Skip to content

Commit

Permalink
Merge pull request #5 from BvB93/devel
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
BvB93 committed Feb 14, 2019
2 parents 7045a09 + c260b2b commit 1a055c9
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ venv.bak/
# mypy
.mypy_cache/
.DS_Store
docs_out/
30 changes: 17 additions & 13 deletions FOX/functions/radial_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@


def get_all_radial(xyz_array, idx_dict, dr=0.05, r_max=12.0, atoms=None):
""" Return the radial distribution functions (RDF's) for all possible atom-pairs in *atoms*
as dataframe. Accepts both 2d and 3d arrays of cartesian coordinates.
xyz_array <np.ndarray>: A m*n*3 or n*3 numpy array of the cartesian coordinates of m molecules
(isomers) consisting of n atoms.
idx_dict <dict>[<list>]: A dictionary consisting of {atomic symbols: [atomic indices]}.
dr <float>: The integration step-size in Angstrom, i.e. the distance between concentric spheres.
r_max <float>: The maximum to be evaluated interatomic distance.
atoms <None> or <tuple>[<str>]: A tuple of atomic symbols. An RDF will be calculated for all
possible atom-pairs in *atoms*. If *atoms* = <None>, An RDF will be calculated for all
possible atom-pairs in *idx_dict*.keys() (i.e. the entire molecule).
return <pd.DataFrame>: A Pandas dataframe of radial distribution functions, averaged over all
conformations in *xyz_array*.
""" Return the radial distribution functions (RDFs) for all possible atom-pairs in **atoms**
as dataframe. Accepts both 2d and 3d arrays of cartesian coordinates as input.
:parameter xyz_array: A *m*n*3* or *n*3* numpy array with the cartesian coordinates of *m*
molecules consisting of *n* atoms.
:type xyz_array: np.ndarray_
:parameter dict idx_dict: A dictionary consisting with atomic symbols as keys and matching
atomic indices as values (|str|_: |list|_ [|int|_]).
:parameter float dr: The integration step-size in Angstrom, *i.e.* the distance between
concentric spheres.
:parameter float r_max: The maximum to be evaluated interatomic distance.
:parameter atoms: A tuple of atomic symbols. RDFs will be calculated for all
possible atom-pairs in **atoms**. If *None*, calculate RDFs for all possible atom-pairs in
the keys of **idx_dict** (*i.e.* all possible atoms pairs in the molecule).
:type atoms: None or tuple [str]
:return: A dataframe (|pd.DataFrame|_) of radial distribution functions, averaged over all
conformations in **xyz_array**.
"""
# Make sure we're dealing with a 3d array
if len(xyz_array.shape) == 2:
Expand Down
15 changes: 8 additions & 7 deletions FOX/functions/read_xyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@


def read_multi_xyz(xyz_file, ret_idx_dict=True):
""" Return a m*n*3 array of cartesian coordinates extracted from an xyz or multi-xyz file.
""" Reads a (multi) .xyz file and return a *m*n*3* array with the cartesian coordinates of *m*
molecules consisting of *n* atoms.
file <str>: The path + filename of a xyz or multi-xyz file.
ret_idx_dict <bool>: Return a dictionary consisting of {atomic symbols: [atomic indices]} as
derived from the first molecule in *file*.
return <np.ndarray> (and <dict>): A m*n*3 numpy array with the cartesian coordinates of
m molecules (isomers) consisting of n atoms. Optionally, a dictionary can be returned
consisting of {atomic symbols: [atomic indices]}.
:parameter str file: The path + filename of a xyz or multi-xyz file.
:parameter bool ret_idx_dict: In addition to returning cartesian coordinates, return a
dictionary with atomic symbols and matching atomic indices.
:return: A *m*n*3* array (|np.ndarray|_) of cartesian coordinates and, optionally, a dictionary
(|dict|_) with atomic symbols as keys and atomic indices as
values (|str|_: |list|_ [|int|_]).
"""
with open(xyz_file, 'r') as file:
# Define constants and construct a dictionary: {atomic symbols: [atomic indices]}
Expand Down
197 changes: 186 additions & 11 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,195 @@
# Minimal makefile for Sphinx documentation
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = Auto-FOX
SOURCEDIR = .
BUILDDIR = _build
PAPER =
BUILDDIR = build
PDFBUILDER = /tmp
PDF = ../manual.pdf

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"

clean:
rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/qmflows.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/qmflows.qhc"

applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/qmflows"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/qmflows"
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(PDFBUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(PDFBUILDDIR)/latex all-pdf
cp $(PDFBUILDDIR)/latex/*.pdf $(PDF)
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."

man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."

info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."

gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."

.PHONY: help Makefile
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
13 changes: 12 additions & 1 deletion docs/rdf.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
Radial Distribution Function Generator
======================================

A radial distribution function (RDF) generator reader has been implemented in the FOX.functions.radial_distribution_ module.
A radial distribution function (RDF) generator has been implemented in the FOX.functions.radial_distribution_ module.
The radial distribution function, or pair correlation function, describes how the particale density in a system varies as a function of distance from a reference particle.
The herein implemented get_all_radial() function is designed for constructing RDFs between all possible (user-defined) atom-pairs.

.. autofunction:: FOX.functions.radial_distribution.get_all_radial

.. _FOX.functions.radial_distribution: https://github.com/BvB93/auto-FOX/tree/master/FOX/functions

.. _np.ndarray: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html
.. _pd.DataFrame: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html
.. _str: https://docs.python.org/3/library/stdtypes.html#str
.. _list: https://docs.python.org/3/library/stdtypes.html#list
.. _int: https://docs.python.org/3/library/functions.html#int

.. |pd.DataFrame| replace:: *pd.DataFrame*
.. |str| replace:: *str*
.. |list| replace:: *list*
.. |int| replace:: *int*
11 changes: 11 additions & 0 deletions docs/xyz_reader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ The herein implemented read_multi_xyz() function allows for the fast, and memory
.. autofunction:: FOX.functions.read_xyz.read_multi_xyz

.. _FOX.functions.read_xyz: https://github.com/BvB93/auto-FOX/tree/master/FOX/functions
.. _np.ndarray: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html
.. _dict: https://docs.python.org/3/library/stdtypes.html#dict
.. _str: https://docs.python.org/3/library/stdtypes.html#str
.. _list: https://docs.python.org/3/library/stdtypes.html#list
.. _int: https://docs.python.org/3/library/functions.html#int

.. |np.ndarray| replace:: *np.ndarray*
.. |dict| replace:: *dict*
.. |str| replace:: *str*
.. |list| replace:: *list*
.. |int| replace:: *int*
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
long_description=readme + '\n\n',
author='Bas van Beek',
author_email='b.f.van.beek@vu.nl',
url='https://github.com//Auto-FOX',
url='https://github.com/BvB93/Auto-FOX',
packages=['FOX'],
package_dir={'FOX': 'FOX'},
include_package_data=True,
Expand Down

0 comments on commit 1a055c9

Please sign in to comment.