Skip to content

Commit

Permalink
Some docs improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCentauri committed Dec 1, 2023
1 parent aa71937 commit fceaf42
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 8 deletions.
13 changes: 13 additions & 0 deletions docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@
"reference_url": {"meshlode": None},
"prefer_full_module": ["meshlode"],
}

autoclass_content = "both"
autodoc_member_order = "bysource"
autodoc_typehints = "both"
autodoc_typehints_format = "short"

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"torch": ("https://pytorch.org/docs/stable/", None),
"metatensor": ("https://lab-cosmo.github.io/metatensor/latest/", None),
}

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
1 change: 1 addition & 0 deletions docs/src/references/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ functions toegther you might take a look at the :ref:`userdoc-how-to` section.
calculators/index
fourier_convolution
mesh_interpolator
system
4 changes: 4 additions & 0 deletions docs/src/references/system.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: meshlode.system
:members:
:undoc-members:
:show-inheritance:
4 changes: 2 additions & 2 deletions docs/src/sg_execution_times.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Computation times
=================
**00:00.001** total execution time for 1 file **from all galleries**:
**00:00.000** total execution time for 1 file **from all galleries**:

.. container::

Expand All @@ -33,5 +33,5 @@ Computation times
- Time
- Mem (MB)
* - :ref:`sphx_glr_examples_madelung.py` (``../../examples/madelung.py``)
- 00:00.001
- 00:00.000
- 0.0
27 changes: 21 additions & 6 deletions src/meshlode/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MeshPotential(torch.nn.Module):
that will be used along each axis.
:param interpolation_order: Interpolation order for mapping onto the grid, where an
interpolation order of p corresponds to interpolation by a polynomial of degree
p-1 (e.g. p=4 for cubic interpolation).
``p-1`` (e.g. ``p=4`` for cubic interpolation).
:param subtract_self: bool. If set to true, subtract from the features of an atom
the contributions to the potential arising from that atom itself (but not the
periodic images).
Expand All @@ -47,19 +47,35 @@ class MeshPotential(torch.nn.Module):
>>> import torch
>>> from meshlode import MeshPotential, System
>>> # Define simple example structure having the CsCl structure
Define simple example structure having the CsCl structure
>>> positions = torch.tensor([[0, 0, 0], [0.5, 0.5, 0.5]])
>>> atomic_numbers = torch.tensor([55, 17]) # Cs and Cl
>>> frame = System(species=atomic_numbers, positions=positions, cell=torch.eye(3))
>>> # Compute features
Compute features
>>> MP = MeshPotential(
... atomic_gaussian_width=0.2, mesh_spacing=0.1, interpolation_order=4
... )
>>> features = MP.compute(frame)
>>> keys = features.keys # print to see all species combinations
All species combinations
>>> features.keys
Labels(
species_center species_neighbor
17 17
17 55
55 17
55 55
)
>>> block_ClCl = features.block({"species_center": 17, "species_neighbor": 17})
>>> values = block_ClCl.values # the Cl-potential at the position of the Cl atom
The Cl-potential at the position of the Cl atom
>>> block_ClCl.values
tensor([[1.3755]])
"""

Expand Down Expand Up @@ -91,7 +107,6 @@ def forward(
return res
# return 0.

# @torch.jit.export
def compute(
self,
frames: Union[List[System], System],
Expand Down

0 comments on commit fceaf42

Please sign in to comment.