Skip to content

Commit

Permalink
DOC: Add examples for periodic ADF/RDF calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas van Beek committed Mar 2, 2021
1 parent f416544 commit 7e3ec6d
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions docs/1_rdf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ oxygen (Cd_Cd, Cd_Se, Cd_O, Se_Se, Se_O and O_O).
# Default weight: np.exp(-r)
>>> rdf = mol.init_rdf(atom_subset=('Cd', 'Se', 'O'))
>>> adf = mol.init_adf(r_max=8, weight=None, atom_subset=('Cd', 'Se'))
>>> adf_weighted = mol.init_adf(r_max=8, atom_subset=('Cd', 'Se'))
>>> adf = mol.init_adf(r_max=8, weight=None, atom_subset=('Cd',))
>>> adf_weighted = mol.init_adf(r_max=8, atom_subset=('Cd',))
>>> rdf.plot(title='RDF')
>>> adf.plot(title='ADF')
Expand All @@ -56,14 +56,36 @@ oxygen (Cd_Cd, Cd_Se, Cd_O, Se_Se, Se_O and O_O).

mol = MultiMolecule.from_xyz(example_xyz)
rdf = mol.init_rdf(atom_subset=('Cd', 'Se', 'O'))
adf = mol.init_adf(r_max=8, weight=None, atom_subset=('Cd', 'Se'))
adf_weighted = mol.init_adf(r_max=8, atom_subset=('Cd', 'Se'))
adf = mol.init_adf(r_max=8, weight=None, atom_subset=('Cd',))
adf_weighted = mol.init_adf(r_max=8, atom_subset=('Cd',))

rdf.plot(title='RDF')
adf.plot(title='ADF')
adf_weighted.plot(title='Distance-weighted ADF')


One can take into account a systems periodicity by settings the molecules'
:attr:`~FOX.MultiMolecule.lattice` vectors and specifying the axes along which
the system is periodic.

The lattice vectors can be provided in one of two formats:

* A :math:`(3, 3)` matrix.
* A :math:`(N_{mol}, 3, 3)`-shaped tensor if they vary across the trajectory.

.. code:: python
>>> from FOX import MultiMolecule
>>> import numpy as np
>>> lattice = np.array(...)
>>> mol = MultiMolecule.from_xyz(...)
>>> mol.lattice = lattice
# Periodic along the x, y and/or z axes
>>> rdf = mol.init_rdf(atom_subset=('Cd', 'Se', 'O'), periodic="xy")
>>> adf = mol.init_adf(r_max=8, atom_subset=('Cd',), periodic="xyz")
API
---
.. automethod:: FOX.MultiMolecule.init_rdf
Expand Down

0 comments on commit 7e3ec6d

Please sign in to comment.