MaterSim / PyXtal_FF

Machine Learning Interatomic Potential Predictions
85 stars 23 forks source link

C version of SO3 and LAMMPS interface (v0.1.8) #33

Closed qzhu2017 closed 2 years ago

qzhu2017 commented 3 years ago

@David-Zagaceta @macstein I don't think the openmp mechanism is really working, when I tried to run SO3.py with different OMP_NUM_THREADS values, the time does not really change. Anyway, we will write it in C and implement the MPI mechanism.

qzhu@cms Parallel_SO3 (master) $ export OMP_NUM_THREADS=1
qzhu@cms Parallel_SO3 (master) $ python SO3.py 
Atoms(symbols='Si64', pbc=True, cell=[10.918, 10.918, 10.918])
64
time elapsed: 0.6822705268859863
qzhu@cms Parallel_SO3 (master) $ export OMP_NUM_THREADS=2
qzhu@cms Parallel_SO3 (master) $ python SO3.py 
Atoms(symbols='Si64', pbc=True, cell=[10.918, 10.918, 10.918])
64
time elapsed: 0.6647293567657471
qzhu@cms Parallel_SO3 (master) $ export OMP_NUM_THREADS=4
qzhu@cms Parallel_SO3 (master) $ python SO3.py 
Atoms(symbols='Si64', pbc=True, cell=[10.918, 10.918, 10.918])
64
time elapsed: 0.6886498928070068
qzhu2017 commented 3 years ago
qzhu2017 commented 3 years ago

@yanxon @macstein Can you check this example? See if it works on your environment.

If yes, please use this as a template to test SO3-NN. I am curious about the speed of SO3 in LAMMPS.

qzhu2017 commented 3 years ago

@macstein @pedroantoniosantosf @yanxon I think you can start to upload your code to this directory. I suggest we name the package name as USER-PYXTAL. Under this umbrella, we can gradually implement new descriptors.

In the meantime, we will maintain the MLIAP package to make sure that the NN regression works.

macstein commented 3 years ago

@yanxon @macstein Can you check this example? See if it works on your environment.

If yes, please use this as a template to test SO3-NN. I am curious about the speed of SO3 in LAMMPS.

With minor modifying in "compute_mliap.cpp" and "pair_mliap.cpp", the example works in my current so3 developing environment. I will wait SO3-NN data from @yanxon

qzhu2017 commented 3 years ago

@macstein @yanxon I just trained SO3-NN for the silicon and uploaded the results to https://github.com/qzhu2017/PyXtal_FF/tree/master/examples/Si-NN-LAMMPS/Si-so3. If you modify PyXtal_FF/examples/Si-NN-LAMMPS/validate.py as follows

 12 des, folder = "sna", "Si-snap"
 13 #des, folder = "so3", "Si-so3"
 14 mliap  = folder + "/16-16-checkpoint.pth"
 15 lmpiap = folder + "/NN_weights.txt"
 16 lmpdes = folder + "/DescriptorParams.txt"

You should be able to run validate.py and check if the results are consistent.

qzhu2017 commented 3 years ago

@macstein Can you check if the above script work for you?

macstein commented 3 years ago

@qzhu2017 It looks working. However, I am not sure if it works properly. Which quantity do I need to compare with pyxtal_ff? When I run "validate.py", I got this error:

bkang@cori06:~/bk/UNLV/github/PyXtal_FF/examples/Si-NN-LAMMPS> python validate.py
Traceback (most recent call last):
  File "validate.py", line 3, in <module>
    from lammps import lammps
ModuleNotFoundError: No module named 'lammps'

Please note that I am using stempede2 to compile and run. stempede2 file system is not stable tonight again.

qzhu2017 commented 3 years ago

You need to follow the instruction in the README.md to install lammps and its python wrapper.

On Tue, Mar 9, 2021 at 11:12 PM macstein notifications@github.com wrote:

@qzhu2017 https://github.com/qzhu2017 It looks working. However, I am not sure if it works properly. Which quantity do I need to compare with pyxtal_ff? When I run "validate.py", I got this error:

bkang@cori06:~/bk/UNLV/github/PyXtal_FF/examples/Si-NN-LAMMPS> python validate.py Traceback (most recent call last): File "validate.py", line 3, in from lammps import lammps ModuleNotFoundError: No module named 'lammps'

Please note that I am using stempede2 to compile and run. stempede2 file system is not stable tonight again.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qzhu2017/PyXtal_FF/issues/33#issuecomment-795001588, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHAUZ5V572FMJJQB2RROBDDTC4EUPANCNFSM4V3DZNRA .

-- [image: Photograph] http://www.skarif2.io/ Qiang Zhu Assistant Professor University of Nevada Las Vegas • Physics and Astronomy Phone ⋅ +1 702 895 1710 Email ⋅ qiang.zhu@unlv.edu Address ⋅ BPB 232, 4505 S. Maryland Parkway https://www.google.com/maps/place/Robert+L.+Bigelow+Physics,+Las+Vegas,+NV+89119/@36.1092077,-115.1454793,17z/data=!3m1!4b1!4m5!3m4!1s0x80c8c5aacc5bd7bf:0x57992e2f948155c0!8m2!3d36.1092077!4d-115.1432906 [image: github] https://github.com/qzhu2017[image: linkedin] https://qzhu2017.github.io/

macstein commented 3 years ago

Installed pyxtal-ff following: https://pyxtal-ff.readthedocs.io/en/latest/_rsts/links/_installation.html Installed lammps and python wrapper following: https://github.com/qzhu2017/PyXtal_FF/blob/master/examples/Si-NN-LAMMPS/README.md

I got an error.

bkang@cori06:~/bk/UNLV/github/PyXtal_FF/examples/Si-NN-LAMMPS> python validate.py

ASE calculator with pyxtal_ff force field

Traceback (most recent call last):
  File "validate.py", line 47, in <module>
    print("Energy: {:8.3f} eV/atom".format(si.get_potential_energy()))
  File "/global/homes/b/bkang/.local/cori/3.8-anaconda-2020.11/lib/python3.8/site-packages/ase/atoms.py", line 733, in get_potential_energy
    energy = self._calc.get_potential_energy(self)
  File "/global/homes/b/bkang/.local/cori/3.8-anaconda-2020.11/lib/python3.8/site-packages/ase/calculators/calculator.py", line 682, in get_potential_energy
    energy = self.get_property('energy', atoms)
  File "/global/homes/b/bkang/.local/cori/3.8-anaconda-2020.11/lib/python3.8/site-packages/ase/calculators/calculator.py", line 738, in get_property
    self.calculate(atoms, [name], system_changes)
  File "/global/homes/b/bkang/.local/cori/3.8-anaconda-2020.11/lib/python3.8/site-packages/pyxtal_ff-0.1.5-py3.8.egg/pyxtal_ff/calculator/__init__.py", line 28, in calculate
    desp = compute_descriptor(self.parameters.ff._descriptors, atoms)
  File "/global/homes/b/bkang/.local/cori/3.8-anaconda-2020.11/lib/python3.8/site-packages/pyxtal_ff-0.1.5-py3.8.egg/pyxtal_ff/utilities/__init__.py", line 278, in compute_descriptor
    from pyxtal_ff.descriptors.SNAP import SO4_Bispectrum
  File "/global/homes/b/bkang/.local/cori/3.8-anaconda-2020.11/lib/python3.8/site-packages/pyxtal_ff-0.1.5-py3.8.egg/pyxtal_ff/descriptors/SNAP.py", line 7, in <module>
    from pyxtal_ff.descriptors.angular_momentum import Wigner_D, factorial, deltacg, Wigner_D_wDerivative
  File "/global/homes/b/bkang/.local/cori/3.8-anaconda-2020.11/lib/python3.8/site-packages/pyxtal_ff-0.1.5-py3.8.egg/pyxtal_ff/descriptors/angular_momentum.py", line 9, in <module>
    from utils import (_Wigner_coefficient as _coeff,
ModuleNotFoundError: No module named 'utils'

Do I need to install utils separately from package installation?

qzhu2017 commented 3 years ago

https://github.com/qzhu2017/PyXtal_FF/blob/3ed5c6307c6721454e9f79db47657c411e897286/pyxtal_ff/descriptors/angular_momentum.py#L6

@macstein It looks like that you changed the file as shown above.

macstein commented 3 years ago

@macstein @yanxon I just trained SO3-NN for the silicon and uploaded the results to https://github.com/qzhu2017/PyXtal_FF/tree/master/examples/Si-NN-LAMMPS/Si-so3. If you modify PyXtal_FF/examples/Si-NN-LAMMPS/validate.py as follows

 12 des, folder = "sna", "Si-snap"
 13 #des, folder = "so3", "Si-so3"
 14 mliap  = folder + "/16-16-checkpoint.pth"
 15 lmpiap = folder + "/NN_weights.txt"
 16 lmpdes = folder + "/DescriptorParams.txt"

You should be able to run validate.py and check if the results are consistent.

By the way, should be?

>  12 #des, folder = "sna", "Si-snap"
>  13 des, folder = "so3", "Si-so3"
qzhu2017 commented 3 years ago

@macstein @yanxon

I just trained SO3-NN for the silicon and uploaded the results to https://github.com/qzhu2017/PyXtal_FF/tree/master/examples/Si-NN-LAMMPS/Si-so3.

If you modify PyXtal_FF/examples/Si-NN-LAMMPS/validate.py as follows


 12 des, folder = "sna", "Si-snap"

 13 #des, folder = "so3", "Si-so3"

 14 mliap  = folder + "/16-16-checkpoint.pth"

 15 lmpiap = folder + "/NN_weights.txt"

 16 lmpdes = folder + "/DescriptorParams.txt"

You should be able to run validate.py and check if the results are consistent.

By the way, should be?


>  12 #des, folder = "sna", "Si-snap"

>  13 des, folder = "so3", "Si-so3"

Yes

macstein commented 3 years ago

For ideal structure I got

Total energy (eV/atom) = -5.42218750354884
ITEM: ATOMS id type fx fy fz
1 1 -8.32667e-16 2.22045e-16 2.22045e-16
2 1 -5.55112e-17 -1.62023e-15 1.57166e-15
3 1 -5.55112e-16 -1.63064e-16 6.74807e-16
4 1 -2.22045e-16 2.2083e-15 -2.17361e-15
5 1 6.38378e-16 3.72966e-16 3.88578e-16
6 1 2.77556e-16 -1.36002e-15 -2.07473e-15
7 1 2.08167e-16 2.11636e-16 -2.35922e-16
8 1 4.996e-16 6.38378e-16 1.72085e-15
Stress [eV/A^3]
0.0129  0.0129 0.0129 0.0 0.0 0.0

validate.py

Energy:  -43.378 eV/atom
Forces (eV/A)
[[  0.0000  -0.0000   0.0000]
 [  0.0000   0.0000   0.0000]
 [ -0.0000   0.0000  -0.0000]
 [ -0.0000   0.0000   0.0000]
 [ -0.0000  -0.0000  -0.0000]
 [  0.0000   0.0000   0.0000]
 [  0.0000   0.0000  -0.0000]
 [ -0.0000  -0.0000   0.0000]]
Stresses (GPa)
[ -0.0129  -0.0129  -0.0129   0.0000   0.0000  -0.0000]

For distorted structure, I got

Total energy (eV/atom) = -5.42197364357977
ITEM: ATOMS id type fx fy fz
1 1 0.207605 -7.49401e-16 -4.996e-16
2 1 -0.0524654 -0.0321733 -0.0321733
3 1 0.0327113 -7.00828e-16 5.6205e-16
4 1 -0.0524654 0.0321733 0.0321733
5 1 -0.0143173 3.1225e-17 6.07153e-16
6 1 -0.0533752 0.033656 -0.033656
7 1 -0.0143173 2.08167e-17 -1.37564e-15
8 1 -0.0533752 -0.033656 0.033656
Stress [eV/A^3]
0.0129 0.0129 0.0129 0.0 0.0 -0.00102

validate.py

Energy:  -43.376 eV/atom
Forces (eV/A)
[[  0.2076  -0.0000   0.0000]
 [ -0.0525  -0.0322  -0.0322]
 [  0.0327   0.0000  -0.0000]
 [ -0.0525   0.0322   0.0322]
 [ -0.0143   0.0000  -0.0000]
 [ -0.0534   0.0337  -0.0337]
 [ -0.0143  -0.0000   0.0000]
 [ -0.0534  -0.0337   0.0337]]
Stresses (GPa)
[ -0.0129  -0.0129  -0.0129   0.0010  -0.0000  -0.0000]
qzhu2017 commented 3 years ago

@macstein @yanxon Are you able to install the lammps and its python wrapper?

macstein commented 3 years ago

@qzhu2017 I did install the lammps (serial) and its python wrapper. I could get part of result (by validate.py) in above https://github.com/qzhu2017/PyXtal_FF/issues/33#issuecomment-795133805 by installing them.

yanxon commented 3 years ago

Are you able to install the lammps and its python wrapper?

I tried this several times actually. I always got errors.

Then, I decided to delete all of LAMMPS, including the path in my ~/.bashrc. Now, I can run the validate.py:

ASE calculator with pyxtal_ff force field

Energy:  -73.361 eV
Forces (eV/A)
[[ -5.1280   0.1181   0.5465]
 [  0.7839  -0.5534  -0.3682]
 [  0.8935   0.4689  -0.2154]
 [  0.3212   0.0988  -0.8995]
 [  1.8002  -0.3349  -1.7182]
 [ -0.0158  -0.0926  -0.8681]
 [  0.5241   0.6977   0.7380]
 [  0.1141   0.0020   1.1442]
 [  0.7068  -0.4046   1.6407]]
Stresses (GPa)
[  0.0132   0.0271   0.0212  -0.0100   0.0211   0.0049]

LAMMPS calculator with pyxtal_ff force field

Energy:  -73.361 eV
Forces (eV/A)
[[ -5.1280   0.1181   0.5465]
 [  0.7838  -0.5534  -0.3682]
 [  0.8935   0.4689  -0.2154]
 [  0.3212   0.0988  -0.8995]
 [  1.8002  -0.3349  -1.7182]
 [ -0.0158  -0.0926  -0.8681]
 [  0.5241   0.6977   0.7380]
 [  0.1141   0.0020   1.1442]
 [  0.7068  -0.4046   1.6407]]
Stresses (GPa)
[  0.0132   0.0271   0.0212  -0.0100   0.0211   0.0049]
qzhu2017 commented 3 years ago

@yanxon Great, did you use Pedro's repo or Lammps's master repo?

I have no problem with Pedro's repo. For the lammps master repo, I can do make mpi. However, I failed in make mpi mode=shlib.

Compiling LAMMPS for machine mpi
make[2]: Entering directory `/scratch/qzhu/github/lammps/src/Obj_shared_mpi'
make[2]: Leaving directory `/scratch/qzhu/github/lammps/src/Obj_shared_mpi'
make[2]: Entering directory `/scratch/qzhu/github/lammps/src/Obj_shared_mpi'
mpicxx -g -O3 main.o       -L. -llammps_mpi     -lpthread -ldl -lutil -lm -lpython2.6   -o ../lmp_mpi
./liblammps_mpi.so: undefined reference to `LAMMPS_NS::MLIAPModelPython::connect_param_counts()'
collect2: error: ld returned 1 exit status
make[2]: *** [../lmp_mpi] Error 1
make[2]: Leaving directory `/scratch/qzhu/github/lammps/src/Obj_shared_mpi'
make[1]: *** [mpi] Error 2
make[1]: Leaving directory `/scratch/qzhu/github/lammps/src'
make: *** [mpi] Error 2

Are you encountering the same thing?

yanxon commented 3 years ago

@qzhu2017

I used LAMMPS's master repo.

I believe I had the same issue. I'm not sure why and couldn't fix the issue.

Eventually, I just got rid of all of my LAMMPS version, and redo the path in ~/.bashrc. This solves the issue.

weilaigit commented 3 years ago

I followed the instruction at https://github.com/qzhu2017/PyXtal_FF/blob/master/examples/Si-LAMMPS/README.md. However, I am still getting the following error when running lammps directly. On the other hand, it worked when I commented so3 and uncommented snap.

ERROR: Illegal pair_style mliap command (../pair_mliap.cpp:174) Last command: pair_style mliap model nn Si-so3/NN_weights.txt descriptor so3 Si-so3/DescriptorParam.txt

qzhu2017 commented 3 years ago

@weilaigit Thanks for your interest. The SO3 descriptor is not ready yet. We are about to finalize it in a couple of weeks.

You are right the SNAP should work well. Please let me know if you need any help on that.

weilaigit commented 3 years ago

@qzhu2017 Thanks for the information on SO3. Looking forward to it.

qzhu2017 commented 3 years ago

Todo list

qzhu2017 commented 3 years ago

@macstein @David-Zagaceta I just tried to test if the results are consistent between lammps and python for so3. If you checkout my most recent commit and run the following the instructions here

qzhu@cms Si-LAMMPS (master) $ python validate.py 

Testing so3 Si-so3
  0 -321.104 eV   37.328 GPa   -0.000    0.000    0.000
  1 -346.899 eV    1.282 GPa   -0.000    0.000    0.000
  2 -344.112 eV    9.191 GPa   -0.000    0.000    0.000
  3 -346.537 eV    3.255 GPa   -0.000    0.000    0.000
  4 -247.037 eV   86.251 GPa   -0.000    0.000    0.000
  5 -274.377 eV   73.769 GPa   -0.000    0.000    0.000
  6 -213.886 eV   93.882 GPa   -0.000    0.000    0.000
  7 -271.015 eV   75.685 GPa   -0.000    0.000    0.000
  8 -310.296 eV   47.532 GPa   -0.000    0.000    0.000
  9 -344.492 eV    8.459 GPa   -0.000    0.000    0.000

In the above, I generate 10 random structures and compute the energy, forces and stress tensors. They all return the right results. So I think the code at least works for the elemental systems.

However, I tried to run MD in LAMMPS but I found the calculation is significantly slower than the snap. For 64 atoms,

qzhu@cms Si-LAMMPS (master) $ /scratch/qzhu/pkgs/lammps/src/lmp_mpi <md.in 
LAMMPS (10 Feb 2021)
Lattice spacing in x,y,z = 5.4000000 5.4000000 5.4000000
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (10.800000 10.800000 10.800000)
  1 by 1 by 1 MPI processor grid
Created 64 atoms
  create_atoms CPU = 0.000 seconds
SO3 keyword rcutfac 5.0 
SO3 keyword nmax 3 
SO3 keyword lmax 4 
SO3 keyword alpha 2.0 
SO3 keyword nelems 1 
SO3 keyword elems Si 
SO3 keyword radelems 0.5 
SO3 keyword welems 14 
rcutfac cut 5 5
Neighbor list info ...
  update every 1 steps, delay 1 steps, check yes
  max neighbors/atom: 2000, page size: 100000
  master list distance cutoff = 6
  ghost atom cutoff = 6
  binsize = 3, bins = 4 4 4
  1 neighbor lists, perpetual/occasional/extra = 1 0 0
  (1) pair mliap, perpetual
      attributes: full, newton on
      pair build: full/bin/atomonly
      stencil: full/bin/3d
      bin: standard
Setting up Verlet run ...
  Unit style    : metal
  Current step  : 0
  Time step     : 0.001
Per MPI rank memory allocation (min/avg/max) = 206.8 | 206.8 | 206.8 Mbytes
Step Temp E_pair c_energy TotEng Press Lx Pxx Pxy 
       0         1500   -6.7288915   -6.7288915   -6.5380308    244272.75         10.8    243684.02    804.01466 
      10    800.03598   -6.6441333   -6.6441333   -6.5423364    195074.22      10.8031    193236.71    4160.0796 
      20     553.2668   -6.6151113   -6.6151113   -6.5447134    187470.32    10.811752    188737.87    11740.391 
      30    899.90015   -6.6602915   -6.6602915   -6.5457877     210028.7    10.825258    214114.73     15580.59 
      40     861.7212   -6.6505488   -6.6505488    -6.540903    196017.09    10.843768    196959.09    15515.007 
      50    1371.0067   -6.7062276   -6.7062276   -6.5317801    210546.62    10.867361    211002.75    25893.506 
      60    1857.5813   -6.7442675   -6.7442675    -6.507908    243416.46    10.896118    233009.13    24350.617 
      70    3023.4671   -6.8030741   -6.8030741   -6.4183668    268313.82    10.930749    263142.03    38223.776 
      80    3332.1624   -6.8092355   -6.8092355   -6.3852496    247480.99    10.971966    222644.83    46823.812 
      90    3714.0236   -6.7912135   -6.7912135   -6.3186394    205836.05    11.019542    164354.22    30091.048 
     100    3535.7131   -6.6730008   -6.6730008   -6.2231151    151129.29     11.07245    133622.37    63713.812 
Loop time of 195.316 on 1 procs for 100 steps with 64 atoms

Performance: 0.044 ns/day, 542.543 hours/ns, 0.512 timesteps/s
100.0% CPU use with 1 MPI tasks x no OpenMP threads

MPI task timing breakdown:
Section |  min time  |  avg time  |  max time  |%varavg| %total
---------------------------------------------------------------
Pair    | 195.31     | 195.31     | 195.31     |   0.0 |100.00
Neigh   | 0.00051234 | 0.00051234 | 0.00051234 |   0.0 |  0.00
Comm    | 0.0002929  | 0.0002929  | 0.0002929  |   0.0 |  0.00
Output  | 0.0001678  | 0.0001678  | 0.0001678  |   0.0 |  0.00
Modify  | 0.00060445 | 0.00060445 | 0.00060445 |   0.0 |  0.00
Other   |            | 0.0001614  |            |       |  0.00

Nlocal:        64.0000 ave          64 max          64 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost:        549.000 ave         549 max         549 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs:         0.00000 ave           0 max           0 min
Histogram: 1 0 0 0 0 0 0 0 0 0
FullNghs:      2512.00 ave        2512 max        2512 min
Histogram: 1 0 0 0 0 0 0 0 0 0

Total # of neighbors = 2512
Ave neighs/atom = 39.250000
Neighbor list builds = 4
Dangerous builds = 0
Total wall time: 0:03:17
macstein commented 3 years ago

@qzhu2017 I cloned https://github.com/macstein/lammps.git and checkout to mliap_so3 branch. And compiled:

make yes-snap
make yes-mliap
make mpi -j 16

Then, I pulled https://github.com/qzhu2017/PyXtal_FF.git and copied examples/Si-LAMMPS folder to lammps. I deleted last two line in 'Si-so3/DescriptorParam.txt':

# Descriptor parameters generated in PyXtal_FF•

# Required•
rcutfac 5.0•
nmax 3•
lmax 4•
alpha 2.0•

# Elements•

nelems 1•
elems Si•
radelems 0.5•
welems 14•

Then I got the result.

macstein@hp:/home/macstein/bk/unlv/work/lammps/github/mliap_so3_test/examples/Si-LAMMPS:~>../../src/lmp_mpi < md.in
LAMMPS (8 Apr 2021)
Lattice spacing in x,y,z = 5.4000000 5.4000000 5.4000000
Created orthogonal box = (0.0000000 0.0000000 0.0000000) to (10.800000 10.800000 10.800000)
  1 by 1 by 1 MPI processor grid
Created 64 atoms
  create_atoms CPU = 0.000 seconds
SO3 keyword rcutfac 5.0 
SO3 keyword nmax 3 
SO3 keyword lmax 4 
SO3 keyword alpha 2.0 
SO3 keyword nelems 1 
SO3 keyword elems Si 
SO3 keyword radelems 0.5 
SO3 keyword welems 14 
Neighbor list info ...
  update every 1 steps, delay 1 steps, check yes
  max neighbors/atom: 2000, page size: 100000
  master list distance cutoff = 6
  ghost atom cutoff = 6
  binsize = 3, bins = 4 4 4
  1 neighbor lists, perpetual/occasional/extra = 1 0 0
  (1) pair mliap, perpetual
      attributes: full, newton on
      pair build: full/bin/atomonly
      stencil: full/bin/3d
      bin: standard
Setting up Verlet run ...
  Unit style    : metal
  Current step  : 0
  Time step     : 0.001
Per MPI rank memory allocation (min/avg/max) = 206.8 | 206.8 | 206.8 Mbytes
Step Temp E_pair c_energy TotEng Press Lx Pxx Pxy 
       0         1500    -5.413805    -5.413805   -5.2229443    47314.408         10.8    46725.674    804.01466 
      10    987.62887   -5.3450018   -5.3450018   -5.2193354    50278.603    10.800612    49619.089     294.5607 
      20    497.11675   -5.2811502   -5.2811502   -5.2178968    47247.556    10.802521    47915.405   -369.73012 
      30     751.1425   -5.3115294   -5.3115294   -5.2159536    35509.659     10.80568    36815.954   -852.80953 
      40    858.19355   -5.3220807   -5.3220807   -5.2128838    27674.019    10.809821    27235.096   -1491.3587 
      50    492.39606   -5.2719712   -5.2719712   -5.2093185    26791.326    10.814733    24460.321   -10.068272 
      60    441.30431   -5.2630958   -5.2630958    -5.206944    24952.083    10.820361    24160.794     467.8531 
      70    940.67823   -5.3229433   -5.3229433   -5.2032509    19330.215     10.82662    21658.529    860.91045 
      80    975.75295   -5.3233016   -5.3233016   -5.1991463    21714.983    10.833378    22768.402    2235.6767 
      90    719.14546    -5.285934    -5.285934   -5.1944296    28026.029    10.840678    26827.741    1562.7642 
     100     865.8432   -5.3006565   -5.3006565   -5.1904863    28561.047    10.848656    27814.684      272.346 
Loop time of 2.28208 on 1 procs for 100 steps with 64 atoms

Performance: 3.786 ns/day, 6.339 hours/ns, 43.820 timesteps/s
95.8% CPU use with 1 MPI tasks x no OpenMP threads

MPI task timing breakdown:
Section |  min time  |  avg time  |  max time  |%varavg| %total
---------------------------------------------------------------
Pair    | 2.2802     | 2.2802     | 2.2802     |   0.0 | 99.92
Neigh   | 0.00024533 | 0.00024533 | 0.00024533 |   0.0 |  0.01
Comm    | 0.00033975 | 0.00033975 | 0.00033975 |   0.0 |  0.01
Output  | 0.00025988 | 0.00025988 | 0.00025988 |   0.0 |  0.01
Modify  | 0.00085354 | 0.00085354 | 0.00085354 |   0.0 |  0.04
Other   |            | 0.0001926  |            |       |  0.01

Nlocal:        64.0000 ave          64 max          64 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost:        557.000 ave         557 max         557 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs:         0.00000 ave           0 max           0 min
Histogram: 1 0 0 0 0 0 0 0 0 0
FullNghs:      2730.00 ave        2730 max        2730 min
Histogram: 1 0 0 0 0 0 0 0 0 0

Total # of neighbors = 2730
Ave neighs/atom = 42.656250
Neighbor list builds = 2
Dangerous builds = 0
Total wall time: 0:00:02

Please let me know if I missed some to reproduce the slower running. So far, in my tests, so3 slower about 4times than snap with/without including rcutoff function.

qzhu2017 commented 3 years ago

@macstein I got the same speed after I recompiled the code.

yanxon commented 3 years ago

@qzhu2017

Fix the dRij_dRm_norm for ACSF and wACSF

descriptors:

symmetry = {'G2': {'eta': [0.035709, 0.071418, 0.178545,
                           0.35709, 0.71418, 1.78545],
                   'Rs': [0]},
            'G4': {'lambda': [-1, 1],
                   'zeta': [1],
                   'eta': [0.035709, 0.071418, 0.178545, 0.35709]}
           }

descriptor = {'type': 'ACSF',
              'parameters': symmetry,
              'Rc': 5.0,
              'ncpu': 1,
              }

Prior results (1000 epochs):

==================== Evaluating Training Set ====================
The results for energy:
    Energy R2     0.997728
    Energy MAE    0.010598
    Energy RMSE   0.014579

The results for force:
    Force R2      0.957327
    Force MAE     0.118502
    Force RMSE    0.180454

The results for stress:
    Stress R2      0.988281
    Stress MAE     0.312531
    Stress RMSE    0.593674

================= Evaluating Testing Set =====================
The results for energy:
    Energy R2     0.998175
    Energy MAE    0.011113
    Energy RMSE   0.013573

The results for force:
    Force R2      0.950220
    Force MAE     0.127570
    Force RMSE    0.196540

The results for stress:
    Stress R2      0.989311
    Stress MAE     0.256398
    Stress RMSE    0.409561

After results (1000 epochs):

==================== Evaluating Training Set ====================
The results for energy:
    Energy R2     0.997728
    Energy MAE    0.010598
    Energy RMSE   0.014579

The results for force:
    Force R2      0.957327
    Force MAE     0.118502
    Force RMSE    0.180454

The results for stress:
    Stress R2      0.988281
    Stress MAE     0.312531
    Stress RMSE    0.593674

================= Evaluating Testing Set =====================
The results for energy:
    Energy R2     0.998175
    Energy MAE    0.011113
    Energy RMSE   0.013573

The results for force:
    Force R2      0.950220
    Force MAE     0.127570
    Force RMSE    0.196540

The results for stress:
    Stress R2      0.989311
    Stress MAE     0.256398
    Stress RMSE    0.409561

It seems like there is nothing changed in the results after the change. However, the ACSF computation per structure becomes about 2-3x higher. This is perhaps that the Si dataset doesn't have the special case that arises the difference in splitting the dGdr into i_dGdr and j_dGdr.

qzhu2017 commented 3 years ago

@yanxon Can you give the example which will lead to the failure of the old code? We need to figure out why the code fails for these special cases.

qzhu2017 commented 3 years ago

@weilaigit We have sent out the pull request to lammps. https://github.com/lammps/lammps/pull/2796

We will make the release of v0.1.8 after lammps merges our pull request.