You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I ran some tests with the SchNetPack-LAMMPS interface using periodic systems and got strange energies/forces when atoms were crossing the cell boundaries. If I understood it correctly, SchNetPack calculates the pairwise distances using the cell offsets in cartesian coordinates (in distance units) and, therefore, the ASE or MatScipy neighbor lists convert the offsets from scaled coordinates (multiplier of the cell vectors) to cartesian:
schnetpack/atomistic/distances.py
l. 24: Rij = R[idx_j] - R[idx_i] + offsets
schnetpack/transform/neighborlist.py
l. 245: offset = torch.mm(S, cell)
The LAMMPS interface does actually the opposite operation converting cartesian offsets to scaled ones before creating the input Dict:
interfaces/lammps/pair_schnetpack.cpp
l. 236: auto cell_inv = cell_tensor.inverse().transpose(0,1);
l. 268: torch::Tensor cell_shift_tensor = cell_inv.matmul(periodic_shift_tensor);
As a quick fix, I commented out some lines and made a few minor changes (see "pair_schnetpack_pbcfix.cpp" in "aspirin_pbcfix", lines 236, 268-280). I used your aspirin example to test both versions ("aspirin_orig" and "aspirin_pbcfix" attached) with the molecule within a periodic box and one that crosses the unit cell boundaries. I double-checked energies and forces with SchNetPack's ASE interface and it seems to work fine now :)
Hi,
I ran some tests with the SchNetPack-LAMMPS interface using periodic systems and got strange energies/forces when atoms were crossing the cell boundaries. If I understood it correctly, SchNetPack calculates the pairwise distances using the cell offsets in cartesian coordinates (in distance units) and, therefore, the ASE or MatScipy neighbor lists convert the offsets from scaled coordinates (multiplier of the cell vectors) to cartesian:
The LAMMPS interface does actually the opposite operation converting cartesian offsets to scaled ones before creating the input Dict:
As a quick fix, I commented out some lines and made a few minor changes (see "pair_schnetpack_pbcfix.cpp" in "aspirin_pbcfix", lines 236, 268-280). I used your aspirin example to test both versions ("aspirin_orig" and "aspirin_pbcfix" attached) with the molecule within a periodic box and one that crosses the unit cell boundaries. I double-checked energies and forces with SchNetPack's ASE interface and it seems to work fine now :)
I hope this helps.
Best,
Andreas
ase_sp.tar.gz
aspirin_orig.tar.gz
aspirin_pbcfix.tar.gz
The text was updated successfully, but these errors were encountered: