From 9d94241b9b0615ad709d52c777f085038501b5e5 Mon Sep 17 00:00:00 2001 From: Philip Loche Date: Mon, 12 Aug 2024 09:14:36 +0200 Subject: [PATCH] rename package to torch-pme --- .github/workflows/documentation-links.yml | 2 +- LICENSE | 2 +- README.rst | 56 +++++++++++++------ docs/src/conf.py | 8 +-- docs/src/index.rst | 8 ++- docs/src/references/base.rst | 4 +- .../calculators/directpotential.rst | 2 +- .../references/calculators/ewaldpotential.rst | 2 +- docs/src/references/calculators/index.rst | 19 ++++++- .../references/calculators/pmepotential.rst | 2 +- docs/src/references/index.rst | 5 +- .../references/lib/fourier_convolution.rst | 2 +- docs/src/references/lib/kvectors.rst | 2 +- docs/src/references/lib/mesh_interpolator.rst | 2 +- .../references/metatensor/directpotential.rst | 2 +- .../references/metatensor/ewaldpotential.rst | 2 +- docs/src/references/metatensor/index.rst | 5 +- .../references/metatensor/pmepotential.rst | 2 +- examples/README.rst | 2 +- examples/charges_example.py | 6 +- examples/library-tutorial.py | 10 ++-- pyproject.toml | 47 ++++++++++------ src/{meshlode => torchpme}/__init__.py | 0 .../calculators/__init__.py | 0 .../calculators/base.py | 2 +- .../calculators/directpotential.py | 2 +- .../calculators/ewaldpotential.py | 2 +- .../calculators/pmepotential.py | 0 src/{meshlode => torchpme}/lib/__init__.py | 0 .../lib/fourier_convolution.py | 0 src/{meshlode => torchpme}/lib/kvectors.py | 0 .../lib/mesh_interpolator.py | 0 src/{meshlode => torchpme}/lib/potentials.py | 0 .../metatensor/__init__.py | 0 src/{meshlode => torchpme}/metatensor/base.py | 2 +- .../metatensor/directpotential.py | 2 +- .../metatensor/ewaldpotential.py | 4 +- .../metatensor/pmepotential.py | 2 +- tests/calculators/test_base.py | 2 +- tests/calculators/test_values_aperiodic.py | 2 +- tests/calculators/test_values_periodic.py | 6 +- tests/calculators/test_workflow.py | 2 +- tests/lib/test_fourier_convolution.py | 2 +- tests/lib/test_kvectors.py | 2 +- tests/lib/test_mesh_interpolator.py | 2 +- tests/lib/test_potentials.py | 2 +- tests/metatensor/test_base_metatensor.py | 4 +- tests/metatensor/test_workflow_metatensor.py | 8 +-- tests/test_init.py | 4 +- tox.ini | 2 +- 50 files changed, 147 insertions(+), 99 deletions(-) rename src/{meshlode => torchpme}/__init__.py (100%) rename src/{meshlode => torchpme}/calculators/__init__.py (100%) rename src/{meshlode => torchpme}/calculators/base.py (99%) rename src/{meshlode => torchpme}/calculators/directpotential.py (98%) rename src/{meshlode => torchpme}/calculators/ewaldpotential.py (99%) rename src/{meshlode => torchpme}/calculators/pmepotential.py (100%) rename src/{meshlode => torchpme}/lib/__init__.py (100%) rename src/{meshlode => torchpme}/lib/fourier_convolution.py (100%) rename src/{meshlode => torchpme}/lib/kvectors.py (100%) rename src/{meshlode => torchpme}/lib/mesh_interpolator.py (100%) rename src/{meshlode => torchpme}/lib/potentials.py (100%) rename src/{meshlode => torchpme}/metatensor/__init__.py (100%) rename src/{meshlode => torchpme}/metatensor/base.py (99%) rename src/{meshlode => torchpme}/metatensor/directpotential.py (96%) rename src/{meshlode => torchpme}/metatensor/ewaldpotential.py (89%) rename src/{meshlode => torchpme}/metatensor/pmepotential.py (98%) diff --git a/.github/workflows/documentation-links.yml b/.github/workflows/documentation-links.yml index 5aa6c730..7554fc4b 100644 --- a/.github/workflows/documentation-links.yml +++ b/.github/workflows/documentation-links.yml @@ -14,4 +14,4 @@ jobs: steps: - uses: readthedocs/actions/preview@v1 with: - project-slug: meshlode + project-slug: torch-pme diff --git a/LICENSE b/LICENSE index e32d7172..4d2a3554 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 MeshLODE contributors +Copyright (c) 2024 torch-pme contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.rst b/README.rst index c433c6de..b4f53d83 100644 --- a/README.rst +++ b/README.rst @@ -1,29 +1,47 @@ -MeshLODE +torch-pme ======== + |tests| |codecov| |docs| -Particle-mesh based calculation of Long Distance Equivariants. +.. marker-introduction + +``torch-pme`` enables efficient, auto-differentiable computation of long-range +interactions in PyTorch. Auto-differentiation is supported for particle *positions*, +*charges*, and *cell* parameters, allowing not only the automatic computation of forces +but also enabling applications in machine learning tasks. The library offers classes for +Particle Mesh Ewald (``PME``), standard ``Ewald``, and non-periodic ``direct`` methods, +with the flexibility to calculate potentials beyond :math:`1/r` electrostatics, +including arbitrary order :math:`1/r^p` potentials. + +Optimized for both CPU and GPU devices, torch-pme is fully `TorchScriptable`_, allowing +it to be converted into a format that runs independently of Python, such as in C++, +making it ideal for high-performance production environments. + +.. _`TorchScriptable`: https://pytorch.org/docs/stable/jit.html + +.. marker-documentation For details, tutorials, and examples, please have a look at our `documentation`_. -.. _`documentation`: https://lab-cosmo.github.io/MeshLODE/latest +.. _`documentation`: https://lab-cosmo.github.io/torch-pme/latest .. marker-installation Installation ------------ -You can install *MeshLode* using pip with + +You can install *torch-pme* using pip with .. code-block:: bash - git clone https://github.com/lab-cosmo/MeshLODE - cd MeshLODE + git clone https://github.com/lab-cosmo/torch-pme + cd torch-pme pip install . -You can then ``import meshlode`` and use it in your projects! +You can then ``import torchpme`` and use it in your projects! We also provide bindings to `metatensor `_ which -can optionally be installed together and used as ``meshlode.metatensor`` via +can optionally be installed together and used as ``torchpme.metatensor`` via .. code-block:: bash @@ -33,28 +51,30 @@ can optionally be installed together and used as ``meshlode.metatensor`` via Having problems or ideas? ------------------------- -Having a problem with MeshLODE? Please let us know by `submitting an issue -`_. + +Having a problem with torch-pme? Please let us know by `submitting an issue +`_. Submit new features or bug fixes through a `pull request -`_. +`_. .. marker-contributing Contributors ------------ -Thanks goes to all people that make MeshLODE possible: -.. image:: https://contrib.rocks/image?repo=lab-cosmo/MeshLODE - :target: https://github.com/lab-cosmo/MeshLODE/graphs/contributors +Thanks goes to all people that make torch-pme possible: + +.. image:: https://contrib.rocks/image?repo=lab-cosmo/torch-pme + :target: https://github.com/lab-cosmo/torch-pme/graphs/contributors -.. |tests| image:: https://github.com/lab-cosmo/MeshLODE/workflows/Tests/badge.svg +.. |tests| image:: https://github.com/lab-cosmo/torch-pme/workflows/Tests/badge.svg :alt: Github Actions Tests Job Status - :target: https://github.com/lab-cosmo/MeshLODE/actions?query=workflow%3ATests + :target: https://github.com/lab-cosmo/torch-pme/actions?query=workflow%3ATests -.. |codecov| image:: https://codecov.io/gh/lab-cosmo/MeshLODE/graph/badge.svg?token=srVKRy7r6m +.. |codecov| image:: https://codecov.io/gh/lab-cosmo/torch-pme/graph/badge.svg?token=srVKRy7r6m :alt: Code coverage - :target: https://codecov.io/gh/lab-cosmo/MeshLODE + :target: https://codecov.io/gh/lab-cosmo/torch-pme .. |docs| image:: https://img.shields.io/badge/documentation-latest-sucess :alt: Documentation diff --git a/docs/src/conf.py b/docs/src/conf.py index 6af8e2eb..6a4c7877 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -4,7 +4,7 @@ import tomli # Replace by tomllib from std library once docs are build with Python 3.11 -import meshlode +import torchpme ROOT = os.path.abspath(os.path.join("..", "..")) @@ -24,7 +24,7 @@ copyright = f"{datetime.now().date().year}, {author}" # The full version, including alpha/beta/rc tags -release = meshlode.__version__ +release = torchpme.__version__ # -- General configuration --------------------------------------------------- @@ -45,8 +45,8 @@ "examples_dirs": ["../../examples"], "gallery_dirs": ["examples"], "min_reported_time": 60, - "reference_url": {"meshlode": None}, - "prefer_full_module": ["meshlode"], + "reference_url": {"torchpme": None}, + "prefer_full_module": ["torchpme"], } autoclass_content = "both" diff --git a/docs/src/index.rst b/docs/src/index.rst index c83141ce..ee5ae8d3 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -1,7 +1,9 @@ -MeshLODE -######## +torch-pme +######### -Particle-mesh based calculation of Long Distance Equivariants. +.. include:: ../../README.rst + :start-after: marker-introduction + :end-before: marker-documentation .. toctree:: :hidden: diff --git a/docs/src/references/base.rst b/docs/src/references/base.rst index 100c0fcd..01a50b82 100644 --- a/docs/src/references/base.rst +++ b/docs/src/references/base.rst @@ -5,10 +5,10 @@ Base classes General Base classes all calculators build on top. -.. automodule:: meshlode.calculators.base +.. automodule:: torchpme.calculators.base :members: :undoc-members: -.. automodule:: meshlode.metatensor.base +.. automodule:: torchpme.metatensor.base :members: :undoc-members: diff --git a/docs/src/references/calculators/directpotential.rst b/docs/src/references/calculators/directpotential.rst index 748d531f..2a9b335c 100644 --- a/docs/src/references/calculators/directpotential.rst +++ b/docs/src/references/calculators/directpotential.rst @@ -1,6 +1,6 @@ DirectPotential ############### -.. autoclass:: meshlode.DirectPotential +.. autoclass:: torchpme.DirectPotential :members: :undoc-members: diff --git a/docs/src/references/calculators/ewaldpotential.rst b/docs/src/references/calculators/ewaldpotential.rst index a58fc588..3446d364 100644 --- a/docs/src/references/calculators/ewaldpotential.rst +++ b/docs/src/references/calculators/ewaldpotential.rst @@ -1,6 +1,6 @@ EwaldPotential ############## -.. autoclass:: meshlode.EwaldPotential +.. autoclass:: torchpme.EwaldPotential :members: :undoc-members: diff --git a/docs/src/references/calculators/index.rst b/docs/src/references/calculators/index.rst index 9a40532d..354fda42 100644 --- a/docs/src/references/calculators/index.rst +++ b/docs/src/references/calculators/index.rst @@ -3,9 +3,9 @@ Calculators ########### -Below is a list of all calculators available. Calculators are the core of MeshLODE and -are algorithms for transforming Cartesian coordinates into representations suitable for -machine learning. +Below is a list of all calculators available. Calculators are the core of ``torch-pme`` +and are algorithms for transforming Cartesian coordinates into representations suitable +for machine learning. Our calculator API follows the `rascaline `_ API and coding guidelines to promote usability and interoperability with existing workflows. @@ -14,6 +14,19 @@ Calculators return the representations as a :py:obj:`List` of :py:class:`torch.T We also provide a return values as a :py:class:`metatensor.TensorMap` in :ref:`metatensor`. +.. note:: + + All calculators compute the potential, from which the "atom-wise" energy :math:`E` + can be determined by multiplying the potential :math:`V_i` with the charges :math:`q` + and dividing by 2. + + .. math:: + + E = \frac{1}{2} q_i \cdot V_i + +Implemented Calculators +----------------------- + .. toctree:: :maxdepth: 1 :glob: diff --git a/docs/src/references/calculators/pmepotential.rst b/docs/src/references/calculators/pmepotential.rst index bb77c10a..8867abeb 100644 --- a/docs/src/references/calculators/pmepotential.rst +++ b/docs/src/references/calculators/pmepotential.rst @@ -1,6 +1,6 @@ PMEPotential ############ -.. autoclass:: meshlode.PMEPotential +.. autoclass:: torchpme.PMEPotential :members: :undoc-members: diff --git a/docs/src/references/index.rst b/docs/src/references/index.rst index bd7257cc..2d213f06 100644 --- a/docs/src/references/index.rst +++ b/docs/src/references/index.rst @@ -3,10 +3,9 @@ API reference ============= -The main references for public functions and classes inside ``MeshLODE``. Most of the +The main references for public functions and classes inside ``torch-pme``. Most of the function contain a little example. If you are looking for recipes how to stack the -functions toegther you might take a look at the :ref:`userdoc-how-to` section. - +functions together you might take a look at the :ref:`userdoc-how-to` section. .. toctree:: :maxdepth: 1 diff --git a/docs/src/references/lib/fourier_convolution.rst b/docs/src/references/lib/fourier_convolution.rst index a13940a8..8760220b 100644 --- a/docs/src/references/lib/fourier_convolution.rst +++ b/docs/src/references/lib/fourier_convolution.rst @@ -1,6 +1,6 @@ Fourier Convolution =================== -.. autoclass:: meshlode.lib.FourierSpaceConvolution +.. autoclass:: torchpme.lib.FourierSpaceConvolution :members: :undoc-members: diff --git a/docs/src/references/lib/kvectors.rst b/docs/src/references/lib/kvectors.rst index 8cd041b2..10ed82d2 100644 --- a/docs/src/references/lib/kvectors.rst +++ b/docs/src/references/lib/kvectors.rst @@ -1,6 +1,6 @@ Kvectors ======== -.. automodule:: meshlode.lib.kvectors +.. automodule:: torchpme.lib.kvectors :members: :undoc-members: diff --git a/docs/src/references/lib/mesh_interpolator.rst b/docs/src/references/lib/mesh_interpolator.rst index c159248a..b8998f43 100644 --- a/docs/src/references/lib/mesh_interpolator.rst +++ b/docs/src/references/lib/mesh_interpolator.rst @@ -1,6 +1,6 @@ Mesh Interpolator ================= -.. autoclass:: meshlode.lib.MeshInterpolator +.. autoclass:: torchpme.lib.MeshInterpolator :members: :undoc-members: diff --git a/docs/src/references/metatensor/directpotential.rst b/docs/src/references/metatensor/directpotential.rst index 7c98eacf..9b5b820c 100644 --- a/docs/src/references/metatensor/directpotential.rst +++ b/docs/src/references/metatensor/directpotential.rst @@ -1,6 +1,6 @@ DirectPotential ############### -.. autoclass:: meshlode.metatensor.DirectPotential +.. autoclass:: torchpme.metatensor.DirectPotential :members: compute, forward :undoc-members: diff --git a/docs/src/references/metatensor/ewaldpotential.rst b/docs/src/references/metatensor/ewaldpotential.rst index 17abbb9c..c46c5cb0 100644 --- a/docs/src/references/metatensor/ewaldpotential.rst +++ b/docs/src/references/metatensor/ewaldpotential.rst @@ -1,6 +1,6 @@ EwaldPotential ############## -.. autoclass:: meshlode.metatensor.EwaldPotential +.. autoclass:: torchpme.metatensor.EwaldPotential :members: compute, forward :undoc-members: diff --git a/docs/src/references/metatensor/index.rst b/docs/src/references/metatensor/index.rst index be0032e3..42f10ff4 100644 --- a/docs/src/references/metatensor/index.rst +++ b/docs/src/references/metatensor/index.rst @@ -3,7 +3,7 @@ Metatensor Bindings ################### -MeshLODE calculators returning representations as :py:class:`metatensor.TensorMap`. +torch-pme calculators returning representations as :py:class:`metatensor.TensorMap`. For using these bindings you need to install the ``metatensor.torch`` optional dependencies. @@ -13,6 +13,9 @@ dependencies. For a plain :py:class:`torch.Tensor` refer to :ref:`calculators`. +Implemented Calculators +----------------------- + .. toctree:: :maxdepth: 1 :glob: diff --git a/docs/src/references/metatensor/pmepotential.rst b/docs/src/references/metatensor/pmepotential.rst index 9b3b4fa2..555c933f 100644 --- a/docs/src/references/metatensor/pmepotential.rst +++ b/docs/src/references/metatensor/pmepotential.rst @@ -1,6 +1,6 @@ PMEPotential ############ -.. autoclass:: meshlode.metatensor.PMEPotential +.. autoclass:: torchpme.metatensor.PMEPotential :members: compute, forward :undoc-members: diff --git a/examples/README.rst b/examples/README.rst index 37a7675b..50d0e669 100644 --- a/examples/README.rst +++ b/examples/README.rst @@ -4,7 +4,7 @@ Examples ======== This section list introductory examples and recipes to the various classes and functions -of ``MeshLODE``. For details on the API specification of the functions take a look at +of ``torch-pme``. For details on the API specification of the functions take a look at the :ref:`userdoc-reference` section. For running the all examples install with the ``examples`` and ``metatensor`` optional diff --git a/examples/charges_example.py b/examples/charges_example.py index 37cd2c69..5b7380f8 100644 --- a/examples/charges_example.py +++ b/examples/charges_example.py @@ -31,7 +31,7 @@ from metatensor.torch.atomistic import NeighborListOptions, System from vesin import NeighborList -import meshlode +import torchpme # %% @@ -67,7 +67,7 @@ # *1* for electrostatic interactions between the two atoms. This calculator # will be used to *compute* the potential energy of the system. -calculator = meshlode.PMEPotential(exponent=1.0) +calculator = torchpme.PMEPotential(exponent=1.0) # %% # Single Charge Channel @@ -158,7 +158,7 @@ # Next, we will perform the same exercise with the Metatensor interface. This involves # creating a new calculator with the metatensor interface. -calculator_metatensor = meshlode.metatensor.PMEPotential(exponent=1.0) +calculator_metatensor = torchpme.metatensor.PMEPotential(exponent=1.0) # %% # Computation with metatensor involves using Metatensor's :py:class:`System diff --git a/examples/library-tutorial.py b/examples/library-tutorial.py index 014d247c..985ccd43 100644 --- a/examples/library-tutorial.py +++ b/examples/library-tutorial.py @@ -2,7 +2,7 @@ Basic Tutorial for Library functions ==================================== This examples provides an illustration of the functioning of the underlaying library -functions of ``meshlode`` and the construction LODE descriptors (`Grisafi 2019 +functions of ``torchpme`` and the construction LODE descriptors (`Grisafi 2019 `__, `Grisafi 2021 `__, `Huguenin 2023 <10.1021/acs.jpclett.3c02375>`__). It builds the (simple and weighted) atom density for @@ -19,7 +19,7 @@ import torch from metatensor.torch.atomistic import System -import meshlode +import torchpme torch.set_default_dtype(torch.float64) @@ -90,7 +90,7 @@ def sliceplot(mesh, sz=12, cmap="viridis", vmin=None, vmax=None): # list of atom weights to yield the mesh values. # -interpol = meshlode.lib.mesh_interpolator.MeshInterpolator( +interpol = torchpme.lib.mesh_interpolator.MeshInterpolator( system.cell, torch.tensor([16, 16, 16]), interpolation_order=3 ) @@ -127,7 +127,7 @@ def sliceplot(mesh, sz=12, cmap="viridis", vmin=None, vmax=None): # be easily extended to compute an arbitrary filter # -fsc = meshlode.lib.fourier_convolution.FourierSpaceConvolution() +fsc = torchpme.lib.fourier_convolution.FourierSpaceConvolution() # %% # plain atomic_smearing @@ -167,7 +167,7 @@ def sliceplot(mesh, sz=12, cmap="viridis", vmin=None, vmax=None): # ``interpolation_order``, if wanted. # -interpol_slice = meshlode.lib.mesh_interpolator.MeshInterpolator( +interpol_slice = torchpme.lib.mesh_interpolator.MeshInterpolator( system.cell, torch.tensor([16, 16, 16]), interpolation_order=4 ) diff --git a/pyproject.toml b/pyproject.toml index 6c1ad452..13b9cd12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,32 +6,43 @@ requires = [ build-backend = "setuptools.build_meta" [project] -name = "MeshLODE" -description = "Particle-mesh based calculation of Long Distance Equivariants" -authors = [ - {name = "Melika Honarmand"}, - {name = "Kevin Kazuki Huguenin-Dumittan"}, - {name = "Philip Loche"}, - {name = "Michele Ceriotti"}, -] +name = "torch-pme" +description = "Particle-mesh based calculations of long-range interactions in PyTorch" +authors = [{name = "torch-pme developers"}] + readme = "README.rst" requires-python = ">=3.9" license = {text = "BSD-3-Clause"} classifiers = [ "Development Status :: 4 - Beta", - "Environment :: Console", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: POSIX", "Operating System :: MacOS :: MacOS X", - "Programming Language :: Python :: 3", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Scientific/Engineering :: Chemistry", + "Topic :: Scientific/Engineering :: Mathematics", + "Framework :: PyTorch", ] keywords = [ + "PyTorch", + "Auto-differentiation", + "Particle-Mesh Ewald", "Electrostatics", "Computational Materials Science", - "Atomistic Simulations", + "Machine Learning", + "Molecular Dynamics", + "GPU Acceleration", + "High-Performance Computing", + "Fourier Transform", + "TorchScript", + "Scientific Computing", ] dependencies = [ "torch >=1.11", @@ -50,15 +61,15 @@ metatensor = [ ] [project.urls] -homepage = "http://meshlode.readthedocs.io" -documentation = "http://meshlode.readthedocs.io" -repository = "https://github.com/lab-cosmo/MeshLODE" -issues = "https://github.com/lab-cosmo/MeshLODE/issues" +homepage = "http://torch-pme.readthedocs.io" +documentation = "http://torch-pme.readthedocs.io" +repository = "https://github.com/lab-cosmo/torch-pme" +issues = "https://github.com/lab-cosmo/torch-pme/issues" [tool.coverage.report] show_missing = true include = [ - "src/meshlode/*" + "src/torchpme/*" ] [tool.coverage.run] @@ -78,7 +89,7 @@ line_length = 88 indent = 4 include_trailing_comma = true lines_after_imports = 2 -known_first_party = "meshlode" +known_first_party = "torchpme" [tool.mypy] exclude = [ @@ -102,4 +113,4 @@ filterwarnings = [ where = ["src"] [tool.setuptools.dynamic] -version = {attr = "meshlode.__version__"} +version = {attr = "torchpme.__version__"} diff --git a/src/meshlode/__init__.py b/src/torchpme/__init__.py similarity index 100% rename from src/meshlode/__init__.py rename to src/torchpme/__init__.py diff --git a/src/meshlode/calculators/__init__.py b/src/torchpme/calculators/__init__.py similarity index 100% rename from src/meshlode/calculators/__init__.py rename to src/torchpme/calculators/__init__.py diff --git a/src/meshlode/calculators/base.py b/src/torchpme/calculators/base.py similarity index 99% rename from src/meshlode/calculators/base.py rename to src/torchpme/calculators/base.py index 802febe1..2d971de5 100644 --- a/src/meshlode/calculators/base.py +++ b/src/torchpme/calculators/base.py @@ -2,7 +2,7 @@ import torch -from meshlode.lib import InversePowerLawPotential +from torchpme.lib import InversePowerLawPotential class CalculatorBaseTorch(torch.nn.Module): diff --git a/src/meshlode/calculators/directpotential.py b/src/torchpme/calculators/directpotential.py similarity index 98% rename from src/meshlode/calculators/directpotential.py rename to src/torchpme/calculators/directpotential.py index c09f05b9..15c667a8 100644 --- a/src/meshlode/calculators/directpotential.py +++ b/src/torchpme/calculators/directpotential.py @@ -114,7 +114,7 @@ def compute( neighbor_shifts=None, ) - # This function is kept to keep MeshLODE compatible with the broader pytorch + # This function is kept to keep torch-pme compatible with the broader pytorch # infrastructure, which require a "forward" function. We name this function # "compute" instead, for compatibility with other COSMO software. def forward( diff --git a/src/meshlode/calculators/ewaldpotential.py b/src/torchpme/calculators/ewaldpotential.py similarity index 99% rename from src/meshlode/calculators/ewaldpotential.py rename to src/torchpme/calculators/ewaldpotential.py index 5f873095..b56fe155 100644 --- a/src/meshlode/calculators/ewaldpotential.py +++ b/src/torchpme/calculators/ewaldpotential.py @@ -261,7 +261,7 @@ def compute( neighbor_shifts=neighbor_shifts, ) - # This function is kept to keep MeshLODE compatible with the broader pytorch + # This function is kept to keep torch-pme compatible with the broader pytorch # infrastructure, which require a "forward" function. We name this function # "compute" instead, for compatibility with other COSMO software. def forward( diff --git a/src/meshlode/calculators/pmepotential.py b/src/torchpme/calculators/pmepotential.py similarity index 100% rename from src/meshlode/calculators/pmepotential.py rename to src/torchpme/calculators/pmepotential.py diff --git a/src/meshlode/lib/__init__.py b/src/torchpme/lib/__init__.py similarity index 100% rename from src/meshlode/lib/__init__.py rename to src/torchpme/lib/__init__.py diff --git a/src/meshlode/lib/fourier_convolution.py b/src/torchpme/lib/fourier_convolution.py similarity index 100% rename from src/meshlode/lib/fourier_convolution.py rename to src/torchpme/lib/fourier_convolution.py diff --git a/src/meshlode/lib/kvectors.py b/src/torchpme/lib/kvectors.py similarity index 100% rename from src/meshlode/lib/kvectors.py rename to src/torchpme/lib/kvectors.py diff --git a/src/meshlode/lib/mesh_interpolator.py b/src/torchpme/lib/mesh_interpolator.py similarity index 100% rename from src/meshlode/lib/mesh_interpolator.py rename to src/torchpme/lib/mesh_interpolator.py diff --git a/src/meshlode/lib/potentials.py b/src/torchpme/lib/potentials.py similarity index 100% rename from src/meshlode/lib/potentials.py rename to src/torchpme/lib/potentials.py diff --git a/src/meshlode/metatensor/__init__.py b/src/torchpme/metatensor/__init__.py similarity index 100% rename from src/meshlode/metatensor/__init__.py rename to src/torchpme/metatensor/__init__.py diff --git a/src/meshlode/metatensor/base.py b/src/torchpme/metatensor/base.py similarity index 99% rename from src/meshlode/metatensor/base.py rename to src/torchpme/metatensor/base.py index 92ac8b74..1742aeb0 100644 --- a/src/meshlode/metatensor/base.py +++ b/src/torchpme/metatensor/base.py @@ -9,7 +9,7 @@ from metatensor.torch.atomistic import System except ImportError: raise ImportError( - "metatensor.torch is required for meshlode.metatensor but is not installed. " + "metatensor.torch is required for torchpme.metatensor but is not installed. " "Try installing it with:\npip install metatensor[torch]" ) diff --git a/src/meshlode/metatensor/directpotential.py b/src/torchpme/metatensor/directpotential.py similarity index 96% rename from src/meshlode/metatensor/directpotential.py rename to src/torchpme/metatensor/directpotential.py index 368fa116..4413f504 100644 --- a/src/meshlode/metatensor/directpotential.py +++ b/src/torchpme/metatensor/directpotential.py @@ -5,7 +5,7 @@ class DirectPotential(CalculatorBaseMetatensor, _DirectPotentialImpl): r"""Specie-wise long-range potential using a direct summation over all atoms. - Refer to :class:`meshlode.DirectPotential` for parameter documentation. + Refer to :class:`torchpme.DirectPotential` for parameter documentation. Example ------- diff --git a/src/meshlode/metatensor/ewaldpotential.py b/src/torchpme/metatensor/ewaldpotential.py similarity index 89% rename from src/meshlode/metatensor/ewaldpotential.py rename to src/torchpme/metatensor/ewaldpotential.py index 1e9ec82a..4ae80385 100644 --- a/src/meshlode/metatensor/ewaldpotential.py +++ b/src/torchpme/metatensor/ewaldpotential.py @@ -7,10 +7,10 @@ class EwaldPotential(CalculatorBaseMetatensor, _EwaldPotentialImpl): r"""Specie-wise long-range potential computed using the Ewald sum. - Refer to :class:`meshlode.EwaldPotential` for parameter documentation. + Refer to :class:`torchpme.EwaldPotential` for parameter documentation. For an **example** on the usage refer to :py:class:`metatensor.PMEPotential - `. + `. """ def __init__( diff --git a/src/meshlode/metatensor/pmepotential.py b/src/torchpme/metatensor/pmepotential.py similarity index 98% rename from src/meshlode/metatensor/pmepotential.py rename to src/torchpme/metatensor/pmepotential.py index 2ee10dfa..21db6891 100644 --- a/src/meshlode/metatensor/pmepotential.py +++ b/src/torchpme/metatensor/pmepotential.py @@ -7,7 +7,7 @@ class PMEPotential(CalculatorBaseMetatensor, _PMEPotentialImpl): r"""Specie-wise long-range potential using a particle mesh-based Ewald (PME). - Refer to :class:`meshlode.PMEPotential` for parameter documentation. + Refer to :class:`torchpme.PMEPotential` for parameter documentation. Example ------- diff --git a/tests/calculators/test_base.py b/tests/calculators/test_base.py index c4d2d507..ddda2c80 100644 --- a/tests/calculators/test_base.py +++ b/tests/calculators/test_base.py @@ -1,7 +1,7 @@ import pytest import torch -from meshlode.calculators.base import CalculatorBaseTorch, PeriodicBase +from torchpme.calculators.base import CalculatorBaseTorch, PeriodicBase # Define some example parameters diff --git a/tests/calculators/test_values_aperiodic.py b/tests/calculators/test_values_aperiodic.py index c2332fc4..eb6ce79e 100644 --- a/tests/calculators/test_values_aperiodic.py +++ b/tests/calculators/test_values_aperiodic.py @@ -3,7 +3,7 @@ import pytest import torch -from meshlode import DirectPotential +from torchpme import DirectPotential def define_molecule(molecule_name="dimer"): diff --git a/tests/calculators/test_values_periodic.py b/tests/calculators/test_values_periodic.py index e8ef8f26..a7e851a5 100644 --- a/tests/calculators/test_values_periodic.py +++ b/tests/calculators/test_values_periodic.py @@ -9,7 +9,7 @@ from ase.io import read from utils import neighbor_list_torch -from meshlode import EwaldPotential, PMEPotential +from torchpme import EwaldPotential, PMEPotential DTYPE = torch.float64 @@ -426,7 +426,7 @@ def test_random_structure(sr_cutoff, frame_index, scaling_factor, ortho, calc_na # Forces in Gaussian units per Å forces_target = torch.tensor(frame.get_forces(), dtype=DTYPE) / scaling_factor**2 - # Convert into input format suitable for MeshLODE + # Convert into input format suitable for torch-pme positions = scaling_factor * (torch.tensor(frame.positions, dtype=DTYPE) @ ortho) cell = scaling_factor * torch.tensor(np.array(frame.cell), dtype=DTYPE) @ ortho charges = torch.tensor([1, 1, 1, 1, -1, -1, -1, -1], dtype=DTYPE).reshape((-1, 1)) @@ -441,7 +441,7 @@ def test_random_structure(sr_cutoff, frame_index, scaling_factor, ortho, calc_na # Enable backward for positions positions.requires_grad = True - # Compute potential using MeshLODE and compare against reference values + # Compute potential using torch-pme and compare against reference values if calc_name == "ewald": calc = EwaldPotential(atomic_smearing=atomic_smearing) rtol_e = 2e-5 diff --git a/tests/calculators/test_workflow.py b/tests/calculators/test_workflow.py index a8911477..e4ccf097 100644 --- a/tests/calculators/test_workflow.py +++ b/tests/calculators/test_workflow.py @@ -9,7 +9,7 @@ from torch.testing import assert_close from utils import neighbor_list_torch -from meshlode import DirectPotential, EwaldPotential, PMEPotential +from torchpme import DirectPotential, EwaldPotential, PMEPotential AVAILABLE_DEVICES = [torch.device("cpu")] + torch.cuda.is_available() * [ diff --git a/tests/lib/test_fourier_convolution.py b/tests/lib/test_fourier_convolution.py index 1126188a..950fbd7a 100644 --- a/tests/lib/test_fourier_convolution.py +++ b/tests/lib/test_fourier_convolution.py @@ -6,7 +6,7 @@ import torch from torch.testing import assert_close -from meshlode.lib import FourierSpaceConvolution +from torchpme.lib import FourierSpaceConvolution class TestKvectorGeneration: diff --git a/tests/lib/test_kvectors.py b/tests/lib/test_kvectors.py index 8ad8e8c0..4235a0d8 100644 --- a/tests/lib/test_kvectors.py +++ b/tests/lib/test_kvectors.py @@ -2,7 +2,7 @@ import torch from torch.testing import assert_close -from meshlode.lib import generate_kvectors_for_mesh, generate_kvectors_squeezed +from torchpme.lib import generate_kvectors_for_mesh, generate_kvectors_squeezed # Generate random cells and mesh parameters diff --git a/tests/lib/test_mesh_interpolator.py b/tests/lib/test_mesh_interpolator.py index 2be2c96e..57d00332 100644 --- a/tests/lib/test_mesh_interpolator.py +++ b/tests/lib/test_mesh_interpolator.py @@ -6,7 +6,7 @@ import torch from torch.testing import assert_close -from meshlode.lib import MeshInterpolator +from torchpme.lib import MeshInterpolator class TestMeshInterpolatorForward: diff --git a/tests/lib/test_potentials.py b/tests/lib/test_potentials.py index 8addfc3c..4e9ff48c 100644 --- a/tests/lib/test_potentials.py +++ b/tests/lib/test_potentials.py @@ -4,7 +4,7 @@ from torch.special import erf, erfc from torch.testing import assert_close -from meshlode.lib import InversePowerLawPotential +from torchpme.lib import InversePowerLawPotential def gamma(x): diff --git a/tests/metatensor/test_base_metatensor.py b/tests/metatensor/test_base_metatensor.py index 3943fd14..b6fddc07 100644 --- a/tests/metatensor/test_base_metatensor.py +++ b/tests/metatensor/test_base_metatensor.py @@ -4,14 +4,14 @@ from utils_metatensor import add_neighbor_list from vesin import NeighborList -import meshlode +import torchpme mts_torch = pytest.importorskip("metatensor.torch") mts_atomistic = pytest.importorskip("metatensor.torch.atomistic") -class CalculatorTest(meshlode.metatensor.base.CalculatorBaseMetatensor): +class CalculatorTest(torchpme.metatensor.base.CalculatorBaseMetatensor): def _compute_single_system( self, positions, charges, cell, neighbor_indices, neighbor_shifts ): diff --git a/tests/metatensor/test_workflow_metatensor.py b/tests/metatensor/test_workflow_metatensor.py index 4408d1cb..1abb2ee4 100644 --- a/tests/metatensor/test_workflow_metatensor.py +++ b/tests/metatensor/test_workflow_metatensor.py @@ -9,7 +9,7 @@ from packaging import version from utils_metatensor import add_neighbor_list -import meshlode +import torchpme mts_torch = pytest.importorskip("metatensor.torch") @@ -28,9 +28,9 @@ @pytest.mark.parametrize( "CalculatorClass, params", [ - (meshlode.metatensor.DirectPotential, {}), + (torchpme.metatensor.DirectPotential, {}), ( - meshlode.metatensor.EwaldPotential, + torchpme.metatensor.EwaldPotential, { "atomic_smearing": ATOMIC_SMEARING, "lr_wavelength": LR_WAVELENGTH, @@ -38,7 +38,7 @@ }, ), ( - meshlode.metatensor.PMEPotential, + torchpme.metatensor.PMEPotential, { "atomic_smearing": ATOMIC_SMEARING, "mesh_spacing": MESH_SPACING, diff --git a/tests/test_init.py b/tests/test_init.py index 1c2cd789..eaf59877 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -1,5 +1,5 @@ -import meshlode +import torchpme def test_version_exist(): - meshlode.__version__ + torchpme.__version__ diff --git a/tox.ini b/tox.ini index 2af8e2d2..3888ead3 100644 --- a/tox.ini +++ b/tox.ini @@ -50,7 +50,7 @@ commands = pytest {[testenv]test_options} {posargs} # Run documentation tests - pytest --doctest-modules --pyargs meshlode + pytest --doctest-modules --pyargs torchpme [testenv:tests-min] description = Run the minimal core tests with pytest and {basepython}.