whitespace fixes

This commit is contained in:
Axel Kohlmeyer 2020-07-16 19:00:22 -04:00
parent 31cfc99ad9
commit e98056c0e8
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
14 changed files with 98 additions and 98 deletions

View File

@ -416,7 +416,7 @@ by circles of diameter 0.5, is specified as follows:
.. parsed-literal::
1 3 13
2 1 1
2 1 1
0 1.33333 1.33333 0 0 0
-2 0 0
2 0 0

View File

@ -57,7 +57,7 @@ The compute *mliap* command must be followed by two keywords
*model* and *descriptor* in either order.
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.
Currently the only descriptor style is *sna*, indicating the bispectrum component

View File

@ -45,7 +45,7 @@ commands:
:math:`\phi_0` is specified in degrees, but LAMMPS converts it to
radians internally; hence :math:`K` is effectively energy per
radian\^2.
----------
Styles with a *gpu*\ , *intel*\ , *kk*\ , *omp*\ , or *opt* suffix are

View File

@ -302,40 +302,40 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(char const *const input_line) cons
if(nocomment) {
if (strcmp(key,"pair") == 0) {
species1 = strtok(ptr," \t");
species2 = strtok(NULL," \t");
the_rest = strtok(NULL,"\n");
species1 = strtok(ptr," \t");
species2 = strtok(NULL," \t");
the_rest = strtok(NULL,"\n");
for (int type_a = 0; type_a < atom->ntypes; ++type_a) {
for (int type_b = type_a; type_b < atom->ntypes; ++type_b) {
if(((strcmp(species[type_a],species1) == 0) &&
(strcmp(species[type_b],species2) == 0))
||
((strcmp(species[type_b],species1) == 0) &&
(strcmp(species[type_a],species2) == 0))
) {
char pair_command[MAXLINE];
sprintf(pair_command,"pair_coeff %i %i %s",type_a+1,type_b+1,
the_rest);
input->one(pair_command);
}
}
}
for (int type_a = 0; type_a < atom->ntypes; ++type_a) {
for (int type_b = type_a; type_b < atom->ntypes; ++type_b) {
if(((strcmp(species[type_a],species1) == 0) &&
(strcmp(species[type_b],species2) == 0))
||
((strcmp(species[type_b],species1) == 0) &&
(strcmp(species[type_a],species2) == 0))
) {
char pair_command[MAXLINE];
sprintf(pair_command,"pair_coeff %i %i %s",type_a+1,type_b+1,
the_rest);
input->one(pair_command);
}
}
}
}
else if (strcmp(key,"charge") == 0) {
species1 = strtok(ptr," \t");
the_rest = strtok(NULL,"\n");
species1 = strtok(ptr," \t");
the_rest = strtok(NULL,"\n");
for (int type_a = 0; type_a < atom->ntypes; ++type_a) {
if(strcmp(species[type_a],species1) == 0) {
char pair_command[MAXLINE];
sprintf(pair_command,"set type %i charge %s",type_a+1,the_rest);
input->one(pair_command);
}
}
for (int type_a = 0; type_a < atom->ntypes; ++type_a) {
if(strcmp(species[type_a],species1) == 0) {
char pair_command[MAXLINE];
sprintf(pair_command,"set type %i charge %s",type_a+1,the_rest);
input->one(pair_command);
}
}
}
else{
error->one(FLERR,"Unrecognized KEY for KIM_SET_TYPE_PARAMETERS command");
error->one(FLERR,"Unrecognized KEY for KIM_SET_TYPE_PARAMETERS command");
}
}
}

View File

@ -129,7 +129,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) :
iarg += 2;
} else if (strcmp(arg[iarg],"aconstrain") == 0 &&
strcmp(style,"bond/create/angle") == 0) {
if (iarg+3 > narg)
if (iarg+3 > narg)
error->all(FLERR,"Illegal fix bond/create/angle command");
amin = force->numeric(FLERR,arg[iarg+1]);
amax = force->inumeric(FLERR,arg[iarg+2]);
@ -470,7 +470,7 @@ void FixBondCreate::post_integrate()
partner[j] = tag[i];
distsq[j] = rsq;
}
}
}

View File

@ -54,16 +54,16 @@ int FixBondCreateAngle::constrain(int i, int j, double amin, double amax)
int flag = 0;
// pass if both atoms have no neighbors: bond is always formed
if (nspecial[i][0] == 0 && nspecial[j][0] == 0) flag = 1;
// pass if i has at least one neighbor and angle constraint is met
if (nspecial[i][0] != 0 && nspecial[j][0] == 0) {
// calculate first vector between i and j
// calculate second vector between i and its first neighbor
v1x = x[i][0] - x[j][0];
v1y = x[i][1] - x[j][1];
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
// set flag if the angle constraint is met
angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z)/
(sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z)));
if (amin <= angle1 && angle1 <= amax) flag = 1;
}
// pass if j has at least one neighbor and angle constraint is met
if (nspecial[j][0] != 0 && nspecial[i][0] == 0) {
// calculate first vector between j and i
// calculate second vector between j and its first neighbor
v1x = x[j][0] - x[i][0];
v1y = x[j][1] - x[i][1];
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 first vector between i and j
// calculate second vector between i and its first neighbor
v1x = x[i][0] - x[j][0];
v1y = x[i][1] - x[j][1];
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];
// calculate angle between both vectors
angle1 = acos((v1x*v2x + v1y*v2y + v1z*v2z) /
(sqrt(v1x*v1x + v1y*v1y + v1z*v1z)*sqrt(v2x*v2x + v2y*v2y + v2z*v2z)));

View File

@ -35,7 +35,7 @@ using namespace LAMMPS_NS;
enum{SCALAR,VECTOR,ARRAY};
ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), mliaparray(NULL),
Compute(lmp, narg, arg), mliaparray(NULL),
mliaparrayall(NULL), map(NULL)
{
array_flag = 1;
@ -79,7 +79,7 @@ ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"gradgradflag") == 0) {
if (iarg+1 > narg) error->all(FLERR,"Illegal compute mliap command");
gradgradflag = atoi(arg[iarg+1]);
if (gradgradflag != 0 && gradgradflag != 1)
if (gradgradflag != 0 && gradgradflag != 1)
error->all(FLERR,"Illegal compute mliap command");
iarg += 2;
} else
@ -215,29 +215,29 @@ void ComputeMLIAP::compute_array()
neighbor->build_one(list);
data->generate_neighdata(list);
// compute descriptors
descriptor->compute_descriptors(data);
if (gradgradflag == 1) {
// calculate double gradient w.r.t. parameters and descriptors
model->compute_gradgrads(data);
// calculate gradients of forces w.r.t. parameters
descriptor->compute_force_gradients(data);
} else if (gradgradflag == 0) {
// calculate descriptor gradients
descriptor->compute_descriptor_gradients(data);
// calculate gradients of forces w.r.t. parameters
model->compute_force_gradients(data);
} else error->all(FLERR,"Invalid value for gradgradflag");

View File

@ -40,7 +40,7 @@ class ComputeMLIAP : public Compute {
double **mliaparray, **mliaparrayall;
class NeighList *list;
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 nelements;
int gradgradflag; // 1 for graddesc, 0 for gamma

View File

@ -33,14 +33,14 @@
using namespace LAMMPS_NS;
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) :
Pointers(lmp),
list(NULL),
gradforce(NULL),
list(NULL),
gradforce(NULL),
betas(NULL), descriptors(NULL), gamma_row_index(NULL), gamma_col_index(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)
{
gradgradflag = gradgradflag_in;
@ -108,10 +108,10 @@ void MLIAPData::generate_neighdata(NeighList* list_in, int eflag_in, int vflag_i
list = list_in;
double **x = atom->x;
int *type = atom->type;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
// grow nmax gradforce array if necessary
if (atom->nmax > nmax) {
@ -121,15 +121,15 @@ void MLIAPData::generate_neighdata(NeighList* list_in, int eflag_in, int vflag_i
}
// clear gradforce array
int ntotal = atom->nlocal + atom->nghost;
for (int i = 0; i < ntotal; i++)
for (int j = 0; j < size_gradforce; j++) {
gradforce[i][j] = 0.0;
}
// grow gamma arrays if necessary
if (gradgradflag == 1) {
const int natomgamma = list->inum;
if (natomgamma_max < natomgamma) {
@ -150,20 +150,20 @@ void MLIAPData::generate_neighdata(NeighList* list_in, int eflag_in, int vflag_i
}
grow_neigharrays();
int ij = 0;
for (int ii = 0; ii < list->inum; ii++) {
const int i = list->ilist[ii];
const double xtmp = x[i][0];
const double ytmp = x[i][1];
const double ztmp = x[i][2];
const int itype = type[i];
const int ielem = map[itype];
int *jlist = firstneigh[i];
const int jnum = numneigh[i];
int ninside = 0;
for (int jj = 0; jj < jnum; 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;
int jtype = type[j];
const int jelem = map[jtype];
if (rsq < descriptor->cutsq[ielem][jelem]) {
jatoms[ij] = j;
jelems[ij] = jelem;
@ -202,7 +202,7 @@ void MLIAPData::grow_neigharrays()
{
// grow neighbor atom arrays if necessary
const int natomneigh = list->inum;
if (natomneigh_max < natomneigh) {
memory->grow(iatoms,natomneigh,"MLIAPData:iatoms");
@ -215,7 +215,7 @@ void MLIAPData::grow_neigharrays()
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
int iilast = list->inum-1;
int ilast = list->ilist[iilast];
int upperbound = firstneigh[ilast] - firstneigh[0] + numneigh[ilast];
@ -223,20 +223,20 @@ void MLIAPData::grow_neigharrays()
double **x = atom->x;
int *type = atom->type;
int nneigh = 0;
for (int ii = 0; ii < list->inum; ii++) {
const int i = list->ilist[ii];
const double xtmp = x[i][0];
const double ytmp = x[i][1];
const double ztmp = x[i][2];
const int itype = type[i];
const int ielem = map[itype];
int *jlist = firstneigh[i];
const int jnum = numneigh[i];
int ninside = 0;
for (int jj = 0; jj < jnum; jj++) {
int j = jlist[jj];
@ -251,7 +251,7 @@ void MLIAPData::grow_neigharrays()
}
nneigh += ninside;
}
if (nneigh_max < nneigh) {
memory->grow(jatoms,nneigh,"MLIAPData:jatoms");
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); // ielems
bytes += natomneigh_max*sizeof(int); // numneighs
bytes += nneigh_max*sizeof(int); // jatoms
bytes += nneigh_max*sizeof(int); // jelems
bytes += nneigh_max*3*sizeof(double); // rij"
if (gradgradflag == 0)
bytes += nneigh_max*ndescriptors*3*sizeof(double);// graddesc
return bytes;
}

View File

@ -36,17 +36,17 @@ class MLIAPData : protected Pointers {
double **gradforce;
double** betas; // betas 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 nelements; // number of elements
// data structures for grad-grad list (gamma)
int natomgamma_max; // allocated size of gamma
int gamma_nnz; // number of non-zero entries in gamma
double** gamma; // gamma element
int** gamma_row_index; // row (parameter) index
int** gamma_col_index; // column (descriptor) index
int** gamma_row_index; // row (parameter) index
int** gamma_col_index; // column (descriptor) index
double* egradient; // energy gradient w.r.t. parameters
// data structures for mliap neighbor list

View File

@ -50,7 +50,7 @@ int MLIAPModelLinear::get_nparams()
---------------------------------------------------------------------- */
void MLIAPModelLinear::compute_gradients(MLIAPData* data)
{
{
for (int ii = 0; ii < data->natoms; ii++) {
const int i = data->iatoms[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
---------------------------------------------------------------------- */
void MLIAPModelLinear::compute_force_gradients(class MLIAPData* data)
void MLIAPModelLinear::compute_force_gradients(class MLIAPData* data)
{
// zero out energy gradients
for (int l = 0; l < data->nelements*data->nparams; l++)
data->egradient[l] = 0.0;
int ij = 0;
for (int ii = 0; ii < data->natoms; 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
int l = elemoffset;
data->egradient[l++] += 1.0;
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++)
data->egradient[l++] += data->descriptors[ii][icoeff];
}
}
/* ----------------------------------------------------------------------

View File

@ -207,7 +207,7 @@ void MLIAPModelQuadratic::compute_force_gradients(class MLIAPData* data) {
for (int l = 0; l < data->nelements*data->nparams; l++)
data->egradient[l] = 0.0;
int ij = 0;
for (int ii = 0; ii < data->natoms; 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
int l = elemoffset;
data->egradient[l++] += 1.0;
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++)
data->egradient[l++] += data->descriptors[ii][icoeff];
// quadratic contributions
for (int icoeff = 0; icoeff < data->ndescriptors; icoeff++) {
double bveci = data->descriptors[ii][icoeff];
data->egradient[l++] += 0.5*bveci*bveci;
@ -274,5 +274,5 @@ void MLIAPModelQuadratic::compute_force_gradients(class MLIAPData* data) {
}
}
}

View File

@ -66,9 +66,9 @@ PairMLIAP::~PairMLIAP()
void PairMLIAP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
data->generate_neighdata(list, eflag, vflag);
// compute descriptors, if needed
if (model->nonlinearflag || eflag)

View File

@ -2770,10 +2770,10 @@ void FixNPTCauchy::CauchyStat_Step(double (&Fi)[3][3], double (&Fdot)[3][3],
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);
for(int l = 1;l <= 3;l++) {
for(int k = 1;k <= 3;k++) {
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) );
}
for(int k = 1;k <= 3;k++) {
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) );
}
}
}
}