Closed yanxon closed 3 years ago
@yanxon
Check my recent commit. Go to PyXtal_FF/examples/Si-LAMMPS
, you can run the script as follows. Clearly, something is messed up with the zbl forces. Should be an easy fix.
qzhu@cms Si-LAMMPS (master) $ python validate.py
0 -41.164 eV 20.792 GPa 0.000 0.000 0.000
1 -40.567 eV 21.046 GPa 0.000 0.000 0.000
2 -41.297 eV 20.267 GPa 0.000 0.000 0.000
3 -41.539 eV 18.660 GPa 0.000 0.000 0.000
4 -41.333 eV 19.804 GPa 0.000 0.000 0.000
5 -41.349 eV 19.034 GPa 0.000 0.000 0.000
6 -41.242 eV 19.493 GPa 0.000 0.000 0.000
7 -41.288 eV 19.123 GPa 0.000 0.000 0.000
8 -41.417 eV 18.865 GPa 0.000 0.000 0.000
9 -41.246 eV 19.668 GPa 0.000 0.000 0.000
10 -41.580 eV 19.202 GPa 0.000 0.000 0.000
11 -41.481 eV 20.017 GPa 0.000 0.000 0.000
12 -41.152 eV 20.199 GPa 0.000 0.000 0.000
13 -41.348 eV 19.523 GPa 0.000 0.000 0.000
14 -41.396 eV 19.366 GPa 0.000 0.000 0.000
15 -40.854 eV 19.978 GPa 0.000 0.000 0.000
16 -41.783 eV 18.815 GPa 0.000 0.000 0.000
17 -41.789 eV 18.177 GPa 0.000 0.000 0.000
18 -41.424 eV 19.139 GPa 0.000 0.000 0.000
19 -40.430 eV 21.355 GPa 0.000 0.042 0.055
eng: -40.42961328110127 -40.429798811356356
Forces from LAMMPS and PyXtal_FF
-1.573 2.380 -0.234 -> -1.573 2.380 -0.234 -> 0.000 -0.000 0.000
-4.037 -0.948 2.192 -> -4.020 -0.930 2.175 -> -0.017 -0.018 0.017
1.625 2.312 -2.010 -> 1.625 2.312 -2.010 -> -0.000 -0.000 0.000
2.381 -2.386 -1.735 -> 2.381 -2.386 -1.735 -> -0.000 0.000 0.000
1.491 -0.652 3.314 -> 1.491 -0.652 3.314 -> -0.000 0.000 -0.000
-2.411 -2.595 1.360 -> -2.411 -2.595 1.360 -> 0.000 0.000 -0.000
3.256 4.539 -3.311 -> 3.240 4.521 -3.294 -> 0.017 0.018 -0.017
-0.733 -2.650 0.424 -> -0.733 -2.650 0.424 -> 0.000 0.000 0.000
Breakdown of Pyxtal_FF
energy_ml (eV): -40.42996946967095
energy_zbl(eV): 0.0001706583145955065
forces (eV/A)
-1.573 2.380 -0.234 -> 0.000 0.000 0.000
-4.004 -0.913 2.160 -> -0.016 -0.017 0.016
1.625 2.312 -2.010 -> 0.000 0.000 0.000
2.381 -2.386 -1.735 -> 0.000 0.000 0.000
1.491 -0.652 3.314 -> 0.000 0.000 0.000
-2.411 -2.595 1.360 -> 0.000 0.000 0.000
3.224 4.504 -3.279 -> 0.016 0.017 -0.016
-0.733 -2.650 0.424 -> 0.000 0.000 0.000
stress_ml (GPa, xx, yy, zz, xy, xz, yz): [ 21.3135 21.1453 21.5978 1.5742 -5.9206 -3.7250]
stress_zbl(GPa, xx, yy, zz, xy, xz, yz): [ 0.0197 0.0230 0.0199 0.0213 -0.0198 -0.0214]
@qzhu2017
I fixed this issue in 657eab73589416ec6e8f11132b32b85930ca0bbf.
Let me see if I can update the test_all.py
script too to include a very small difference between inner and outer cutoff for future convenience.
The test case is added in 3b38f46c846f9b28d19fc2b9a5c49e38edd815c2.
@qzhu2017
The bug has not been fixed on my side after f65289589bca9dd5059aaa8c5a75a44673d84f7d. In PyXtal_FF/examples/Si-LAMMPS
, I run
qzhu@cms Si-LAMMPS (master) $ python validate.py
0 -41.525 eV 19.459 GPa 0.000 0.000 0.000
1 -41.322 eV 19.244 GPa 0.000 0.000 0.000
2 -41.325 eV 20.346 GPa 0.000 0.000 0.000
3 -41.008 eV 19.798 GPa 0.000 0.034 0.044
eng: -41.00799588506293 -41.00812871860695
Forces from LAMMPS and PyXtal_FF
-3.339 -2.387 -3.270 -> -3.326 -2.372 -3.256 -> -0.013 -0.015 -0.014
4.284 2.315 3.168 -> 4.271 2.300 3.154 -> 0.013 0.015 0.014
-0.279 0.182 1.095 -> -0.279 0.182 1.095 -> -0.000 -0.000 -0.000
-1.527 1.850 -2.837 -> -1.527 1.850 -2.837 -> 0.000 -0.000 0.000
-0.434 0.084 -0.442 -> -0.434 0.084 -0.442 -> -0.000 -0.000 0.000
1.728 -1.826 -1.479 -> 1.728 -1.826 -1.479 -> -0.000 0.000 0.000
0.210 -0.858 3.127 -> 0.210 -0.858 3.127 -> -0.000 0.000 -0.000
-0.643 0.640 0.638 -> -0.643 0.640 0.638 -> 0.000 -0.000 -0.000
Breakdown of Pyxtal_FF
energy_ml (eV): -41.008250609827485
energy_zbl(eV): 0.00012189122053740675
forces (eV/A)
-3.315 -2.358 -3.243 -> -0.012 -0.014 -0.013
4.259 2.286 3.141 -> 0.012 0.014 0.013
-0.279 0.182 1.095 -> 0.000 0.000 0.000
-1.527 1.850 -2.837 -> 0.000 0.000 0.000
-0.434 0.084 -0.442 -> 0.000 0.000 0.000
1.728 -1.826 -1.479 -> 0.000 0.000 0.000
0.210 -0.858 3.127 -> 0.000 0.000 0.000
-0.643 0.640 0.638 -> 0.000 0.000 0.000
stress_ml (GPa, xx, yy, zz, xy, xz, yz): [ 19.7681 20.8087 19.5361 -0.5927 2.0311 3.1119]
stress_zbl(GPa, xx, yy, zz, xy, xz, yz): [ 0.0145 0.0189 0.0167 0.0165 0.0155 0.0178]
The forces are not consistent.
@yanxon
Here is the updated output from validate.py
qzhu@cms Si-LAMMPS (master) $ python validate.py
0 -41.525 eV 19.459 GPa 0.000 0.000 0.000
1 -41.322 eV 19.244 GPa 0.000 0.000 0.000
2 -41.325 eV 20.346 GPa 0.000 0.000 0.000
3 -41.008 eV 19.798 GPa 0.000 0.034 0.044
eng: -41.00799588506293 -41.00812871860695
Forces from LAMMPS and PyXtal_FF
-3.3393 -2.3866 -3.2695 -> -3.3264 -2.3719 -3.2557 -> -0.0129 -0.0147 -0.0138
4.2840 2.3147 3.1680 -> 4.2711 2.2999 3.1542 -> 0.0129 0.0147 0.0138
-0.2785 0.1817 1.0952 -> -0.2785 0.1817 1.0952 -> -0.0000 -0.0000 -0.0000
-1.5274 1.8504 -2.8370 -> -1.5274 1.8504 -2.8370 -> 0.0000 -0.0000 0.0000
-0.4340 0.0841 -0.4425 -> -0.4340 0.0841 -0.4425 -> -0.0000 -0.0000 0.0000
1.7282 -1.8263 -1.4795 -> 1.7282 -1.8263 -1.4795 -> -0.0000 0.0000 0.0000
0.2098 -0.8583 3.1269 -> 0.2098 -0.8583 3.1269 -> -0.0000 0.0000 -0.0000
-0.6428 0.6405 0.6383 -> -0.6428 0.6405 0.6383 -> 0.0000 -0.0000 -0.0000
Breakdown of Pyxtal_FF
energy_ml (eV): -41.008250609827485
energy_zbl(eV): 0.00012189122053740675
forces (eV/A)
-3.315 -2.358 -3.243 -> -0.012 -0.014 -0.013
4.259 2.286 3.141 -> 0.012 0.014 0.013
-0.279 0.182 1.095 -> 0.000 0.000 0.000
-1.527 1.850 -2.837 -> 0.000 0.000 0.000
-0.434 0.084 -0.442 -> 0.000 0.000 0.000
1.728 -1.826 -1.479 -> 0.000 0.000 0.000
0.210 -0.858 3.127 -> 0.000 0.000 0.000
-0.643 0.640 0.638 -> 0.000 0.000 0.000
stress_ml (GPa, xx, yy, zz, xy, xz, yz): [ 19.7681 20.8087 19.5361 -0.5927 2.0311 3.1119]
stress_zbl(GPa, xx, yy, zz, xy, xz, yz): [ 0.0145 0.0189 0.0167 0.0165 0.0155 0.0178]
Breakdown of LAMMPS
energy_ml (eV): -41.00825062318803
energy_zbl(eV): 0.0002547247607291858
Forces
-3.315 -2.358 -3.243 -> -0.025 -0.028 -0.027
4.259 2.286 3.141 -> 0.025 0.028 0.027
-0.279 0.182 1.095 -> 0.000 0.000 0.000
-1.527 1.850 -2.837 -> 0.000 0.000 0.000
-0.434 0.084 -0.442 -> 0.000 0.000 0.000
1.728 -1.826 -1.479 -> 0.000 0.000 0.000
0.210 -0.858 3.127 -> 0.000 0.000 0.000
-0.643 0.640 0.638 -> 0.000 0.000 0.000
stress_ml (GPa, xx, yy, zz, xy, xz, yz): [ 19.7681 20.8087 19.5361 -0.5927 2.0311 3.1119]
stress_zbl(GPa, xx, yy, zz, xy, xz, yz): [ 0.0301 0.0394 0.0348 0.0344 0.0323 0.0370]
It seems that the zbl output from PyXtal is about only half of the values from lammps for this structure.
@yanxon Can you resolve this issue soon. It seems that there is a fundamental problem that both energy/forces from pyxtal_FF are only about half of the outputs from lammps.
@qzhu2017 I am looking at it. I'm not sure what's wrong yet. Hopefully, I can spot something. Sometimes, it's just a silly mistake.
@qzhu2017 Can we please have a quick meeting today, say 5-10 mins? I think I know what's going on.
https://unlv.webex.com/meet/qiang.zhu
On Sat, May 15, 2021 at 6:27 PM Howard Yanxon @.***> wrote:
@qzhu2017 https://github.com/qzhu2017 Can we please have a quick meeting today, say 5-10 mins? I think I know what's going on.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qzhu2017/PyXtal_FF/issues/45#issuecomment-841750411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHAUZ5RM5AFLHGE5F2GJSFLTN4NQRANCNFSM445CXFUA .
-- [image: Photograph] http://www.skarif2.io/ Qiang Zhu Assistant Professor University of Nevada Las Vegas • Physics and Astronomy Phone ⋅ +1 702 895 1710 Email ⋅ @. Address ⋅ BPB 232, 4505 S. Maryland Parkway @.,-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/
@qzhu2017
I successfully installed lammps-python and ran validate.py
. I got this result:
3 -37.583 eV 50.343 GPa 0.029 1.140 1.615
eng: -37.582944530794485 -37.611991540348335
Forces from LAMMPS and PyXtal_FF
-5.1019 -3.9989 -5.1461 -> -4.6704 -3.5021 -4.6808 -> -0.4315 -0.4968 -0.4653
6.4002 3.9275 4.8345 -> 5.9687 3.4307 4.3692 -> 0.4315 0.4968 0.4653
-0.1972 0.2448 1.5855 -> -0.1972 0.2448 1.5855 -> -0.0000 -0.0000 -0.0000
-2.1801 2.4429 -3.6152 -> -2.1690 2.4330 -3.6052 -> -0.0111 0.0099 -0.0100
-0.6702 0.1857 -0.7116 -> -0.6702 0.1857 -0.7116 -> -0.0000 -0.0000 0.0000
2.4327 -2.4534 -1.7964 -> 2.4327 -2.4534 -1.7964 -> -0.0000 0.0000 0.0000
0.2616 -1.1736 4.1861 -> 0.2506 -1.1636 4.1761 -> 0.0111 -0.0099 0.0100
-0.9453 0.8250 0.6633 -> -0.9453 0.8250 0.6633 -> 0.0000 -0.0000 -0.0000
Breakdown of Pyxtal_FF
energy_ml (eV): -37.64178279348804
energy_zbl(eV): 0.029791253139706875
forces (eV/A)
-4.206 -2.967 -4.180 -> -0.465 -0.535 -0.501
5.504 2.896 3.868 -> 0.465 0.535 0.501
-0.197 0.245 1.585 -> 0.000 0.000 0.000
-2.159 2.424 -3.596 -> -0.010 0.009 -0.009
-0.670 0.186 -0.712 -> 0.000 0.000 0.000
2.433 -2.453 -1.796 -> 0.000 0.000 0.000
0.240 -1.154 4.167 -> 0.010 -0.009 0.009
-0.945 0.825 0.663 -> 0.000 0.000 0.000
stress_ml (GPa, xx, yy, zz, xy, xz, yz): [ 49.1432 50.9964 48.6411 -1.1376 2.7436 4.5140]
stress_zbl(GPa, xx, yy, zz, xy, xz, yz): [ 0.6208 0.8148 0.7165 0.6821 0.6667 0.7381]
Breakdown of LAMMPS
energy_ml (eV): -37.64178281119801
energy_zbl(eV): 0.058838262604393066
Forces
-4.206 -2.967 -4.180 -> -0.896 -1.032 -0.966
5.504 2.896 3.868 -> 0.896 1.032 0.966
-0.197 0.245 1.585 -> 0.000 0.000 0.000
-2.159 2.424 -3.596 -> -0.021 0.019 -0.019
-0.670 0.186 -0.712 -> 0.000 0.000 0.000
2.433 -2.453 -1.796 -> 0.000 0.000 0.000
0.240 -1.154 4.167 -> 0.021 -0.019 0.019
-0.945 0.825 0.663 -> 0.000 0.000 0.000
stress_ml (GPa, xx, yy, zz, xy, xz, yz): [ 49.1432 50.9964 48.6411 -1.1376 2.7436 4.5140]
stress_zbl(GPa, xx, yy, zz, xy, xz, yz): [ 1.1999 1.5736 1.3839 1.3133 1.2882 1.4214]
Now, I take the "random" structure 3 and convert it to lammps data structure and the corresponding cif file. Then, I ran it with lmp_mpi
using the in_file, and I get the same results as the validate.py
, which is expected.
Then you can run the base_potential.py
in https://github.com/qzhu2017/PyXtal_FF/blob/master/examples/Si-LAMMPS/validate/base_potential.py. The base_potential.py
is the one that I currently have implemented in PyXtal_FF. Here is the result:
Energy: 0.05881695165257561
Force:
[[-0.895870 -1.031627 -0.966130]
[ 0.895870 1.031627 0.966130]
[ 0.000000 0.000000 0.000000]
[-0.021165 0.018975 -0.019159]
[ 0.000000 0.000000 0.000000]
[ 0.000000 0.000000 0.000000]
[ 0.021165 -0.018975 0.019159]
[ 0.000000 0.000000 0.000000]]
Stress: [ 0.007486 0.009819 0.008635 0.008196 0.008038 0.008871]
Conc: I don't think there is anything wrong with the base_potential.py
. Perhaps, there is something wrong with the Calculator.
@qzhu2017
If you run this script:
import torch
model = torch.load("Si-snap-zbl/12-12-checkpoint.pth")
print(model['des_info'])
You will get this:
{'system': ['Si'], 'type': 'SNAP', 'Rc': 5.0, 'weights': {'Si': 1.0}, 'N': None, 'N_train': None, 'N_test': None, 'ncpu': 1, 'force': True, 'stress': True, 'cutoff': 'cosine', 'base_potential': {'inner': 1.0, 'outer': 2.0}, 'parameters': {'lmax': 3, 'rfac': 0.99363, 'normalize_U': False}}
The inner/outer is 1.0/2.0, not 1.5/2.0.
If you update the NN model, this should solve the issue.
@yanxon I just fixed it as follows
@qzhu2017
I am testing ZBL PyXtal_FF with Si dataset.
For instance, when the inner cutoff = 2.5 and outer cutoff = 3.0:
the inner cutoff = 2.5 and outer cutoff = 3.5:
Note: Stress is correct here.
the inner cutoff = 2.5 and outer cutoff = 4.0:
Note: The force error is less pronounce.
As the difference between outer and inner is greater, the error between pyxtal_ff and lammps becomes less pronounced. Nevertheless, the energy is always correct.