Merge pull request #657 from lammps/snap-potentials

new SNAP potentials and examples
This commit is contained in:
Steve Plimpton 2017-09-20 09:34:51 -06:00 committed by GitHub
commit 638b91bf74
12 changed files with 229 additions and 88 deletions

View File

@ -178,7 +178,7 @@ not the same and the current value is not the default.
Note that some force field styles (pair, bond, angle, etc) do not
store their coefficient info in restart files. Typically these are
many-body or tabulated potentials which read their parameters from
separate files. In these cases you will need to re-specify the "pair
separate files. In these cases you will need to re-specify the
"pair_coeff"_pair_coeff.html, "bond_coeff"_bond_coeff.html, etc
commands in your restart input script. The doc pages for individual
force field styles mention if this is the case. This is also true of

View File

@ -0,0 +1,7 @@
# DATE: 2017-09-18 CONTRIBUTOR: Chi Chen <chc273@eng.ucsd.edu> CITATION: C. Chen, Z. Deng, R. Tran, H. Tang, I.-H. Chu, S. P. Ong, "Accurate force field for molybdenum by machine learning large materials data" Physical Review Materials 1, 04 3603 (2017)
# Generated by Materials Virtual Lab
# Definition of SNAP potential.
pair_style snap
pair_coeff * * Mo_Chen_PRM2017.snapcoeff Mo Mo_Chen_PRM2017.snapparam Mo

View File

@ -0,0 +1,35 @@
# DATE: 2017-09-18 CONTRIBUTOR: Chi Chen <chc273@eng.ucsd.edu> CITATION: C. Chen, Z. Deng, R. Tran, H. Tang, I.-H. Chu, S. P. Ong, "Accurate force field for molybdenum by machine learning large materials data" Physical Review Materials 1, 04 3603 (2017)
# Generated by Materials Virtual Lab
1 31
Mo 0.5 1
-17.2757958404
0.00431015861472
0.0657685117891
0.477733335702
0.0152688837211
0.77559888196
0.284846429566
0.148804982644
0.0573702179736
0.19281989434
0.323441703578
0.101324335724
0.0139639846514
-0.0324444749083
0.0349797952779
0.0613023441282
0.0881078513046
0.118716074611
0.0069662975532
-0.0174658914685
-0.0178902177779
0.0195993756659
0.0719238160707
0.0344832661036
-0.0358616891662
-0.0292380783172
-0.0334933909866
0.00595462520243
0.0754556638328
-0.000972545258845
-0.0100170422751

View File

@ -0,0 +1,4 @@
# DATE: 2017-09-18 CONTRIBUTOR: Chi Chen <chc273@eng.ucsd.edu> CITATION: C. Chen, Z. Deng, R. Tran, H. Tang, I.-H. Chu, S. P. Ong, "Accurate force field for molybdenum by machine learning large materials data" Physical Review Materials 1, 04 3603 (2017)
# Generated by Materials Virtual Lab
rcutfac 4.615858
twojmax 6

View File

@ -0,0 +1,45 @@
# Demonstrate SNAP Ta potential
# Initialize simulation
variable nsteps index 100
variable nrep equal 4
variable a equal 3.160
units metal
# generate the box and atom positions using a BCC lattice
variable nx equal ${nrep}
variable ny equal ${nrep}
variable nz equal ${nrep}
boundary p p p
lattice bcc $a
region box block 0 ${nx} 0 ${ny} 0 ${nz}
create_box 1 box
create_atoms 1 box
mass 1 183.84
# choose potential
include Mo_Chen_PRM2017.snap
# Setup output
thermo 10
thermo_modify norm yes
# Set up NVE run
timestep 0.5e-3
neighbor 1.0 bin
neigh_modify once no every 1 delay 0 check yes
# Run MD
velocity all create 300.0 4928459
fix 1 all nve
run ${nsteps}

View File

@ -21,7 +21,7 @@ Instructions:
tarball either in this /lib/voronoi directory
or somewhere else on your system.
2. compile Voro++ from within its home directory
2. Compile Voro++ from within its home directory
% make
3. There is no need to install Voro++ if you only wish

View File

@ -0,0 +1,6 @@
# DATE: 2017-09-18 CONTRIBUTOR: Chi Chen <chc273@eng.ucsd.edu> CITATION: C. Chen, Z. Deng, R. Tran, H. Tang, I.-H. Chu, S. P. Ong, "Accurate force field for molybdenum by machine learning large materials data" Physical Review Materials 1, 04 3603 (2017)
# Generated by Materials Virtual Lab
# Definition of SNAP potential.
pair_style snap
pair_coeff * * Mo_Chen_PRM2017.snapcoeff Mo Mo_Chen_PRM2017.snapparam Mo

View File

@ -0,0 +1,35 @@
# DATE: 2017-09-18 CONTRIBUTOR: Chi Chen <chc273@eng.ucsd.edu> CITATION: C. Chen, Z. Deng, R. Tran, H. Tang, I.-H. Chu, S. P. Ong, "Accurate force field for molybdenum by machine learning large materials data" Physical Review Materials 1, 04 3603 (2017)
# Generated by Materials Virtual Lab
1 31
Mo 0.5 1
-17.2757958404
0.00431015861472
0.0657685117891
0.477733335702
0.0152688837211
0.77559888196
0.284846429566
0.148804982644
0.0573702179736
0.19281989434
0.323441703578
0.101324335724
0.0139639846514
-0.0324444749083
0.0349797952779
0.0613023441282
0.0881078513046
0.118716074611
0.0069662975532
-0.0174658914685
-0.0178902177779
0.0195993756659
0.0719238160707
0.0344832661036
-0.0358616891662
-0.0292380783172
-0.0334933909866
0.00595462520243
0.0754556638328
-0.000972545258845
-0.0100170422751

View File

@ -0,0 +1,4 @@
# DATE: 2017-09-18 CONTRIBUTOR: Chi Chen <chc273@eng.ucsd.edu> CITATION: C. Chen, Z. Deng, R. Tran, H. Tang, I.-H. Chu, S. P. Ong, "Accurate force field for molybdenum by machine learning large materials data" Physical Review Materials 1, 04 3603 (2017)
# Generated by Materials Virtual Lab
rcutfac 4.615858
twojmax 6

View File

@ -2,7 +2,7 @@
# Definition of SNAP potential Ta_Cand06A
# Assumes 1 LAMMPS atom type
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 73

View File

@ -8,8 +8,8 @@ variable zblz equal 74
# Specify hybrid with SNAP, ZBL, and long-range Coulomb
pair_style hybrid/overlay zbl ${zblcutinner} ${zblcutouter} snap table spline 10000 table spline 10000
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * snap W_2940_2017_2.snapcoeff W W_2940_2017_2.snapparam W NULL
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * snap W_2940_2017_2.snapcoeff W W_2940_2017_2.snapparam W NULL
pair_coeff 2 2 table 1 He_He_JW2013.table HeHe
pair_coeff 1 2 table 2 W_He_JW2013.table WHe
#Hybrid/overlay will take all pair styles and add their contributions equally, order of pair_coeff doesnt matter here

View File

@ -39,7 +39,8 @@ ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg),
distsq(NULL), nearest(NULL), centro(NULL)
{
if (narg < 4 || narg > 6) error->all(FLERR,"Illegal compute centro/atom command");
if (narg < 4 || narg > 6)
error->all(FLERR,"Illegal compute centro/atom command");
if (strcmp(arg[3],"fcc") == 0) nnn = 12;
else if (strcmp(arg[3],"bcc") == 0) nnn = 8;
@ -48,13 +49,14 @@ ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) :
// default values
axes_flag = 0;
// optional keywords
int iarg = 4;
while (iarg < narg) {
if (strcmp(arg[iarg],"axes") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute centro/atom command3");
if (iarg+2 > narg)
error->all(FLERR,"Illegal compute centro/atom command3");
if (strcmp(arg[iarg+1],"yes") == 0) axes_flag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) axes_flag = 0;
else error->all(FLERR,"Illegal compute centro/atom command2");
@ -68,7 +70,7 @@ ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) :
peratom_flag = 1;
if (!axes_flag) size_peratom_cols = 0;
else size_peratom_cols = 10;
nmax = 0;
maxneigh = 0;
}
@ -137,7 +139,8 @@ void ComputeCentroAtom::compute_peratom()
memory->destroy(array_atom);
nmax = atom->nmax;
memory->create(centro,nmax,"centro/atom:centro");
memory->create(array_atom,nmax,size_peratom_cols,"centro/atom:array_atom");
memory->create(array_atom,nmax,size_peratom_cols,
"centro/atom:array_atom");
}
}
@ -202,98 +205,98 @@ void ComputeCentroAtom::compute_peratom()
}
// check whether to include local crystal symmetry axes
if (!axes_flag) {
// if not nnn neighbors, centro = 0.0
// if not nnn neighbors, centro = 0.0
if (n < nnn) {
centro[i] = 0.0;
continue;
}
if (n < nnn) {
centro[i] = 0.0;
continue;
}
// store nnn nearest neighs in 1st nnn locations of distsq and nearest
// store nnn nearest neighs in 1st nnn locations of distsq and nearest
select2(nnn,n,distsq,nearest);
select2(nnn,n,distsq,nearest);
// R = Ri + Rj for each of npairs i,j pairs among nnn neighbors
// pairs = squared length of each R
// R = Ri + Rj for each of npairs i,j pairs among nnn neighbors
// pairs = squared length of each R
n = 0;
for (j = 0; j < nnn; j++) {
jj = nearest[j];
for (k = j+1; k < nnn; k++) {
kk = nearest[k];
delx = x[jj][0] + x[kk][0] - 2.0*xtmp;
dely = x[jj][1] + x[kk][1] - 2.0*ytmp;
delz = x[jj][2] + x[kk][2] - 2.0*ztmp;
pairs[n++] = delx*delx + dely*dely + delz*delz;
n = 0;
for (j = 0; j < nnn; j++) {
jj = nearest[j];
for (k = j+1; k < nnn; k++) {
kk = nearest[k];
delx = x[jj][0] + x[kk][0] - 2.0*xtmp;
dely = x[jj][1] + x[kk][1] - 2.0*ytmp;
delz = x[jj][2] + x[kk][2] - 2.0*ztmp;
pairs[n++] = delx*delx + dely*dely + delz*delz;
}
}
}
}
} else {
// calculate local crystal symmetry axes
// calculate local crystal symmetry axes
// rsq1, rsq2 are two smallest values of R^2
// R1, R2 are corresponding vectors Ri - Rj
// R3 is normal to R1, R2
// rsq1, rsq2 are two smallest values of R^2
// R1, R2 are corresponding vectors Ri - Rj
// R3 is normal to R1, R2
double rsq1,rsq2;
double rsq1,rsq2;
double* r1 = &array_atom[i][1];
double* r2 = &array_atom[i][4];
double* r3 = &array_atom[i][7];
if (n < nnn) {
centro[i] = 0.0;
MathExtra::zero3(r1);
MathExtra::zero3(r2);
MathExtra::zero3(r3);
continue;
}
double* r1 = &array_atom[i][1];
double* r2 = &array_atom[i][4];
double* r3 = &array_atom[i][7];
if (n < nnn) {
centro[i] = 0.0;
MathExtra::zero3(r1);
MathExtra::zero3(r2);
MathExtra::zero3(r3);
continue;
}
// store nnn nearest neighs in 1st nnn locations of distsq and nearest
// store nnn nearest neighs in 1st nnn locations of distsq and nearest
select2(nnn,n,distsq,nearest);
select2(nnn,n,distsq,nearest);
n = 0;
rsq1 = rsq2 = cutsq;
for (j = 0; j < nnn; j++) {
jj = nearest[j];
for (k = j+1; k < nnn; k++) {
kk = nearest[k];
delx = x[jj][0] + x[kk][0] - 2.0*xtmp;
dely = x[jj][1] + x[kk][1] - 2.0*ytmp;
delz = x[jj][2] + x[kk][2] - 2.0*ztmp;
double rsq = delx*delx + dely*dely + delz*delz;
pairs[n++] = rsq;
if (rsq < rsq2) {
if (rsq < rsq1) {
rsq2 = rsq1;
MathExtra::copy3(r1, r2);
rsq1 = rsq;
MathExtra::sub3(x[jj],x[kk],r1);
} else {
rsq2 = rsq;
MathExtra::sub3(x[jj],x[kk],r2);
}
n = 0;
rsq1 = rsq2 = cutsq;
for (j = 0; j < nnn; j++) {
jj = nearest[j];
for (k = j+1; k < nnn; k++) {
kk = nearest[k];
delx = x[jj][0] + x[kk][0] - 2.0*xtmp;
dely = x[jj][1] + x[kk][1] - 2.0*ytmp;
delz = x[jj][2] + x[kk][2] - 2.0*ztmp;
double rsq = delx*delx + dely*dely + delz*delz;
pairs[n++] = rsq;
if (rsq < rsq2) {
if (rsq < rsq1) {
rsq2 = rsq1;
MathExtra::copy3(r1, r2);
rsq1 = rsq;
MathExtra::sub3(x[jj],x[kk],r1);
} else {
rsq2 = rsq;
MathExtra::sub3(x[jj],x[kk],r2);
}
}
}
}
}
}
MathExtra::cross3(r1,r2,r3);
MathExtra::norm3(r1);
MathExtra::norm3(r2);
MathExtra::norm3(r3);
MathExtra::cross3(r1,r2,r3);
MathExtra::norm3(r1);
MathExtra::norm3(r2);
MathExtra::norm3(r3);
}
// store nhalf smallest pair distances in 1st nhalf locations of pairs
select(nhalf,npairs,pairs);
// centrosymmetry = sum of nhalf smallest squared values
value = 0.0;
@ -303,9 +306,9 @@ void ComputeCentroAtom::compute_peratom()
} else {
centro[i] = 0.0;
if (axes_flag) {
MathExtra::zero3(&array_atom[i][1]);
MathExtra::zero3(&array_atom[i][4]);
MathExtra::zero3(&array_atom[i][7]);
MathExtra::zero3(&array_atom[i][1]);
MathExtra::zero3(&array_atom[i][4]);
MathExtra::zero3(&array_atom[i][7]);
}
}
}
@ -316,10 +319,11 @@ void ComputeCentroAtom::compute_peratom()
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
if (mask[i] & groupbit)
array_atom[i][0] = centro[i];
array_atom[i][0] = centro[i];
}
}
/* ----------------------------------------------------------------------
2 select routines from Numerical Recipes (slightly modified)
find k smallest values in array of length n
@ -434,5 +438,6 @@ void ComputeCentroAtom::select2(int k, int n, double *arr, int *iarr)
double ComputeCentroAtom::memory_usage()
{
double bytes = nmax * sizeof(double);
if (axes_flag) bytes += size_peratom_cols*nmax * sizeof(double);
return bytes;
}