Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of EquivariantPowerSpectrum and EquivariantPowerSpectrumByPair convenience calculators #317

Closed
wants to merge 15 commits into from
Closed
1 change: 1 addition & 0 deletions python/rascaline/rascaline/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from .clebsch_gordan import ( # noqa
DensityCorrelations,
CorrelateTensorWithDensity,
calculate_cg_coefficients,
cartesian_to_spherical,
)
Expand Down
1 change: 1 addition & 0 deletions python/rascaline/rascaline/utils/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from metatensor import Labels, LabelsEntry, TensorBlock, TensorMap, operations

from ..calculator_base import CalculatorBase
from ..calculators import SphericalExpansion, SphericalExpansionByPair
from ..systems import IntoSystem


Expand Down
2 changes: 2 additions & 0 deletions python/rascaline/rascaline/utils/clebsch_gordan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from ._cartesian_spherical import cartesian_to_spherical # noqa: F401
from ._coefficients import calculate_cg_coefficients # noqa: F401
from ._correlate_density import DensityCorrelations # noqa: F401
from ._correlate_tensors import CorrelateTensorWithDensity # noqa: F401
from ._lambda_soap import LambdaSoap, LambdaSoapXSphExByPair # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def __init__(
keep_l_in_keys: Optional[Union[bool, List[bool]]] = False,
arrays_backend: Optional[str] = None,
cg_backend: Optional[str] = None,
cg_coefficients: Optional[TensorMap] = None,
) -> None:
super().__init__()
if arrays_backend is None:
Expand Down Expand Up @@ -174,11 +175,14 @@ def __init__(
"Must be greater equal 0."
)
self._max_angular = max_angular
self._cg_coefficients = _coefficients.calculate_cg_coefficients(
lambda_max=self._max_angular,
cg_backend=self._cg_backend,
use_torch=(arrays_backend == "torch"),
)
if cg_coefficients is None:
self._cg_coefficients = _coefficients.calculate_cg_coefficients(
lambda_max=self._max_angular,
cg_backend=self._cg_backend,
use_torch=(arrays_backend == "torch"),
)
else: # using a pre-computed set of CG coefficients
self._cg_coefficients = cg_coefficients

# Check inputs
if body_order <= 2:
Expand Down Expand Up @@ -274,7 +278,6 @@ def _correlate_density(

# Add "order_nu" to the keys metadata
density = operations.insert_dimension(density, "keys", 0, "order_nu", 1)
# density = _utils.standardize_keys(density) # standardize metadata

# Check metadata
assert density.keys.names[:3] == [
Expand Down
Loading
Loading