rascaline
rascaline copied to clipboard
Clebsch-Gordan `correlate_tensors` method
Following on from PR #237, and completes a TODO item in #239 , the next public API function implemented is the correlate_tensors
method. This takes two arbitrary TensorMaps and performs a single Clebsch-Gordan tensor product. The function correlate_density
previously implemented in #237, is a special case of this method, used to correlate a density descriptor with itself.
As this is the general case, the method cannot take computational shortcuts as in correlate_density
. As such, the public API function signature is simplified to:
def correlate_tensors(
tensor_1: TensorMap,
tensor_2: TensorMap,
selected_keys: Optional[Union[Labels, List[Labels]]] = None,
) -> TensorMap:
where arg selected_keys
controls the output of angular and parity channels, and therefore the block combinations performed.
Other Changes
- Unit tests sped up by reducing parametrization and lowering max angular/radial channels of input hypers re @Luthaf comment in #239
-
Breaking change to
correlate_density
: TensorMaps are now returned with the "order_nu" and "inversion_sigma" key dimensions, even if they are not sparse (i.e. redundant). This metadata should be carried around to allow passing of TensorMaps to CG functions that require it (i.e.correlate_tensors
), and can always be easily removed by the user if they wish. Once TensorMaps can be tagged with global (i.e. non-sparse) metadata, they will be moved there (another breaking change, for the future)