PK!DCCcscribe/__init__.py__version__ = '0.1.0' from .soap import SOAP components = [SOAP] PK!PPcscribe/conversion.py"""Convert representations for cmlkit""" import numpy as np def to_local(data, rep): """Indices of local descriptors belonging to structures dscribe returns local descriptors as one flat array of dimension n_total_atoms x dim, whereas cmlkit expects a ndarray-list of length n_systems, where each entry is an ndarry of dim n_atoms_system x dim, i.e. the local representations for each atom in this particular system. The translation between these two notations is done via an offset array, which keeps track of which entries in the dscribe array belong to which atom. """ counts = data.info["atoms_by_system"] offsets = np.zeros(len(counts) + 1, dtype=int) offsets[1::] = np.cumsum(counts) return np.array( [rep[offsets[i]: offsets[i + 1]] for i in range(data.n)], dtype=object ) PK!Nccscribe/soap.pyfrom cmlkit.representation import Representation from dscribe.descriptors import SOAP as dsSOAP from .conversion import to_local class SOAP(Representation): """SOAP Representation (implemented in DScribe). For details, see https://singroup.github.io/dscribe/tutorials/soap.html or the dscribe source. Parametrisation here is identical to "original" quippy SOAP, with the addition of the "rbf" argument. Parameters: elems: Elements for which we compute SOAP cutoff: Cutoff radius sigma: Broadening n_max: Number of radial basis functions l_max: Number of angular basis functions rbf: Radial basis set. Either "gto" for Gaussians, or "polynomial" for a polynomial basis set more similar to the "original" SOAP approach. """ kind = "ds_soap" default_context = {"n_jobs": 1, "verbose": False} def __init__(self, elems, cutoff, sigma, n_max, l_max, rbf="gto", context={}): super().__init__(context=context) self.config = { "elems": elems, "cutoff": cutoff, "sigma": sigma, "n_max": n_max, "l_max": l_max, "rbf": rbf, } def _get_config(self): return self.config def compute(self, data): if data.b is None: ds_soap = dsSOAP( species=self.config["elems"], rcut=self.config["cutoff"], nmax=self.config["n_max"], lmax=self.config["l_max"], sigma=self.config["sigma"], rbf=self.config["rbf"], crossover=True, periodic=False, ) else: ds_soap = dsSOAP( species=self.config["elems"], rcut=self.config["cutoff"], nmax=self.config["n_max"], lmax=self.config["l_max"], sigma=self.config["sigma"], rbf=self.config["rbf"], crossover=True, periodic=True, ) rep = ds_soap.create( data.as_Atoms(), n_jobs=self.context["n_jobs"], verbose=self.context["verbose"], ) return to_local(data, rep) PK!_-#''cscribe-0.1.0.dist-info/LICENSEMIT License Copyright (c) 2019 Marcel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HڽTUcscribe-0.1.0.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!Hhse| cscribe-0.1.0.dist-info/METADATARn@Sĥb;i*Y"j$Q¡BƞKl;Ng'}^8@H>woI&S ,0VQRwĴ* ikRJU m2d[FKx G!dDƅA*ʪ"p2YyWKL*ʴx,SW \<4b*ey㚁ũ~q_9PȬ;)Cg+Lߧ+[ZYL7T%N.XdU\eU%Y>@}5W0r H>VaI碻Rx ma]X{)!8Å/PK!DCCcscribe/__init__.pyPK!PPtcscribe/conversion.pyPK!Nccscribe/soap.pyPK!_-#'' cscribe-0.1.0.dist-info/LICENSEPK!HڽTUxcscribe-0.1.0.dist-info/WHEELPK!Hhse| cscribe-0.1.0.dist-info/METADATAPK!H5^\UScscribe-0.1.0.dist-info/RECORDPK