Giter VIP home page Giter VIP logo

soaplite's Introduction

SOAPLite

WARNING: This project has been archived, as the functionality of SOAPLite has been merged into DScribe.

Smooth Overlap of Atomic Positions (SOAP) is an algorithm used for accurately classifying and machine learning chemical environments [1,2]. For a detailed documentation, please read soapDoc.pdf in this repository.

Getting Started

This is a low level, lightweight and fast implementation of SOAP for machine learning in quantum chemistry and materials physics. When given a structure and SOAP parameters, SOAPLite will spit out the SOAP spectra of local points in space. For a higher level interface, please use DScribe instead.

Here is an example of the python interface:

from soaplite import getBasisFunc, get_soap_locals
from ase.build import molecule

#-------------- Define structure -----------------------------------------------
atoms = molecule("H2O")

#-------------- Define positions of desired local environments ----------------
hpos = [
    [0, 1, 2],
    [2, 3, 4]
]

#------------------ Basis function settings (rCut, N_max) ----------------------
n_max = 5
l_max = 5
r_cut = 10.0
my_alphas, my_betas = getBasisFunc(r_cut, n_max)

#--------- Get local chemical environments for each defined position -----------
x = get_soap_locals(
    atoms,
    hpos,
    my_alphas,
    my_betas,
    rCut=r_cut,
    NradBas=n_max,
    Lmax=l_max,
    crossOver=True
)

print(x)
print(x.shape)

Installation

We provide a python interface to the code with precompiled C-extension. This precompiled version should work with linux-based machines, and can be installed with:

pip install soaplite

Or by cloning this repository, you can install it by

pip3 install .

in the SOAPLite directory.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU LESSER GENERAL PUBLIC LICENSE - see the LICENSE.md file for details

References

If you use this software, please cite

  • [1] On representing chemical environments - Albert P. Bartók, Risi Kondor, Gábor Csányi paper
  • [2] Comparing molecules and solids across structural and alchemical space - Sandip De, Albert P. Bartók, Gábor Cásnyi, and Michele Ceriotti paper
  • Machine learning hydrogen adsorption on nanoclusters through structural descriptors - Marc O. J. Jäger, Eiaki V. Morooka, Filippo Federici Canova, Lauri Himanen & Adam S. Foster paper

The theory is based on the first two papers, and the implementation is based on the third paper.

soaplite's People

Contributors

aki78 avatar lauri-codes avatar marchunter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soaplite's Issues

Does SOAPLite work with periodic/bulk structures?

How do I make sure the periodic boundary conditions are used? The following fails:

from soaplite import getBasisFunc, get_periodic_soap_locals
from ase.build import bulk

atoms = bulk('NaCl', 'rocksalt', a=5.64)

hpos = [
    [0, 0, 0],
]

n_max = 5
l_max = 5
r_cut = 10.0
my_alphas, my_betas = getBasisFunc(r_cut, n_max)

x = get_periodic_soap_locals(
    atoms,
    hpos,
    my_alphas,
    my_betas,
    rCut=r_cut,
    NradBas=n_max,
    Lmax=l_max,
    crossOver=True
)

Traceback:

/soaplite/soaplite.py:49: RuntimeWarning: divide by zero encountered in true_divide
  cell_images = np.ceil(rCutHard/xyz_arr)
Traceback (most recent call last):
  File "test.py", line 29, in <module>
    crossOver=True
  File "/home/bart/anaconda3/lib/python3.6/site-packages/soaplite-0.9.14-py3.6-linux-x86_64.egg/soaplite/soaplite.py", line 181, in get_periodic_soap_locals
    suce = _get_supercell(obj, rCut)
  File "/home/bart/anaconda3/lib/python3.6/site-packages/soaplite-0.9.14-py3.6-linux-x86_64.egg/soaplite/soaplite.py", line 50, in _get_supercell
    nx = int(cell_images[0])
OverflowError: cannot convert float infinity to integer

How to derive the equation of C_{nn'l} in the appendix from Eqn 4

Hi,

It is a very beautiful implementation of SOAP. I am wondering how to get the equations of c_{nn'l} in the appendix from the Eqn 4 of soapDoc.pdf. I cannot find this information in both SOAPlite documents and the original paper. It is appreciated if you can add more information about this. Thank you very much.

Reproducing QUIP SOAP vectors with SOAPLite

Hello,

I'm the developer of a set of MD site analysis tools (sitator) that I'm trying to transition over to Python 3. As part of that I'm looking to get away from QUIP/quippy with GAP for computing SOAP vectors. SOAPLite looks promising, and I'd love to use it, but I'm having difficulty reproducing my results from QUIP/GAP.

I took the simplified structure struct-one-Li.cif.txt containing one Li atom whose SOAP vector I want to compute. (The rest of the atoms, for simplicity, were all changed to hydrogens.)

quippy
With quippy, I calculate the SOAP vector:

d = quippy.descriptors.Descriptor("soap cutoff=4.0 cutoff_transition_width=0.5 l_max=6 n_max=6 atom_sigma=0.4 n_Z=1 Z={3} normalize=F")
a_qp = qp.Atoms(structure)
a_qp.set_cutoff(4.0)
a_qp.calc_connect()
soaps = d.calc(a_qp, grad = False)['descriptor']

The resulting SOAP vector (length 148):

image

SOAPLite

I use this code:

li_mask = structure.get_atomic_numbers() == 3
li_pos = structure.get_positions()[np.where(li_mask)[0][0]]
no_li_struct  = structure[~li_mask]
sigma = 0.4
eta = 1/(2*sigma**2)
soaps = soaplite.get_periodic_soap_locals_gauss(static_struct, np.array([li_pos]), rCut = 4.0, nMax = 6, Lmax = 6, eta = eta, all_atomtypes = [1])

The resulting SOAP vector (length 147):

image

The calculation for eta is taken from pycsoap (source code here); I'm not sure if it's correct but it was the best resource I was able to find for how to translate the atom_sigma parameter.


How can I reproduce my QUIP results with SOAPLite?

Thanks,
A.M.

How to get soap from cif file?

I have the cif file database for machine learning.
I want to get soap discriptors from these cif files.

Is it possible by SOAPlite?

Re:How to get soap from cif file?

Great thanks for #7 "How to get soap from cif file?"

Sorry for a late reply. I tried them about my cif files and read documents, however I can't fully understand yet.

Some of my data are here
I tried the program you answered about ABAVIJ_clean.cif.

I can't understand how to change the code from 'hydrogen.cif' and the meaning of
*soaplite
pos = [[0, 0, 0]]
rcut = 4
nmax = 6

  • dscribe
    species=["H"],

Thanks.

How to use crossOver=False

  1. I would like to obtain separate power spectra for each species to construct a delta chemical kernel.
    If I understand correctly, crossover=False will calculate the spectrum for a single species, but how is it determined which one? The positions hpos are just positions in 3D space right?

  2. I noticed in the H2O example (in the README), setting crossover=False gives a (2,180) matrix instead of (2,270). The 180 comes from:

terms = 0
for n in range(n_max+1):
    for n_prime in range(n_max+1):
        for l in range(l_max):
            terms += 1
print(terms) # => 180

Why does crossover=True give 270 coefficients per spectrum?

  1. In the documentation, you start with "The SOAP power spectrum at a certain position r is defined as", and then immediately continue to use x..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.