Skip to content

Commit

Permalink
DOC: incomplete autodocumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentRDC committed Dec 30, 2020
1 parent 4d69564 commit ad51fc9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
6 changes: 3 additions & 3 deletions crystals/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Element:
Parameters
----------
element : str, int, or Element
element : str, int, or :class:`Element`
Elemental symbol (e.g. "He"), element name (e.g. "Helium"),
atomic number, or another `Element` instance.
Expand Down Expand Up @@ -336,7 +336,7 @@ def distance_fractional(atm1, atm2):
Parameters
----------
atm1, atm2 : ``crystals.Atom``
atm1, atm2 : :class:`Atom`
Returns
-------
Expand All @@ -361,7 +361,7 @@ def distance_cartesian(atm1, atm2):
Parameters
----------
atm1, atm2 : ``crystals.Atom``
atm1, atm2 : :class:`Atom`
Returns
-------
Expand Down
44 changes: 22 additions & 22 deletions crystals/crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@
class Crystal(AtomicStructure, Lattice):
"""
The :class:`Crystal` class is a set-like container that represent
crystalline structures. In addition to constructing the ``Crystal``
crystalline structures. In addition to constructing the :class:`Crystal`
object yourself, other constructors are also available
(and preferred):
* ``Crystal.from_cif``: create an instance from a CIF file;
* :meth:`Crystal.from_cif`: create an instance from a CIF file;
* ``Crystal.from_pdb``: create an instance from a Protein Data Bank entry;
* :meth:`Crystal.from_pdb`: create an instance from a Protein Data Bank entry;
* ``Crystal.from_database``: create an instance from the internal database of CIF files;
* :meth:`Crystal.from_database`: create an instance from the internal database of CIF files;
* ``Crystal.from_cod``: create an instance from a Crystallography Open Database entry.
* :meth:`Crystal.from_cod`: create an instance from a Crystallography Open Database entry.
* ``Crystal.from_mp``: create an instance from the Materials Project database.
* :meth:`Crystal.from_mp`: create an instance from the Materials Project database.
* ``Crystal.from_pwscf``: create an instance from the output of the PWSCF program.
* :meth:`Crystal.from_pwscf`: create an instance from the output of the PWSCF program.
* ``Crystal.from_ase``: create an instance from an ``ase.Atoms`` instance.
* :meth:`Crystal.from_ase`: create an instance from an ``ase.Atoms`` instance.
Parameters
----------
unitcell : iterable of ``Atom`` or ``AtomicStructures``
unitcell : iterable of :class:`Atom` or :class:`AtomicStructure`
Unit cell atoms or substructures. It is assumed that the atoms are
in fractional coordinates.
lattice_vectors : iterable of array_like
Expand Down Expand Up @@ -602,13 +602,13 @@ def indexed_by(self, lattice):
Parameters
----------
lattice : Crystal, Lattice, or array_like, shape (3,3)
lattice : :class:`Crystal`, :class:`Lattice`, or array_like, shape (3,3)
Lattice or Crystal by which to index the structure. ``lattice`` can also be a 3x3 array,
where every row is a lattice vector.
Returns
-------
crystal : Crystal
crystal : :class:`Crystal`
New crystal, indexed by ``lattice``.
"""
# TODO: example
Expand Down Expand Up @@ -673,7 +673,7 @@ def _to_string(self, natoms):

def to_cif(self, filename):
"""
Convert this `Crystal` instance to a CIF file.
Convert this :class:`Crystal` instance to a CIF file.
Note that some information may be lost in the translation. However, we guarantee that
reading a structure from a file, and then writing back to the same format is idempotent.
Expand All @@ -692,7 +692,7 @@ def to_cif(self, filename):

def to_xyz(self, filename):
"""
Convert this `Crystal` instance to a XYZ file.
Convert this :class:`Crystal` instance to a XYZ file.
Note that some information may be lost in the translation. However, we guarantee that
reading a structure from a file, and then writing back to the same format is idempotent.
Expand All @@ -711,8 +711,8 @@ def to_xyz(self, filename):

def to_ase(self, **kwargs):
"""
Convert a into an ``ase.Atoms`` object. Keyword arguments are passed
to ``ase.Atoms`` constructor.
Convert a into an :class:`ase.Atoms` object. Keyword arguments are passed
to :class:`ase.Atoms` constructor.
Note that some information may be lost in the translation. However, we guarantee that
reading a structure from a file, and then writing back to the same format is idempotent.
Expand Down Expand Up @@ -740,10 +740,10 @@ class Supercell(AtomicStructure):
supercell of crystalline structures.
It is recommended that you do not instantiate a :class:`Supercell` by hand, but rather
create a ``Crystal`` object and use the ``Crystal.supercell`` method.
create a :class:`Crystal` object and use the :meth:`Crystal.supercell` method.
To iterate over all atoms in the supercell, use this object as an iterable.
To recover the underlying crystal, use the ``Supercell.crystal`` attribute.
To recover the underlying crystal, use the :attr:`Supercell.crystal` attribute.
Parameters
----------
Expand Down Expand Up @@ -818,17 +818,17 @@ def symmetry_expansion(atoms, symmetry_operators):
Parameters
----------
atoms : iterable of ``Atom`` and/or ``AtomicStructure``
atoms : iterable of :class:`Atom` and/or :class:`AtomicStructure`
Asymmetric unit cell atoms. It is assumed that the atomic
coordinates are in fractional form. Transformations work
the same way for ``Atom`` objects and ``AtomicStructures``
the same way for :class:`Atom` objects and :class:`AtomicStructure`
objects: a copy is made and moved to the symmetric location.
symmetry_operators : iterable of array_like
Symmetry operators that generate the full unit cell.
Yields
------
it : ``Atom`` and/or ``AtomicStructure``
it : :class:`Atom` and/or :class:`AtomicStructure`
Appropriately-transformed object. Original objects are left untouched.
See Also
Expand Down Expand Up @@ -882,15 +882,15 @@ def symmetry_reduction(unitcell, symmetry_operators):
Parameters
----------
unitcell : iterable of ``Atom`` and/or ``AtomicStructure``
unitcell : iterable of :class:`Atom` and/or :class:`AtomicStructure`
Unit cell. It is assumed that the atomic
coordinates are in fractional form.
symmetry_operators : iterable of array_like
Symmetry operators that generate the full unit cell.
Returns
-------
asym_cell: set of ``Atom`` and/or ``AtomicStructure``
asym_cell: set of :class:`Atom` and/or :class:`AtomicStructure`
Asymmetric cell.
See Also
Expand Down
6 changes: 3 additions & 3 deletions crystals/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ def write_cif(crystal, fname):

def ase_atoms(crystal, **kwargs):
"""
Convert a ``crystals.Crystal`` object into an ``ase.Atoms`` object.
Keyword arguments are passed to ``ase.Atoms`` constructor.
Convert a :class:`crystals.Crystal` object into an :class:`ase.Atoms` object.
Keyword arguments are passed to :class:`ase.Atoms` constructor.
Parameters
----------
crystal : crystals.Crystal
crystal : :class:`Crystal`
Crystal to be converted.
Returns
Expand Down
5 changes: 4 additions & 1 deletion docs/api/base-classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ Lattice
-------

.. autoclass:: Lattice
:members:

---------------
AtomicStructure
---------------

.. autoclass:: AtomicStructure
.. autoclass:: AtomicStructure
:members:
:private-members:
4 changes: 4 additions & 0 deletions docs/api/data-structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Crystal

.. autoclass:: Crystal
:show-inheritance:
:members:
:exclude-members: from_parameters

---------
Expand All @@ -23,6 +24,7 @@ Supercell

.. autoclass:: Supercell
:show-inheritance:
:members:
:exclude-members: from_parameters

----
Expand All @@ -33,6 +35,7 @@ To deal with atoms with coordinates, take a look at the :class:`Atom` class:

.. autoclass:: Atom
:show-inheritance:
:members:

-------
Element
Expand All @@ -42,6 +45,7 @@ To access atomic data only, take a look at the :class:`Element` class:

.. autoclass:: Element
:show-inheritance:
:members:

-------------------
Electronic Orbitals
Expand Down

0 comments on commit ad51fc9

Please sign in to comment.