Removed redundant element list from pair_coeff snap syntax

This commit is contained in:
Aidan Thompson 2018-12-03 20:28:01 -07:00
parent 67041a5446
commit fa7e02ea71
19 changed files with 54 additions and 306 deletions

View File

@ -16,7 +16,7 @@ pair_style snap :pre
[Examples:]
pair_style snap
pair_coeff * * InP.snapcoeff In P InP.snapparam In In P P :pre
pair_coeff * * InP.snapcoeff InP.snapparam In In P P :pre
[Description:]
@ -48,14 +48,12 @@ not set in the pair_style or pair_coeff command; they are specified in
the SNAP potential files themselves.
Only a single pair_coeff command is used with the {snap} style which
specifies two SNAP files and the list SNAP element(s) to be
extracted.
The SNAP elements are mapped to LAMMPS atom types by specifying
N additional arguments after the 2nd filename in the pair_coeff
command, where N is the number of LAMMPS atom types:
specifies a SNAP coefficient file followed by a SNAP parameter file
and then N additional arguments specifying the mapping of SNAP
elements to LAMMPS atom types, where N is the number of
LAMMPS atom types:
SNAP element file
Elem1, Elem2, ...
SNAP coefficient file
SNAP parameter file
N element names = mapping of SNAP elements to atom types :ul
@ -63,13 +61,11 @@ As an example, if a LAMMPS indium phosphide simulation has 4 atoms
types, with the first two being indium and the 3rd and 4th being
phophorous, the pair_coeff command would look like this:
pair_coeff * * snap InP.snapcoeff In P InP.snapparam In In P P :pre
pair_coeff * * snap InP.snapcoeff InP.snapparam In In P P :pre
The 1st 2 arguments must be * * so as to span all LAMMPS atom types.
The two filenames are for the element and parameter files, respectively.
The 'In' and 'P' arguments (between the file names) are the two elements
which will be extracted from the element file. The
two trailing 'In' arguments map LAMMPS atom types 1 and 2 to the
The two filenames are for the coefficient and parameter files, respectively.
The two trailing 'In' arguments map LAMMPS atom types 1 and 2 to the
SNAP 'In' element. The two trailing 'P' arguments map LAMMPS atom types
3 and 4 to the SNAP 'P' element.
@ -79,10 +75,11 @@ This can be used when a {snap} potential is used as part of the
{hybrid} pair style. The NULL values are placeholders for atom types
that will be used with other potentials.
The name of the SNAP element file usually ends in the
The name of the SNAP coefficient file usually ends in the
".snapcoeff" extension. It may contain coefficients
for many SNAP elements.
Only those elements listed in the pair_coeff command are extracted.
for many SNAP elements. The only requirement is that it
contain at least those element names appearing in the
LAMMPS mapping list.
The name of the SNAP parameter file usually ends in the ".snapparam"
extension. It contains a small number
of parameters that define the overall form of the SNAP potential.
@ -110,8 +107,7 @@ It is convenient to keep these commands in a separate file that can
be inserted in any LAMMPS input script using the "include"_include.html
command.
The top of the SNAP element file can contain any number of blank and comment
lines (start with #), but follows a strict
The top of the SNAP coefficient file can contain any number of blank and comment lines (start with #), but follows a strict
format after that. The first non-blank non-comment
line must contain two integers:

View File

@ -1,7 +0,0 @@
# 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 @@
../../potentials/Mo_Chen_PRM2017.snap

View File

@ -1,35 +0,0 @@
# 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 @@
../../potentials/Mo_Chen_PRM2017.snapcoeff

View File

@ -1,4 +0,0 @@
# 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 @@
../../potentials/Mo_Chen_PRM2017.snapparam

View File

@ -1,17 +0,0 @@
# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
# Definition of SNAP potential Ta_Cand06A
# Assumes 1 LAMMPS atom type
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 73
# Specify hybrid with SNAP, ZBL
pair_style hybrid/overlay &
zbl ${zblcutinner} ${zblcutouter} &
snap
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * snap Ta06A.snapcoeff Ta Ta06A.snapparam Ta

1
examples/snap/Ta06A.snap Symbolic link
View File

@ -0,0 +1 @@
../../potentials/Ta06A.snap

View File

@ -1,37 +0,0 @@
# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
# LAMMPS SNAP coefficients for Ta_Cand06A
1 31
Ta 0.5 1
-2.92477
-0.01137
-0.00775
-0.04907
-0.15047
0.09157
0.05590
0.05785
-0.11615
-0.17122
-0.10583
0.03941
-0.11284
0.03939
-0.07331
-0.06582
-0.09341
-0.10587
-0.15497
0.04820
0.00205
0.00060
-0.04898
-0.05084
-0.03371
-0.01441
-0.01501
-0.00599
-0.06373
0.03965
0.01072

View File

@ -0,0 +1 @@
../../potentials/Ta06A.snapcoeff

View File

@ -1,15 +0,0 @@
# DATE: 2014-09-05 CONTRIBUTOR: Aidan Thompson athomps@sandia.gov CITATION: Thompson, Swiler, Trott, Foiles and Tucker, arxiv.org, 1409.3880 (2014)
# LAMMPS SNAP parameters for Ta_Cand06A
# required
rcutfac 4.67637
twojmax 6
# optional
rfac0 0.99363
rmin0 0
diagonalstyle 3
bzeroflag 0
quadraticflag 0

View File

@ -0,0 +1 @@
../../potentials/Ta06A.snapparam

View File

@ -1,16 +0,0 @@
# DATE: 2017-02-20 CONTRIBUTOR: Mitchell Wood mitwood@sandia.gov CITATION: Wood, M. A. and Thompson, A. P. "Quantum-Accurate Molecular Dynamics Potential for Tungsten" arXiv:1702.07042 [physics.comp-ph]
#
# Definition of SNAP+ZBL potential.
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 74
# Specify hybrid with SNAP and ZBL
pair_style hybrid/overlay &
zbl ${zblcutinner} ${zblcutouter} &
snap
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * snap W_2940_2017_2.snapcoeff W W_2940_2017_2.snapparam W
#Nomenclature on the snap files are Element_DakotaID_Year_Month

View File

@ -0,0 +1 @@
../../potentials/W_2940_2017_2.snap

View File

@ -1,62 +0,0 @@
# DATE: 2017-02-20 CONTRIBUTOR: Mitchell Wood mitwood@sandia.gov CITATION: Wood, M. A. and Thompson, A. P. "Quantum-Accurate Molecular Dynamics Potential for Tungsten" arXiv:1702.07042 [physics.comp-ph]
#
# LAMMPS SNAP coefficients for W
1 56
W 0.5 1
0.781170857801
-0.001794941735
-0.016628679036
-0.066625537037
-0.073716343967
-0.062913923923
0.032552694672
-0.134901744419
-0.075076334103
-0.148558616547
-0.140808831101
-0.166749145704
-0.047487675984
-0.049892090603
-0.032483739965
-0.114766534860
-0.106759718242
-0.125894850485
-0.103409735225
-0.095247335447
-0.061998736346
-0.053895610976
-0.010799734206
-0.011644828900
-0.028316826924
0.011176085541
0.064619474684
-0.023886279996
-0.004099224312
-0.056084222496
-0.035551497650
-0.056678501024
-0.004905851656
-0.015701146162
-0.008462280779
0.016429018676
0.032432633993
-0.010805361272
-0.014841893457
0.019414134562
-0.008112452759
-0.002700775447
0.007032887063
-0.009706065042
0.008385967833
0.028606085876
-0.007003591067
0.006467260152
-0.006666986361
0.029243285316
0.002477673872
-0.000199497504
0.004068954075
0.006036129972
-0.013010633924
-0.008314173699

View File

@ -0,0 +1 @@
../../potentials/W_2940_2017_2.snapcoeff

View File

@ -1,13 +0,0 @@
# DATE: 2017-02-20 CONTRIBUTOR: Mitchell Wood mitwood@sandia.gov CITATION: Wood, M. A. and Thompson, A. P. "Quantum-Accurate Molecular Dynamics Potential for Tungsten" arXiv:1702.07042 [physics.comp-ph]
#
# required
rcutfac 4.73442
twojmax 8
# optional
rfac0 0.99363
rmin0 0
diagonalstyle 3
bzeroflag 0
quadraticflag 0

View File

@ -0,0 +1 @@
../../potentials/W_2940_2017_2.snapparam

View File

@ -1,17 +0,0 @@
# DATE: 2017-02-20 CONTRIBUTOR: Mitchell Wood mitwood@sandia.gov CITATION: Wood, M. A. and Thompson, A. P. "Quantum-Accurate Molecular Dynamics Potential for Tungsten" arXiv:1702.07042 [physics.comp-ph]
#
# Definition of SNAP+ZBL+Tabulated potential.
variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 74
# Specify hybrid with SNAP and ZBL
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 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
#This is not the case for pair_style hybrid ... where only one pair_coeff is read for each type combination, order matters here.

View File

@ -0,0 +1 @@
../../potentials/W_2940_2017_2_He_JW2013.snap

View File

@ -1,6 +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
pair_coeff * * Mo_Chen_PRM2017.snapcoeff Mo_Chen_PRM2017.snapparam Mo

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
@ -13,5 +13,5 @@ pair_style hybrid/overlay &
zbl ${zblcutinner} ${zblcutouter} &
snap
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * snap Ta06A.snapcoeff Ta Ta06A.snapparam Ta
pair_coeff * * snap Ta06A.snapcoeff Ta06A.snapparam Ta

View File

@ -8,7 +8,8 @@ twojmax 6
# optional
gamma 1
rfac0 0.99363
rmin0 0
diagonalstyle 3
bzeroflag 0
quadraticflag 0

View File

@ -5,12 +5,12 @@ variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 74
# Specify hybrid with SNAP, ZBL, and long-range Coulomb
# Specify hybrid with SNAP and ZBL
pair_style hybrid/overlay &
zbl ${zblcutinner} ${zblcutouter} &
snap
pair_coeff 1 1 zbl ${zblz} ${zblz}
pair_coeff * * snap W_2940_2017_2.snapcoeff W W_2940_2017_2.snapparam W
pair_coeff * * snap W_2940_2017_2.snapcoeff W_2940_2017_2.snapparam W
#Nomenclature on the snap files are Element_DakotaID_Year_Month

View File

@ -6,7 +6,8 @@ twojmax 8
# optional
gamma 1
rfac0 0.99363
rmin0 0
diagonalstyle 3
bzeroflag 0
quadraticflag 0

View File

@ -5,11 +5,11 @@ variable zblcutinner equal 4
variable zblcutouter equal 4.8
variable zblz equal 74
# Specify hybrid with SNAP, ZBL, and long-range Coulomb
# Specify hybrid with SNAP and ZBL
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_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

@ -1416,11 +1416,7 @@ void PairSNAP::settings(int narg, char **arg)
void PairSNAP::coeff(int narg, char **arg)
{
// read SNAP element names between 2 filenames
// nelements = # of SNAP elements
// elements = list of unique element names
if (narg < 6) error->all(FLERR,"Incorrect args for pair coefficients");
if (narg < 5) error->all(FLERR,"Incorrect args for pair coefficients");
if (!allocated) allocate();
if (nelements) {
@ -1432,30 +1428,17 @@ void PairSNAP::coeff(int narg, char **arg)
memory->destroy(coeffelem);
}
nelements = narg - 4 - atom->ntypes;
if (nelements < 1) error->all(FLERR,"Incorrect args for pair coefficients");
char* type1 = arg[0];
char* type2 = arg[1];
char* coefffilename = arg[2];
char** elemlist = &arg[3];
char* paramfilename = arg[3+nelements];
char** elemtypes = &arg[4+nelements];
char* paramfilename = arg[3];
char** elemtypes = &arg[4];
// insure I,J args are * *
if (strcmp(type1,"*") != 0 || strcmp(type2,"*") != 0)
error->all(FLERR,"Incorrect args for pair coefficients");
elements = new char*[nelements];
for (int i = 0; i < nelements; i++) {
char* elemname = elemlist[i];
int n = strlen(elemname) + 1;
elements[i] = new char[n];
strcpy(elements[i],elemname);
}
// read snapcoeff and snapparam files
read_files(coefffilename,paramfilename);
@ -1631,22 +1614,19 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
iword = 1;
words[iword] = strtok(NULL,"' \t\n\r\f");
int nelemfile = atoi(words[0]);
nelements = atoi(words[0]);
ncoeffall = atoi(words[1]);
// Set up element lists
// set up element lists
elements = new char*[nelements];
memory->create(radelem,nelements,"pair:radelem");
memory->create(wjelem,nelements,"pair:wjelem");
memory->create(coeffelem,nelements,ncoeffall,"pair:coeffelem");
int *found = new int[nelements];
for (int ielem = 0; ielem < nelements; ielem++)
found[ielem] = 0;
// Loop over nelements blocks in the SNAP coefficient file
// Loop over elements in the SNAP coefficient file
for (int ielemfile = 0; ielemfile < nelemfile; ielemfile++) {
for (int ielem = 0; ielem < nelements; ielem++) {
if (comm->me == 0) {
ptr = fgets(line,MAXLINE,fpcoeff);
@ -1673,33 +1653,12 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
words[iword] = strtok(NULL,"' \t\n\r\f");
char* elemtmp = words[0];
double radtmp = atof(words[1]);
double wjtmp = atof(words[2]);
int n = strlen(elemtmp) + 1;
elements[ielem] = new char[n];
strcpy(elements[ielem],elemtmp);
// skip if element name isn't in element list
int ielem;
for (ielem = 0; ielem < nelements; ielem++)
if (strcmp(elemtmp,elements[ielem]) == 0) break;
if (ielem == nelements) {
if (comm->me == 0)
for (int icoeff = 0; icoeff < ncoeffall; icoeff++)
ptr = fgets(line,MAXLINE,fpcoeff);
continue;
}
// skip if element already appeared
if (found[ielem]) {
if (comm->me == 0)
for (int icoeff = 0; icoeff < ncoeffall; icoeff++)
ptr = fgets(line,MAXLINE,fpcoeff);
continue;
}
found[ielem] = 1;
radelem[ielem] = radtmp;
wjelem[ielem] = wjtmp;
radelem[ielem] = atof(words[1]);
wjelem[ielem] = atof(words[2]);
if (comm->me == 0) {
@ -1821,7 +1780,6 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename)
if (rcutfacflag == 0 || twojmaxflag == 0)
error->all(FLERR,"Incorrect SNAP parameter file");
delete[] found;
}
/* ----------------------------------------------------------------------

View File

@ -173,4 +173,8 @@ E: Incorrect format in SNAP parameter file
Incorrect number of words per line in the parameter file.
E: Did not find all elements in SNAP coefficient file.
One or more elements listed in the pair_coeff command were not found in the coefficient file.
*/