SOAPify.utils

Utilities submodule, cointains unclassified support functions Author: Daniele Rapetti

Functions

fillSOAPVectorFromdscribe(soapFromdscribe, ...)

Given the result of a SOAP calculation from dscribe returns the SOAP power spectrum

getAddressesQuippyLikeDscribe(lmax, nmax, ...)

create a support bdarray to reorder the quippy output in a dscribe fashion

getSOAPSettings(fitsetData)

Gets the settings of the SOAP calculation

getSlicesFromAttrs(attrs)

returns the positional slices for the calculated fingerprints

getdscribeSOAPMapping(lmax, nmax, species[, ...])

returns how dscribe saves the SOAP results

getquippySOAPMapping(lmax, nmax, species[, ...])

returns how quippi saves the SOAP results

normalizeArray(x)

Normalizes the futher axis of the given array

orderByZ(species)

Orders the list of species by their atomic number

SOAPify.utils.fillSOAPVectorFromdscribe(soapFromdscribe, lMax, nMax, atomTypes=None, atomicSlices=None)[source]
Given the result of a SOAP calculation from dscribe returns the SOAP power spectrum

with also the symmetric part explicitly stored, see the note in https://singroup.github.io/dscribe/1.2.x/tutorials/descriptors/soap.html

No controls are implemented on the shape of the soapFromdscribe vector.

Parameters
  • soapFromdscribe (numpy.ndarray) – the result of the SOAP calculation from the dscribe utility

  • lMax (int) – the l_max specified in the calculation.

  • nMax (int) – the n_max specified in the calculation.

Returns

The full soap spectrum, with the symmetric part sored explicitly

Return type

numpy.ndarray

SOAPify.utils.getAddressesQuippyLikeDscribe(lmax, nmax, species)[source]

create a support bdarray to reorder the quippy output in a dscribe fashion

Given the lmax and nmax of a SOAP calculation and the species of the atoms returns an array of idexes for reordering the quippy results as the dscribe results

Parameters
  • lmax (int) – the lmax specified in the calculation.

  • nmax (int) – the nmax specified in the calculation.

  • species (list[str]) – the list of atomic species.

  • Returns – numpy.ndarray: an array of indexes

SOAPify.utils.getSOAPSettings(fitsetData)[source]

Gets the settings of the SOAP calculation

you can feed directly this output to fillSOAPVectorFromdscribe()

#TODO: make tests for this

Parameters

fitsetData (h5py.Dataset) – A soap dataset with attributes

Returns

a dictionary with the following components:
  • nMax

  • lMax

  • atomTypes

  • atomicSlices

Return type

dict

SOAPify.utils.getSlicesFromAttrs(attrs)[source]

returns the positional slices for the calculated fingerprints

Given the attributes of from a SOAP dataset returns the slices of the SOAP vector that contains the pair information

Parameters

attrs (dict) – the attributes of the SOAP dataset

Returns

the slices of the SOAP vector to be extracted and the atomic types

Return type

tuple(list,dict)

SOAPify.utils.getdscribeSOAPMapping(lmax, nmax, species, crossover=True)[source]

returns how dscribe saves the SOAP results

return a list of string with the identities of the data returned from dscribe, see the note in https://singroup.github.io/dscribe/1.2.x/tutorials/descriptors/soap.html

Parameters
  • lmax (int) – the lmax specified in the calculation.

  • nmax (int) – the nmax specified in the calculation.

  • species (list[str]) – the list of atomic species.

  • crossover (bool) – if True, the SOAP descriptors are generated for the mixed species. Defaults to True.

Returns

an array of strings with the mapping of the output of the analysis

Return type

numpy.ndarray

SOAPify.utils.getquippySOAPMapping(lmax, nmax, species, diagonalRadial=False)[source]

returns how quippi saves the SOAP results

return a list of string with the identities of the data returned from quippy, see https://github.com/libAtoms/GAP/blob/main/descriptors.f95#L7588

Parameters
  • lmax (int) – the lmax specified in the calculation.

  • nmax (int) – the nmax specified in the calculation.

  • species (list[str]) – the list of atomic species.

  • diagonalRadial (bool) – if True, Only return the n1=n2 elements of the power spectrum. NOT IMPLEMENTED. Defaults to False.

Returns

an array of strings with the mapping of the output of the analysis

Return type

numpy.ndarray

SOAPify.utils.normalizeArray(x)[source]

Normalizes the futher axis of the given array

(eg. in an array of shape (100,50,3) normalizes all the 5000 3D vectors)

Parameters

x (numpy.ndarray) – the array to be normalized

Returns

the normalized array

Return type

numpy.ndarray

SOAPify.utils.orderByZ(species)[source]

Orders the list of species by their atomic number

Parameters

species (list[str]) – the list of atomic species to be ordered

Returns

the ordered list of atomic species

Return type

list[str]