Merge pull request #2828 from tomswinburne/snap-scale
Adding scale parameter to pair/snap for fix/adapt
This commit is contained in:
@ -188,6 +188,8 @@ formulas for the meaning of these parameters:
|
|||||||
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
|
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
|
||||||
| :doc:`reax/c <pair_reaxc>` | chi, eta, gamma | type global |
|
| :doc:`reax/c <pair_reaxc>` | chi, eta, gamma | type global |
|
||||||
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
|
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
|
||||||
|
| :doc:`snap <pair_snap>` | scale | type pairs |
|
||||||
|
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
|
||||||
| :doc:`spin/dmi <pair_spin_dmi>` | coulombic_cutoff | type global |
|
| :doc:`spin/dmi <pair_spin_dmi>` | coulombic_cutoff | type global |
|
||||||
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
|
+------------------------------------------------------------------------------+--------------------------------------------------+-------------+
|
||||||
| :doc:`spin/exchange <pair_spin_exchange>` | coulombic_cutoff | type global |
|
| :doc:`spin/exchange <pair_spin_exchange>` | coulombic_cutoff | type global |
|
||||||
|
|||||||
@ -173,10 +173,12 @@ styles and their energy formulas for the meaning of these parameters:
|
|||||||
+------------------------------------------------------------------------------+-------------------------+------------+
|
+------------------------------------------------------------------------------+-------------------------+------------+
|
||||||
| :doc:`nm/cut/coul/cut, nm/cut/coul/long <pair_nm>` | e0,r0,nn,mm | type pairs |
|
| :doc:`nm/cut/coul/cut, nm/cut/coul/long <pair_nm>` | e0,r0,nn,mm | type pairs |
|
||||||
+------------------------------------------------------------------------------+-------------------------+------------+
|
+------------------------------------------------------------------------------+-------------------------+------------+
|
||||||
| :doc:`ufm <pair_ufm>` | epsilon,sigma,scale | type pairs |
|
| :doc:`snap <pair_snap>` | scale | type pairs |
|
||||||
+------------------------------------------------------------------------------+-------------------------+------------+
|
+------------------------------------------------------------------------------+-------------------------+------------+
|
||||||
| :doc:`soft <pair_soft>` | a | type pairs |
|
| :doc:`soft <pair_soft>` | a | type pairs |
|
||||||
+------------------------------------------------------------------------------+-------------------------+------------+
|
+------------------------------------------------------------------------------+-------------------------+------------+
|
||||||
|
| :doc:`ufm <pair_ufm>` | epsilon,sigma,scale | type pairs |
|
||||||
|
+------------------------------------------------------------------------------+-------------------------+------------+
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|||||||
1
examples/snap/Ni_Zuo_JPCA2020.quadratic.snapcoeff
Symbolic link
1
examples/snap/Ni_Zuo_JPCA2020.quadratic.snapcoeff
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../potentials/Ni_Zuo_JPCA2020.quadratic.snapcoeff
|
||||||
1
examples/snap/Ni_Zuo_JPCA2020.quadratic.snapparam
Symbolic link
1
examples/snap/Ni_Zuo_JPCA2020.quadratic.snapparam
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../potentials/Ni_Zuo_JPCA2020.quadratic.snapparam
|
||||||
1
examples/snap/Ni_Zuo_JPCA2020.snapcoeff
Symbolic link
1
examples/snap/Ni_Zuo_JPCA2020.snapcoeff
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../potentials/Ni_Zuo_JPCA2020.snapcoeff
|
||||||
1
examples/snap/Ni_Zuo_JPCA2020.snapparam
Symbolic link
1
examples/snap/Ni_Zuo_JPCA2020.snapparam
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../potentials/Ni_Zuo_JPCA2020.snapparam
|
||||||
53
examples/snap/in.snap.scale.Ni_Zuo_JCPA2020
Normal file
53
examples/snap/in.snap.scale.Ni_Zuo_JCPA2020
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# Toy demonstration of SNAP "scale" parameter, using fix/adapt and hybrid/overlay
|
||||||
|
# Mixing linear and quadratic SNAP Ni potentials by Zuo et al. JCPA 2020
|
||||||
|
|
||||||
|
# mixing parameter
|
||||||
|
|
||||||
|
variable lambda equal 0.2
|
||||||
|
|
||||||
|
|
||||||
|
# Initialize simulation
|
||||||
|
|
||||||
|
variable nsteps index 100
|
||||||
|
variable nrep equal 3
|
||||||
|
variable a equal 3.52
|
||||||
|
units metal
|
||||||
|
|
||||||
|
# generate the box and atom positions using a FCC lattice
|
||||||
|
variable nx equal ${nrep}
|
||||||
|
variable ny equal ${nrep}
|
||||||
|
variable nz equal ${nrep}
|
||||||
|
|
||||||
|
boundary p p p
|
||||||
|
|
||||||
|
lattice fcc $a
|
||||||
|
region box block 0 ${nx} 0 ${ny} 0 ${nz}
|
||||||
|
create_box 1 box
|
||||||
|
create_atoms 1 box
|
||||||
|
|
||||||
|
mass 1 34.
|
||||||
|
|
||||||
|
# choose bundled SNAP Ni potential from Zuo et al. JCPA 2020
|
||||||
|
pair_style hybrid/overlay snap snap
|
||||||
|
pair_coeff * * snap 1 Ni_Zuo_JPCA2020.snapcoeff Ni_Zuo_JPCA2020.snapparam Ni
|
||||||
|
pair_coeff * * snap 2 Ni_Zuo_JPCA2020.quadratic.snapcoeff Ni_Zuo_JPCA2020.quadratic.snapparam Ni
|
||||||
|
|
||||||
|
# scale according to mixing parameter
|
||||||
|
variable l1 equal ${lambda}
|
||||||
|
variable l2 equal 1.0-${lambda}
|
||||||
|
fix scale1 all adapt 1 pair snap:1 scale * * v_l1
|
||||||
|
fix scale2 all adapt 1 pair snap:2 scale * * v_l2
|
||||||
|
|
||||||
|
# Setup output
|
||||||
|
thermo 1
|
||||||
|
thermo_modify norm yes
|
||||||
|
|
||||||
|
# Set up NVE run
|
||||||
|
timestep 0.5e-3
|
||||||
|
neighbor 1.0 bin
|
||||||
|
neigh_modify every 1 delay 0 check yes
|
||||||
|
|
||||||
|
# Run MD
|
||||||
|
velocity all create 300.0 4928459 loop geom
|
||||||
|
fix 1 all nve
|
||||||
|
run ${nsteps}
|
||||||
@ -70,6 +70,7 @@ PairSNAP::~PairSNAP()
|
|||||||
if (allocated) {
|
if (allocated) {
|
||||||
memory->destroy(setflag);
|
memory->destroy(setflag);
|
||||||
memory->destroy(cutsq);
|
memory->destroy(cutsq);
|
||||||
|
memory->destroy(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -164,6 +165,7 @@ void PairSNAP::compute(int eflag, int vflag)
|
|||||||
// for neighbors of I within cutoff:
|
// for neighbors of I within cutoff:
|
||||||
// compute Fij = dEi/dRj = -dEi/dRi
|
// compute Fij = dEi/dRj = -dEi/dRi
|
||||||
// add to Fi, subtract from Fj
|
// add to Fi, subtract from Fj
|
||||||
|
// scaling is that for type I
|
||||||
|
|
||||||
snaptr->compute_yi(beta[ii]);
|
snaptr->compute_yi(beta[ii]);
|
||||||
|
|
||||||
@ -178,12 +180,12 @@ void PairSNAP::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
snaptr->compute_deidrj(fij);
|
snaptr->compute_deidrj(fij);
|
||||||
|
|
||||||
f[i][0] += fij[0];
|
f[i][0] += fij[0]*scale[itype][itype];
|
||||||
f[i][1] += fij[1];
|
f[i][1] += fij[1]*scale[itype][itype];
|
||||||
f[i][2] += fij[2];
|
f[i][2] += fij[2]*scale[itype][itype];
|
||||||
f[j][0] -= fij[0];
|
f[j][0] -= fij[0]*scale[itype][itype];
|
||||||
f[j][1] -= fij[1];
|
f[j][1] -= fij[1]*scale[itype][itype];
|
||||||
f[j][2] -= fij[2];
|
f[j][2] -= fij[2]*scale[itype][itype];
|
||||||
|
|
||||||
// tally per-atom virial contribution
|
// tally per-atom virial contribution
|
||||||
|
|
||||||
@ -224,6 +226,7 @@ void PairSNAP::compute(int eflag, int vflag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
evdwl *= scale[itype][itype];
|
||||||
ev_tally_full(i,2.0*evdwl,0.0,0.0,0.0,0.0,0.0);
|
ev_tally_full(i,2.0*evdwl,0.0,0.0,0.0,0.0,0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,9 +354,9 @@ void PairSNAP::allocate()
|
|||||||
{
|
{
|
||||||
allocated = 1;
|
allocated = 1;
|
||||||
int n = atom->ntypes;
|
int n = atom->ntypes;
|
||||||
|
|
||||||
memory->create(setflag,n+1,n+1,"pair:setflag");
|
memory->create(setflag,n+1,n+1,"pair:setflag");
|
||||||
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
||||||
|
memory->create(scale,n+1,n+1,"pair:scale");
|
||||||
map = new int[n+1];
|
map = new int[n+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,11 +411,16 @@ void PairSNAP::coeff(int narg, char **arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate maximum cutoff for all elements
|
// Calculate maximum cutoff for all elements
|
||||||
|
|
||||||
rcutmax = 0.0;
|
rcutmax = 0.0;
|
||||||
for (int ielem = 0; ielem < nelements; ielem++)
|
for (int ielem = 0; ielem < nelements; ielem++)
|
||||||
rcutmax = MAX(2.0*radelem[ielem]*rcutfac,rcutmax);
|
rcutmax = MAX(2.0*radelem[ielem]*rcutfac,rcutmax);
|
||||||
|
|
||||||
|
// set default scaling
|
||||||
|
int n = atom->ntypes;
|
||||||
|
for (int ii = 0; ii < n+1; ii++)
|
||||||
|
for (int jj = 0; jj < n+1; jj++)
|
||||||
|
scale[ii][jj] = 1.0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -441,6 +449,7 @@ void PairSNAP::init_style()
|
|||||||
double PairSNAP::init_one(int i, int j)
|
double PairSNAP::init_one(int i, int j)
|
||||||
{
|
{
|
||||||
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
|
||||||
|
scale[j][i] = scale[i][j];
|
||||||
return (radelem[map[i]] +
|
return (radelem[map[i]] +
|
||||||
radelem[map[j]])*rcutfac;
|
radelem[map[j]])*rcutfac;
|
||||||
}
|
}
|
||||||
@ -711,6 +720,7 @@ double PairSNAP::memory_usage()
|
|||||||
int n = atom->ntypes+1;
|
int n = atom->ntypes+1;
|
||||||
bytes += (double)n*n*sizeof(int); // setflag
|
bytes += (double)n*n*sizeof(int); // setflag
|
||||||
bytes += (double)n*n*sizeof(double); // cutsq
|
bytes += (double)n*n*sizeof(double); // cutsq
|
||||||
|
bytes += (double)n*n*sizeof(double); // scale
|
||||||
bytes += (double)n*sizeof(int); // map
|
bytes += (double)n*sizeof(int); // map
|
||||||
bytes += (double)beta_max*ncoeff*sizeof(double); // bispectrum
|
bytes += (double)beta_max*ncoeff*sizeof(double); // bispectrum
|
||||||
bytes += (double)beta_max*ncoeff*sizeof(double); // beta
|
bytes += (double)beta_max*ncoeff*sizeof(double); // beta
|
||||||
@ -720,3 +730,9 @@ double PairSNAP::memory_usage()
|
|||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *PairSNAP::extract(const char *str, int &dim)
|
||||||
|
{
|
||||||
|
dim = 2;
|
||||||
|
if (strcmp(str,"scale") == 0) return (void *) scale;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|||||||
@ -34,6 +34,7 @@ class PairSNAP : public Pair {
|
|||||||
virtual void init_style();
|
virtual void init_style();
|
||||||
virtual double init_one(int, int);
|
virtual double init_one(int, int);
|
||||||
virtual double memory_usage();
|
virtual double memory_usage();
|
||||||
|
virtual void *extract(const char *, int &);
|
||||||
|
|
||||||
double rcutfac, quadraticflag; // declared public to workaround gcc 4.9
|
double rcutfac, quadraticflag; // declared public to workaround gcc 4.9
|
||||||
int ncoeff; // compiler bug, manifest in KOKKOS package
|
int ncoeff; // compiler bug, manifest in KOKKOS package
|
||||||
@ -55,6 +56,7 @@ class PairSNAP : public Pair {
|
|||||||
double **coeffelem; // element bispectrum coefficients
|
double **coeffelem; // element bispectrum coefficients
|
||||||
double **beta; // betas for all atoms in list
|
double **beta; // betas for all atoms in list
|
||||||
double **bispectrum; // bispectrum components for all atoms in list
|
double **bispectrum; // bispectrum components for all atoms in list
|
||||||
|
double **scale; // for thermodynamic integration
|
||||||
int twojmax, switchflag, bzeroflag, bnormflag;
|
int twojmax, switchflag, bzeroflag, bnormflag;
|
||||||
int chemflag, wselfallflag;
|
int chemflag, wselfallflag;
|
||||||
int chunksize;
|
int chunksize;
|
||||||
|
|||||||
@ -14,7 +14,8 @@ pair_style: hybrid/overlay zbl 4.0 4.8 snap
|
|||||||
pair_coeff: ! |
|
pair_coeff: ! |
|
||||||
1*8 1*8 zbl 73 73
|
1*8 1*8 zbl 73 73
|
||||||
* * snap Ta06A.snapcoeff Ta06A.snapparam Ta Ta Ta Ta Ta Ta Ta Ta
|
* * snap Ta06A.snapcoeff Ta06A.snapparam Ta Ta Ta Ta Ta Ta Ta Ta
|
||||||
extract: ! ""
|
extract: ! |
|
||||||
|
scale 2
|
||||||
natoms: 64
|
natoms: 64
|
||||||
init_vdwl: -473.569864629026
|
init_vdwl: -473.569864629026
|
||||||
init_coul: 0
|
init_coul: 0
|
||||||
|
|||||||
@ -16,7 +16,8 @@ pair_coeff: ! |
|
|||||||
1*4 5*8 zbl 49 15
|
1*4 5*8 zbl 49 15
|
||||||
5*8 5*8 zbl 15 15
|
5*8 5*8 zbl 15 15
|
||||||
* * snap InP_JCPA2020.snapcoeff InP_JCPA2020.snapparam In In In In P P P P
|
* * snap InP_JCPA2020.snapcoeff InP_JCPA2020.snapparam In In In In P P P P
|
||||||
extract: ! ""
|
extract: ! |
|
||||||
|
scale 2
|
||||||
natoms: 64
|
natoms: 64
|
||||||
init_vdwl: -185.3871232982
|
init_vdwl: -185.3871232982
|
||||||
init_coul: 0
|
init_coul: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user