How does compute sna/atom work?

To parameterize a SNAP potential for gallium nitride (2 atom types), I’m trying to list the bispectrum components for every atom so that I can plug into a least squares optimizer. The order of bispectrum components using compute sna/atom, however, does not seem to be consistent with that calculated in the SNAP pair style.

I’ve compute the bispectrum components using the python interface, and then manually calculated the potential energy to compare with the LAMMPS calculated energy. My calculated energy and the LAMMPS energy do not agree (see attached files), but I am using the proper definition of the SNAP potential.

My questions are:

  1. How can I list the bispectrum components from compute sna/atom so that they are consistent with how the energy is calculated in LAMMPS?

  2. How are the bispectrum components ordered in the array from the compute? I assume rows correspond to individual atoms, and columns correspond to bispectrum components. This is what the documentation says, but calculating the energy this way does not seem to work.

  3. How are the derivatives of bispectrum components ordered from compute snad/atom? The doc page says: “The columns are arranged into ntypes blocks​”. Does this mean if K = 30 and ntypes = 2, then there are 2330=180 columns?​

calculate_energy.py (1.96 KB)

DATA (7.58 KB)

GaN.snapcoeff (85 Bytes)

GaN.snapparam (146 Bytes)

Best to contact the SNAP package maintainer Aidan Thompson (cc’d) about these details directly.

axel.