mirror of https://github.com/lammps/lammps.git
whitespace fixes
This commit is contained in:
parent
31cfc99ad9
commit
e98056c0e8
|
@ -416,7 +416,7 @@ by circles of diameter 0.5, is specified as follows:
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
1 3 13
|
1 3 13
|
||||||
2 1 1
|
2 1 1
|
||||||
0 1.33333 1.33333 0 0 0
|
0 1.33333 1.33333 0 0 0
|
||||||
-2 0 0
|
-2 0 0
|
||||||
2 0 0
|
2 0 0
|
||||||
|
|
|
@ -57,7 +57,7 @@ The compute *mliap* command must be followed by two keywords
|
||||||
*model* and *descriptor* in either order.
|
*model* and *descriptor* in either order.
|
||||||
|
|
||||||
The *model* keyword is followed by a model style, currently limited to
|
The *model* keyword is followed by a model style, currently limited to
|
||||||
either *linear* or *quadratic*.
|
either *linear* or *quadratic*.
|
||||||
|
|
||||||
The *descriptor* keyword is followed by a descriptor style, and additional arguments.
|
The *descriptor* keyword is followed by a descriptor style, and additional arguments.
|
||||||
Currently the only descriptor style is *sna*, indicating the bispectrum component
|
Currently the only descriptor style is *sna*, indicating the bispectrum component
|
||||||
|
|
|
@ -45,7 +45,7 @@ commands:
|
||||||
:math:`\phi_0` is specified in degrees, but LAMMPS converts it to
|
:math:`\phi_0` is specified in degrees, but LAMMPS converts it to
|
||||||
radians internally; hence :math:`K` is effectively energy per
|
radians internally; hence :math:`K` is effectively energy per
|
||||||
radian\^2.
|
radian\^2.
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Styles with a *gpu*\ , *intel*\ , *kk*\ , *omp*\ , or *opt* suffix are
|
Styles with a *gpu*\ , *intel*\ , *kk*\ , *omp*\ , or *opt* suffix are
|
||||||
|
|
|
@ -302,40 +302,40 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(char const *const input_line) cons
|
||||||
|
|
||||||
if(nocomment) {
|
if(nocomment) {
|
||||||
if (strcmp(key,"pair") == 0) {
|
if (strcmp(key,"pair") == 0) {
|
||||||
species1 = strtok(ptr," \t");
|
species1 = strtok(ptr," \t");
|
||||||
species2 = strtok(NULL," \t");
|
species2 = strtok(NULL," \t");
|
||||||
the_rest = strtok(NULL,"\n");
|
the_rest = strtok(NULL,"\n");
|
||||||
|
|
||||||
for (int type_a = 0; type_a < atom->ntypes; ++type_a) {
|
for (int type_a = 0; type_a < atom->ntypes; ++type_a) {
|
||||||
for (int type_b = type_a; type_b < atom->ntypes; ++type_b) {
|
for (int type_b = type_a; type_b < atom->ntypes; ++type_b) {
|
||||||
if(((strcmp(species[type_a],species1) == 0) &&
|
if(((strcmp(species[type_a],species1) == 0) &&
|
||||||
(strcmp(species[type_b],species2) == 0))
|
(strcmp(species[type_b],species2) == 0))
|
||||||
||
|
||
|
||||||
((strcmp(species[type_b],species1) == 0) &&
|
((strcmp(species[type_b],species1) == 0) &&
|
||||||
(strcmp(species[type_a],species2) == 0))
|
(strcmp(species[type_a],species2) == 0))
|
||||||
) {
|
) {
|
||||||
char pair_command[MAXLINE];
|
char pair_command[MAXLINE];
|
||||||
sprintf(pair_command,"pair_coeff %i %i %s",type_a+1,type_b+1,
|
sprintf(pair_command,"pair_coeff %i %i %s",type_a+1,type_b+1,
|
||||||
the_rest);
|
the_rest);
|
||||||
input->one(pair_command);
|
input->one(pair_command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(key,"charge") == 0) {
|
else if (strcmp(key,"charge") == 0) {
|
||||||
species1 = strtok(ptr," \t");
|
species1 = strtok(ptr," \t");
|
||||||
the_rest = strtok(NULL,"\n");
|
the_rest = strtok(NULL,"\n");
|
||||||
|
|
||||||
for (int type_a = 0; type_a < atom->ntypes; ++type_a) {
|
for (int type_a = 0; type_a < atom->ntypes; ++type_a) {
|
||||||
if(strcmp(species[type_a],species1) == 0) {
|
if(strcmp(species[type_a],species1) == 0) {
|
||||||
char pair_command[MAXLINE];
|
char pair_command[MAXLINE];
|
||||||
sprintf(pair_command,"set type %i charge %s",type_a+1,the_rest);
|
sprintf(pair_command,"set type %i charge %s",type_a+1,the_rest);
|
||||||
input->one(pair_command);
|
input->one(pair_command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
error->one(FLERR,"Unrecognized KEY for KIM_SET_TYPE_PARAMETERS command");
|
error->one(FLERR,"Unrecognized KEY for KIM_SET_TYPE_PARAMETERS command");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) :
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else if (strcmp(arg[iarg],"aconstrain") == 0 &&
|
} else if (strcmp(arg[iarg],"aconstrain") == 0 &&
|
||||||
strcmp(style,"bond/create/angle") == 0) {
|
strcmp(style,"bond/create/angle") == 0) {
|
||||||
if (iarg+3 > narg)
|
if (iarg+3 > narg)
|
||||||
error->all(FLERR,"Illegal fix bond/create/angle command");
|
error->all(FLERR,"Illegal fix bond/create/angle command");
|
||||||
amin = force->numeric(FLERR,arg[iarg+1]);
|
amin = force->numeric(FLERR,arg[iarg+1]);
|
||||||
amax = force->inumeric(FLERR,arg[iarg+2]);
|
amax = force->inumeric(FLERR,arg[iarg+2]);
|
||||||
|
@ -470,7 +470,7 @@ void FixBondCreate::post_integrate()
|
||||||
partner[j] = tag[i];
|
partner[j] = tag[i];
|
||||||
distsq[j] = rsq;
|
distsq[j] = rsq;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,16 +54,16 @@ int FixBondCreateAngle::constrain(int i, int j, double amin, double amax)
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
|
|
||||||
// pass if both atoms have no neighbors: bond is always formed
|
// pass if both atoms have no neighbors: bond is always formed
|
||||||
|
|
||||||
if (nspecial[i][0] == 0 && nspecial[j][0] == 0) flag = 1;
|
if (nspecial[i][0] == 0 && nspecial[j][0] == 0) flag = 1;
|
||||||
|
|
||||||
// pass if i has at least one neighbor and angle constraint is met
|
// pass if i has at least one neighbor and angle constraint is met
|
||||||
|
|
||||||
if (nspecial[i][0] != 0 && nspecial[j][0] == 0) {
|
if (nspecial[i][0] != 0 && nspecial[j][0] == 0) {
|
||||||
|
|
||||||
// calculate first vector between i and j
|
// calculate first vector between i and j
|
||||||
// calculate second vector between i and its first neighbor
|
// calculate second vector between i and its first neighbor
|
||||||
|
|
||||||
v1x = x[i][0] - x[j][0];
|
v1x = x[i][0] - x[j][0];
|
||||||
v1y = x[i][1] - x[j][1];
|
v1y = x[i][1] - x[j][1];
|
||||||
v1z = x[i][2] - x[j][2];
|
v1z = x[i][2] - x[j][2];
|
||||||
|
@ -73,19 +73,19 @@ int FixBondCreateAngle::constrain(int i, int j, double amin, double amax)
|
||||||
|
|
||||||
// calculate angle between both vectors
|
// calculate angle between both vectors
|
||||||
// set flag if the angle constraint is met
|
// set flag if the angle constraint is met
|
||||||
|
|
||||||
angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z)/
|
angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z)/
|
||||||
(sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z)));
|
(sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z)));
|
||||||
if (amin <= angle1 && angle1 <= amax) flag = 1;
|
if (amin <= angle1 && angle1 <= amax) flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass if j has at least one neighbor and angle constraint is met
|
// pass if j has at least one neighbor and angle constraint is met
|
||||||
|
|
||||||
if (nspecial[j][0] != 0 && nspecial[i][0] == 0) {
|
if (nspecial[j][0] != 0 && nspecial[i][0] == 0) {
|
||||||
|
|
||||||
// calculate first vector between j and i
|
// calculate first vector between j and i
|
||||||
// calculate second vector between j and its first neighbor
|
// calculate second vector between j and its first neighbor
|
||||||
|
|
||||||
v1x = x[j][0] - x[i][0];
|
v1x = x[j][0] - x[i][0];
|
||||||
v1y = x[j][1] - x[i][1];
|
v1y = x[j][1] - x[i][1];
|
||||||
v1z = x[j][2] - x[i][2];
|
v1z = x[j][2] - x[i][2];
|
||||||
|
@ -108,7 +108,7 @@ int FixBondCreateAngle::constrain(int i, int j, double amin, double amax)
|
||||||
// Calculate 1st angle
|
// Calculate 1st angle
|
||||||
// calculate first vector between i and j
|
// calculate first vector between i and j
|
||||||
// calculate second vector between i and its first neighbor
|
// calculate second vector between i and its first neighbor
|
||||||
|
|
||||||
v1x = x[i][0] - x[j][0];
|
v1x = x[i][0] - x[j][0];
|
||||||
v1y = x[i][1] - x[j][1];
|
v1y = x[i][1] - x[j][1];
|
||||||
v1z = x[i][2] - x[j][2];
|
v1z = x[i][2] - x[j][2];
|
||||||
|
@ -117,7 +117,7 @@ int FixBondCreateAngle::constrain(int i, int j, double amin, double amax)
|
||||||
v2z = x[i][2] - x[atom->map(special[i][0])][2];
|
v2z = x[i][2] - x[atom->map(special[i][0])][2];
|
||||||
|
|
||||||
// calculate angle between both vectors
|
// calculate angle between both vectors
|
||||||
|
|
||||||
angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z) /
|
angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z) /
|
||||||
(sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z)));
|
(sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z)));
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ using namespace LAMMPS_NS;
|
||||||
enum{SCALAR,VECTOR,ARRAY};
|
enum{SCALAR,VECTOR,ARRAY};
|
||||||
|
|
||||||
ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
|
ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
|
||||||
Compute(lmp, narg, arg), mliaparray(NULL),
|
Compute(lmp, narg, arg), mliaparray(NULL),
|
||||||
mliaparrayall(NULL), map(NULL)
|
mliaparrayall(NULL), map(NULL)
|
||||||
{
|
{
|
||||||
array_flag = 1;
|
array_flag = 1;
|
||||||
|
@ -79,7 +79,7 @@ ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
|
||||||
} else if (strcmp(arg[iarg],"gradgradflag") == 0) {
|
} else if (strcmp(arg[iarg],"gradgradflag") == 0) {
|
||||||
if (iarg+1 > narg) error->all(FLERR,"Illegal compute mliap command");
|
if (iarg+1 > narg) error->all(FLERR,"Illegal compute mliap command");
|
||||||
gradgradflag = atoi(arg[iarg+1]);
|
gradgradflag = atoi(arg[iarg+1]);
|
||||||
if (gradgradflag != 0 && gradgradflag != 1)
|
if (gradgradflag != 0 && gradgradflag != 1)
|
||||||
error->all(FLERR,"Illegal compute mliap command");
|
error->all(FLERR,"Illegal compute mliap command");
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
} else
|
} else
|
||||||
|
@ -215,29 +215,29 @@ void ComputeMLIAP::compute_array()
|
||||||
neighbor->build_one(list);
|
neighbor->build_one(list);
|
||||||
|
|
||||||
data->generate_neighdata(list);
|
data->generate_neighdata(list);
|
||||||
|
|
||||||
// compute descriptors
|
// compute descriptors
|
||||||
|
|
||||||
descriptor->compute_descriptors(data);
|
descriptor->compute_descriptors(data);
|
||||||
|
|
||||||
if (gradgradflag == 1) {
|
if (gradgradflag == 1) {
|
||||||
|
|
||||||
// calculate double gradient w.r.t. parameters and descriptors
|
// calculate double gradient w.r.t. parameters and descriptors
|
||||||
|
|
||||||
model->compute_gradgrads(data);
|
model->compute_gradgrads(data);
|
||||||
|
|
||||||
// calculate gradients of forces w.r.t. parameters
|
// calculate gradients of forces w.r.t. parameters
|
||||||
|
|
||||||
descriptor->compute_force_gradients(data);
|
descriptor->compute_force_gradients(data);
|
||||||
|
|
||||||
} else if (gradgradflag == 0) {
|
} else if (gradgradflag == 0) {
|
||||||
|
|
||||||
// calculate descriptor gradients
|
// calculate descriptor gradients
|
||||||
|
|
||||||
descriptor->compute_descriptor_gradients(data);
|
descriptor->compute_descriptor_gradients(data);
|
||||||
|
|
||||||
// calculate gradients of forces w.r.t. parameters
|
// calculate gradients of forces w.r.t. parameters
|
||||||
|
|
||||||
model->compute_force_gradients(data);
|
model->compute_force_gradients(data);
|
||||||
|
|
||||||
} else error->all(FLERR,"Invalid value for gradgradflag");
|
} else error->all(FLERR,"Invalid value for gradgradflag");
|
||||||
|
|
|
@ -40,7 +40,7 @@ class ComputeMLIAP : public Compute {
|
||||||
double **mliaparray, **mliaparrayall;
|
double **mliaparray, **mliaparrayall;
|
||||||
class NeighList *list;
|
class NeighList *list;
|
||||||
int *map; // map types to [0,nelements)
|
int *map; // map types to [0,nelements)
|
||||||
int ndescriptors; // number of descriptors
|
int ndescriptors; // number of descriptors
|
||||||
int nparams; // number of model parameters per element
|
int nparams; // number of model parameters per element
|
||||||
int nelements;
|
int nelements;
|
||||||
int gradgradflag; // 1 for graddesc, 0 for gamma
|
int gradgradflag; // 1 for graddesc, 0 for gamma
|
||||||
|
|
|
@ -33,14 +33,14 @@
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
MLIAPData::MLIAPData(LAMMPS *lmp,
|
MLIAPData::MLIAPData(LAMMPS *lmp,
|
||||||
int gradgradflag_in, int *map_in, class MLIAPModel* model_in,
|
int gradgradflag_in, int *map_in, class MLIAPModel* model_in,
|
||||||
class MLIAPDescriptor* descriptor_in, class PairMLIAP* pairmliap_in) :
|
class MLIAPDescriptor* descriptor_in, class PairMLIAP* pairmliap_in) :
|
||||||
Pointers(lmp),
|
Pointers(lmp),
|
||||||
list(NULL),
|
list(NULL),
|
||||||
gradforce(NULL),
|
gradforce(NULL),
|
||||||
betas(NULL), descriptors(NULL), gamma_row_index(NULL), gamma_col_index(NULL),
|
betas(NULL), descriptors(NULL), gamma_row_index(NULL), gamma_col_index(NULL),
|
||||||
gamma(NULL), egradient(NULL), model(NULL), descriptor(NULL),
|
gamma(NULL), egradient(NULL), model(NULL), descriptor(NULL),
|
||||||
iatoms(NULL), ielems(NULL), numneighs(NULL),
|
iatoms(NULL), ielems(NULL), numneighs(NULL),
|
||||||
jatoms(NULL), jelems(NULL), rij(NULL), graddesc(NULL)
|
jatoms(NULL), jelems(NULL), rij(NULL), graddesc(NULL)
|
||||||
{
|
{
|
||||||
gradgradflag = gradgradflag_in;
|
gradgradflag = gradgradflag_in;
|
||||||
|
@ -108,10 +108,10 @@ void MLIAPData::generate_neighdata(NeighList* list_in, int eflag_in, int vflag_i
|
||||||
list = list_in;
|
list = list_in;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
|
|
||||||
int *numneigh = list->numneigh;
|
int *numneigh = list->numneigh;
|
||||||
int **firstneigh = list->firstneigh;
|
int **firstneigh = list->firstneigh;
|
||||||
|
|
||||||
// grow nmax gradforce array if necessary
|
// grow nmax gradforce array if necessary
|
||||||
|
|
||||||
if (atom->nmax > nmax) {
|
if (atom->nmax > nmax) {
|
||||||
|
@ -121,15 +121,15 @@ void MLIAPData::generate_neighdata(NeighList* list_in, int eflag_in, int vflag_i
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear gradforce array
|
// clear gradforce array
|
||||||
|
|
||||||
int ntotal = atom->nlocal + atom->nghost;
|
int ntotal = atom->nlocal + atom->nghost;
|
||||||
for (int i = 0; i < ntotal; i++)
|
for (int i = 0; i < ntotal; i++)
|
||||||
for (int j = 0; j < size_gradforce; j++) {
|
for (int j = 0; j < size_gradforce; j++) {
|
||||||
gradforce[i][j] = 0.0;
|
gradforce[i][j] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// grow gamma arrays if necessary
|
// grow gamma arrays if necessary
|
||||||
|
|
||||||
if (gradgradflag == 1) {
|
if (gradgradflag == 1) {
|
||||||
const int natomgamma = list->inum;
|
const int natomgamma = list->inum;
|
||||||
if (natomgamma_max < natomgamma) {
|
if (natomgamma_max < natomgamma) {
|
||||||
|
@ -150,20 +150,20 @@ void MLIAPData::generate_neighdata(NeighList* list_in, int eflag_in, int vflag_i
|
||||||
}
|
}
|
||||||
|
|
||||||
grow_neigharrays();
|
grow_neigharrays();
|
||||||
|
|
||||||
int ij = 0;
|
int ij = 0;
|
||||||
for (int ii = 0; ii < list->inum; ii++) {
|
for (int ii = 0; ii < list->inum; ii++) {
|
||||||
const int i = list->ilist[ii];
|
const int i = list->ilist[ii];
|
||||||
|
|
||||||
const double xtmp = x[i][0];
|
const double xtmp = x[i][0];
|
||||||
const double ytmp = x[i][1];
|
const double ytmp = x[i][1];
|
||||||
const double ztmp = x[i][2];
|
const double ztmp = x[i][2];
|
||||||
const int itype = type[i];
|
const int itype = type[i];
|
||||||
const int ielem = map[itype];
|
const int ielem = map[itype];
|
||||||
|
|
||||||
int *jlist = firstneigh[i];
|
int *jlist = firstneigh[i];
|
||||||
const int jnum = numneigh[i];
|
const int jnum = numneigh[i];
|
||||||
|
|
||||||
int ninside = 0;
|
int ninside = 0;
|
||||||
for (int jj = 0; jj < jnum; jj++) {
|
for (int jj = 0; jj < jnum; jj++) {
|
||||||
int j = jlist[jj];
|
int j = jlist[jj];
|
||||||
|
@ -174,7 +174,7 @@ void MLIAPData::generate_neighdata(NeighList* list_in, int eflag_in, int vflag_i
|
||||||
const double rsq = delx*delx + dely*dely + delz*delz;
|
const double rsq = delx*delx + dely*dely + delz*delz;
|
||||||
int jtype = type[j];
|
int jtype = type[j];
|
||||||
const int jelem = map[jtype];
|
const int jelem = map[jtype];
|
||||||
|
|
||||||
if (rsq < descriptor->cutsq[ielem][jelem]) {
|
if (rsq < descriptor->cutsq[ielem][jelem]) {
|
||||||
jatoms[ij] = j;
|
jatoms[ij] = j;
|
||||||
jelems[ij] = jelem;
|
jelems[ij] = jelem;
|
||||||
|
@ -202,7 +202,7 @@ void MLIAPData::grow_neigharrays()
|
||||||
{
|
{
|
||||||
|
|
||||||
// grow neighbor atom arrays if necessary
|
// grow neighbor atom arrays if necessary
|
||||||
|
|
||||||
const int natomneigh = list->inum;
|
const int natomneigh = list->inum;
|
||||||
if (natomneigh_max < natomneigh) {
|
if (natomneigh_max < natomneigh) {
|
||||||
memory->grow(iatoms,natomneigh,"MLIAPData:iatoms");
|
memory->grow(iatoms,natomneigh,"MLIAPData:iatoms");
|
||||||
|
@ -215,7 +215,7 @@ void MLIAPData::grow_neigharrays()
|
||||||
|
|
||||||
int *numneigh = list->numneigh;
|
int *numneigh = list->numneigh;
|
||||||
int **firstneigh = list->firstneigh;
|
int **firstneigh = list->firstneigh;
|
||||||
|
|
||||||
int iilast = list->inum-1;
|
int iilast = list->inum-1;
|
||||||
int ilast = list->ilist[iilast];
|
int ilast = list->ilist[iilast];
|
||||||
int upperbound = firstneigh[ilast] - firstneigh[0] + numneigh[ilast];
|
int upperbound = firstneigh[ilast] - firstneigh[0] + numneigh[ilast];
|
||||||
|
@ -223,20 +223,20 @@ void MLIAPData::grow_neigharrays()
|
||||||
|
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
|
|
||||||
int nneigh = 0;
|
int nneigh = 0;
|
||||||
for (int ii = 0; ii < list->inum; ii++) {
|
for (int ii = 0; ii < list->inum; ii++) {
|
||||||
const int i = list->ilist[ii];
|
const int i = list->ilist[ii];
|
||||||
|
|
||||||
const double xtmp = x[i][0];
|
const double xtmp = x[i][0];
|
||||||
const double ytmp = x[i][1];
|
const double ytmp = x[i][1];
|
||||||
const double ztmp = x[i][2];
|
const double ztmp = x[i][2];
|
||||||
const int itype = type[i];
|
const int itype = type[i];
|
||||||
const int ielem = map[itype];
|
const int ielem = map[itype];
|
||||||
|
|
||||||
int *jlist = firstneigh[i];
|
int *jlist = firstneigh[i];
|
||||||
const int jnum = numneigh[i];
|
const int jnum = numneigh[i];
|
||||||
|
|
||||||
int ninside = 0;
|
int ninside = 0;
|
||||||
for (int jj = 0; jj < jnum; jj++) {
|
for (int jj = 0; jj < jnum; jj++) {
|
||||||
int j = jlist[jj];
|
int j = jlist[jj];
|
||||||
|
@ -251,7 +251,7 @@ void MLIAPData::grow_neigharrays()
|
||||||
}
|
}
|
||||||
nneigh += ninside;
|
nneigh += ninside;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nneigh_max < nneigh) {
|
if (nneigh_max < nneigh) {
|
||||||
memory->grow(jatoms,nneigh,"MLIAPData:jatoms");
|
memory->grow(jatoms,nneigh,"MLIAPData:jatoms");
|
||||||
memory->grow(jelems,nneigh,"MLIAPData:jelems");
|
memory->grow(jelems,nneigh,"MLIAPData:jelems");
|
||||||
|
@ -284,14 +284,14 @@ double MLIAPData::memory_usage()
|
||||||
bytes += natomneigh_max*sizeof(int); // iatoms
|
bytes += natomneigh_max*sizeof(int); // iatoms
|
||||||
bytes += natomneigh_max*sizeof(int); // ielems
|
bytes += natomneigh_max*sizeof(int); // ielems
|
||||||
bytes += natomneigh_max*sizeof(int); // numneighs
|
bytes += natomneigh_max*sizeof(int); // numneighs
|
||||||
|
|
||||||
bytes += nneigh_max*sizeof(int); // jatoms
|
bytes += nneigh_max*sizeof(int); // jatoms
|
||||||
bytes += nneigh_max*sizeof(int); // jelems
|
bytes += nneigh_max*sizeof(int); // jelems
|
||||||
bytes += nneigh_max*3*sizeof(double); // rij"
|
bytes += nneigh_max*3*sizeof(double); // rij"
|
||||||
|
|
||||||
if (gradgradflag == 0)
|
if (gradgradflag == 0)
|
||||||
bytes += nneigh_max*ndescriptors*3*sizeof(double);// graddesc
|
bytes += nneigh_max*ndescriptors*3*sizeof(double);// graddesc
|
||||||
|
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,17 +36,17 @@ class MLIAPData : protected Pointers {
|
||||||
double **gradforce;
|
double **gradforce;
|
||||||
double** betas; // betas for all atoms in list
|
double** betas; // betas for all atoms in list
|
||||||
double** descriptors; // descriptors for all atoms in list
|
double** descriptors; // descriptors for all atoms in list
|
||||||
int ndescriptors; // number of descriptors
|
int ndescriptors; // number of descriptors
|
||||||
int nparams; // number of model parameters per element
|
int nparams; // number of model parameters per element
|
||||||
int nelements; // number of elements
|
int nelements; // number of elements
|
||||||
|
|
||||||
// data structures for grad-grad list (gamma)
|
// data structures for grad-grad list (gamma)
|
||||||
|
|
||||||
int natomgamma_max; // allocated size of gamma
|
int natomgamma_max; // allocated size of gamma
|
||||||
int gamma_nnz; // number of non-zero entries in gamma
|
int gamma_nnz; // number of non-zero entries in gamma
|
||||||
double** gamma; // gamma element
|
double** gamma; // gamma element
|
||||||
int** gamma_row_index; // row (parameter) index
|
int** gamma_row_index; // row (parameter) index
|
||||||
int** gamma_col_index; // column (descriptor) index
|
int** gamma_col_index; // column (descriptor) index
|
||||||
double* egradient; // energy gradient w.r.t. parameters
|
double* egradient; // energy gradient w.r.t. parameters
|
||||||
|
|
||||||
// data structures for mliap neighbor list
|
// data structures for mliap neighbor list
|
||||||
|
|
|
@ -50,7 +50,7 @@ int MLIAPModelLinear::get_nparams()
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void MLIAPModelLinear::compute_gradients(MLIAPData* data)
|
void MLIAPModelLinear::compute_gradients(MLIAPData* data)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < data->natoms; ii++) {
|
for (int ii = 0; ii < data->natoms; ii++) {
|
||||||
const int i = data->iatoms[ii];
|
const int i = data->iatoms[ii];
|
||||||
const int ielem = data->ielems[ii];
|
const int ielem = data->ielems[ii];
|
||||||
|
@ -129,14 +129,14 @@ void MLIAPModelLinear::compute_gradgrads(class MLIAPData* data)
|
||||||
egradient is derivative of energy w.r.t. parameters
|
egradient is derivative of energy w.r.t. parameters
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void MLIAPModelLinear::compute_force_gradients(class MLIAPData* data)
|
void MLIAPModelLinear::compute_force_gradients(class MLIAPData* data)
|
||||||
{
|
{
|
||||||
|
|
||||||
// zero out energy gradients
|
// zero out energy gradients
|
||||||
|
|
||||||
for (int l = 0; l < data->nelements*data->nparams; l++)
|
for (int l = 0; l < data->nelements*data->nparams; l++)
|
||||||
data->egradient[l] = 0.0;
|
data->egradient[l] = 0.0;
|
||||||
|
|
||||||
int ij = 0;
|
int ij = 0;
|
||||||
for (int ii = 0; ii < data->natoms; ii++) {
|
for (int ii = 0; ii < data->natoms; ii++) {
|
||||||
const int i = data->iatoms[ii];
|
const int i = data->iatoms[ii];
|
||||||
|
@ -161,14 +161,14 @@ void MLIAPModelLinear::compute_force_gradients(class MLIAPData* data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// gradient of energy of atom I w.r.t. parameters
|
// gradient of energy of atom I w.r.t. parameters
|
||||||
|
|
||||||
int l = elemoffset;
|
int l = elemoffset;
|
||||||
data->egradient[l++] += 1.0;
|
data->egradient[l++] += 1.0;
|
||||||
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++)
|
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++)
|
||||||
data->egradient[l++] += data->descriptors[ii][icoeff];
|
data->egradient[l++] += data->descriptors[ii][icoeff];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|
|
@ -207,7 +207,7 @@ void MLIAPModelQuadratic::compute_force_gradients(class MLIAPData* data) {
|
||||||
|
|
||||||
for (int l = 0; l < data->nelements*data->nparams; l++)
|
for (int l = 0; l < data->nelements*data->nparams; l++)
|
||||||
data->egradient[l] = 0.0;
|
data->egradient[l] = 0.0;
|
||||||
|
|
||||||
int ij = 0;
|
int ij = 0;
|
||||||
for (int ii = 0; ii < data->natoms; ii++) {
|
for (int ii = 0; ii < data->natoms; ii++) {
|
||||||
const int i = data->iatoms[ii];
|
const int i = data->iatoms[ii];
|
||||||
|
@ -256,14 +256,14 @@ void MLIAPModelQuadratic::compute_force_gradients(class MLIAPData* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// gradient of energy of atom I w.r.t. parameters
|
// gradient of energy of atom I w.r.t. parameters
|
||||||
|
|
||||||
int l = elemoffset;
|
int l = elemoffset;
|
||||||
data->egradient[l++] += 1.0;
|
data->egradient[l++] += 1.0;
|
||||||
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++)
|
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++)
|
||||||
data->egradient[l++] += data->descriptors[ii][icoeff];
|
data->egradient[l++] += data->descriptors[ii][icoeff];
|
||||||
|
|
||||||
// quadratic contributions
|
// quadratic contributions
|
||||||
|
|
||||||
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++) {
|
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++) {
|
||||||
double bveci = data->descriptors[ii][icoeff];
|
double bveci = data->descriptors[ii][icoeff];
|
||||||
data->egradient[l++] += 0.5*bveci*bveci;
|
data->egradient[l++] += 0.5*bveci*bveci;
|
||||||
|
@ -274,5 +274,5 @@ void MLIAPModelQuadratic::compute_force_gradients(class MLIAPData* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,9 +66,9 @@ PairMLIAP::~PairMLIAP()
|
||||||
void PairMLIAP::compute(int eflag, int vflag)
|
void PairMLIAP::compute(int eflag, int vflag)
|
||||||
{
|
{
|
||||||
ev_init(eflag,vflag);
|
ev_init(eflag,vflag);
|
||||||
|
|
||||||
data->generate_neighdata(list, eflag, vflag);
|
data->generate_neighdata(list, eflag, vflag);
|
||||||
|
|
||||||
// compute descriptors, if needed
|
// compute descriptors, if needed
|
||||||
|
|
||||||
if (model->nonlinearflag || eflag)
|
if (model->nonlinearflag || eflag)
|
||||||
|
|
|
@ -2770,10 +2770,10 @@ void FixNPTCauchy::CauchyStat_Step(double (&Fi)[3][3], double (&Fdot)[3][3],
|
||||||
n=uv(jj,2);
|
n=uv(jj,2);
|
||||||
dsds(ii,jj) = Fi(i,m)*Fi(j,n) + Fi(i,n)*Fi(j,m) + Fi(j,m)*Fi(i,n) + Fi(j,n)*Fi(i,m);
|
dsds(ii,jj) = Fi(i,m)*Fi(j,n) + Fi(i,n)*Fi(j,m) + Fi(j,m)*Fi(i,n) + Fi(j,n)*Fi(i,m);
|
||||||
for(int l = 1;l <= 3;l++) {
|
for(int l = 1;l <= 3;l++) {
|
||||||
for(int k = 1;k <= 3;k++) {
|
for(int k = 1;k <= 3;k++) {
|
||||||
dsdf(ii,jj) = dsdf(ii,jj) + cauchy(k,l)*
|
dsdf(ii,jj) = dsdf(ii,jj) + cauchy(k,l)*
|
||||||
( Fi(i,k)*Fi(j,l)*Fi(n,m) - Fi(i,m)*Fi(j,l)*Fi(n,k) - Fi(i,k)*Fi(j,m)*Fi(n,l) );
|
( Fi(i,k)*Fi(j,l)*Fi(n,m) - Fi(i,m)*Fi(j,l)*Fi(n,k) - Fi(i,k)*Fi(j,m)*Fi(n,l) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue