diff --git a/src/ASPHERE/compute_erotate_asphere.cpp b/src/ASPHERE/compute_erotate_asphere.cpp index 5b9612ee1eac26c697fc4a103c72e6706123c41e..afec2a9b28a8af8727a153738ff2f95f5fcc791f 100644 --- a/src/ASPHERE/compute_erotate_asphere.cpp +++ b/src/ASPHERE/compute_erotate_asphere.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "compute_erotate_asphere.h" #include "math_extra.h" #include "atom.h" diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 0f2fea03560a72a12c32c6b70b4107a85824184d..f3db5dea9278cc7499f1bf9e86db30a40b780987 100755 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -15,8 +15,8 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_temp_asphere.h" #include "math_extra.h" #include "atom.h" @@ -55,7 +55,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : int iarg = 3; while (iarg < narg) { if (strcmp(arg[iarg],"bias") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/asphere command"); tempbias = 1; int n = strlen(arg[iarg+1]) + 1; @@ -63,7 +63,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : strcpy(id_bias,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"dof") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/asphere command"); if (strcmp(arg[iarg+1],"rotate") == 0) mode = ROTATE; else if (strcmp(arg[iarg+1],"all") == 0) mode = ALL; @@ -107,7 +107,7 @@ void ComputeTempAsphere::init() if (tempbias) { int i = modify->find_compute(id_bias); - if (i < 0) + if (i < 0) error->all(FLERR,"Could not find compute ID for temperature bias"); tbias = modify->compute[i]; if (tbias->tempflag == 0) @@ -267,7 +267,7 @@ double ComputeTempAsphere::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic || tempbias == 2) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/ASPHERE/fix_nh_asphere.cpp b/src/ASPHERE/fix_nh_asphere.cpp index ced5470adaae81ff680324f613a39f492433a05a..2eee28dc1ce1ead9da818fb1e12832c06d8e5ef3 100644 --- a/src/ASPHERE/fix_nh_asphere.cpp +++ b/src/ASPHERE/fix_nh_asphere.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "math_extra.h" #include "fix_nh_asphere.h" #include "atom.h" diff --git a/src/ASPHERE/fix_nph_asphere.cpp b/src/ASPHERE/fix_nph_asphere.cpp index a1a113a33713a58c32a99afce3a28d606eef918d..10549ca1b8c3a42e4a9b89bcef0cf636907ae8db 100644 --- a/src/ASPHERE/fix_nph_asphere.cpp +++ b/src/ASPHERE/fix_nph_asphere.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nph_asphere.h" #include "modify.h" #include "error.h" diff --git a/src/ASPHERE/fix_npt_asphere.cpp b/src/ASPHERE/fix_npt_asphere.cpp index dab72dc29fe3767ee8022ff11c363f496a93c682..2625bc6391b8f8fe8e7ee1d51c2343a24d6424d8 100755 --- a/src/ASPHERE/fix_npt_asphere.cpp +++ b/src/ASPHERE/fix_npt_asphere.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_npt_asphere.h" #include "modify.h" #include "error.h" diff --git a/src/ASPHERE/fix_nve_asphere.cpp b/src/ASPHERE/fix_nve_asphere.cpp index 78eebc8820b09779ba86e0a6fccf403a44e02925..2ac3f95c5398220c1d981844a82fd5d0a4b5ab3a 100755 --- a/src/ASPHERE/fix_nve_asphere.cpp +++ b/src/ASPHERE/fix_nve_asphere.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_nve_asphere.h" #include "math_extra.h" #include "atom.h" diff --git a/src/ASPHERE/fix_nve_asphere_noforce.cpp b/src/ASPHERE/fix_nve_asphere_noforce.cpp index 1cbc8fb16c6c12476c6c55a064052ec3dc1471a2..34fb57159c69612c19dacd5e1246f6a180532428 100644 --- a/src/ASPHERE/fix_nve_asphere_noforce.cpp +++ b/src/ASPHERE/fix_nve_asphere_noforce.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_nve_asphere_noforce.h" #include "math_extra.h" #include "atom.h" diff --git a/src/ASPHERE/fix_nve_line.cpp b/src/ASPHERE/fix_nve_line.cpp index be9b42a7a19ccbc73ffa955e73eb5174cac4ae87..554242fb5b4209d797d91c0dbf1f61b6a0594e37 100644 --- a/src/ASPHERE/fix_nve_line.cpp +++ b/src/ASPHERE/fix_nve_line.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_nve_line.h" #include "atom.h" #include "atom_vec_line.h" diff --git a/src/ASPHERE/fix_nve_tri.cpp b/src/ASPHERE/fix_nve_tri.cpp index 71fe4d72dc7171fa6992a173e01751d17cf0c169..f859ce08c81b75b29adc72ddba388edd406931b6 100644 --- a/src/ASPHERE/fix_nve_tri.cpp +++ b/src/ASPHERE/fix_nve_tri.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_nve_tri.h" #include "math_extra.h" #include "atom.h" diff --git a/src/ASPHERE/fix_nvt_asphere.cpp b/src/ASPHERE/fix_nvt_asphere.cpp index 796bbdf40cafd60a3640bd57b25e19e92315fda0..5b8b943ab469677c5b98aeaf97219d415dec3869 100755 --- a/src/ASPHERE/fix_nvt_asphere.cpp +++ b/src/ASPHERE/fix_nvt_asphere.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nvt_asphere.h" #include "group.h" #include "modify.h" diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index b22a4fc70f220fb98d2d29eda62a78f3875504d8..4aae7177dae1c01ccd883413b39f0d8122a0c339 100755 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -15,10 +15,10 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_gayberne.h" #include "math_extra.h" #include "atom.h" diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index 7f97902c578c68b226ac24761e82bdd0449af526..2124b455f60ec9d0b374ee812aa7a70a3ab80602 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_line_lj.h" #include "atom.h" #include "atom_vec_line.h" diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index adf8c5466016a210ca69aa686cb91aa1564c1d34..870ec95740eb0d0f314653953ec6cff584b0eebb 100755 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -15,10 +15,10 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_resquared.h" #include "math_extra.h" #include "atom.h" diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index 257341e60224692a6242501f8db8095b2dd4a9cc..4823664de8dddaab952d30bb413189a6c72ef412 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tri_lj.h" #include "math_extra.h" #include "atom.h" @@ -476,7 +476,7 @@ void PairTriLJ::init_style() neighbor->request(this,instance_me); } - + /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ diff --git a/src/BODY/body_nparticle.cpp b/src/BODY/body_nparticle.cpp index b8e981e17273347459b3ae5cc375b0ddd8b929bc..ccb3a6318205f6f180d4dcd82f2d18835bb3e4de 100644 --- a/src/BODY/body_nparticle.cpp +++ b/src/BODY/body_nparticle.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "body_nparticle.h" #include "math_extra.h" #include "atom_vec_body.h" @@ -25,14 +25,14 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -BodyNparticle::BodyNparticle(LAMMPS *lmp, int narg, char **arg) : +BodyNparticle::BodyNparticle(LAMMPS *lmp, int narg, char **arg) : Body(lmp, narg, arg) { if (narg != 3) error->all(FLERR,"Invalid body nparticle command"); int nmin = force->inumeric(FLERR,arg[1]); int nmax = force->inumeric(FLERR,arg[2]); - if (nmin <= 0 || nmin > nmax) + if (nmin <= 0 || nmin > nmax) error->all(FLERR,"Invalid body nparticle command"); size_forward = 0; @@ -90,7 +90,7 @@ int BodyNparticle::unpack_border_body(AtomVecBody::Bonus *bonus, double *buf) populate bonus data structure with data file values ------------------------------------------------------------------------- */ -void BodyNparticle::data_body(int ibonus, int ninteger, int ndouble, +void BodyNparticle::data_body(int ibonus, int ninteger, int ndouble, char **ifile, char **dfile) { AtomVecBody::Bonus *bonus = &avec->bonus[ibonus]; @@ -98,22 +98,22 @@ void BodyNparticle::data_body(int ibonus, int ninteger, int ndouble, // error in data file if any values are NULL for (int i = 0; i < ninteger; i++) - if (ifile[i] == NULL) + if (ifile[i] == NULL) error->one(FLERR,"Invalid format in Bodies section of data file"); for (int i = 0; i < ndouble; i++) if (dfile[i] == NULL) error->one(FLERR,"Invalid format in Bodies section of data file"); - // set ninteger, ndouble in bonus and allocate 2 vectors of ints, doubles + // set ninteger, ndouble in bonus and allocate 2 vectors of ints, doubles - if (ninteger != 1) + if (ninteger != 1) error->one(FLERR,"Incorrect # of integer values in " "Bodies section of data file"); int nsub = atoi(ifile[0]); if (nsub < 1) error->one(FLERR,"Incorrect integer value in " "Bodies section of data file"); - if (ndouble != 6 + 3*nsub) + if (ndouble != 6 + 3*nsub) error->one(FLERR,"Incorrect # of floating-point values in " "Bodies section of data file"); @@ -144,7 +144,7 @@ void BodyNparticle::data_body(int ibonus, int ninteger, int ndouble, double max; max = MAX(inertia[0],inertia[1]); max = MAX(max,inertia[2]); - + if (inertia[0] < EPSILON*max) inertia[0] = 0.0; if (inertia[1] < EPSILON*max) inertia[1] = 0.0; if (inertia[2] < EPSILON*max) inertia[2] = 0.0; @@ -169,9 +169,9 @@ void BodyNparticle::data_body(int ibonus, int ninteger, int ndouble, double cross[3]; MathExtra::cross3(ex_space,ey_space,cross); if (MathExtra::dot3(cross,ez_space) < 0.0) MathExtra::negate3(ez_space); - + // create initial quaternion - + MathExtra::exyz_to_q(ex_space,ey_space,ez_space,bonus->quat); // bonus->dvalue = sub-particle displacements in body frame diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index 3ba146642ed74fc8176229bbc4a7bee3d1ac9613..474d132ab413ad97c690095f34af9d882a3b251b 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_body_local.h" #include "atom.h" #include "atom_vec_body.h" @@ -61,7 +61,7 @@ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : int indexmax = bptr->noutcol(); for (int i = 0; i < nvalues; i++) { - if (which[i] == INDEX && (index[i] < 0 || index[i] >= indexmax)) + if (which[i] == INDEX && (index[i] < 0 || index[i] >= indexmax)) error->all(FLERR,"Invalid index in compute body/local command"); } @@ -92,7 +92,7 @@ void ComputeBodyLocal::init() int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) + if (mask[i] & groupbit) if (body[i] < 0) nonbody = 1; int flag; diff --git a/src/BODY/fix_nve_body.cpp b/src/BODY/fix_nve_body.cpp index 27212ce0afc0efabe918df53ac4c382c1387f4c3..edc88ed3b4213fb5eae64a1283e5b1bb88bf14fa 100644 --- a/src/BODY/fix_nve_body.cpp +++ b/src/BODY/fix_nve_body.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_nve_body.h" #include "math_extra.h" #include "atom.h" diff --git a/src/BODY/pair_body.cpp b/src/BODY/pair_body.cpp index 4d565e0ed1b5541fc90c8bccfae6caae9b887715..86fea7e859c43bdad3f51192db3261398d34e29e 100644 --- a/src/BODY/pair_body.cpp +++ b/src/BODY/pair_body.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_body.h" #include "math_extra.h" #include "atom.h" @@ -178,7 +178,7 @@ void PairBody::compute(int eflag, int vflag) torque[i][0] += ti[0]; torque[i][1] += ti[1]; torque[i][2] += ti[2]; - + if (newton_pair || j < nlocal) { fj[0] = -delx*fpair; fj[1] = -dely*fpair; @@ -465,7 +465,7 @@ void PairBody::body2space(int i) AtomVecBody::Bonus *bonus = &avec->bonus[ibonus]; int nsub = bptr->nsub(bonus); double *coords = bptr->coords(bonus); - + dnum[i] = nsub; dfirst[i] = ndiscrete; diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index 09ff5860e9e63ac1eb4bde8734bab96fde3561eb..ceeba556787ad08471d158c8139410912c919642 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -15,9 +15,9 @@ Contributing author: Eric Simon (Cray) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "angle_class2.h" #include "atom.h" #include "neighbor.h" diff --git a/src/CLASS2/angle_class2.h b/src/CLASS2/angle_class2.h index 202dda6fabefbcf2d54087a32965614f1e87023d..1d595d5f6ac8737d58def4dff9109a4d13a09b26 100644 --- a/src/CLASS2/angle_class2.h +++ b/src/CLASS2/angle_class2.h @@ -20,7 +20,7 @@ AngleStyle(class2,AngleClass2) #ifndef LMP_ANGLE_CLASS2_H #define LMP_ANGLE_CLASS2_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index 19b4916210229b892e879224a425c190782392a6..b87deed5a65b41217c973c8c19a571060fac2e51 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -15,8 +15,8 @@ Contributing author: Eric Simon (Cray) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_class2.h" #include "atom.h" #include "neighbor.h" diff --git a/src/CLASS2/bond_class2.h b/src/CLASS2/bond_class2.h index 6c54a71360164b24f0dfa2c4eedd76ca0e69d387..51e2c939a77432100f4833378d53e2dff652c826 100644 --- a/src/CLASS2/bond_class2.h +++ b/src/CLASS2/bond_class2.h @@ -20,7 +20,7 @@ BondStyle(class2,BondClass2) #ifndef LMP_BOND_CLASS2_H #define LMP_BOND_CLASS2_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 579e195c2ac984b8e25b42d980ba7075252eeac8..9e907f87b72d473807cb149ac8b8ab0304a2b6b7 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -15,9 +15,9 @@ Contributing author: Eric Simon (Cray) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "dihedral_class2.h" #include "atom.h" #include "neighbor.h" @@ -205,8 +205,8 @@ void DihedralClass2::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/CLASS2/dihedral_class2.h b/src/CLASS2/dihedral_class2.h index c55a740300fccac73844368616afaf98c00a46b7..e8309dad7a94d2b1ebc91c08291185445006297c 100644 --- a/src/CLASS2/dihedral_class2.h +++ b/src/CLASS2/dihedral_class2.h @@ -20,7 +20,7 @@ DihedralStyle(class2,DihedralClass2) #ifndef LMP_DIHEDRAL_CLASS2_H #define LMP_DIHEDRAL_CLASS2_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index b4ccd77e77c87d48636d0a440f222d0e2d888ce1..c813954805a61ab01886017cde793b4bc5133f38 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -15,9 +15,9 @@ Contributing author: Eric Simon (Cray) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "improper_class2.h" #include "atom.h" #include "neighbor.h" @@ -156,8 +156,8 @@ void ImproperClass2::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); @@ -853,5 +853,5 @@ void ImproperClass2::write_data(FILE *fp) for (int i = 1; i <= atom->nimpropertypes; i++) fprintf(fp,"%d %g %g %g %g %g %g\n",i,aa_k1[i],aa_k2[i],aa_k3[i], aa_theta0_1[i]*180.0/MY_PI,aa_theta0_2[i]*180.0/MY_PI, - aa_theta0_3[i]*180.0/MY_PI); + aa_theta0_3[i]*180.0/MY_PI); } diff --git a/src/CLASS2/improper_class2.h b/src/CLASS2/improper_class2.h index 33ddd8cde024dbb912eee79d1136b1e7a59e49b2..f814da96c545daee13babb3ca34f53bc03b235ca 100644 --- a/src/CLASS2/improper_class2.h +++ b/src/CLASS2/improper_class2.h @@ -20,7 +20,7 @@ ImproperStyle(class2,ImproperClass2) #ifndef LMP_IMPROPER_CLASS2_H #define LMP_IMPROPER_CLASS2_H -#include "stdio.h" +#include <stdio.h> #include "improper.h" namespace LAMMPS_NS { diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index 9ae9613a747caf68ea4fdd9f2f4b45ffa0e086e4..0974769b9c7c3464b3306b488f9e329e8c480a2b 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_class2.h" #include "atom.h" #include "comm.h" diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp index 23f4d361417a6c027a44ee55478a01173458c64b..c7c473868947b11ade979bb966625ef773bfd08d 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.cpp +++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_class2_coul_cut.h" #include "atom.h" #include "comm.h" diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 7801e1687f225c8f898c20ce1a41ae4228033c76..62ffdab6e1226a7edfbdfcabf173c2751045dd59 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_class2_coul_long.h" #include "atom.h" #include "comm.h" @@ -136,18 +136,18 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag) prefactor = qqrd2e * qtmp*q[j]/r; forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; - } else { - union_int_float_t rsq_lookup; - rsq_lookup.f = rsq; - itable = rsq_lookup.i & ncoulmask; - itable >>= ncoulshiftbits; - fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; - table = ftable[itable] + fraction*dftable[itable]; - forcecoul = qtmp*q[j] * table; - if (factor_coul < 1.0) { - table = ctable[itable] + fraction*dctable[itable]; - prefactor = qtmp*q[j] * table; - forcecoul -= (1.0-factor_coul)*prefactor; + } else { + union_int_float_t rsq_lookup; + rsq_lookup.f = rsq; + itable = rsq_lookup.i & ncoulmask; + itable >>= ncoulshiftbits; + fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; + table = ftable[itable] + fraction*dftable[itable]; + forcecoul = qtmp*q[j] * table; + if (factor_coul < 1.0) { + table = ctable[itable] + fraction*dctable[itable]; + prefactor = qtmp*q[j] * table; + forcecoul -= (1.0-factor_coul)*prefactor; } } } else forcecoul = 0.0; @@ -172,11 +172,11 @@ void PairLJClass2CoulLong::compute(int eflag, int vflag) if (eflag) { if (rsq < cut_coulsq) { - if (!ncoultablebits || rsq <= tabinnersq) - ecoul = prefactor*erfc; - else { - table = etable[itable] + fraction*detable[itable]; - ecoul = qtmp*q[j] * table; + if (!ncoultablebits || rsq <= tabinnersq) + ecoul = prefactor*erfc; + else { + table = etable[itable] + fraction*detable[itable]; + ecoul = qtmp*q[j] * table; } if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; } else ecoul = 0.0; @@ -251,7 +251,7 @@ void PairLJClass2CoulLong::settings(int narg, char **arg) void PairLJClass2CoulLong::coeff(int narg, char **arg) { - if (narg < 4 || narg > 6) + if (narg < 4 || narg > 6) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -299,7 +299,7 @@ void PairLJClass2CoulLong::init_style() error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; - // setup force tables + // setup force tables if (ncoultablebits) init_tables(cut_coul,NULL); } diff --git a/src/COLLOID/fix_wall_colloid.cpp b/src/COLLOID/fix_wall_colloid.cpp index 41e8e9740aff2b6d4a55d2047438a00984c42851..7c0203ac5fb853fddd2c9c2e1a8359e44e5cdd6c 100644 --- a/src/COLLOID/fix_wall_colloid.cpp +++ b/src/COLLOID/fix_wall_colloid.cpp @@ -15,8 +15,8 @@ Contributing authors: Jeremy Lechman (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "fix_wall_colloid.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp index ef0978ab01aca5d26b8017445651270424a9b6d0..b5d83233ab9ca1713609d6a2096428fdfae08d53 100644 --- a/src/COLLOID/pair_colloid.cpp +++ b/src/COLLOID/pair_colloid.cpp @@ -15,10 +15,10 @@ Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_colloid.h" #include "atom.h" #include "comm.h" @@ -144,7 +144,7 @@ void PairColloid::compute(int eflag, int vflag) evdwl = 2.0/9.0*fR * (1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) * sigma6[itype][jtype]/K[6]) - offset[itype][jtype]; - if (rsq <= K[1]) + if (rsq <= K[1]) error->one(FLERR,"Overlapping small/large in pair colloid"); break; @@ -183,7 +183,7 @@ void PairColloid::compute(int eflag, int vflag) if (eflag) evdwl += a12[itype][jtype]/6.0 * (2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) - offset[itype][jtype]; - if (r <= K[1]) + if (r <= K[1]) error->one(FLERR,"Overlapping large/large in pair colloid"); break; } diff --git a/src/COLLOID/pair_yukawa_colloid.cpp b/src/COLLOID/pair_yukawa_colloid.cpp index 13d632526f98d6b6ab280f70995351b582744f97..9b8d0ecaad24d4b5ac3ca07f4775e6438d2ae177 100644 --- a/src/COLLOID/pair_yukawa_colloid.cpp +++ b/src/COLLOID/pair_yukawa_colloid.cpp @@ -15,8 +15,8 @@ Contributing authors: Randy Schunk (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_yukawa_colloid.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index 8714b5201d7a552f43b71e245962d5161b5a563f..43bf7b8e5e5a67d604670c392fd3768129079b8f 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -16,10 +16,10 @@ (hendrik.heenen at mytum.com) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" -#include "math.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> #include "compute_temp_cs.h" #include "atom.h" #include "atom_vec.h" @@ -57,12 +57,12 @@ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) : // find and define groupbits for core and shell groups cgroup = group->find(arg[3]); - if (cgroup == -1) + if (cgroup == -1) error->all(FLERR,"Cannot find specified group ID for core particles"); groupbit_c = group->bitmask[cgroup]; sgroup = group->find(arg[4]); - if (sgroup == -1) + if (sgroup == -1) error->all(FLERR,"Cannot find specified group ID for shell particles"); groupbit_s = group->bitmask[sgroup]; @@ -228,9 +228,9 @@ double ComputeTempCS::compute_scalar() vcm_pairs(); - // calculate thermal scalar in respect to atom velocities as center-of-mass + // calculate thermal scalar in respect to atom velocities as center-of-mass // velocities of its according core/shell pairs - + double **v = atom->v; int *mask = atom->mask; int *type = atom->type; @@ -256,12 +256,12 @@ double ComputeTempCS::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; } - + /* ---------------------------------------------------------------------- */ void ComputeTempCS::compute_vector() @@ -313,7 +313,7 @@ void ComputeTempCS::vcm_pairs() maxatom = atom->nmax; memory->create(vint,maxatom,3,"temp/cs:vint"); } - + // vcm = COM velocity of each CS pair // vint = internal velocity of each C/S atom, used as bias @@ -327,7 +327,7 @@ void ComputeTempCS::vcm_pairs() tagint partnerID; for (i = 0; i < nlocal; i++) { - if ((mask[i] & groupbit) && + if ((mask[i] & groupbit) && (mask[i] & groupbit_c || mask[i] & groupbit_s)) { if (rmass) massone = rmass[i]; else massone = mass[type[i]]; diff --git a/src/CORESHELL/pair_born_coul_long_cs.cpp b/src/CORESHELL/pair_born_coul_long_cs.cpp index 87c86808608aca34cc6a2fa0f846c93f52875fd6..7d0d9c9416a4ad46ded5be36dbbaadd6a474ab38 100644 --- a/src/CORESHELL/pair_born_coul_long_cs.cpp +++ b/src/CORESHELL/pair_born_coul_long_cs.cpp @@ -15,10 +15,10 @@ Contributing author: Hendrik Heenen (hendrik.heenen@mytum.de) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_born_coul_long_cs.h" #include "atom.h" #include "comm.h" @@ -118,8 +118,8 @@ void PairBornCoulLongCS::compute(int eflag, int vflag) r = sqrt(rsq); prefactor = qqrd2e * qtmp*q[j]; if (factor_coul < 1.0) { - // When bonded parts are being calculated a minimal distance (EPS_EWALD) - // has to be added to the prefactor and erfc in order to make the + // When bonded parts are being calculated a minimal distance (EPS_EWALD) + // has to be added to the prefactor and erfc in order to make the // used approximation functions valid grij = g_ewald * (r+EPS_EWALD); expm2 = exp(-grij*grij); diff --git a/src/CORESHELL/pair_buck_coul_long_cs.cpp b/src/CORESHELL/pair_buck_coul_long_cs.cpp index 1d269da58f43b7424c12286345a0a78f504dc485..822ec1049725ac2d2470b653ec9e68adc178702a 100644 --- a/src/CORESHELL/pair_buck_coul_long_cs.cpp +++ b/src/CORESHELL/pair_buck_coul_long_cs.cpp @@ -15,10 +15,10 @@ Contributing author: Hendrik Heenen (hendrik.heenen@mytum.de) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_buck_coul_long_cs.h" #include "atom.h" #include "comm.h" @@ -118,8 +118,8 @@ void PairBuckCoulLongCS::compute(int eflag, int vflag) r = sqrt(rsq); prefactor = qqrd2e * qtmp*q[j]; if (factor_coul < 1.0) { - // When bonded parts are being calculated a minimal distance (EPS_EWALD) - // has to be added to the prefactor and erfc in order to make the + // When bonded parts are being calculated a minimal distance (EPS_EWALD) + // has to be added to the prefactor and erfc in order to make the // used approximation functions for the Ewald correction valid grij = g_ewald * (r+EPS_EWALD); expm2 = exp(-grij*grij); diff --git a/src/CORESHELL/pair_coul_long_cs.cpp b/src/CORESHELL/pair_coul_long_cs.cpp index 05cf53c9b078328dc677ac358da307ea715180c1..9177e9a0613ce7b61f3028fbad65d7076861664e 100644 --- a/src/CORESHELL/pair_coul_long_cs.cpp +++ b/src/CORESHELL/pair_coul_long_cs.cpp @@ -15,10 +15,10 @@ Contributing author: Hendrik Heenen (hendrik.heenen@mytum.de) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_long_cs.h" #include "atom.h" #include "comm.h" @@ -116,8 +116,8 @@ void PairCoulLongCS::compute(int eflag, int vflag) r = sqrt(rsq); prefactor = qqrd2e * scale[itype][jtype] * qtmp*q[j]; if (factor_coul < 1.0) { - // When bonded parts are being calculated a minimal distance (EPS_EWALD) - // has to be added to the prefactor and erfc in order to make the + // When bonded parts are being calculated a minimal distance (EPS_EWALD) + // has to be added to the prefactor and erfc in order to make the // used approximation functions for the Ewald correction valid grij = g_ewald * (r+EPS_EWALD); expm2 = exp(-grij*grij); diff --git a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp index fe9ba286969b76b3c256a32b491a5c80661b7598..e2ffda148f1627d6726adc08c58e31b57f3041db 100644 --- a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp @@ -15,10 +15,10 @@ Contributing author: Hendrik Heenen (hendrik.heenen@mytum.de) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_long_cs.h" #include "atom.h" #include "comm.h" @@ -124,8 +124,8 @@ void PairLJCutCoulLongCS::compute(int eflag, int vflag) r = sqrt(rsq); prefactor = qqrd2e * qtmp*q[j]; if (factor_coul < 1.0) { - // When bonded parts are being calculated a minimal distance (EPS_EWALD) - // has to be added to the prefactor and erfc in order to make the + // When bonded parts are being calculated a minimal distance (EPS_EWALD) + // has to be added to the prefactor and erfc in order to make the // used approximation functions for the Ewald correction valid grij = g_ewald * (r+EPS_EWALD); expm2 = exp(-grij*grij); diff --git a/src/DIPOLE/atom_vec_dipole.cpp b/src/DIPOLE/atom_vec_dipole.cpp index 07c8d203d8836b1c465f0366733ccc6eef128011..5d69f03376b976fee756534660b8510bbe03162c 100644 --- a/src/DIPOLE/atom_vec_dipole.cpp +++ b/src/DIPOLE/atom_vec_dipole.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "atom_vec_dipole.h" #include "atom.h" #include "comm.h" diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp index d87434871879e6a7cd457afb954c2a584998550c..53c977f876ede3268d7d75946a166042843e0148 100755 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_lj_cut_dipole_cut.h" #include "atom.h" #include "neighbor.h" @@ -22,7 +22,7 @@ #include "memory.h" #include "error.h" #include "update.h" -#include "string.h" +#include <string.h> using namespace LAMMPS_NS; diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.cpp b/src/DIPOLE/pair_lj_cut_dipole_long.cpp index 824bbf734ac802cbdc6b538a97e418d694ec1390..3f44579b8f265615ec61e1dd9dcb1dcfcaced593 100755 --- a/src/DIPOLE/pair_lj_cut_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_long.cpp @@ -5,16 +5,16 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_dipole_long.h" #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "memory.h" #include "error.h" #include "update.h" -#include "string.h" +#include <string.h> using namespace LAMMPS_NS; @@ -50,7 +50,7 @@ PairLJCutDipoleLong::PairLJCutDipoleLong(LAMMPS *lmp) : Pair(lmp) } /* ---------------------------------------------------------------------- - free all arrays + free all arrays ------------------------------------------------------------------------- */ PairLJCutDipoleLong::~PairLJCutDipoleLong() @@ -153,7 +153,7 @@ void PairLJCutDipoleLong::compute(int eflag, int vflag) pdotp = mu[i][0]*mu[j][0] + mu[i][1]*mu[j][1] + mu[i][2]*mu[j][2]; pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz; - + g0 = qtmp*q[j]; g1 = qtmp*pjdotr - q[j]*pidotr + pdotp; g2 = -pidotr*pjdotr; @@ -166,10 +166,10 @@ void PairLJCutDipoleLong::compute(int eflag, int vflag) g0b1_g1b2_g2b3 = g0*b1 + g1*b2 + g2*b3; fdx = delx * g0b1_g1b2_g2b3 - - b1 * (qtmp*mu[j][0] - q[j]*mu[i][0]) + + b1 * (qtmp*mu[j][0] - q[j]*mu[i][0]) + b2 * (pjdotr*mu[i][0] + pidotr*mu[j][0]); fdy = dely * g0b1_g1b2_g2b3 - - b1 * (qtmp*mu[j][1] - q[j]*mu[i][1]) + + b1 * (qtmp*mu[j][1] - q[j]*mu[i][1]) + b2 * (pjdotr*mu[i][1] + pidotr*mu[j][1]); fdz = delz * g0b1_g1b2_g2b3 - b1 * (qtmp*mu[j][2] - q[j]*mu[i][2]) + @@ -204,13 +204,13 @@ void PairLJCutDipoleLong::compute(int eflag, int vflag) d1 = (d0 + pre1*expm2) * r2inv; d2 = (3.0*d1 + pre2*expm2) * r2inv; d3 = (5.0*d2 + pre3*expm2) * r2inv; - + g0d1_g1d2_g2d3 = g0*d1 + g1*d2 + g2*d3; fax = delx * g0d1_g1d2_g2d3 - - d1 * (qtmp*mu[j][0] - q[j]*mu[i][0]) + + d1 * (qtmp*mu[j][0] - q[j]*mu[i][0]) + d2 * (pjdotr*mu[i][0] + pidotr*mu[j][0]); fay = dely * g0d1_g1d2_g2d3 - - d1 * (qtmp*mu[j][1] - q[j]*mu[i][1]) + + d1 * (qtmp*mu[j][1] - q[j]*mu[i][1]) + d2 * (pjdotr*mu[i][1] + pidotr*mu[j][1]); faz = delz * g0d1_g1d2_g2d3 - d1 * (qtmp*mu[j][2] - q[j]*mu[i][2]) + @@ -271,7 +271,7 @@ void PairLJCutDipoleLong::compute(int eflag, int vflag) fx = qqrd2e*forcecoulx + delx*fforce; fy = qqrd2e*forcecouly + dely*fforce; fz = qqrd2e*forcecoulz + delz*fforce; - + // force & torque accumulation f[i][0] += fx; @@ -316,7 +316,7 @@ void PairLJCutDipoleLong::compute(int eflag, int vflag) } /* ---------------------------------------------------------------------- - allocate all arrays + allocate all arrays ------------------------------------------------------------------------- */ void PairLJCutDipoleLong::allocate() @@ -343,12 +343,12 @@ void PairLJCutDipoleLong::allocate() } /* ---------------------------------------------------------------------- - global settings + global settings ------------------------------------------------------------------------- */ void PairLJCutDipoleLong::settings(int narg, char **arg) { - if (narg < 1 || narg > 2) + if (narg < 1 || narg > 2) error->all(FLERR,"Incorrect args in pair_style command"); cut_lj_global = force->numeric(FLERR,arg[0]); @@ -371,7 +371,7 @@ void PairLJCutDipoleLong::settings(int narg, char **arg) void PairLJCutDipoleLong::coeff(int narg, char **arg) { - if (narg < 4 || narg > 5) + if (narg < 4 || narg > 5) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -419,12 +419,12 @@ double PairLJCutDipoleLong::init_one(int i, int j) lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0); lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0); lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0); - + if (offset_flag) { double ratio = sigma[i][j] / cut_lj[i][j]; offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0)); } else offset[i][j] = 0.0; - + cut_ljsq[j][i] = cut_ljsq[i][j]; lj1[j][i] = lj1[i][j]; lj2[j][i] = lj2[i][j]; @@ -449,7 +449,7 @@ void PairLJCutDipoleLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == NULL) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.h b/src/DIPOLE/pair_lj_cut_dipole_long.h index 9c04a31d244f7d7a7065f5cafd64338d2d07b315..d2d441e0e903a6cfa9194dd44ce0eaf6afc6ca91 100755 --- a/src/DIPOLE/pair_lj_cut_dipole_long.h +++ b/src/DIPOLE/pair_lj_cut_dipole_long.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/DIPOLE/pair_lj_long_dipole_long.cpp b/src/DIPOLE/pair_lj_long_dipole_long.cpp index 0e5a0222c70105784f34f12c8f8552aef157bf65..248865ef728ca04fb658a0929397d11094d6c31c 100755 --- a/src/DIPOLE/pair_lj_long_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_long_dipole_long.cpp @@ -15,10 +15,10 @@ Contributing author: Pieter J. in 't Veld and Stan Moore (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "math_const.h" #include "math_vector.h" #include "pair_lj_long_dipole_long.h" @@ -173,7 +173,7 @@ void *PairLJLongDipoleLong::extract(const char *id, int &dim) "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", "cut_vdwl", NULL}; void *ptrs[] = { - lj4, sigma, epsilon, &ewald_order, &cut_coul, &mix_flag, &cut_coul, + lj4, sigma, epsilon, &ewald_order, &cut_coul, &mix_flag, &cut_coul, &cut_lj_global, NULL}; int i; @@ -189,7 +189,7 @@ void *PairLJLongDipoleLong::extract(const char *id, int &dim) void PairLJLongDipoleLong::coeff(int narg, char **arg) { - if (narg < 4 || narg > 5) + if (narg < 4 || narg > 5) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -247,14 +247,14 @@ void PairLJLongDipoleLong::init_style() // ensure use of KSpace long-range solver, set g_ewald if (ewald_order&(1<<3)) { // r^-1 kspace - if (force->kspace == NULL) + if (force->kspace == NULL) error->all(FLERR,"Pair style requires a KSpace style"); for (i=0; style3[i]&&strcmp(force->kspace_style, style3[i]); ++i); if (!style3[i]) error->all(FLERR,"Pair style requires use of kspace_style ewald/disp"); } if (ewald_order&(1<<6)) { // r^-6 kspace - if (force->kspace == NULL) + if (force->kspace == NULL) error->all(FLERR,"Pair style requires a KSpace style"); for (i=0; style6[i]&&strcmp(force->kspace_style, style6[i]); ++i); if (!style6[i]) @@ -313,7 +313,7 @@ double PairLJLongDipoleLong::init_one(int i, int j) //if (cut_respa && MIN(cut_lj[i][j],cut_coul) < cut_respa[3]) //error->all(FLERR,"Pair cutoff < Respa interior cutoff"); - + if (offset_flag) { double ratio = sigma[i][j] / cut_lj[i][j]; offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0)); @@ -423,7 +423,7 @@ void PairLJLongDipoleLong::compute(int eflag, int vflag) if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + double **x = atom->x, *x0 = x[0]; double **mu = atom->mu, *mu0 = mu[0], *imu, *jmu; double **tq = atom->torque, *tq0 = tq[0], *tqi; @@ -445,7 +445,7 @@ void PairLJLongDipoleLong::compute(int eflag, int vflag) double B0, B1, B2, B3, G0, G1, G2, mudi, mudj, muij; vector force_d = VECTOR_NULL, ti = VECTOR_NULL, tj = VECTOR_NULL; vector mui, muj, xi, d; - + double C1 = 2.0 * g_ewald / MY_PIS; double C2 = 2.0 * g2 * C1; double C3 = 2.0 * g2 * C2; @@ -460,14 +460,14 @@ void PairLJLongDipoleLong::compute(int eflag, int vflag) cutsqi = cutsq[typei]; cut_ljsqi = cut_ljsq[typei]; memcpy(xi, x0+(i+(i<<1)), sizeof(vector)); memcpy(mui, imu = mu0+(i<<2), sizeof(vector)); - + jneighn = (jneigh = list->firstneigh[i])+list->numneigh[i]; for (; jneigh<jneighn; ++jneigh) { // loop over neighbors j = *jneigh; ni = sbmask(j); // special index j &= NEIGHMASK; - + { register double *xj = x0+(j+(j<<1)); d[0] = xi[0] - xj[0]; // pair vector d[1] = xi[1] - xj[1]; @@ -496,7 +496,7 @@ void PairLJLongDipoleLong::compute(int eflag, int vflag) G1 = qi*mudj-qj*mudi+muij; G2 = -mudi*mudj; force_coul = G0*B1+G1*B2+G2*B3; - + mudi *= B2; mudj *= B2; // torque contribs ti[0] = mudj*d[0]+(qj*d[0]-muj[0])*B1; ti[1] = mudj*d[1]+(qj*d[1]-muj[1])*B1; @@ -552,7 +552,7 @@ void PairLJLongDipoleLong::compute(int eflag, int vflag) register double f = special_lj[ni], t = rn*(1.0-f); force_lj = f*(rn *= rn)*lj1i[typej]- g8*(((6.0*a2+6.0)*a2+3.0)*a2+1.0)*x2*rsq+t*lj2i[typej]; - if (eflag) evdwl = + if (eflag) evdwl = f*rn*lj3i[typej]-g6*((a2+1.0)*a2+0.5)*x2+t*lj4i[typej]; } } @@ -641,8 +641,8 @@ double PairLJLongDipoleLong::single(int i, int j, int itype, int jtype, G1 = qi*mudj-qj*mudi+muij; G2 = -mudi*mudj; force_coul = G0*B1+G1*B2+G2*B3; - - eng += G0*B0+G1*B1+G2*B2; + + eng += G0*B0+G1*B1+G2*B2; if (factor_coul < 1.0) { // adj part, eqn 2.13 force_coul -= (f = force->qqrd2e*(1.0-factor_coul)/r)*( (3.0*G1+6.0*muij+15.0*G2*r2inv)*r2inv+G0); @@ -672,7 +672,7 @@ double PairLJLongDipoleLong::single(int i, int j, int itype, int jtype, eng += factor_lj*(r6inv*(r6inv*lj3[itype][jtype]- lj4[itype][jtype])-offset[itype][jtype]); } - } + } else force_lj = 0.0; fforce = (force_coul+force_lj)*r2inv; diff --git a/src/FLD/pair_brownian.cpp b/src/FLD/pair_brownian.cpp index 3aa96288ba96882b00e51ef84d13f8d73fb6b977..c1cc523d3262c1885a1dcb485a907b8f36094f5c 100755 --- a/src/FLD/pair_brownian.cpp +++ b/src/FLD/pair_brownian.cpp @@ -15,10 +15,10 @@ Contributing authors: Amit Kumar and Michael Bybee (UIUC) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_brownian.h" #include "atom.h" #include "atom_vec.h" @@ -502,7 +502,7 @@ void PairBrownian::init_style() if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; else if (strstr(modify->fix[i]->style,"wall") != NULL) { - if (flagwall) + if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); flagwall = 1; // Walls exist diff --git a/src/FLD/pair_brownian_poly.cpp b/src/FLD/pair_brownian_poly.cpp index c0a958ea7dd670e1fce8195bab01a25b63ae0e0b..84c56109d13cbb6f788cd65135a8ca9a268ca853 100644 --- a/src/FLD/pair_brownian_poly.cpp +++ b/src/FLD/pair_brownian_poly.cpp @@ -16,10 +16,10 @@ Dave Heine (Corning), polydispersity ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_brownian_poly.h" #include "atom.h" #include "atom_vec.h" @@ -365,7 +365,7 @@ void PairBrownianPoly::init_style() if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; else if (strstr(modify->fix[i]->style,"wall") != NULL) { - if (flagwall) + if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); flagwall = 1; // Walls exist diff --git a/src/FLD/pair_lubricate.cpp b/src/FLD/pair_lubricate.cpp index 79046e445dccc28dcc9d7fe1e9c430206c0258cd..ea398c340a9467711ad95fb19cab7573b5eae20e 100755 --- a/src/FLD/pair_lubricate.cpp +++ b/src/FLD/pair_lubricate.cpp @@ -16,10 +16,10 @@ Amit Kumar and Michael Bybee (UIUC) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lubricate.h" #include "atom.h" #include "atom_vec.h" @@ -575,7 +575,7 @@ void PairLubricate::init_style() "fix deform remap option"); } if (strstr(modify->fix[i]->style,"wall") != NULL) { - if (flagwall) + if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair lubricate"); flagwall = 1; // Walls exist diff --git a/src/FLD/pair_lubricateU.cpp b/src/FLD/pair_lubricateU.cpp index 66e9ab140045efd9513e35b5eaa2283265187b3f..214bc3c2f3ed68e71fb87d2d234087582d6165f0 100644 --- a/src/FLD/pair_lubricateU.cpp +++ b/src/FLD/pair_lubricateU.cpp @@ -15,11 +15,11 @@ Contributing authors: Amit Kumar and Michael Bybee (UIUC) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lubricateU.h" #include "atom.h" #include "atom_vec.h" @@ -1800,7 +1800,7 @@ void PairLubricateU::init_style() if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; else if (strstr(modify->fix[i]->style,"wall") != NULL) { - if (flagwall) + if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " "pair lubricateU"); diff --git a/src/FLD/pair_lubricateU_poly.cpp b/src/FLD/pair_lubricateU_poly.cpp index 02734c058bb9404a7712f476e046aeb9e8577b25..6a032987d97680ac4e07c0a9d54d7b51e09bcbfd 100644 --- a/src/FLD/pair_lubricateU_poly.cpp +++ b/src/FLD/pair_lubricateU_poly.cpp @@ -17,11 +17,11 @@ Dave Heine (Corning), polydispersity ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lubricateU_poly.h" #include "atom.h" #include "atom_vec.h" @@ -1153,7 +1153,7 @@ void PairLubricateUPoly::init_style() if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; else if (strstr(modify->fix[i]->style,"wall") != NULL){ - if (flagwall) + if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " "pair lubricateU"); diff --git a/src/FLD/pair_lubricate_poly.cpp b/src/FLD/pair_lubricate_poly.cpp index 937c5a315a077f3864aec77e9fd9256263d9918d..3701e2d78984e8b1e67fdab3b51c6e503f010b82 100644 --- a/src/FLD/pair_lubricate_poly.cpp +++ b/src/FLD/pair_lubricate_poly.cpp @@ -17,10 +17,10 @@ Dave Heine (Corning), polydispersity ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lubricate_poly.h" #include "atom.h" #include "atom_vec.h" @@ -471,7 +471,7 @@ void PairLubricatePoly::init_style() "fix deform remap option"); } if (strstr(modify->fix[i]->style,"wall") != NULL) { - if (flagwall) + if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " "pair lubricate/poly"); diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 1dea4dc46785f57ead0361ed7cea1feb5d669690..ddd82b30b59cde846aac81ad5a39f92e7eca54eb 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_gpu.h" #include "atom.h" #include "force.h" @@ -40,7 +40,7 @@ extern int lmp_init_device(MPI_Comm world, MPI_Comm replica, const int first_gpu, const int last_gpu, const int gpu_mode, const double particle_split, const int nthreads, const int t_per_atom, - const double cell_size, char *opencl_flags, + const double cell_size, char *opencl_flags, const int block_pair); extern void lmp_clear_device(); extern double lmp_gpu_forces(double **f, double **tor, double *eatom, @@ -89,7 +89,7 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : if (ngpu <= 0) error->all(FLERR,"Illegal package gpu command"); int first_gpu = 0; int last_gpu = ngpu-1; - + // options _gpu_mode = GPU_NEIGH; @@ -172,7 +172,7 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : if (binsize == 0.0) binsize = -1.0; int gpu_flag = lmp_init_device(universe->uworld, world, first_gpu, last_gpu, _gpu_mode, _particle_split, nthreads, - threads_per_atom, binsize, opencl_flags, + threads_per_atom, binsize, opencl_flags, block_pair); GPU_EXTRA::check_flag(gpu_flag,error,world); } @@ -200,8 +200,8 @@ int FixGPU::setmask() void FixGPU::init() { // GPU package cannot be used with atom_style template - - if (atom->molecular == 2) + + if (atom->molecular == 2) error->all(FLERR,"GPU package does not (yet) work with " "atom_style template"); @@ -219,7 +219,7 @@ void FixGPU::init() // neighbor list builds on the GPU with triclinic box is not yet supported - if ((_gpu_mode == GPU_NEIGH || _gpu_mode == GPU_HYB_NEIGH) && + if ((_gpu_mode == GPU_NEIGH || _gpu_mode == GPU_HYB_NEIGH) && domain->triclinic) error->all(FLERR,"Cannot use package gpu neigh yes with triclinic box"); @@ -229,7 +229,7 @@ void FixGPU::init() error->warning(FLERR,"Using package gpu without any pair style defined"); // make sure fdotr virial is not accumulated multiple times - + if (force->pair_match("hybrid",1) != NULL) { PairHybrid *hybrid = (PairHybrid *) force->pair; for (int i = 0; i < hybrid->nstyles; i++) diff --git a/src/GPU/pair_beck_gpu.cpp b/src/GPU/pair_beck_gpu.cpp index 614c088b03431c24b74941ad2e86c698b24b9167..c81318664086f895c7665d7bece4e25cd0ec40f8 100644 --- a/src/GPU/pair_beck_gpu.cpp +++ b/src/GPU/pair_beck_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_beck_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" #include "math_special.h" @@ -54,7 +54,7 @@ int ** beck_gpu_compute_n(const int ago, const int inum, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success); -void beck_gpu_compute(const int ago, const int inum, const int nall, +void beck_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, @@ -68,7 +68,7 @@ PairBeckGPU::PairBeckGPU(LAMMPS *lmp) : PairBeck(lmp), gpu_mode(GPU_FORCE) respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -86,10 +86,10 @@ void PairBeckGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -98,7 +98,7 @@ void PairBeckGPU::compute(int eflag, int vflag) atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, - vflag_atom, host_start, + vflag_atom, host_start, &ilist, &numneigh, cpu_time, success); } else { inum = list->inum; @@ -125,7 +125,7 @@ void PairBeckGPU::compute(int eflag, int vflag) void PairBeckGPU::init_style() { - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with beck/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -171,7 +171,7 @@ double PairBeckGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairBeckGPU::cpu_compute(int start, int inum, int eflag, int vflag, +void PairBeckGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; diff --git a/src/GPU/pair_beck_gpu.h b/src/GPU/pair_beck_gpu.h index 4ae04a82a6917d082a98780a7a22e87b7d0feae3..8fd2cfad4563bb0ac56c1bd040249f47a2073334 100644 --- a/src/GPU/pair_beck_gpu.h +++ b/src/GPU/pair_beck_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_born_coul_long_gpu.cpp b/src/GPU/pair_born_coul_long_gpu.cpp index 7873912020204602274343e2ff778659d2f6d006..4e457de4a525a7647db2d417c35517009372409e 100644 --- a/src/GPU/pair_born_coul_long_gpu.cpp +++ b/src/GPU/pair_born_coul_long_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_born_coul_long_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -33,7 +33,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "kspace.h" #include "gpu_extra.h" @@ -51,9 +51,9 @@ using namespace MathConst; // External functions from cuda library for atom decomposition int borncl_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv, - double **host_born1, double **host_born2, - double **host_born3, double **host_a, - double **host_c, double **host_d, + double **host_born1, double **host_born2, + double **host_born3, double **host_a, + double **host_c, double **host_d, double **sigma, double **offset, double *special_lj, const int inum, const int nall, const int max_nbors, const int maxspecial, const double cell_size, @@ -63,7 +63,7 @@ int borncl_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv, void borncl_gpu_clear(); int** borncl_gpu_compute_n(const int ago, const int inum_full, const int nall, double **host_x, int *host_type, double *sublo, - double *subhi, tagint *tag, int **nspecial, + double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, @@ -79,13 +79,13 @@ double borncl_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairBornCoulLongGPU::PairBornCoulLongGPU(LAMMPS *lmp) : +PairBornCoulLongGPU::PairBornCoulLongGPU(LAMMPS *lmp) : PairBornCoulLong(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -103,12 +103,12 @@ void PairBornCoulLongGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; - int *ilist, *numneigh, **firstneigh; + int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { inum = atom->nlocal; firstneigh = borncl_gpu_compute_n(neighbor->ago, inum, nall, atom->x, @@ -147,7 +147,7 @@ void PairBornCoulLongGPU::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style born/coul/long/gpu requires atom attribute q"); - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR, "Cannot use newton pair with born/coul/long/gpu pair style"); @@ -179,12 +179,12 @@ void PairBornCoulLongGPU::init_style() int maxspecial=0; if (atom->molecular) maxspecial=atom->maxspecial; - int success = borncl_gpu_init(atom->ntypes+1, cutsq, rhoinv, + int success = borncl_gpu_init(atom->ntypes+1, cutsq, rhoinv, born1, born2, born3, a, c, d, sigma, offset, force->special_lj, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, cell_size, gpu_mode, screen, cut_ljsq, - cut_coulsq, force->special_coul, + cut_coulsq, force->special_coul, force->qqrd2e, g_ewald); GPU_EXTRA::check_flag(success,error,world); @@ -284,7 +284,7 @@ void PairBornCoulLongGPU::cpu_compute(int start, int inum, int eflag, if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; } else ecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv + evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv + d[itype][jtype]*r6inv*r2inv - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; diff --git a/src/GPU/pair_born_coul_long_gpu.h b/src/GPU/pair_born_coul_long_gpu.h index f188f93d1fce9fe137dc6accf8ac0353ebb126ac..e929826a248c17476b1063a75282cb230aa5b209 100644 --- a/src/GPU/pair_born_coul_long_gpu.h +++ b/src/GPU/pair_born_coul_long_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_born_coul_wolf_gpu.cpp b/src/GPU/pair_born_coul_wolf_gpu.cpp index 5d09b0325f6d5007a574f6ce0158908000703cea..4a7e0f223ceba2ed24320360dae3d5ffb100467a 100644 --- a/src/GPU/pair_born_coul_wolf_gpu.cpp +++ b/src/GPU/pair_born_coul_wolf_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing authors: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_born_coul_wolf_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -33,7 +33,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -42,9 +42,9 @@ using namespace MathConst; // External functions from cuda library for atom decomposition int borncw_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv, - double **host_born1, double **host_born2, - double **host_born3, double **host_a, double **host_c, - double **host_d, double **sigma, double **offset, + double **host_born1, double **host_born2, + double **host_born3, double **host_a, double **host_c, + double **host_d, double **sigma, double **offset, double *special_lj, const int inum, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, @@ -54,7 +54,7 @@ int borncw_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv, void borncw_gpu_clear(); int ** borncw_gpu_compute_n(const int ago, const int inum_full, const int nall, double **host_x, int *host_type, double *sublo, - double *subhi, tagint *tag, int **nspecial, + double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, @@ -70,13 +70,13 @@ double borncw_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairBornCoulWolfGPU::PairBornCoulWolfGPU(LAMMPS *lmp) : PairBornCoulWolf(lmp), +PairBornCoulWolfGPU::PairBornCoulWolfGPU(LAMMPS *lmp) : PairBornCoulWolf(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -94,10 +94,10 @@ void PairBornCoulWolfGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -106,8 +106,8 @@ void PairBornCoulWolfGPU::compute(int eflag, int vflag) atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, - vflag_atom, host_start, - &ilist, &numneigh, cpu_time, success, + vflag_atom, host_start, + &ilist, &numneigh, cpu_time, success, atom->q, domain->boxlo, domain->prd); } else { inum = list->inum; @@ -135,7 +135,7 @@ void PairBornCoulWolfGPU::compute(int eflag, int vflag) void PairBornCoulWolfGPU::init_style() { - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR, "Cannot use newton pair with born/coul/wolf/gpu pair style"); @@ -159,18 +159,18 @@ void PairBornCoulWolfGPU::init_style() cut_coulsq = cut_coul * cut_coul; double e_shift = erfc(alf*cut_coul)/cut_coul; - double f_shift = -(e_shift+ 2.0*alf/MY_PIS * exp(-alf*alf*cut_coul*cut_coul)) / - cut_coul; + double f_shift = -(e_shift+ 2.0*alf/MY_PIS * exp(-alf*alf*cut_coul*cut_coul)) / + cut_coul; int maxspecial=0; if (atom->molecular) maxspecial=atom->maxspecial; - int success = borncw_gpu_init(atom->ntypes+1, cutsq, rhoinv, - born1, born2, born3, a, c, d, sigma, offset, + int success = borncw_gpu_init(atom->ntypes+1, cutsq, rhoinv, + born1, born2, born3, a, c, d, sigma, offset, force->special_lj, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, cell_size, gpu_mode, screen, cut_ljsq, - cut_coulsq, force->special_coul, force->qqrd2e, + cut_coulsq, force->special_coul, force->qqrd2e, alf, e_shift, f_shift); GPU_EXTRA::check_flag(success,error,world); @@ -178,7 +178,7 @@ void PairBornCoulWolfGPU::init_style() int irequest = neighbor->request(this,instance_me); neighbor->requests[irequest]->half = 0; neighbor->requests[irequest]->full = 1; - } + } } /* ---------------------------------------------------------------------- */ @@ -203,7 +203,7 @@ void PairBornCoulWolfGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *jlist; evdwl = ecoul = 0.0; - + double **x = atom->x; double **f = atom->f; double *q = atom->q; @@ -212,10 +212,10 @@ void PairBornCoulWolfGPU::cpu_compute(int start, int inum, int eflag, int vflag, double *special_coul = force->special_coul; double *special_lj = force->special_lj; double qqrd2e = force->qqrd2e; - + double e_shift = erfc(alf*cut_coul)/cut_coul; - double f_shift = -(e_shift+ 2.0*alf/MY_PIS * exp(-alf*alf*cut_coul*cut_coul)) / - cut_coul; + double f_shift = -(e_shift+ 2.0*alf/MY_PIS * exp(-alf*alf*cut_coul*cut_coul)) / + cut_coul; // loop over neighbors of my atoms @@ -247,13 +247,13 @@ void PairBornCoulWolfGPU::cpu_compute(int start, int inum, int eflag, int vflag, if (rsq < cutsq[itype][jtype]) { r2inv = 1.0/rsq; - + if (rsq < cut_coulsq) { r = sqrt(rsq); prefactor = qqrd2e*qtmp*q[j]/r; - erfcc = erfc(alf*r); + erfcc = erfc(alf*r); erfcd = exp(-alf*alf*r*r); - v_sh = (erfcc - e_shift*r) * prefactor; + v_sh = (erfcc - e_shift*r) * prefactor; dvdrr = (erfcc/rsq + 2.0*alf/MY_PIS * erfcd/r) + f_shift; forcecoul = dvdrr*rsq*prefactor; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; @@ -263,12 +263,12 @@ void PairBornCoulWolfGPU::cpu_compute(int start, int inum, int eflag, int vflag, r6inv = r2inv*r2inv*r2inv; r = sqrt(rsq); rexp = exp((sigma[itype][jtype]-r)*rhoinv[itype][jtype]); - forceborn = born1[itype][jtype]*r*rexp - born2[itype][jtype]*r6inv + + forceborn = born1[itype][jtype]*r*rexp - born2[itype][jtype]*r6inv + born3[itype][jtype]*r2inv*r6inv; } else forceborn = 0.0; - + fpair = (factor_coul*forcecoul + factor_lj*forceborn) * r2inv; - + f[i][0] += delx*fpair; f[i][1] += dely*fpair; f[i][2] += delz*fpair; diff --git a/src/GPU/pair_born_coul_wolf_gpu.h b/src/GPU/pair_born_coul_wolf_gpu.h index 0aec3a4b35374b62c29ddcc605b19347ad2a955b..6eb03f3e1a62c0f654f96f44707422d60ce22f54 100644 --- a/src/GPU/pair_born_coul_wolf_gpu.h +++ b/src/GPU/pair_born_coul_wolf_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_born_gpu.cpp b/src/GPU/pair_born_gpu.cpp index 4df91fde153ffd94f12ba2ce73c24d52547b7af8..e80a6509ad5a5806a9986e08c9d4b37c5f0bcfa6 100644 --- a/src/GPU/pair_born_gpu.cpp +++ b/src/GPU/pair_born_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_born_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -40,19 +40,19 @@ using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition int born_gpu_init(const int ntypes, double **cutsq, double **host_rhoinv, - double **host_born1, double **host_born2, double **host_born3, - double **host_a, double **host_c, double **host_d, - double **host_sigma, double **offset, double *special_lj, + double **host_born1, double **host_born2, double **host_born3, + double **host_a, double **host_c, double **host_d, + double **host_sigma, double **offset, double *special_lj, const int inum, const int nall, const int max_nbors, - const int maxspecial, const double cell_size, + const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); void born_gpu_reinit(const int ntypes, double **host_rhoinv, double **host_born1, double **host_born2, double **host_born3, double **host_a, double **host_c, double **host_d, double **offset); void born_gpu_clear(); -int ** born_gpu_compute_n(const int ago, const int inum_full, - const int nall, double **host_x, int *host_type, +int ** born_gpu_compute_n(const int ago, const int inum_full, + const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, @@ -71,7 +71,7 @@ PairBornGPU::PairBornGPU(LAMMPS *lmp) : PairBorn(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -89,10 +89,10 @@ void PairBornGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -101,7 +101,7 @@ void PairBornGPU::compute(int eflag, int vflag) atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, - vflag_atom, host_start, + vflag_atom, host_start, &ilist, &numneigh, cpu_time, success); } else { inum = list->inum; @@ -128,7 +128,7 @@ void PairBornGPU::compute(int eflag, int vflag) void PairBornGPU::init_style() { - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with born/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -151,7 +151,7 @@ void PairBornGPU::init_style() int maxspecial=0; if (atom->molecular) maxspecial=atom->maxspecial; - int success = born_gpu_init(atom->ntypes+1, cutsq, rhoinv, + int success = born_gpu_init(atom->ntypes+1, cutsq, rhoinv, born1, born2, born3, a, c, d, sigma, offset, force->special_lj, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, @@ -170,7 +170,7 @@ void PairBornGPU::init_style() void PairBornGPU::reinit() { Pair::reinit(); - + born_gpu_reinit(atom->ntypes+1, rhoinv, born1, born2, born3, a, c, d, offset); } @@ -185,7 +185,7 @@ double PairBornGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairBornGPU::cpu_compute(int start, int inum, int eflag, int vflag, +void PairBornGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; @@ -225,7 +225,7 @@ void PairBornGPU::cpu_compute(int start, int inum, int eflag, int vflag, r6inv = r2inv*r2inv*r2inv; r = sqrt(rsq); rexp = exp((sigma[itype][jtype]-r)*rhoinv[itype][jtype]); - forceborn = born1[itype][jtype]*r*rexp - born2[itype][jtype]*r6inv + + forceborn = born1[itype][jtype]*r*rexp - born2[itype][jtype]*r6inv + born3[itype][jtype]*r2inv*r6inv; fpair = factor_lj*forceborn*r2inv; @@ -234,7 +234,7 @@ void PairBornGPU::cpu_compute(int start, int inum, int eflag, int vflag, f[i][2] += delz*fpair; if (eflag) { - evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv + + evdwl = a[itype][jtype]*rexp - c[itype][jtype]*r6inv + d[itype][jtype]*r6inv*r2inv - offset[itype][jtype]; evdwl *= factor_lj; } diff --git a/src/GPU/pair_born_gpu.h b/src/GPU/pair_born_gpu.h index e5961de99808fe60742b3add8e9ece392b932eb4..49c76fadf62676e0ef844a43637def04d6e6054a 100644 --- a/src/GPU/pair_born_gpu.h +++ b/src/GPU/pair_born_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_buck_coul_cut_gpu.cpp b/src/GPU/pair_buck_coul_cut_gpu.cpp index e00fb88c02e25463a54f250c54ebcc620eb0601a..e74020dd3a61f653cdaf008987480f1033cf2da7 100644 --- a/src/GPU/pair_buck_coul_cut_gpu.cpp +++ b/src/GPU/pair_buck_coul_cut_gpu.cpp @@ -15,9 +15,9 @@ Contributing authors: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_buck_coul_cut_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_buck_coul_long_gpu.cpp b/src/GPU/pair_buck_coul_long_gpu.cpp index bb93b1d08cf3110ad5feac983030dd31004c02c3..c2a37fc3dc5fef8859aab5f8f2e84db58afdde23 100644 --- a/src/GPU/pair_buck_coul_long_gpu.cpp +++ b/src/GPU/pair_buck_coul_long_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_buck_coul_long_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "kspace.h" #include "gpu_extra.h" diff --git a/src/GPU/pair_buck_gpu.cpp b/src/GPU/pair_buck_gpu.cpp index de64bfd90c55bcd4c8487e1f1c9a8162036450f0..1e9b838ec805301151c0f7fa892fa6f0bf4aded4 100644 --- a/src/GPU/pair_buck_gpu.cpp +++ b/src/GPU/pair_buck_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_buck_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -167,7 +167,7 @@ void PairBuckGPU::init_style() void PairBuckGPU::reinit() { Pair::reinit(); - + buck_gpu_reinit(atom->ntypes+1, cutsq, rhoinv, buck1, buck2, a, c, offset); } diff --git a/src/GPU/pair_colloid_gpu.cpp b/src/GPU/pair_colloid_gpu.cpp index 1b164df8f6090ae8542f6ec3ae8e7db2aa912efc..d4e8224238375a1fd0b432a522c57c9370d48b9e 100644 --- a/src/GPU/pair_colloid_gpu.cpp +++ b/src/GPU/pair_colloid_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_colloid_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -40,22 +40,22 @@ using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition int colloid_gpu_init(const int ntypes, double **cutsq, double **host_lj1, - double **host_lj2, double **host_lj3, double **host_lj4, - double **offset, double *special_lj, double **host_a12, - double **host_a1, double **host_a2, double **host_d1, - double **host_d2, double **host_sigma3, double **host_sigma6, - int **host_form, const int nlocal, + double **host_lj2, double **host_lj3, double **host_lj4, + double **offset, double *special_lj, double **host_a12, + double **host_a1, double **host_a2, double **host_d1, + double **host_d2, double **host_sigma3, double **host_sigma6, + int **host_form, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); void colloid_gpu_clear(); int ** colloid_gpu_compute_n(const int ago, const int inum, - const int nall, double **host_x, int *host_type, + const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success); -void colloid_gpu_compute(const int ago, const int inum, const int nall, +void colloid_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, @@ -69,7 +69,7 @@ PairColloidGPU::PairColloidGPU(LAMMPS *lmp) : PairColloid(lmp), gpu_mode(GPU_FOR respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -87,10 +87,10 @@ void PairColloidGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -99,7 +99,7 @@ void PairColloidGPU::compute(int eflag, int vflag) atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, - vflag_atom, host_start, + vflag_atom, host_start, &ilist, &numneigh, cpu_time, success); } else { inum = list->inum; @@ -126,7 +126,7 @@ void PairColloidGPU::compute(int eflag, int vflag) void PairColloidGPU::init_style() { - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with colloid/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -160,7 +160,7 @@ void PairColloidGPU::init_style() if (atom->molecular) maxspecial=atom->maxspecial; int success = colloid_gpu_init(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4, - offset, force->special_lj, a12, a1, a2, + offset, force->special_lj, a12, a1, a2, d1, d2, sigma3, sigma6, _form, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, cell_size, gpu_mode, screen); @@ -184,8 +184,8 @@ double PairColloidGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairColloidGPU::cpu_compute(int start, int inum, int eflag, int vflag, - int *ilist, int *numneigh, int **firstneigh) +void PairColloidGPU::cpu_compute(int start, int inum, int eflag, int vflag, + int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; @@ -224,16 +224,16 @@ void PairColloidGPU::cpu_compute(int start, int inum, int eflag, int vflag, if (rsq >= cutsq[itype][jtype]) continue; switch (form[itype][jtype]) { - case SMALL_SMALL: + case SMALL_SMALL: r2inv = 1.0/rsq; r6inv = r2inv*r2inv*r2inv; forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]); fpair = factor_lj*forcelj*r2inv; - if (eflag) + if (eflag) evdwl = r6inv*(r6inv*lj3[itype][jtype]-lj4[itype][jtype]) - offset[itype][jtype]; break; - + case SMALL_LARGE: c2 = a2[itype][jtype]; K[1] = c2*c2; @@ -244,14 +244,14 @@ void PairColloidGPU::cpu_compute(int start, int inum, int eflag, int vflag, K[3] *= K[3]*K[3]; K[6] = K[3]*K[3]; fR = sigma3[itype][jtype]*a12[itype][jtype]*c2*K[1]/K[3]; - fpair = 4.0/15.0*fR*factor_lj * - (2.0*(K[1]+K[2]) * (K[1]*(5.0*K[1]+22.0*K[2])+5.0*K[4]) * + fpair = 4.0/15.0*fR*factor_lj * + (2.0*(K[1]+K[2]) * (K[1]*(5.0*K[1]+22.0*K[2])+5.0*K[4]) * sigma6[itype][jtype]/K[6]-5.0) / K[0]; - if (eflag) - evdwl = 2.0/9.0*fR * + if (eflag) + evdwl = 2.0/9.0*fR * (1.0-(K[1]*(K[1]*(K[1]/3.0+3.0*K[2])+4.2*K[4])+K[2]*K[4]) * sigma6[itype][jtype]/K[6]) - offset[itype][jtype]; - if (rsq <= K[1]) + if (rsq <= K[1]) error->one(FLERR,"Overlapping small/large in pair colloid"); break; @@ -284,17 +284,17 @@ void PairColloidGPU::cpu_compute(int start, int inum, int eflag, int vflag, fR = a12[itype][jtype]*sigma6[itype][jtype]/r/37800.0; evdwl = fR * (h[0]-h[1]-h[2]+h[3]); dUR = evdwl/r + 5.0*fR*(g[0]+g[1]-g[2]-g[3]); - dUA = -a12[itype][jtype]/3.0*r*((2.0*K[0]*K[7]+1.0)*K[7] + + dUA = -a12[itype][jtype]/3.0*r*((2.0*K[0]*K[7]+1.0)*K[7] + (2.0*K[0]*K[8]-1.0)*K[8]); fpair = factor_lj * (dUR+dUA)/r; if (eflag) - evdwl += a12[itype][jtype]/6.0 * + evdwl += a12[itype][jtype]/6.0 * (2.0*K[0]*(K[7]+K[8])-log(K[8]/K[7])) - offset[itype][jtype]; - if (r <= K[1]) + if (r <= K[1]) error->one(FLERR,"Overlapping large/large in pair colloid"); break; } - + if (eflag) evdwl *= factor_lj; f[i][0] += delx*fpair; diff --git a/src/GPU/pair_colloid_gpu.h b/src/GPU/pair_colloid_gpu.h index 5bb524e8905a2c5c1124f0a7d1d14690910067f1..78ecfbc59a8cc6c2c5e65a37e617633e0e7cb578 100644 --- a/src/GPU/pair_colloid_gpu.h +++ b/src/GPU/pair_colloid_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_coul_cut_gpu.cpp b/src/GPU/pair_coul_cut_gpu.cpp index 04345b920922845e221f810a4f8b19a8381fe929..c66a0a8ef4b3891f82e96ad867d0382b4684cd7e 100644 --- a/src/GPU/pair_coul_cut_gpu.cpp +++ b/src/GPU/pair_coul_cut_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_coul_cut_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -172,7 +172,7 @@ void PairCoulCutGPU::init_style() void PairCoulCutGPU::reinit() { Pair::reinit(); - + coul_gpu_reinit(atom->ntypes+1, scale); } diff --git a/src/GPU/pair_coul_debye_gpu.cpp b/src/GPU/pair_coul_debye_gpu.cpp index 19ae6b3162b6cbcda7efe4792bedc4b7833e0bd5..2b5d608fc7f142d84270deae65e7cefc54e11f76 100644 --- a/src/GPU/pair_coul_debye_gpu.cpp +++ b/src/GPU/pair_coul_debye_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ndtrung@umich.edu) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_coul_debye_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -46,15 +46,15 @@ int cdebye_gpu_init(const int ntypes, double **host_scale, double **cutsq, const double qqrd2e, const double kappa); void cdebye_gpu_reinit(const int ntypes, double **host_scale); void cdebye_gpu_clear(); -int ** cdebye_gpu_compute_n(const int ago, const int inum, const int nall, - double **host_x, int *host_type, +int ** cdebye_gpu_compute_n(const int ago, const int inum, const int nall, + double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success, double *host_q, double *boxlo, double *prd); -void cdebye_gpu_compute(const int ago, const int inum, const int nall, +void cdebye_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, @@ -65,12 +65,12 @@ double cdebye_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairCoulDebyeGPU::PairCoulDebyeGPU(LAMMPS *lmp) : +PairCoulDebyeGPU::PairCoulDebyeGPU(LAMMPS *lmp) : PairCoulDebye(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -88,12 +88,12 @@ void PairCoulDebyeGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; - int *ilist, *numneigh, **firstneigh; + int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { inum = atom->nlocal; firstneigh = cdebye_gpu_compute_n(neighbor->ago, inum, nall, atom->x, @@ -101,7 +101,7 @@ void PairCoulDebyeGPU::compute(int eflag, int vflag) atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time, - success, atom->q, domain->boxlo, + success, atom->q, domain->boxlo, domain->prd); } else { inum = list->inum; @@ -132,7 +132,7 @@ void PairCoulDebyeGPU::init_style() if (!atom->q_flag) error->all(FLERR,"Pair style coul/debye/gpu requires atom attribute q"); - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with coul/debye/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -174,7 +174,7 @@ void PairCoulDebyeGPU::init_style() void PairCoulDebyeGPU::reinit() { Pair::reinit(); - + cdebye_gpu_reinit(atom->ntypes+1, scale); } @@ -188,7 +188,7 @@ double PairCoulDebyeGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairCoulDebyeGPU::cpu_compute(int start, int inum, int eflag, +void PairCoulDebyeGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { diff --git a/src/GPU/pair_coul_debye_gpu.h b/src/GPU/pair_coul_debye_gpu.h index eebb44c357dc4c5d0ddea3d0fa17037635798082..9cc379d1ed8d9af165d75ec3489f465a8de68bda 100644 --- a/src/GPU/pair_coul_debye_gpu.h +++ b/src/GPU/pair_coul_debye_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_coul_dsf_gpu.cpp b/src/GPU/pair_coul_dsf_gpu.cpp index 55e398738b2ecc1589b62db34d525dc66775254a..d2d060281c23eeaf36f5fecae7ae5baecc7db906 100644 --- a/src/GPU/pair_coul_dsf_gpu.cpp +++ b/src/GPU/pair_coul_dsf_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_coul_dsf_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" #define MY_PIS 1.77245385090551602729 @@ -52,8 +52,8 @@ int cdsf_gpu_init(const int ntypes, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, const double host_cut_coulsq, - double *host_special_coul, const double qqrd2e, - const double e_shift, const double f_shift, + double *host_special_coul, const double qqrd2e, + const double e_shift, const double f_shift, const double alpha); void cdsf_gpu_clear(); int ** cdsf_gpu_compute_n(const int ago, const int inum, @@ -75,7 +75,7 @@ double cdsf_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairCoulDSFGPU::PairCoulDSFGPU(LAMMPS *lmp) : PairCoulDSF(lmp), +PairCoulDSFGPU::PairCoulDSFGPU(LAMMPS *lmp) : PairCoulDSF(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; @@ -164,10 +164,10 @@ void PairCoulDSFGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; cut_coulsq = cut_coul * cut_coul; - double erfcc = erfc(alpha*cut_coul); + double erfcc = erfc(alpha*cut_coul); double erfcd = exp(-alpha*alpha*cut_coul*cut_coul); - f_shift = -(erfcc/cut_coulsq + 2.0/MY_PIS*alpha*erfcd/cut_coul); - e_shift = erfcc/cut_coul - f_shift*cut_coul; + f_shift = -(erfcc/cut_coulsq + 2.0/MY_PIS*alpha*erfcd/cut_coul); + e_shift = erfcc/cut_coul - f_shift*cut_coul; int maxspecial=0; if (atom->molecular) @@ -248,10 +248,10 @@ void PairCoulDSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, erfcd = exp(-alpha*alpha*r*r); t = 1.0 / (1.0 + EWALD_P*alpha*r); erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; - + fpair = forcecoul * r2inv; f[i][0] += delx*fpair; f[i][1] += dely*fpair; diff --git a/src/GPU/pair_coul_long_gpu.cpp b/src/GPU/pair_coul_long_gpu.cpp index 68742efbcd082445cc1e3b5b336d7ef9ece3753a..a1864a40028e333a6367c8ff1d6c69ef5874689e 100644 --- a/src/GPU/pair_coul_long_gpu.cpp +++ b/src/GPU/pair_coul_long_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Axel Kohlmeyer (Temple) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_coul_long_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "kspace.h" #include "gpu_extra.h" @@ -181,7 +181,7 @@ void PairCoulLongGPU::init_style() void PairCoulLongGPU::reinit() { Pair::reinit(); - + cl_gpu_reinit(atom->ntypes+1, scale); } diff --git a/src/GPU/pair_dpd_gpu.cpp b/src/GPU/pair_dpd_gpu.cpp index dacdaa5e5618ed46a9adc1ba737667a178562a66..c82ed97485851fada7d1f71ab12c21c880d44664 100644 --- a/src/GPU/pair_dpd_gpu.cpp +++ b/src/GPU/pair_dpd_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_dpd_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -33,7 +33,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -49,10 +49,10 @@ void dpd_gpu_clear(); int ** dpd_gpu_compute_n(const int ago, const int inum_full, const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, - tagint **special, const bool eflag, const bool vflag, - const bool eatom, const bool vatom, int &host_start, + tagint **special, const bool eflag, const bool vflag, + const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success, - double **host_v, const double dtinvsqrt, + double **host_v, const double dtinvsqrt, const int seed, const int timestep, double *boxlo, double *prd); void dpd_gpu_compute(const int ago, const int inum_full, const int nall, @@ -60,7 +60,7 @@ void dpd_gpu_compute(const int ago, const int inum_full, const int nall, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, const double cpu_time, bool &success, tagint *tag, - double **host_v, const double dtinvsqrt, + double **host_v, const double dtinvsqrt, const int seed, const int timestep, const int nlocal, double *boxlo, double *prd); double dpd_gpu_bytes(); @@ -75,7 +75,7 @@ double dpd_gpu_bytes(); #define _USE_UNIFORM_SARU_LCG #endif -// References: +// References: // 1. Y. Afshar, F. Schmid, A. Pishevar, S. Worley, Comput. Phys. Comm. 184 (2013), 1119–1128. // 2. C. L. Phillips, J. A. Anderson, S. C. Glotzer, Comput. Phys. Comm. 230 (2011), 7191-7201. // PRNG period = 3666320093*2^32 ~ 2^64 ~ 10^19 @@ -87,9 +87,9 @@ double dpd_gpu_bytes(); #define TWO_N32 0.232830643653869628906250e-9f /* 2^-32 */ // specifically implemented for steps = 1; high = 1.0; low = -1.0 -// returns uniformly distributed random numbers u in [-1.0;1.0] -// using the inherent LCG, then multiply u with sqrt(3) to "match" -// with a normal random distribution. +// returns uniformly distributed random numbers u in [-1.0;1.0] +// using the inherent LCG, then multiply u with sqrt(3) to "match" +// with a normal random distribution. // Afshar et al. mutlplies u in [-0.5;0.5] with sqrt(12) // Curly brackets to make variables local to the scope. #ifdef _USE_UNIFORM_SARU_LCG @@ -119,8 +119,8 @@ double dpd_gpu_bytes(); #endif // specifically implemented for steps = 1; high = 1.0; low = -1.0 -// returns uniformly distributed random numbers u in [-1.0;1.0] using TEA8 -// then multiply u with sqrt(3) to "match" with a normal random distribution +// returns uniformly distributed random numbers u in [-1.0;1.0] using TEA8 +// then multiply u with sqrt(3) to "match" with a normal random distribution // Afshar et al. mutlplies u in [-0.5;0.5] with sqrt(12) #ifdef _USE_UNIFORM_SARU_TEA8 #define numtyp double @@ -159,7 +159,7 @@ double dpd_gpu_bytes(); #endif // specifically implemented for steps = 1; high = 1.0; low = -1.0 -// returns two uniformly distributed random numbers r1 and r2 in [-1.0;1.0], +// returns two uniformly distributed random numbers r1 and r2 in [-1.0;1.0], // and uses the polar method (Marsaglia's) to transform to a normal random value // This is used to compared with CPU DPD using RandMars::gaussian() #ifdef _USE_GAUSSIAN_SARU_LCG @@ -232,7 +232,7 @@ void PairDPDGPU::compute(int eflag, int vflag) int inum, host_start; double dtinvsqrt = 1.0/sqrt(update->dt); - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -242,7 +242,7 @@ void PairDPDGPU::compute(int eflag, int vflag) atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time, - success, atom->v, dtinvsqrt, seed, + success, atom->v, dtinvsqrt, seed, update->ntimestep, domain->boxlo, domain->prd); } else { @@ -252,8 +252,8 @@ void PairDPDGPU::compute(int eflag, int vflag) firstneigh = list->firstneigh; dpd_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, ilist, numneigh, firstneigh, eflag, vflag, eflag_atom, - vflag_atom, host_start, cpu_time, success, - atom->tag, atom->v, dtinvsqrt, seed, + vflag_atom, host_start, cpu_time, success, + atom->tag, atom->v, dtinvsqrt, seed, update->ntimestep, atom->nlocal, domain->boxlo, domain->prd); } @@ -296,7 +296,7 @@ void PairDPDGPU::init_style() int maxspecial=0; if (atom->molecular) maxspecial=atom->maxspecial; - int success = dpd_gpu_init(atom->ntypes+1, cutsq, a0, gamma, sigma, + int success = dpd_gpu_init(atom->ntypes+1, cutsq, a0, gamma, sigma, cut, force->special_lj, false, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, cell_size, gpu_mode, screen); diff --git a/src/GPU/pair_dpd_tstat_gpu.cpp b/src/GPU/pair_dpd_tstat_gpu.cpp index b5233027f93334f1a727abfd661a1375949e0169..e051a13a0b2f947570d803a25bb584d69a5bb3f0 100644 --- a/src/GPU/pair_dpd_tstat_gpu.cpp +++ b/src/GPU/pair_dpd_tstat_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_dpd_tstat_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -33,7 +33,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -49,8 +49,8 @@ void dpd_gpu_clear(); int ** dpd_gpu_compute_n(const int ago, const int inum_full, const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, - tagint **special, const bool eflag, const bool vflag, - const bool eatom, const bool vatom, int &host_start, + tagint **special, const bool eflag, const bool vflag, + const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success, double **host_v, const double dtinvsqrt, const int seed, const int timestep, @@ -60,7 +60,7 @@ void dpd_gpu_compute(const int ago, const int inum_full, const int nall, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, const double cpu_time, bool &success, tagint *tag, - double **host_v, const double dtinvsqrt, + double **host_v, const double dtinvsqrt, const int seed, const int timestep, const int nlocal, double *boxlo, double *prd); void dpd_gpu_update_coeff(int ntypes, double **host_a0, double **host_gamma, @@ -77,7 +77,7 @@ double dpd_gpu_bytes(); #define _USE_UNIFORM_SARU_LCG #endif -// References: +// References: // 1. Y. Afshar, F. Schmid, A. Pishevar, S. Worley, Comput. Phys. Comm. 184 (2013), 1119–1128. // 2. C. L. Phillips, J. A. Anderson, S. C. Glotzer, Comput. Phys. Comm. 230 (2011), 7191-7201. // PRNG period = 3666320093*2^32 ~ 2^64 ~ 10^19 @@ -89,9 +89,9 @@ double dpd_gpu_bytes(); #define TWO_N32 0.232830643653869628906250e-9f /* 2^-32 */ // specifically implemented for steps = 1; high = 1.0; low = -1.0 -// returns uniformly distributed random numbers u in [-1.0;1.0] -// using the inherent LCG, then multiply u with sqrt(3) to "match" -// with a normal random distribution. +// returns uniformly distributed random numbers u in [-1.0;1.0] +// using the inherent LCG, then multiply u with sqrt(3) to "match" +// with a normal random distribution. // Afshar et al. mutlplies u in [-0.5;0.5] with sqrt(12) // Curly brackets to make variables local to the scope. #ifdef _USE_UNIFORM_SARU_LCG @@ -121,8 +121,8 @@ double dpd_gpu_bytes(); #endif // specifically implemented for steps = 1; high = 1.0; low = -1.0 -// returns uniformly distributed random numbers u in [-1.0;1.0] using TEA8 -// then multiply u with sqrt(3) to "match" with a normal random distribution +// returns uniformly distributed random numbers u in [-1.0;1.0] using TEA8 +// then multiply u with sqrt(3) to "match" with a normal random distribution // Afshar et al. mutlplies u in [-0.5;0.5] with sqrt(12) #ifdef _USE_UNIFORM_SARU_TEA8 #define numtyp double @@ -161,7 +161,7 @@ double dpd_gpu_bytes(); #endif // specifically implemented for steps = 1; high = 1.0; low = -1.0 -// returns two uniformly distributed random numbers r1 and r2 in [-1.0;1.0], +// returns two uniformly distributed random numbers r1 and r2 in [-1.0;1.0], // and uses the polar method (Marsaglia's) to transform to a normal random value // This is used to compared with CPU DPD using RandMars::gaussian() #ifdef _USE_GAUSSIAN_SARU_LCG @@ -241,7 +241,7 @@ void PairDPDTstatGPU::compute(int eflag, int vflag) for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) sigma[i][j] = sigma[j][i] = sqrt(2.0*boltz*temperature*gamma[i][j]); - + dpd_gpu_update_coeff(atom->ntypes+1, a0, gamma, sigma, cut); } @@ -249,7 +249,7 @@ void PairDPDTstatGPU::compute(int eflag, int vflag) int inum, host_start; double dtinvsqrt = 1.0/sqrt(update->dt); - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -259,7 +259,7 @@ void PairDPDTstatGPU::compute(int eflag, int vflag) atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time, - success, atom->v, dtinvsqrt, seed, + success, atom->v, dtinvsqrt, seed, update->ntimestep, domain->boxlo, domain->prd); } else { @@ -269,8 +269,8 @@ void PairDPDTstatGPU::compute(int eflag, int vflag) firstneigh = list->firstneigh; dpd_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, ilist, numneigh, firstneigh, eflag, vflag, eflag_atom, - vflag_atom, host_start, cpu_time, success, - atom->tag, atom->v, dtinvsqrt, seed, + vflag_atom, host_start, cpu_time, success, + atom->tag, atom->v, dtinvsqrt, seed, update->ntimestep, atom->nlocal, domain->boxlo, domain->prd); } @@ -313,7 +313,7 @@ void PairDPDTstatGPU::init_style() int maxspecial=0; if (atom->molecular) maxspecial=atom->maxspecial; - int success = dpd_gpu_init(atom->ntypes+1, cutsq, a0, gamma, sigma, + int success = dpd_gpu_init(atom->ntypes+1, cutsq, a0, gamma, sigma, cut, force->special_lj, true, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, cell_size, gpu_mode, screen); @@ -410,7 +410,7 @@ void PairDPDTstatGPU::cpu_compute(int start, int inum, int eflag, int vflag, f[i][0] += delx*fpair; f[i][1] += dely*fpair; f[i][2] += delz*fpair; - + if (evflag) ev_tally_full(i,0.0,0.0,fpair,delx,dely,delz); } } diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index 9fb914cb0bc0f4cc69012fbb7887ca7f6c5af5dd..4ba784da28da24efaed3dcc1cef4a4fc41167130 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -15,9 +15,9 @@ Contributing authors: Trung Dac Nguyen (ORNL), W. Michael Brown (ORNL) ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eam_alloy_gpu.h" #include "atom.h" #include "force.h" @@ -39,10 +39,10 @@ int eam_alloy_gpu_init(const int ntypes, double host_cutforcesq, int **host_type2rhor, int **host_type2z2r, int *host_type2frho, double ***host_rhor_spline, double ***host_z2r_spline, double ***host_frho_spline, - double rdr, double rdrho, double rhomax, - int nrhor, int nrho, int nz2r, int nfrho, int nr, - const int nlocal, const int nall, const int max_nbors, - const int maxspecial, const double cell_size, int &gpu_mode, + double rdr, double rdrho, double rhomax, + int nrhor, int nrho, int nz2r, int nfrho, int nr, + const int nlocal, const int nall, const int max_nbors, + const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, int &fp_size); void eam_alloy_gpu_clear(); int** eam_alloy_gpu_compute_n(const int ago, const int inum_full, const int nall, @@ -233,7 +233,7 @@ double PairEAMAlloyGPU::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -int PairEAMAlloyGPU::pack_forward_comm(int n, int *list, double *buf, +int PairEAMAlloyGPU::pack_forward_comm(int n, int *list, double *buf, int pbc_flag,int *pbc) { int i,j,m; diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index 3c5c486a69553b608feb47c6aabd29e3924094e3..c64a7d7e91ee802b2c7cca4a483d8fff3b7c28b5 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -15,9 +15,9 @@ Contributing authors: Trung Dac Nguyen (ORNL), W. Michael Brown (ORNL) ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eam_fs_gpu.h" #include "atom.h" #include "force.h" @@ -39,10 +39,10 @@ int eam_fs_gpu_init(const int ntypes, double host_cutforcesq, int **host_type2rhor, int **host_type2z2r, int *host_type2frho, double ***host_rhor_spline, double ***host_z2r_spline, double ***host_frho_spline, - double rdr, double rdrho, double rhomax, - int nrhor, int nrho, int nz2r, int nfrho, int nr, - const int nlocal, const int nall, const int max_nbors, - const int maxspecial, const double cell_size, int &gpu_mode, + double rdr, double rdrho, double rhomax, + int nrhor, int nrho, int nz2r, int nfrho, int nr, + const int nlocal, const int nall, const int max_nbors, + const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, int &fp_size); void eam_fs_gpu_clear(); int** eam_fs_gpu_compute_n(const int ago, const int inum_full, const int nall, @@ -233,7 +233,7 @@ double PairEAMFSGPU::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -int PairEAMFSGPU::pack_forward_comm(int n, int *list, double *buf, +int PairEAMFSGPU::pack_forward_comm(int n, int *list, double *buf, int pbc_flag,int *pbc) { int i,j,m; diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index c9aba74c250588646efe9d76792f815ec621c790..ea75ff8ca843637285083729e015f637063a3784 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -15,10 +15,10 @@ Contributing authors: Trung Dac Nguyen (ORNL), W. Michael Brown (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eam_gpu.h" #include "atom.h" #include "force.h" @@ -41,10 +41,10 @@ int eam_gpu_init(const int ntypes, double host_cutforcesq, int **host_type2rhor, int **host_type2z2r, int *host_type2frho, double ***host_rhor_spline, double ***host_z2r_spline, double ***host_frho_spline, - double rdr, double rdrho, double rhomax, - int nrhor, int nrho, int nz2r, int nfrho, int nr, - const int nlocal, const int nall, const int max_nbors, - const int maxspecial, const double cell_size, int &gpu_mode, + double rdr, double rdrho, double rhomax, + int nrhor, int nrho, int nz2r, int nfrho, int nr, + const int nlocal, const int nall, const int max_nbors, + const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, int &fp_size); void eam_gpu_clear(); int** eam_gpu_compute_n(const int ago, const int inum_full, const int nall, @@ -237,7 +237,7 @@ double PairEAMGPU::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -int PairEAMGPU::pack_forward_comm(int n, int *list, double *buf, +int PairEAMGPU::pack_forward_comm(int n, int *list, double *buf, int pbc_flag,int *pbc) { int i,j,m; diff --git a/src/GPU/pair_eam_gpu.h b/src/GPU/pair_eam_gpu.h index ffdb790382e82e58ee0a72f625ebe9289e0f9c4b..ccc6b6f8c640d0330b2f429a899318715fb28e84 100644 --- a/src/GPU/pair_eam_gpu.h +++ b/src/GPU/pair_eam_gpu.h @@ -20,7 +20,7 @@ PairStyle(eam/gpu,PairEAMGPU) #ifndef LMP_PAIR_EAM_GPU_H #define LMP_PAIR_EAM_GPU_H -#include "stdio.h" +#include <stdio.h> #include "pair_eam.h" namespace LAMMPS_NS { diff --git a/src/GPU/pair_gauss_gpu.cpp b/src/GPU/pair_gauss_gpu.cpp index c7b47131a648d28f4fa614bcc200730d60c5c773..a8cb695b3aba077587028729e73a38b5731b7bba 100644 --- a/src/GPU/pair_gauss_gpu.cpp +++ b/src/GPU/pair_gauss_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_gauss_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -40,20 +40,20 @@ using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition int gauss_gpu_init(const int ntypes, double **cutsq, double **host_a, - double **b, double **offset, double *special_lj, const int nlocal, + double **b, double **offset, double *special_lj, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); int gauss_gpu_reinit(const int ntypes, double **cutsq, double **host_a, double **b, double **offset); void gauss_gpu_clear(); int ** gauss_gpu_compute_n(const int ago, const int inum, - const int nall, double **host_x, int *host_type, + const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success); -void gauss_gpu_compute(const int ago, const int inum, const int nall, +void gauss_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, @@ -66,7 +66,7 @@ PairGaussGPU::PairGaussGPU(LAMMPS *lmp) : PairGauss(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -84,10 +84,10 @@ void PairGaussGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -96,7 +96,7 @@ void PairGaussGPU::compute(int eflag, int vflag) atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, - vflag_atom, host_start, + vflag_atom, host_start, &ilist, &numneigh, cpu_time, success); } else { inum = list->inum; @@ -123,7 +123,7 @@ void PairGaussGPU::compute(int eflag, int vflag) void PairGaussGPU::init_style() { - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with gauss/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -164,7 +164,7 @@ void PairGaussGPU::init_style() void PairGaussGPU::reinit() { Pair::reinit(); - + gauss_gpu_reinit(atom->ntypes+1, cutsq, a, b, offset); } @@ -178,7 +178,7 @@ double PairGaussGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairGaussGPU::cpu_compute(int start, int inum, int eflag, int vflag, +void PairGaussGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; @@ -214,8 +214,8 @@ void PairGaussGPU::cpu_compute(int start, int inum, int eflag, int vflag, if (rsq < cutsq[itype][jtype]) { r2inv = 1.0/rsq; - forcelj = - 2.0*a[itype][jtype]*b[itype][jtype] * rsq * - exp(-b[itype][jtype]*rsq); + forcelj = - 2.0*a[itype][jtype]*b[itype][jtype] * rsq * + exp(-b[itype][jtype]*rsq); fpair = factor_lj*forcelj*r2inv; f[i][0] += delx*fpair; diff --git a/src/GPU/pair_gauss_gpu.h b/src/GPU/pair_gauss_gpu.h index d4ffae23cb459bada83c9a42021c872e24030b4b..bda2e2644a260bf81364de1c29ffafefdcd31848 100644 --- a/src/GPU/pair_gauss_gpu.h +++ b/src/GPU/pair_gauss_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index 75191f93135d4a058b97e460e5b74f0cf5e3d1bd..aae8fb2b7118e593edcf495e52229bfbfe5e4f8b 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_gayberne_gpu.h" #include "math_extra.h" #include "atom.h" @@ -34,7 +34,7 @@ #include "universe.h" #include "domain.h" #include "update.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_lj96_cut_gpu.cpp b/src/GPU/pair_lj96_cut_gpu.cpp index 7dacbf68bc599c15ccb3924dc8b020b0e0e97613..813daa4da24f33c4cf535146cd03a3d941fa866b 100644 --- a/src/GPU/pair_lj96_cut_gpu.cpp +++ b/src/GPU/pair_lj96_cut_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj96_cut_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp index df88bd0777203b745d4756fb8418c797b37478b6..b951567f45db68eb2a1699dfc4696bfcd6463e52 100644 --- a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_charmm_coul_long_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "kspace.h" #include "gpu_extra.h" diff --git a/src/GPU/pair_lj_class2_coul_long_gpu.cpp b/src/GPU/pair_lj_class2_coul_long_gpu.cpp index b675f87d5070ddc4b08c349d5447fecfc50b9542..f7c874cb65e7ed50aa385be7da882e906acde79c 100644 --- a/src/GPU/pair_lj_class2_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_class2_coul_long_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_class2_coul_long_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "kspace.h" #include "gpu_extra.h" diff --git a/src/GPU/pair_lj_class2_gpu.cpp b/src/GPU/pair_lj_class2_gpu.cpp index b34fc607005c81a31f62a552e4b622b5ca6d4edf..cc6866db1ca7a07bb79e05e1a5396db7211c5d97 100644 --- a/src/GPU/pair_lj_class2_gpu.cpp +++ b/src/GPU/pair_lj_class2_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_class2_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_lj_cubic_gpu.cpp b/src/GPU/pair_lj_cubic_gpu.cpp index 904c7f4ca986ce59a8fb38decea375ff64ce2307..516ac7d15432abfd7f3cd5d4fcb4bd774beb5153 100644 --- a/src/GPU/pair_lj_cubic_gpu.cpp +++ b/src/GPU/pair_lj_cubic_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ndactrung@gmail.com) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_cubic_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -40,9 +40,9 @@ using namespace PairLJCubicConstants; // External functions from cuda library for atom decomposition -int ljcb_gpu_init(const int ntypes, double **cutsq, double **cut_inner_sq, - double **cut_inner, double **sigma, double **epsilon, - double **host_lj1, double **host_lj2, double **host_lj3, +int ljcb_gpu_init(const int ntypes, double **cutsq, double **cut_inner_sq, + double **cut_inner, double **sigma, double **epsilon, + double **host_lj1, double **host_lj2, double **host_lj3, double **host_lj4, double *special_lj, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); @@ -64,7 +64,7 @@ double ljcb_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairLJCubicGPU::PairLJCubicGPU(LAMMPS *lmp) : PairLJCubic(lmp), +PairLJCubicGPU::PairLJCubicGPU(LAMMPS *lmp) : PairLJCubic(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; @@ -91,7 +91,7 @@ void PairLJCubicGPU::compute(int eflag, int vflag) int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -151,7 +151,7 @@ void PairLJCubicGPU::init_style() if (atom->molecular) maxspecial=atom->maxspecial; int success = ljcb_gpu_init(atom->ntypes+1, cutsq, cut_inner_sq, - cut_inner, sigma, epsilon, lj1, lj2, + cut_inner, sigma, epsilon, lj1, lj2, lj3, lj4, force->special_lj, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, cell_size, gpu_mode, screen); diff --git a/src/GPU/pair_lj_cut_coul_cut_gpu.cpp b/src/GPU/pair_lj_cut_coul_cut_gpu.cpp index 9a964e366875e15f5b894fe3e5ae652b81e6e45b..840c07680f44a450a7beb240a1ec50223f64dfe2 100644 --- a/src/GPU/pair_lj_cut_coul_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_cut_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_cut_coul_cut_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_lj_cut_coul_debye_gpu.cpp b/src/GPU/pair_lj_cut_coul_debye_gpu.cpp index 724d0d9d03b4f821b719a118045eaae3a8f49ab2..39108d8558f1bd5dca8549e1c7de5c979fc1ebd6 100644 --- a/src/GPU/pair_lj_cut_coul_debye_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_debye_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_cut_coul_debye_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -40,23 +40,23 @@ using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition int ljcd_gpu_init(const int ntypes, double **cutsq, double **host_lj1, - double **host_lj2, double **host_lj3, double **host_lj4, - double **offset, double *special_lj, const int nlocal, + double **host_lj2, double **host_lj3, double **host_lj4, + double **offset, double *special_lj, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, double **host_cut_ljsq, double **host_cut_coulsq, double *host_special_coul, const double qqrd2e, const double kappa); void ljcd_gpu_clear(); -int ** ljcd_gpu_compute_n(const int ago, const int inum, const int nall, - double **host_x, int *host_type, +int ** ljcd_gpu_compute_n(const int ago, const int inum, const int nall, + double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success, double *host_q, double *boxlo, double *prd); -void ljcd_gpu_compute(const int ago, const int inum, const int nall, +void ljcd_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, @@ -67,13 +67,13 @@ double ljcd_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairLJCutCoulDebyeGPU::PairLJCutCoulDebyeGPU(LAMMPS *lmp) : +PairLJCutCoulDebyeGPU::PairLJCutCoulDebyeGPU(LAMMPS *lmp) : PairLJCutCoulDebye(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -91,12 +91,12 @@ void PairLJCutCoulDebyeGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; - int *ilist, *numneigh, **firstneigh; + int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { inum = atom->nlocal; firstneigh = ljcd_gpu_compute_n(neighbor->ago, inum, nall, atom->x, @@ -104,7 +104,7 @@ void PairLJCutCoulDebyeGPU::compute(int eflag, int vflag) atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time, - success, atom->q, domain->boxlo, + success, atom->q, domain->boxlo, domain->prd); } else { inum = list->inum; @@ -135,7 +135,7 @@ void PairLJCutCoulDebyeGPU::init_style() if (!atom->q_flag) error->all(FLERR,"Pair style lj/cut/coul/debye/gpu requires atom attribute q"); - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/cut/coul/debye/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -161,8 +161,8 @@ void PairLJCutCoulDebyeGPU::init_style() int success = ljcd_gpu_init(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4, offset, force->special_lj, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, - cell_size, gpu_mode, screen, cut_ljsq, - cut_coulsq, force->special_coul, + cell_size, gpu_mode, screen, cut_ljsq, + cut_coulsq, force->special_coul, force->qqrd2e, kappa); GPU_EXTRA::check_flag(success,error,world); @@ -183,7 +183,7 @@ double PairLJCutCoulDebyeGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairLJCutCoulDebyeGPU::cpu_compute(int start, int inum, int eflag, +void PairLJCutCoulDebyeGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { diff --git a/src/GPU/pair_lj_cut_coul_debye_gpu.h b/src/GPU/pair_lj_cut_coul_debye_gpu.h index 2c6f2bbbf35cb4d0428e96fd30430217822ee0f7..6b0f2ed8d796335e2884b8670ef5e7098338c769 100644 --- a/src/GPU/pair_lj_cut_coul_debye_gpu.h +++ b/src/GPU/pair_lj_cut_coul_debye_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp b/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp index b1d48bd9688a398b558da652d4797e38b957a560..efca1a2c511d0ea45f521d2975a7337e603e7ec6 100644 --- a/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_cut_coul_dsf_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" #define MY_PIS 1.77245385090551602729 @@ -54,8 +54,8 @@ int ljd_gpu_init(const int ntypes, double **cutsq, double **host_lj1, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, double **host_cut_ljsq, const double host_cut_coulsq, - double *host_special_coul, const double qqrd2e, - const double e_shift, const double f_shift, + double *host_special_coul, const double qqrd2e, + const double e_shift, const double f_shift, const double alpha); void ljd_gpu_clear(); int ** ljd_gpu_compute_n(const int ago, const int inum, @@ -165,10 +165,10 @@ void PairLJCutCoulDSFGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; cut_coulsq = cut_coul * cut_coul; - double erfcc = erfc(alpha*cut_coul); + double erfcc = erfc(alpha*cut_coul); double erfcd = exp(-alpha*alpha*cut_coul*cut_coul); - f_shift = -(erfcc/cut_coulsq + 2.0/MY_PIS*alpha*erfcd/cut_coul); - e_shift = erfcc/cut_coul - f_shift*cut_coul; + f_shift = -(erfcc/cut_coulsq + 2.0/MY_PIS*alpha*erfcd/cut_coul); + e_shift = erfcc/cut_coul - f_shift*cut_coul; int maxspecial=0; if (atom->molecular) @@ -262,7 +262,7 @@ void PairLJCutCoulDSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, erfcd = exp(-alpha*alpha*r*r); t = 1.0 / (1.0 + EWALD_P*alpha*r); erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } @@ -278,7 +278,7 @@ void PairLJCutCoulDSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; - + if (rsq < cut_coulsq) { ecoul = prefactor * (erfcc - r*e_shift - rsq*f_shift); if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.cpp b/src/GPU/pair_lj_cut_coul_long_gpu.cpp index d5025ffda90be3be202c03b3b2715ef851253c51..8ea7a7f07bbd8d660f149a9e0620b74ca75dae8c 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_long_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_cut_coul_long_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "kspace.h" #include "gpu_extra.h" @@ -200,7 +200,7 @@ void PairLJCutCoulLongGPU::init_style() void PairLJCutCoulLongGPU::reinit() { Pair::reinit(); - + ljcl_gpu_reinit(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4, offset, cut_ljsq); } diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp index 4972ce57b145c8f1f87d67a7bd467f58418c2c12..7d8be01e814398c630b4564ae44c79d0d469812a 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_cut_coul_msm_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -33,7 +33,7 @@ #include "update.h" #include "domain.h" #include "kspace.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -56,7 +56,7 @@ int ** ljcm_gpu_compute_n(const int ago, const int inum, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success, double *host_q, double *boxlo, double *prd); -void ljcm_gpu_compute(const int ago, const int inum, const int nall, +void ljcm_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, @@ -72,7 +72,7 @@ PairLJCutCoulMSMGPU::PairLJCutCoulMSMGPU(LAMMPS *lmp) : respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -90,10 +90,10 @@ void PairLJCutCoulMSMGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -132,8 +132,8 @@ void PairLJCutCoulMSMGPU::compute(int eflag, int vflag) void PairLJCutCoulMSMGPU::init_style() { cut_respa = NULL; - - if (force->newton_pair) + + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/cut/coul/msm/gpu pair style"); if (force->kspace->scalar_pressure_flag) @@ -161,7 +161,7 @@ void PairLJCutCoulMSMGPU::init_style() // setup force tables if (ncoultablebits) init_tables(cut_coul,cut_respa); - + int maxspecial=0; if (atom->molecular) maxspecial=atom->maxspecial; @@ -192,7 +192,7 @@ double PairLJCutCoulMSMGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairLJCutCoulMSMGPU::cpu_compute(int start, int inum, int eflag, int vflag, +void PairLJCutCoulMSMGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype,itable; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; @@ -209,7 +209,7 @@ void PairLJCutCoulMSMGPU::cpu_compute(int start, int inum, int eflag, int vflag, double *special_coul = force->special_coul; double *special_lj = force->special_lj; double qqrd2e = force->qqrd2e; - + // loop over neighbors of my atoms for (ii = start; ii < inum; ii++) { @@ -289,7 +289,7 @@ void PairLJCutCoulMSMGPU::cpu_compute(int start, int inum, int eflag, int vflag, evdwl *= factor_lj; } else evdwl = 0.0; } - + if (evflag) ev_tally_full(i,evdwl,ecoul,fpair,delx,dely,delz); } } diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.h b/src/GPU/pair_lj_cut_coul_msm_gpu.h index 88360e30d200b917e519a219004f29802b399399..ca18ca89e44395890ad2190a395e6c794d7bd17d 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.h +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp b/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp index 348fe44b248dbe34fe22745e8ae29161bed3a09d..3b5f0c12830543ffa77f8914d063b92d4aa55ab9 100755 --- a/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_cut_dipole_cut_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -40,40 +40,40 @@ using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition int dpl_gpu_init(const int ntypes, double **cutsq, double **host_lj1, - double **host_lj2, double **host_lj3, double **host_lj4, - double **offset, double *special_lj, const int nlocal, + double **host_lj2, double **host_lj3, double **host_lj4, + double **offset, double *special_lj, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, double **host_cut_ljsq, double **host_cut_coulsq, double *host_special_coul, const double qqrd2e); void dpl_gpu_clear(); int ** dpl_gpu_compute_n(const int ago, const int inum, - const int nall, double **host_x, int *host_type, - double *sublo, double *subhi, tagint *tag, - int **nspecial, tagint **special, const bool eflag, - const bool vflag, const bool eatom, const bool vatom, - int &host_start, int **ilist, int **jnum, - const double cpu_time, bool &success, - double *host_q, double **host_mu, + const int nall, double **host_x, int *host_type, + double *sublo, double *subhi, tagint *tag, + int **nspecial, tagint **special, const bool eflag, + const bool vflag, const bool eatom, const bool vatom, + int &host_start, int **ilist, int **jnum, + const double cpu_time, bool &success, + double *host_q, double **host_mu, double *boxlo, double *prd); void dpl_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, const double cpu_time, - bool &success, double *host_q, double **host_mu, + bool &success, double *host_q, double **host_mu, const int nlocal, double *boxlo, double *prd); double dpl_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairLJCutDipoleCutGPU::PairLJCutDipoleCutGPU(LAMMPS *lmp) : PairLJCutDipoleCut(lmp), +PairLJCutDipoleCutGPU::PairLJCutDipoleCutGPU(LAMMPS *lmp) : PairLJCutDipoleCut(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -91,12 +91,12 @@ void PairLJCutDipoleCutGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; - int *ilist, *numneigh, **firstneigh; + int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { inum = atom->nlocal; firstneigh = dpl_gpu_compute_n(neighbor->ago, inum, nall, atom->x, @@ -104,7 +104,7 @@ void PairLJCutDipoleCutGPU::compute(int eflag, int vflag) atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time, - success, atom->q, atom->mu, domain->boxlo, + success, atom->q, atom->mu, domain->boxlo, domain->prd); } else { inum = list->inum; @@ -134,8 +134,8 @@ void PairLJCutDipoleCutGPU::init_style() { if (!atom->q_flag || !atom->mu_flag || !atom->torque_flag) error->all(FLERR,"Pair dipole/cut/gpu requires atom attributes q, mu, torque"); - - if (force->newton_pair) + + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with dipole/cut/gpu pair style"); if (strcmp(update->unit_style,"electron") == 0) @@ -186,7 +186,7 @@ double PairLJCutDipoleCutGPU::memory_usage() /* ---------------------------------------------------------------------- */ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vflag, - int *ilist, int *numneigh, + int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; @@ -247,7 +247,7 @@ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vfla forcecoulx = forcecouly = forcecoulz = 0.0; tixcoul = tiycoul = tizcoul = 0.0; tjxcoul = tjycoul = tjzcoul = 0.0; - + if (rsq < cut_coulsq[itype][jtype]) { if (qtmp != 0.0 && q[j] != 0.0) { @@ -259,7 +259,7 @@ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vfla forcecoulz += pre1*delz; } - if (mu[i][3] > 0.0 && mu[j][3] > 0.0) { + if (mu[i][3] > 0.0 && mu[j][3] > 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; r7inv = r5inv*r2inv; @@ -276,7 +276,7 @@ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vfla forcecoulx += pre1*delx + pre2*mu[i][0] + pre3*mu[j][0]; forcecouly += pre1*dely + pre2*mu[i][1] + pre3*mu[j][1]; forcecoulz += pre1*delz + pre2*mu[i][2] + pre3*mu[j][2]; - + crossx = pre4 * (mu[i][1]*mu[j][2] - mu[i][2]*mu[j][1]); crossy = pre4 * (mu[i][2]*mu[j][0] - mu[i][0]*mu[j][2]); crossz = pre4 * (mu[i][0]*mu[j][1] - mu[i][1]*mu[j][0]); @@ -289,7 +289,7 @@ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vfla tjzcoul += -crossz + pre3 * (mu[j][0]*dely - mu[j][1]*delx); } - if (mu[i][3] > 0.0 && q[j] != 0.0) { + if (mu[i][3] > 0.0 && q[j] != 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; @@ -304,7 +304,7 @@ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vfla tizcoul += pre2 * (mu[i][0]*dely - mu[i][1]*delx); } - if (mu[j][3] > 0.0 && qtmp != 0.0) { + if (mu[j][3] > 0.0 && qtmp != 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz; @@ -327,7 +327,7 @@ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vfla forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]); forcelj *= factor_lj * r2inv; } else forcelj = 0.0; - + // total force fq = factor_coul*qqrd2e; @@ -349,7 +349,7 @@ void PairLJCutDipoleCutGPU::cpu_compute(int start, int inum, int eflag, int vfla ecoul = qtmp*q[j]*rinv; if (mu[i][3] > 0.0 && mu[j][3] > 0.0) ecoul += r3inv*pdotp - 3.0*r5inv*pidotr*pjdotr; - if (mu[i][3] > 0.0 && q[j] != 0.0) + if (mu[i][3] > 0.0 && q[j] != 0.0) ecoul += -q[j]*r3inv*pidotr; if (mu[j][3] > 0.0 && qtmp != 0.0) ecoul += qtmp*r3inv*pjdotr; diff --git a/src/GPU/pair_lj_cut_dipole_cut_gpu.h b/src/GPU/pair_lj_cut_dipole_cut_gpu.h index 687c15821791fc505898c9e43868c463b7969c04..b6651379555de9622a85f2469f033c9fcaa9d845 100755 --- a/src/GPU/pair_lj_cut_dipole_cut_gpu.h +++ b/src/GPU/pair_lj_cut_dipole_cut_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_lj_cut_gpu.cpp b/src/GPU/pair_lj_cut_gpu.cpp index 39c95df5b6848cdb831406bf62e2077c3cc0857a..ef97269772b3dad8c21418ecd4d1881657b4c014 100644 --- a/src/GPU/pair_lj_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_cut_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -91,7 +91,7 @@ void PairLJCutGPU::compute(int eflag, int vflag) int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -170,7 +170,7 @@ void PairLJCutGPU::init_style() void PairLJCutGPU::reinit() { Pair::reinit(); - + ljl_gpu_reinit(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4, offset); } diff --git a/src/GPU/pair_lj_expand_gpu.cpp b/src/GPU/pair_lj_expand_gpu.cpp index 1bafd362bdbcc5091398e1c2d5422469e9933ffa..33bbf60600be9db82911e3cf6400c6262db0e8e5 100644 --- a/src/GPU/pair_lj_expand_gpu.cpp +++ b/src/GPU/pair_lj_expand_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Inderaj Bains (NVIDIA), ibains@nvidia.com ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_expand_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -167,7 +167,7 @@ void PairLJExpandGPU::init_style() void PairLJExpandGPU::reinit() { Pair::reinit(); - + lje_gpu_reinit(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4, offset, shift); } diff --git a/src/GPU/pair_lj_gromacs_gpu.cpp b/src/GPU/pair_lj_gromacs_gpu.cpp index ca71a49314660d780ef37f428fe8ba70cb49ec10..5833b8198f698f2eacd9fd1716d789b3ef14ab97 100644 --- a/src/GPU/pair_lj_gromacs_gpu.cpp +++ b/src/GPU/pair_lj_gromacs_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_gromacs_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "kspace.h" #include "gpu_extra.h" @@ -46,7 +46,7 @@ int ljgrm_gpu_init(const int ntypes, double **cutsq, double **host_lj1, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, double **host_ljsw1, double **host_ljsw2, double **host_ljsw3, - double **host_ljsw4, double **host_ljsw5, + double **host_ljsw4, double **host_ljsw5, double **cut_inner, double **cut_innersq); void ljgrm_gpu_clear(); int ** ljgrm_gpu_compute_n(const int ago, const int inum_full, @@ -65,13 +65,13 @@ double ljgrm_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairLJGromacsGPU::PairLJGromacsGPU(LAMMPS *lmp) : +PairLJGromacsGPU::PairLJGromacsGPU(LAMMPS *lmp) : PairLJGromacs(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -89,12 +89,12 @@ void PairLJGromacsGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; - int *ilist, *numneigh, **firstneigh; + int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { inum = atom->nlocal; firstneigh = ljgrm_gpu_compute_n(neighbor->ago, inum, nall, @@ -128,7 +128,7 @@ void PairLJGromacsGPU::compute(int eflag, int vflag) void PairLJGromacsGPU::init_style() { - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/gromacs/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -155,7 +155,7 @@ void PairLJGromacsGPU::init_style() int success = ljgrm_gpu_init(atom->ntypes+1, cutsq, lj1, lj2, lj3, lj4, force->special_lj, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, - cell_size, gpu_mode, screen, ljsw1, ljsw2, + cell_size, gpu_mode, screen, ljsw1, ljsw2, ljsw3, ljsw4, ljsw5, cut_inner, cut_inner_sq); GPU_EXTRA::check_flag(success,error,world); @@ -218,7 +218,7 @@ void PairLJGromacsGPU::cpu_compute(int start, int inum, int eflag, r6inv = r2inv*r2inv*r2inv; forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]); if (rsq > cut_inner_sq[itype][jtype]) { - r = sqrt(rsq); + r = sqrt(rsq); t = r - cut_inner[itype][jtype]; fswitch = r*t*t*(ljsw1[itype][jtype] + ljsw2[itype][jtype]*t); forcelj += fswitch; diff --git a/src/GPU/pair_lj_gromacs_gpu.h b/src/GPU/pair_lj_gromacs_gpu.h index f27d521b29d2cd4e33ab90554484ccc7ca459603..4f00662021c643abeb313eaaf99126e69dbd9389 100644 --- a/src/GPU/pair_lj_gromacs_gpu.h +++ b/src/GPU/pair_lj_gromacs_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp index 426b5dfae939d4a0d096c2a86a74932a8307da8b..0b8d0f3b31b57113346d45dc57e65fb50163c16b 100644 --- a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_sdk_coul_long_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "kspace.h" #include "gpu_extra.h" diff --git a/src/GPU/pair_lj_sdk_gpu.cpp b/src/GPU/pair_lj_sdk_gpu.cpp index e19860d607dded693583fa50031c3618d68ae3e2..e7e9b690f3e05fd5727f922c4cca44de660e874c 100644 --- a/src/GPU/pair_lj_sdk_gpu.cpp +++ b/src/GPU/pair_lj_sdk_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_sdk_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp b/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp index 81ec6c1d02774422713332b82d5d34effe941ed7..5b22bebf7f357b0de570d8d15c29d821ddbab3a4 100755 --- a/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp +++ b/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_sf_dipole_sf_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -40,20 +40,20 @@ using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition int dplsf_gpu_init(const int ntypes, double **cutsq, double **host_lj1, - double **host_lj2, double **host_lj3, double **host_lj4, - double *special_lj, const int nlocal, + double **host_lj2, double **host_lj3, double **host_lj4, + double *special_lj, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen, double **host_cut_ljsq, double **host_cut_coulsq, double *host_special_coul, const double qqrd2e); void dplsf_gpu_clear(); int ** dplsf_gpu_compute_n(const int ago, const int inum, - const int nall, double **host_x, int *host_type, + const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, - bool &success, double *host_q, double **host_mu, + bool &success, double *host_q, double **host_mu, double *boxlo, double *prd); void dplsf_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, @@ -66,13 +66,13 @@ double dplsf_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairLJSFDipoleSFGPU::PairLJSFDipoleSFGPU(LAMMPS *lmp) : PairLJSFDipoleSF(lmp), +PairLJSFDipoleSFGPU::PairLJSFDipoleSFGPU(LAMMPS *lmp) : PairLJSFDipoleSF(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -90,12 +90,12 @@ void PairLJSFDipoleSFGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; - int *ilist, *numneigh, **firstneigh; + int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { inum = atom->nlocal; firstneigh = dplsf_gpu_compute_n(neighbor->ago, inum, nall, atom->x, @@ -103,7 +103,7 @@ void PairLJSFDipoleSFGPU::compute(int eflag, int vflag) atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, vflag_atom, host_start, &ilist, &numneigh, cpu_time, - success, atom->q, atom->mu, domain->boxlo, + success, atom->q, atom->mu, domain->boxlo, domain->prd); } else { inum = list->inum; @@ -133,8 +133,8 @@ void PairLJSFDipoleSFGPU::init_style() { if (!atom->q_flag || !atom->mu_flag || !atom->torque_flag) error->all(FLERR,"Pair dipole/sf/gpu requires atom attributes q, mu, torque"); - - if (force->newton_pair) + + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with dipole/sf/gpu pair style"); if (strcmp(update->unit_style,"electron") == 0) @@ -261,7 +261,7 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, forcecoulz += pre1*delz; } - if (mu[i][3] > 0.0 && mu[j][3] > 0.0) { + if (mu[i][3] > 0.0 && mu[j][3] > 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; rcutcoul2inv=1.0/cut_coulsq[itype][jtype]; @@ -269,7 +269,7 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, pdotp = mu[i][0]*mu[j][0] + mu[i][1]*mu[j][1] + mu[i][2]*mu[j][2]; pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz; - + afac = 1.0 - rsq*rsq * rcutcoul2inv*rcutcoul2inv; pre1 = afac * ( pdotp - 3.0 * r2inv * pidotr * pjdotr ); aforcecoulx = pre1*delx; @@ -282,15 +282,15 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, bforcecoulx = bfac * (pjdotr*mu[i][0]+pidotr*mu[j][0]-presf*delx); bforcecouly = bfac * (pjdotr*mu[i][1]+pidotr*mu[j][1]-presf*dely); bforcecoulz = bfac * (pjdotr*mu[i][2]+pidotr*mu[j][2]-presf*delz); - + forcecoulx += 3.0 * r5inv * ( aforcecoulx + bforcecoulx ); forcecouly += 3.0 * r5inv * ( aforcecouly + bforcecouly ); forcecoulz += 3.0 * r5inv * ( aforcecoulz + bforcecoulz ); - + pre2 = 3.0 * bfac * r5inv * pjdotr; pre3 = 3.0 * bfac * r5inv * pidotr; pre4 = -bfac * r3inv; - + crossx = pre4 * (mu[i][1]*mu[j][2] - mu[i][2]*mu[j][1]); crossy = pre4 * (mu[i][2]*mu[j][0] - mu[i][0]*mu[j][2]); crossz = pre4 * (mu[i][0]*mu[j][1] - mu[i][1]*mu[j][0]); @@ -303,13 +303,13 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, tjzcoul += -crossz + pre3 * (mu[j][0]*dely - mu[j][1]*delx); } - if (mu[i][3] > 0.0 && q[j] != 0.0) { + if (mu[i][3] > 0.0 && q[j] != 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; - pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; + pidotr = mu[i][0]*delx + mu[i][1]*dely + mu[i][2]*delz; rcutcoul2inv=1.0/cut_coulsq[itype][jtype]; pre1 = 3.0 * q[j] * r5inv * pidotr * (1-rsq*rcutcoul2inv); - pqfac = 1.0 - 3.0*rsq*rcutcoul2inv + + pqfac = 1.0 - 3.0*rsq*rcutcoul2inv + 2.0*rsq*sqrt(rsq)*rcutcoul2inv*sqrt(rcutcoul2inv); pre2 = q[j] * r3inv * pqfac; @@ -321,7 +321,7 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, tizcoul += pre2 * (mu[i][0]*dely - mu[i][1]*delx); } - if (mu[j][3] > 0.0 && qtmp != 0.0) { + if (mu[j][3] > 0.0 && qtmp != 0.0) { r3inv = r2inv*rinv; r5inv = r3inv*r2inv; pjdotr = mu[j][0]*delx + mu[j][1]*dely + mu[j][2]*delz; @@ -337,7 +337,7 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, tjxcoul += -pre2 * (mu[j][1]*delz - mu[j][2]*dely); tjycoul += -pre2 * (mu[j][2]*delx - mu[j][0]*delz); tjzcoul += -pre2 * (mu[j][0]*dely - mu[j][1]*delx); - } + } } // LJ interaction @@ -345,22 +345,22 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, if (rsq < cut_ljsq[itype][jtype]) { r6inv = r2inv*r2inv*r2inv; forceljcut = r6inv*(lj1[itype][jtype]*r6inv-lj2[itype][jtype])*r2inv; - + rcutlj2inv = 1.0 / cut_ljsq[itype][jtype]; rcutlj6inv = rcutlj2inv * rcutlj2inv * rcutlj2inv; - forceljsf = (lj1[itype][jtype]*rcutlj6inv - lj2[itype][jtype]) * + forceljsf = (lj1[itype][jtype]*rcutlj6inv - lj2[itype][jtype]) * rcutlj6inv * rcutlj2inv; forcelj = factor_lj * (forceljcut - forceljsf); } else forcelj = 0.0; - + // total force fq = factor_coul*qqrd2e; fx = fq*forcecoulx + delx*forcelj; fy = fq*forcecouly + dely*forcelj; fz = fq*forcecoulz + delz*forcelj; - + // force & torque accumulation f[i][0] += fx; @@ -376,7 +376,7 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, pow((1.0-sqrt(rsq)/sqrt(cut_coulsq[itype][jtype])),2); if (mu[i][3] > 0.0 && mu[j][3] > 0.0) ecoul += bfac * (r3inv*pdotp - 3.0*r5inv*pidotr*pjdotr); - if (mu[i][3] > 0.0 && q[j] != 0.0) + if (mu[i][3] > 0.0 && q[j] != 0.0) ecoul += -q[j]*r3inv * pqfac * pidotr; if (mu[j][3] > 0.0 && qtmp != 0.0) ecoul += qtmp*r3inv * qpfac * pjdotr; @@ -389,9 +389,9 @@ void PairLJSFDipoleSFGPU::cpu_compute(int start, int inum, int eflag, int vflag, rsq*rcutlj2inv + rcutlj6inv*(-7*lj3[itype][jtype]*rcutlj6inv+4*lj4[itype][jtype]); evdwl *= factor_lj; - } else evdwl = 0.0; - } - + } else evdwl = 0.0; + } + if (evflag) ev_tally_xyz_full(i,evdwl,ecoul, fx,fy,fz,delx,dely,delz); } diff --git a/src/GPU/pair_lj_sf_dipole_sf_gpu.h b/src/GPU/pair_lj_sf_dipole_sf_gpu.h index ba1b93292ccd512989a8a84c1dc9cf9e75250200..79df32729390fdaa5c02454b4a9939daa4d6b085 100755 --- a/src/GPU/pair_lj_sf_dipole_sf_gpu.h +++ b/src/GPU/pair_lj_sf_dipole_sf_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_mie_cut_gpu.cpp b/src/GPU/pair_mie_cut_gpu.cpp index 3a6334f85ec48203b3400807de5f3bc568b01722..4857928a27c3d5b1d7aa23eb797669c341f81528 100644 --- a/src/GPU/pair_mie_cut_gpu.cpp +++ b/src/GPU/pair_mie_cut_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_mie_cut_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; @@ -47,13 +47,13 @@ int mie_gpu_init(const int ntypes, double **cutsq, double **host_mie1, const double cell_size, int &gpu_mode, FILE *screen); void mie_gpu_clear(); int ** mie_gpu_compute_n(const int ago, const int inum, - const int nall, double **host_x, int *host_type, + const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success); -void mie_gpu_compute(const int ago, const int inum, const int nall, +void mie_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, @@ -67,7 +67,7 @@ PairMIECutGPU::PairMIECutGPU(LAMMPS *lmp) : PairMIECut(lmp), gpu_mode(GPU_FORCE) respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -85,10 +85,10 @@ void PairMIECutGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -125,8 +125,8 @@ void PairMIECutGPU::compute(int eflag, int vflag) void PairMIECutGPU::init_style() { cut_respa = NULL; - - if (force->newton_pair) + + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with mie/cut/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -172,7 +172,7 @@ double PairMIECutGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairMIECutGPU::cpu_compute(int start, int inum, int eflag, int vflag, +void PairMIECutGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; diff --git a/src/GPU/pair_mie_cut_gpu.h b/src/GPU/pair_mie_cut_gpu.h index ed5a1d43dec1d5e4da8f30bc7db0753650a7f3cc..2e9096e17288cb67821de9c2227fbfe40ee15f07 100644 --- a/src/GPU/pair_mie_cut_gpu.h +++ b/src/GPU/pair_mie_cut_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_morse_gpu.cpp b/src/GPU/pair_morse_gpu.cpp index ad2b3b0b37e9ddf6faad7d92b0951448ae5c2682..b72a6afaf4c72fcdf98b0dab1759e8bbe2cf2760 100644 --- a/src/GPU/pair_morse_gpu.cpp +++ b/src/GPU/pair_morse_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_morse_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_resquared_gpu.cpp b/src/GPU/pair_resquared_gpu.cpp index f26883376c8652e78825c70dc600d0c675070a33..d83a63c467115af4b1df7427c5430715b85c98b1 100644 --- a/src/GPU/pair_resquared_gpu.cpp +++ b/src/GPU/pair_resquared_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_resquared_gpu.h" #include "math_extra.h" #include "atom.h" @@ -34,7 +34,7 @@ #include "universe.h" #include "domain.h" #include "update.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_soft_gpu.cpp b/src/GPU/pair_soft_gpu.cpp index b36d5d27be8d2ba5764aab86c56be48379f5529e..aa0268025c186100f0c6255e8a9efb336965c7a3 100644 --- a/src/GPU/pair_soft_gpu.cpp +++ b/src/GPU/pair_soft_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_soft_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" #include "math_const.h" @@ -48,13 +48,13 @@ void soft_gpu_reinit(const int ntypes, double **cutsq, double **host_prefactor, double **host_cut); void soft_gpu_clear(); int ** soft_gpu_compute_n(const int ago, const int inum, - const int nall, double **host_x, int *host_type, + const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success); -void soft_gpu_compute(const int ago, const int inum, const int nall, +void soft_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, @@ -70,7 +70,7 @@ PairSoftGPU::PairSoftGPU(LAMMPS *lmp) : PairSoft(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -88,10 +88,10 @@ void PairSoftGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -100,7 +100,7 @@ void PairSoftGPU::compute(int eflag, int vflag) atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, - vflag_atom, host_start, + vflag_atom, host_start, &ilist, &numneigh, cpu_time, success); } else { inum = list->inum; @@ -127,7 +127,7 @@ void PairSoftGPU::compute(int eflag, int vflag) void PairSoftGPU::init_style() { - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with soft/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -168,7 +168,7 @@ void PairSoftGPU::init_style() void PairSoftGPU::reinit() { Pair::reinit(); - + soft_gpu_reinit(atom->ntypes+1, cutsq, prefactor, cut); } @@ -182,7 +182,7 @@ double PairSoftGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairSoftGPU::cpu_compute(int start, int inum, int eflag, int vflag, +void PairSoftGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; diff --git a/src/GPU/pair_soft_gpu.h b/src/GPU/pair_soft_gpu.h index da14c292a5cde90ef712e5c3a90ebce0ba5e3660..61e8ee3db54166905a6f8303089d00f602ca0add 100644 --- a/src/GPU/pair_soft_gpu.h +++ b/src/GPU/pair_soft_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_sw_gpu.cpp b/src/GPU/pair_sw_gpu.cpp index 70e271122d110f4871b02b9f6a8bb5fcc9b9e69b..67faf98da4db0f8922be6cb9a2fcc59ffa1b0023 100644 --- a/src/GPU/pair_sw_gpu.cpp +++ b/src/GPU/pair_sw_gpu.cpp @@ -15,10 +15,10 @@ Contributing author: Mike Brown (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_sw_gpu.h" #include "atom.h" #include "neighbor.h" @@ -37,14 +37,14 @@ using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition -int sw_gpu_init(const int ntypes, const int inum, const int nall, const int max_nbors, +int sw_gpu_init(const int ntypes, const int inum, const int nall, const int max_nbors, const double cell_size, int &gpu_mode, FILE *screen, int* host_map, const int nelements, int*** host_elem2param, const int nparams, const double* sw_epsilon, const double* sw_sigma, const double* sw_lambda, const double* sw_gamma, const double* sw_costheta, const double* sw_biga, const double* sw_bigb, const double* sw_powerp, - const double* sw_powerq, const double* sw_cut, + const double* sw_powerq, const double* sw_cut, const double* sw_cutsq); void sw_gpu_clear(); int ** sw_gpu_compute_n(const int ago, const int inum, @@ -116,8 +116,8 @@ void PairSWGPU::compute(int eflag, int vflag) firstneigh = list->firstneigh; sw_gpu_compute(neighbor->ago, atom->nlocal, nall, inum+list->gnum, - atom->x, atom->type, ilist, numneigh, firstneigh, eflag, - vflag, eflag_atom, vflag_atom, host_start, cpu_time, + atom->x, atom->type, ilist, numneigh, firstneigh, eflag, + vflag, eflag_atom, vflag_atom, host_start, cpu_time, success); } if (!success) @@ -180,10 +180,10 @@ void PairSWGPU::init_style() costheta[i] = params[i].costheta; } - int success = sw_gpu_init(atom->ntypes+1, atom->nlocal, atom->nlocal+atom->nghost, 300, - cell_size, gpu_mode, screen, map, nelements, - elem2param, nparams, epsilon, - sigma, lambda, gamma, costheta, biga, bigb, + int success = sw_gpu_init(atom->ntypes+1, atom->nlocal, atom->nlocal+atom->nghost, 300, + cell_size, gpu_mode, screen, map, nelements, + elem2param, nparams, epsilon, + sigma, lambda, gamma, costheta, biga, bigb, powerp, powerq, _cut, _cutsq); memory->destroy(epsilon); diff --git a/src/GPU/pair_table_gpu.cpp b/src/GPU/pair_table_gpu.cpp index 6b1ca065c0764f22b95e6de86412e40cb52a0e0f..b0a38eb461e1a2826ada524a7ea70aaaf59b9567 100644 --- a/src/GPU/pair_table_gpu.cpp +++ b/src/GPU/pair_table_gpu.cpp @@ -15,9 +15,9 @@ Contributing authors: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_table_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" #define LOOKUP 0 diff --git a/src/GPU/pair_tersoff_gpu.cpp b/src/GPU/pair_tersoff_gpu.cpp index 36019e4b3544fca82e5ad33766dcf22aa672d159..eea3fbc06dfd55530c041c329254b722a9b9df05 100644 --- a/src/GPU/pair_tersoff_gpu.cpp +++ b/src/GPU/pair_tersoff_gpu.cpp @@ -15,10 +15,10 @@ Contributing author: Trung Dac Nguyen (ndactrung@gmail.com) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_gpu.h" #include "atom.h" #include "neighbor.h" @@ -37,19 +37,19 @@ using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition -int tersoff_gpu_init(const int ntypes, const int inum, const int nall, +int tersoff_gpu_init(const int ntypes, const int inum, const int nall, const int max_nbors, const double cell_size, int &gpu_mode, - FILE *screen, int* host_map, const int nelements, - int*** host_elem2param, const int nparams, - const double* ts_lam1, const double* ts_lam2, - const double* ts_lam3, const double* ts_powermint, + FILE *screen, int* host_map, const int nelements, + int*** host_elem2param, const int nparams, + const double* ts_lam1, const double* ts_lam2, + const double* ts_lam3, const double* ts_powermint, const double* ts_biga, const double* ts_bigb, - const double* ts_bigr, const double* ts_bigd, - const double* ts_c1, const double* ts_c2, - const double* ts_c3, const double* ts_c4, - const double* ts_c, const double* ts_d, - const double* ts_h, const double* ts_gamma, - const double* ts_beta, const double* ts_powern, + const double* ts_bigr, const double* ts_bigd, + const double* ts_c1, const double* ts_c2, + const double* ts_c3, const double* ts_c4, + const double* ts_c, const double* ts_d, + const double* ts_h, const double* ts_gamma, + const double* ts_beta, const double* ts_powern, const double* ts_cutsq); void tersoff_gpu_clear(); int ** tersoff_gpu_compute_n(const int ago, const int inum_full, @@ -59,10 +59,10 @@ int ** tersoff_gpu_compute_n(const int ago, const int inum_full, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success); -void tersoff_gpu_compute(const int ago, const int nlocal, const int nall, - const int nlist, double **host_x, int *host_type, - int *ilist, int *numj, int **firstneigh, const bool eflag, - const bool vflag, const bool eatom, const bool vatom, +void tersoff_gpu_compute(const int ago, const int nlocal, const int nall, + const int nlist, double **host_x, int *host_type, + int *ilist, int *numj, int **firstneigh, const bool eflag, + const bool vflag, const bool eatom, const bool vatom, int &host_start, const double cpu_time, bool &success); double tersoff_gpu_bytes(); extern double lmp_gpu_forces(double **f, double **tor, double *eatom, @@ -120,8 +120,8 @@ void PairTersoffGPU::compute(int eflag, int vflag) firstneigh = list->firstneigh; tersoff_gpu_compute(neighbor->ago, atom->nlocal, nall, inum+list->gnum, - atom->x, atom->type, ilist, numneigh, firstneigh, eflag, - vflag, eflag_atom, vflag_atom, host_start, cpu_time, + atom->x, atom->type, ilist, numneigh, firstneigh, eflag, + vflag, eflag_atom, vflag_atom, host_start, cpu_time, success); } if (!success) @@ -159,7 +159,7 @@ void PairTersoffGPU::init_style() lam1 = lam2 = lam3 = powermint = NULL; biga = bigb = bigr = bigd = NULL; c1 = c2 = c3 = c4 = NULL; - c = d = h = gamma = NULL; + c = d = h = gamma = NULL; beta = powern = _cutsq = NULL; memory->create(lam1,nparams,"pair:lam1"); @@ -204,12 +204,12 @@ void PairTersoffGPU::init_style() _cutsq[i] = params[i].cutsq; } - int success = tersoff_gpu_init(atom->ntypes+1, atom->nlocal, - atom->nlocal+atom->nghost, 300, - cell_size, gpu_mode, screen, map, nelements, + int success = tersoff_gpu_init(atom->ntypes+1, atom->nlocal, + atom->nlocal+atom->nghost, 300, + cell_size, gpu_mode, screen, map, nelements, elem2param, nparams, lam1, lam2, lam3, - powermint, biga, bigb, bigr, bigd, - c1, c2, c3, c4, c, d, h, gamma, + powermint, biga, bigb, bigr, bigd, + c1, c2, c3, c4, c, d, h, gamma, beta, powern, _cutsq); memory->destroy(lam1); @@ -232,7 +232,7 @@ void PairTersoffGPU::init_style() memory->destroy(powern); memory->destroy(_cutsq); - if (success == -10) + if (success == -10) error->all(FLERR, "Pair tersoff/gpu only works with 1 thread per atom for now."); GPU_EXTRA::check_flag(success,error,world); diff --git a/src/GPU/pair_yukawa_colloid_gpu.cpp b/src/GPU/pair_yukawa_colloid_gpu.cpp index febdc33040917a4a930b160b15e68ddd17806d41..4041bd2ebfb19e53343535e02a5f460f4862f5d7 100644 --- a/src/GPU/pair_yukawa_colloid_gpu.cpp +++ b/src/GPU/pair_yukawa_colloid_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_yukawa_colloid_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,17 +32,17 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition -int ykcolloid_gpu_init(const int ntypes, double **cutsq, double **host_a, +int ykcolloid_gpu_init(const int ntypes, double **cutsq, double **host_a, double **host_offset, double *special_lj, const int inum, const int nall, const int max_nbors, const int maxspecial, - const double cell_size, int &gpu_mode, FILE *screen, + const double cell_size, int &gpu_mode, FILE *screen, const double kappa); void ykcolloid_gpu_clear(); int ** ykcolloid_gpu_compute_n(const int ago, const int inum_full, @@ -52,9 +52,9 @@ int ** ykcolloid_gpu_compute_n(const int ago, const int inum_full, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success, double *host_rad); -void ykcolloid_gpu_compute(const int ago, const int inum_full, - const int nall, double **host_x, int *host_type, - int *ilist, int *numj, int **firstneigh, +void ykcolloid_gpu_compute(const int ago, const int inum_full, + const int nall, double **host_x, int *host_type, + int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, const double cpu_time, bool &success, double *host_rad); @@ -62,13 +62,13 @@ double ykcolloid_gpu_bytes(); /* ---------------------------------------------------------------------- */ -PairYukawaColloidGPU::PairYukawaColloidGPU(LAMMPS *lmp) : PairYukawaColloid(lmp), +PairYukawaColloidGPU::PairYukawaColloidGPU(LAMMPS *lmp) : PairYukawaColloid(lmp), gpu_mode(GPU_FORCE) { respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -86,31 +86,31 @@ void PairYukawaColloidGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { inum = atom->nlocal; firstneigh = ykcolloid_gpu_compute_n(neighbor->ago, inum, nall, - atom->x, atom->type, + atom->x, atom->type, domain->sublo, - domain->subhi, atom->tag, - atom->nspecial, atom->special, + domain->subhi, atom->tag, + atom->nspecial, atom->special, eflag, vflag, eflag_atom, - vflag_atom, host_start, &ilist, - &numneigh, cpu_time, + vflag_atom, host_start, &ilist, + &numneigh, cpu_time, success, atom->radius); } else { inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - ykcolloid_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, - ilist, numneigh, firstneigh, eflag, vflag, - eflag_atom, vflag_atom, host_start, cpu_time, + ykcolloid_gpu_compute(neighbor->ago, inum, nall, atom->x, atom->type, + ilist, numneigh, firstneigh, eflag, vflag, + eflag_atom, vflag_atom, host_start, cpu_time, success, atom->radius); } if (!success) @@ -131,8 +131,8 @@ void PairYukawaColloidGPU::init_style() { if (!atom->sphere_flag) error->all(FLERR,"Pair yukawa/colloid/gpu requires atom style sphere"); - - if (force->newton_pair) + + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with yukawa/colloid/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -151,11 +151,11 @@ void PairYukawaColloidGPU::init_style() } } double cell_size = sqrt(maxcut) + neighbor->skin; - + int maxspecial=0; if (atom->molecular) maxspecial=atom->maxspecial; - int success = ykcolloid_gpu_init(atom->ntypes+1, cutsq, a, + int success = ykcolloid_gpu_init(atom->ntypes+1, cutsq, a, offset, force->special_lj, atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, cell_size, gpu_mode, screen, kappa); @@ -178,8 +178,8 @@ double PairYukawaColloidGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairYukawaColloidGPU::cpu_compute(int start, int inum, int eflag, - int vflag, int *ilist, int *numneigh, +void PairYukawaColloidGPU::cpu_compute(int start, int inum, int eflag, + int vflag, int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair,radi,radj; @@ -215,7 +215,7 @@ void PairYukawaColloidGPU::cpu_compute(int start, int inum, int eflag, rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; radj = radius[j]; - + if (rsq < cutsq[itype][jtype]) { r = sqrt(rsq); rinv = 1.0/r; @@ -223,7 +223,7 @@ void PairYukawaColloidGPU::cpu_compute(int start, int inum, int eflag, forceyukawa = a[itype][jtype] * screening; fpair = factor*forceyukawa * rinv; - + f[i][0] += delx*fpair; f[i][1] += dely*fpair; f[i][2] += delz*fpair; diff --git a/src/GPU/pair_yukawa_colloid_gpu.h b/src/GPU/pair_yukawa_colloid_gpu.h index 7366770e2413d642e48211c5141da28ae749835a..218cfa332036ea7ef80b0a42df92624d54566a10 100644 --- a/src/GPU/pair_yukawa_colloid_gpu.h +++ b/src/GPU/pair_yukawa_colloid_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pair_yukawa_gpu.cpp b/src/GPU/pair_yukawa_gpu.cpp index 5e4a0dc7788a593b6ae781c01d327f16a1a6df36..fcb0ae56bcc6376e62b77d9f80b1137ac4f5dd19 100644 --- a/src/GPU/pair_yukawa_gpu.cpp +++ b/src/GPU/pair_yukawa_gpu.cpp @@ -15,9 +15,9 @@ Contributing author: Trung Dac Nguyen (ORNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_yukawa_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -32,7 +32,7 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; diff --git a/src/GPU/pair_zbl_gpu.cpp b/src/GPU/pair_zbl_gpu.cpp index 4795e9e939227bd2a1ac9cf1956b1eca099f2245..faf6e9b29d84c39c151b8b7840d37d0c3b256944 100644 --- a/src/GPU/pair_zbl_gpu.cpp +++ b/src/GPU/pair_zbl_gpu.cpp @@ -2,12 +2,12 @@ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov - + Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. - + See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "lmptype.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_zbl_gpu.h" #include "atom.h" #include "atom_vec.h" @@ -33,30 +33,30 @@ #include "universe.h" #include "update.h" #include "domain.h" -#include "string.h" +#include <string.h> #include "gpu_extra.h" using namespace LAMMPS_NS; // External functions from cuda library for atom decomposition -int zbl_gpu_init(const int ntypes, double **cutsq, double **host_sw1, - double **host_sw2, double **host_sw3, double **host_sw4, - double **host_sw5, double **host_d1a, double **host_d2a, - double **host_d3a, double **host_d4a, double **host_zze, +int zbl_gpu_init(const int ntypes, double **cutsq, double **host_sw1, + double **host_sw2, double **host_sw3, double **host_sw4, + double **host_sw5, double **host_d1a, double **host_d2a, + double **host_d3a, double **host_d4a, double **host_zze, double cut_globalsq, double cut_innersq, double cut_inner, - const int inum, const int nall, const int max_nbors, - const int maxspecial, const double cell_size, + const int inum, const int nall, const int max_nbors, + const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); void zbl_gpu_clear(); int ** zbl_gpu_compute_n(const int ago, const int inum, - const int nall, double **host_x, int *host_type, + const int nall, double **host_x, int *host_type, double *sublo, double *subhi, tagint *tag, int **nspecial, tagint **special, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, int **ilist, int **jnum, const double cpu_time, bool &success); -void zbl_gpu_compute(const int ago, const int inum, const int nall, +void zbl_gpu_compute(const int ago, const int inum, const int nall, double **host_x, int *host_type, int *ilist, int *numj, int **firstneigh, const bool eflag, const bool vflag, const bool eatom, const bool vatom, int &host_start, @@ -70,7 +70,7 @@ PairZBLGPU::PairZBLGPU(LAMMPS *lmp) : PairZBL(lmp), gpu_mode(GPU_FORCE) respa_enable = 0; reinitflag = 0; cpu_time = 0.0; - GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); + GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } /* ---------------------------------------------------------------------- @@ -88,10 +88,10 @@ void PairZBLGPU::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + int nall = atom->nlocal + atom->nghost; int inum, host_start; - + bool success = true; int *ilist, *numneigh, **firstneigh; if (gpu_mode != GPU_FORCE) { @@ -100,7 +100,7 @@ void PairZBLGPU::compute(int eflag, int vflag) atom->x, atom->type, domain->sublo, domain->subhi, atom->tag, atom->nspecial, atom->special, eflag, vflag, eflag_atom, - vflag_atom, host_start, + vflag_atom, host_start, &ilist, &numneigh, cpu_time, success); } else { inum = list->inum; @@ -127,7 +127,7 @@ void PairZBLGPU::compute(int eflag, int vflag) void PairZBLGPU::init_style() { - if (force->newton_pair) + if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with zbl/gpu pair style"); // Repeat cutsq calculation because done after call to init_style @@ -153,10 +153,10 @@ void PairZBLGPU::init_style() int maxspecial=0; if (atom->molecular) maxspecial=atom->maxspecial; - int success = zbl_gpu_init(atom->ntypes+1, cutsq, sw1, sw2, sw3, sw4, - sw5, d1a, d2a, d3a, d4a, zze, + int success = zbl_gpu_init(atom->ntypes+1, cutsq, sw1, sw2, sw3, sw4, + sw5, d1a, d2a, d3a, d4a, zze, cut_globalsq, cut_innersq, cut_inner, - atom->nlocal, atom->nlocal+atom->nghost, + atom->nlocal, atom->nlocal+atom->nghost, 300, maxspecial, cell_size, gpu_mode, screen); GPU_EXTRA::check_flag(success,error,world); @@ -177,7 +177,7 @@ double PairZBLGPU::memory_usage() /* ---------------------------------------------------------------------- */ -void PairZBLGPU::cpu_compute(int start, int inum, int eflag, int vflag, +void PairZBLGPU::cpu_compute(int start, int inum, int eflag, int vflag, int *ilist, int *numneigh, int **firstneigh) { int i,j,ii,jj,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; @@ -215,7 +215,7 @@ void PairZBLGPU::cpu_compute(int start, int inum, int eflag, int vflag, if (rsq > cut_innersq) { t = r - cut_inner; - fswitch = t*t * + fswitch = t*t * (sw1[itype][jtype] + sw2[itype][jtype]*t); fpair += fswitch; } @@ -229,7 +229,7 @@ void PairZBLGPU::cpu_compute(int start, int inum, int eflag, int vflag, evdwl = e_zbl(r, itype, jtype); evdwl += sw5[itype][jtype]; if (rsq > cut_innersq) { - eswitch = t*t*t * + eswitch = t*t*t * (sw3[itype][jtype] + sw4[itype][jtype]*t); evdwl += eswitch; } diff --git a/src/GPU/pair_zbl_gpu.h b/src/GPU/pair_zbl_gpu.h index f0035968fa4f4162ee89a50627d51c7646dc5b6a..f7a28870bce4fccd02ec071066157ac2bcb14bbc 100644 --- a/src/GPU/pair_zbl_gpu.h +++ b/src/GPU/pair_zbl_gpu.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index f38752c0ee0e85b21a2b8d40bc12acc33a0dd409..b34fd30a0d0bd4115ac88ef84b90e8460057ac76 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -15,11 +15,11 @@ Contributing authors: Mike Brown (ORNL), Axel Kohlmeyer (Temple) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> #include "pppm_gpu.h" #include "atom.h" #include "comm.h" @@ -153,7 +153,7 @@ void PPPMGPU::init() bool respa_value=false; if (strstr(update->integrate_style,"respa")) - respa_value=true; + respa_value=true; if (order>8) error->all(FLERR,"Cannot use order greater than 8 with pppm/gpu."); @@ -202,7 +202,7 @@ void PPPMGPU::compute(int eflag, int vflag) // invoke allocate_peratom() if needed for first time if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = + else evflag = evflag_atom = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; // If need per-atom energies/virials, allocate per-atom arrays here @@ -272,7 +272,7 @@ void PPPMGPU::compute(int eflag, int vflag) // extra per-atom energy/virial communication if (evflag_atom) { - if (differentiation_flag == 1 && vflag_atom) + if (differentiation_flag == 1 && vflag_atom) cg_peratom->forward_comm(this,FORWARD_AD_PERATOM); else if (differentiation_flag == 0) cg_peratom->forward_comm(this,FORWARD_IK_PERATOM); @@ -636,7 +636,7 @@ void PPPMGPU::unpack_reverse(int flag, FFT_SCALAR *buf, int nlist, int *list) FFT_SCALAR *dest = &density_brick_gpu[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) dest[list[i]] += buf[i]; - } + } } /* ---------------------------------------------------------------------- diff --git a/src/GRANULAR/fix_freeze.cpp b/src/GRANULAR/fix_freeze.cpp index 655edd844b8cd8bb23ca874c7f8ed6058218f034..3cfee675b26ec51f07d01f6e2a87f86f499a70ea 100644 --- a/src/GRANULAR/fix_freeze.cpp +++ b/src/GRANULAR/fix_freeze.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_freeze.h" #include "atom.h" #include "update.h" diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index d20b359fb25cb2c067882736c26b3eea2e8dd0dd..8086a68d401148c452ead4c38f5a5881454e624b 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_pour.h" #include "atom.h" #include "atom_vec.h" @@ -123,10 +123,10 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix pour molecule must have coordinates"); if (onemols[i]->typeflag == 0) error->all(FLERR,"Fix pour molecule must have atom types"); - if (ntype+onemols[i]->ntypes <= 0 || + if (ntype+onemols[i]->ntypes <= 0 || ntype+onemols[i]->ntypes > atom->ntypes) error->all(FLERR,"Invalid atom type in fix pour mol command"); - + if (atom->molecular == 2 && onemols != atom->avec->onemols) error->all(FLERR,"Fix pour molecule template ID must be same " "as atom style template ID"); @@ -238,7 +238,7 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : } else if (dstyle == POLY) { volume_one = 0.0; for (int i = 0; i < npoly; i++) - volume_one += (4.0/3.0 * MY_PI * + volume_one += (4.0/3.0 * MY_PI * radius_poly[i]*radius_poly[i]*radius_poly[i]) * frac_poly[i]; } } else { @@ -301,7 +301,7 @@ int FixPour::setmask() void FixPour::init() { - if (domain->triclinic) + if (domain->triclinic) error->all(FLERR,"Cannot use fix pour with triclinic box"); // insure gravity fix exists @@ -516,7 +516,7 @@ void FixPour::pre_exchange() // default to 0.5, if radii not defined in Molecule // same as atom->avec->create_atom(), invoked below - if (onemols[imol]->radiusflag) + if (onemols[imol]->radiusflag) coords[i][3] = onemols[imol]->radius[i]; else coords[i][3] = 0.5; @@ -781,7 +781,7 @@ int FixPour::outside(int dim, double value, double lo, double hi) } else { if (value < lo || value > hi) return 1; } - } + } if (value < lo || value > hi) return 1; return 0; @@ -819,7 +819,7 @@ void FixPour::xyz_random(double h, double *coord) double FixPour::radius_sample() { if (dstyle == ONE) return radius_one; - if (dstyle == RANGE) return radius_lo + + if (dstyle == RANGE) return radius_lo + random->uniform()*(radius_hi-radius_lo); double value = random->uniform(); @@ -884,9 +884,9 @@ void FixPour::options(int narg, char **arg) if (mode != MOLECULE) error->all(FLERR,"Illegal fix deposit command"); if (iarg+nmol+1 > narg) error->all(FLERR,"Illegal fix deposit command"); molfrac[0] = force->numeric(FLERR,arg[iarg+1]); - for (int i = 1; i < nmol; i++) + for (int i = 1; i < nmol; i++) molfrac[i] = molfrac[i-1] + force->numeric(FLERR,arg[iarg+i+1]); - if (molfrac[nmol-1] < 1.0-EPSILON || molfrac[nmol-1] > 1.0+EPSILON) + if (molfrac[nmol-1] < 1.0-EPSILON || molfrac[nmol-1] > 1.0+EPSILON) error->all(FLERR,"Illegal fix deposit command"); molfrac[nmol-1] = 1.0; iarg += nmol+1; @@ -934,7 +934,7 @@ void FixPour::options(int narg, char **arg) dstyle = POLY; npoly = force->inumeric(FLERR,arg[iarg+2]); if (npoly <= 0) error->all(FLERR,"Illegal fix pour command"); - if (iarg+3 + 2*npoly > narg) + if (iarg+3 + 2*npoly > narg) error->all(FLERR,"Illegal fix pour command"); radius_poly = new double[npoly]; frac_poly = new double[npoly]; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index d1cc90369c2087f7da9ffc40ecce3d37bc76f2c8..b49b2043b2301a36b51e3867339923c8583bcb91 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -15,9 +15,9 @@ Contributing authors: Leo Silbert (SNL), Gary Grest (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_wall_gran.h" #include "atom.h" #include "domain.h" diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index d10dd809d561046a667d9603797395bc238d02b0..f7937fd664f20ca51d34267e2b84850dec9ec910 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -15,10 +15,10 @@ Contributing authors: Leo Silbert (SNL), Gary Grest (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> #include "pair_gran_hertz_history.h" #include "atom.h" #include "update.h" diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index 7e3f52eedf11b32c477f9aadd3ed40d3b1a1872b..79503e07b931492f49b6bb5200a240f209975550 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -15,9 +15,9 @@ Contributing authors: Leo Silbert (SNL), Gary Grest (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "pair_gran_hooke.h" #include "atom.h" #include "force.h" diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index a2dbd84efdd0ef4776bc109af69eb3faec1cc361..ec156b4acda96f0160b86c6bd9f19f93445fe3d3 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -15,10 +15,10 @@ Contributing authors: Leo Silbert (SNL), Gary Grest (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_gran_hooke_history.h" #include "atom.h" #include "atom_vec.h" @@ -472,12 +472,12 @@ void PairGranHookeHistory::init_style() onerad_dynamic[i] = onerad_frozen[i] = 0.0; if (ipour >= 0) { itype = i; - onerad_dynamic[i] = + onerad_dynamic[i] = *((double *) modify->fix[ipour]->extract("radius",itype)); } if (idep >= 0) { itype = i; - onerad_dynamic[i] = + onerad_dynamic[i] = *((double *) modify->fix[idep]->extract("radius",itype)); } } @@ -759,7 +759,7 @@ double PairGranHookeHistory::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, +int PairGranHookeHistory::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/KOKKOS/angle_charmm_kokkos.cpp b/src/KOKKOS/angle_charmm_kokkos.cpp index 180cac613d5e6707e381bc26a2aa5587fca6e47e..cb704627659e5bb7961c840086200118cf0407a9 100755 --- a/src/KOKKOS/angle_charmm_kokkos.cpp +++ b/src/KOKKOS/angle_charmm_kokkos.cpp @@ -15,8 +15,8 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_charmm_kokkos.h" #include "atom_kokkos.h" #include "neighbor_kokkos.h" diff --git a/src/KOKKOS/angle_charmm_kokkos.h b/src/KOKKOS/angle_charmm_kokkos.h index 9c203f35f06525ca741a234f2332501de36c8e30..3ff623044b501605f499af074e2eafff686405af 100755 --- a/src/KOKKOS/angle_charmm_kokkos.h +++ b/src/KOKKOS/angle_charmm_kokkos.h @@ -57,9 +57,9 @@ class AngleCharmmKokkos : public AngleCharmm { const F_FLOAT &delx2, const F_FLOAT &dely2, const F_FLOAT &delz2) const; protected: - + class NeighborKokkos *neighborKK; - + typename ArrayTypes<DeviceType>::t_x_array_randomread x; typename ArrayTypes<DeviceType>::t_f_array f; typename ArrayTypes<DeviceType>::t_int_2d anglelist; diff --git a/src/KOKKOS/angle_harmonic_kokkos.cpp b/src/KOKKOS/angle_harmonic_kokkos.cpp index dee0e8246df2c05e8aa2c51b2959bd61e9263f9d..c5976f1bff680bc56787b68b06b7248f4ece7fb7 100755 --- a/src/KOKKOS/angle_harmonic_kokkos.cpp +++ b/src/KOKKOS/angle_harmonic_kokkos.cpp @@ -15,8 +15,8 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_harmonic_kokkos.h" #include "atom_kokkos.h" #include "neighbor_kokkos.h" diff --git a/src/KOKKOS/angle_harmonic_kokkos.h b/src/KOKKOS/angle_harmonic_kokkos.h index ddf045c74b9729edc6b4d9c74a09072306edb912..0fe906fbb7fe0e416cbae582cb356825c4c04e77 100755 --- a/src/KOKKOS/angle_harmonic_kokkos.h +++ b/src/KOKKOS/angle_harmonic_kokkos.h @@ -58,9 +58,9 @@ class AngleHarmonicKokkos : public AngleHarmonic { const F_FLOAT &delx2, const F_FLOAT &dely2, const F_FLOAT &delz2) const; protected: - + class NeighborKokkos *neighborKK; - + typename ArrayTypes<DeviceType>::t_x_array_randomread x; typename ArrayTypes<DeviceType>::t_f_array f; typename ArrayTypes<DeviceType>::t_int_2d anglelist; diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp index 6ae27aac0e8e7007ffa76f8165d28ff84e8c9649..352121fa92d0077ea8a62db1b18abf8493438abc 100644 --- a/src/KOKKOS/atom_kokkos.cpp +++ b/src/KOKKOS/atom_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "atom_kokkos.h" #include "atom_vec.h" #include "atom_vec_kokkos.h" @@ -247,7 +247,7 @@ void AtomKokkos::deallocate_topology() ------------------------------------------------------------------------- */ void AtomKokkos::sync_modify(ExecutionSpace execution_space, - unsigned int datamask_read, + unsigned int datamask_read, unsigned int datamask_modify) { sync(execution_space,datamask_read); diff --git a/src/KOKKOS/atom_vec_angle_kokkos.cpp b/src/KOKKOS/atom_vec_angle_kokkos.cpp index 5217435b51df7f14a03ce06a947e75d0e60e3672..f07e4a9e66bfe46a37f29064cc1b806504ae32c0 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.cpp +++ b/src/KOKKOS/atom_vec_angle_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_angle_kokkos.h" #include "atom_kokkos.h" #include "comm_kokkos.h" diff --git a/src/KOKKOS/atom_vec_atomic_kokkos.cpp b/src/KOKKOS/atom_vec_atomic_kokkos.cpp index ddef28df2d4413ec7e421a9173d487c13c9ec96e..e9b3115d167a76928629e9b1e72ed072b0da4497 100644 --- a/src/KOKKOS/atom_vec_atomic_kokkos.cpp +++ b/src/KOKKOS/atom_vec_atomic_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_atomic_kokkos.h" #include "atom_kokkos.h" #include "comm_kokkos.h" @@ -87,28 +87,28 @@ void AtomVecAtomicKokkos::grow(int n) void AtomVecAtomicKokkos::grow_reset() { - tag = atomKK->tag; - d_tag = atomKK->k_tag.d_view; + tag = atomKK->tag; + d_tag = atomKK->k_tag.d_view; h_tag = atomKK->k_tag.h_view; - type = atomKK->type; - d_type = atomKK->k_type.d_view; + type = atomKK->type; + d_type = atomKK->k_type.d_view; h_type = atomKK->k_type.h_view; - mask = atomKK->mask; - d_mask = atomKK->k_mask.d_view; + mask = atomKK->mask; + d_mask = atomKK->k_mask.d_view; h_mask = atomKK->k_mask.h_view; - image = atomKK->image; - d_image = atomKK->k_image.d_view; + image = atomKK->image; + d_image = atomKK->k_image.d_view; h_image = atomKK->k_image.h_view; - x = atomKK->x; - d_x = atomKK->k_x.d_view; + x = atomKK->x; + d_x = atomKK->k_x.d_view; h_x = atomKK->k_x.h_view; - v = atomKK->v; - d_v = atomKK->k_v.d_view; + v = atomKK->v; + d_v = atomKK->k_v.d_view; h_v = atomKK->k_v.h_view; - f = atomKK->f; - d_f = atomKK->k_f.d_view; + f = atomKK->f; + d_f = atomKK->k_f.d_view; h_f = atomKK->k_f.h_view; } @@ -187,8 +187,8 @@ struct AtomVecAtomicKokkos_PackComm { /* ---------------------------------------------------------------------- */ -int AtomVecAtomicKokkos::pack_comm_kokkos(const int &n, - const DAT::tdual_int_2d &list, +int AtomVecAtomicKokkos::pack_comm_kokkos(const int &n, + const DAT::tdual_int_2d &list, const int & iswap, const DAT::tdual_xfloat_2d &buf, const int &pbc_flag, @@ -1127,7 +1127,7 @@ int AtomVecAtomicKokkos::unpack_exchange(double *buf) { int nlocal = atom->nlocal; if (nlocal == nmax) grow(0); - modified(Host,X_MASK | V_MASK | TAG_MASK | TYPE_MASK | + modified(Host,X_MASK | V_MASK | TAG_MASK | TYPE_MASK | MASK_MASK | IMAGE_MASK); int m = 1; @@ -1275,7 +1275,7 @@ void AtomVecAtomicKokkos::create_atom(int itype, double *coord) initialize other atom quantities ------------------------------------------------------------------------- */ -void AtomVecAtomicKokkos::data_atom(double *coord, tagint imagetmp, +void AtomVecAtomicKokkos::data_atom(double *coord, tagint imagetmp, char **values) { int nlocal = atom->nlocal; diff --git a/src/KOKKOS/atom_vec_atomic_kokkos.h b/src/KOKKOS/atom_vec_atomic_kokkos.h index 291f6b4b7897cf155a54cd20b1c15d5bfe37e614..6e73f4ee3c706a1b1d5e3b62c39c5e5c96a55ede 100644 --- a/src/KOKKOS/atom_vec_atomic_kokkos.h +++ b/src/KOKKOS/atom_vec_atomic_kokkos.h @@ -53,25 +53,25 @@ class AtomVecAtomicKokkos : public AtomVecKokkos { bigint memory_usage(); void grow_reset(); - int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, + int pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &k_sendlist, const int & iswap, const DAT::tdual_xfloat_2d &buf, const int &pbc_flag, const int pbc[]); - void unpack_comm_kokkos(const int &n, const int &nfirst, + void unpack_comm_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf); - int pack_comm_self(const int &n, const DAT::tdual_int_2d &list, - const int & iswap, const int nfirst, + int pack_comm_self(const int &n, const DAT::tdual_int_2d &list, + const int & iswap, const int nfirst, const int &pbc_flag, const int pbc[]); - int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, + int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, int pbc_flag, int *pbc, ExecutionSpace space); - void unpack_border_kokkos(const int &n, const int &nfirst, - const DAT::tdual_xfloat_2d &buf, + void unpack_border_kokkos(const int &n, const int &nfirst, + const DAT::tdual_xfloat_2d &buf, ExecutionSpace space); - int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, + int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, - ExecutionSpace space, int dim, + ExecutionSpace space, int dim, X_FLOAT lo, X_FLOAT hi); int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, diff --git a/src/KOKKOS/atom_vec_bond_kokkos.cpp b/src/KOKKOS/atom_vec_bond_kokkos.cpp index c04cc893be7d999ec791e2d5fe7b53fe1ad04029..65ac756956509dcb7222f5250e39f947a818b31d 100644 --- a/src/KOKKOS/atom_vec_bond_kokkos.cpp +++ b/src/KOKKOS/atom_vec_bond_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_bond_kokkos.h" #include "atom_kokkos.h" #include "comm_kokkos.h" diff --git a/src/KOKKOS/atom_vec_charge_kokkos.cpp b/src/KOKKOS/atom_vec_charge_kokkos.cpp index 40b87c91b2f92976599ed5e3058df2d77f9d24cf..34e7bbae93bc19c2e143059ccb8b69f6bcffb5ca 100644 --- a/src/KOKKOS/atom_vec_charge_kokkos.cpp +++ b/src/KOKKOS/atom_vec_charge_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_charge_kokkos.h" #include "atom_kokkos.h" #include "comm_kokkos.h" diff --git a/src/KOKKOS/atom_vec_full_kokkos.cpp b/src/KOKKOS/atom_vec_full_kokkos.cpp index a8472b47131e4c632dfb277ce8b88ed5f3dd4330..10043d5dd058f96797a62240e96b324c10e6599b 100644 --- a/src/KOKKOS/atom_vec_full_kokkos.cpp +++ b/src/KOKKOS/atom_vec_full_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_full_kokkos.h" #include "atom_kokkos.h" #include "comm_kokkos.h" diff --git a/src/KOKKOS/atom_vec_kokkos.h b/src/KOKKOS/atom_vec_kokkos.h index 4ad62c8f9ce5490af79c871e3f0f08b55367a239..b10c4a21565d46bed04664cc8a9ca6a4e9099e68 100644 --- a/src/KOKKOS/atom_vec_kokkos.h +++ b/src/KOKKOS/atom_vec_kokkos.h @@ -27,43 +27,43 @@ class AtomVecKokkos : public AtomVec { virtual void sync(ExecutionSpace space, unsigned int mask) = 0; virtual void modified(ExecutionSpace space, unsigned int mask) = 0; - virtual int - pack_comm_self(const int &n, const DAT::tdual_int_2d &list, - const int & iswap, const int nfirst, + virtual int + pack_comm_self(const int &n, const DAT::tdual_int_2d &list, + const int & iswap, const int nfirst, const int &pbc_flag, const int pbc[]) = 0; //{return 0;} - virtual int - pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &list, + virtual int + pack_comm_kokkos(const int &n, const DAT::tdual_int_2d &list, const int & iswap, const DAT::tdual_xfloat_2d &buf, const int &pbc_flag, const int pbc[]) = 0; //{return 0;} - virtual void - unpack_comm_kokkos(const int &n, const int &nfirst, + virtual void + unpack_comm_kokkos(const int &n, const int &nfirst, const DAT::tdual_xfloat_2d &buf) = 0; - virtual int - pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, + virtual int + pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist, DAT::tdual_xfloat_2d buf,int iswap, int pbc_flag, int *pbc, ExecutionSpace space) = 0; //{return 0;}; - virtual void - unpack_border_kokkos(const int &n, const int &nfirst, - const DAT::tdual_xfloat_2d &buf, + virtual void + unpack_border_kokkos(const int &n, const int &nfirst, + const DAT::tdual_xfloat_2d &buf, ExecutionSpace space) = 0; - virtual int - pack_exchange_kokkos(const int &nsend, DAT::tdual_xfloat_2d &buf, + virtual int + pack_exchange_kokkos(const int &nsend, DAT::tdual_xfloat_2d &buf, DAT::tdual_int_1d k_sendlist, DAT::tdual_int_1d k_copylist, ExecutionSpace space, int dim, X_FLOAT lo, X_FLOAT hi) = 0; //{return 0;}; - virtual int + virtual int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv, int nlocal, int dim, X_FLOAT lo, X_FLOAT hi, ExecutionSpace space) = 0; //{return 0;}; protected: - + class CommKokkos *commKK; }; diff --git a/src/KOKKOS/atom_vec_molecular_kokkos.cpp b/src/KOKKOS/atom_vec_molecular_kokkos.cpp index a577dda355e9f5ba859f3dd4e9e3613fdeb45574..848e146ac83e51b979b20e3c161fed732dcac244 100644 --- a/src/KOKKOS/atom_vec_molecular_kokkos.cpp +++ b/src/KOKKOS/atom_vec_molecular_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_molecular_kokkos.h" #include "atom_kokkos.h" #include "comm_kokkos.h" diff --git a/src/KOKKOS/bond_fene_kokkos.cpp b/src/KOKKOS/bond_fene_kokkos.cpp index a0543fd8a81e2caef1367e0f6dd525166472e4d0..c8b643261a3146444a6f31f5ec582e80f2ed556e 100755 --- a/src/KOKKOS/bond_fene_kokkos.cpp +++ b/src/KOKKOS/bond_fene_kokkos.cpp @@ -15,8 +15,8 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_fene_kokkos.h" #include "atom_kokkos.h" #include "neighbor_kokkos.h" diff --git a/src/KOKKOS/bond_fene_kokkos.h b/src/KOKKOS/bond_fene_kokkos.h index c82e35c54534192fa1148cfe3b9e7fd6066edf3e..ef3799292553060234243223651eeae7c80ea55a 100755 --- a/src/KOKKOS/bond_fene_kokkos.h +++ b/src/KOKKOS/bond_fene_kokkos.h @@ -57,9 +57,9 @@ class BondFENEKokkos : public BondFENE { const F_FLOAT &dely, const F_FLOAT &delz) const; protected: - + class NeighborKokkos *neighborKK; - + typename ArrayTypes<DeviceType>::t_x_array_randomread x; typename ArrayTypes<DeviceType>::t_f_array f; typename ArrayTypes<DeviceType>::t_int_2d bondlist; diff --git a/src/KOKKOS/bond_harmonic_kokkos.cpp b/src/KOKKOS/bond_harmonic_kokkos.cpp index f90df92fb35f37155740c533ac9ddb9196f00378..ba2ab19a0433f3204add21f802aab59f54a120c3 100755 --- a/src/KOKKOS/bond_harmonic_kokkos.cpp +++ b/src/KOKKOS/bond_harmonic_kokkos.cpp @@ -15,8 +15,8 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_harmonic_kokkos.h" #include "atom_kokkos.h" #include "neighbor_kokkos.h" diff --git a/src/KOKKOS/bond_harmonic_kokkos.h b/src/KOKKOS/bond_harmonic_kokkos.h index 6988fc5a4b9ec501320a243017861dbd57b1b1cd..f2d692c9cc24825569c84d85485fb806f4354761 100755 --- a/src/KOKKOS/bond_harmonic_kokkos.h +++ b/src/KOKKOS/bond_harmonic_kokkos.h @@ -57,9 +57,9 @@ class BondHarmonicKokkos : public BondHarmonic { const F_FLOAT &dely, const F_FLOAT &delz) const; protected: - + class NeighborKokkos *neighborKK; - + typename ArrayTypes<DeviceType>::t_x_array_randomread x; typename ArrayTypes<DeviceType>::t_f_array f; typename ArrayTypes<DeviceType>::t_int_2d bondlist; diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index b2a1f9f7a68b748aab2524941a02c15dd0b6b520..94571594a143a5e355978dc86471995e49bf87e1 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -187,7 +187,7 @@ void CommKokkos::forward_comm_device(int dummy) else buf = NULL; if (size_forward_recv[iswap]) { - buf = atomKK->k_x.view<DeviceType>().ptr_on_device() + + buf = atomKK->k_x.view<DeviceType>().ptr_on_device() + firstrecv[iswap]*atomKK->k_x.view<DeviceType>().dimension_1(); MPI_Irecv(buf,size_forward_recv[iswap],MPI_DOUBLE, recvproc[iswap],0,world,&request); @@ -480,7 +480,7 @@ void CommKokkos::exchange_device() k_count.modify<LMPHostType>(); k_count.sync<DeviceType>(); - BuildExchangeListFunctor<DeviceType> + BuildExchangeListFunctor<DeviceType> f(atomKK->k_x,k_exchange_sendlist,k_count,k_sendflag, nlocal,dim,lo,hi); Kokkos::parallel_for(nlocal,f); @@ -512,7 +512,7 @@ void CommKokkos::exchange_device() k_exchange_copylist.modify<LMPHostType>(); k_exchange_copylist.sync<DeviceType>(); - nsend = + nsend = avec->pack_exchange_kokkos(k_count.h_view(0),k_buf_send, k_exchange_sendlist,k_exchange_copylist, ExecutionSpaceFromDevice<DeviceType>:: @@ -634,11 +634,11 @@ struct BuildBorderListFunctor { typename AT::t_int_2d sendlist; typename AT::t_int_1d nsend; - BuildBorderListFunctor(typename AT::tdual_x_array _x, + BuildBorderListFunctor(typename AT::tdual_x_array _x, typename AT::tdual_int_2d _sendlist, - typename AT::tdual_int_1d _nsend,int _nfirst, + typename AT::tdual_int_1d _nsend,int _nfirst, int _nlast, int _dim, - X_FLOAT _lo, X_FLOAT _hi, int _iswap, + X_FLOAT _lo, X_FLOAT _hi, int _iswap, int _maxsendlist): x(_x.template view<DeviceType>()), sendlist(_sendlist.template view<DeviceType>()), @@ -649,7 +649,7 @@ struct BuildBorderListFunctor { KOKKOS_INLINE_FUNCTION void operator() (typename Kokkos::TeamPolicy<DeviceType>::member_type dev) const { - const int chunk = ((nlast - nfirst + dev.league_size() - 1 ) / + const int chunk = ((nlast - nfirst + dev.league_size() - 1 ) / dev.league_size()); const int teamstart = chunk*dev.league_rank() + nfirst; const int teamend = (teamstart + chunk) < nlast?(teamstart + chunk):nlast; diff --git a/src/KOKKOS/comm_kokkos.h b/src/KOKKOS/comm_kokkos.h index a6aeca3a596f21bea74a44e126434f134b0bf418..587b0305958ffbd8c0a6988091c2d40adf48df86 100644 --- a/src/KOKKOS/comm_kokkos.h +++ b/src/KOKKOS/comm_kokkos.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class CommKokkos : public CommBrick { public: - + bool exchange_comm_classic; bool forward_comm_classic; diff --git a/src/KOKKOS/compute_temp_kokkos.cpp b/src/KOKKOS/compute_temp_kokkos.cpp index bb5e2799c2b808950016962092530efb01cb3432..df5b0fa0904fde1a5ddce181127b33e907759d2d 100755 --- a/src/KOKKOS/compute_temp_kokkos.cpp +++ b/src/KOKKOS/compute_temp_kokkos.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_temp_kokkos.h" #include "atom_kokkos.h" #include "update.h" @@ -69,7 +69,7 @@ double ComputeTempKokkos<DeviceType>::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/KOKKOS/dihedral_charmm_kokkos.cpp b/src/KOKKOS/dihedral_charmm_kokkos.cpp index 6d7275fed2cd7f5a883b4505edec5fa4dcca4717..6042a1a75b23b0b6cc1fbc2d579630bf9bb36e2e 100755 --- a/src/KOKKOS/dihedral_charmm_kokkos.cpp +++ b/src/KOKKOS/dihedral_charmm_kokkos.cpp @@ -15,8 +15,8 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "dihedral_charmm_kokkos.h" #include "atom_kokkos.h" #include "comm.h" @@ -180,7 +180,7 @@ void DihedralCharmmKokkos<DeviceType>::compute(int eflag_in, int vflag_in) if (eflag_atom) { k_eatom.template modify<DeviceType>(); k_eatom.template sync<LMPHostType>(); - + k_eatom_pair.template modify<DeviceType>(); k_eatom_pair.template sync<LMPHostType>(); for (int i = 0; i < n; i++) @@ -431,8 +431,8 @@ void DihedralCharmmKokkos<DeviceType>::allocate() k_lj14_4 = DAT::tdual_ffloat_2d("DihedralCharmm:lj14_4",n+1,n+1); d_lj14_1 = k_lj14_1.d_view; - d_lj14_2 = k_lj14_2.d_view; - d_lj14_3 = k_lj14_3.d_view; + d_lj14_2 = k_lj14_2.d_view; + d_lj14_3 = k_lj14_3.d_view; d_lj14_4 = k_lj14_4.d_view; int nd = atom->ndihedraltypes; diff --git a/src/KOKKOS/dihedral_charmm_kokkos.h b/src/KOKKOS/dihedral_charmm_kokkos.h index 7c34519616b04ae454282aeaad77334af89fb0ac..2ebae7e98541b0e3fbabfba98c97f93d76b3e438 100755 --- a/src/KOKKOS/dihedral_charmm_kokkos.h +++ b/src/KOKKOS/dihedral_charmm_kokkos.h @@ -122,9 +122,9 @@ class DihedralCharmmKokkos : public DihedralCharmm { const F_FLOAT &dely, const F_FLOAT &delz) const; protected: - + class NeighborKokkos *neighborKK; - + typename AT::t_x_array_randomread x; typename AT::t_int_1d_randomread atomtype; typename AT::t_ffloat_1d_randomread q; diff --git a/src/KOKKOS/dihedral_opls_kokkos.cpp b/src/KOKKOS/dihedral_opls_kokkos.cpp index 8aaa0526762ea132ae1d722140c12e8b4f1fe9dc..608e8d97545b370b2a014867ac4eb6538e437c81 100755 --- a/src/KOKKOS/dihedral_opls_kokkos.cpp +++ b/src/KOKKOS/dihedral_opls_kokkos.cpp @@ -15,8 +15,8 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "dihedral_opls_kokkos.h" #include "atom_kokkos.h" #include "comm.h" diff --git a/src/KOKKOS/dihedral_opls_kokkos.h b/src/KOKKOS/dihedral_opls_kokkos.h index 7e7d9100e21062b9ae492bef1349594ffcecaf13..183c39ea3701ee8af137393b4d7354dd6490bfb1 100755 --- a/src/KOKKOS/dihedral_opls_kokkos.h +++ b/src/KOKKOS/dihedral_opls_kokkos.h @@ -59,9 +59,9 @@ class DihedralOPLSKokkos : public DihedralOPLS { const F_FLOAT &vb3x, const F_FLOAT &vb3y, const F_FLOAT &vb3z) const; protected: - + class NeighborKokkos *neighborKK; - + typename AT::t_x_array_randomread x; typename AT::t_f_array f; typename AT::t_int_2d dihedrallist; diff --git a/src/KOKKOS/domain_kokkos.cpp b/src/KOKKOS/domain_kokkos.cpp index 5bb796b0fb4740e4a96bbf5c1eb11c092b9097bb..dff5bddc69faa445f2609d0af2af5f3abe7f179f 100644 --- a/src/KOKKOS/domain_kokkos.cpp +++ b/src/KOKKOS/domain_kokkos.cpp @@ -45,7 +45,7 @@ struct DomainPBCFunctor { DomainPBCFunctor(double* _lo, double* _hi, double* _period, DAT::tdual_x_array _x, DAT::tdual_v_array _v, - DAT::tdual_int_1d _mask, DAT::tdual_imageint_1d _image, + DAT::tdual_int_1d _mask, DAT::tdual_imageint_1d _image, int _deform_groupbit, double* _h_rate, int _xperiodic, int _yperiodic, int _zperiodic): x(_x.view<DeviceType>()), v(_v.view<DeviceType>()), @@ -82,7 +82,7 @@ struct DomainPBCFunctor { image[i] = otherdims | idim; } } - + if (PERIODIC && yperiodic) { if (x(i,1) < lo[1]) { x(i,1) += period[1]; @@ -110,7 +110,7 @@ struct DomainPBCFunctor { image[i] = otherdims | (idim << IMGBITS); } } - + if (PERIODIC && zperiodic) { if (x(i,2) < lo[2]) { x(i,2) += period[2]; @@ -174,13 +174,13 @@ void DomainKokkos::pbc() if (xperiodic || yperiodic || zperiodic) { if (deform_vremap) { - DomainPBCFunctor<LMPDeviceType,1,1> + DomainPBCFunctor<LMPDeviceType,1,1> f(lo,hi,period, atomKK->k_x,atomKK->k_v,atomKK->k_mask,atomKK->k_image, deform_groupbit,h_rate,xperiodic,yperiodic,zperiodic); Kokkos::parallel_for(nlocal,f); } else { - DomainPBCFunctor<LMPDeviceType,1,0> + DomainPBCFunctor<LMPDeviceType,1,0> f(lo,hi,period, atomKK->k_x,atomKK->k_v,atomKK->k_mask,atomKK->k_image, deform_groupbit,h_rate,xperiodic,yperiodic,zperiodic); @@ -188,13 +188,13 @@ void DomainKokkos::pbc() } } else { if (deform_vremap) { - DomainPBCFunctor<LMPDeviceType,0,1> + DomainPBCFunctor<LMPDeviceType,0,1> f(lo,hi,period, atomKK->k_x,atomKK->k_v,atomKK->k_mask,atomKK->k_image, deform_groupbit,h_rate,xperiodic,yperiodic,zperiodic); Kokkos::parallel_for(nlocal,f); } else { - DomainPBCFunctor<LMPDeviceType,0,0> + DomainPBCFunctor<LMPDeviceType,0,0> f(lo,hi,period, atomKK->k_x,atomKK->k_v,atomKK->k_mask,atomKK->k_image, deform_groupbit,h_rate,xperiodic,yperiodic,zperiodic); @@ -226,7 +226,7 @@ void DomainKokkos::remap_all() if (triclinic == 0) { for (int i=0; i<3; i++) { - lo[i] = boxlo[i]; + lo[i] = boxlo[i]; hi[i] = boxhi[i]; period[i] = prd[i]; } @@ -269,7 +269,7 @@ void DomainKokkos::operator()(TagDomain_remap_all, const int &i) const { } x(i,0) = MAX(x(i,0),lo[0]); } - + if (yperiodic) { while (x(i,1) < lo[1]) { x(i,1) += period[1]; @@ -289,7 +289,7 @@ void DomainKokkos::operator()(TagDomain_remap_all, const int &i) const { } x(i,1) = MAX(x(i,1),lo[1]); } - + if (zperiodic) { while (x(i,2) < lo[2]) { x(i,2) += period[2]; @@ -357,8 +357,8 @@ void DomainKokkos::operator()(TagDomain_image_flip, const int &i) const { ybox -= p_flip*zbox; xbox -= m_flip*ybox + n_flip*zbox; - image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | - (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | + (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } diff --git a/src/KOKKOS/fix_deform_kokkos.cpp b/src/KOKKOS/fix_deform_kokkos.cpp index 7da7d301be9f3e3a0fb095b7e15c5acfb5cfbf21..0050fdc5e43f0a3aab38834643e616c7d912213f 100755 --- a/src/KOKKOS/fix_deform_kokkos.cpp +++ b/src/KOKKOS/fix_deform_kokkos.cpp @@ -15,9 +15,9 @@ Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_deform_kokkos.h" #include "atom_kokkos.h" #include "update.h" diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index cd34d3a9648c6794c8b8cac2239c5fe10fcfbdab..e7dc6f9ba217aa810b63b778ca3a94a58b5f3a6f 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_langevin_kokkos.h" #include "atom_masks.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/fix_langevin_kokkos.h b/src/KOKKOS/fix_langevin_kokkos.h index 6f50230b6254dca088bcbbae92fa8ccabb399406..a9d015f6a1a669c76472a8dc300b509ade85b9e7 100644 --- a/src/KOKKOS/fix_langevin_kokkos.h +++ b/src/KOKKOS/fix_langevin_kokkos.h @@ -42,7 +42,7 @@ namespace LAMMPS_NS { fz += rhs.fz; return *this; } - + KOKKOS_INLINE_FUNCTION volatile s_FSUM& operator+=(const volatile s_FSUM &rhs) volatile { fx += rhs.fx; @@ -92,7 +92,7 @@ namespace LAMMPS_NS { private: class CommKokkos *commKK; - + double *rmass; typename ArrayTypes<DeviceType>::tdual_double_2d k_franprev; typename ArrayTypes<DeviceType>::t_double_2d d_franprev; diff --git a/src/KOKKOS/fix_nh_kokkos.cpp b/src/KOKKOS/fix_nh_kokkos.cpp index bdf1bd39176bc6b200d1bd98786775564c28f6f7..d8225b90b5afb4d2282b7514a9ec4e9011da7388 100755 --- a/src/KOKKOS/fix_nh_kokkos.cpp +++ b/src/KOKKOS/fix_nh_kokkos.cpp @@ -15,9 +15,9 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_nh_kokkos.h" #include "math_extra.h" #include "atom.h" @@ -245,7 +245,7 @@ void FixNHKokkos<DeviceType>::final_integrate() // re-compute temp before nh_v_press() // only needed for temperature computes with BIAS on reneighboring steps: - // b/c some biases store per-atom values (e.g. temp/profile) + // b/c some biases store per-atom values (e.g. temp/profile) // per-atom values are invalid if reneigh/comm occurred // since temp->compute() in initial_integrate() diff --git a/src/KOKKOS/fix_nph_kokkos.cpp b/src/KOKKOS/fix_nph_kokkos.cpp index 1eddaad8ab9d16670e0aa2d77441d84331e379f6..08a7ea166d0f8a7cd255893082aabcd54f852e2f 100755 --- a/src/KOKKOS/fix_nph_kokkos.cpp +++ b/src/KOKKOS/fix_nph_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nph_kokkos.h" #include "modify.h" #include "error.h" diff --git a/src/KOKKOS/fix_npt_kokkos.cpp b/src/KOKKOS/fix_npt_kokkos.cpp index 880bf0126fcc1289b4ff5574b1b23a12844bff49..6ae0add69065d70ce9f9997cd8232cc2a6a3d27c 100755 --- a/src/KOKKOS/fix_npt_kokkos.cpp +++ b/src/KOKKOS/fix_npt_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_npt_kokkos.h" #include "modify.h" #include "error.h" diff --git a/src/KOKKOS/fix_nve_kokkos.cpp b/src/KOKKOS/fix_nve_kokkos.cpp index 3bc1a5629b5728d0be24367b8826d1c82a352b62..aa7698badcafff22b2c8f2e5473c09d5ceef256d 100644 --- a/src/KOKKOS/fix_nve_kokkos.cpp +++ b/src/KOKKOS/fix_nve_kokkos.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "fix_nve_kokkos.h" #include "atom_masks.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/fix_nve_kokkos.h b/src/KOKKOS/fix_nve_kokkos.h index 4ec6405ec510b43bd18c1fe20eab4242e9307010..578e0f46cc932efc4b6434b97612b64a64ef8533 100644 --- a/src/KOKKOS/fix_nve_kokkos.h +++ b/src/KOKKOS/fix_nve_kokkos.h @@ -55,7 +55,7 @@ class FixNVEKokkos : public FixNVE { void final_integrate_rmass_item(int) const; private: - + typename ArrayTypes<DeviceType>::t_x_array x; typename ArrayTypes<DeviceType>::t_v_array v; diff --git a/src/KOKKOS/fix_nvt_kokkos.cpp b/src/KOKKOS/fix_nvt_kokkos.cpp index 3045f1a4f4037ecb61c855ddad7e56f61e06a929..43fa07ea5a64b5b23f462ae081c1ddc644f5a703 100755 --- a/src/KOKKOS/fix_nvt_kokkos.cpp +++ b/src/KOKKOS/fix_nvt_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nvt_kokkos.h" #include "group.h" #include "modify.h" diff --git a/src/KOKKOS/fix_wall_reflect_kokkos.cpp b/src/KOKKOS/fix_wall_reflect_kokkos.cpp index 2876b0836abe7f33cb6ca12be52f2fa7ee35b054..cd6501d50ed3e10c0f4e6db08569c2c92f560fb8 100755 --- a/src/KOKKOS/fix_wall_reflect_kokkos.cpp +++ b/src/KOKKOS/fix_wall_reflect_kokkos.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_wall_reflect_kokkos.h" #include "atom_kokkos.h" #include "comm.h" diff --git a/src/KOKKOS/improper_harmonic_kokkos.cpp b/src/KOKKOS/improper_harmonic_kokkos.cpp index 4f96a65c1d3f37a911e5b5c749485bf2d05351b5..f614b3dbc2f9925034e880c5d9cc8df25623f103 100755 --- a/src/KOKKOS/improper_harmonic_kokkos.cpp +++ b/src/KOKKOS/improper_harmonic_kokkos.cpp @@ -15,9 +15,9 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "improper_harmonic_kokkos.h" #include "atom_kokkos.h" #include "comm.h" @@ -225,7 +225,7 @@ void ImproperHarmonicKokkos<DeviceType>::operator()(TagImproperHarmonicCompute<N const F_FLOAT domega = acos(c) - d_chi[type]; F_FLOAT a = d_k[type] * domega; - F_FLOAT eimproper = 0.0; + F_FLOAT eimproper = 0.0; if (eflag) eimproper = a*domega; a = -a * 2.0/s; diff --git a/src/KOKKOS/improper_harmonic_kokkos.h b/src/KOKKOS/improper_harmonic_kokkos.h index 921bbdcaf2830a69f34f307f36b1bcc15009a751..dc7a12af4d25ccfcb00345b78cc465c41f12d497 100755 --- a/src/KOKKOS/improper_harmonic_kokkos.h +++ b/src/KOKKOS/improper_harmonic_kokkos.h @@ -59,9 +59,9 @@ class ImproperHarmonicKokkos : public ImproperHarmonic { const F_FLOAT &vb3x, const F_FLOAT &vb3y, const F_FLOAT &vb3z) const; protected: - + class NeighborKokkos *neighborKK; - + typename AT::t_x_array_randomread x; typename AT::t_f_array f; typename AT::t_int_2d improperlist; diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index de3fcc831f5cd04dd90ef2a4c806b45c8ee5efb9..03626a5c6cfa8022d51570aa4d7673ed5ebc436e 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" -#include "stdlib.h" -#include "ctype.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> #include "kokkos.h" #include "lammps.h" #include "force.h" @@ -44,7 +44,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) device = atoi(arg[iarg+1]); iarg += 2; - } else if (strcmp(arg[iarg],"g") == 0 || + } else if (strcmp(arg[iarg],"g") == 0 || strcmp(arg[iarg],"gpus") == 0) { if (iarg+2 > narg) error->all(FLERR,"Invalid Kokkos command-line args"); int ngpu = atoi(arg[iarg+1]); @@ -208,9 +208,9 @@ void KokkosLMP::accelerator(int narg, char **arg) int KokkosLMP::neigh_list_kokkos(int m) { NeighborKokkos *nk = (NeighborKokkos *) neighbor; - if (nk->lists_host[m] && nk->lists_host[m]->d_numneigh.dimension_0()) + if (nk->lists_host[m] && nk->lists_host[m]->d_numneigh.dimension_0()) return 1; - if (nk->lists_device[m] && nk->lists_device[m]->d_numneigh.dimension_0()) + if (nk->lists_device[m] && nk->lists_device[m]->d_numneigh.dimension_0()) return 1; return 0; } diff --git a/src/KOKKOS/kokkos_type.h b/src/KOKKOS/kokkos_type.h index 1f9087c3cc6ef206cb86474bcdefc3b9c8014e06..15d2eb5525e6ffe8d01893756ae33304e1e2d2ac 100644 --- a/src/KOKKOS/kokkos_type.h +++ b/src/KOKKOS/kokkos_type.h @@ -262,7 +262,7 @@ typedef tdual_int_scalar::t_dev_um t_int_scalar_um; typedef tdual_int_scalar::t_dev_const_um t_int_scalar_const_um; typedef Kokkos:: - DualView<LMP_FLOAT, LMPDeviceType::array_layout, LMPDeviceType> + DualView<LMP_FLOAT, LMPDeviceType::array_layout, LMPDeviceType> tdual_float_scalar; typedef tdual_float_scalar::t_dev t_float_scalar; typedef tdual_float_scalar::t_dev_const t_float_scalar_const; @@ -372,7 +372,7 @@ typedef tdual_xfloat_2d::t_dev_um t_xfloat_2d_um; typedef tdual_xfloat_2d::t_dev_const_um t_xfloat_2d_const_um; typedef tdual_xfloat_2d::t_dev_const_randomread t_xfloat_2d_randomread; -//2d X_FLOAT array n*4 +//2d X_FLOAT array n*4 #ifdef LMP_KOKKOS_NO_LEGACY typedef Kokkos::DualView<X_FLOAT*[3], Kokkos::LayoutLeft, LMPDeviceType> tdual_x_array; #else @@ -467,7 +467,7 @@ typedef tdual_efloat_2d::t_dev_um t_efloat_2d_um; typedef tdual_efloat_2d::t_dev_const_um t_efloat_2d_const_um; typedef tdual_efloat_2d::t_dev_const_randomread t_efloat_2d_randomread; -//2d E_FLOAT array n*3 +//2d E_FLOAT array n*3 typedef Kokkos::DualView<E_FLOAT*[3], Kokkos::LayoutRight, LMPDeviceType> tdual_e_array; typedef tdual_e_array::t_dev t_e_array; diff --git a/src/KOKKOS/memory_kokkos.h b/src/KOKKOS/memory_kokkos.h index 034fbca239cd3dd81e2986614183c774ca6a8bc1..8ade198c4056727f78b620300b72783f15375431 100644 --- a/src/KOKKOS/memory_kokkos.h +++ b/src/KOKKOS/memory_kokkos.h @@ -20,7 +20,7 @@ ------------------------------------------------------------------------- */ template <typename TYPE> -TYPE create_kokkos(TYPE &data, typename TYPE::value_type *&array, +TYPE create_kokkos(TYPE &data, typename TYPE::value_type *&array, int n1, const char *name) { data = TYPE(name,n1); @@ -29,8 +29,8 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type *&array, } template <typename TYPE, typename HTYPE> - TYPE create_kokkos(TYPE &data, HTYPE &h_data, - typename TYPE::value_type *&array, int n1, + TYPE create_kokkos(TYPE &data, HTYPE &h_data, + typename TYPE::value_type *&array, int n1, const char *name) { data = TYPE(std::string(name),n1); @@ -63,11 +63,11 @@ template <typename TYPE, typename HTYPE> ------------------------------------------------------------------------- */ template <typename TYPE> -TYPE grow_kokkos(TYPE &data, typename TYPE::value_type *&array, +TYPE grow_kokkos(TYPE &data, typename TYPE::value_type *&array, int n1, const char *name) { if (array == NULL) return create_kokkos(data,array,n1,name); - + data.resize(n1); array = data.h_view.ptr_on_device(); return data; @@ -151,7 +151,7 @@ TYPE create_kokkos(TYPE &data, int n1, int n2, int n3, int n4, int n5 , int n6 , template <typename TYPE, typename HTYPE> - TYPE create_kokkos(TYPE &data, HTYPE &h_data, int n1, int n2, + TYPE create_kokkos(TYPE &data, HTYPE &h_data, int n1, int n2, const char *name) { data = TYPE(std::string(name),n1,n2); @@ -164,13 +164,13 @@ template <typename TYPE, typename HTYPE> } template <typename TYPE> -TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, +TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, int n2, const char *name) { data = TYPE(std::string(name),n1,n2); bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type **) smalloc(nbytes,name); - + bigint n = 0; for (int i = 0; i < n1; i++) { if(n2==0) @@ -183,8 +183,8 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, } template <typename TYPE, typename HTYPE> - TYPE create_kokkos(TYPE &data, HTYPE &h_data, - typename TYPE::value_type **&array, int n1, int n2, + TYPE create_kokkos(TYPE &data, HTYPE &h_data, + typename TYPE::value_type **&array, int n1, int n2, const char *name) { data = TYPE(std::string(name),n1,n2); @@ -195,7 +195,7 @@ template <typename TYPE, typename HTYPE> #endif bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type **) smalloc(nbytes,name); - + bigint n = 0; for (int i = 0; i < n1; i++) { if(n2==0) @@ -213,57 +213,57 @@ template <typename TYPE, typename HTYPE> ------------------------------------------------------------------------- */ template <typename TYPE> -TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, +TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, int n2, const char *name) { if (array == NULL) return create_kokkos(data,array,n1,n2,name); data.resize(n1,n2); bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type**) srealloc(array,nbytes,name); - + for (int i = 0; i < n1; i++) if(n2==0) array[i] = NULL; else array[i] = &data.h_view(i,0); - + return data; } template <typename TYPE> -TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, +TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, const char *name) { data = TYPE(std::string(name),n1); bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type **) smalloc(nbytes,name); - + for (int i = 0; i < n1; i++) if(data.h_view.dimension_1()==0) array[i] = NULL; else array[i] = &data.h_view(i,0); - + return data; } template <typename TYPE> -TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, +TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, const char *name) { if (array == NULL) return create_kokkos(data,array,n1,name); - + data.resize(n1); - + bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type **) smalloc(nbytes,name); - + for (int i = 0; i < n1; i++) if(data.h_view.dimension_1()==0) array[i] = NULL; else array[i] = &data.h_view(i,0); - + return data; } diff --git a/src/KOKKOS/modify_kokkos.cpp b/src/KOKKOS/modify_kokkos.cpp index 4fcd13615692c0e809de219f83c7ecf78d891c6d..b6078960c452f0f7100692703abb9a5e663034d9 100644 --- a/src/KOKKOS/modify_kokkos.cpp +++ b/src/KOKKOS/modify_kokkos.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -ModifyKokkos::ModifyKokkos(LAMMPS *lmp) : Modify(lmp) +ModifyKokkos::ModifyKokkos(LAMMPS *lmp) : Modify(lmp) { atomKK = (AtomKokkos *) atom; } diff --git a/src/KOKKOS/modify_kokkos.h b/src/KOKKOS/modify_kokkos.h index 7d1796dac57ae4154418e442ef6a1c600bd74844..b8e5f8de30b3d88e07c581690688e7bd9221707c 100644 --- a/src/KOKKOS/modify_kokkos.h +++ b/src/KOKKOS/modify_kokkos.h @@ -61,7 +61,7 @@ class ModifyKokkos : public Modify { int min_reset_ref(); protected: - + }; } diff --git a/src/KOKKOS/neigh_bond_kokkos.cpp b/src/KOKKOS/neigh_bond_kokkos.cpp index 5157df99705a81e809a6a3cdb9c153b30eb7c468..e18fe6f372261fd2abc1097dbf4aac14ccbb963d 100755 --- a/src/KOKKOS/neigh_bond_kokkos.cpp +++ b/src/KOKKOS/neigh_bond_kokkos.cpp @@ -28,7 +28,7 @@ #include "error.h" #include "modify.h" #include "fix.h" -#include "string.h" +#include <string.h> #include "atom_masks.h" #include "domain.h" diff --git a/src/KOKKOS/neigh_bond_kokkos.h b/src/KOKKOS/neigh_bond_kokkos.h index feb0874d5050ad992e45391a2f6456cab4e44669..6ce2b0734edff3297eddb5c75fb2f2364727582a 100755 --- a/src/KOKKOS/neigh_bond_kokkos.h +++ b/src/KOKKOS/neigh_bond_kokkos.h @@ -80,11 +80,11 @@ class NeighBondKokkos : protected Pointers { int me; private: - + DAT::tdual_int_1d k_map_array; typename AT::t_int_1d_randomread map_array; - + DAT::tdual_int_1d k_sametag; typename AT::t_int_1d_randomread sametag; diff --git a/src/KOKKOS/neigh_list_kokkos.cpp b/src/KOKKOS/neigh_list_kokkos.cpp index 4a1b77f3b6ed673b876d748b04546d22cbfa450c..302b6def62398f9ff424dda19ec23c3adc2d5c8b 100644 --- a/src/KOKKOS/neigh_list_kokkos.cpp +++ b/src/KOKKOS/neigh_list_kokkos.cpp @@ -31,7 +31,7 @@ void NeighListKokkos<Device>::clean_copy() dnum = 0; iskip = NULL; ijskip = NULL; - + ipage = NULL; dpage = NULL; maxstencil = 0; @@ -49,11 +49,11 @@ void NeighListKokkos<Device>::grow(int nmax) if (nmax <= maxatoms) return; maxatoms = nmax; - d_ilist = + d_ilist = typename ArrayTypes<Device>::t_int_1d("neighlist:ilist",maxatoms); - d_numneigh = + d_numneigh = typename ArrayTypes<Device>::t_int_1d("neighlist:numneigh",maxatoms); - d_neighbors = + d_neighbors = typename ArrayTypes<Device>::t_neighbors_2d("neighlist:neighbors", maxatoms,maxneighs); @@ -77,7 +77,7 @@ void NeighListKokkos<Device>::stencil_allocate(int smax, int style) if (style == BIN) { if (smax > maxstencil) { maxstencil = smax; - d_stencil = + d_stencil = memory->create_kokkos(d_stencil,h_stencil,stencil,maxstencil, "neighlist:stencil"); if (ghostflag) { diff --git a/src/KOKKOS/neigh_list_kokkos.h b/src/KOKKOS/neigh_list_kokkos.h index 8dc80b83b7b93cfaeeabcb1a68de5c780fa8624d..5200b24595549d6dfdf6c789a9415f8f5d6dca69 100644 --- a/src/KOKKOS/neigh_list_kokkos.h +++ b/src/KOKKOS/neigh_list_kokkos.h @@ -28,7 +28,7 @@ class AtomNeighbors const int num_neighs; KOKKOS_INLINE_FUNCTION - AtomNeighbors(int* const & firstneigh, const int & _num_neighs, + AtomNeighbors(int* const & firstneigh, const int & _num_neighs, const int & stride): num_neighs(_num_neighs), _firstneigh(firstneigh), _stride(stride) {}; KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index a09c47e104f28d0fb19dcc6be904fc826835fdd7..a5206bbe88c0514d1b3e5494045fa587ad4054a7 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -27,7 +27,7 @@ enum{NSQ,BIN,MULTI}; // also in neigh_list.cpp /* ---------------------------------------------------------------------- */ -NeighborKokkos::NeighborKokkos(LAMMPS *lmp) : Neighbor(lmp), +NeighborKokkos::NeighborKokkos(LAMMPS *lmp) : Neighbor(lmp), neighbond_host(lmp),neighbond_device(lmp) { atoms_per_bin = 16; @@ -51,15 +51,15 @@ NeighborKokkos::~NeighborKokkos() if (!copymode) { memory->destroy_kokkos(k_cutneighsq,cutneighsq); cutneighsq = NULL; - + for (int i = 0; i < nlist_host; i++) delete lists_host[i]; delete [] lists_host; for (int i = 0; i < nlist_device; i++) delete lists_device[i]; delete [] lists_device; - + delete [] pair_build_device; delete [] pair_build_host; - + memory->destroy_kokkos(k_ex1_type,ex1_type); memory->destroy_kokkos(k_ex2_type,ex2_type); memory->destroy_kokkos(k_ex1_group,ex1_group); @@ -68,7 +68,7 @@ NeighborKokkos::~NeighborKokkos() memory->destroy_kokkos(k_ex1_bit,ex1_bit); memory->destroy_kokkos(k_ex2_bit,ex2_bit); memory->destroy_kokkos(k_ex_mol_bit,ex_mol_bit); - + memory->destroy_kokkos(k_bondlist,bondlist); memory->destroy_kokkos(k_anglelist,anglelist); memory->destroy_kokkos(k_dihedrallist,dihedrallist); @@ -170,36 +170,36 @@ int NeighborKokkos::init_lists_kokkos() /* ---------------------------------------------------------------------- */ void NeighborKokkos::init_list_flags1_kokkos(int i) -{ +{ if (lists_host[i]) { lists_host[i]->buildflag = 1; if (pair_build_host[i] == NULL) lists_host[i]->buildflag = 0; if (requests[i]->occasional) lists_host[i]->buildflag = 0; - + lists_host[i]->growflag = 1; if (requests[i]->copy) lists_host[i]->growflag = 0; - + lists_host[i]->stencilflag = 1; if (style == NSQ) lists_host[i]->stencilflag = 0; if (stencil_create[i] == NULL) lists_host[i]->stencilflag = 0; - + lists_host[i]->ghostflag = 0; if (requests[i]->ghost) lists_host[i]->ghostflag = 1; if (requests[i]->ghost && !requests[i]->occasional) anyghostlist = 1; } - + if (lists_device[i]) { lists_device[i]->buildflag = 1; if (pair_build_device[i] == NULL) lists_device[i]->buildflag = 0; if (requests[i]->occasional) lists_device[i]->buildflag = 0; - + lists_device[i]->growflag = 1; if (requests[i]->copy) lists_device[i]->growflag = 0; - + lists_device[i]->stencilflag = 1; if (style == NSQ) lists_device[i]->stencilflag = 0; if (stencil_create[i] == NULL) lists_device[i]->stencilflag = 0; - + lists_device[i]->ghostflag = 0; if (requests[i]->ghost) lists_device[i]->ghostflag = 1; if (requests[i]->ghost && !requests[i]->occasional) anyghostlist = 1; @@ -209,7 +209,7 @@ void NeighborKokkos::init_list_flags1_kokkos(int i) /* ---------------------------------------------------------------------- */ void NeighborKokkos::init_list_flags2_kokkos(int i) -{ +{ if (lists_host[i]) { if (lists_host[i]->buildflag) blist[nblist++] = i; if (lists_host[i]->growflag && requests[i]->occasional == 0) diff --git a/src/KOKKOS/neighbor_kokkos.h b/src/KOKKOS/neighbor_kokkos.h index 9264a90524c807fda7bcd92d6a76083b02956426..17e9176bfb0cb3fc21294c4faaa1dde52394df4b 100644 --- a/src/KOKKOS/neighbor_kokkos.h +++ b/src/KOKKOS/neighbor_kokkos.h @@ -280,10 +280,10 @@ struct NeighborKokkosBuildFunctor { const NeighborKokkosExecute<Device> c; const size_t sharedsize; - NeighborKokkosBuildFunctor(const NeighborKokkosExecute<Device> &_c, + NeighborKokkosBuildFunctor(const NeighborKokkosExecute<Device> &_c, const size_t _sharedsize):c(_c), sharedsize(_sharedsize) {}; - + KOKKOS_INLINE_FUNCTION void operator() (const int & i) const { c.template build_Item<HALF_NEIGH,GHOST_NEWTON>(i); @@ -304,7 +304,7 @@ struct NeighborKokkosBuildFunctorFullGhost { const NeighborKokkosExecute<Device> c; const size_t sharedsize; - NeighborKokkosBuildFunctorFullGhost(const NeighborKokkosExecute<Device> &_c, + NeighborKokkosBuildFunctorFullGhost(const NeighborKokkosExecute<Device> &_c, const size_t _sharedsize):c(_c), sharedsize(_sharedsize) {}; @@ -331,17 +331,17 @@ struct NeighborClusterKokkosBuildFunctor { } }; -template<class DeviceType> +template<class DeviceType> struct TagNeighborCheckDistance{}; -template<class DeviceType> +template<class DeviceType> struct TagNeighborXhold{}; class NeighborKokkos : public Neighbor { public: typedef int value_type; - + int nlist_host; // pairwise neighbor lists on Host NeighListKokkos<LMPHostType> **lists_host; @@ -360,11 +360,11 @@ class NeighborKokkos : public Neighbor { ~NeighborKokkos(); void init(); - template<class DeviceType> + template<class DeviceType> KOKKOS_INLINE_FUNCTION void operator()(TagNeighborCheckDistance<DeviceType>, const int&, int&) const; - template<class DeviceType> + template<class DeviceType> KOKKOS_INLINE_FUNCTION void operator()(TagNeighborXhold<DeviceType>, const int&) const; diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index 7ffdf903f35ad63ff9bbeb1f92aa322188056347..51547cea9768053874235e3f9820d6acfbe3d516 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_buck_coul_cut_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -63,7 +63,7 @@ PairBuckCoulCutKokkos<DeviceType>::PairBuckCoulCutKokkos(LAMMPS *lmp):PairBuckCo template<class DeviceType> PairBuckCoulCutKokkos<DeviceType>::~PairBuckCoulCutKokkos() { - + if (!copymode) { memory->destroy_kokkos(k_eatom,eatom); memory->destroy_kokkos(k_vatom,vatom); diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.h b/src/KOKKOS/pair_buck_coul_cut_kokkos.h index 90c9fdca53e4dde4d832b031e8ad2a86cd3e0096..41f34b3354adcdb2ed84daa0ece225e70eb7c334 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.h @@ -101,7 +101,7 @@ class PairBuckCoulCutKokkos : public PairBuckCoulCut { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cut_coulsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cut_coulsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp index 3966b38043f57406b2c6319a34d94dbb069e8338..57108ee6e097a0e318d030fd19ecf5cb11cb787e 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_buck_coul_long_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.h b/src/KOKKOS/pair_buck_coul_long_kokkos.h index be506ce27f2f3142026f73e7cbae6d3ac9df4f09..55f746ec6dccd99d2c4af40fae4eb849c8dece04 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.h +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.h @@ -105,7 +105,7 @@ class PairBuckCoulLongKokkos : public PairBuckCoulLong { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index 7cabbeaf775f2b10d765ec7c617b4a1c0cf7d5ba..7d73160392a18383b1775edcc38a9fd8eb051b40 100755 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_buck_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -216,7 +216,7 @@ void PairBuckKokkos<DeviceType>::init_style() int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; - if (respa) + if (respa) error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } diff --git a/src/KOKKOS/pair_buck_kokkos.h b/src/KOKKOS/pair_buck_kokkos.h index f0f461db0dd58fdbdda77087653bd4739826de50..217bca7b347d4c3a386c8a1215d8a353595aa626 100755 --- a/src/KOKKOS/pair_buck_kokkos.h +++ b/src/KOKKOS/pair_buck_kokkos.h @@ -87,7 +87,7 @@ class PairBuckKokkos : public PairBuck { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cutsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cutsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_coul_cut_kokkos.cpp b/src/KOKKOS/pair_coul_cut_kokkos.cpp index 8ec7aa41ad0d3fb8342668a1e9f6264da8410bd1..cfed188c5aa3fc7335feff2bf851e01bb3d08bb9 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_coul_cut_kokkos.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_cut_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/pair_coul_cut_kokkos.h b/src/KOKKOS/pair_coul_cut_kokkos.h index 4b2175eac9623e4902f4a69b36fca32557a584f4..754706ef4d321390449c65d337a3597c482d5f69 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_coul_cut_kokkos.h @@ -104,7 +104,7 @@ class PairCoulCutKokkos : public PairCoulCut { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cut_coulsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cut_coulsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp index 50fb7f816256a1d39daeb437c592cced0b3f373a..ea28e325a5f117f9dbd52d072282783f984de6cb 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_debye_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -159,7 +159,7 @@ compute_fcoul(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT screening = exp(-kappa*r); F_FLOAT forcecoul; - forcecoul = qqrd2e * qtmp * q(j) * screening * (kappa + rinv) * + forcecoul = qqrd2e * qtmp * q(j) * screening * (kappa + rinv) * (STACKPARAMS?m_params[itype][jtype].scale:params(itype,jtype).scale); return factor_coul*forcecoul*r2inv; @@ -181,7 +181,7 @@ compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT r = 1.0/rinv; const F_FLOAT screening = exp(-kappa*r); - return factor_coul * qqrd2e * qtmp * q(j) * rinv * screening * + return factor_coul * qqrd2e * qtmp * q(j) * rinv * screening * (STACKPARAMS?m_params[itype][jtype].scale:params(itype,jtype).scale); } diff --git a/src/KOKKOS/pair_coul_debye_kokkos.h b/src/KOKKOS/pair_coul_debye_kokkos.h index 25bb15b162bc7db255b71bb2f37ad0b0f2a63be6..8e6095401a56504244629fa72406324d666d068e 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.h +++ b/src/KOKKOS/pair_coul_debye_kokkos.h @@ -102,7 +102,7 @@ class PairCoulDebyeKokkos : public PairCoulDebye { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cut_coulsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cut_coulsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_coul_dsf_kokkos.cpp index f88efd0d8ec379957b0f0aa3d9dbdfa6aefdaf03..f80fe0d38e1ccacb43901d787a661b649327d8d6 100755 --- a/src/KOKKOS/pair_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_coul_dsf_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_dsf_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -287,7 +287,7 @@ void PairCoulDSFKokkos<DeviceType>::operator()(TagPairCoulDSFKernelA<NEIGHFLAG,N const F_FLOAT erfcd = exp(-alpha*alpha*rsq); const F_FLOAT t = 1.0 / (1.0 + EWALD_P*alpha*r); const F_FLOAT erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - const F_FLOAT forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + + const F_FLOAT forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r; const F_FLOAT fpair = forcecoul * r2inv; @@ -424,7 +424,7 @@ void PairCoulDSFKokkos<DeviceType>::ev_tally(EV_FLOAT &ev, const int &i, const i /* ---------------------------------------------------------------------- */ template<class DeviceType> -KOKKOS_INLINE_FUNCTION +KOKKOS_INLINE_FUNCTION int PairCoulDSFKokkos<DeviceType>::sbmask(const int& j) const { return j >> SBBITS & 3; } diff --git a/src/KOKKOS/pair_coul_dsf_kokkos.h b/src/KOKKOS/pair_coul_dsf_kokkos.h index 31cb501bb7eb24ce54745b2822d36b9d04166994..f9bc2505573e30a7cc99679f3fb2fb8aff157026 100755 --- a/src/KOKKOS/pair_coul_dsf_kokkos.h +++ b/src/KOKKOS/pair_coul_dsf_kokkos.h @@ -73,7 +73,7 @@ class PairCoulDSFKokkos : public PairCoulDSF { DAT::t_efloat_1d d_eatom; DAT::t_virial_array d_vatom; - + int neighflag,newton_pair; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_coul_long_kokkos.cpp b/src/KOKKOS/pair_coul_long_kokkos.cpp index 7d92b634d52e6fade9025555d53470fc33e92e65..150ed99296ad2ce537b5c75e90aa90fdbf41f226 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_coul_long_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_long_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/pair_coul_long_kokkos.h b/src/KOKKOS/pair_coul_long_kokkos.h index db996f22b0359360a234c7a9f5030179184f6e87..c546a10a287c8833b7c1ba19a380099c1e31e834 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.h +++ b/src/KOKKOS/pair_coul_long_kokkos.h @@ -109,7 +109,7 @@ class PairCoulLongKokkos : public PairCoulLong { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_coul_wolf_kokkos.cpp b/src/KOKKOS/pair_coul_wolf_kokkos.cpp index 6b951a15482e682b3a74f80bcadcfbd6dcf98f7e..4d2804ce0f41196cf97694095b547f4cf521a263 100755 --- a/src/KOKKOS/pair_coul_wolf_kokkos.cpp +++ b/src/KOKKOS/pair_coul_wolf_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_wolf_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -426,7 +426,7 @@ void PairCoulWolfKokkos<DeviceType>::ev_tally(EV_FLOAT &ev, const int &i, const /* ---------------------------------------------------------------------- */ template<class DeviceType> -KOKKOS_INLINE_FUNCTION +KOKKOS_INLINE_FUNCTION int PairCoulWolfKokkos<DeviceType>::sbmask(const int& j) const { return j >> SBBITS & 3; } diff --git a/src/KOKKOS/pair_coul_wolf_kokkos.h b/src/KOKKOS/pair_coul_wolf_kokkos.h index 20a34f8eea0a7b8d40ad6626120366e0ad0558d1..1efafca99cf5be5c52b85e99f9f09401021fb475 100755 --- a/src/KOKKOS/pair_coul_wolf_kokkos.h +++ b/src/KOKKOS/pair_coul_wolf_kokkos.h @@ -73,7 +73,7 @@ class PairCoulWolfKokkos : public PairCoulWolf { DAT::t_efloat_1d d_eatom; DAT::t_virial_array d_vatom; - + int neighflag,newton_pair; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 2e56307779f07248bd205b0d0b9c465a2f710910..706cf0b52375f7a839fbeff0944e9ef06fa99f1f 100755 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -15,10 +15,10 @@ Contributing authors: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "kokkos.h" #include "pair_kokkos.h" #include "pair_eam_alloy_kokkos.h" diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index 2d48f0fde54340e072473480709d40b324a3cde8..1187dc0a2d3b42f19b04916d788c140ab4f0eedb 100755 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -23,7 +23,7 @@ PairStyle(eam/alloy/kk/host,PairEAMAlloyKokkos<LMPHostType>) #ifndef LMP_PAIR_EAM_ALLOY_KOKKOS_H #define LMP_PAIR_EAM_ALLOY_KOKKOS_H -#include "stdio.h" +#include <stdio.h> #include "pair_kokkos.h" #include "pair_eam.h" #include "neigh_list_kokkos.h" @@ -71,7 +71,7 @@ class PairEAMAlloyKokkos : public PairEAM { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyInitialize, const int&) const; - + template<int NEIGHFLAG, int NEWTON_PAIR> KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMAlloyKernelA<NEIGHFLAG,NEWTON_PAIR>, const int&) const; @@ -106,7 +106,7 @@ class PairEAMAlloyKokkos : public PairEAM { const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const; - virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, + virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, int, int *); virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); virtual int pack_forward_comm(int, int *, double *, int, int *); diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index a95deb85426a0c67900411596146568f32c8ea38..6d96d3c33c3f65ef21f17f5dfc99f4b3565c8d9b 100755 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -15,10 +15,10 @@ Contributing authors: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "kokkos.h" #include "pair_kokkos.h" #include "pair_eam_fs_kokkos.h" diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 9ffa121467b79e1404f59c0b16fdb49825327c05..4ac00939883549e582de8df273ab4346045f20ad 100755 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -23,7 +23,7 @@ PairStyle(eam/fs/kk/host,PairEAMFSKokkos<LMPHostType>) #ifndef LMP_PAIR_EAM_FS_KOKKOS_H #define LMP_PAIR_EAM_FS_KOKKOS_H -#include "stdio.h" +#include <stdio.h> #include "pair_kokkos.h" #include "pair_eam.h" #include "neigh_list_kokkos.h" @@ -71,7 +71,7 @@ class PairEAMFSKokkos : public PairEAM { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSInitialize, const int&) const; - + template<int NEIGHFLAG, int NEWTON_PAIR> KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMFSKernelA<NEIGHFLAG,NEWTON_PAIR>, const int&) const; @@ -106,7 +106,7 @@ class PairEAMFSKokkos : public PairEAM { const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const; - virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, + virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, int, int *); virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); virtual int pack_forward_comm(int, int *, double *, int, int *); diff --git a/src/KOKKOS/pair_eam_kokkos.cpp b/src/KOKKOS/pair_eam_kokkos.cpp index 14cd2ab8c2a61f6d7e2bd88ae02ef6ea75ad01f7..b643393f84492bf5db669c5bf6e4fe5fb5729186 100755 --- a/src/KOKKOS/pair_eam_kokkos.cpp +++ b/src/KOKKOS/pair_eam_kokkos.cpp @@ -15,10 +15,10 @@ Contributing authors: Stan Moore (SNL), Christian Trott (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "kokkos.h" #include "pair_kokkos.h" #include "pair_eam_kokkos.h" @@ -278,7 +278,7 @@ void PairEAMKokkos<DeviceType>::init_style() int irequest = neighbor->nrequest - 1; neighbor->requests[irequest]-> - kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && + kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && !Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; neighbor->requests[irequest]-> kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; @@ -294,7 +294,7 @@ void PairEAMKokkos<DeviceType>::init_style() } else { error->all(FLERR,"Cannot use chosen neighbor list style with pair eam/kk"); } - + } /* ---------------------------------------------------------------------- @@ -480,7 +480,7 @@ void PairEAMKokkos<DeviceType>::interpolate(int n, double delta, double *f, t_ho /* ---------------------------------------------------------------------- */ template<class DeviceType> -int PairEAMKokkos<DeviceType>::pack_forward_comm_kokkos(int n, DAT::tdual_int_2d k_sendlist, int iswap_in, DAT::tdual_xfloat_1d &buf, +int PairEAMKokkos<DeviceType>::pack_forward_comm_kokkos(int n, DAT::tdual_int_2d k_sendlist, int iswap_in, DAT::tdual_xfloat_1d &buf, int pbc_flag, int *pbc) { d_sendlist = k_sendlist.view<DeviceType>(); @@ -518,7 +518,7 @@ void PairEAMKokkos<DeviceType>::operator()(TagPairEAMUnpackForwardComm, const in /* ---------------------------------------------------------------------- */ template<class DeviceType> -int PairEAMKokkos<DeviceType>::pack_forward_comm(int n, int *list, double *buf, +int PairEAMKokkos<DeviceType>::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j; @@ -585,7 +585,7 @@ void PairEAMKokkos<DeviceType>::operator()(TagPairEAMKernelA<NEIGHFLAG,NEWTON_PA // rho = density at each atom // loop over neighbors of my atoms - + // The rho array is atomic for Half/Thread neighbor style Kokkos::View<F_FLOAT*, typename DAT::t_f_array::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > rho = v_rho; @@ -626,7 +626,7 @@ void PairEAMKokkos<DeviceType>::operator()(TagPairEAMKernelA<NEIGHFLAG,NEWTON_PA rho[j] += ((rhor.x*p + rhor.y)*p + rhor.z)*p + rhor.w; } } - + } rho[i] += rhotmp; } @@ -714,7 +714,7 @@ void PairEAMKokkos<DeviceType>::operator()(TagPairEAMKernelAB<EFLAG>, const int const F_FLOAT4 rhor = d_rhor_spline_b(d_type2rhor_ji,m); rhotmp += ((rhor.x*p + rhor.y)*p + rhor.z)*p + rhor.w; } - + } d_rho[i] += rhotmp; diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 4bd43cd38add16f5a91d6a9e802f7596d45756f5..b3d33bb37f764e781009adcbd942f34a9ac8c423 100755 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -23,7 +23,7 @@ PairStyle(eam/kk/host,PairEAMKokkos<LMPHostType>) #ifndef LMP_PAIR_EAM_KOKKOS_H #define LMP_PAIR_EAM_KOKKOS_H -#include "stdio.h" +#include <stdio.h> #include "pair_kokkos.h" #include "pair_eam.h" #include "neigh_list_kokkos.h" @@ -68,7 +68,7 @@ class PairEAMKokkos : public PairEAM { KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMInitialize, const int&) const; - + template<int NEIGHFLAG, int NEWTON_PAIR> KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMKernelA<NEIGHFLAG,NEWTON_PAIR>, const int&) const; @@ -103,7 +103,7 @@ class PairEAMKokkos : public PairEAM { const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const; - virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, + virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, int, int *); virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&); virtual int pack_forward_comm(int, int *, double *, int, int *); @@ -158,7 +158,7 @@ class PairEAMKokkos : public PairEAM { typename AT::t_int_2d d_sendlist; typename AT::t_xfloat_1d_um v_buf; - + int neighflag,newton_pair; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index c2b05e82873809c733429c8873755d14fbace422..4e97e3ebd219023867cdc801e53672ce8bfddcb9 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_charmm_coul_charmm_implicit_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -195,8 +195,8 @@ compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0*rsq * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - englj = r6inv * - ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - + englj = r6inv * + ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - (STACKPARAMS?m_params[itype][jtype].lj4:params(itype,jtype).lj4)); forcelj = forcelj*switch1 + englj*switch2; } @@ -215,9 +215,9 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const { const F_FLOAT r2inv = 1.0/rsq; const F_FLOAT r6inv = r2inv*r2inv*r2inv; - F_FLOAT englj, switch1; + F_FLOAT englj, switch1; - englj = r6inv * + englj = r6inv * ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - (STACKPARAMS?m_params[itype][jtype].lj4:params(itype,jtype).lj4)); @@ -268,7 +268,7 @@ compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const { const F_FLOAT r2inv = 1.0/rsq; - F_FLOAT ecoul, switch1; + F_FLOAT ecoul, switch1; ecoul = qqrd2e * qtmp * q(j) * r2inv; if (rsq > cut_coul_innersq) { diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h index 06950756ea87889d1f76a077cdcab492bf912439..0174d557681b365f9f4660150069f22201010c4e 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h @@ -105,7 +105,7 @@ class PairLJCharmmCoulCharmmImplicitKokkos : public PairLJCharmmCoulCharmmImplic typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp index 2fa71aeebfa93bbb0c037d10eb37d9f3bb4a7bb7..9b7b8d8d7a4d241b40ad7f3f1d6c1fddfd7883b2 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_charmm_coul_charmm_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -195,8 +195,8 @@ compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0*rsq * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - englj = r6inv * - ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - + englj = r6inv * + ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - (STACKPARAMS?m_params[itype][jtype].lj4:params(itype,jtype).lj4)); forcelj = forcelj*switch1 + englj*switch2; } @@ -215,9 +215,9 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const { const F_FLOAT r2inv = 1.0/rsq; const F_FLOAT r6inv = r2inv*r2inv*r2inv; - F_FLOAT englj, switch1; + F_FLOAT englj, switch1; - englj = r6inv * + englj = r6inv * ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - (STACKPARAMS?m_params[itype][jtype].lj4:params(itype,jtype).lj4)); @@ -270,7 +270,7 @@ compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT r2inv = 1.0/rsq; const F_FLOAT rinv = sqrt(r2inv); - F_FLOAT ecoul, switch1; + F_FLOAT ecoul, switch1; ecoul = qqrd2e * qtmp * q(j) * rinv; if (rsq > cut_coul_innersq) { diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h index ee76bb193e4a910f6a51671651453035a3257958..34134fd520f03a9819da5f9655132a377a6213d3 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h @@ -105,7 +105,7 @@ class PairLJCharmmCoulCharmmKokkos : public PairLJCharmmCoulCharmm { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp index 8809912cdddc8fcd32ade07744de5cf55f968843..ad41540b5efe423bd702b2afa9732c08adc05057 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_charmm_coul_long_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -195,8 +195,8 @@ compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0*rsq * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - englj = r6inv * - ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - + englj = r6inv * + ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - (STACKPARAMS?m_params[itype][jtype].lj4:params(itype,jtype).lj4)); forcelj = forcelj*switch1 + englj*switch2; } @@ -215,9 +215,9 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const { const F_FLOAT r2inv = 1.0/rsq; const F_FLOAT r6inv = r2inv*r2inv*r2inv; - F_FLOAT englj, switch1; + F_FLOAT englj, switch1; - englj = r6inv * + englj = r6inv * ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - (STACKPARAMS?m_params[itype][jtype].lj4:params(itype,jtype).lj4)); diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h index 039af94c5558cf684ced95989a7e622cbf1bb721..f212540a14b9ec09968ac0d81a94fb9cb0b00606 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h @@ -105,7 +105,7 @@ class PairLJCharmmCoulLongKokkos : public PairLJCharmmCoulLong { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp index 283b88b579604ac823d86e6370783bcd3aa0429f..9a451a744e6d60b76e14eb0362b81788bca1229e 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_class2_coul_cut_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp index 3e530afa3f9278a91b3f88fd714d0ae8197fe069..a9cb4fbbe111606cb8cd73f09cff7317e26f4bb6 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_class2_coul_long_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h index 76728c36ff73d1afbdc57ad0e1e74df97f086049..b376906e49261645aacaf699c5808ae2954e5293 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h @@ -102,7 +102,7 @@ class PairLJClass2CoulLongKokkos : public PairLJClass2CoulLong { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index 62d228dfb157038faecfd7a8570257ca710da2f3..9bc3989fff9052b07f5b034698de52f8fe8695cf 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_class2_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -210,7 +210,7 @@ void PairLJClass2Kokkos<DeviceType>::init_style() int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; - if (respa) + if (respa) error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } @@ -220,7 +220,7 @@ void PairLJClass2Kokkos<DeviceType>::init_style() int irequest = neighbor->nrequest - 1; neighbor->requests[irequest]-> - kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && + kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && !Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; neighbor->requests[irequest]-> kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp index 12d6fe91784be5ed146effb206e2761111ae948b..c3b9439670b2c6a186b0015915c57f1e5e56ab91 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_cut_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h index 20ebfa3b032ada9836a20659153b94108dc0a72b..a73af32b8d1022f23a431f6ee2ac63740b3d63d8 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h @@ -100,7 +100,7 @@ class PairLJCutCoulCutKokkos : public PairLJCutCoulCut { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cut_coulsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cut_coulsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index 92908a62ab058df6c4f51594d7176c9a78368201..4e3680bf3055aba2f57d4c4ac11c88c622112996 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_debye_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h index e5a5d76a1681743688be89427aa31c6daaced744..6195fee90e550ec3ff8f4aa907d7d0ee1d3e76ea 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h @@ -98,7 +98,7 @@ class PairLJCutCoulDebyeKokkos : public PairLJCutCoulDebye { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cut_coulsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cut_coulsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index 2c74fa91ca735ef621ee5984b0e4197bbf4b5993..480f2ad180d22a3dab832434121236fc6b1dfba9 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_dsf_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -223,7 +223,7 @@ compute_fcoul(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT t = 1.0 / (1.0 + EWALD_P*alpha*r); const F_FLOAT erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - return prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * + return prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r2inv; } diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h index 661125a1b7e264dc5dd2b5afdcb45585a47ea394..4ce73f4a943d6489d47937a838d856c809cf029d 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h @@ -97,7 +97,7 @@ class PairLJCutCoulDSFKokkos : public PairLJCutCoulDSF { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cut_coulsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cut_coulsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp index 590c890676b2df093e4ecd7a8f1a4c50bfe03094..356fc4f2c5342b069a3bb9cf979d09923dbd77ab 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_long_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h index 1700bd04c27221af0bfa25101fc392cde97f9f48..a18797e1aa620cb04663496d75b27ce9d03f3583 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h @@ -102,7 +102,7 @@ class PairLJCutCoulLongKokkos : public PairLJCutCoulLong { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index 657848585c6958396b0fe3c94c519f3433f409a8..1e400c6413a4962a763c427296241cbf1c58915b 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -201,7 +201,7 @@ void PairLJCutKokkos<DeviceType>::init_style() int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; - if (respa) + if (respa) error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } @@ -211,7 +211,7 @@ void PairLJCutKokkos<DeviceType>::init_style() int irequest = neighbor->nrequest - 1; neighbor->requests[irequest]-> - kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && + kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && !Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; neighbor->requests[irequest]-> kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; diff --git a/src/KOKKOS/pair_lj_cut_kokkos.h b/src/KOKKOS/pair_lj_cut_kokkos.h index 4da4730650d75f782e131f49a77bc324851ac156..37046e457a8a2f270098c4b6ca2d9b795fda02a4 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_kokkos.h @@ -87,7 +87,7 @@ class PairLJCutKokkos : public PairLJCut { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cutsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cutsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index 43efff020526bcf689667c7890ec573809fcb99b..29473f14bcbc8e1b4083dba10f587c122baf686e 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_expand_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -213,7 +213,7 @@ void PairLJExpandKokkos<DeviceType>::init_style() int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; - if (respa) + if (respa) error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } @@ -223,7 +223,7 @@ void PairLJExpandKokkos<DeviceType>::init_style() int irequest = neighbor->nrequest - 1; neighbor->requests[irequest]-> - kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && + kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && !Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; neighbor->requests[irequest]-> kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; diff --git a/src/KOKKOS/pair_lj_expand_kokkos.h b/src/KOKKOS/pair_lj_expand_kokkos.h index c8b8684cdc3da08311e217e6fbfbf8c37db4ef56..1e7f57befd3ca74218087ccf10696e69764af278 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.h +++ b/src/KOKKOS/pair_lj_expand_kokkos.h @@ -91,7 +91,7 @@ class PairLJExpandKokkos : public PairLJExpand { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cutsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cutsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp index 6fd07bd67c209fcb7902bb2bc4e7fab2b4b4093c..7081dd5417e9a371a6c67769cec97fef789d071b 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_gromacs_coul_gromacs_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -185,7 +185,7 @@ compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT r = sqrt(rsq); const F_FLOAT tlj = r - cut_lj_inner; const F_FLOAT fswitch = r*tlj*tlj* - ((STACKPARAMS?m_params[itype][jtype].ljsw1:params(itype,jtype).ljsw1) + + ((STACKPARAMS?m_params[itype][jtype].ljsw1:params(itype,jtype).ljsw1) + (STACKPARAMS?m_params[itype][jtype].ljsw2:params(itype,jtype).ljsw2)*tlj); forcelj += fswitch; } @@ -204,7 +204,7 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT r2inv = 1.0/rsq; const F_FLOAT r6inv = r2inv*r2inv*r2inv; - F_FLOAT englj = r6inv * + F_FLOAT englj = r6inv * ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - (STACKPARAMS?m_params[itype][jtype].lj4:params(itype,jtype).lj4)); englj += (STACKPARAMS?m_params[itype][jtype].ljsw5:params(itype,jtype).ljsw5); @@ -213,7 +213,7 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT r = sqrt(rsq); const F_FLOAT tlj = r - cut_lj_inner; const F_FLOAT eswitch = tlj*tlj*tlj * - ((STACKPARAMS?m_params[itype][jtype].ljsw3:params(itype,jtype).ljsw3) + + ((STACKPARAMS?m_params[itype][jtype].ljsw3:params(itype,jtype).ljsw3) + (STACKPARAMS?m_params[itype][jtype].ljsw4:params(itype,jtype).ljsw4)*tlj); englj += eswitch; } diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h index 81db722433307d429a8632c37a25f7892c39b7e2..3a69ba1172454ee592761c41a50715b0404a29e9 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h @@ -105,7 +105,7 @@ class PairLJGromacsCoulGromacsKokkos : public PairLJGromacsCoulGromacs { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index be9d5faaf1d51f30058c7f9511a4fab7334f842f..d1699fe6b6474b6bb24af26f19e260d0f1473617 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_gromacs_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -172,7 +172,7 @@ compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT r = sqrt(rsq); const F_FLOAT tlj = r - (STACKPARAMS?m_params[itype][jtype].cut_inner:params(itype,jtype).cut_inner); const F_FLOAT fswitch = r*tlj*tlj* - ((STACKPARAMS?m_params[itype][jtype].ljsw1:params(itype,jtype).ljsw1) + + ((STACKPARAMS?m_params[itype][jtype].ljsw1:params(itype,jtype).ljsw1) + (STACKPARAMS?m_params[itype][jtype].ljsw2:params(itype,jtype).ljsw2)*tlj); forcelj += fswitch; } @@ -191,7 +191,7 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT r2inv = 1.0/rsq; const F_FLOAT r6inv = r2inv*r2inv*r2inv; - F_FLOAT englj = r6inv * + F_FLOAT englj = r6inv * ((STACKPARAMS?m_params[itype][jtype].lj3:params(itype,jtype).lj3)*r6inv - (STACKPARAMS?m_params[itype][jtype].lj4:params(itype,jtype).lj4)); englj += (STACKPARAMS?m_params[itype][jtype].ljsw5:params(itype,jtype).ljsw5); @@ -200,7 +200,7 @@ compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const F_FLOAT r = sqrt(rsq); const F_FLOAT tlj = r - (STACKPARAMS?m_params[itype][jtype].cut_inner:params(itype,jtype).cut_inner); const F_FLOAT eswitch = tlj*tlj*tlj * - ((STACKPARAMS?m_params[itype][jtype].ljsw3:params(itype,jtype).ljsw3) + + ((STACKPARAMS?m_params[itype][jtype].ljsw3:params(itype,jtype).ljsw3) + (STACKPARAMS?m_params[itype][jtype].ljsw4:params(itype,jtype).ljsw4)*tlj); englj += eswitch; } diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.h b/src/KOKKOS/pair_lj_gromacs_kokkos.h index 717571e1441823860bf74d0bdd86af605bdb575a..fd00a35d4e1617e2d937e48a3315d076d418cca6 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.h +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.h @@ -108,7 +108,7 @@ class PairLJGromacsKokkos : public PairLJGromacs { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread d_rtable, d_drtable, d_ftable, d_dftable, d_ctable, d_dctable, d_etable, d_detable; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.cpp b/src/KOKKOS/pair_lj_sdk_kokkos.cpp index bc413d39f0693c80a13cbe6d7ebad7273c0563cf..6ff92035351c67058fd913463cedd20210d6adf7 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.cpp +++ b/src/KOKKOS/pair_lj_sdk_kokkos.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_sdk_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -242,7 +242,7 @@ void PairLJSDKKokkos<DeviceType>::init_style() int respa = 0; if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; - if (respa) + if (respa) error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle"); } @@ -252,7 +252,7 @@ void PairLJSDKKokkos<DeviceType>::init_style() int irequest = neighbor->nrequest - 1; neighbor->requests[irequest]-> - kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && + kokkos_host = Kokkos::Impl::is_same<DeviceType,LMPHostType>::value && !Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; neighbor->requests[irequest]-> kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value; diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.h b/src/KOKKOS/pair_lj_sdk_kokkos.h index 517b6bc55fd946da8684f92a0313e46b14cfeed7..f5ffdd852079f2c56761022c0e63506c9d7f2a2d 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.h +++ b/src/KOKKOS/pair_lj_sdk_kokkos.h @@ -88,7 +88,7 @@ class PairLJSDKKokkos : public PairLJSDK { typename ArrayTypes<DeviceType>::tdual_ffloat_2d k_cutsq; typename ArrayTypes<DeviceType>::t_ffloat_2d d_cutsq; - + int neighflag; int nlocal,nall,eflag,vflag; diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index c773516e671c6a53545a485b34370dbfc580f996..df15bfaf1ae18ffa557feb6d68dcc4be1643c33e 100755 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_sw_kokkos.h" #include "kokkos.h" #include "pair_kokkos.h" @@ -144,7 +144,7 @@ void PairSWKokkos<DeviceType>::compute(int eflag_in, int vflag_in) Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairSWComputeFullA<FULL,0> >(0,inum),*this); DeviceType::fence(); ev_all += ev; - + if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairSWComputeFullB<FULL,1> >(0,ignum),*this,ev); else diff --git a/src/KOKKOS/pair_sw_kokkos.h b/src/KOKKOS/pair_sw_kokkos.h index a73008ee1c32783126f4892ff34e87313cd0d502..4be9c80fa31d5c7c1c2b153e6504d5376142041f 100755 --- a/src/KOKKOS/pair_sw_kokkos.h +++ b/src/KOKKOS/pair_sw_kokkos.h @@ -83,12 +83,12 @@ class PairSWKokkos : public PairSW { template<int NEIGHFLAG> KOKKOS_INLINE_FUNCTION - void ev_tally3(EV_FLOAT &ev, const int &i, const int &j, int &k, + void ev_tally3(EV_FLOAT &ev, const int &i, const int &j, int &k, const F_FLOAT &evdwl, const F_FLOAT &ecoul, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drki) const; KOKKOS_INLINE_FUNCTION - void ev_tally3_atom(EV_FLOAT &ev, const int &i, + void ev_tally3_atom(EV_FLOAT &ev, const int &i, const F_FLOAT &evdwl, const F_FLOAT &ecoul, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drki) const; diff --git a/src/KOKKOS/pair_table_kokkos.cpp b/src/KOKKOS/pair_table_kokkos.cpp index f0c6068bbee917613248f83b6a760a1a966c703f..a7e01649cc9d04436d710574583f2eba86147655 100644 --- a/src/KOKKOS/pair_table_kokkos.cpp +++ b/src/KOKKOS/pair_table_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "pair_table_kokkos.h" #include "kokkos.h" #include "atom.h" @@ -368,7 +368,7 @@ void PairTableKokkos<DeviceType>::create_kokkos_tables() h_table->f2(i,j) = tb->f2[j]; } - + Kokkos::deep_copy(d_table->nshiftbits,h_table->nshiftbits); Kokkos::deep_copy(d_table->nmask,h_table->nmask); Kokkos::deep_copy(d_table->innersq,h_table->innersq); @@ -465,12 +465,12 @@ void PairTableKokkos<DeviceType>::settings(int narg, char **arg) if (allocated) { memory->destroy(setflag); - + d_table_const.tabindex = d_table->tabindex = typename ArrayTypes<DeviceType>::t_int_2d(); h_table->tabindex = typename ArrayTypes<LMPHostType>::t_int_2d(); - d_table_const.cutsq = d_table->cutsq = typename ArrayTypes<DeviceType>::t_ffloat_2d(); - h_table->cutsq = typename ArrayTypes<LMPHostType>::t_ffloat_2d(); + d_table_const.cutsq = d_table->cutsq = typename ArrayTypes<DeviceType>::t_ffloat_2d(); + h_table->cutsq = typename ArrayTypes<LMPHostType>::t_ffloat_2d(); } allocated = 0; diff --git a/src/KOKKOS/pair_table_kokkos.h b/src/KOKKOS/pair_table_kokkos.h index 17068b3a87360604af26094dc17b4f702a446c55..09e64804b4774a3023e8f9364f2f262750f9c9db 100644 --- a/src/KOKKOS/pair_table_kokkos.h +++ b/src/KOKKOS/pair_table_kokkos.h @@ -49,8 +49,8 @@ class PairTableKokkos : public Pair { virtual ~PairTableKokkos(); virtual void compute(int, int); - - template<int TABSTYLE> + + template<int TABSTYLE> void compute_style(int, int); /*template<int EVFLAG, int NEIGHFLAG, int NEWTON_PAIR, int TABSTYLE> @@ -82,7 +82,7 @@ class PairTableKokkos : public Pair { typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread innersq,invdelta,deltasq6; typename ArrayTypes<DeviceType>::t_ffloat_2d_randomread rsq,drsq,e,de,f,df,e2,f2; };*/ - //Its faster not to use texture fetch if the number of tables is less than 32! + //Its faster not to use texture fetch if the number of tables is less than 32! struct TableDeviceConst { typename ArrayTypes<DeviceType>::t_ffloat_2d cutsq; typename ArrayTypes<DeviceType>::t_int_2d tabindex; @@ -147,7 +147,7 @@ class PairTableKokkos : public Pair { protected: int nlocal,nall,eflag,vflag,neighflag,newton_pair; - + int update_table; void create_kokkos_tables(); void cleanup_copy(); diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index d32e18e66ff689fa7309543efe996a0cd75972f5..76743c8a7e08fdec722ffa4f9d7c6b961390a0a1 100755 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -227,7 +227,7 @@ void PairTersoffKokkos<DeviceType>::compute(int eflag_in, int vflag_in) Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairTersoffComputeFullA<FULL,0> >(0,inum),*this); DeviceType::fence(); ev_all += ev; - + if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairTersoffComputeFullB<FULL,1> >(0,ignum),*this,ev); else @@ -317,7 +317,7 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeHalf<NEIGHFL const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * + const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1) / r; const F_FLOAT eng = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; @@ -335,7 +335,7 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeHalf<NEIGHFL } // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -350,7 +350,7 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeHalf<NEIGHFL bo_ij = 0.0; if (rsq1 > cutsq1) continue; rij = sqrt(rsq1); - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -386,12 +386,12 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeHalf<NEIGHFL if (EVFLAG) { if (eflag) ev.evdwl += eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -477,7 +477,7 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeFullA<NEIGHF const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * + const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1) / r; const F_FLOAT eng = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; @@ -488,13 +488,13 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeFullA<NEIGHF if (EVFLAG) { if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,frep,delx,dely,delz); } } // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -509,7 +509,7 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeFullA<NEIGHF bo_ij = 0.0; if (rsq1 > cutsq1) continue; rij = sqrt(rsq1); - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -542,12 +542,12 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeFullA<NEIGHF if (EVFLAG) { if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -608,7 +608,7 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeFullB<NEIGHF const int jnum = d_numneigh[i]; // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -626,7 +626,7 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeFullB<NEIGHF rij = sqrt(rsq1); j_jnum = d_numneigh[j]; - + for (kk = 0; kk < j_jnum; kk++) { k = d_neighbors(j,kk); if (k == i) continue; @@ -659,14 +659,14 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeFullB<NEIGHF f(i,2) -= delz1*fatt; if (EVFLAG) { - if (eflag) + if (eflag) ev.evdwl += 0.5 * eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < j_jnum; kk++) { k = d_neighbors(j,kk); if (k == i) continue; @@ -718,7 +718,7 @@ void PairTersoffKokkos<DeviceType>::operator()(TagPairTersoffComputeFullB<NEIGHF template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffKokkos<DeviceType>::ters_fc_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { const F_FLOAT ters_R = paramskk(i,j,k).bigr; const F_FLOAT ters_D = paramskk(i,j,k).bigd; @@ -733,7 +733,7 @@ double PairTersoffKokkos<DeviceType>::ters_fc_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffKokkos<DeviceType>::ters_dfc(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { const F_FLOAT ters_R = paramskk(i,j,k).bigr; const F_FLOAT ters_D = paramskk(i,j,k).bigd; @@ -749,7 +749,7 @@ template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffKokkos<DeviceType>::bondorder(const int &i, const int &j, const int &k, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const { F_FLOAT arg, ex_delr; @@ -800,10 +800,10 @@ double PairTersoffKokkos<DeviceType>:: template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffKokkos<DeviceType>::ters_fa_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) + return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * ters_fc_k(i,j,k,r); } @@ -812,7 +812,7 @@ double PairTersoffKokkos<DeviceType>::ters_fa_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffKokkos<DeviceType>::ters_dfa(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; return paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * @@ -824,7 +824,7 @@ double PairTersoffKokkos<DeviceType>::ters_dfa(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffKokkos<DeviceType>::ters_bij_k(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const + const int &k, const F_FLOAT &bo) const { const F_FLOAT tmp = paramskk(i,j,k).beta * bo; if (tmp > paramskk(i,j,k).c1) return 1.0/sqrt(tmp); @@ -841,7 +841,7 @@ double PairTersoffKokkos<DeviceType>::ters_bij_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffKokkos<DeviceType>::ters_dbij(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const + const int &k, const F_FLOAT &bo) const { const F_FLOAT tmp = paramskk(i,j,k).beta * bo; if (tmp > paramskk(i,j,k).c1) return paramskk(i,j,k).beta * -0.5*pow(tmp,-1.5); @@ -1119,7 +1119,7 @@ void PairTersoffKokkos<DeviceType>::ev_tally(EV_FLOAT &ev, const int &i, const i template<class DeviceType> template<int NEIGHFLAG> KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos<DeviceType>::v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, +void PairTersoffKokkos<DeviceType>::v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const { @@ -1191,7 +1191,7 @@ void PairTersoffKokkos<DeviceType>::v_tally3_atom(EV_FLOAT &ev, const int &i, co /* ---------------------------------------------------------------------- */ template<class DeviceType> -KOKKOS_INLINE_FUNCTION +KOKKOS_INLINE_FUNCTION int PairTersoffKokkos<DeviceType>::sbmask(const int& j) const { return j >> SBBITS & 3; } diff --git a/src/KOKKOS/pair_tersoff_kokkos.h b/src/KOKKOS/pair_tersoff_kokkos.h index ad5e04f9df3b361351d9f7ed047d48c3f8d3ddd1..9612bc4d7fa3490fb75c08925e1e28e10d2b1f3c 100755 --- a/src/KOKKOS/pair_tersoff_kokkos.h +++ b/src/KOKKOS/pair_tersoff_kokkos.h @@ -23,7 +23,7 @@ PairStyle(tersoff/kk/host,PairTersoffKokkos<LMPHostType>) #ifndef LMP_PAIR_TERSOFF_KOKKOS_H #define LMP_PAIR_TERSOFF_KOKKOS_H -#include "stdio.h" +#include <stdio.h> #include "pair_kokkos.h" #include "pair_tersoff.h" #include "neigh_list_kokkos.h" @@ -143,7 +143,7 @@ class PairTersoffKokkos : public PairTersoff { void vec3_scaleadd(const F_FLOAT k, const double x[3], const double y[3], double * const z) const { z[0] = k*x[0]+y[0]; z[1] = k*x[1]+y[1]; z[2] = k*x[2]+y[2]; } - + KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const; @@ -152,7 +152,7 @@ class PairTersoffKokkos : public PairTersoff { bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;}; params_ters(int i){powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0; bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;}; - F_FLOAT powerm, gamma, lam3, c, d, h, powern, beta, lam2, bigb, bigr, + F_FLOAT powerm, gamma, lam3, c, d, h, powern, beta, lam2, bigb, bigr, bigd, lam1, biga, cutsq, c1, c2, c3, c4; }; @@ -164,11 +164,11 @@ class PairTersoffKokkos : public PairTersoff { template<int NEIGHFLAG> KOKKOS_INLINE_FUNCTION - void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, + void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const; KOKKOS_INLINE_FUNCTION - void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, + void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; void allocate(); diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index ff84e2d39211ae03c8c30acc0307237301fe593d..57e4882f0fda83667428491a8635f4b0f4f4c8c6 100755 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_mod_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -227,7 +227,7 @@ void PairTersoffMODKokkos<DeviceType>::compute(int eflag_in, int vflag_in) Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairTersoffMODComputeFullA<FULL,0> >(0,inum),*this); DeviceType::fence(); ev_all += ev; - + if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairTersoffMODComputeFullB<FULL,1> >(0,ignum),*this,ev); else @@ -317,7 +317,7 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeHalf<N const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * + const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1) / r; const F_FLOAT eng = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; @@ -335,7 +335,7 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeHalf<N } // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -350,7 +350,7 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeHalf<N bo_ij = 0.0; if (rsq1 > cutsq1) continue; rij = sqrt(rsq1); - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -386,12 +386,12 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeHalf<N if (EVFLAG) { if (eflag) ev.evdwl += eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -477,7 +477,7 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeFullA< const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * + const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1) / r; const F_FLOAT eng = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; @@ -488,13 +488,13 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeFullA< if (EVFLAG) { if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,frep,delx,dely,delz); } } // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -509,7 +509,7 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeFullA< bo_ij = 0.0; if (rsq1 > cutsq1) continue; rij = sqrt(rsq1); - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -542,12 +542,12 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeFullA< if (EVFLAG) { if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -608,7 +608,7 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeFullB< const int jnum = d_numneigh[i]; // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -626,7 +626,7 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeFullB< rij = sqrt(rsq1); j_jnum = d_numneigh[j]; - + for (kk = 0; kk < j_jnum; kk++) { k = d_neighbors(j,kk); if (k == i) continue; @@ -659,14 +659,14 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeFullB< f(i,2) -= delz1*fatt; if (EVFLAG) { - if (eflag) + if (eflag) ev.evdwl += 0.5 * eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < j_jnum; kk++) { k = d_neighbors(j,kk); if (k == i) continue; @@ -718,14 +718,14 @@ void PairTersoffMODKokkos<DeviceType>::operator()(TagPairTersoffMODComputeFullB< template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos<DeviceType>::ters_fc_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { const F_FLOAT ters_R = paramskk(i,j,k).bigr; const F_FLOAT ters_D = paramskk(i,j,k).bigd; if (r < ters_R-ters_D) return 1.0; if (r > ters_R+ters_D) return 0.0; - return 0.5*(1.0 - 1.125*sin(MY_PI2*(r - ters_R)/ters_D) - + return 0.5*(1.0 - 1.125*sin(MY_PI2*(r - ters_R)/ters_D) - 0.125*sin(3.0*MY_PI2*(r - ters_R)/ters_D)); } @@ -734,14 +734,14 @@ double PairTersoffMODKokkos<DeviceType>::ters_fc_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos<DeviceType>::ters_dfc(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { const F_FLOAT ters_R = paramskk(i,j,k).bigr; const F_FLOAT ters_D = paramskk(i,j,k).bigd; if (r < ters_R-ters_D) return 0.0; if (r > ters_R+ters_D) return 0.0; - return -(0.375*MY_PI4/ters_D) * (3.0*cos(MY_PI2*(r - ters_R)/ters_D) + + return -(0.375*MY_PI4/ters_D) * (3.0*cos(MY_PI2*(r - ters_R)/ters_D) + cos(3.0*MY_PI2*(r - ters_R)/ters_D)); } @@ -751,7 +751,7 @@ template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos<DeviceType>::bondorder(const int &i, const int &j, const int &k, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const { F_FLOAT arg, ex_delr; @@ -781,9 +781,9 @@ double PairTersoffMODKokkos<DeviceType>:: const F_FLOAT ters_c5 = paramskk(i,j,k).c5; const F_FLOAT tmp_h = (paramskk(i,j,k).h - cos)*(paramskk(i,j,k).h - cos); - return ters_c1 + (ters_c2*tmp_h/(ters_c3 + tmp_h)) * + return ters_c1 + (ters_c2*tmp_h/(ters_c3 + tmp_h)) * (1.0 + ters_c4*exp(-ters_c5*tmp_h)); - + } /* ---------------------------------------------------------------------- */ @@ -801,7 +801,7 @@ double PairTersoffMODKokkos<DeviceType>:: const F_FLOAT g1 = (paramskk(i,j,k).h - cos)/(ters_c3 + tmp_h); const F_FLOAT g2 = exp(-ters_c5*tmp_h); - return -2.0*ters_c2*g1*((1 + ters_c4*g2)*(1 + g1*(cos - paramskk(i,j,k).h)) - + return -2.0*ters_c2*g1*((1 + ters_c4*g2)*(1 + g1*(cos - paramskk(i,j,k).h)) - tmp_h*ters_c4*ters_c5*g2); } @@ -810,10 +810,10 @@ double PairTersoffMODKokkos<DeviceType>:: template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos<DeviceType>::ters_fa_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) + return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * ters_fc_k(i,j,k,r); } @@ -822,7 +822,7 @@ double PairTersoffMODKokkos<DeviceType>::ters_fa_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos<DeviceType>::ters_dfa(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; return paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * @@ -834,12 +834,12 @@ double PairTersoffMODKokkos<DeviceType>::ters_dfa(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos<DeviceType>::ters_bij_k(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const + const int &k, const F_FLOAT &bo) const { const F_FLOAT tmp = paramskk(i,j,k).beta * bo; - if (tmp > paramskk(i,j,k).ca1) + if (tmp > paramskk(i,j,k).ca1) return pow(tmp, -paramskk(i,j,k).powern/(2.0*paramskk(i,j,k).powern_del)); - if (tmp < paramskk(i,j,k).ca4) + if (tmp < paramskk(i,j,k).ca4) return 1.0; return pow(1.0 + pow(tmp,paramskk(i,j,k).powern), -1.0/(2.0*paramskk(i,j,k).powern_del)); } @@ -849,17 +849,17 @@ double PairTersoffMODKokkos<DeviceType>::ters_bij_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos<DeviceType>::ters_dbij(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const + const int &k, const F_FLOAT &bo) const { const F_FLOAT tmp = paramskk(i,j,k).beta * bo; - if (tmp > paramskk(i,j,k).ca1) + if (tmp > paramskk(i,j,k).ca1) return -0.5*(paramskk(i,j,k).powern/paramskk(i,j,k).powern_del)* pow(tmp,-0.5*(paramskk(i,j,k).powern/paramskk(i,j,k).powern_del)) / bo; - if (tmp < paramskk(i,j,k).ca4) + if (tmp < paramskk(i,j,k).ca4) return 0.0; - + const F_FLOAT tmp_n = pow(tmp,paramskk(i,j,k).powern); - return -0.5 *(paramskk(i,j,k).powern/paramskk(i,j,k).powern_del)* + return -0.5 *(paramskk(i,j,k).powern/paramskk(i,j,k).powern_del)* pow(1.0+tmp_n, -1.0-(1.0/(2.0*paramskk(i,j,k).powern_del)))*tmp_n / bo; } @@ -1125,7 +1125,7 @@ void PairTersoffMODKokkos<DeviceType>::ev_tally(EV_FLOAT &ev, const int &i, cons template<class DeviceType> template<int NEIGHFLAG> KOKKOS_INLINE_FUNCTION -void PairTersoffMODKokkos<DeviceType>::v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, +void PairTersoffMODKokkos<DeviceType>::v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const { @@ -1197,7 +1197,7 @@ void PairTersoffMODKokkos<DeviceType>::v_tally3_atom(EV_FLOAT &ev, const int &i, /* ---------------------------------------------------------------------- */ template<class DeviceType> -KOKKOS_INLINE_FUNCTION +KOKKOS_INLINE_FUNCTION int PairTersoffMODKokkos<DeviceType>::sbmask(const int& j) const { return j >> SBBITS & 3; } diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.h b/src/KOKKOS/pair_tersoff_mod_kokkos.h index 6b1d32d2b4cbe7281281db2c22709dc90248a85a..980b18475b1df4c34beaf7dd125c5e74902dc62c 100755 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.h +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.h @@ -23,7 +23,7 @@ PairStyle(tersoff/mod/kk/host,PairTersoffMODKokkos<LMPHostType>) #ifndef LMP_PAIR_TERSOFF_MOD_KOKKOS_H #define LMP_PAIR_TERSOFF_MOD_KOKKOS_H -#include "stdio.h" +#include <stdio.h> #include "pair_kokkos.h" #include "pair_tersoff_mod.h" #include "neigh_list_kokkos.h" @@ -143,7 +143,7 @@ class PairTersoffMODKokkos : public PairTersoffMOD { void vec3_scaleadd(const F_FLOAT k, const double x[3], const double y[3], double * const z) const { z[0] = k*x[0]+y[0]; z[1] = k*x[1]+y[1]; z[2] = k*x[2]+y[2]; } - + KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const; @@ -152,7 +152,7 @@ class PairTersoffMODKokkos : public PairTersoffMOD { lam1=0;biga=0;powern_del=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;c5=0;ca1=0;ca4=0;}; params_ters(int i){powerm=0;lam3=0;h=0;powern=0;beta=0;lam2=0;bigb=0;bigr=0;bigd=0; lam1=0;biga=0;powern_del=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;c5=0;ca1=0;ca4=0;}; - F_FLOAT powerm, lam3, h, powern, beta, lam2, bigb, bigr, bigd, + F_FLOAT powerm, lam3, h, powern, beta, lam2, bigb, bigr, bigd, lam1, biga, powern_del, cutsq, c1, c2, c3, c4, c5, ca1, ca4; }; @@ -164,11 +164,11 @@ class PairTersoffMODKokkos : public PairTersoffMOD { template<int NEIGHFLAG> KOKKOS_INLINE_FUNCTION - void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, + void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const; KOKKOS_INLINE_FUNCTION - void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, + void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; void allocate(); diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index 12e69e6802a79e4adf63b3b7337cce075aa7a6db..9ab828868577da1187e5c102419862f9a46e46e7 100755 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_zbl_kokkos.h" #include "kokkos.h" #include "atom_kokkos.h" @@ -241,7 +241,7 @@ void PairTersoffZBLKokkos<DeviceType>::compute(int eflag_in, int vflag_in) Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairTersoffZBLComputeFullA<FULL,0> >(0,inum),*this); DeviceType::fence(); ev_all += ev; - + if (evflag) Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairTersoffZBLComputeFullB<FULL,1> >(0,ignum),*this,ev); else @@ -333,19 +333,19 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeHalf<N const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep_t = paramskk(itype,jtype,jtype).biga * tmp_exp * + const F_FLOAT frep_t = paramskk(itype,jtype,jtype).biga * tmp_exp * (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1); const F_FLOAT eng_t = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; // ZBL repulsive portion const F_FLOAT esq = pow(global_e,2.0); - const F_FLOAT a_ij = (0.8854*global_a_0) / + const F_FLOAT a_ij = (0.8854*global_a_0) / (pow(paramskk(itype,jtype,jtype).Z_i,0.23) + pow(paramskk(itype,jtype,jtype).Z_j,0.23)); const F_FLOAT premult = (paramskk(itype,jtype,jtype).Z_i * paramskk(itype,jtype,jtype).Z_j * esq)/ (4.0*MY_PI*global_epsilon_0); const F_FLOAT r_ov_a = r/a_ij; - const F_FLOAT phi = 0.1818*exp(-3.2*r_ov_a) + 0.5099*exp(-0.9423*r_ov_a) + + const F_FLOAT phi = 0.1818*exp(-3.2*r_ov_a) + 0.5099*exp(-0.9423*r_ov_a) + 0.2802*exp(-0.4029*r_ov_a) + 0.02817*exp(-0.2016*r_ov_a); const F_FLOAT dphi = (1.0/a_ij) * (-3.2*0.1818*exp(-3.2*r_ov_a) - 0.9423*0.5099*exp(-0.9423*r_ov_a) - @@ -362,7 +362,7 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeHalf<N fermi_d_k(itype,jtype,jtype,r)*eng_t + fermi_k(itype,jtype,jtype,r)*frep_t) / r; if (eflag) - eng = (1.0 - fermi_k(itype,jtype,jtype,r)) * eng_z + + eng = (1.0 - fermi_k(itype,jtype,jtype,r)) * eng_z + fermi_k(itype,jtype,jtype,r) * eng_t; a_f(i,0) += delx*frep; @@ -379,7 +379,7 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeHalf<N } // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -394,7 +394,7 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeHalf<N bo_ij = 0.0; if (rsq1 > cutsq1) continue; rij = sqrt(rsq1); - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -430,12 +430,12 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeHalf<N if (EVFLAG) { if (eflag) ev.evdwl += eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -523,19 +523,19 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullA< const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep_t = paramskk(itype,jtype,jtype).biga * tmp_exp * + const F_FLOAT frep_t = paramskk(itype,jtype,jtype).biga * tmp_exp * (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1); const F_FLOAT eng_t = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; // ZBL repulsive portion const F_FLOAT esq = pow(global_e,2.0); - const F_FLOAT a_ij = (0.8854*global_a_0) / + const F_FLOAT a_ij = (0.8854*global_a_0) / (pow(paramskk(itype,jtype,jtype).Z_i,0.23) + pow(paramskk(itype,jtype,jtype).Z_j,0.23)); const F_FLOAT premult = (paramskk(itype,jtype,jtype).Z_i * paramskk(itype,jtype,jtype).Z_j * esq)/ (4.0*MY_PI*global_epsilon_0); const F_FLOAT r_ov_a = r/a_ij; - const F_FLOAT phi = 0.1818*exp(-3.2*r_ov_a) + 0.5099*exp(-0.9423*r_ov_a) + + const F_FLOAT phi = 0.1818*exp(-3.2*r_ov_a) + 0.5099*exp(-0.9423*r_ov_a) + 0.2802*exp(-0.4029*r_ov_a) + 0.02817*exp(-0.2016*r_ov_a); const F_FLOAT dphi = (1.0/a_ij) * (-3.2*0.1818*exp(-3.2*r_ov_a) - 0.9423*0.5099*exp(-0.9423*r_ov_a) - @@ -552,7 +552,7 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullA< fermi_d_k(itype,jtype,jtype,r)*eng_t + fermi_k(itype,jtype,jtype,r)*frep_t) / r; if (eflag) - eng = (1.0 - fermi_k(itype,jtype,jtype,r)) * eng_z + + eng = (1.0 - fermi_k(itype,jtype,jtype,r)) * eng_z + fermi_k(itype,jtype,jtype,r) * eng_t; f(i,0) += delx*frep; @@ -562,13 +562,13 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullA< if (EVFLAG) { if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,frep,delx,dely,delz); } } // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -583,7 +583,7 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullA< bo_ij = 0.0; if (rsq1 > cutsq1) continue; rij = sqrt(rsq1); - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -616,12 +616,12 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullA< if (EVFLAG) { if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < jnum; kk++) { if (jj == kk) continue; k = d_neighbors(i,kk); @@ -682,7 +682,7 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullB< const int jnum = d_numneigh[i]; // attractive: bond order - + for (jj = 0; jj < jnum; jj++) { j = d_neighbors(i,jj); j &= NEIGHMASK; @@ -700,7 +700,7 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullB< rij = sqrt(rsq1); j_jnum = d_numneigh[j]; - + for (kk = 0; kk < j_jnum; kk++) { k = d_neighbors(j,kk); if (k == i) continue; @@ -733,14 +733,14 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullB< f(i,2) -= delz1*fatt; if (EVFLAG) { - if (eflag) + if (eflag) ev.evdwl += 0.5 * eng; - if (vflag_either || eflag_atom) + if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force - + for (kk = 0; kk < j_jnum; kk++) { k = d_neighbors(j,kk); if (k == i) continue; @@ -792,7 +792,7 @@ void PairTersoffZBLKokkos<DeviceType>::operator()(TagPairTersoffZBLComputeFullB< template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::ters_fc_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { const F_FLOAT ters_R = paramskk(i,j,k).bigr; const F_FLOAT ters_D = paramskk(i,j,k).bigd; @@ -807,7 +807,7 @@ double PairTersoffZBLKokkos<DeviceType>::ters_fc_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::ters_dfc(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { const F_FLOAT ters_R = paramskk(i,j,k).bigr; const F_FLOAT ters_D = paramskk(i,j,k).bigd; @@ -823,7 +823,7 @@ template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::bondorder(const int &i, const int &j, const int &k, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const { F_FLOAT arg, ex_delr; @@ -874,10 +874,10 @@ double PairTersoffZBLKokkos<DeviceType>:: template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::ters_fa_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) + return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * ters_fc_k(i,j,k,r) * fermi_k(i,j,k,r); } @@ -886,12 +886,12 @@ double PairTersoffZBLKokkos<DeviceType>::ters_fa_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::ters_dfa(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; return paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * - (paramskk(i,j,k).lam2 * ters_fc_k(i,j,k,r) * fermi_k(i,j,k,r) - - ters_dfc(i,j,k,r) * fermi_k(i,j,k,r) - ters_fc_k(i,j,k,r) * + (paramskk(i,j,k).lam2 * ters_fc_k(i,j,k,r) * fermi_k(i,j,k,r) - + ters_dfc(i,j,k,r) * fermi_k(i,j,k,r) - ters_fc_k(i,j,k,r) * fermi_d_k(i,j,k,r)); } @@ -900,7 +900,7 @@ double PairTersoffZBLKokkos<DeviceType>::ters_dfa(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::ters_bij_k(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const + const int &k, const F_FLOAT &bo) const { const F_FLOAT tmp = paramskk(i,j,k).beta * bo; if (tmp > paramskk(i,j,k).c1) return 1.0/sqrt(tmp); @@ -917,7 +917,7 @@ double PairTersoffZBLKokkos<DeviceType>::ters_bij_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::ters_dbij(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const + const int &k, const F_FLOAT &bo) const { const F_FLOAT tmp = paramskk(i,j,k).beta * bo; if (tmp > paramskk(i,j,k).c1) return paramskk(i,j,k).beta * -0.5*pow(tmp,-1.5); @@ -1128,7 +1128,7 @@ void PairTersoffZBLKokkos<DeviceType>::ters_dthbk( template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::fermi_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { return 1.0 / (1.0 + exp(-paramskk(i,j,k).ZBLexpscale * (r - paramskk(i,j,k).ZBLcut))); @@ -1139,11 +1139,11 @@ double PairTersoffZBLKokkos<DeviceType>::fermi_k(const int &i, const int &j, template<class DeviceType> KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos<DeviceType>::fermi_d_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const + const int &k, const F_FLOAT &r) const { - return paramskk(i,j,k).ZBLexpscale * exp(-paramskk(i,j,k).ZBLexpscale * + return paramskk(i,j,k).ZBLexpscale * exp(-paramskk(i,j,k).ZBLexpscale * (r - paramskk(i,j,k).ZBLcut)) / - pow(1.0 + exp(-paramskk(i,j,k).ZBLexpscale * + pow(1.0 + exp(-paramskk(i,j,k).ZBLexpscale * (r - paramskk(i,j,k).ZBLcut)),2.0); } @@ -1219,7 +1219,7 @@ void PairTersoffZBLKokkos<DeviceType>::ev_tally(EV_FLOAT &ev, const int &i, cons template<class DeviceType> template<int NEIGHFLAG> KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos<DeviceType>::v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, +void PairTersoffZBLKokkos<DeviceType>::v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const { @@ -1291,7 +1291,7 @@ void PairTersoffZBLKokkos<DeviceType>::v_tally3_atom(EV_FLOAT &ev, const int &i, /* ---------------------------------------------------------------------- */ template<class DeviceType> -KOKKOS_INLINE_FUNCTION +KOKKOS_INLINE_FUNCTION int PairTersoffZBLKokkos<DeviceType>::sbmask(const int& j) const { return j >> SBBITS & 3; } diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.h b/src/KOKKOS/pair_tersoff_zbl_kokkos.h index a7f21e3eee1ef80f5763453e1a6eda657e107eb5..03e14b43e78cb18b570abe62c679e86c666a06fa 100755 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.h +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.h @@ -23,7 +23,7 @@ PairStyle(tersoff/zbl/kk/host,PairTersoffZBLKokkos<LMPHostType>) #ifndef LMP_PAIR_TERSOFF_ZBL_KOKKOS_H #define LMP_PAIR_TERSOFF_ZBL_KOKKOS_H -#include "stdio.h" +#include <stdio.h> #include "pair_kokkos.h" #include "pair_tersoff_zbl.h" #include "neigh_list_kokkos.h" @@ -143,7 +143,7 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { void vec3_scaleadd(const F_FLOAT k, const double x[3], const double y[3], double * const z) const { z[0] = k*x[0]+y[0]; z[1] = k*x[1]+y[1]; z[2] = k*x[2]+y[2]; } - + KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const; @@ -152,7 +152,7 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;Z_i=0;Z_j=0;ZBLcut=0;ZBLexpscale=0;}; params_ters(int i){powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0; bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;Z_i=0;Z_j=0;ZBLcut=0;ZBLexpscale=0;}; - F_FLOAT powerm, gamma, lam3, c, d, h, powern, beta, lam2, bigb, bigr, + F_FLOAT powerm, gamma, lam3, c, d, h, powern, beta, lam2, bigb, bigr, bigd, lam1, biga, cutsq, c1, c2, c3, c4, Z_i, Z_j, ZBLcut, ZBLexpscale; }; @@ -164,11 +164,11 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { template<int NEIGHFLAG> KOKKOS_INLINE_FUNCTION - void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, + void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const; KOKKOS_INLINE_FUNCTION - void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, + void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; void allocate(); diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp index 3d69547f34bc2fbd4b8f28d36cd8624219f04b53..67e852a7d944a7af92f68faafefd464757cec6ae 100644 --- a/src/KOKKOS/verlet_kokkos.cpp +++ b/src/KOKKOS/verlet_kokkos.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "verlet_kokkos.h" #include "neighbor.h" #include "domain.h" @@ -42,7 +42,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ VerletKokkos::VerletKokkos(LAMMPS *lmp, int narg, char **arg) : - Verlet(lmp, narg, arg) + Verlet(lmp, narg, arg) { atomKK = (AtomKokkos *) atom; } diff --git a/src/KOKKOS/verlet_kokkos.h b/src/KOKKOS/verlet_kokkos.h index 2c7bad1efbd3d91cd3e8fe70c966acf2e60ac436..4b64ced5676062904f8eebf675f31c71f1346af5 100644 --- a/src/KOKKOS/verlet_kokkos.h +++ b/src/KOKKOS/verlet_kokkos.h @@ -33,7 +33,7 @@ class VerletKokkos : public Verlet { void run(int); protected: - + void force_clear(); }; diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index 386523c364ff9262cc87943b0c3b2ccfadf95090..f3a4188de9ae041309a454f621026c514f2d6151 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -18,11 +18,11 @@ triclinic added by Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "stdio.h" -#include "string.h" -#include "math.h" +#include <mpi.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> #include "ewald.h" #include "atom.h" #include "comm.h" @@ -86,7 +86,7 @@ void Ewald::init() } // error check - + triclinic_check(); if (domain->dimension == 2) error->all(FLERR,"Cannot use Ewald with 2d simulation"); @@ -252,19 +252,19 @@ void Ewald::setup() kmax = MAX(kxmax,kymax); kmax = MAX(kmax,kzmax); kmax3d = 4*kmax*kmax*kmax + 6*kmax*kmax + 3*kmax; - + double gsqxmx = unitk[0]*unitk[0]*kxmax*kxmax; double gsqymx = unitk[1]*unitk[1]*kymax*kymax; double gsqzmx = unitk[2]*unitk[2]*kzmax*kzmax; gsqmx = MAX(gsqxmx,gsqymx); gsqmx = MAX(gsqmx,gsqzmx); - + kxmax_orig = kxmax; kymax_orig = kymax; kzmax_orig = kzmax; // scale lattice vectors for triclinic skew - + if (triclinic) { double tmp[3]; tmp[0] = kxmax/xprd; @@ -274,7 +274,7 @@ void Ewald::setup() kxmax = MAX(1,static_cast<int>(tmp[0])); kymax = MAX(1,static_cast<int>(tmp[1])); kzmax = MAX(1,static_cast<int>(tmp[2])); - + kmax = MAX(kxmax,kymax); kmax = MAX(kmax,kzmax); kmax3d = 4*kmax*kmax*kmax + 6*kmax*kmax + 3*kmax; @@ -285,7 +285,7 @@ void Ewald::setup() kxmax = kx_ewald; kymax = ky_ewald; kzmax = kz_ewald; - + kxmax_orig = kxmax; kymax_orig = kymax; kzmax_orig = kzmax; @@ -354,18 +354,18 @@ void Ewald::compute(int eflag, int vflag) if (eflag || vflag) ev_setup(eflag,vflag); else evflag = evflag_atom = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; - - // if atom count has changed, update qsum and qsqsum + + // if atom count has changed, update qsum and qsqsum if (atom->natoms != natoms_original) { qsum_qsq(); natoms_original = atom->natoms; } - + // return if there are no charges - + if (qsqsum == 0.0) return; - + // extend size of per-atom arrays if necessary if (atom->nlocal > nmax) { @@ -1012,7 +1012,7 @@ void Ewald::coeffs() } /* ---------------------------------------------------------------------- - pre-compute coefficients for each Ewald K-vector for a triclinic + pre-compute coefficients for each Ewald K-vector for a triclinic system ------------------------------------------------------------------------- */ @@ -1395,7 +1395,7 @@ void Ewald::slabcorr_groups(int groupbit_A, int groupbit_B, int AA_flag) if (!((mask[i] & groupbit_A) && (mask[i] & groupbit_B))) if (AA_flag) continue; - if (mask[i] & groupbit_A) { + if (mask[i] & groupbit_A) { qsum_A += q[i]; dipole_A += q[i]*x[i][2]; dipole_r2_A += q[i]*x[i][2]*x[i][2]; diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 2f0874cf117f527a97e425bf7feac3c1a60b2264..c1a8d81e00ee53a1bf09d39860ec8ef93e6b20a9 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -15,11 +15,11 @@ Contributing authors: Pieter in 't Veld (SNL), Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> #include "ewald_disp.h" #include "math_vector.h" #include "math_const.h" @@ -195,8 +195,8 @@ void EwaldDisp::init() //Try Newton Solver //Use old method to get guess g_ewald = (1.35 - 0.15*log(accuracy))/ *cutoff; - - double g_ewald_new = + + double g_ewald_new = NewtonSolve(g_ewald,(*cutoff),natoms,shape_det(domain->h),b2); if (g_ewald_new > 0.0) g_ewald = g_ewald_new; else error->warning(FLERR,"Ewald/disp Newton solver failed, " @@ -205,7 +205,7 @@ void EwaldDisp::init() //Try Newton Solver //Use old method to get guess g_ewald = (1.35 - 0.15*log(accuracy))/ *cutoff; - double g_ewald_new = + double g_ewald_new = NewtonSolve(g_ewald,(*cutoff),natoms,shape_det(domain->h),M2); if (g_ewald_new > 0.0) g_ewald = g_ewald_new; else error->warning(FLERR,"Ewald/disp Newton solver failed, " @@ -289,7 +289,7 @@ void EwaldDisp::setup() compute RMS accuracy for a dimension ------------------------------------------------------------------------- */ -double EwaldDisp::rms(int km, double prd, bigint natoms, +double EwaldDisp::rms(int km, double prd, bigint natoms, double q2, double b2, double M2) { double value = 0.0; @@ -930,7 +930,7 @@ void EwaldDisp::compute_energy() if (func[0]) { // 1/r sum[0] += *(ke++)*(cek->re*cek->re+cek->im*cek->im); if (func[3]) cek_coul = cek; - ++cek; + ++cek; } if (func[1]) { // geometric 1/r^6 sum[1] += *(ke++)*(cek->re*cek->re+cek->im*cek->im); ++cek; } @@ -1161,7 +1161,7 @@ void EwaldDisp::compute_virial_dipole() ++cek; } if (func[1]) { // geometric 1/r^6 - ke++; + ke++; ++cek; } if (func[2]) { // arithmetic 1/r^6 @@ -1404,7 +1404,7 @@ void EwaldDisp::compute_slabcorr() double ffact = qscale * (-4.0*MY_PI/volume); double **f = atom->f; - for (int i = 0; i < nlocal; i++) + for (int i = 0; i < nlocal; i++) f[i][2] += ffact * q[i]*(dipole_all - qsum*x[i][2]); // add on torque corrections @@ -1423,7 +1423,7 @@ void EwaldDisp::compute_slabcorr() Newton solver used to find g_ewald for LJ systems ------------------------------------------------------------------------- */ -double EwaldDisp::NewtonSolve(double x, double Rc, +double EwaldDisp::NewtonSolve(double x, double Rc, bigint natoms, double vol, double b2) { double dx,tol; @@ -1474,7 +1474,7 @@ double EwaldDisp::f(double x, double Rc, bigint natoms, double vol, double b2) Calculate numerical derivative f'(x) ------------------------------------------------------------------------- */ -double EwaldDisp::derivf(double x, double Rc, +double EwaldDisp::derivf(double x, double Rc, bigint natoms, double vol, double b2) { double h = 0.000001; //Derivative step-size diff --git a/src/KSPACE/fft3d.cpp b/src/KSPACE/fft3d.cpp index 50ed97fa93d611d761eea3c5e4f019f4d4e17787..a0896ed22da05dde9e25f8853eca0dd5efffe772 100644 --- a/src/KSPACE/fft3d.cpp +++ b/src/KSPACE/fft3d.cpp @@ -19,10 +19,10 @@ Paul Coffman (IBM) added MPI collectives remap ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include <mpi.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> #include "fft3d.h" #include "remap.h" diff --git a/src/KSPACE/fft3d.h b/src/KSPACE/fft3d.h index 34a7bcf9d6af953ca07adc269b68d994e8a8a749..ed3b597f339651ef915f42644f0b30d99ce28965 100644 --- a/src/KSPACE/fft3d.h +++ b/src/KSPACE/fft3d.h @@ -314,10 +314,10 @@ struct fft_plan_3d { // function prototypes -extern "C" { +extern "C" { void fft_3d(FFT_DATA *, FFT_DATA *, int, struct fft_plan_3d *); struct fft_plan_3d *fft_3d_create_plan(MPI_Comm, int, int, int, - int, int, int, int, int, + int, int, int, int, int, int, int, int, int, int, int, int, int, int, int *, int); void fft_3d_destroy_plan(struct fft_plan_3d *); diff --git a/src/KSPACE/fft3d_wrap.cpp b/src/KSPACE/fft3d_wrap.cpp index fb5d3e3d2bd3ee90845629a4eb71ed744aca7fde..b9a6f0ae4659b1fc93dd9154ae95a2b7fb75da6a 100644 --- a/src/KSPACE/fft3d_wrap.cpp +++ b/src/KSPACE/fft3d_wrap.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "fft3d_wrap.h" #include "error.h" diff --git a/src/KSPACE/fix_tune_kspace.cpp b/src/KSPACE/fix_tune_kspace.cpp index 9c7552f20ce31f00959f47560d1edd02cfcff0d1..2dbed26941467cbb05491cb5772ffc9bb153883e 100644 --- a/src/KSPACE/fix_tune_kspace.cpp +++ b/src/KSPACE/fix_tune_kspace.cpp @@ -15,8 +15,8 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_tune_kspace.h" #include "update.h" #include "domain.h" @@ -84,9 +84,9 @@ int FixTuneKspace::setmask() void FixTuneKspace::init() { - if (!force->kspace) + if (!force->kspace) error->all(FLERR,"Cannot use fix tune/kspace without a kspace style"); - if (!force->pair) + if (!force->pair) error->all(FLERR,"Cannot use fix tune/kspace without a pair style"); double old_acc = force->kspace->accuracy/force->kspace->two_charge_force; @@ -219,7 +219,7 @@ void FixTuneKspace::store_old_kspace_settings() update the pair style if necessary, preserving the settings ------------------------------------------------------------------------- */ -void FixTuneKspace::update_pair_style(char *new_pair_style, +void FixTuneKspace::update_pair_style(char *new_pair_style, double pair_cut_coul) { int itmp; @@ -254,7 +254,7 @@ void FixTuneKspace::update_pair_style(char *new_pair_style, update the kspace style if necessary ------------------------------------------------------------------------- */ -void FixTuneKspace::update_kspace_style(char *new_kspace_style, +void FixTuneKspace::update_kspace_style(char *new_kspace_style, char *new_acc_str) { // create kspace style char string diff --git a/src/KSPACE/fix_tune_kspace.h b/src/KSPACE/fix_tune_kspace.h index b99b7a0851530697432c5e88f0cdb0498db533da..3311bd1d430ee35c12c9c20aaa090d975efc8611 100644 --- a/src/KSPACE/fix_tune_kspace.h +++ b/src/KSPACE/fix_tune_kspace.h @@ -20,7 +20,7 @@ FixStyle(tune/kspace,FixTuneKspace) #ifndef LMP_FIX_TUNE_KSPACE_H #define LMP_FIX_TUNE_KSPACE_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/KSPACE/gridcomm.cpp b/src/KSPACE/gridcomm.cpp index 1ae7849a7a1c45d660307f800287e325a6d84d9f..ba08c9be2675cbae8c02365f2b0590a2d0bc7acd 100644 --- a/src/KSPACE/gridcomm.cpp +++ b/src/KSPACE/gridcomm.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "gridcomm.h" #include "comm.h" #include "kspace.h" @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; GridComm::GridComm(LAMMPS *lmp, MPI_Comm gcomm, int forward, int reverse, int ixlo, int ixhi, int iylo, int iyhi, int izlo, int izhi, int oxlo, int oxhi, int oylo, int oyhi, int ozlo, int ozhi, - int pxlo, int pxhi, int pylo, int pyhi, int pzlo, int pzhi) + int pxlo, int pxhi, int pylo, int pyhi, int pzlo, int pzhi) : Pointers(lmp) { gridcomm = gcomm; @@ -74,9 +74,9 @@ GridComm::GridComm(LAMMPS *lmp, MPI_Comm gcomm, int forward, int reverse, GridComm::GridComm(LAMMPS *lmp, MPI_Comm gcomm, int forward, int reverse, int ixlo, int ixhi, int iylo, int iyhi, int izlo, int izhi, int oxlo, int oxhi, int oylo, int oyhi, int ozlo, int ozhi, - int oxlo_max, int oxhi_max, int oylo_max, int oyhi_max, + int oxlo_max, int oxhi_max, int oylo_max, int oyhi_max, int ozlo_max, int ozhi_max, - int pxlo, int pxhi, int pylo, int pyhi, int pzlo, int pzhi) + int pxlo, int pxhi, int pylo, int pyhi, int pzlo, int pzhi) : Pointers(lmp) { gridcomm = gcomm; @@ -194,7 +194,7 @@ int GridComm::ghost_overlap() if (ghostyhi > inyhi-inylo+1) nearest = 1; if (ghostzlo > inzhi-inzlo+1) nearest = 1; if (ghostzhi > inzhi-inzlo+1) nearest = 1; - + int nearest_all; MPI_Allreduce(&nearest,&nearest_all,1,MPI_INT,MPI_MIN,gridcomm); @@ -230,14 +230,14 @@ void GridComm::setup() while (notdone) { if (nswap == maxswap) { maxswap += SWAPDELTA; - swap = (Swap *) + swap = (Swap *) memory->srealloc(swap,maxswap*sizeof(Swap),"Commgrid:swap"); } swap[nswap].sendproc = procxlo; swap[nswap].recvproc = procxhi; sendplanes = MIN(sendlast-sendfirst+1,ghostxlo-nsent); - swap[nswap].npack = + swap[nswap].npack = indices(swap[nswap].packlist, sendfirst,sendfirst+sendplanes-1,inylo,inyhi,inzlo,inzhi); @@ -246,7 +246,7 @@ void GridComm::setup() &recvplanes,1,MPI_INT,procxhi,0,gridcomm,MPI_STATUS_IGNORE); else recvplanes = sendplanes; - swap[nswap].nunpack = + swap[nswap].nunpack = indices(swap[nswap].unpacklist, recvfirst,recvfirst+recvplanes-1,inylo,inyhi,inzlo,inzhi); @@ -272,14 +272,14 @@ void GridComm::setup() while (notdone) { if (nswap == maxswap) { maxswap += 1; - swap = (Swap *) + swap = (Swap *) memory->srealloc(swap,maxswap*sizeof(Swap),"Commgrid:swap"); } swap[nswap].sendproc = procxhi; swap[nswap].recvproc = procxlo; sendplanes = MIN(sendlast-sendfirst+1,ghostxhi-nsent); - swap[nswap].npack = + swap[nswap].npack = indices(swap[nswap].packlist, sendlast-sendplanes+1,sendlast,inylo,inyhi,inzlo,inzhi); @@ -288,7 +288,7 @@ void GridComm::setup() &recvplanes,1,MPI_INT,procxlo,0,gridcomm,MPI_STATUS_IGNORE); else recvplanes = sendplanes; - swap[nswap].nunpack = + swap[nswap].nunpack = indices(swap[nswap].unpacklist, recvlast-recvplanes+1,recvlast,inylo,inyhi,inzlo,inzhi); @@ -314,14 +314,14 @@ void GridComm::setup() while (notdone) { if (nswap == maxswap) { maxswap += SWAPDELTA; - swap = (Swap *) + swap = (Swap *) memory->srealloc(swap,maxswap*sizeof(Swap),"Commgrid:swap"); } swap[nswap].sendproc = procylo; swap[nswap].recvproc = procyhi; sendplanes = MIN(sendlast-sendfirst+1,ghostylo-nsent); - swap[nswap].npack = + swap[nswap].npack = indices(swap[nswap].packlist, outxlo,outxhi,sendfirst,sendfirst+sendplanes-1,inzlo,inzhi); @@ -330,7 +330,7 @@ void GridComm::setup() &recvplanes,1,MPI_INT,procyhi,0,gridcomm,MPI_STATUS_IGNORE); else recvplanes = sendplanes; - swap[nswap].nunpack = + swap[nswap].nunpack = indices(swap[nswap].unpacklist, outxlo,outxhi,recvfirst,recvfirst+recvplanes-1,inzlo,inzhi); @@ -356,14 +356,14 @@ void GridComm::setup() while (notdone) { if (nswap == maxswap) { maxswap += 1; - swap = (Swap *) + swap = (Swap *) memory->srealloc(swap,maxswap*sizeof(Swap),"Commgrid:swap"); } swap[nswap].sendproc = procyhi; swap[nswap].recvproc = procylo; sendplanes = MIN(sendlast-sendfirst+1,ghostyhi-nsent); - swap[nswap].npack = + swap[nswap].npack = indices(swap[nswap].packlist, outxlo,outxhi,sendlast-sendplanes+1,sendlast,inzlo,inzhi); @@ -372,7 +372,7 @@ void GridComm::setup() &recvplanes,1,MPI_INT,procylo,0,gridcomm,MPI_STATUS_IGNORE); else recvplanes = sendplanes; - swap[nswap].nunpack = + swap[nswap].nunpack = indices(swap[nswap].unpacklist, outxlo,outxhi,recvlast-recvplanes+1,recvlast,inzlo,inzhi); @@ -398,14 +398,14 @@ void GridComm::setup() while (notdone) { if (nswap == maxswap) { maxswap += SWAPDELTA; - swap = (Swap *) + swap = (Swap *) memory->srealloc(swap,maxswap*sizeof(Swap),"Commgrid:swap"); } swap[nswap].sendproc = proczlo; swap[nswap].recvproc = proczhi; sendplanes = MIN(sendlast-sendfirst+1,ghostzlo-nsent); - swap[nswap].npack = + swap[nswap].npack = indices(swap[nswap].packlist, outxlo,outxhi,outylo,outyhi,sendfirst,sendfirst+sendplanes-1); @@ -414,7 +414,7 @@ void GridComm::setup() &recvplanes,1,MPI_INT,proczhi,0,gridcomm,MPI_STATUS_IGNORE); else recvplanes = sendplanes; - swap[nswap].nunpack = + swap[nswap].nunpack = indices(swap[nswap].unpacklist, outxlo,outxhi,outylo,outyhi,recvfirst,recvfirst+recvplanes-1); @@ -440,14 +440,14 @@ void GridComm::setup() while (notdone) { if (nswap == maxswap) { maxswap += 1; - swap = (Swap *) + swap = (Swap *) memory->srealloc(swap,maxswap*sizeof(Swap),"Commgrid:swap"); } swap[nswap].sendproc = proczhi; swap[nswap].recvproc = proczlo; sendplanes = MIN(sendlast-sendfirst+1,ghostzhi-nsent); - swap[nswap].npack = + swap[nswap].npack = indices(swap[nswap].packlist, outxlo,outxhi,outylo,outyhi,sendlast-sendplanes+1,sendlast); @@ -456,7 +456,7 @@ void GridComm::setup() &recvplanes,1,MPI_INT,proczlo,0,gridcomm,MPI_STATUS_IGNORE); else recvplanes = sendplanes; - swap[nswap].nunpack = + swap[nswap].nunpack = indices(swap[nswap].unpacklist, outxlo,outxhi,outylo,outyhi,recvlast-recvplanes+1,recvlast); @@ -490,7 +490,7 @@ void GridComm::setup() void GridComm::forward_comm(KSpace *kspace, int which) { for (int m = 0; m < nswap; m++) { - if (swap[m].sendproc == me) + if (swap[m].sendproc == me) kspace->pack_forward(which,buf2,swap[m].npack,swap[m].packlist); else kspace->pack_forward(which,buf1,swap[m].npack,swap[m].packlist); @@ -502,7 +502,7 @@ void GridComm::forward_comm(KSpace *kspace, int which) swap[m].sendproc,0,gridcomm); MPI_Wait(&request,MPI_STATUS_IGNORE); } - + kspace->unpack_forward(which,buf2,swap[m].nunpack,swap[m].unpacklist); } } @@ -515,7 +515,7 @@ void GridComm::forward_comm(KSpace *kspace, int which) void GridComm::reverse_comm(KSpace *kspace, int which) { for (int m = nswap-1; m >= 0; m--) { - if (swap[m].recvproc == me) + if (swap[m].recvproc == me) kspace->pack_reverse(which,buf2,swap[m].nunpack,swap[m].unpacklist); else kspace->pack_reverse(which,buf1,swap[m].nunpack,swap[m].unpacklist); @@ -527,7 +527,7 @@ void GridComm::reverse_comm(KSpace *kspace, int which) swap[m].recvproc,0,gridcomm); MPI_Wait(&request,MPI_STATUS_IGNORE); } - + kspace->unpack_reverse(which,buf2,swap[m].npack,swap[m].packlist); } } @@ -538,7 +538,7 @@ void GridComm::reverse_comm(KSpace *kspace, int which) outzlo_max:outzhi_max) ------------------------------------------------------------------------- */ -int GridComm::indices(int *&list, +int GridComm::indices(int *&list, int xlo, int xhi, int ylo, int yhi, int zlo, int zhi) { int nmax = (xhi-xlo+1) * (yhi-ylo+1) * (zhi-zlo+1); diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index f4ec380068e27253aecb311f93b36b9a87dce83d..92ed86338cacc90f4ebafd5b7a7a1f58b2309618 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -15,11 +15,11 @@ Contributing authors: Paul Crozier, Stan Moore, Stephen Bond, (all SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> #include "msm.h" #include "atom.h" #include "comm.h" @@ -148,7 +148,7 @@ void MSM::init() triclinic_check(); if (domain->dimension == 2) error->all(FLERR,"Cannot (yet) use MSM with 2d simulation"); - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"MSM can only currently be used with " "comm_style brick"); @@ -165,7 +165,7 @@ void MSM::init() if (order%2 != 0) error->all(FLERR,"MSM order must be 4, 6, 8, or 10"); - if (sizeof(FFT_SCALAR) != 8) + if (sizeof(FFT_SCALAR) != 8) error->all(FLERR,"Cannot (yet) use single precision with MSM " "(remove -DFFT_SINGLE from Makefile and recompile)"); @@ -359,7 +359,7 @@ void MSM::setup() double ay = a; double az = a; - // transform the interaction sphere in box coords to an + // transform the interaction sphere in box coords to an // ellipsoid in lamda (0-1) coords to // get the direct sum interaction limits for a triclinic system @@ -408,7 +408,7 @@ void MSM::setup() else boxlo = domain->boxlo_lamda; - // ghost grid points depend on direct sum interaction limits, + // ghost grid points depend on direct sum interaction limits, // so need to recompute local grid set_grid_local(); @@ -457,17 +457,17 @@ void MSM::compute(int eflag, int vflag) } } - // if atom count has changed, update qsum and qsqsum + // if atom count has changed, update qsum and qsqsum if (atom->natoms != natoms_original) { qsum_qsq(); natoms_original = atom->natoms; } - + // return if there are no charges - + if (qsqsum == 0.0) return; - + // invoke allocate_peratom() if needed for first time if (vflag_atom && !peratom_allocate_flag) { @@ -500,7 +500,7 @@ void MSM::compute(int eflag, int vflag) particle_map(); make_rho(); - // all procs reverse communicate charge density values from + // all procs reverse communicate charge density values from // their ghost grid points // to fully sum contribution in their 3d grid @@ -3136,7 +3136,7 @@ void MSM::get_g_direct() for (ix = nxlo_direct; ix <= nxhi_direct; ix++) { xdiff = ix/delxinv[n]; - // transform grid point pair-wise distance from lamda (0-1) coords to box coords + // transform grid point pair-wise distance from lamda (0-1) coords to box coords if (triclinic) { tmp[0] = xdiff; diff --git a/src/KSPACE/msm.h b/src/KSPACE/msm.h index ef12e460cebe5bf05e886770d0a3a934c3489848..6a0b7d0eebd77b4fafa6423b024fa69fd943db85 100644 --- a/src/KSPACE/msm.h +++ b/src/KSPACE/msm.h @@ -21,7 +21,7 @@ KSpaceStyle(msm,MSM) #define LMP_MSM_H #include "lmptype.h" -#include "mpi.h" +#include <mpi.h> #include "kspace.h" @@ -62,8 +62,8 @@ class MSM : public KSpace { int nlower,nupper; int peratom_allocate_flag; int levels; - - MPI_Comm *world_levels; + + MPI_Comm *world_levels; double ****qgrid; double ****egrid; @@ -85,7 +85,7 @@ class MSM : public KSpace { class GridComm **cg_peratom; class GridComm *cg_all; class GridComm *cg_peratom_all; - + int current_level; int **part2grid; // storage for particle -> grid mapping @@ -221,7 +221,7 @@ The box size has apparently blown up. E: Out of range atoms - cannot compute MSM -One or more atoms are attempting to map their charge to a MSM grid point +One or more atoms are attempting to map their charge to a MSM grid point that is not owned by a processor. This is likely for one of two reasons, both of them bad. First, it may mean that an atom near the boundary of a processor's sub-domain has moved more than 1/2 the diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index 30dcbeb3f6330e2e465e8413e2b10292b67d4222..e7000c26d9b15cfc79f8e07d012f8314a0db2f71 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -15,11 +15,11 @@ Contributing authors: Paul Crozier, Stan Moore, Stephen Bond, (all SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "atom.h" #include "gridcomm.h" #include "domain.h" diff --git a/src/KSPACE/msm_cg.h b/src/KSPACE/msm_cg.h index 47b95dcc8e78c7975f5a7c9e7c82f8995379d09f..2f68e46461fe007852cab8cca5e6e73422ce92ab 100644 --- a/src/KSPACE/msm_cg.h +++ b/src/KSPACE/msm_cg.h @@ -66,7 +66,7 @@ The box size has apparently blown up. E: Out of range atoms - cannot compute MSM -One or more atoms are attempting to map their charge to a MSM grid point +One or more atoms are attempting to map their charge to a MSM grid point that is not owned by a processor. This is likely for one of two reasons, both of them bad. First, it may mean that an atom near the boundary of a processor's sub-domain has moved more than 1/2 the diff --git a/src/KSPACE/pair_born_coul_long.cpp b/src/KSPACE/pair_born_coul_long.cpp index 35b8b517e5f8255177e60c080d7d7ac21c5098ad..15bcd1081b892a610383b8d33c5ef9e1953c698c 100644 --- a/src/KSPACE/pair_born_coul_long.cpp +++ b/src/KSPACE/pair_born_coul_long.cpp @@ -15,10 +15,10 @@ Contributing author: Ahmed Ismail (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_born_coul_long.h" #include "atom.h" #include "comm.h" @@ -381,7 +381,7 @@ void PairBornCoulLong::init_style() g_ewald = force->kspace->g_ewald; neighbor->request(this,instance_me); - + // setup force tables if (ncoultablebits) init_tables(cut_coul,NULL); diff --git a/src/KSPACE/pair_born_coul_msm.cpp b/src/KSPACE/pair_born_coul_msm.cpp index 50779abb0052fe1d44f651a5dd6eb6e404c7a531..6ed120cdc575341614e92e9d82ea2f2c654383a8 100644 --- a/src/KSPACE/pair_born_coul_msm.cpp +++ b/src/KSPACE/pair_born_coul_msm.cpp @@ -15,10 +15,10 @@ Contributing author: Stan Moore (SNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_born_coul_msm.h" #include "atom.h" #include "comm.h" @@ -204,8 +204,8 @@ void PairBornCoulMSM::compute(int eflag, int vflag) for (i = 0; i < 3; i++) virial[i] += force->pair->eng_coul/3.0; for (int i = 0; i < nmax; i++) { f[i][0] += ftmp[i][0]; - f[i][1] += ftmp[i][1]; - f[i][2] += ftmp[i][2]; + f[i][1] += ftmp[i][1]; + f[i][2] += ftmp[i][2]; } } } diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index 08d3ebf3d77b53f07f581278a50f96b39a22020a..683e5bf0045e17f979e9d44e489576ec1fe762aa 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_buck_coul_long.h" #include "atom.h" #include "comm.h" @@ -125,7 +125,7 @@ void PairBuckCoulLong::compute(int eflag, int vflag) jtype = type[j]; if (rsq < cutsq[itype][jtype]) { - r2inv = 1.0/rsq; + r2inv = 1.0/rsq; if (rsq < cut_coulsq) { if (!ncoultablebits || rsq <= tabinnersq) { r = sqrt(rsq); @@ -251,7 +251,7 @@ void PairBuckCoulLong::settings(int narg, char **arg) void PairBuckCoulLong::coeff(int narg, char **arg) { - if (narg < 5 || narg > 6) + if (narg < 5 || narg > 6) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -360,7 +360,7 @@ void PairBuckCoulLong::init_style() g_ewald = force->kspace->g_ewald; neighbor->request(this,instance_me); - + // setup force tables if (ncoultablebits) init_tables(cut_coul,NULL); diff --git a/src/KSPACE/pair_buck_coul_msm.cpp b/src/KSPACE/pair_buck_coul_msm.cpp index 370845e384e3d92db9e26d7bc9e4b63e42f4214e..e33bdc839c3dfaf4e97223381ba5121450170566 100644 --- a/src/KSPACE/pair_buck_coul_msm.cpp +++ b/src/KSPACE/pair_buck_coul_msm.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_buck_coul_msm.h" #include "atom.h" #include "comm.h" @@ -200,8 +200,8 @@ void PairBuckCoulMSM::compute(int eflag, int vflag) for (i = 0; i < 3; i++) virial[i] += force->pair->eng_coul/3.0; for (int i = 0; i < nmax; i++) { f[i][0] += ftmp[i][0]; - f[i][1] += ftmp[i][1]; - f[i][2] += ftmp[i][2]; + f[i][1] += ftmp[i][1]; + f[i][2] += ftmp[i][2]; } } } diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index 3b8692185403f5a5385953a140170ba0931041a1..52d250fbe180c8d9284d8f8b6eaa804bab777e1f 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -15,10 +15,10 @@ Contributing author: Pieter J. in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "math_vector.h" #include "pair_buck_long_coul_long.h" #include "atom.h" @@ -86,17 +86,17 @@ void PairBuckLongCoulLong::settings(int narg, char **arg) options(arg,6); options(++arg,1); - if (!comm->me && ewald_order == ((1<<1) | (1<<6))) + if (!comm->me && ewald_order == ((1<<1) | (1<<6))) error->warning(FLERR,"Using largest cutoff for buck/long/coul/long"); - if (!*(++arg)) + if (!*(++arg)) error->all(FLERR,"Cutoffs missing in pair_style buck/long/coul/long"); - if (ewald_off & (1<<6)) + if (ewald_off & (1<<6)) error->all(FLERR,"LJ6 off not supported in pair_style buck/long/coul/long"); - if (!((ewald_order^ewald_off) & (1<<1))) + if (!((ewald_order^ewald_off) & (1<<1))) error->all(FLERR, "Coulomb cut not supported in pair_style buck/long/coul/coul"); cut_buck_global = force->numeric(FLERR,*(arg++)); - if (narg == 4 && ((ewald_order & 0x42) == 0x42)) + if (narg == 4 && ((ewald_order & 0x42) == 0x42)) error->all(FLERR,"Only one cutoff allowed when requesting all long"); if (narg == 4) cut_coul = force->numeric(FLERR,*arg); else cut_coul = cut_buck_global; @@ -176,7 +176,7 @@ void *PairBuckLongCoulLong::extract(const char *id, int &dim) const char *ids[] = { "B", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", "cut_LJ", NULL}; void *ptrs[] = { - buck_c, &ewald_order, &cut_coul, &mix_flag, &cut_coul, &cut_buck_global, + buck_c, &ewald_order, &cut_coul, &mix_flag, &cut_coul, &cut_buck_global, NULL}; int i; @@ -192,7 +192,7 @@ void *PairBuckLongCoulLong::extract(const char *id, int &dim) void PairBuckLongCoulLong::coeff(int narg, char **arg) { - if (narg < 5 || narg > 6) + if (narg < 5 || narg > 6) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); diff --git a/src/KSPACE/pair_coul_long.cpp b/src/KSPACE/pair_coul_long.cpp index db46fed21360a8c2a2ecf82c2117de9826f882e8..c1cd14523e59b50b204f6b41821a2a460c635a53 100644 --- a/src/KSPACE/pair_coul_long.cpp +++ b/src/KSPACE/pair_coul_long.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_long.h" #include "atom.h" #include "comm.h" diff --git a/src/KSPACE/pair_coul_msm.cpp b/src/KSPACE/pair_coul_msm.cpp index e27714f59db38400b703c2f82479abb9d226d572..62daee9a13695636aa3f10153bf7e4a2603f143d 100644 --- a/src/KSPACE/pair_coul_msm.cpp +++ b/src/KSPACE/pair_coul_msm.cpp @@ -15,10 +15,10 @@ Contributing authors: Stan Moore (SNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_msm.h" #include "atom.h" #include "comm.h" diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index ea357604d4e377c88bd827c4b62bca7d47896af5..2c709a3ae027cbef88fc3630af87e4affc38bccd 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_charmm_coul_long.h" #include "atom.h" #include "comm.h" diff --git a/src/KSPACE/pair_lj_charmm_coul_msm.cpp b/src/KSPACE/pair_lj_charmm_coul_msm.cpp index a06863fd87afe700d6ae73ae23821c104514e446..e99071f4ef1f7f1b96cb77927eb87c0feb741a36 100644 --- a/src/KSPACE/pair_lj_charmm_coul_msm.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_msm.cpp @@ -15,10 +15,10 @@ Contributing authors: Paul Crozier (SNL), Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_charmm_coul_msm.h" #include "atom.h" #include "comm.h" @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -PairLJCharmmCoulMSM::PairLJCharmmCoulMSM(LAMMPS *lmp) : +PairLJCharmmCoulMSM::PairLJCharmmCoulMSM(LAMMPS *lmp) : PairLJCharmmCoulLong(lmp) { ewaldflag = pppmflag = 0; @@ -135,9 +135,9 @@ void PairLJCharmmCoulMSM::compute(int eflag, int vflag) if (!ncoultablebits || rsq <= tabinnersq) { r = sqrt(rsq); prefactor = qqrd2e * qtmp*q[j]/r; - egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul); - fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul); - forcecoul = prefactor * fgamma; + egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul); + fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul); + forcecoul = prefactor * fgamma; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } else { union_int_float_t rsq_lookup; @@ -240,8 +240,8 @@ void PairLJCharmmCoulMSM::compute(int eflag, int vflag) for (i = 0; i < 3; i++) virial[i] += force->pair->eng_coul/3.0; for (int i = 0; i < nmax; i++) { f[i][0] += ftmp[i][0]; - f[i][1] += ftmp[i][1]; - f[i][2] += ftmp[i][2]; + f[i][1] += ftmp[i][1]; + f[i][2] += ftmp[i][2]; } } } @@ -321,9 +321,9 @@ void PairLJCharmmCoulMSM::compute_outer(int eflag, int vflag) if (!ncoultablebits || rsq <= tabinnersq) { r = sqrt(rsq); prefactor = qqrd2e * qtmp*q[j]/r; - egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul); - fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul); - forcecoul = prefactor * (fgamma - 1.0); + egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul); + fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul); + forcecoul = prefactor * (fgamma - 1.0); if (rsq > cut_in_off_sq) { if (rsq < cut_in_on_sq) { rsw = (r - cut_in_off)/cut_in_diff; @@ -412,7 +412,7 @@ void PairLJCharmmCoulMSM::compute_outer(int eflag, int vflag) if (vflag) { if (rsq < cut_coulsq) { if (!ncoultablebits || rsq <= tabinnersq) { - forcecoul = prefactor * fgamma; + forcecoul = prefactor * fgamma; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } else { table = vtable[itable] + fraction*dvtable[itable]; diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index c113aea83afc69b0d801d96db51cad7e5d44688d..866db6ba659120ab6b17da7a864bea10088c13b9 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_long.h" #include "atom.h" #include "comm.h" diff --git a/src/KSPACE/pair_lj_cut_coul_msm.cpp b/src/KSPACE/pair_lj_cut_coul_msm.cpp index f9fc9be3fcae44d1d8fa53d504cf5cb36a6ecd84..e3b3f58fcbf83355b8a16d9c4c711022ca881684 100644 --- a/src/KSPACE/pair_lj_cut_coul_msm.cpp +++ b/src/KSPACE/pair_lj_cut_coul_msm.cpp @@ -15,10 +15,10 @@ Contributing authors: Stan Moore (SNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_msm.h" #include "atom.h" #include "comm.h" @@ -228,8 +228,8 @@ void PairLJCutCoulMSM::compute(int eflag, int vflag) for (i = 0; i < 3; i++) virial[i] += force->pair->eng_coul/3.0; for (int i = 0; i < nmax; i++) { f[i][0] += ftmp[i][0]; - f[i][1] += ftmp[i][1]; - f[i][2] += ftmp[i][2]; + f[i][1] += ftmp[i][1]; + f[i][2] += ftmp[i][2]; } } } diff --git a/src/KSPACE/pair_lj_cut_tip4p_long.cpp b/src/KSPACE/pair_lj_cut_tip4p_long.cpp index 657d83b75281ccb6c204283784c889b13f3144d4..6e855e41f0418f180e6abc2f13cef1e87d6f0305 100644 --- a/src/KSPACE/pair_lj_cut_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_cut_tip4p_long.cpp @@ -16,10 +16,10 @@ simpler force assignment added by Rolf Isele-Holder (Aachen University) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_tip4p_long.h" #include "angle.h" #include "atom.h" diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 06e77482d2c477fda66f85b873a780dd37de4d55..3675ea76dc36668ff2865f61a59d5c26483c03aa 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -13,14 +13,14 @@ /* ---------------------------------------------------------------------- Contributing author: Pieter J. in 't Veld (SNL) - Tabulation for long-range dispersion added by Wayne Mitchell (Loyola + Tabulation for long-range dispersion added by Wayne Mitchell (Loyola University New Orleans) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "math_vector.h" #include "pair_lj_long_coul_long.h" #include "atom.h" @@ -57,7 +57,7 @@ PairLJLongCoulLong::PairLJLongCoulLong(LAMMPS *lmp) : Pair(lmp) fdisptable = NULL; qdist = 0.0; } - + /* ---------------------------------------------------------------------- global settings ------------------------------------------------------------------------- */ @@ -87,18 +87,18 @@ void PairLJLongCoulLong::settings(int narg, char **arg) options(++arg, 1); if (!comm->me && ewald_order == ((1<<1) | (1<<6))) error->warning(FLERR,"Using largest cutoff for lj/long/coul/long"); - if (!*(++arg)) + if (!*(++arg)) error->all(FLERR,"Cutoffs missing in pair_style lj/long/coul/long"); - if (!((ewald_order^ewald_off) & (1<<1))) + if (!((ewald_order^ewald_off) & (1<<1))) error->all(FLERR, "Coulomb cut not supported in pair_style lj/long/coul/long"); cut_lj_global = force->numeric(FLERR,*(arg++)); - if (narg == 4 && ((ewald_order & 0x42) == 0x42)) + if (narg == 4 && ((ewald_order & 0x42) == 0x42)) error->all(FLERR,"Only one cutoff allowed when requesting all long"); if (narg == 4) cut_coul = force->numeric(FLERR,*arg); else cut_coul = cut_lj_global; - if (allocated) { + if (allocated) { int i,j; for (i = 1; i <= atom->ntypes; i++) for (j = i+1; j <= atom->ntypes; j++) @@ -279,12 +279,12 @@ void PairLJLongCoulLong::init_style() error->all(FLERR,"Pair style requires a KSpace style"); if (force->kspace) g_ewald = force->kspace->g_ewald; if (force->kspace) g_ewald_6 = force->kspace->g_ewald_6; - + // setup force tables - + if (ncoultablebits) init_tables(cut_coul,cut_respa); if (ndisptablebits) init_tables_disp(cut_lj_global); - + } /* ---------------------------------------------------------------------- @@ -598,7 +598,7 @@ void PairLJLongCoulLong::compute(int eflag, int vflag) } } } - + else force_lj = evdwl = 0.0; fpair = (force_coul+force_lj)*r2inv; @@ -808,7 +808,7 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) evdwl = ecoul = 0.0; if (eflag || vflag) ev_setup(eflag,vflag); else evflag = 0; - + double **x = atom->x, *x0 = x[0]; double **f = atom->f, *f0 = f[0], *fi = f0; double *q = atom->q; @@ -818,7 +818,7 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) double *special_lj = force->special_lj; int newton_pair = force->newton_pair; double qqrd2e = force->qqrd2e; - + int i, j, order1 = ewald_order&(1<<1), order6 = ewald_order&(1<<6); int *ineigh, *ineighn, *jneigh, *jneighn, typei, typej, ni, respa_flag; double qi = 0.0, qri = 0.0; @@ -827,16 +827,16 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) double g2 = g_ewald_6*g_ewald_6, g6 = g2*g2*g2, g8 = g6*g2; double respa_lj = 0.0, respa_coul = 0.0, frespa = 0.0; vector xi, d; - + double cut_in_off = cut_respa[2]; double cut_in_on = cut_respa[3]; - + double cut_in_diff = cut_in_on - cut_in_off; double cut_in_off_sq = cut_in_off*cut_in_off; double cut_in_on_sq = cut_in_on*cut_in_on; - + ineighn = (ineigh = listouter->ilist)+listouter->inum; - + for (; ineigh<ineighn; ++ineigh) { // loop over my atoms i = *ineigh; fi = f0+3*i; if (order1) qri = (qi = q[i])*qqrd2e; // initialize constants @@ -845,20 +845,20 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) cutsqi = cutsq[typei]; cut_ljsqi = cut_ljsq[typei]; memcpy(xi, x0+(i+(i<<1)), sizeof(vector)); jneighn = (jneigh = listouter->firstneigh[i])+listouter->numneigh[i]; - + for (; jneigh<jneighn; ++jneigh) { // loop over neighbors j = *jneigh; ni = sbmask(j); j &= NEIGHMASK; - + { register double *xj = x0+(j+(j<<1)); d[0] = xi[0] - xj[0]; // pair vector d[1] = xi[1] - xj[1]; d[2] = xi[2] - xj[2]; } - + if ((rsq = vec_dot(d, d)) >= cutsqi[typej = type[j]]) continue; r2inv = 1.0/rsq; - + frespa = 1.0; // check whether and how to compute respa corrections respa_coul = 0; respa_lj = 0; @@ -867,7 +867,7 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) register double rsw = (sqrt(rsq)-cut_in_off)/cut_in_diff; frespa = 1-rsw*rsw*(3.0-2.0*rsw); } - + if (order1 && (rsq < cut_coulsq)) { // coulombic if (!ncoultablebits || rsq <= tabinnersq) { // series real space register double r = sqrt(rsq), s = qri*q[j]; @@ -908,7 +908,7 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) } } } - + else force_coul = respa_coul = ecoul = 0.0; if (rsq < cut_ljsqi[typej]) { // lennard-jones @@ -964,9 +964,9 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) } } else force_lj = respa_lj = evdwl = 0.0; - + fpair = (force_coul+force_lj)*r2inv; - + if (newton_pair || j < nlocal) { register double *fj = f0+(j+(j<<1)), f; fi[0] += f = d[0]*fpair; fj[0] -= f; @@ -978,7 +978,7 @@ void PairLJLongCoulLong::compute_outer(int eflag, int vflag) fi[1] += d[1]*fpair; fi[2] += d[2]*fpair; } - + if (evflag) { fvirial = (force_coul + force_lj + respa_coul + respa_lj)*r2inv; ev_tally(i,j,nlocal,newton_pair, diff --git a/src/KSPACE/pair_lj_long_coul_long.h b/src/KSPACE/pair_lj_long_coul_long.h index c1628e31327a03b74eee53205f46b15599842dba..22704c79fae39f32039a9d58b053dbf02c78274f 100644 --- a/src/KSPACE/pair_lj_long_coul_long.h +++ b/src/KSPACE/pair_lj_long_coul_long.h @@ -19,7 +19,7 @@ PairStyle(lj/long/coul/long,PairLJLongCoulLong) #ifndef LMP_PAIR_LJ_LONG_COUL_LONG_H #define LMP_PAIR_LJ_LONG_COUL_LONG_H - + #include "pair.h" namespace LAMMPS_NS { diff --git a/src/KSPACE/pair_lj_long_tip4p_long.cpp b/src/KSPACE/pair_lj_long_tip4p_long.cpp index 712d9c35b26511d65bd8b7a88fe0c19af68989e7..b8ce8ece4c12256aab209d4a24b6840e6ab771c2 100755 --- a/src/KSPACE/pair_lj_long_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_long_tip4p_long.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ Rolf Isele-Holder (Aachen University) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_long_tip4p_long.h" #include "angle.h" #include "atom.h" @@ -48,7 +48,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -PairLJLongTIP4PLong::PairLJLongTIP4PLong(LAMMPS *lmp) : +PairLJLongTIP4PLong::PairLJLongTIP4PLong(LAMMPS *lmp) : PairLJLongCoulLong(lmp) { dispersionflag = tip4pflag = 1; @@ -90,7 +90,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) double *x1,*x2; int *ilist,*jlist,*numneigh,**firstneigh; double rsq; - + evdwl = ecoul = 0.0; if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -133,7 +133,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { @@ -180,7 +180,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - + if (rsq < cut_ljsq[itype][jtype]) { // lj r2inv = 1.0/rsq; if (order6) { // long-range lj @@ -198,7 +198,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) register double f = special_lj[ni], t = rn*(1.0-f); forcelj = f*(rn *= rn)*lj1i[jtype]- g8*(((6.0*a2+6.0)*a2+3.0)*a2+1.0)*x2*rsq+t*lj2i[jtype]; - if (eflag) + if (eflag) evdwl = f*rn*lj3i[jtype]-g6*((a2+1.0)*a2+0.5)*x2+t*lj4i[jtype]; } } @@ -245,12 +245,12 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) evdwl,0.0,forcelj,delx,dely,delz); } - + // adjust rsq and delxyz for off-site O charge(s) // ADDITIONAL REQEUST REQUIRED HERE!!!!! if (rsq < cut_coulsqplus) { - if (itype == typeO || jtype == typeO) { + if (itype == typeO || jtype == typeO) { if (jtype == typeO) { if (hneigh[j][0] < 0) { hneigh[j][0] = jH1 = atom->map(tag[j] + 1); @@ -278,7 +278,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) } // test current rsq against cutoff and compute Coulombic force - + if (rsq < cut_coulsq && order1) { r2inv = 1.0 / rsq; if (!ncoultablebits || rsq <= tabinnersq) { @@ -290,7 +290,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) prefactor = qqrd2e * qtmp*q[j]/r; forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); if (factor_coul < 1.0) { - forcecoul -= (1.0-factor_coul)*prefactor; + forcecoul -= (1.0-factor_coul)*prefactor; } } else { union_int_float_t rsq_lookup; @@ -408,7 +408,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) fH[0] = 0.5 * alpha * fd[0]; fH[1] = 0.5 * alpha * fd[1]; - fH[2] = 0.5 * alpha * fd[2]; + fH[2] = 0.5 * alpha * fd[2]; f[j][0] += fO[0]; f[j][1] += fO[1]; @@ -447,7 +447,7 @@ void PairLJLongTIP4PLong::compute(int eflag, int vflag) } if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; } else ecoul = 0.0; - + if (evflag) ev_tally_tip4p(key,vlist,v,ecoul,alpha); } } @@ -512,7 +512,7 @@ void PairLJLongTIP4PLong::compute_inner() ilist = listinner->ilist; numneigh = listinner->numneigh; firstneigh = listinner->firstneigh; - + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { @@ -557,9 +557,9 @@ void PairLJLongTIP4PLong::compute_inner() delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - + if (rsq < cut_ljsq[itype][jtype] && rsq < cut_out_off_sq ) { // lj - r2inv = 1.0/rsq; + r2inv = 1.0/rsq; register double rn = r2inv*r2inv*r2inv; if (ni == 0) forcelj = rn*(rn*lj1i[jtype]-lj2i[jtype]); else { // special case @@ -581,12 +581,12 @@ void PairLJLongTIP4PLong::compute_inner() f[j][2] -= delz*forcelj; } - + // adjust rsq and delxyz for off-site O charge(s) // ADDITIONAL REQEUST REQUIRED HERE!!!!! if (rsq < cut_coulsqplus && order1) { - if (itype == typeO || jtype == typeO) { + if (itype == typeO || jtype == typeO) { if (jtype == typeO) { if (hneigh[j][0] < 0) { hneigh[j][0] = jH1 = atom->map(tag[j] + 1); @@ -614,7 +614,7 @@ void PairLJLongTIP4PLong::compute_inner() } // test current rsq against cutoff and compute Coulombic force - + if (rsq < cut_coulsq && rsq < cut_out_off_sq) { r2inv = 1.0 / rsq; qri = qqrd2e*qtmp; @@ -688,7 +688,7 @@ void PairLJLongTIP4PLong::compute_inner() fH[0] = 0.5 * alpha * fd[0]; fH[1] = 0.5 * alpha * fd[1]; - fH[2] = 0.5 * alpha * fd[2]; + fH[2] = 0.5 * alpha * fd[2]; f[j][0] += fO[0]; f[j][1] += fO[1]; @@ -755,7 +755,7 @@ void PairLJLongTIP4PLong::compute_middle() ilist = listmiddle->ilist; numneigh = listmiddle->numneigh; firstneigh = listmiddle->firstneigh; - + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { @@ -800,9 +800,9 @@ void PairLJLongTIP4PLong::compute_middle() delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - + if (rsq < cut_ljsq[itype][jtype] && rsq >= cut_in_off_sq && rsq <= cut_out_off_sq ) { // lj - r2inv = 1.0/rsq; + r2inv = 1.0/rsq; register double rn = r2inv*r2inv*r2inv; if (ni == 0) forcelj = rn*(rn*lj1i[jtype]-lj2i[jtype]); else { // special case @@ -828,12 +828,12 @@ void PairLJLongTIP4PLong::compute_middle() f[j][2] -= delz*forcelj; } - + // adjust rsq and delxyz for off-site O charge(s) // ADDITIONAL REQEUST REQUIRED HERE!!!!! if (rsq < cut_coulsqplus && order1) { - if (itype == typeO || jtype == typeO) { + if (itype == typeO || jtype == typeO) { if (jtype == typeO) { if (hneigh[j][0] < 0) { hneigh[j][0] = jH1 = atom->map(tag[j] + 1); @@ -861,7 +861,7 @@ void PairLJLongTIP4PLong::compute_middle() } // test current rsq against cutoff and compute Coulombic force - + if (rsq < cut_coulsq && rsq >= cut_in_off_sq && rsq <= cut_out_off_sq) { r2inv = 1.0 / rsq; qri = qqrd2e*qtmp; @@ -939,7 +939,7 @@ void PairLJLongTIP4PLong::compute_middle() fH[0] = 0.5 * alpha * fd[0]; fH[1] = 0.5 * alpha * fd[1]; - fH[2] = 0.5 * alpha * fd[2]; + fH[2] = 0.5 * alpha * fd[2]; f[j][0] += fO[0]; f[j][1] += fO[1]; @@ -974,7 +974,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh; double rsq,qri; int respa_flag; - + evdwl = ecoul = 0.0; if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; @@ -1016,7 +1016,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) double cut_in_off = cut_respa[2]; double cut_in_on = cut_respa[3]; - + double cut_in_diff = cut_in_on - cut_in_off; double cut_in_off_sq = cut_in_off*cut_in_off; double cut_in_on_sq = cut_in_on*cut_in_on; @@ -1025,7 +1025,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) ilist = listouter->ilist; numneigh = listouter->numneigh; firstneigh = listouter->firstneigh; - + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { @@ -1072,7 +1072,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; - + respa_coul = 0; respa_lj = 0; if (rsq < cut_ljsq[itype][jtype]) { // lj @@ -1141,7 +1141,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) f[j][0] -= delx*forcelj; f[j][1] -= dely*forcelj; f[j][2] -= delz*forcelj; - + if (evflag) { fvirial = forcelj + respa_lj*r2inv; ev_tally(i,j,nlocal,newton_pair, @@ -1149,12 +1149,12 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) } } - + // adjust rsq and delxyz for off-site O charge(s) // ADDITIONAL REQEUST REQUIRED HERE!!!!! if (rsq < cut_coulsqplus) { - if (itype == typeO || jtype == typeO) { + if (itype == typeO || jtype == typeO) { if (jtype == typeO) { if (hneigh[j][0] < 0) { hneigh[j][0] = jH1 = atom->map(tag[j] + 1); @@ -1229,7 +1229,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) ecoul = qiqj*(etable[k]+f*detable[k]-t.f); } } - } + } cforce = forcecoul * r2inv; fvirial = (forcecoul + respa_coul) * r2inv; @@ -1342,7 +1342,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) fH[0] = 0.5 * alpha * fd[0]; fH[1] = 0.5 * alpha * fd[1]; - fH[2] = 0.5 * alpha * fd[2]; + fH[2] = 0.5 * alpha * fd[2]; f[j][0] += fO[0]; f[j][1] += fO[1]; @@ -1368,7 +1368,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) fH[0] = 0.5 * alpha * fd[0]; fH[1] = 0.5 * alpha * fd[1]; - fH[2] = 0.5 * alpha * fd[2]; + fH[2] = 0.5 * alpha * fd[2]; domain->closest_image(x[j],x[jH1],xH1); domain->closest_image(x[j],x[jH2],xH2); @@ -1384,7 +1384,7 @@ void PairLJLongTIP4PLong::compute_outer(int eflag, int vflag) vlist[n++] = jH1; vlist[n++] = jH2; } - + if (evflag) ev_tally_tip4p(key,vlist,v,ecoul,alpha); } } @@ -1404,12 +1404,12 @@ void PairLJLongTIP4PLong::settings(int narg, char **arg) ewald_order = 0; options(arg, 6); options(++arg, 1); - if (!comm->me && ewald_order&(1<<6)) + if (!comm->me && ewald_order&(1<<6)) error->warning(FLERR,"Mixing forced for lj coefficients"); - if (!comm->me && ewald_order==((1<<1)|(1<<6))) + if (!comm->me && ewald_order==((1<<1)|(1<<6))) error->warning(FLERR, "Using largest cutoff for pair_style lj/long/tip4p/long"); - if (!((ewald_order^ewald_off)&(1<<1))) + if (!((ewald_order^ewald_off)&(1<<1))) error->all(FLERR, "Coulomb cut not supported in pair_style lj/long/tip4p/long"); typeO = force->inumeric(FLERR,arg[1]); @@ -1422,8 +1422,8 @@ void PairLJLongTIP4PLong::settings(int narg, char **arg) cut_lj_global = force->numeric(FLERR,arg[6]); if (narg == 8) cut_coul = cut_lj_global; else cut_coul = force->numeric(FLERR,arg[7]); - - + + // reset cutoffs that have been explicitly set if (allocated) { @@ -1442,7 +1442,7 @@ void PairLJLongTIP4PLong::init_style() { if (atom->tag_enable == 0) error->all(FLERR,"Pair style lj/long/tip4p/long requires atom IDs"); - if (!force->newton_pair) + if (!force->newton_pair) error->all(FLERR,"Pair style lj/long/tip4p/long requires newton pair on"); if (!atom->q_flag) error->all(FLERR,"Pair style lj/long/tip4p/long requires atom attribute q"); @@ -1573,10 +1573,10 @@ void *PairLJLongTIP4PLong::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; const char *ids[] = { - "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "cut_coul", + "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "cut_coul", "ewald_mix", "cut_LJ", NULL}; void *ptrs[] = { - lj4, sigma, epsilon, &ewald_order, &cut_coul, &cut_coul, + lj4, sigma, epsilon, &ewald_order, &cut_coul, &cut_coul, &mix_flag, &cut_lj_global, NULL}; int i; @@ -1587,7 +1587,7 @@ void *PairLJLongTIP4PLong::extract(const char *str, int &dim) if (strcmp(ids[i],str) == 0) return ptrs[i]; - + ++i; } return NULL; diff --git a/src/KSPACE/pair_lj_long_tip4p_long.h b/src/KSPACE/pair_lj_long_tip4p_long.h index ef929d198e8adf5340dec4f066c8265f8abcbb40..ef86e4ed809ef8e99c4daecf2ef9eceb5cfc21bc 100755 --- a/src/KSPACE/pair_lj_long_tip4p_long.h +++ b/src/KSPACE/pair_lj_long_tip4p_long.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/KSPACE/pair_tip4p_long.cpp b/src/KSPACE/pair_tip4p_long.cpp index fbe146ecf289a21d1ca9ed512724a1cacc5902ee..0753a3f34db267a0e315838881c42a2a9b2ae5d9 100644 --- a/src/KSPACE/pair_tip4p_long.cpp +++ b/src/KSPACE/pair_tip4p_long.cpp @@ -16,10 +16,10 @@ simpler force assignment added by Rolf Isele-Holder (Aachen University) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tip4p_long.h" #include "angle.h" #include "atom.h" diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 434667a3021877204d1c4b4bb70a30bb420d8918..99bae3f41bcd424e3ec66a8243eab2c0ed388ee7 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -18,11 +18,11 @@ triclinic added by Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> #include "pppm.h" #include "atom.h" #include "comm.h" @@ -67,7 +67,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) { if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm command"); - + pppmflag = 1; group_group_enable = 1; @@ -91,7 +91,7 @@ PPPM::PPPM(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) vg = NULL; fkx = fky = fkz = NULL; - sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = + sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = NULL; density_A_brick = density_B_brick = NULL; @@ -182,7 +182,7 @@ void PPPM::init() "slab correction"); if (domain->dimension == 2) error->all(FLERR, "Cannot use PPPM with 2d simulation"); - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"PPPM can only currently be used with " "comm_style brick"); @@ -304,7 +304,7 @@ void PPPM::init() order--; iteration++; } - + if (order < minorder) error->all(FLERR,"PPPM order < minimum allowed order"); if (!overlap_allowed && cgtmp->ghost_overlap()) error->all(FLERR,"PPPM grid stencil extends " @@ -623,11 +623,11 @@ void PPPM::compute(int eflag, int vflag) qsum_qsq(); natoms_original = atom->natoms; } - + // return if there are no charges - + if (qsqsum == 0.0) return; - + // convert atoms from box to lamda coords if (triclinic == 0) boxlo = domain->boxlo; @@ -673,7 +673,7 @@ void PPPM::compute(int eflag, int vflag) // extra per-atom energy/virial communication if (evflag_atom) { - if (differentiation_flag == 1 && vflag_atom) + if (differentiation_flag == 1 && vflag_atom) cg_peratom->forward_comm(this,FORWARD_AD_PERATOM); else if (differentiation_flag == 0) cg_peratom->forward_comm(this,FORWARD_IK_PERATOM); @@ -1073,7 +1073,7 @@ void PPPM::set_grid_global() } // scale grid for triclinic skew - + if (triclinic) { double tmp[3]; tmp[0] = nx_pppm/xprd; @@ -1165,7 +1165,7 @@ double PPPM::compute_qopt() { double qopt = 0.0; double *prd = domain->prd; - + const double xprd = prd[0]; const double yprd = prd[1]; const double zprd = prd[2]; @@ -1452,7 +1452,7 @@ void PPPM::set_grid_local() nzhi_in = nzhi_out = nz_pppm - 1; nzhi_out = MIN(nzhi_out,nz_pppm-1); } - + // decomposition of FFT mesh // global indices range from 0 to N-1 // proc owns entire x-dimension, clumps of columns in y,z dimensions @@ -2772,7 +2772,7 @@ void PPPM::unpack_reverse(int flag, FFT_SCALAR *buf, int nlist, int *list) FFT_SCALAR *dest = &density_brick[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) dest[list[i]] += buf[i]; - } + } } /* ---------------------------------------------------------------------- @@ -3349,7 +3349,7 @@ void PPPM::poisson_groups(int AA_flag) } // triclinic system - + if (triclinic) { poisson_groups_triclinic(); return; @@ -3464,7 +3464,7 @@ void PPPM::slabcorr_groups(int groupbit_A, int groupbit_B, int AA_flag) if (!((mask[i] & groupbit_A) && (mask[i] & groupbit_B))) if (AA_flag) continue; - if (mask[i] & groupbit_A) { + if (mask[i] & groupbit_A) { qsum_A += q[i]; dipole_A += q[i]*x[i][2]; dipole_r2_A += q[i]*x[i][2]*x[i][2]; diff --git a/src/KSPACE/pppm.h b/src/KSPACE/pppm.h index 508d47a33f3fdd34eb8e496da4f896fc3b945d80..b543c5fd3df3cd80ce16f93072593e8076e1aec0 100644 --- a/src/KSPACE/pppm.h +++ b/src/KSPACE/pppm.h @@ -21,7 +21,7 @@ KSpaceStyle(pppm,PPPM) #define LMP_PPPM_H #include "lmptype.h" -#include "mpi.h" +#include <mpi.h> #ifdef FFT_SINGLE typedef float FFT_SCALAR; @@ -104,7 +104,7 @@ class PPPM : public KSpace { int typeH,typeO; // atom types of TIP4P water H and O atoms double qdist; // distance from O site to negative charge double alpha; // geometric factor - + void set_grid_global(); void set_grid_local(); void adjust_gewald(); @@ -124,19 +124,19 @@ class PPPM : public KSpace { virtual void compute_gf_ik(); virtual void compute_gf_ad(); void compute_sf_precoeff(); - + virtual void particle_map(); virtual void make_rho(); virtual void brick2fft(); - + virtual void poisson(); virtual void poisson_ik(); virtual void poisson_ad(); - + virtual void fieldforce(); virtual void fieldforce_ik(); virtual void fieldforce_ad(); - + virtual void poisson_peratom(); virtual void fieldforce_peratom(); void procs2grid2d(int,int,int,int *, int*); diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index 21dd09cae152da3a3854e9b3b146012c2550621e..f07f38b4be462c6a1c515f9fc9336d1c1b67759e 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -15,10 +15,10 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom.h" #include "gridcomm.h" @@ -193,7 +193,7 @@ void PPPMCG::compute(int eflag, int vflag) // extra per-atom energy/virial communication if (evflag_atom) { - if (differentiation_flag == 1 && vflag_atom) + if (differentiation_flag == 1 && vflag_atom) cg_peratom->forward_comm(this,FORWARD_AD_PERATOM); else if (differentiation_flag == 0) cg_peratom->forward_comm(this,FORWARD_IK_PERATOM); diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 802d2a7d32ed3e24bfb444104e65f91dffc1e55e..538f9de28c63336cd323affad02c28fd3ff21d81 100755 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,11 +16,11 @@ Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> #include "pppm_disp.h" #include "math_const.h" #include "atom.h" @@ -71,7 +71,7 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) triclinic_support = 0; pppmflag = dispersionflag = 1; accuracy_relative = fabs(force->numeric(FLERR,arg[0])); - + nfactors = 3; factors = new int[nfactors]; factors[0] = 2; @@ -89,52 +89,52 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; density_fft = NULL; - u_brick = v0_brick = v1_brick = v2_brick = v3_brick = + u_brick = v0_brick = v1_brick = v2_brick = v3_brick = v4_brick = v5_brick = NULL; density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = NULL; density_fft_g = NULL; - u_brick_g = v0_brick_g = v1_brick_g = v2_brick_g = v3_brick_g = + u_brick_g = v0_brick_g = v1_brick_g = v2_brick_g = v3_brick_g = v4_brick_g = v5_brick_g = NULL; density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = NULL; density_fft_a0 = NULL; - u_brick_a0 = v0_brick_a0 = v1_brick_a0 = v2_brick_a0 = v3_brick_a0 = + u_brick_a0 = v0_brick_a0 = v1_brick_a0 = v2_brick_a0 = v3_brick_a0 = v4_brick_a0 = v5_brick_a0 = NULL; density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = NULL; density_fft_a1 = NULL; - u_brick_a1 = v0_brick_a1 = v1_brick_a1 = v2_brick_a1 = v3_brick_a1 = + u_brick_a1 = v0_brick_a1 = v1_brick_a1 = v2_brick_a1 = v3_brick_a1 = v4_brick_a1 = v5_brick_a1 = NULL; density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = NULL; density_fft_a2 = NULL; - u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = + u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = v4_brick_a2 = v5_brick_a2 = NULL; density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = NULL; density_fft_a3 = NULL; - u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = + u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = v4_brick_a3 = v5_brick_a3 = NULL; density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = NULL; density_fft_a4 = NULL; - u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = v3_brick_a4 = + u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = v3_brick_a4 = v4_brick_a4 = v5_brick_a4 = NULL; density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = NULL; density_fft_a5 = NULL; - u_brick_a5 = v0_brick_a5 = v1_brick_a5 = v2_brick_a5 = v3_brick_a5 = + u_brick_a5 = v0_brick_a5 = v1_brick_a5 = v2_brick_a5 = v3_brick_a5 = v4_brick_a5 = v5_brick_a5 = NULL; density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = NULL; density_fft_a6 = NULL; - u_brick_a6 = v0_brick_a6 = v1_brick_a6 = v2_brick_a6 = v3_brick_a6 = + u_brick_a6 = v0_brick_a6 = v1_brick_a6 = v2_brick_a6 = v3_brick_a6 = v4_brick_a6 = v5_brick_a6 = NULL; density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = NULL; density_fft_none = NULL; - u_brick_none = v0_brick_none = v1_brick_none = v2_brick_none = v3_brick_none = + u_brick_none = v0_brick_none = v1_brick_none = v2_brick_none = v3_brick_none = v4_brick_none = v5_brick_none = NULL; greensfn = NULL; @@ -150,9 +150,9 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) fkx_6 = fky_6 = fkz_6 = NULL; fkx2_6 = fky2_6 = fkz2_6 = NULL; - sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = sf_precoeff4 = + sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = NULL; - sf_precoeff1_6 = sf_precoeff2_6 = sf_precoeff3_6 = sf_precoeff4_6 = + sf_precoeff1_6 = sf_precoeff2_6 = sf_precoeff3_6 = sf_precoeff4_6 = sf_precoeff5_6 = sf_precoeff6_6 = NULL; gf_b = NULL; @@ -179,7 +179,7 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp, int narg, char **arg) : KSpace(lmp, narg, arg) } /* ---------------------------------------------------------------------- - free all memory + free all memory ------------------------------------------------------------------------- */ PPPMDisp::~PPPMDisp() @@ -199,7 +199,7 @@ PPPMDisp::~PPPMDisp() } /* ---------------------------------------------------------------------- - called once before run + called once before run ------------------------------------------------------------------------- */ void PPPMDisp::init() @@ -212,18 +212,18 @@ void PPPMDisp::init() triclinic_check(); if (domain->dimension == 2) error->all(FLERR,"Cannot use PPPMDisp with 2d simulation"); - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"PPPMDisp can only currently be used with " "comm_style brick"); if (slabflag == 0 && domain->nonperiodic > 0) error->all(FLERR,"Cannot use nonperiodic boundaries with PPPMDisp"); if (slabflag == 1) { - if (domain->xperiodic != 1 || domain->yperiodic != 1 || + if (domain->xperiodic != 1 || domain->yperiodic != 1 || domain->boundary[2][0] != 1 || domain->boundary[2][1] != 1) error->all(FLERR,"Incorrect boundaries with slab PPPMDisp"); } - + if (order > MAXORDER || order_6 > MAXORDER) { char str[128]; sprintf(str,"PPPMDisp coulomb order cannot be greater than %d",MAXORDER); @@ -233,7 +233,7 @@ void PPPMDisp::init() // free all arrays previously allocated deallocate(); - deallocate_peratom(); + deallocate_peratom(); // check whether cutoff and pair style are set @@ -251,7 +251,7 @@ void PPPMDisp::init() cutoff_lj = *p_cutoff_lj; double tmp2; - MPI_Allreduce(&cutoff, &tmp2,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&cutoff, &tmp2,1,MPI_DOUBLE,MPI_SUM,world); // check out which types of potentials will have to be calculated @@ -266,7 +266,7 @@ void PPPMDisp::init() case 1: k = 0; break; case 6: - if ((ewald_mix==GEOMETRIC || ewald_mix==SIXTHPOWER || + if ((ewald_mix==GEOMETRIC || ewald_mix==SIXTHPOWER || mixflag == 1) && mixflag!= 2) { k = 1; break; } else if (ewald_mix==ARITHMETIC && mixflag!=2) { k = 2; break; } else if (mixflag == 2) { k = 3; break; } @@ -277,7 +277,7 @@ void PPPMDisp::init() } function[k] = 1; } - + // warn, if function[0] is not set but charge attribute is set! @@ -303,14 +303,14 @@ void PPPMDisp::init() scale = 1.0; qqrd2e = force->qqrd2e; natoms_original = atom->natoms; - + if (function[0]) qsum_qsq(); // if kspace is TIP4P, extract TIP4P params from pair style // bond/angle are not yet init(), so insure equilibrium request is valid qdist = 0.0; - + if (tip4pflag) { int itmp; double *p_qdist = (double *) force->pair->extract("qdist",itmp); @@ -328,10 +328,10 @@ void PPPMDisp::init() if (force->angle == NULL || force->bond == NULL) error->all(FLERR,"Bond and angle potentials must be defined for TIP4P"); - if (typeA < 1 || typeA > atom->nangletypes || + if (typeA < 1 || typeA > atom->nangletypes || force->angle->setflag[typeA] == 0) error->all(FLERR,"Bad TIP4P angle type for PPPMDisp/TIP4P"); - if (typeB < 1 || typeB > atom->nbondtypes || + if (typeB < 1 || typeB > atom->nbondtypes || force->bond->setflag[typeB] == 0) error->all(FLERR,"Bad TIP4P bond type for PPPMDisp/TIP4P"); double theta = force->angle->equilibrium_angle(typeA); @@ -353,7 +353,7 @@ void PPPMDisp::init() if (!gewaldflag_6) g_ewald_6 = 1; // set accuracy (force units) from accuracy_relative or accuracy_absolute - + if (accuracy_absolute >= 0.0) accuracy = accuracy_absolute; else accuracy = accuracy_relative * two_charge_force; @@ -370,7 +370,7 @@ void PPPMDisp::init() iteration++; // set grid for dispersion interaction and coulomb interactions - + set_grid(); if (nx_pppm >= OFFSET || ny_pppm >= OFFSET || nz_pppm >= OFFSET) @@ -408,13 +408,13 @@ void PPPMDisp::init() if (cgtmp) delete cgtmp; // adjust g_ewald - + if (!gewaldflag) adjust_gewald(); // calculate the final accuracy - + double acc = final_accuracy(); - + // print stats int ngrid_max,nfft_both_max; @@ -427,7 +427,7 @@ void PPPMDisp::init() #else const char fft_prec[] = "double"; #endif - + if (screen) { fprintf(screen," Coulomb G vector (1/distance)= %g\n",g_ewald); fprintf(screen," Coulomb grid = %d %d %d\n",nx_pppm,ny_pppm,nz_pppm); @@ -467,7 +467,7 @@ void PPPMDisp::init() iteration++; set_grid_6(); - + if (nx_pppm_6 >= OFFSET || ny_pppm_6 >= OFFSET || nz_pppm_6 >= OFFSET) error->all(FLERR,"PPPMDisp Dispersion grid is too large"); @@ -497,14 +497,14 @@ void PPPMDisp::init() order_6--; } - if (order_6 < minorder) + if (order_6 < minorder) error->all(FLERR,"Dispersion PPPMDisp order has been " "reduced below minorder"); if (cgtmp) delete cgtmp; // adjust g_ewald_6 - if (!gewaldflag_6 && accuracy_kspace_6 == accuracy_real_6) + if (!gewaldflag_6 && accuracy_kspace_6 == accuracy_real_6) adjust_gewald_6(); // calculate the final accuracy @@ -525,7 +525,7 @@ void PPPMDisp::init() #else const char fft_prec[] = "double"; #endif - + if (screen) { fprintf(screen," Dispersion G vector (1/distance)= %g\n",g_ewald_6); fprintf(screen," Dispersion grid = %d %d %d\n", @@ -577,7 +577,7 @@ void PPPMDisp::init() cg->setup(); if (differentiation_flag == 1) compute_sf_precoeff(nx_pppm, ny_pppm, nz_pppm, order, - nxlo_fft, nylo_fft, nzlo_fft, + nxlo_fft, nylo_fft, nzlo_fft, nxhi_fft, nyhi_fft, nzhi_fft, sf_precoeff1, sf_precoeff2, sf_precoeff3, sf_precoeff4, sf_precoeff5, sf_precoeff6); @@ -589,7 +589,7 @@ void PPPMDisp::init() cg_6->setup(); if (differentiation_flag == 1) compute_sf_precoeff(nx_pppm_6, ny_pppm_6, nz_pppm_6, order_6, - nxlo_fft_6, nylo_fft_6, nzlo_fft_6, + nxlo_fft_6, nylo_fft_6, nzlo_fft_6, nxhi_fft_6, nyhi_fft_6, nzhi_fft_6, sf_precoeff1_6, sf_precoeff2_6, sf_precoeff3_6, sf_precoeff4_6, sf_precoeff5_6, sf_precoeff6_6); @@ -598,7 +598,7 @@ void PPPMDisp::init() } /* ---------------------------------------------------------------------- - adjust PPPM coeffs, called initially and whenever volume has changed + adjust PPPM coeffs, called initially and whenever volume has changed ------------------------------------------------------------------------- */ void PPPMDisp::setup() @@ -607,11 +607,11 @@ void PPPMDisp::setup() if (slabflag == 0 && domain->nonperiodic > 0) error->all(FLERR,"Cannot use nonperiodic boundaries with PPPMDisp"); if (slabflag == 1) { - if (domain->xperiodic != 1 || domain->yperiodic != 1 || + if (domain->xperiodic != 1 || domain->yperiodic != 1 || domain->boundary[2][0] != 1 || domain->boundary[2][1] != 1) error->all(FLERR,"Incorrect boundaries with slab PPPMDisp"); } - + double *prd; // volume-dependent factors @@ -843,9 +843,9 @@ void PPPMDisp::setup_grid() if (function[0]) { compute_gf_denom(gf_b, order); compute_rho_coeff(rho_coeff, drho_coeff, order); - if (differentiation_flag == 1) + if (differentiation_flag == 1) compute_sf_precoeff(nx_pppm, ny_pppm, nz_pppm, order, - nxlo_fft, nylo_fft, nzlo_fft, + nxlo_fft, nylo_fft, nzlo_fft, nxhi_fft, nyhi_fft, nzhi_fft, sf_precoeff1, sf_precoeff2, sf_precoeff3, sf_precoeff4, sf_precoeff5, sf_precoeff6); @@ -855,7 +855,7 @@ void PPPMDisp::setup_grid() compute_rho_coeff(rho_coeff_6, drho_coeff_6, order_6); if (differentiation_flag == 1) compute_sf_precoeff(nx_pppm_6, ny_pppm_6, nz_pppm_6, order_6, - nxlo_fft_6, nylo_fft_6, nzlo_fft_6, + nxlo_fft_6, nylo_fft_6, nzlo_fft_6, nxhi_fft_6, nyhi_fft_6, nzhi_fft_6, sf_precoeff1_6, sf_precoeff2_6, sf_precoeff3_6, sf_precoeff4_6, sf_precoeff5_6, sf_precoeff6_6); @@ -867,7 +867,7 @@ void PPPMDisp::setup_grid() } /* ---------------------------------------------------------------------- - compute the PPPM long-range force, energy, virial + compute the PPPM long-range force, energy, virial ------------------------------------------------------------------------- */ void PPPMDisp::compute(int eflag, int vflag) @@ -877,7 +877,7 @@ void PPPMDisp::compute(int eflag, int vflag) // convert atoms from box to lamda coords if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = evflag_atom = eflag_global = vflag_global = + else evflag = evflag_atom = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; if (evflag_atom && !peratom_allocate_flag) { @@ -892,7 +892,7 @@ void PPPMDisp::compute(int eflag, int vflag) } peratom_allocate_flag = 1; } - + if (triclinic == 0) boxlo = domain->boxlo; else { boxlo = domain->boxlo_lamda; @@ -906,7 +906,7 @@ void PPPMDisp::compute(int eflag, int vflag) if (function[1] + function[2] + function[3]) memory->destroy(part2grid_6); nmax = atom->nmax; if (function[0]) memory->create(part2grid,nmax,3,"pppm/disp:part2grid"); - if (function[1] + function[2] + function[3]) + if (function[1] + function[2] + function[3]) memory->create(part2grid_6,nmax,3,"pppm/disp:part2grid_6"); } @@ -933,23 +933,23 @@ void PPPMDisp::compute(int eflag, int vflag) make_rho_c(); cg->reverse_comm(this,REVERSE_RHO); - + brick2fft(nxlo_in, nylo_in, nzlo_in, nxhi_in, nyhi_in, nzhi_in, - density_brick, density_fft, work1,remap); - + density_brick, density_fft, work1,remap); + if (differentiation_flag == 1) { poisson_ad(work1, work2, density_fft, fft1, fft2, nx_pppm, ny_pppm, nz_pppm, nfft, nxlo_fft, nylo_fft, nzlo_fft, nxhi_fft, nyhi_fft, nzhi_fft, nxlo_in, nylo_in, nzlo_in, nxhi_in, nyhi_in, nzhi_in, - energy_1, greensfn, + energy_1, greensfn, virial_1, vg,vg2, u_brick, v0_brick, v1_brick, v2_brick, v3_brick, v4_brick, v5_brick); cg->forward_comm(this,FORWARD_AD); - fieldforce_c_ad(); + fieldforce_c_ad(); if (vflag_atom) cg_peratom->forward_comm(this, FORWARD_AD_PERATOM); @@ -958,14 +958,14 @@ void PPPMDisp::compute(int eflag, int vflag) nx_pppm, ny_pppm, nz_pppm, nfft, nxlo_fft, nylo_fft, nzlo_fft, nxhi_fft, nyhi_fft, nzhi_fft, nxlo_in, nylo_in, nzlo_in, nxhi_in, nyhi_in, nzhi_in, - energy_1, greensfn, + energy_1, greensfn, fkx, fky, fkz,fkx2, fky2, fkz2, vdx_brick, vdy_brick, vdz_brick, virial_1, vg,vg2, u_brick, v0_brick, v1_brick, v2_brick, v3_brick, v4_brick, v5_brick); cg->forward_comm(this, FORWARD_IK); - fieldforce_c_ik(); + fieldforce_c_ik(); if (evflag_atom) cg_peratom->forward_comm(this, FORWARD_IK_PERATOM); } @@ -983,14 +983,14 @@ void PPPMDisp::compute(int eflag, int vflag) brick2fft(nxlo_in_6, nylo_in_6, nzlo_in_6, nxhi_in_6, nyhi_in_6, nzhi_in_6, density_brick_g, density_fft_g, work1_6,remap_6); - + if (differentiation_flag == 1) { poisson_ad(work1_6, work2_6, density_fft_g, fft1_6, fft2_6, nx_pppm_6, ny_pppm_6, nz_pppm_6, nfft_6, nxlo_fft_6, nylo_fft_6, nzlo_fft_6, nxhi_fft_6, nyhi_fft_6, nzhi_fft_6, nxlo_in_6, nylo_in_6, nzlo_in_6, nxhi_in_6, nyhi_in_6, nzhi_in_6, - energy_6, greensfn_6, + energy_6, greensfn_6, virial_6, vg_6, vg2_6, u_brick_g, v0_brick_g, v1_brick_g, v2_brick_g, v3_brick_g, v4_brick_g, v5_brick_g); @@ -1005,13 +1005,13 @@ void PPPMDisp::compute(int eflag, int vflag) nx_pppm_6, ny_pppm_6, nz_pppm_6, nfft_6, nxlo_fft_6, nylo_fft_6, nzlo_fft_6, nxhi_fft_6, nyhi_fft_6, nzhi_fft_6, nxlo_in_6, nylo_in_6, nzlo_in_6, nxhi_in_6, nyhi_in_6, nzhi_in_6, - energy_6, greensfn_6, + energy_6, greensfn_6, fkx_6, fky_6, fkz_6,fkx2_6, fky2_6, fkz2_6, vdx_brick_g, vdy_brick_g, vdz_brick_g, virial_6, vg_6, vg2_6, u_brick_g, v0_brick_g, v1_brick_g, v2_brick_g, v3_brick_g, v4_brick_g, v5_brick_g); - + cg_6->forward_comm(this,FORWARD_IK_G); - + fieldforce_g_ik(); @@ -1036,7 +1036,7 @@ void PPPMDisp::compute(int eflag, int vflag) nx_pppm_6, ny_pppm_6, nz_pppm_6, nfft_6, nxlo_fft_6, nylo_fft_6, nzlo_fft_6, nxhi_fft_6, nyhi_fft_6, nzhi_fft_6, nxlo_in_6, nylo_in_6, nzlo_in_6, nxhi_in_6, nyhi_in_6, nzhi_in_6, - energy_6, greensfn_6, + energy_6, greensfn_6, virial_6, vg_6, vg2_6, u_brick_a3, v0_brick_a3, v1_brick_a3, v2_brick_a3, v3_brick_a3, v4_brick_a3, v5_brick_a3); poisson_2s_ad(density_fft_a0, density_fft_a6, @@ -1056,12 +1056,12 @@ void PPPMDisp::compute(int eflag, int vflag) if (evflag_atom) cg_peratom_6->forward_comm(this, FORWARD_AD_PERATOM_A); } else { - + poisson_ik(work1_6, work2_6, density_fft_a3, fft1_6, fft2_6, nx_pppm_6, ny_pppm_6, nz_pppm_6, nfft_6, nxlo_fft_6, nylo_fft_6, nzlo_fft_6, nxhi_fft_6, nyhi_fft_6, nzhi_fft_6, nxlo_in_6, nylo_in_6, nzlo_in_6, nxhi_in_6, nyhi_in_6, nzhi_in_6, - energy_6, greensfn_6, + energy_6, greensfn_6, fkx_6, fky_6, fkz_6,fkx2_6, fky2_6, fkz2_6, vdx_brick_a3, vdy_brick_a3, vdz_brick_a3, virial_6, vg_6, vg2_6, u_brick_a3, v0_brick_a3, v1_brick_a3, v2_brick_a3, v3_brick_a3, v4_brick_a3, v5_brick_a3); @@ -1134,7 +1134,7 @@ void PPPMDisp::compute(int eflag, int vflag) fieldforce_none_ik(); - if (evflag_atom) + if (evflag_atom) cg_peratom_6->forward_comm(this, FORWARD_IK_PERATOM_NONE); } if (evflag_atom) fieldforce_none_peratom(); @@ -1156,10 +1156,10 @@ void PPPMDisp::compute(int eflag, int vflag) energy_1 = energy_all; MPI_Allreduce(&energy_6,&energy_all,1,MPI_DOUBLE,MPI_SUM,world); energy_6 = energy_all; - + energy_1 *= 0.5*volume; energy_6 *= 0.5*volume; - + energy_1 -= g_ewald*qsqsum/MY_PIS + MY_PI2*qsum*qsum / (g_ewald*g_ewald*volume); energy_6 += - MY_PI*MY_PIS/(6*volume)*pow(g_ewald_6,3)*csumij + @@ -1199,7 +1199,7 @@ void PPPMDisp::compute(int eflag, int vflag) } } } - + if (vflag_atom) { if (function[1] + function[2] + function[3]) { int tmp; @@ -1218,7 +1218,7 @@ void PPPMDisp::compute(int eflag, int vflag) if (function[1] + function[2] + function[3]) energy += energy_6; // convert atoms back from lamda to box coords - + if (triclinic) domain->lamda2x(atom->nlocal); } @@ -1262,7 +1262,7 @@ void PPPMDisp::init_coeffs() // local pair coeffs if (function[3] && !converged) { error->all(FLERR,"Matrix factorization to split dispersion coefficients failed"); } - // determine number of used eigenvalues + // determine number of used eigenvalues // based on maximum allowed number or cutoff criterion // sort eigenvalues according to their size with bubble sort double t; @@ -1361,9 +1361,9 @@ void PPPMDisp::init_coeffs() // local pair coeffs } if (function[2]) { // arithmetic 1/r^6 //cannot use epsilon, because this has not been set yet - double **epsilon = (double **) force->pair->extract("epsilon",tmp); + double **epsilon = (double **) force->pair->extract("epsilon",tmp); //cannot use sigma, because this has not been set yet - double **sigma = (double **) force->pair->extract("sigma",tmp); + double **sigma = (double **) force->pair->extract("sigma",tmp); if (!(epsilon&&sigma)) error->all(FLERR,"Epsilon or sigma reference not set by pair style in PPPMDisp"); double eps_i, sigma_i, sigma_n, *bi = B = new double[7*n+7]; @@ -1420,7 +1420,7 @@ int PPPMDisp::qr_alg(double **A, double **Q, int n) bn1 = A[n-2][n-1]; d = (an1-an)/2; mue = an + d - copysign(1.,d)*sqrt(d*d + bn1*bn1); - for (int i = 0; i < n; i++) + for (int i = 0; i < n; i++) A[i][i] -= mue; // perform a QR factorization for a tridiagonal matrix A @@ -1440,19 +1440,19 @@ int PPPMDisp::qr_alg(double **A, double **Q, int n) count = count + 1; if (count == countmax) break; } - + // free allocated memory memory->destroy(Qi); memory->destroy(A0); memory->destroy(C); memory->destroy(D); memory->destroy(E); - + return converged; } /* ---------------------------------------------------------------------- - Transform a Matrix to Hessenberg form (for symmetric Matrices, the + Transform a Matrix to Hessenberg form (for symmetric Matrices, the result will be a tridiagonal matrix) ------------------------------------------------------------------------- */ @@ -1542,7 +1542,7 @@ void PPPMDisp::mmult(double** A, double** B, double** C, int n) for (int j = 0; j < n; j++) C[i][j] = 0.0; - // perform matrix multiplication + // perform matrix multiplication for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) for (int k = 0; k < n; k++) @@ -1571,7 +1571,7 @@ int PPPMDisp::check_convergence(double** A,double** Q,double** A0, for (int j = 0; j < n; j++) Bmax = (Bmax>A0[i][j])?Bmax:A0[i][j]; //max(Bmax,A0[i][j]); double epsabs = eps*Bmax; - + // reconstruct the original matrix // store the diagonal elements in D for (int i = 0; i < n; i++) @@ -1604,7 +1604,7 @@ int PPPMDisp::check_convergence(double** A,double** Q,double** A0, } /* ---------------------------------------------------------------------- - allocate memory that depends on # of K-vectors and order + allocate memory that depends on # of K-vectors and order ------------------------------------------------------------------------- */ void PPPMDisp::allocate() @@ -1924,7 +1924,7 @@ void PPPMDisp::allocate() nxlo_out_6,nxhi_out_6,nylo_out_6,nyhi_out_6,nzlo_out_6,nzhi_out_6, procneigh[0][0],procneigh[0][1],procneigh[1][0], procneigh[1][1],procneigh[2][0],procneigh[2][1]); - } + } if (function[3]) { memory->create(work1_6,2*nfft_both_6,"pppm/disp:work1_6"); @@ -2009,7 +2009,7 @@ void PPPMDisp::allocate() /* ---------------------------------------------------------------------- allocate memory that depends on # of K-vectors and order - for per atom calculations + for per atom calculations ------------------------------------------------------------------------- */ void PPPMDisp::allocate_peratom() @@ -2095,7 +2095,7 @@ void PPPMDisp::allocate_peratom() } if (function[2]) { - + if ( differentiation_flag != 1 ) { memory->create3d_offset(u_brick_a0,nzlo_out_6,nzhi_out_6,nylo_out_6,nyhi_out_6, nxlo_out_6,nxhi_out_6,"pppm/disp:u_brick_a0"); @@ -2221,7 +2221,7 @@ void PPPMDisp::allocate_peratom() procneigh[0][0],procneigh[0][1],procneigh[1][0], procneigh[1][1],procneigh[2][0],procneigh[2][1]); - } + } if (function[3]) { @@ -2264,7 +2264,7 @@ void PPPMDisp::allocate_peratom() /* ---------------------------------------------------------------------- - deallocate memory that depends on # of K-vectors and order + deallocate memory that depends on # of K-vectors and order ------------------------------------------------------------------------- */ void PPPMDisp::deallocate() @@ -2316,7 +2316,7 @@ void PPPMDisp::deallocate() memory->destroy(density_fft_a3); density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = NULL; density_fft_a3 = NULL; - + memory->destroy3d_offset(density_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); @@ -2411,7 +2411,7 @@ void PPPMDisp::deallocate() memory->destroy(gf_b_6); memory->destroy2d_offset(rho1d_6,-order_6/2); memory->destroy2d_offset(rho_coeff_6,(1-order_6)/2); - memory->destroy2d_offset(drho1d_6,-order_6/2); + memory->destroy2d_offset(drho1d_6,-order_6/2); memory->destroy2d_offset(drho_coeff_6,(1-order_6)/2); gf_b_6 = NULL; rho1d_6 = rho_coeff_6 = drho1d_6 = drho_coeff_6 = NULL; @@ -2436,7 +2436,7 @@ void PPPMDisp::deallocate() /* ---------------------------------------------------------------------- deallocate memory that depends on # of K-vectors and order - for per atom calculations + for per atom calculations ------------------------------------------------------------------------- */ void PPPMDisp::deallocate_peratom() @@ -2496,7 +2496,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = v4_brick_a3 = v5_brick_a3 = NULL; - + memory->destroy3d_offset(u_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v1_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2505,7 +2505,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = v3_brick_a4 = v4_brick_a4 = v5_brick_a4 = NULL; - + memory->destroy3d_offset(u_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v1_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2555,7 +2555,7 @@ void PPPMDisp::set_grid() double yprd = domain->yprd; double zprd = domain->zprd; double zprd_slab = zprd*slab_volfactor; - + // make initial g_ewald estimate // based on desired accuracy and real space cutoff // fluid-occupied volume used to estimate real-space error @@ -2566,20 +2566,20 @@ void PPPMDisp::set_grid() if (!gewaldflag) { g_ewald = accuracy*sqrt(natoms*cutoff*xprd*yprd*zprd) / (2.0*q2); - if (g_ewald >= 1.0) + if (g_ewald >= 1.0) error->all(FLERR,"KSpace accuracy too large to estimate G vector"); g_ewald = sqrt(-log(g_ewald)) / cutoff; - } + } // set optimal nx_pppm,ny_pppm,nz_pppm based on order and accuracy // nz_pppm uses extended zprd_slab instead of zprd // reduce it until accuracy target is met if (!gridflag) { - h = h_x = h_y = h_z = 4.0/g_ewald; + h = h_x = h_y = h_z = 4.0/g_ewald; int count = 0; while (1) { - + // set grid dimension nx_pppm = static_cast<int> (xprd/h_x); ny_pppm = static_cast<int> (yprd/h_y); @@ -2607,7 +2607,7 @@ void PPPMDisp::set_grid() nzhi_fft = (me_z+1)*nz_pppm/npez_fft - 1; double qopt = compute_qopt(); - + double dfkspace = sqrt(qopt/natoms)*q2/(xprd*yprd*zprd_slab); count++; @@ -2619,7 +2619,7 @@ void PPPMDisp::set_grid() h_x = h_y = h_z = h; } } - + // boost grid size until it is factorable while (!factorable(nx_pppm)) nx_pppm++; @@ -2628,7 +2628,7 @@ void PPPMDisp::set_grid() } /* ---------------------------------------------------------------------- - set the FFT parameters + set the FFT parameters ------------------------------------------------------------------------- */ void PPPMDisp::set_fft_parameters(int& nx_p,int& ny_p,int& nz_p, @@ -2653,9 +2653,9 @@ void PPPMDisp::set_fft_parameters(int& nx_p,int& ny_p,int& nz_p, nylo_i = static_cast<int> (comm->ysplit[comm->myloc[1]] * ny_p); nyhi_i = static_cast<int> (comm->ysplit[comm->myloc[1]+1] * ny_p) - 1; - nzlo_i = static_cast<int> + nzlo_i = static_cast<int> (comm->zsplit[comm->myloc[2]] * nz_p/slab_volfactor); - nzhi_i = static_cast<int> + nzhi_i = static_cast<int> (comm->zsplit[comm->myloc[2]+1] * nz_p/slab_volfactor) - 1; @@ -2710,26 +2710,26 @@ void PPPMDisp::set_fft_parameters(int& nx_p,int& ny_p,int& nz_p, dist[1] = cuthalf/domain->prd[1]; dist[2] = cuthalf/domain->prd[2]; } - + int nlo,nhi; - - nlo = static_cast<int> ((sublo[0]-dist[0]-boxlo[0]) * + + nlo = static_cast<int> ((sublo[0]-dist[0]-boxlo[0]) * nx_p/xprd + sft) - OFFSET; - nhi = static_cast<int> ((subhi[0]+dist[0]-boxlo[0]) * + nhi = static_cast<int> ((subhi[0]+dist[0]-boxlo[0]) * nx_p/xprd + sft) - OFFSET; nxlo_o = nlo + nlow; nxhi_o = nhi + nupp; - nlo = static_cast<int> ((sublo[1]-dist[1]-boxlo[1]) * + nlo = static_cast<int> ((sublo[1]-dist[1]-boxlo[1]) * ny_p/yprd + sft) - OFFSET; - nhi = static_cast<int> ((subhi[1]+dist[1]-boxlo[1]) * + nhi = static_cast<int> ((subhi[1]+dist[1]-boxlo[1]) * ny_p/yprd + sft) - OFFSET; nylo_o = nlo + nlow; nyhi_o = nhi + nupp; - nlo = static_cast<int> ((sublo[2]-dist[2]-boxlo[2]) * + nlo = static_cast<int> ((sublo[2]-dist[2]-boxlo[2]) * nz_p/zprd_slab + sft) - OFFSET; - nhi = static_cast<int> ((subhi[2]+dist[2]-boxlo[2]) * + nhi = static_cast<int> ((subhi[2]+dist[2]-boxlo[2]) * nz_p/zprd_slab + sft) - OFFSET; nzlo_o = nlo + nlow; nzhi_o = nhi + nupp; @@ -2745,7 +2745,7 @@ void PPPMDisp::set_fft_parameters(int& nx_p,int& ny_p,int& nz_p, nzhi_i = nz_p - 1; nzhi_o = nz_p - 1; } - + // decomposition of FFT mesh // global indices range from 0 to N-1 // proc owns entire x-dimension, clump of columns in y,z dimensions @@ -2792,7 +2792,7 @@ void PPPMDisp::set_fft_parameters(int& nx_p,int& ny_p,int& nz_p, /* ---------------------------------------------------------------------- check if all factors of n are in list of factors - return 1 if yes, 0 if no + return 1 if yes, 0 if no ------------------------------------------------------------------------- */ int PPPMDisp::factorable(int n) @@ -2813,25 +2813,25 @@ int PPPMDisp::factorable(int n) } /* ---------------------------------------------------------------------- - pre-compute Green's function denominator expansion coeffs, Gamma(2n) + pre-compute Green's function denominator expansion coeffs, Gamma(2n) ------------------------------------------------------------------------- */ void PPPMDisp::adjust_gewald() { - + // Use Newton solver to find g_ewald double dx; - + // Begin algorithm - + for (int i = 0; i < LARGE; i++) { - dx = f() / derivf(); + dx = f() / derivf(); g_ewald -= dx; //Update g_ewald if (fabs(f()) < SMALL) return; } - + // Failed to converge - + char str[128]; sprintf(str, "Could not compute g_ewald"); error->all(FLERR, str); @@ -2852,12 +2852,12 @@ double PPPMDisp::f() double zprd_slab = zprd*slab_volfactor; bigint natoms = atom->natoms; - df_rspace = 2.0*q2*exp(-g_ewald*g_ewald*cutoff*cutoff) / + df_rspace = 2.0*q2*exp(-g_ewald*g_ewald*cutoff*cutoff) / sqrt(natoms*cutoff*xprd*yprd*zprd); - + double qopt = compute_qopt(); df_kspace = sqrt(qopt/natoms)*q2/(xprd*yprd*zprd_slab); - + return df_rspace - df_kspace; } @@ -2865,21 +2865,21 @@ double PPPMDisp::f() Calculate numerical derivative f'(x) using forward difference [f(x + h) - f(x)] / h ------------------------------------------------------------------------- */ - + double PPPMDisp::derivf() -{ +{ double h = 0.000001; //Derivative step-size double df,f1,f2,g_ewald_old; - + f1 = f(); g_ewald_old = g_ewald; g_ewald += h; f2 = f(); g_ewald = g_ewald_old; df = (f2 - f1)/h; - + return df; -} +} /* ---------------------------------------------------------------------- Calculate the final estimator for the accuracy @@ -2894,7 +2894,7 @@ double PPPMDisp::final_accuracy() double zprd = domain->zprd; double zprd_slab = zprd*slab_volfactor; bigint natoms = atom->natoms; - df_rspace = 2.0*q2 * exp(-g_ewald*g_ewald*cutoff*cutoff) / + df_rspace = 2.0*q2 * exp(-g_ewald*g_ewald*cutoff*cutoff) / sqrt(natoms*cutoff*xprd*yprd*zprd); double qopt = compute_qopt(); @@ -2999,8 +2999,8 @@ double PPPMDisp::compute_qopt_ik() for (k = nxlo_fft; k <= nxhi_fft; k++) { kper = k - nx_pppm*(2*k/nx_pppm); - - sqk = pow(unitkx*kper,2.0) + pow(unitky*lper,2.0) + + + sqk = pow(unitkx*kper,2.0) + pow(unitky*lper,2.0) + pow(unitkz*mper,2.0); if (sqk != 0.0) { @@ -3085,12 +3085,12 @@ double PPPMDisp::compute_qopt_ad() for (k = nxlo_fft; k <= nxhi_fft; k++) { kper = k - nx_pppm*(2*k/nx_pppm); - - sqk = pow(unitkx*kper,2.0) + pow(unitky*lper,2.0) + + + sqk = pow(unitkx*kper,2.0) + pow(unitky*lper,2.0) + pow(unitkz*mper,2.0); if (sqk != 0.0) { - + sum1 = 0.0; sum2 = 0.0; sum3 = 0.0; @@ -3175,8 +3175,8 @@ double PPPMDisp::compute_qopt_6_ik() for (k = nxlo_fft_6; k <= nxhi_fft_6; k++) { kper = k - nx_pppm_6*(2*k/nx_pppm_6); - - sqk = pow(unitkx*kper,2.0) + pow(unitky*lper,2.0) + + + sqk = pow(unitkx*kper,2.0) + pow(unitky*lper,2.0) + pow(unitkz*mper,2.0); if (sqk != 0.0) { @@ -3268,12 +3268,12 @@ double PPPMDisp::compute_qopt_6_ad() for (k = nxlo_fft_6; k <= nxhi_fft_6; k++) { kper = k - nx_pppm_6*(2*k/nx_pppm_6); - - sqk = pow(unitkx*kper,2.0) + pow(unitky*lper,2.0) + + + sqk = pow(unitkx*kper,2.0) + pow(unitky*lper,2.0) + pow(unitkz*mper,2.0); if (sqk != 0.0) { - + sum1 = 0.0; sum2 = 0.0; sum3 = 0.0; @@ -3333,11 +3333,11 @@ void PPPMDisp::set_grid_6() while (!factorable(nx_pppm_6)) nx_pppm_6++; while (!factorable(ny_pppm_6)) ny_pppm_6++; while (!factorable(nz_pppm_6)) nz_pppm_6++; - + } /* ---------------------------------------------------------------------- - Calculate the sum of the squared dispersion coefficients and other + Calculate the sum of the squared dispersion coefficients and other related quantities required for the calculations ------------------------------------------------------------------------- */ @@ -3346,17 +3346,17 @@ void PPPMDisp::calc_csum() csumij = 0.0; csum = 0.0; - int ntypes = atom->ntypes; + int ntypes = atom->ntypes; int i,j,k; delete [] cii; cii = new double[ntypes +1]; for (i = 0; i<=ntypes; i++) cii[i] = 0.0; - delete [] csumi; + delete [] csumi; csumi = new double[ntypes +1]; - for (i = 0; i<=ntypes; i++) csumi[i] = 0.0; + for (i = 0; i<=ntypes; i++) csumi[i] = 0.0; int *neach = new int[ntypes+1]; - for (i = 0; i<=ntypes; i++) neach[i] = 0; + for (i = 0; i<=ntypes; i++) neach[i] = 0; //the following variables are needed to distinguish between arithmetic // and geometric mixing @@ -3412,7 +3412,7 @@ void PPPMDisp::calc_csum() d1 = neach_all[i]*B[i]; d2 = neach_all[j]*B[j]; csumij += d1*d2; - //csumij += neach_all[i]*neach_all[j]*B[i]*B[j]; + //csumij += neach_all[i]*neach_all[j]*B[i]*B[j]; } } } @@ -3440,7 +3440,7 @@ void PPPMDisp::calc_csum() } } } - } + } delete [] neach; delete [] neach_all; @@ -3490,10 +3490,10 @@ double PPPMDisp::f_6() bigint natoms = atom->natoms; df_rspace = lj_rspace_error(); - + double qopt = compute_qopt_6(); df_kspace = sqrt(qopt/natoms)*csum/(xprd*yprd*zprd_slab); - + return df_rspace - df_kspace; } @@ -3501,21 +3501,21 @@ double PPPMDisp::f_6() Calculate numerical derivative f'(x) using forward difference [f(x + h) - f(x)] / h ------------------------------------------------------------------------- */ - + double PPPMDisp::derivf_6() -{ +{ double h = 0.000001; //Derivative step-size double df,f1,f2,g_ewald_old; - + f1 = f_6(); g_ewald_old = g_ewald_6; g_ewald_6 += h; f2 = f_6(); g_ewald_6 = g_ewald_old; df = (f2 - f1)/h; - + return df; -} +} /* ---------------------------------------------------------------------- @@ -3530,13 +3530,13 @@ void PPPMDisp::set_init_g6() // make initial g_ewald estimate // based on desired error and real space cutoff - + // compute initial value for df_real with g_ewald_6 = 1/cutoff_lj // if df_real > 0, repeat divide g_ewald_6 by 2 until df_real < 0 // else, repeat multiply g_ewald_6 by 2 until df_real > 0 // perform bisection for the last two values of double df_real; - double g_ewald_old; + double g_ewald_old; double gmin, gmax; // check if there is a user defined accuracy @@ -3608,7 +3608,7 @@ void PPPMDisp::set_n_pppm_6() // decrease grid spacing untill required precision is obtained int count = 0; while(1) { - + // set grid dimension nx_pppm_6 = static_cast<int> (xprd/h_x); ny_pppm_6 = static_cast<int> (yprd/h_y); @@ -3636,7 +3636,7 @@ void PPPMDisp::set_n_pppm_6() nzhi_fft_6 = (me_z+1)*nz_pppm_6/npez_fft - 1; double qopt = compute_qopt_6(); - + double df_kspace = sqrt(qopt/natoms)*csum/(xprd*yprd*zprd_slab); count++; @@ -3673,7 +3673,7 @@ double PPPMDisp::lj_rspace_error() /* ---------------------------------------------------------------------- Compyute the modified (hockney-eastwood) coulomb green function - ---------------------------------------------------------------------- */ + ---------------------------------------------------------------------- */ void PPPMDisp::compute_gf() { @@ -3738,7 +3738,7 @@ void PPPMDisp::compute_gf() if (sqk != 0.0) { numerator = 4.0*MY_PI/sqk; - denominator = gf_denom(snx2,sny2,snz2, gf_b, order); + denominator = gf_denom(snx2,sny2,snz2, gf_b, order); greensfn[n++] = numerator*sx*sy*sz*wx*wy*wz/denominator; } else greensfn[n++] = 0.0; } @@ -3748,10 +3748,10 @@ void PPPMDisp::compute_gf() /* ---------------------------------------------------------------------- compute self force coefficients for ad-differentiation scheme - and Coulomb interaction + and Coulomb interaction ------------------------------------------------------------------------- */ -void PPPMDisp::compute_sf_precoeff(int nxp, int nyp, int nzp, int ord, +void PPPMDisp::compute_sf_precoeff(int nxp, int nyp, int nzp, int ord, int nxlo_ft, int nylo_ft, int nzlo_ft, int nxhi_ft, int nyhi_ft, int nzhi_ft, double *sf_pre1, double *sf_pre2, double *sf_pre3, @@ -3795,7 +3795,7 @@ void PPPMDisp::compute_sf_precoeff(int nxp, int nyp, int nzp, int ord, for (k = nxlo_ft; k <= nxhi_ft; k++) { kper = k - nxp*(2*k/nxp); - + sum1 = sum2 = sum3 = sum4 = sum5 = sum6 = 0.0; for (i = -nb; i <= nb; i++) { @@ -3824,7 +3824,7 @@ void PPPMDisp::compute_sf_precoeff(int nxp, int nyp, int nzp, int ord, if (argy != 0.0) wy1[i+2] = pow(sin(argy)/argy,ord); argy = 0.5*qy2*yprd/nyp; if (argy != 0.0) wy2[i+2] = pow(sin(argy)/argy,ord); - + qz0 = unitkz*(mper+nzp*i); qz1 = unitkz*(mper+nzp*(i+1)); qz2 = unitkz*(mper+nzp*(i+2)); @@ -3838,7 +3838,7 @@ void PPPMDisp::compute_sf_precoeff(int nxp, int nyp, int nzp, int ord, argz = 0.5*qz2*zprd_slab/nzp; if (argz != 0.0) wz2[i+2] = pow(sin(argz)/argz,ord); } - + for (nx = 0; nx <= 4; nx++) { for (ny = 0; ny <= 4; ny++) { for (nz = 0; nz <= 4; nz++) { @@ -3859,7 +3859,7 @@ void PPPMDisp::compute_sf_precoeff(int nxp, int nyp, int nzp, int ord, } } } - + // store values sf_pre1[n] = sum1; @@ -3922,7 +3922,7 @@ void PPPMDisp::compute_gf_6() argz = 0.5*qz*zprd_slab/nz_pppm_6; if (argz != 0.0) wz = pow(sin(argz)/argz,order_6); wz *= wz; - + for (l = nylo_fft_6; l <= nyhi_fft_6; l++) { lper = l - ny_pppm_6*(2*l/ny_pppm_6); qy = unitky*lper; @@ -3944,11 +3944,11 @@ void PPPMDisp::compute_gf_6() argx = 0.5*qx*xprd/nx_pppm_6; if (argx != 0.0) wx = pow(sin(argx)/argx,order_6); wx *= wx; - + sqk = pow(qx,2.0) + pow(qy,2.0) + pow(qz,2.0); if (sqk != 0.0) { - denominator = gf_denom(snx2,sny2,snz2, gf_b_6, order_6); + denominator = gf_denom(snx2,sny2,snz2, gf_b_6, order_6); rtsqk = sqrt(sqk); term = (1-2*sqk*inv2ew*inv2ew)*sx*sy*sz + 2*sqk*rtsqk*inv2ew*inv2ew*inv2ew*rtpi*erfc(rtsqk*inv2ew); @@ -3961,7 +3961,7 @@ void PPPMDisp::compute_gf_6() /* ---------------------------------------------------------------------- compute self force coefficients for ad-differentiation scheme - and Coulomb interaction + and Coulomb interaction ------------------------------------------------------------------------- */ void PPPMDisp::compute_sf_coeff() { @@ -4017,7 +4017,7 @@ void PPPMDisp::compute_sf_coeff() /* ---------------------------------------------------------------------- compute self force coefficients for ad-differentiation scheme - and Dispersion interaction + and Dispersion interaction ------------------------------------------------------------------------- */ void PPPMDisp::compute_sf_coeff_6() @@ -4051,9 +4051,9 @@ void PPPMDisp::compute_sf_coeff_6() } } - + // perform multiplication with prefactors - + double prex, prey, prez; prex = prey = prez = MY_PI/volume; prex *= nx_pppm_6/xprd; @@ -4065,9 +4065,9 @@ void PPPMDisp::compute_sf_coeff_6() sf_coeff_6[3] *= prey*2; sf_coeff_6[4] *= prez; sf_coeff_6[5] *= prez*2; - + // communicate values with other procs - + double tmp[6]; MPI_Allreduce(sf_coeff_6,tmp,6,MPI_DOUBLE,MPI_SUM,world); for (n = 0; n < 6; n++) sf_coeff_6[n] = tmp[n]; @@ -4083,7 +4083,7 @@ void PPPMDisp::compute_sf_coeff_6() j=-inf l=0 = -(z*z)**n /(2n-1)! * (d/dx)**(2n-1) cot(x) at z = sin(x) - gf_b = denominator expansion coeffs + gf_b = denominator expansion coeffs ------------------------------------------------------------------------- */ double PPPMDisp::gf_denom(double x, double y, double z, double *g_b, int ord) @@ -4100,18 +4100,18 @@ double PPPMDisp::gf_denom(double x, double y, double z, double *g_b, int ord) } /* ---------------------------------------------------------------------- - pre-compute Green's function denominator expansion coeffs, Gamma(2n) + pre-compute Green's function denominator expansion coeffs, Gamma(2n) ------------------------------------------------------------------------- */ void PPPMDisp::compute_gf_denom(double* gf, int ord) { int k,l,m; - + for (l = 1; l < ord; l++) gf[l] = 0.0; gf[0] = 1.0; - + for (m = 1; m < ord; m++) { - for (l = m; l > 0; l--) + for (l = m; l > 0; l--) gf[l] = 4.0 * (gf[l]*(l-m)*(l-m-0.5)-gf[l-1]*(l-m-1)*(l-m-1)); gf[0] = 4.0 * (gf[0]*(l-m)*(l-m-0.5)); } @@ -4123,7 +4123,7 @@ void PPPMDisp::compute_gf_denom(double* gf, int ord) } /* ---------------------------------------------------------------------- - ghost-swap to accumulate full density in brick decomposition + ghost-swap to accumulate full density in brick decomposition remap density from 3d brick decomposition to FFTdecomposition for coulomb interaction or dispersion interaction with geometric mixing @@ -4151,7 +4151,7 @@ void PPPMDisp::brick2fft(int nxlo_i, int nylo_i, int nzlo_i, /* ---------------------------------------------------------------------- - ghost-swap to accumulate full density in brick decomposition + ghost-swap to accumulate full density in brick decomposition remap density from 3d brick decomposition to FFTdecomposition for dispersion with arithmetic mixing rule ------------------------------------------------------------------------- */ @@ -4188,7 +4188,7 @@ void PPPMDisp::brick2fft_a() } /* ---------------------------------------------------------------------- - ghost-swap to accumulate full density in brick decomposition + ghost-swap to accumulate full density in brick decomposition remap density from 3d brick decomposition to FFTdecomposition for dispersion with special case ------------------------------------------------------------------------- */ @@ -4205,7 +4205,7 @@ void PPPMDisp::brick2fft_none() n = 0; for (iz = nzlo_in_6; iz <= nzhi_in_6; iz++) for (iy = nylo_in_6; iy <= nyhi_in_6; iy++) - for (ix = nxlo_in_6; ix <= nxhi_in_6; ix++) + for (ix = nxlo_in_6; ix <= nxhi_in_6; ix++) density_fft_none[k][n++] = density_brick_none[k][iz][iy][ix]; } @@ -4216,7 +4216,7 @@ void PPPMDisp::brick2fft_none() /* ---------------------------------------------------------------------- find center grid pt for each of my particles check that full stencil for the particle will fit in my 3d brick - store central grid pt indices in part2grid array + store central grid pt indices in part2grid array ------------------------------------------------------------------------- */ void PPPMDisp::particle_map(double delx, double dely, double delz, @@ -4234,7 +4234,7 @@ void PPPMDisp::particle_map(double delx, double dely, double delz, int flag = 0; for (int i = 0; i < nlocal; i++) { - + // (nx,ny,nz) = global coords of grid pt to "lower left" of charge // current particle coord can be outside global and local box // add/subtract OFFSET to avoid int(-0.75) = 0 when want it to be -1 @@ -4272,7 +4272,7 @@ void PPPMDisp::particle_map_c(double delx, double dely, double delz, create discretized "density" on section of global grid due to my particles density(x,y,z) = charge "density" at grid points of my 3d brick (nxlo:nxhi,nylo:nyhi,nzlo:nzhi) is extent of my brick (including ghosts) - in global grid + in global grid ------------------------------------------------------------------------- */ void PPPMDisp::make_rho_c() @@ -4410,7 +4410,7 @@ void PPPMDisp::make_rho_a() int type; double **x = atom->x; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { //do the following for all 4 grids @@ -4470,7 +4470,7 @@ void PPPMDisp::make_rho_none() int type; double **x = atom->x; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { //do the following for all 4 grids @@ -4506,7 +4506,7 @@ void PPPMDisp::make_rho_none() ------------------------------------------------------------------------- */ void PPPMDisp::poisson_ik(FFT_SCALAR* wk1, FFT_SCALAR* wk2, - FFT_SCALAR* dfft, LAMMPS_NS::FFT3d* ft1,LAMMPS_NS::FFT3d* ft2, + FFT_SCALAR* dfft, LAMMPS_NS::FFT3d* ft1,LAMMPS_NS::FFT3d* ft2, int nx_p, int ny_p, int nz_p, int nft, int nxlo_ft, int nylo_ft, int nzlo_ft, int nxhi_ft, int nyhi_ft, int nzhi_ft, @@ -4525,7 +4525,7 @@ void PPPMDisp::poisson_ik(FFT_SCALAR* wk1, FFT_SCALAR* wk2, int i,j,k,n; double eng; - // transform charge/dispersion density (r -> k) + // transform charge/dispersion density (r -> k) n = 0; for (i = 0; i < nft; i++) { wk1[n++] = dfft[i]; @@ -4551,7 +4551,7 @@ void PPPMDisp::poisson_ik(FFT_SCALAR* wk1, FFT_SCALAR* wk2, } else { n = 0; for (i = 0; i < nft; i++) { - egy += + egy += s2 * gfn[i] * (wk1[n]*wk1[n] + wk1[n+1]*wk1[n+1]); n += 2; } @@ -4650,7 +4650,7 @@ void PPPMDisp::poisson_ik(FFT_SCALAR* wk1, FFT_SCALAR* wk2, ------------------------------------------------------------------------- */ void PPPMDisp::poisson_ad(FFT_SCALAR* wk1, FFT_SCALAR* wk2, - FFT_SCALAR* dfft, LAMMPS_NS::FFT3d* ft1,LAMMPS_NS::FFT3d* ft2, + FFT_SCALAR* dfft, LAMMPS_NS::FFT3d* ft1,LAMMPS_NS::FFT3d* ft2, int nx_p, int ny_p, int nz_p, int nft, int nxlo_ft, int nylo_ft, int nzlo_ft, int nxhi_ft, int nyhi_ft, int nzhi_ft, @@ -4666,7 +4666,7 @@ void PPPMDisp::poisson_ad(FFT_SCALAR* wk1, FFT_SCALAR* wk2, int i,j,k,n; double eng; - // transform charge/dispersion density (r -> k) + // transform charge/dispersion density (r -> k) n = 0; for (i = 0; i < nft; i++) { wk1[n++] = dfft[i]; @@ -4692,7 +4692,7 @@ void PPPMDisp::poisson_ad(FFT_SCALAR* wk1, FFT_SCALAR* wk2, } else { n = 0; for (i = 0; i < nft; i++) { - egy += + egy += s2 * gfn[i] * (wk1[n]*wk1[n] + wk1[n+1]*wk1[n+1]); n += 2; } @@ -4740,7 +4740,7 @@ void PPPMDisp::poisson_ad(FFT_SCALAR* wk1, FFT_SCALAR* wk2, Fourier Transform for per atom virial calculations ------------------------------------------------------------------------- */ -void PPPMDisp:: poisson_peratom(FFT_SCALAR* wk1, FFT_SCALAR* wk2, LAMMPS_NS::FFT3d* ft2, +void PPPMDisp:: poisson_peratom(FFT_SCALAR* wk1, FFT_SCALAR* wk2, LAMMPS_NS::FFT3d* ft2, double** vcoeff, double** vcoeff2, int nft, int nxlo_i, int nylo_i, int nzlo_i, int nxhi_i, int nyhi_i, int nzhi_i, @@ -4756,7 +4756,7 @@ void PPPMDisp:: poisson_peratom(FFT_SCALAR* wk1, FFT_SCALAR* wk2, LAMMPS_NS::FFT n += 2; } - ft2->compute(wk2,wk2,-1); + ft2->compute(wk2,wk2,-1); n = 0; for (k = nzlo_i; k <= nzhi_i; k++) @@ -4767,7 +4767,7 @@ void PPPMDisp:: poisson_peratom(FFT_SCALAR* wk1, FFT_SCALAR* wk2, LAMMPS_NS::FFT } //v2 & v3 term - + n = 0; for (i = 0; i < nft; i++) { wk2[n] = wk1[n]*vcoeff[i][2] - wk1[n+1]*vcoeff2[i][0]; @@ -4775,7 +4775,7 @@ void PPPMDisp:: poisson_peratom(FFT_SCALAR* wk1, FFT_SCALAR* wk2, LAMMPS_NS::FFT n += 2; } - ft2->compute(wk2,wk2,-1); + ft2->compute(wk2,wk2,-1); n = 0; for (k = nzlo_i; k <= nzhi_i; k++) @@ -4786,7 +4786,7 @@ void PPPMDisp:: poisson_peratom(FFT_SCALAR* wk1, FFT_SCALAR* wk2, LAMMPS_NS::FFT } //v4 & v5 term - + n = 0; for (i = 0; i < nft; i++) { wk2[n] = wk1[n]*vcoeff2[i][1] - wk1[n+1]*vcoeff2[i][2]; @@ -4794,7 +4794,7 @@ void PPPMDisp:: poisson_peratom(FFT_SCALAR* wk1, FFT_SCALAR* wk2, LAMMPS_NS::FFT n += 2; } - ft2->compute(wk2,wk2,-1); + ft2->compute(wk2,wk2,-1); n = 0; for (k = nzlo_i; k <= nzhi_i; k++) @@ -4802,12 +4802,12 @@ void PPPMDisp:: poisson_peratom(FFT_SCALAR* wk1, FFT_SCALAR* wk2, LAMMPS_NS::FFT for (i = nxlo_i; i <= nxhi_i; i++) { v4_pa[k][j][i] = wk2[n++]; v5_pa[k][j][i] = wk2[n++]; - } - + } + } /* ---------------------------------------------------------------------- - Poisson solver for one mesh with 2 different dispersion densities + Poisson solver for one mesh with 2 different dispersion densities for ik scheme ------------------------------------------------------------------------- */ @@ -4827,14 +4827,14 @@ void PPPMDisp::poisson_2s_ik(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, // transform charge/dispersion density (r -> k) // only one tansform required when energies and pressures do not - // need to be calculated + // need to be calculated if (eflag_global + vflag_global == 0) { n = 0; for (i = 0; i < nfft_6; i++) { work1_6[n++] = dfft_1[i]; work1_6[n++] = dfft_2[i]; } - + fft1_6->compute(work1_6,work1_6,1); } // two transforms are required when energies and pressures are @@ -4864,7 +4864,7 @@ void PPPMDisp::poisson_2s_ik(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, } else { n = 0; for (i = 0; i < nfft_6; i++) { - energy_6 += + energy_6 += 2 * s2 * greensfn_6[i] * (work1_6[n]*work2_6[n+1] - work1_6[n+1]*work2_6[n]); n += 2; } @@ -4897,7 +4897,7 @@ void PPPMDisp::poisson_2s_ik(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, } fft2_6->compute(work2_6,work2_6,-1); - + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -4949,7 +4949,7 @@ void PPPMDisp::poisson_2s_ik(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, } //Per-atom energy - + if (eflag_atom) { n = 0; for (i = 0; i < nfft_6; i++) { @@ -4957,9 +4957,9 @@ void PPPMDisp::poisson_2s_ik(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, work2_6[n+1] = work1_6[n+1]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -4967,7 +4967,7 @@ void PPPMDisp::poisson_2s_ik(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, u_pa_1[k][j][i] = work2_6[n++]; u_pa_2[k][j][i] = work2_6[n++]; } - } + } if (vflag_atom) poisson_2s_peratom(v0_pa_1, v1_pa_1, v2_pa_1, v3_pa_1, v4_pa_1, v5_pa_1, v0_pa_2, v1_pa_2, v2_pa_2, v3_pa_2, v4_pa_2, v5_pa_2); @@ -4975,7 +4975,7 @@ void PPPMDisp::poisson_2s_ik(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, /* ---------------------------------------------------------------------- - Poisson solver for one mesh with 2 different dispersion densities + Poisson solver for one mesh with 2 different dispersion densities for ik scheme ------------------------------------------------------------------------- */ @@ -4992,14 +4992,14 @@ void PPPMDisp::poisson_none_ik(int n1, int n2,FFT_SCALAR* dfft_1, FFT_SCALAR* df // transform charge/dispersion density (r -> k) // only one tansform required when energies and pressures do not - // need to be calculated + // need to be calculated if (eflag_global + vflag_global == 0) { n = 0; for (i = 0; i < nfft_6; i++) { work1_6[n++] = dfft_1[i]; work1_6[n++] = dfft_2[i]; } - + fft1_6->compute(work1_6,work1_6,1); } @@ -5014,7 +5014,7 @@ void PPPMDisp::poisson_none_ik(int n1, int n2,FFT_SCALAR* dfft_1, FFT_SCALAR* df work1_6[n] = ZEROF; work2_6[n++] = dfft_2[i]; } - + fft1_6->compute(work1_6,work1_6,1); fft1_6->compute(work2_6,work2_6,1); @@ -5032,7 +5032,7 @@ void PPPMDisp::poisson_none_ik(int n1, int n2,FFT_SCALAR* dfft_1, FFT_SCALAR* df } else { n = 0; for (i = 0; i < nfft_6; i++) { - energy_6 += + energy_6 += s2 * greensfn_6[i] * (B[n1]*(work1_6[n]*work1_6[n] + work1_6[n+1]*work1_6[n+1]) + B[n2]*(work2_6[n]*work2_6[n] + work2_6[n+1]*work2_6[n+1])); n += 2; } @@ -5065,7 +5065,7 @@ void PPPMDisp::poisson_none_ik(int n1, int n2,FFT_SCALAR* dfft_1, FFT_SCALAR* df } fft2_6->compute(work2_6,work2_6,-1); - + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5117,7 +5117,7 @@ void PPPMDisp::poisson_none_ik(int n1, int n2,FFT_SCALAR* dfft_1, FFT_SCALAR* df } //Per-atom energy - + if (eflag_atom) { n = 0; for (i = 0; i < nfft_6; i++) { @@ -5125,9 +5125,9 @@ void PPPMDisp::poisson_none_ik(int n1, int n2,FFT_SCALAR* dfft_1, FFT_SCALAR* df work2_6[n+1] = work1_6[n+1]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5135,7 +5135,7 @@ void PPPMDisp::poisson_none_ik(int n1, int n2,FFT_SCALAR* dfft_1, FFT_SCALAR* df u_pa[n1][k][j][i] = B[n1]*work2_6[n++]; u_pa[n2][k][j][i] = B[n2]*work2_6[n++]; } - } + } if (vflag_atom) poisson_none_peratom(n1,n2, v0_pa[n1], v1_pa[n1], v2_pa[n1], v3_pa[n1], v4_pa[n1], v5_pa[n1], @@ -5143,7 +5143,7 @@ void PPPMDisp::poisson_none_ik(int n1, int n2,FFT_SCALAR* dfft_1, FFT_SCALAR* df } /* ---------------------------------------------------------------------- - Poisson solver for one mesh with 2 different dispersion densities + Poisson solver for one mesh with 2 different dispersion densities for ad scheme ------------------------------------------------------------------------- */ @@ -5161,14 +5161,14 @@ void PPPMDisp::poisson_2s_ad(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, // transform charge/dispersion density (r -> k) // only one tansform required when energies and pressures do not - // need to be calculated + // need to be calculated if (eflag_global + vflag_global == 0) { n = 0; for (i = 0; i < nfft_6; i++) { work1_6[n++] = dfft_1[i]; work1_6[n++] = dfft_2[i]; } - + fft1_6->compute(work1_6,work1_6,1); } // two transforms are required when energies and pressures are @@ -5198,7 +5198,7 @@ void PPPMDisp::poisson_2s_ad(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, } else { n = 0; for (i = 0; i < nfft_6; i++) { - energy_6 += + energy_6 += 2 * s2 * greensfn_6[i] * (work1_6[n]*work2_6[n+1] - work1_6[n+1]*work2_6[n]); n += 2; } @@ -5223,23 +5223,23 @@ void PPPMDisp::poisson_2s_ad(FFT_SCALAR* dfft_1, FFT_SCALAR* dfft_2, work2_6[n+1] = work1_6[n+1]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) for (i = nxlo_in_6; i <= nxhi_in_6; i++) { u_pa_1[k][j][i] = work2_6[n++]; u_pa_2[k][j][i] = work2_6[n++]; - } + } if (vflag_atom) poisson_2s_peratom(v0_pa_1, v1_pa_1, v2_pa_1, v3_pa_1, v4_pa_1, v5_pa_1, v0_pa_2, v1_pa_2, v2_pa_2, v3_pa_2, v4_pa_2, v5_pa_2); } /* ---------------------------------------------------------------------- - Poisson solver for one mesh with 2 different dispersion densities + Poisson solver for one mesh with 2 different dispersion densities for ad scheme ------------------------------------------------------------------------- */ @@ -5255,14 +5255,14 @@ void PPPMDisp::poisson_none_ad(int n1, int n2, FFT_SCALAR* dfft_1, FFT_SCALAR* d // transform charge/dispersion density (r -> k) // only one tansform required when energies and pressures do not - // need to be calculated + // need to be calculated if (eflag_global + vflag_global == 0) { n = 0; for (i = 0; i < nfft_6; i++) { work1_6[n++] = dfft_1[i]; work1_6[n++] = dfft_2[i]; } - + fft1_6->compute(work1_6,work1_6,1); } // two transforms are required when energies and pressures are @@ -5292,7 +5292,7 @@ void PPPMDisp::poisson_none_ad(int n1, int n2, FFT_SCALAR* dfft_1, FFT_SCALAR* d } else { n = 0; for (i = 0; i < nfft_6; i++) { - energy_6 += + energy_6 += s2 * greensfn_6[i] * (B[n1]*(work1_6[n]*work1_6[n] + work1_6[n+1]*work1_6[n+1]) + B[n2]*(work2_6[n]*work2_6[n] + work2_6[n+1]*work2_6[n+1])); n += 2; } @@ -5317,16 +5317,16 @@ void PPPMDisp::poisson_none_ad(int n1, int n2, FFT_SCALAR* dfft_1, FFT_SCALAR* d work2_6[n+1] = work1_6[n+1]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) for (i = nxlo_in_6; i <= nxhi_in_6; i++) { u_pa_1[k][j][i] = B[n1]*work2_6[n++]; u_pa_2[k][j][i] = B[n2]*work2_6[n++]; - } + } if (vflag_atom) poisson_none_peratom(n1,n2, v0_pa[n1], v1_pa[n1], v2_pa[n1], v3_pa[n1], v4_pa[n1], v5_pa[n1], @@ -5351,9 +5351,9 @@ void PPPMDisp::poisson_2s_peratom(FFT_SCALAR*** v0_pa_1, FFT_SCALAR*** v1_pa_1, work2_6[n+1] = work1_6[n+1]*vg_6[i][0]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5361,18 +5361,18 @@ void PPPMDisp::poisson_2s_peratom(FFT_SCALAR*** v0_pa_1, FFT_SCALAR*** v1_pa_1, v0_pa_1[k][j][i] = work2_6[n++]; v0_pa_2[k][j][i] = work2_6[n++]; } - - //Compute second virial term v1 - + + //Compute second virial term v1 + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg_6[i][1]; work2_6[n+1] = work1_6[n+1]*vg_6[i][1]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5380,18 +5380,18 @@ void PPPMDisp::poisson_2s_peratom(FFT_SCALAR*** v0_pa_1, FFT_SCALAR*** v1_pa_1, v1_pa_1[k][j][i] = work2_6[n++]; v1_pa_2[k][j][i] = work2_6[n++]; } - + //Compute third virial term v2 - + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg_6[i][2]; work2_6[n+1] = work1_6[n+1]*vg_6[i][2]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5401,16 +5401,16 @@ void PPPMDisp::poisson_2s_peratom(FFT_SCALAR*** v0_pa_1, FFT_SCALAR*** v1_pa_1, } //Compute fourth virial term v3 - + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg2_6[i][0]; work2_6[n+1] = work1_6[n+1]*vg2_6[i][0]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5420,16 +5420,16 @@ void PPPMDisp::poisson_2s_peratom(FFT_SCALAR*** v0_pa_1, FFT_SCALAR*** v1_pa_1, } //Compute fifth virial term v4 - + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg2_6[i][1]; work2_6[n+1] = work1_6[n+1]*vg2_6[i][1]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5437,18 +5437,18 @@ void PPPMDisp::poisson_2s_peratom(FFT_SCALAR*** v0_pa_1, FFT_SCALAR*** v1_pa_1, v4_pa_1[k][j][i] = work2_6[n++]; v4_pa_2[k][j][i] = work2_6[n++]; } - + //Compute last virial term v5 - + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg2_6[i][2]; work2_6[n+1] = work1_6[n+1]*vg2_6[i][2]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5462,7 +5462,7 @@ void PPPMDisp::poisson_2s_peratom(FFT_SCALAR*** v0_pa_1, FFT_SCALAR*** v1_pa_1, Fourier Transform for per atom virial calculations ------------------------------------------------------------------------- */ -void PPPMDisp::poisson_none_peratom(int n1, int n2, +void PPPMDisp::poisson_none_peratom(int n1, int n2, FFT_SCALAR*** v0_pa_1, FFT_SCALAR*** v1_pa_1, FFT_SCALAR*** v2_pa_1, FFT_SCALAR*** v3_pa_1, FFT_SCALAR*** v4_pa_1, FFT_SCALAR*** v5_pa_1, FFT_SCALAR*** v0_pa_2, FFT_SCALAR*** v1_pa_2, FFT_SCALAR*** v2_pa_2, @@ -5477,9 +5477,9 @@ void PPPMDisp::poisson_none_peratom(int n1, int n2, work2_6[n+1] = work1_6[n+1]*vg_6[i][0]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5487,18 +5487,18 @@ void PPPMDisp::poisson_none_peratom(int n1, int n2, v0_pa_1[k][j][i] = B[n1]*work2_6[n++]; v0_pa_2[k][j][i] = B[n2]*work2_6[n++]; } - - //Compute second virial term v1 - + + //Compute second virial term v1 + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg_6[i][1]; work2_6[n+1] = work1_6[n+1]*vg_6[i][1]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5506,18 +5506,18 @@ void PPPMDisp::poisson_none_peratom(int n1, int n2, v1_pa_1[k][j][i] = B[n1]*work2_6[n++]; v1_pa_2[k][j][i] = B[n2]*work2_6[n++]; } - + //Compute third virial term v2 - + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg_6[i][2]; work2_6[n+1] = work1_6[n+1]*vg_6[i][2]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5527,16 +5527,16 @@ void PPPMDisp::poisson_none_peratom(int n1, int n2, } //Compute fourth virial term v3 - + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg2_6[i][0]; work2_6[n+1] = work1_6[n+1]*vg2_6[i][0]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5546,16 +5546,16 @@ void PPPMDisp::poisson_none_peratom(int n1, int n2, } //Compute fifth virial term v4 - + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg2_6[i][1]; work2_6[n+1] = work1_6[n+1]*vg2_6[i][1]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5563,18 +5563,18 @@ void PPPMDisp::poisson_none_peratom(int n1, int n2, v4_pa_1[k][j][i] = B[n1]*work2_6[n++]; v4_pa_2[k][j][i] = B[n2]*work2_6[n++]; } - + //Compute last virial term v5 - + n = 0; for (i = 0; i < nfft_6; i++) { work2_6[n] = work1_6[n]*vg2_6[i][2]; work2_6[n+1] = work1_6[n+1]*vg2_6[i][2]; n += 2; } - - fft2_6->compute(work2_6,work2_6,-1); - + + fft2_6->compute(work2_6,work2_6,-1); + n = 0; for (k = nzlo_in_6; k <= nzhi_in_6; k++) for (j = nylo_in_6; j <= nyhi_in_6; j++) @@ -5583,9 +5583,9 @@ void PPPMDisp::poisson_none_peratom(int n1, int n2, v5_pa_2[k][j][i] = B[n2]*work2_6[n++]; } } - + /* ---------------------------------------------------------------------- - interpolate from grid to get electric field & force on my particles + interpolate from grid to get electric field & force on my particles for ik scheme ------------------------------------------------------------------------- */ @@ -5644,7 +5644,7 @@ void PPPMDisp::fieldforce_c_ik() } /* ---------------------------------------------------------------------- interpolate from grid to get electric field & force on my particles - for ad scheme + for ad scheme ------------------------------------------------------------------------- */ void PPPMDisp::fieldforce_c_ad() @@ -5733,7 +5733,7 @@ void PPPMDisp::fieldforce_c_ad() } /* ---------------------------------------------------------------------- - interpolate from grid to get electric field & force on my particles + interpolate from grid to get electric field & force on my particles ------------------------------------------------------------------------- */ void PPPMDisp::fieldforce_c_peratom() @@ -5773,7 +5773,7 @@ void PPPMDisp::fieldforce_c_peratom() for (l = nlower; l <= nupper; l++) { mx = l+nx; x0 = y0*rho1d[0][l]; - if (eflag_atom) u_pa += x0*u_brick[mz][my][mx]; + if (eflag_atom) u_pa += x0*u_brick[mz][my][mx]; if (vflag_atom) { v0 += x0*v0_brick[mz][my][mx]; v1 += x0*v1_brick[mz][my][mx]; @@ -5804,7 +5804,7 @@ void PPPMDisp::fieldforce_c_peratom() /* ---------------------------------------------------------------------- interpolate from grid to get dispersion field & force on my particles - for geometric mixing rule + for geometric mixing rule ------------------------------------------------------------------------- */ void PPPMDisp::fieldforce_g_ik() @@ -5901,7 +5901,7 @@ void PPPMDisp::fieldforce_g_ad() int nlocal = atom->nlocal; - + for (i = 0; i < nlocal; i++) { nx = part2grid_6[i][0]; ny = part2grid_6[i][1]; @@ -6001,7 +6001,7 @@ void PPPMDisp::fieldforce_g_peratom() for (l = nlower_6; l <= nupper_6; l++) { mx = l+nx; x0 = y0*rho1d_6[0][l]; - if (eflag_atom) u_pa += x0*u_brick_g[mz][my][mx]; + if (eflag_atom) u_pa += x0*u_brick_g[mz][my][mx]; if (vflag_atom) { v0 += x0*v0_brick_g[mz][my][mx]; v1 += x0*v1_brick_g[mz][my][mx]; @@ -6402,22 +6402,22 @@ void PPPMDisp::fieldforce_a_peratom() lj5 = B[7*type+1]*0.5; lj6 = B[7*type]*0.5; - - if (eflag_atom) - eatom[i] += u_pa0*lj0 + u_pa1*lj1 + u_pa2*lj2 + + + if (eflag_atom) + eatom[i] += u_pa0*lj0 + u_pa1*lj1 + u_pa2*lj2 + u_pa3*lj3 + u_pa4*lj4 + u_pa5*lj5 + u_pa6*lj6; if (vflag_atom) { - vatom[i][0] += v00*lj0 + v01*lj1 + v02*lj2 + v03*lj3 + + vatom[i][0] += v00*lj0 + v01*lj1 + v02*lj2 + v03*lj3 + v04*lj4 + v05*lj5 + v06*lj6; - vatom[i][1] += v10*lj0 + v11*lj1 + v12*lj2 + v13*lj3 + + vatom[i][1] += v10*lj0 + v11*lj1 + v12*lj2 + v13*lj3 + v14*lj4 + v15*lj5 + v16*lj6; - vatom[i][2] += v20*lj0 + v21*lj1 + v22*lj2 + v23*lj3 + + vatom[i][2] += v20*lj0 + v21*lj1 + v22*lj2 + v23*lj3 + v24*lj4 + v25*lj5 + v26*lj6; - vatom[i][3] += v30*lj0 + v31*lj1 + v32*lj2 + v33*lj3 + + vatom[i][3] += v30*lj0 + v31*lj1 + v32*lj2 + v33*lj3 + v34*lj4 + v35*lj5 + v36*lj6; - vatom[i][4] += v40*lj0 + v41*lj1 + v42*lj2 + v43*lj3 + + vatom[i][4] += v40*lj0 + v41*lj1 + v42*lj2 + v43*lj3 + v44*lj4 + v45*lj5 + v46*lj6; - vatom[i][5] += v50*lj0 + v51*lj1 + v52*lj2 + v53*lj3 + + vatom[i][5] += v50*lj0 + v51*lj1 + v52*lj2 + v53*lj3 + v54*lj4 + v55*lj5 + v56*lj6; } } @@ -6563,7 +6563,7 @@ void PPPMDisp::fieldforce_none_ad() x0 = drho1d_6[0][l]*rho1d_6[1][m]*rho1d_6[2][n]; y0 = rho1d_6[0][l]*drho1d_6[1][m]*rho1d_6[2][n]; z0 = rho1d_6[0][l]*rho1d_6[1][m]*drho1d_6[2][n]; - + for (k = 0; k < nsplit; k++) { ekx[k] += x0*u_brick_none[k][mz][my][mx]; eky[k] += y0*u_brick_none[k][mz][my][mx]; @@ -6625,7 +6625,7 @@ void PPPMDisp::fieldforce_none_peratom() int i,k,l,m,n,nx,ny,nz,mx,my,mz; FFT_SCALAR dx,dy,dz,x0,y0,z0; FFT_SCALAR *u_pa,*v0,*v1,*v2,*v3,*v4,*v5; - + u_pa = new FFT_SCALAR[nsplit]; v0 = new FFT_SCALAR[nsplit]; v1 = new FFT_SCALAR[nsplit]; @@ -6656,9 +6656,9 @@ void PPPMDisp::fieldforce_none_peratom() dz = nz+shiftone_6 - (x[i][2]-boxlo[2])*delzinv_6; compute_rho1d(dx,dy,dz, order_6, rho_coeff_6, rho1d_6); - for (k = 0; k < nsplit; k++) + for (k = 0; k < nsplit; k++) u_pa[k] = v0[k] = v1[k] = v2[k] = v3[k] = v4[k] = v5[k] = ZEROF; - + for (n = nlower_6; n <= nupper_6; n++) { mz = n+nz; z0 = rho1d_6[2][n]; @@ -6689,7 +6689,7 @@ void PPPMDisp::fieldforce_none_peratom() type = atom->type[i]; for (k = 0; k < nsplit; k++) { lj = B[nsplit*type + k]*0.5; - + if (eflag_atom) { eatom[i] += u_pa[k]*lj; } @@ -7845,7 +7845,7 @@ void PPPMDisp::unpack_reverse(int flag, FFT_SCALAR *buf, int nlist, int *list) } /* ---------------------------------------------------------------------- - map nprocs to NX by NY grid as PX by PY procs - return optimal px,py + map nprocs to NX by NY grid as PX by PY procs - return optimal px,py ------------------------------------------------------------------------- */ void PPPMDisp::procs2grid2d(int nprocs, int nx, int ny, int *px, int *py) @@ -7869,7 +7869,7 @@ void PPPMDisp::procs2grid2d(int nprocs, int nx, int ny, int *px, int *py) boxy = ny/ipy; if (ny % ipy) boxy++; surf = boxx + boxy; - if (surf < bestsurf || + if (surf < bestsurf || (surf == bestsurf && boxx*boxy > bestboxx*bestboxy)) { bestsurf = surf; bestboxx = boxx; @@ -7884,11 +7884,11 @@ void PPPMDisp::procs2grid2d(int nprocs, int nx, int ny, int *px, int *py) /* ---------------------------------------------------------------------- charge assignment into rho1d - dx,dy,dz = distance of particle from "lower left" grid point + dx,dy,dz = distance of particle from "lower left" grid point ------------------------------------------------------------------------- */ void PPPMDisp::compute_rho1d(const FFT_SCALAR &dx, const FFT_SCALAR &dy, - const FFT_SCALAR &dz, int ord, + const FFT_SCALAR &dz, int ord, FFT_SCALAR **rho_c, FFT_SCALAR **r1d) { int k,l; @@ -7914,7 +7914,7 @@ void PPPMDisp::compute_rho1d(const FFT_SCALAR &dx, const FFT_SCALAR &dy, ------------------------------------------------------------------------- */ void PPPMDisp::compute_drho1d(const FFT_SCALAR &dx, const FFT_SCALAR &dy, - const FFT_SCALAR &dz, int ord, + const FFT_SCALAR &dz, int ord, FFT_SCALAR **drho_c, FFT_SCALAR **dr1d) { int k,l; @@ -7950,10 +7950,10 @@ void PPPMDisp::compute_drho1d(const FFT_SCALAR &dx, const FFT_SCALAR &dy, | 0 otherwise --- a coeffients are packed into the array rho_coeff to eliminate zeros - rho_coeff(l,((k+mod(n+1,2))/2) = a(l,k) + rho_coeff(l,((k+mod(n+1,2))/2) = a(l,k) ------------------------------------------------------------------------- */ -void PPPMDisp::compute_rho_coeff(FFT_SCALAR **coeff , FFT_SCALAR **dcoeff, +void PPPMDisp::compute_rho_coeff(FFT_SCALAR **coeff , FFT_SCALAR **dcoeff, int ord) { int j,k,l,m; @@ -7962,10 +7962,10 @@ void PPPMDisp::compute_rho_coeff(FFT_SCALAR **coeff , FFT_SCALAR **dcoeff, FFT_SCALAR **a; memory->create2d_offset(a,ord,-ord,ord,"pppm/disp:a"); - for (k = -ord; k <= ord; k++) + for (k = -ord; k <= ord; k++) for (l = 0; l < ord; l++) a[l][k] = 0.0; - + a[0][0] = 1.0; for (j = 1; j < ord; j++) { for (k = -j; k <= j; k += 2) { @@ -7976,7 +7976,7 @@ void PPPMDisp::compute_rho_coeff(FFT_SCALAR **coeff , FFT_SCALAR **dcoeff, s += powf(0.5,(float) l+1) * (a[l][k-1] + powf(-1.0,(float) l) * a[l][k+1]) / (l+1); #else - s += pow(0.5,(double) l+1) * + s += pow(0.5,(double) l+1) * (a[l][k-1] + pow(-1.0,(double) l) * a[l][k+1]) / (l+1); #endif } @@ -8128,7 +8128,7 @@ int PPPMDisp::timing_3d(int n, double &time3d) if (function[3]) mixing = nsplit_alloc/2; if (function[0]) for (int i = 0; i < 2*nfft_both; i++) work1[i] = ZEROF; - if (function[1] + function[2] + function[3]) + if (function[1] + function[2] + function[3]) for (int i = 0; i < 2*nfft_both_6; i++) work1_6[i] = ZEROF; @@ -8153,7 +8153,7 @@ int PPPMDisp::timing_3d(int n, double &time3d) MPI_Barrier(world); time1 = MPI_Wtime(); - + if (function[1] + function[2] + function[3]) { for (int i = 0; i < n; i++) { fft1_6->compute(work1_6,work1_6,1); @@ -8174,7 +8174,7 @@ int PPPMDisp::timing_3d(int n, double &time3d) } /* ---------------------------------------------------------------------- - memory usage of local arrays + memory usage of local arrays ------------------------------------------------------------------------- */ double PPPMDisp::memory_usage() @@ -8192,22 +8192,22 @@ double PPPMDisp::memory_usage() if (function[3]) mixing = nsplit_alloc; if (function[0]) { - int nbrick = (nxhi_out-nxlo_out+1) * (nyhi_out-nylo_out+1) * + int nbrick = (nxhi_out-nxlo_out+1) * (nyhi_out-nylo_out+1) * (nzhi_out-nzlo_out+1); bytes += (1 + diff + per) * nbrick * sizeof(FFT_SCALAR); //brick memory bytes += 6 * nfft_both * sizeof(double); // vg bytes += nfft_both * sizeof(double); // greensfn - bytes += nfft_both * 3 * sizeof(FFT_SCALAR); // density_FFT, work1, work2 + bytes += nfft_both * 3 * sizeof(FFT_SCALAR); // density_FFT, work1, work2 bytes += cg->memory_usage(); } if (function[1] + function[2] + function[3]) { - int nbrick = (nxhi_out_6-nxlo_out_6+1) * (nyhi_out_6-nylo_out_6+1) * + int nbrick = (nxhi_out_6-nxlo_out_6+1) * (nyhi_out_6-nylo_out_6+1) * (nzhi_out_6-nzlo_out_6+1); bytes += (1 + diff + per ) * nbrick * sizeof(FFT_SCALAR) * mixing; // density_brick + vd_brick + per atom bricks bytes += 6 * nfft_both_6 * sizeof(double); // vg bytes += nfft_both_6 * sizeof(double); // greensfn - bytes += nfft_both_6 * (mixing + 2) * sizeof(FFT_SCALAR); // density_FFT, work1, work2 + bytes += nfft_both_6 * (mixing + 2) * sizeof(FFT_SCALAR); // density_FFT, work1, work2 bytes += cg_6->memory_usage(); } return bytes; diff --git a/src/KSPACE/pppm_disp.h b/src/KSPACE/pppm_disp.h index 90da7eb392024e5effb22457ef2b192ae97f608b..ae07ea9e07b3f762df77c827b2cc28d3e9a8f3f8 100755 --- a/src/KSPACE/pppm_disp.h +++ b/src/KSPACE/pppm_disp.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -21,7 +21,7 @@ KSpaceStyle(pppm/disp,PPPMDisp) #define LMP_PPPM_DISP_H #include "lmptype.h" -#include "mpi.h" +#include <mpi.h> #ifdef FFT_SINGLE typedef float FFT_SCALAR; @@ -79,7 +79,7 @@ Variables needed for calculating the 1/r and 1/r^6 potential double delxinv,delyinv,delzinv,delvolinv; double delxinv_6,delyinv_6,delzinv_6,delvolinv_6; - + double shift,shiftone; int nxlo_in,nylo_in,nzlo_in,nxhi_in,nyhi_in,nzhi_in; int nxlo_out,nylo_out,nzlo_out,nxhi_out,nyhi_out,nzhi_out; @@ -171,9 +171,9 @@ Variables needed for calculating the 1/r and 1/r^6 potential double *gf_b; double *gf_b_6; - double *sf_precoeff1, *sf_precoeff2, *sf_precoeff3, *sf_precoeff4, + double *sf_precoeff1, *sf_precoeff2, *sf_precoeff3, *sf_precoeff4, *sf_precoeff5, *sf_precoeff6; - double *sf_precoeff1_6, *sf_precoeff2_6, *sf_precoeff3_6, + double *sf_precoeff1_6, *sf_precoeff2_6, *sf_precoeff3_6, *sf_precoeff4_6, *sf_precoeff5_6, *sf_precoeff6_6; FFT_SCALAR **rho1d,**rho_coeff; FFT_SCALAR **drho1d, **drho_coeff; @@ -248,9 +248,9 @@ Variables needed for calculating the 1/r and 1/r^6 potential double diffpr(double, double, double, double, double **); void compute_gf_denom(double*, int); double gf_denom(double, double, double, double*, int); - - void compute_sf_precoeff(int, int, int, int, + + void compute_sf_precoeff(int, int, int, int, int, int, int, int, int, int, double*, double*, double*, @@ -281,7 +281,7 @@ Variables needed for calculating the 1/r and 1/r^6 potential virtual void brick2fft_none(); virtual void poisson_ik(FFT_SCALAR *, FFT_SCALAR *, - FFT_SCALAR *, LAMMPS_NS::FFT3d *,LAMMPS_NS::FFT3d *, + FFT_SCALAR *, LAMMPS_NS::FFT3d *,LAMMPS_NS::FFT3d *, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, double&, double *, @@ -292,7 +292,7 @@ Variables needed for calculating the 1/r and 1/r^6 potential FFT_SCALAR ***, FFT_SCALAR ***, FFT_SCALAR ***); virtual void poisson_ad(FFT_SCALAR*, FFT_SCALAR*, - FFT_SCALAR*, LAMMPS_NS::FFT3d*,LAMMPS_NS::FFT3d*, + FFT_SCALAR*, LAMMPS_NS::FFT3d*,LAMMPS_NS::FFT3d*, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, @@ -301,7 +301,7 @@ Variables needed for calculating the 1/r and 1/r^6 potential FFT_SCALAR***, FFT_SCALAR***, FFT_SCALAR***, FFT_SCALAR***, FFT_SCALAR***, FFT_SCALAR***, FFT_SCALAR***); - virtual void poisson_peratom(FFT_SCALAR*, FFT_SCALAR*, LAMMPS_NS::FFT3d*, + virtual void poisson_peratom(FFT_SCALAR*, FFT_SCALAR*, LAMMPS_NS::FFT3d*, double**, double**, int, int, int, int, int, int, int, FFT_SCALAR***, FFT_SCALAR***, FFT_SCALAR***, @@ -325,7 +325,7 @@ Variables needed for calculating the 1/r and 1/r^6 potential FFT_SCALAR***, FFT_SCALAR***, FFT_SCALAR***); virtual void poisson_none_ad(int, int, FFT_SCALAR *, FFT_SCALAR *, - FFT_SCALAR ***, FFT_SCALAR ***, + FFT_SCALAR ***, FFT_SCALAR ***, FFT_SCALAR ****, FFT_SCALAR ****, FFT_SCALAR ****, FFT_SCALAR ****, FFT_SCALAR ****, FFT_SCALAR ****); virtual void poisson_none_ik(int, int, FFT_SCALAR *, FFT_SCALAR *, @@ -352,9 +352,9 @@ Variables needed for calculating the 1/r and 1/r^6 potential virtual void fieldforce_none_ad(); virtual void fieldforce_none_peratom(); void procs2grid2d(int,int,int,int *, int*); - void compute_rho1d(const FFT_SCALAR &, const FFT_SCALAR &, + void compute_rho1d(const FFT_SCALAR &, const FFT_SCALAR &, const FFT_SCALAR &, int, FFT_SCALAR **, FFT_SCALAR **); - void compute_drho1d(const FFT_SCALAR &, const FFT_SCALAR &, + void compute_drho1d(const FFT_SCALAR &, const FFT_SCALAR &, const FFT_SCALAR &, int, FFT_SCALAR **, FFT_SCALAR **); void compute_rho_coeff(FFT_SCALAR **,FFT_SCALAR **, int); void slabcorr(int); diff --git a/src/KSPACE/pppm_disp_tip4p.cpp b/src/KSPACE/pppm_disp_tip4p.cpp index c021e3dcc07e08762e5a14a6bdbcc17727f4bd9f..a44e524e9c7e45f7d0a31e87c7ce6c3f89fffe19 100755 --- a/src/KSPACE/pppm_disp_tip4p.cpp +++ b/src/KSPACE/pppm_disp_tip4p.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,7 +16,7 @@ Rolf Isele-Holder (Aachen University) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pppm_disp_tip4p.h" #include "pppm_disp.h" #include "atom.h" @@ -63,7 +63,7 @@ void PPPMDispTIP4P::init() /* ---------------------------------------------------------------------- find center grid pt for each of my particles check that full stencil for the particle will fit in my 3d brick - store central grid pt indices in part2grid array + store central grid pt indices in part2grid array ------------------------------------------------------------------------- */ void PPPMDispTIP4P::particle_map_c(double delx, double dely, double delz, @@ -84,7 +84,7 @@ void PPPMDispTIP4P::particle_map_c(double delx, double dely, double delz, int flag = 0; for (int i = 0; i < nlocal; i++) { if (type[i] == typeO) { - find_M(i,iH1,iH2,xM); + find_M(i,iH1,iH2,xM); xi = xM; } else xi = x[i]; @@ -107,7 +107,7 @@ void PPPMDispTIP4P::particle_map_c(double delx, double dely, double delz, nz+nlow < nzlo || nz+nup > nzhi) flag = 1; } - + if (flag) error->one(FLERR,"Out of range atoms - cannot compute PPPM"); } @@ -115,7 +115,7 @@ void PPPMDispTIP4P::particle_map_c(double delx, double dely, double delz, create discretized "density" on section of global grid due to my particles density(x,y,z) = charge "density" at grid points of my 3d brick (nxlo:nxhi,nylo:nyhi,nzlo:nzhi) is extent of my brick (including ghosts) - in global grid + in global grid ------------------------------------------------------------------------- */ void PPPMDispTIP4P::make_rho_c() @@ -134,14 +134,14 @@ void PPPMDispTIP4P::make_rho_c() // (dx,dy,dz) = distance to "lower left" grid pt // (mx,my,mz) = global coords of moving stencil pt - int *type = atom->type; + int *type = atom->type; double *q = atom->q; double **x = atom->x; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { if (type[i] == typeO) { - find_M(i,iH1,iH2,xM); + find_M(i,iH1,iH2,xM); xi = xM; } else xi = x[i]; @@ -171,7 +171,7 @@ void PPPMDispTIP4P::make_rho_c() } /* ---------------------------------------------------------------------- - interpolate from grid to get electric field & force on my particles + interpolate from grid to get electric field & force on my particles for ik differentiation ------------------------------------------------------------------------- */ @@ -199,7 +199,7 @@ void PPPMDispTIP4P::fieldforce_c_ik() for (i = 0; i < nlocal; i++) { if (type[i] == typeO) { - find_M(i,iH1,iH2,xM); + find_M(i,iH1,iH2,xM); xi = xM; } else xi = x[i]; @@ -260,7 +260,7 @@ void PPPMDispTIP4P::fieldforce_c_ik() /* ---------------------------------------------------------------------- interpolate from grid to get electric field & force on my particles - for ad scheme + for ad scheme ------------------------------------------------------------------------- */ void PPPMDispTIP4P::fieldforce_c_ad() @@ -287,7 +287,7 @@ void PPPMDispTIP4P::fieldforce_c_ad() double hx_inv = nx_pppm/xprd; double hy_inv = ny_pppm/yprd; double hz_inv = nz_pppm/zprd_slab; - + // loop over my charges, interpolate electric field from nearby grid points @@ -305,7 +305,7 @@ void PPPMDispTIP4P::fieldforce_c_ad() for (i = 0; i < nlocal; i++) { if (type[i] == typeO) { - find_M(i,iH1,iH2,xM); + find_M(i,iH1,iH2,xM); xi = xM; } else xi = x[i]; @@ -315,7 +315,7 @@ void PPPMDispTIP4P::fieldforce_c_ad() dx = nx+shiftone - (xi[0]-boxlo[0])*delxinv; dy = ny+shiftone - (xi[1]-boxlo[1])*delyinv; dz = nz+shiftone - (xi[2]-boxlo[2])*delzinv; - + compute_rho1d(dx,dy,dz, order, rho_coeff, rho1d); compute_drho1d(dx,dy,dz, order, drho_coeff, drho1d); @@ -336,7 +336,7 @@ void PPPMDispTIP4P::fieldforce_c_ad() ekx *= hx_inv; eky *= hy_inv; ekz *= hz_inv; - + // convert E-field to force and substract self forces const double qfactor = force->qqrd2e * scale; @@ -383,7 +383,7 @@ void PPPMDispTIP4P::fieldforce_c_ad() /* ---------------------------------------------------------------------- - interpolate from grid to get electric field & force on my particles + interpolate from grid to get electric field & force on my particles ------------------------------------------------------------------------- */ void PPPMDispTIP4P::fieldforce_c_peratom() @@ -408,7 +408,7 @@ void PPPMDispTIP4P::fieldforce_c_peratom() for (i = 0; i < nlocal; i++) { if (type[i] == typeO) { - find_M(i,iH1,iH2,xM); + find_M(i,iH1,iH2,xM); xi = xM; } else xi = x[i]; @@ -431,7 +431,7 @@ void PPPMDispTIP4P::fieldforce_c_peratom() for (l = nlower; l <= nupper; l++) { mx = l+nx; x0 = y0*rho1d[0][l]; - if (eflag_atom) u_pa += x0*u_brick[mz][my][mx]; + if (eflag_atom) u_pa += x0*u_brick[mz][my][mx]; if (vflag_atom) { v0 += x0*v0_brick[mz][my][mx]; v1 += x0*v1_brick[mz][my][mx]; @@ -502,7 +502,7 @@ void PPPMDispTIP4P::find_M(int i, int &iH1, int &iH2, double *xM) if (atom->type[iH1] != typeH || atom->type[iH2] != typeH) error->one(FLERR,"TIP4P hydrogen has incorrect atom type"); - double **x = atom->x; + double **x = atom->x; double delx1 = x[iH1][0] - x[i][0]; double dely1 = x[iH1][1] - x[i][1]; diff --git a/src/KSPACE/pppm_disp_tip4p.h b/src/KSPACE/pppm_disp_tip4p.h index 9a5e56660dc9b796ead041f732c8142090ffc72c..7b3c24db8be7289a8b098cdf35c0ca67f45596ac 100755 --- a/src/KSPACE/pppm_disp_tip4p.h +++ b/src/KSPACE/pppm_disp_tip4p.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -40,7 +40,7 @@ class PPPMDispTIP4P : public PPPMDisp { virtual void fieldforce_c_peratom(); private: - void find_M(int, int &, int &, double *); + void find_M(int, int &, int &, double *); }; } diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index 1a117c3bca5d448d281b0ca50009e610e30670b8..8cb71f3e6f66f515e6da43ee938dfc7b9acb9b3e 100755 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -15,11 +15,11 @@ Contributing author: Stan Moore (Sandia) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> #include "pppm_stagger.h" #include "atom.h" #include "gridcomm.h" @@ -51,7 +51,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ -PPPMStagger::PPPMStagger(LAMMPS *lmp, int narg, char **arg) : +PPPMStagger::PPPMStagger(LAMMPS *lmp, int narg, char **arg) : PPPM(lmp, narg, arg) { if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/stagger command"); @@ -160,7 +160,7 @@ void PPPMStagger::compute(int eflag, int vflag) particle_map(); make_rho(); - + // all procs communicate density values from their ghost cells // to fully sum contribution in their 3d bricks // remap from 3d decomposition to FFT decomposition @@ -177,14 +177,14 @@ void PPPMStagger::compute(int eflag, int vflag) // all procs communicate E-field values // to fill ghost cells surrounding their 3d bricks - + if (differentiation_flag == 1) cg->forward_comm(this,FORWARD_AD); else cg->forward_comm(this,FORWARD_IK); // extra per-atom energy/virial communication if (evflag_atom) { - if (differentiation_flag == 1 && vflag_atom) + if (differentiation_flag == 1 && vflag_atom) cg_peratom->forward_comm(this,FORWARD_AD_PERATOM); else if (differentiation_flag == 0) cg_peratom->forward_comm(this,FORWARD_IK_PERATOM); @@ -228,7 +228,7 @@ void PPPMStagger::compute(int eflag, int vflag) if (vflag_global) { double virial_all[6]; MPI_Allreduce(virial,virial_all,6,MPI_DOUBLE,MPI_SUM,world); - for (i = 0; i < 6; i++) + for (i = 0; i < 6; i++) virial[i] = 0.5*qscale*volume*virial_all[i]/float(nstagger); } diff --git a/src/KSPACE/pppm_stagger.h b/src/KSPACE/pppm_stagger.h index ca981072d74ac33293311a7a8ce010b7a40ebbdc..c096d3b0acd8c40477df509791827eee672a8956 100755 --- a/src/KSPACE/pppm_stagger.h +++ b/src/KSPACE/pppm_stagger.h @@ -43,7 +43,7 @@ class PPPMStagger : public PPPM { virtual void compute_gf_denom(); virtual void compute_gf_ik(); virtual void compute_gf_ad(); - + virtual void particle_map(); virtual void make_rho(); virtual void fieldforce_ik(); diff --git a/src/KSPACE/pppm_tip4p.cpp b/src/KSPACE/pppm_tip4p.cpp index f3c6d3c9a45208ce171120df4a19183cc909f400..6742a0b14d4008100423e513b086706b3df4f985 100644 --- a/src/KSPACE/pppm_tip4p.cpp +++ b/src/KSPACE/pppm_tip4p.cpp @@ -15,7 +15,7 @@ Contributing authors: Amalie Frischknecht and Ahmed Ismail (SNL) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pppm_tip4p.h" #include "atom.h" #include "domain.h" @@ -296,7 +296,7 @@ void PPPMTIP4P::fieldforce_ad() for (i = 0; i < nlocal; i++) { if (type[i] == typeO) { - find_M(i,iH1,iH2,xM); + find_M(i,iH1,iH2,xM); xi = xM; } else xi = x[i]; @@ -306,7 +306,7 @@ void PPPMTIP4P::fieldforce_ad() dx = nx+shiftone - (xi[0]-boxlo[0])*delxinv; dy = ny+shiftone - (xi[1]-boxlo[1])*delyinv; dz = nz+shiftone - (xi[2]-boxlo[2])*delzinv; - + compute_rho1d(dx,dy,dz); compute_drho1d(dx,dy,dz); @@ -327,7 +327,7 @@ void PPPMTIP4P::fieldforce_ad() ekx *= hx_inv; eky *= hy_inv; ekz *= hz_inv; - + // convert E-field to force and substract self forces const double qfactor = qqrd2e * scale; @@ -375,7 +375,7 @@ void PPPMTIP4P::fieldforce_ad() /* ---------------------------------------------------------------------- - interpolate from grid to get electric field & force on my particles + interpolate from grid to get electric field & force on my particles ------------------------------------------------------------------------- */ void PPPMTIP4P::fieldforce_peratom() @@ -401,7 +401,7 @@ void PPPMTIP4P::fieldforce_peratom() for (i = 0; i < nlocal; i++) { if (type[i] == typeO) { - find_M(i,iH1,iH2,xM); + find_M(i,iH1,iH2,xM); xi = xM; } else xi = x[i]; @@ -424,7 +424,7 @@ void PPPMTIP4P::fieldforce_peratom() for (l = nlower; l <= nupper; l++) { mx = l+nx; x0 = y0*rho1d[0][l]; - if (eflag_atom) u_pa += x0*u_brick[mz][my][mx]; + if (eflag_atom) u_pa += x0*u_brick[mz][my][mx]; if (vflag_atom) { v0 += x0*v0_brick[mz][my][mx]; v1 += x0*v1_brick[mz][my][mx]; diff --git a/src/KSPACE/remap.cpp b/src/KSPACE/remap.cpp index 115bcc25b8167e3b53cc1ff7bfd4ce74845f2c8b..86522f3f2f7f166c6e34e6043047998d0178cc37 100644 --- a/src/KSPACE/remap.cpp +++ b/src/KSPACE/remap.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" +#include <stdio.h> +#include <stdlib.h> #include "remap.h" #define PACK_DATA FFT_SCALAR @@ -64,7 +64,7 @@ void remap_3d(FFT_SCALAR *in, FFT_SCALAR *out, FFT_SCALAR *buf, { // use point-to-point communication - if (!plan->usecollective) { + if (!plan->usecollective) { int i,isend,irecv; FFT_SCALAR *scratch; @@ -111,7 +111,7 @@ void remap_3d(FFT_SCALAR *in, FFT_SCALAR *out, FFT_SCALAR *buf, // use All2Allv collective for remap communication - } else { + } else { if (plan->commringlen > 0) { int isend,irecv; @@ -124,9 +124,9 @@ void remap_3d(FFT_SCALAR *in, FFT_SCALAR *out, FFT_SCALAR *buf, for (int i=0;i<plan->nrecv;i++) recvBufferSize += plan->recv_size[i]; - FFT_SCALAR *packedSendBuffer + FFT_SCALAR *packedSendBuffer = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * sendBufferSize); - FFT_SCALAR *packedRecvBuffer + FFT_SCALAR *packedRecvBuffer = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * recvBufferSize); int *sendcnts = (int *) malloc(sizeof(int) * plan->commringlen); @@ -454,14 +454,14 @@ struct remap_plan_3d *remap_3d_create_plan( // create sub-comm rank list - if (plan->usecollective) { + if (plan->usecollective) { plan->commringlist = NULL; // merge recv and send rank lists - // ask Steve Plimpton about method to more accurately determine + // ask Steve Plimpton about method to more accurately determine // maximum number of procs contributing to pencil - int maxcommsize = nprocs; + int maxcommsize = nprocs; int *commringlist = (int *) malloc(maxcommsize*sizeof(int)); int commringlen = 0; diff --git a/src/KSPACE/remap_wrap.cpp b/src/KSPACE/remap_wrap.cpp index d790e9e7c03024de8ae3238b49f0f5688e82cc15..8ea2918d7f58b6bb9d5bcf4a1c4f7dd0439a2f41 100644 --- a/src/KSPACE/remap_wrap.cpp +++ b/src/KSPACE/remap_wrap.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "remap_wrap.h" #include "error.h" diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 877ff1c292ce4b74c692c0c2adeb7fd25a128dff..a05211ab64ab2abde9d3fe7d4cea200eb0da0648 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -15,10 +15,10 @@ Contributing authors: Ray Shan (Sandia, tnshan@sandia.gov) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "pair_comb.h" #include "pair_comb3.h" #include "fix_qeq_comb.h" @@ -290,7 +290,7 @@ double FixQEQComb::memory_usage() } /* ---------------------------------------------------------------------- */ -int FixQEQComb::pack_forward_comm(int n, int *list, double *buf, +int FixQEQComb::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/MANYBODY/fix_qeq_comb.h b/src/MANYBODY/fix_qeq_comb.h index 0ce0767dd15e675f629d756ac88a23b9c632ab4a..d627ef669b1a79721e4c528bc242d0eca3dd5f32 100644 --- a/src/MANYBODY/fix_qeq_comb.h +++ b/src/MANYBODY/fix_qeq_comb.h @@ -20,7 +20,7 @@ FixStyle(qeq/comb,FixQEQComb) #ifndef LMP_FIX_QEQ_COMB_H #define LMP_FIX_QEQ_COMB_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index 5cb861b563309b92e62c4680e3f602c35ed5f5fd..ce1c382da93876fa2652f37ca91ad47e1e19e0aa 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -16,10 +16,10 @@ Chandra Veer Singh (Cornell) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_adp.h" #include "atom.h" #include "force.h" @@ -934,7 +934,7 @@ void PairADP::grab(FILE *fp, int n, double *list) /* ---------------------------------------------------------------------- */ -int PairADP::pack_forward_comm(int n, int *list, double *buf, +int PairADP::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index f3a7be5a2d75054184bebcddfe9db9351c7c5053..d38440a1ffe64fa2b82b7aeb32e8cbb0ce484d1e 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -17,11 +17,11 @@ Marcel Fallet & Steve Stuart (Clemson), Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "mpi.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <mpi.h> #include "pair_airebo.h" #include "atom.h" #include "neighbor.h" @@ -4196,7 +4196,7 @@ double PairAIREBO::memory_usage() for (int i = 0; i < comm->nthreads; i++) bytes += ipage[i].size(); - + bytes += 2*maxlocal * sizeof(double); return bytes; } diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h index 8a6e52fead9c2dafbd6b65d4d64c8a15b8dd9b0d..b929621bd3348f31e155410bd3548edd13ad1226 100644 --- a/src/MANYBODY/pair_airebo.h +++ b/src/MANYBODY/pair_airebo.h @@ -22,7 +22,7 @@ PairStyle(airebo,PairAIREBO) #include "pair.h" #include "my_page.h" -#include "math.h" +#include <math.h> #include "math_const.h" namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index 20febf3a3791064250c9d72000f4538c96883700..037f893ea595babe764b1a5cc285623e0662118c 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -32,11 +32,11 @@ Rules"_http://lammps.sandia.gov/open_source.html ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "mpi.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <mpi.h> #include "pair_bop.h" #include "atom.h" #include "neighbor.h" @@ -49,7 +49,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "ctype.h" +#include <ctype.h> using namespace LAMMPS_NS; @@ -779,14 +779,14 @@ void PairBOP::gneigh() max_check3++; } } - + BOP_index[i]=neigh_total; BOP_index3[i]=neigh_total3; BOP_total[i]=max_check; BOP_total3[i]=max_check3; neigh_total+=max_check; neigh_total3+=max_check3; - + if(max_check>maxneigh||max_check3>maxneigh3){ maxneigh=max_check; maxneigh3=max_check3; @@ -901,9 +901,9 @@ void PairBOP::gneigh() for(jj=0;jj<nlisti;jj++) { temp_ij=BOP_index[i]+jj; j=iilist[neigh_index[temp_ij]]; - + jtype = map[type[j]]+1; - + if(itype==jtype) i12=itype-1; else if(itype<jtype) @@ -1231,7 +1231,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) ilist = list->ilist; firstneigh = list->firstneigh; MPI_Comm_rank(world,&me); - + if(nb_sg==0) { nb_sg=(maxneigh)*(maxneigh/2); } @@ -1246,7 +1246,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) } else { i=itmp; } - + i_tag=tag[i]; itype = map[type[i]]+1; @@ -1467,7 +1467,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) r_jk=rij[temp_jk]; } } - + sig_flag=0; for(nsearch=0;nsearch<nSigBk;nsearch++) { ncmp=itypeSigBk[nsearch]; @@ -1579,7 +1579,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) //1st CC is Eq. 11 (c) for i atom where j & k=neighbor of i AA=AA+gfactorsq*betaS_ik*betaS_ik; - + //agpdpr1 is derivative of AA w.r.t. Beta(rik) //app1 is derivative of AA w.r.t. cos(theta_jik) @@ -1706,8 +1706,8 @@ double PairBOP::sigmaBo(int itmp, int jtmp) *dis_jk[1]*r_ij*r_ij)/(r_ij*r_ij*r_jk*r_jk); dcA_ijk[2][1]=(-dis_ij[2]*r_ij*r_jk-cosAng_ijk *dis_jk[2]*r_ij*r_ij)/(r_ij*r_ij*r_jk*r_jk); - } - } else { + } + } else { if(neigh_flag[temp_jkp]) { pass_jkp=1; dis_jkp[0]=disij[0][temp_jkp]; @@ -1734,8 +1734,8 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dcA_ijk[0][1]=dcAng[ang_ijk][0][ngjk]; dcA_ijk[1][1]=dcAng[ang_ijk][1][ngjk]; dcA_ijk[2][1]=dcAng[ang_ijk][2][ngjk]; - } - } + } + } if(pass_jkp==1) { amean=cosAng_ijk; if(amean<-1.0) amean=-1.0; @@ -1792,7 +1792,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) ngkj=0; } ang_ikj=cos_index[k]+nikj; - + cosAng_ikj=cosAng[ang_ikj]; dcA_ikj[0][0]=dcAng[ang_ikj][0][ngki]; dcA_ikj[1][0]=dcAng[ang_ikj][1][ngki]; @@ -2133,7 +2133,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) } } } - + // j and k are different neighbors of i and k' is a neighbor k not equal to i for(ltmp=0;ltmp<nlistk;ltmp++) { @@ -2198,7 +2198,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dBetaS_kkp=dBetaS[temp_kkp]; } } - if(pass_kkp==1) { + if(pass_kkp==1) { sig_flag=0; for(nsearch=0;nsearch<nSigBk;nsearch++) { ncmp=itypeSigBk[nsearch]; @@ -2252,7 +2252,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dcA_ikkp[1][1]=dcAng[ang_ikkp][1][ngli]; dcA_ikkp[2][1]=dcAng[ang_ikkp][2][ngli]; } - + nb_kkp=nb_t; nb_t++; if(nb_t>nb_sg) { @@ -2301,7 +2301,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) //where j , k =neighbor of i & k' =neighbor of k CC=CC+gfactor*rfactor; - + //agpdpr1 is derivative of CC 3rd term w.r.t. Beta(r_ik) //agpdpr2 is derivative of CC 3rd term w.r.t. Beta(r_kk') //app1 is derivative of CC 3rd term w.r.t. cos(theta_jik) @@ -2353,7 +2353,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) kp=jlist[ni_jkp]; kptype = map[type[kp]]+1; kplist=firstneigh[kp]; - + same_kkpk=0; same_jkpj=0; nlistkp=BOP_total[kp]; @@ -2705,7 +2705,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) *(betaS_kkp+small2); rfactor=pow(rfactor0,2.0/3.0); drfactor=2.0/3.0*pow(rfactor0,-1.0/3.0); - + //EE is Eq. 25(notes) EE=EE+gfactor*rfactor; @@ -2786,7 +2786,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) temp_jk=BOP_index[j]+ktmp; ni_jk=neigh_index[temp_jk]; k=jlist[ni_jk]; - + klist=firstneigh[k]; ktype=map[type[k]]+1; nlistk=BOP_total[k]; @@ -2889,7 +2889,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) dcA_ijk[2][1]=dcAng[ang_ijk][2][ngk]; } } - if(pass_jk==1) { + if(pass_jk==1) { nb_jk=nb_t; nb_t++; if(nb_t>nb_sg) { @@ -3171,11 +3171,11 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor=gfactor1*gfactor2*gfactor3; rfactorrt=betaS_jk*betaS_jkp; rfactor=rfactorrt*rfactorrt; - + //2nd DD is Eq. 11 (c) for j atom where i , k & k'=neighbor of j DD=DD+2.0*gfactor*rfactor; - + //agpdpr1 is derivative of DD w.r.t. Beta(r_jk) //agpdpr2 is derivative of DD w.r.t. Beta(r_jk') //app1 is derivative of DD w.r.t. cos(theta_ijk) @@ -3222,7 +3222,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) app2*dcA_ijkp[2][1] +app3*dcA_kjkp[2][1] +agpdpr2*dis_jkp[2]; - + } } } @@ -3397,11 +3397,11 @@ double PairBOP::sigmaBo(int itmp, int jtmp) gfactor=gfactorsq*gfactorsq2; rfactorrt=betaS_jk*betaS_kkp; rfactor=rfactorrt*rfactorrt; - + //3rd DD is Eq. 11 (c) for j atom where i & k=neighbor of j & k'=neighbor of k DD=DD+gfactor*rfactor; - + //agpdpr1 is derivative of DD 3rd term w.r.t. Beta(r_jk) //agpdpr2 is derivative of DD 3rd term w.r.t. Beta(r_kk') //app1 is derivative of DD 3rd term w.r.t. cos(theta_ijk) @@ -3454,7 +3454,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) sigB=0.0; sig_flag=1; } - if(sig_flag==0){ + if(sig_flag==0){ if(sigma_a[iij]==0){ if(sig_flag==0) { if(AA<0.0) @@ -3684,7 +3684,7 @@ double PairBOP::sigmaBo(int itmp, int jtmp) //This loop is to ensure there is not an error for atoms with no neighbors (deposition) // sigB is the final expression for (a) Eq. 6 and (b) Eq. 11 - + if(nb_t==0) { if(j>i) { bt_sg[0].dSigB1[0]=bndtmp1*dis_ij[0]; @@ -3764,11 +3764,11 @@ double PairBOP::sigmaBo(int itmp, int jtmp) part2=1.0-part1*EE1/part0; part3=dsigB1*part1/part0; part4=part3/part0*EE1; - + // sigB is the final expression for (a) Eq. 6 and (b) Eq. 11 sigB=dsigB1*part2; - + pp1=2.0*betaS_ij; xtmp[0]=x[bt_j][0]-x[bt_i][0]; xtmp[1]=x[bt_j][1]-x[bt_i][1]; @@ -4674,7 +4674,7 @@ double PairBOP::PiBo(int itmp, int jtmp) +2.0*cosAng_ijkp*(1.0-cosSq); angFactor4=2.0*angFactor*angFactor-(1.0-cosSq)*(1.0-cosSq1); betaCapSum=.5*betaCapSq1*betaCapSq2; - + //4th BB is 4th term of Eq. 38 (a) where i , k and k' =neighbors j BB=BB+betaCapSum*angFactor4; @@ -5036,12 +5036,12 @@ void PairBOP::read_table(char *filename) } } } - if(nws==3) { + if(nws==3) { sscanf(s,"%d %d %d",&nr,&ntheta,&nBOt); npower=2; if(ntheta<=10) npower=ntheta; } - else { + else { sscanf(s,"%d %d",&nr,&nBOt); ntheta=0; npower=3; @@ -5077,7 +5077,7 @@ void PairBOP::read_table(char *filename) memory->create(gfunc5,bop_types,bop_types,bop_types,ntheta,"BOP:gfunc5"); memory->create(gfunc6,bop_types,bop_types,bop_types,ntheta,"BOP:gfunc6"); memory->create(gpara,bop_types,bop_types,bop_types,npower+1,"BOP:gpara"); - + allocate(); if (me == 0) { FILE *fp = force->open_potential(filename); @@ -5115,7 +5115,7 @@ void PairBOP::read_table(char *filename) for(j=0;j<bop_types;j++) for(k=j;k<bop_types;k++) { if(npower<=2) { - for(m=0;m<ntheta;m++) { + for(m=0;m<ntheta;m++) { fgets(s,MAXLINE,fp); sscanf(s,"%lf%lf%lf%lf%lf",&gfunc[j][i][k][n],&gfunc[j][i][k][n+1] ,&gfunc[j][i][k][n+2],&gfunc[j][i][k][n+3],&gfunc[j][i][k][n+4]); @@ -5372,11 +5372,11 @@ void PairBOP::read_table(char *filename) gfunc4[j][i][k][ntheta-1]=gfunc1[j][i][k][m]/dtheta; gfunc5[j][i][k][ntheta-1]=2.0*gfunc2[j][i][k][m]/dtheta; gfunc6[j][i][k][ntheta-1]=3.0*gfunc3[j][i][k][m]/dtheta; - } - } - } - } - } + } + } + } + } + } for(i=0;i<bop_types;i++) { for(j=0;j<bop_types;j++) { for(k=0;k<j;k++) { @@ -5393,11 +5393,11 @@ void PairBOP::read_table(char *filename) } else { for(n=0;n<npower+1;n++) { gpara[j][i][k][n]=gpara[k][i][j][n]; - } - } - } - } - } + } + } + } + } + } fclose(fp); } MPI_Bcast(&rdBO,1,MPI_DOUBLE,0,world); @@ -5736,7 +5736,7 @@ double PairBOP::memory_usage() bytes += bop_types*bop_types*bop_types*ntheta *sizeof(double); } else { bytes += bop_types*bop_types*bop_types*npower+1 *sizeof(double); - } + } return bytes; } diff --git a/src/MANYBODY/pair_bop.h b/src/MANYBODY/pair_bop.h index ed8d1fdc27f1b35395dbdc17c2cde66f93063021..28be43fc72636ef2ed8b8a073437e9f74277f398 100644 --- a/src/MANYBODY/pair_bop.h +++ b/src/MANYBODY/pair_bop.h @@ -26,7 +26,7 @@ PairStyle(bop,PairBOP) #define LMP_PAIR_BOP_H #include "pair.h" -#include "time.h" +#include <time.h> #include "update.h" namespace LAMMPS_NS { @@ -91,7 +91,7 @@ class PairBOP : public Pair { double *sigma_rc,*pi_rc,*phi_rc,*r1,*sigma_beta0; double *pi_beta0,*phi0,*sigma_n,*pi_n,*phi_m; double *sigma_nc,*pi_nc,*phi_nc; - double *pro,*sigma_delta,*sigma_c,*sigma_a; + double *pro,*sigma_delta,*sigma_c,*sigma_a; double *sigma_f,*sigma_k,*small3; double small1,small2,small3g,small4,small5,small6,small7; double which,alpha,alpha1,beta1,gamma1,alpha2,beta2,alpha3; diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 26ff69d56404ba6c7f918e37077555d0276a2a8b..083e63e9602f56e44564167ff2ea323195668cf4 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -18,10 +18,10 @@ and Aidan Thompson's Tersoff code in LAMMPS ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_comb.h" #include "atom.h" #include "comm.h" @@ -73,7 +73,7 @@ PairComb::PairComb(LAMMPS *lmp) : Pair(lmp) phin = NULL; dphin = NULL; erpaw = NULL; - + sht_num = NULL; sht_first = NULL; @@ -2002,7 +2002,7 @@ void PairComb::Over_cor(Param *param, double rsq1, int NCoi, /* ---------------------------------------------------------------------- */ -int PairComb::pack_forward_comm(int n, int *list, double *buf, +int PairComb::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index 2d1a782070965935cc2146ef71c365c5ff59a4c0..255e8a54c4db5b323e13a372c658555c27980793 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,10 +17,10 @@ Dundar Yilmaz (dundar.yilmaz@zirve.edu.tr) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_comb3.h" #include "atom.h" #include "comm.h" @@ -56,7 +56,7 @@ PairComb3::PairComb3(LAMMPS *lmp) : Pair(lmp) bbij = NULL; map = NULL; esm = NULL; - + nelements = 0; elements = NULL; nparams = 0; @@ -151,11 +151,11 @@ void PairComb3::allocate() memory->create(cutghost,n+1,n+1,"pair:cutghost"); map = new int[n+1]; - esm = new double[n]; + esm = new double[n]; } /* ---------------------------------------------------------------------- - global settings + global settings ------------------------------------------------------------------------- */ void PairComb3::settings(int narg, char **arg) @@ -227,7 +227,7 @@ void PairComb3::coeff(int narg, char **arg) } // read potential file and initialize potential parameters - + read_file(arg[2]); setup(); @@ -334,7 +334,7 @@ void PairComb3::read_lib() while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; ccutoff[0] = atof(words[0]); ccutoff[1] = atof(words[1]); - ccutoff[2] = atof(words[2]); + ccutoff[2] = atof(words[2]); ccutoff[3] = atof(words[3]); ccutoff[4] = atof(words[4]); ccutoff[5] = atof(words[5]); @@ -345,12 +345,12 @@ void PairComb3::read_lib() while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; ch_a[0] = atof(words[0]); ch_a[1] = atof(words[1]); - ch_a[2] = atof(words[2]); + ch_a[2] = atof(words[2]); ch_a[3] = atof(words[3]); ch_a[4] = atof(words[4]); ch_a[5] = atof(words[5]); ch_a[6] = atof(words[6]); - + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); @@ -358,7 +358,7 @@ void PairComb3::read_lib() nsplpcn = atoi(words[0]); nsplrad = atoi(words[1]); nspltor = atoi(words[2]); - + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); @@ -366,7 +366,7 @@ void PairComb3::read_lib() maxx = atoi(words[0]); maxy = atoi(words[1]); maxz = atoi(words[2]); - + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); @@ -375,7 +375,7 @@ void PairComb3::read_lib() maxyc = atoi(words[1]); maxconj = atoi(words[2]); - for (l=0; l<nsplpcn; l++) { + for (l=0; l<nsplpcn; l++) { fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); @@ -384,7 +384,7 @@ void PairComb3::read_lib() vmaxxcn[l] = atof(words[2]); dvmaxxcn[l] = atof(words[3]); } - + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); @@ -392,7 +392,7 @@ void PairComb3::read_lib() ntab = atoi(words[0]); for (i=0; i<ntab+1; i++){ - fgets(s,maxlib,fp); + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; @@ -401,14 +401,14 @@ void PairComb3::read_lib() ddpang[i] = atof(words[3]); } - for (l=0; l<nsplpcn; l++) + for (l=0; l<nsplpcn; l++) for (i=0; i<maxx+1; i++) for (j=0; j<maxy+1; j++) - for (k=0; k<maxz+1; k++) { - fgets(s,maxlib,fp); + for (k=0; k<maxz+1; k++) { + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; + while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; ll = atoi(words[0])-1; ii = atoi(words[1]); jj = atoi(words[2]); @@ -422,8 +422,8 @@ void PairComb3::read_lib() for (l=0; l<nsplpcn; l++) for (i=0; i<maxx; i++) for (j=0; j<maxy; j++) - for (k=0; k<maxz; k++) { - fgets(s,maxlib,fp); + for (k=0; k<maxz; k++) { + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; @@ -432,7 +432,7 @@ void PairComb3::read_lib() jj = atoi(words[2]); kk = atoi(words[3]); for(iii=0; iii<2; iii++) { - fgets(s,maxlib,fp); + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; @@ -443,11 +443,11 @@ void PairComb3::read_lib() } } - for (l=0; l<nsplrad; l++) + for (l=0; l<nsplrad; l++) for (i=0; i<maxxc+1; i++) for (j=0; j<maxyc+1; j++) - for (k=0; k<maxconj; k++) { - fgets(s,maxlib,fp); + for (k=0; k<maxconj; k++) { + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; @@ -464,8 +464,8 @@ void PairComb3::read_lib() for (l=0; l<nsplrad; l++) for (i=0; i<maxxc; i++) for (j=0; j<maxyc; j++) - for (k=0; k<maxconj-1; k++) { - fgets(s,maxlib,fp); + for (k=0; k<maxconj-1; k++) { + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; @@ -484,12 +484,12 @@ void PairComb3::read_lib() } } } - + for (l=0; l<nspltor; l++) for (i=0; i<maxxc+1; i++) for (j=0; j<maxyc+1; j++) - for (k=0; k<maxconj; k++) { - fgets(s,maxlib,fp); + for (k=0; k<maxconj; k++) { + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; @@ -502,12 +502,12 @@ void PairComb3::read_lib() tor_gridy[ll][ii][jj][kk] = atof(words[6]); tor_gridz[ll][ii][jj][kk] = atof(words[7]); } - + for (l=0; l<nspltor; l++) for (i=0; i<maxxc; i++) for (j=0; j<maxyc; j++) - for (k=0; k<maxconj-1; k++) { - fgets(s,maxlib,fp); + for (k=0; k<maxconj-1; k++) { + fgets(s,maxlib,fp); nwords = 0; words[nwords++] = strtok(s," \t\n\r\f"); while ((words[nwords++] = strtok(NULL," \t\n\r\f")))continue; @@ -526,9 +526,9 @@ void PairComb3::read_lib() } } } - + fclose(fp); - } + } k = 0; for (i=0; i<4; i++) @@ -559,30 +559,30 @@ void PairComb3::read_lib() MPI_Bcast(&maxxc,1,MPI_INT,0,world); MPI_Bcast(&maxyc,1,MPI_INT,0,world); MPI_Bcast(&maxconj,1,MPI_INT,0,world); - MPI_Bcast(&maxxcn,4,MPI_INT,0,world); + MPI_Bcast(&maxxcn,4,MPI_INT,0,world); MPI_Bcast(&vmaxxcn,4,MPI_DOUBLE,0,world); MPI_Bcast(&dvmaxxcn,4,MPI_DOUBLE,0,world); MPI_Bcast(&ntab,1,MPI_INT,0,world); MPI_Bcast(&pang[0],20001,MPI_DOUBLE,0,world); MPI_Bcast(&dpang[0],20001,MPI_DOUBLE,0,world); MPI_Bcast(&ddpang[0],20001,MPI_DOUBLE,0,world); - MPI_Bcast(&pcn_grid[0][0][0][0],500,MPI_DOUBLE,0,world); + MPI_Bcast(&pcn_grid[0][0][0][0],500,MPI_DOUBLE,0,world); MPI_Bcast(&pcn_gridx[0][0][0][0],500,MPI_DOUBLE,0,world); MPI_Bcast(&pcn_gridy[0][0][0][0],500,MPI_DOUBLE,0,world); MPI_Bcast(&pcn_gridz[0][0][0][0],500,MPI_DOUBLE,0,world); - MPI_Bcast(&pcn_cubs[0][0][0][0][0],16384,MPI_DOUBLE,0,world); + MPI_Bcast(&pcn_cubs[0][0][0][0][0],16384,MPI_DOUBLE,0,world); - MPI_Bcast(&rad_grid[0][0][0][0],825,MPI_DOUBLE,0,world); + MPI_Bcast(&rad_grid[0][0][0][0],825,MPI_DOUBLE,0,world); MPI_Bcast(&rad_gridx[0][0][0][0],825,MPI_DOUBLE,0,world); MPI_Bcast(&rad_gridy[0][0][0][0],825,MPI_DOUBLE,0,world); MPI_Bcast(&rad_gridz[0][0][0][0],825,MPI_DOUBLE,0,world); - MPI_Bcast(&rad_spl[0][0][0][0][0],30720,MPI_DOUBLE,0,world); + MPI_Bcast(&rad_spl[0][0][0][0][0],30720,MPI_DOUBLE,0,world); MPI_Bcast(&tor_grid[0][0][0][0],275,MPI_DOUBLE,0,world); MPI_Bcast(&tor_gridx[0][0][0][0],275,MPI_DOUBLE,0,world); MPI_Bcast(&tor_gridy[0][0][0][0],275,MPI_DOUBLE,0,world); MPI_Bcast(&tor_gridz[0][0][0][0],275,MPI_DOUBLE,0,world); - MPI_Bcast(&tor_spl[0][0][0][0][0],10240,MPI_DOUBLE,0,world); + MPI_Bcast(&tor_spl[0][0][0][0][0],10240,MPI_DOUBLE,0,world); MPI_Bcast(&iin2[0][0],32,MPI_INT,0,world); MPI_Bcast(&iin3[0][0],192,MPI_INT,0,world); @@ -665,7 +665,7 @@ void PairComb3::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((nwords <= params_per_line) + while ((nwords <= params_per_line) && (words[nwords++] = strtok(NULL," \t\n\r\f"))) { continue; } @@ -673,7 +673,7 @@ void PairComb3::read_file(char *file) // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line // else skip to next line - + for (ielement = 0; ielement < nelements; ielement++) if (strcmp(words[0],elements[ielement]) == 0) break; if (ielement == nelements) continue; @@ -706,8 +706,8 @@ void PairComb3::read_file(char *file) params[nparams].powerm = atof(words[11]); params[nparams].veps = atof(words[12]); params[nparams].vsig = atof(words[13]); - params[nparams].paaa = atof(words[14]); - params[nparams].pbbb = atof(words[15]); + params[nparams].paaa = atof(words[14]); + params[nparams].pbbb = atof(words[15]); params[nparams].lami = atof(words[16]); params[nparams].alfi = atof(words[17]); params[nparams].powern = atof(words[18]); @@ -737,7 +737,7 @@ void PairComb3::read_file(char *file) params[nparams].alpha2 = atof(words[42]); params[nparams].bigB2 = atof(words[43]); params[nparams].alpha3 = atof(words[44]); - params[nparams].bigB3 = atof(words[45]); + params[nparams].bigB3 = atof(words[45]); params[nparams].lambda = atof(words[46]); params[nparams].bigA = atof(words[47]); params[nparams].beta = atof(words[48]); @@ -770,25 +770,25 @@ void PairComb3::read_file(char *file) // parameter sanity checks - if (params[nparams].lambda < 0.0 || params[nparams].powern < 0.0 || - params[nparams].beta < 0.0 || params[nparams].alpha1 < 0.0 || - params[nparams].bigB1< 0.0 || params[nparams].bigA< 0.0 || + if (params[nparams].lambda < 0.0 || params[nparams].powern < 0.0 || + params[nparams].beta < 0.0 || params[nparams].alpha1 < 0.0 || + params[nparams].bigB1< 0.0 || params[nparams].bigA< 0.0 || params[nparams].bigB2< 0.0 || params[nparams].alpha2 <0.0 || params[nparams].bigB3< 0.0 || params[nparams].alpha3 <0.0 || params[nparams].bigr < 0.0 || params[nparams].bigd < 0.0 || params[nparams].bigd > params[nparams].bigr || params[nparams].powerm - params[nparams].powermint != 0.0 || params[nparams].addrepr < 0.0 || params[nparams].powermint < 1.0 || - params[nparams].QL > 0.0 || params[nparams].QU < 0.0 || + params[nparams].QL > 0.0 || params[nparams].QU < 0.0 || params[nparams].DL < 0.0 || params[nparams].DU > 0.0 || - params[nparams].pcross < 0.0 || - params[nparams].esm < 0.0 || params[nparams].veps < 0.0 || - params[nparams].vsig < 0.0 || params[nparams].vdwflag < 0.0 + params[nparams].pcross < 0.0 || + params[nparams].esm < 0.0 || params[nparams].veps < 0.0 || + params[nparams].vsig < 0.0 || params[nparams].vdwflag < 0.0 ) error->all(FLERR,"Illegal COMB3 parameter"); nparams++; - } + } delete [] words; } @@ -811,7 +811,7 @@ void PairComb3::setup() for (k = 0; k < nelements; k++) { n = -1; for (m = 0; m < nparams; m++) { - if (i == params[m].ielement && j == params[m].jelement && + if (i == params[m].ielement && j == params[m].jelement && k == params[m].kelement) { if (n >= 0) error->all(FLERR,"Potential file has duplicate entry"); n = m; @@ -833,14 +833,14 @@ void PairComb3::setup() params[m].Qo = (params[m].QU+params[m].QL)/2.0; // (A22) params[m].dQ = (params[m].QU-params[m].QL)/2.0; // (A21) - params[m].aB = 1.0 / + params[m].aB = 1.0 / (1.0-pow(fabs(params[m].Qo/params[m].dQ),10)); // (A20) params[m].bB = pow(fabs(params[m].aB),0.1)/params[m].dQ; // (A19) params[m].nD = log(params[m].DU/(params[m].DU-params[m].DL))/ log(params[m].QU/(params[m].QU-params[m].QL)); params[m].bD = (pow((params[m].DL-params[m].DU),(1.0/params[m].nD)))/ (params[m].QU-params[m].QL); - + params[m].lcut = params[m].coulcut; params[m].lcutsq = params[m].lcut*params[m].lcut; } @@ -855,7 +855,7 @@ void PairComb3::setup() } chicut1 = 7.0; chicut2 = cutmax; -} +} /* ---------------------------------------------------------------------- */ @@ -917,22 +917,22 @@ void PairComb3::Short_neigh() rsq1 = vec3_dot(delrj,delrj); jtype = map[type[j]]; iparam_ij = elem2param[itype][jtype][jtype]; - + if (rsq1 > cutmin) continue; neighptrj[nj++] = j; rr1 = sqrt(rsq1); - NCo[i] += comb_fc(rr1,¶ms[iparam_ij]) * params[iparam_ij].pcross; - + NCo[i] += comb_fc(rr1,¶ms[iparam_ij]) * params[iparam_ij].pcross; + icontrol = params[iparam_ij].jelementgp; - + if( icontrol == 1) - xcctmp[i] += comb_fc(rr1,¶ms[iparam_ij]) * params[iparam_ij].pcross; - if (icontrol == 2) - xchtmp[i] += comb_fc(rr1,¶ms[iparam_ij]) * params[iparam_ij].pcross; + xcctmp[i] += comb_fc(rr1,¶ms[iparam_ij]) * params[iparam_ij].pcross; + if (icontrol == 2) + xchtmp[i] += comb_fc(rr1,¶ms[iparam_ij]) * params[iparam_ij].pcross; if (icontrol == 3) - xcotmp[i] += comb_fc(rr1,¶ms[iparam_ij]) * params[iparam_ij].pcross; - + xcotmp[i] += comb_fc(rr1,¶ms[iparam_ij]) * params[iparam_ij].pcross; + } sht_first[i] = neighptrj; @@ -960,21 +960,21 @@ void PairComb3::compute(int eflag, int vflag) int *ilist,*jlist,*numneigh,**firstneigh,mr1,mr2,mr3,inty,nj; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; double rsq,rsq1,rsq2,rsq3,iq,jq,yaself; - double eng_tmp,vionij,fvionij,sr1,sr2,sr3; + double eng_tmp,vionij,fvionij,sr1,sr2,sr3; double zeta_ij,prefac_ij1,prefac_ij2,prefac_ij3,prefac_ij4,prefac_ij5; double zeta_ji,prefac_ji1,prefac_ji2,prefac_ji3,prefac_ji4,prefac_ji5; double delrj[3],delrk[3],fi[3],fj[3],fk[3],fl[3]; double ep6p_ij,ep6p_ji,fip6p[3],fjp6p[3],fkp6p[3],flp6p[3]; double potal,fac11,fac11e; tagint itag, jtag; - + int nlocal = atom->nlocal; int newton_pair = force->newton_pair; tagint *tag = atom->tag; int *type = atom->type; double **x = atom->x; double **f = atom->f; - double *q = atom->q; + double *q = atom->q; // coordination terms double xcn, ycn; @@ -986,7 +986,7 @@ void PairComb3::compute(int eflag, int vflag) int iparam_jil, iparam_ijl, iparam_ki, iparam_lj; int iparam_jl, iparam_ik, iparam_km, iparam_lp; double kconjug, lconjug, kradtot, lradtot; - double delrl[3], delrm[3], delrp[3], ddprx[3], srmu; + double delrl[3], delrm[3], delrp[3], ddprx[3], srmu; double zet_addi,zet_addj; evdwl = eng_tmp = 0.0; @@ -1001,7 +1001,7 @@ void PairComb3::compute(int eflag, int vflag) ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - yaself = vionij = fvionij = fpair = 0.0; + yaself = vionij = fvionij = fpair = 0.0; // self energy correction term: potal potal_calc(potal,fac11,fac11e); @@ -1031,7 +1031,7 @@ void PairComb3::compute(int eflag, int vflag) if (x[j][2] < x[i][2]) continue; if (x[j][2] == ztmp && x[j][1] < ytmp) continue; if (x[j][2] == ztmp && x[j][1] == ytmp && x[j][0] < xtmp) continue; - } + } jtype = map[type[j]]; jq = q[j]; @@ -1047,7 +1047,7 @@ void PairComb3::compute(int eflag, int vflag) if (rsq > params[iparam_ij].lcutsq) continue; tri_point(rsq, mr1, mr2, mr3, sr1, sr2, sr3); - + dipole_init(¶ms[iparam_ij],¶ms[iparam_ji],fac11,delrj, rsq,mr1,mr2,mr3,sr1,sr2,sr3,iq,jq,i,j); } @@ -1064,7 +1064,7 @@ void PairComb3::compute(int eflag, int vflag) iq = q[i]; nj = 0; iparam_i = elem2param[itype][itype][itype]; - + // self energy, only on i atom yaself = self(¶ms[iparam_i],iq); @@ -1073,7 +1073,7 @@ void PairComb3::compute(int eflag, int vflag) yaself += dipole_self(¶ms[iparam_i],i); if (evflag) ev_tally(i,i,nlocal,0,0.0,yaself,0.0,0.0,0.0,0.0); - + // two-body interactions (long:R + A, short: only R) jlist = firstneigh[i]; @@ -1095,7 +1095,7 @@ void PairComb3::compute(int eflag, int vflag) if (x[j][2] < x[i][2]) continue; if (x[j][2] == ztmp && x[j][1] < ytmp) continue; if (x[j][2] == ztmp && x[j][1] == ytmp && x[j][0] < xtmp) continue; - } + } jtype = map[type[j]]; jq = q[j]; @@ -1126,12 +1126,12 @@ void PairComb3::compute(int eflag, int vflag) if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); - + // Q-dependent: Coulombic, field, polarization // 1/r energy and forces - direct(¶ms[iparam_ij], ¶ms[iparam_ji], - mr1, mr2, mr3, rsq, sr1, sr2, sr3, iq, jq, + direct(¶ms[iparam_ij], ¶ms[iparam_ji], + mr1, mr2, mr3, rsq, sr1, sr2, sr3, iq, jq, fac11, fac11e, eng_tmp, fvionij, i, j); vionij = eng_tmp; @@ -1150,7 +1150,7 @@ void PairComb3::compute(int eflag, int vflag) f[j][2] -= delz*fvionij; // sums up long range Q-dependent energies (excluding dipole) - if (evflag) + if (evflag) ev_tally(i,j,nlocal,newton_pair,0.0,vionij,fvionij,delx,dely,delz); // polarization field @@ -1161,7 +1161,7 @@ void PairComb3::compute(int eflag, int vflag) vionij = eng_tmp; // sums up dipole energies - if (evflag) + if (evflag) ev_tally(i,j,nlocal,newton_pair,0.0,vionij,fvionij,delx,dely,delz); // sums up dipole forces @@ -1171,15 +1171,15 @@ void PairComb3::compute(int eflag, int vflag) f[j][0] -= (ddprx[0] + delx*fvionij); f[j][1] -= (ddprx[1] + dely*fvionij); f[j][2] -= (ddprx[2] + delz*fvionij); - } - + } + if (rsq > params[iparam_ij].cutsq) continue; repulsive(¶ms[iparam_ij], ¶ms[iparam_ji], rsq, fpair, eflag, eng_tmp, iq, jq); evdwl = eng_tmp; - + // repulsion is pure two-body, sums up pair repulsive forces f[i][0] += delx*fpair; f[i][1] += dely*fpair; @@ -1187,7 +1187,7 @@ void PairComb3::compute(int eflag, int vflag) f[j][0] -= delx*fpair; f[j][1] -= dely*fpair; f[j][2] -= delz*fpair; - + if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); } @@ -1213,13 +1213,13 @@ void PairComb3::compute(int eflag, int vflag) rsq1 = vec3_dot(delrj,delrj); if (rsq1 > params[iparam_ij].cutsq) continue; nj ++; - + // this Qj for q-dependent BSi jq = q[j]; - + // accumulate bondorder zeta for each i-j interaction via k and l loops - zeta_ij = 0.0; - bbtor = 0.0; + zeta_ij = 0.0; + bbtor = 0.0; kconjug = 0.0; for (kk = 0; kk < sht_jnum; kk++) { // kk is neighbor of ii @@ -1235,7 +1235,7 @@ void PairComb3::compute(int eflag, int vflag) delrk[1] = x[k][1] - ytmp; delrk[2] = x[k][2] - ztmp; rsq2 = vec3_dot(delrk,delrk); - + if (rsq2 > params[iparam_ik].cutsq) continue; // 3-body zeta in bond order @@ -1260,13 +1260,13 @@ void PairComb3::compute(int eflag, int vflag) if(srmu > 0.1) { for (ll = 0; ll < sht_lnum; ll++) { // ll is neighbor of jj - l = sht_llist[ll]; + l = sht_llist[ll]; - if(l==i || l==j || l==k) continue; + if(l==i || l==j || l==k) continue; ltype = map[type[l]]; - delrl[0] = x[l][0] - x[j][0]; + delrl[0] = x[l][0] - x[j][0]; delrl[1] = x[l][1] - x[j][1]; delrl[2] = x[l][2] - x[j][2]; rsq3 = vec3_dot(delrl,delrl); @@ -1274,20 +1274,20 @@ void PairComb3::compute(int eflag, int vflag) if (rsq3 > params[iparam_jl].cutsq) continue; - iparam_ikl = elem2param[itype][ktype][ltype]; + iparam_ikl = elem2param[itype][ktype][ltype]; torindx = params[iparam_ij].tor_flag; bbtor += bbtor1(torindx, ¶ms[iparam_ikl],¶ms[iparam_jl], rsq1,rsq2,rsq3,delrj,delrk,delrl,srmu); } } } - } + } - zeta_ji = 0.0; + zeta_ji = 0.0; lconjug = 0.0; - for (ll = 0; ll < sht_lnum; ll++) { - l = sht_llist[ll]; + for (ll = 0; ll < sht_lnum; ll++) { + l = sht_llist[ll]; if (l == i) continue; ltype = map[type[l]]; @@ -1321,7 +1321,7 @@ void PairComb3::compute(int eflag, int vflag) lcn=NCo[l]; lconjug += rad_init(rsq2,¶ms[iparam_lj],j,lradtot,lcn); } - } + } force_zeta(¶ms[iparam_ij], ¶ms[iparam_ji], rsq1, xcn, ycn, zeta_ij, zeta_ji, fpair, @@ -1362,14 +1362,14 @@ void PairComb3::compute(int eflag, int vflag) delrk[2] = x[k][2] - ztmp; rsq2 = vec3_dot(delrk,delrk); if (rsq2 > params[iparam_ik].cutsq) continue; - + // BO-dependent 3-body E & F attractive(¶ms[iparam_ijk], ¶ms[iparam_jik],¶ms[iparam_ikj], prefac_ij1, prefac_ij2, prefac_ij3, prefac_ij4, prefac_ij5, rsq1,rsq2,delrj,delrk,fi,fj,fk,i,xcn); ep6p_ij = ep6p(¶ms[iparam_ijk],¶ms[iparam_ikj],rsq1,rsq2,delrj,delrk,zet_addi); - fp6p(¶ms[iparam_ijk],¶ms[iparam_ikj],rsq1,rsq2,delrj,delrk,fip6p,fjp6p,fkp6p); + fp6p(¶ms[iparam_ijk],¶ms[iparam_ikj],rsq1,rsq2,delrj,delrk,fip6p,fjp6p,fkp6p); // Sums up i-j-k forces: LP contribution for (im = 0; im < 3; im++) { @@ -1392,19 +1392,19 @@ void PairComb3::compute(int eflag, int vflag) if(srmu > 0.1) { for (ll = 0; ll < sht_lnum; ll++) { // ll is neighbor of jj - l = sht_llist[ll]; - if (l==i||l==j||l==k) continue; + l = sht_llist[ll]; + if (l==i||l==j||l==k) continue; ltype = map[type[l]]; - delrl[0] = x[l][0] - x[j][0]; + delrl[0] = x[l][0] - x[j][0]; delrl[1] = x[l][1] - x[j][1]; delrl[2] = x[l][2] - x[j][2]; rsq3 = vec3_dot(delrl,delrl); - + iparam_jl = elem2param[jtype][ltype][ltype]; if (rsq3 > params[iparam_jl].cutsq) continue; - iparam_ikl = elem2param[itype][ktype][ltype]; + iparam_ikl = elem2param[itype][ktype][ltype]; torindx = params[iparam_ij].tor_flag; tor_force(torindx, ¶ms[iparam_ikl], ¶ms[iparam_jl],srmu, rsq1,rsq2,rsq3,delrj,delrk,delrl); @@ -1420,13 +1420,13 @@ void PairComb3::compute(int eflag, int vflag) } if( params[iparam_ijk].rad_flag>=1 && - params[iparam_ijk].ielementgp==1 && + params[iparam_ijk].ielementgp==1 && params[iparam_ijk].kelementgp==1) { iparam_ki = elem2param[ktype][itype][itype]; kcn=NCo[k]; double rik=sqrt(rsq2); kradtot = -comb_fc(rik,¶ms[iparam_ki])*params[iparam_ki].pcross+kcn; - + rad_forceik(¶ms[iparam_ki],rsq2,delrk,kconjug,kradtot); for (im = 0; im < 3; im++) { @@ -1437,11 +1437,11 @@ void PairComb3::compute(int eflag, int vflag) if (fabs(radtmp) > 1.0e-12) { for (mm = 0; mm < sht_mnum; mm++) { // mm is neighbor of kk m = sht_mlist[mm]; - if (m == k) continue; + if (m == k) continue; mtype = map[type[m]]; - delrm[0] = x[m][0] - x[k][0]; + delrm[0] = x[m][0] - x[k][0]; delrm[1] = x[m][1] - x[k][1]; delrm[2] = x[m][2] - x[k][2]; rsq3 = vec3_dot(delrm,delrm); @@ -1461,7 +1461,7 @@ void PairComb3::compute(int eflag, int vflag) } } - if (evflag) + if (evflag) ev_tally(i,j,nlocal,newton_pair,ep6p_ij,0.0,0.0,0.0,0.0,0.0); if (vflag_atom) v_tally3(i,j,k,fj,fk,delrj,delrk); @@ -1481,7 +1481,7 @@ void PairComb3::compute(int eflag, int vflag) iparam_jli = elem2param[jtype][ltype][itype]; iparam_ijl = elem2param[itype][jtype][ltype]; iparam_jl = elem2param[jtype][ltype][ltype]; - delrk[0] = x[l][0] - x[j][0]; + delrk[0] = x[l][0] - x[j][0]; delrk[1] = x[l][1] - x[j][1]; delrk[2] = x[l][2] - x[j][2]; @@ -1495,9 +1495,9 @@ void PairComb3::compute(int eflag, int vflag) // BO-independent 3-body j-i-l LP and BB correction and forces ep6p_ji = ep6p(¶ms[iparam_jil],¶ms[iparam_jli],rsq1,rsq2,delrl,delrk,zet_addj); - fp6p(¶ms[iparam_jil],¶ms[iparam_jli],rsq1,rsq2,delrl,delrk,fjp6p,fip6p,flp6p); + fp6p(¶ms[iparam_jil],¶ms[iparam_jli],rsq1,rsq2,delrl,delrk,fjp6p,fip6p,flp6p); - if (evflag) + if (evflag) ev_tally(j,i,nlocal,newton_pair,ep6p_ji,0.0,0.0,0.0,0.0,0.0); // BO-dependent 3-body E & F @@ -1513,9 +1513,9 @@ void PairComb3::compute(int eflag, int vflag) f[i][im] += fi[im]; f[l][im] += fl[im]; } - + // radical i-j-l-p: apply to all CC,CO,OC bonds - if( params[iparam_jil].rad_flag >= 1 && + if( params[iparam_jil].rad_flag >= 1 && params[iparam_jil].ielementgp == 1 && params[iparam_jil].kelementgp == 1 ) { iparam_lj = elem2param[ltype][jtype][jtype]; @@ -1533,10 +1533,10 @@ void PairComb3::compute(int eflag, int vflag) if (fabs(radtmp)>1.0e-12) { for (pp = 0; pp < sht_pnum; pp++) { // pp is neighbor of ll p = sht_plist[pp]; - if (p == l) continue; + if (p == l) continue; ptype = map[type[p]]; - delrp[0] = x[p][0] - x[l][0]; + delrp[0] = x[p][0] - x[l][0]; delrp[1] = x[p][1] - x[l][1]; delrp[2] = x[p][2] - x[l][2]; rsq3 = vec3_dot(delrp,delrp); @@ -1558,7 +1558,7 @@ void PairComb3::compute(int eflag, int vflag) if (vflag_atom) v_tally3(j,i,l,fi,fl,delrl,delrk); - } + } } } @@ -1568,7 +1568,7 @@ void PairComb3::compute(int eflag, int vflag) /* ---------------------------------------------------------------------- */ -void PairComb3::repulsive(Param *parami, Param *paramj, double rsq, +void PairComb3::repulsive(Param *parami, Param *paramj, double rsq, double &fforce,int eflag, double &eng, double iq, double jq) { double r,tmp_fc,tmp_fc_d,Di,Dj; @@ -1595,14 +1595,14 @@ void PairComb3::repulsive(Param *parami, Param *paramj, double rsq, LamDiLamDj = exp(0.5*(parami->lami*Di+paramj->lami*Dj)-rlm1*r); caj = bigA * LamDiLamDj; - fforce = -caj * fcdA; + fforce = -caj * fcdA; - // additional repulsion + // additional repulsion vrcs = 1.0; fvrcs = 0.0; - if (romi != 0.0 && r < addr) { + if (romi != 0.0 && r < addr) { vrcs += romi * pow((1.0-r/addr),2.0); - fvrcs = romi * 2.0 * (r/addr-1.0)/addr; + fvrcs = romi * 2.0 * (r/addr-1.0)/addr; fforce = fforce*vrcs - caj * tmp_fc * vrcs * fvrcs; } fforce /= r; @@ -1613,7 +1613,7 @@ void PairComb3::repulsive(Param *parami, Param *paramj, double rsq, /* ---------------------------------------------------------------------- */ -double PairComb3::zeta(Param *parami, Param *paramj, double rsqij, +double PairComb3::zeta(Param *parami, Param *paramj, double rsqij, double rsqik, double *delrij, double *delrik, int i, double xcn) { double rij,rik,costheta,arg,ex_delr,rlm3; @@ -1634,7 +1634,7 @@ double PairComb3::zeta(Param *parami, Param *paramj, double rsqij, /* ---------------------------------------------------------------------- */ -void PairComb3::selfp6p(Param *parami, Param *paramj, double rsq, +void PairComb3::selfp6p(Param *parami, Param *paramj, double rsq, double &eng, double &force) { double r,comtti,comttj,fcj,fcj_d; @@ -1676,7 +1676,7 @@ double PairComb3::ep6p(Param *paramj, Param *paramk, double rsqij, double rsqik, fcj = comb_fc(rij,paramj); fck = comb_fc(rik,paramk); - rmu = costheta; + rmu = costheta; rmu2 = rmu *rmu; rmu3 = rmu2*rmu; rmu4 = rmu3*rmu; rmu5 = rmu4*rmu; rmu6 = rmu5*rmu; lp0 = pplp0; @@ -1693,7 +1693,7 @@ double PairComb3::ep6p(Param *paramj, Param *paramk, double rsqij, double rsqik, /*---------------------------------------------------------------------- */ void PairComb3::fp6p(Param *paramij,Param *paramik, double rsqij, double rsqik, - double *delrij, double *delrik, double *drilp, + double *delrij, double *delrik, double *drilp, double *drjlp, double *drklp) { double pplp0 = paramij->p6p0; @@ -1705,17 +1705,17 @@ void PairComb3::fp6p(Param *paramij,Param *paramik, double rsqij, double rsqik, double lp0,lp1,lp2,lp3,lp4,lp5,lp6; double lp1_d,lp2_d,lp3_d,lp4_d,lp5_d,lp6_d; double rmu2, rmu3, rmu4, rmu5, rmu6; - + ffj1 = 0.0, ffj2 = 0.0; ffk1 = 0.0, ffk2 = 0.0; rij = sqrt(rsqij); rik = sqrt(rsqik); - costheta = vec3_dot(delrij,delrik) / (rij*rik); + costheta = vec3_dot(delrij,delrik) / (rij*rik); fcj = comb_fc(rij,paramij); fck = comb_fc(rik,paramik); fcj_d = comb_fc_d(rij,paramij); fck_d = comb_fc_d(rik,paramik); - rmu = costheta; + rmu = costheta; rmu2 = rmu *rmu; rmu3 = rmu2*rmu; rmu4 = rmu3*rmu; rmu5 = rmu4*rmu; rmu6 = rmu5*rmu; @@ -1734,38 +1734,38 @@ void PairComb3::fp6p(Param *paramij,Param *paramik, double rsqij, double rsqik, lp6_d = pplp6*6.0*rmu5; comtt = lp0 + lp1 + lp2 + lp3 + lp4 + lp5 + lp6; comtt_d = lp1_d + lp2_d + lp3_d + lp4_d + lp5_d + lp6_d; - + com4k = fcj * fck_d * comtt; com5 = fcj * fck * comtt_d; - com5k = fck * comtt * fcj_d; + com5k = fck * comtt * fcj_d; - ffj1 = 0.5*(-com5/(rij*rik)); - ffj2 = 0.5*(com5*rmu/rsqij-com5k/rij); + ffj1 = 0.5*(-com5/(rij*rik)); + ffj2 = 0.5*(com5*rmu/rsqij-com5k/rij); ffk1 = ffj1; ffk2 = 0.5*(-com4k/rik+com5*rmu/rsqik); // j-atom - vec3_scale(ffj1,delrik,drjlp); + vec3_scale(ffj1,delrik,drjlp); vec3_scaleadd(ffj2,delrij,drjlp,drjlp); - + // k-atom vec3_scale(ffk1,delrij,drklp); vec3_scaleadd(ffk2,delrik,drklp,drklp); - - // i-atom - vec3_add(drjlp,drklp,drilp); + + // i-atom + vec3_add(drjlp,drklp,drilp); vec3_scale(-1.0,drilp,drilp); } /* ---------------------------------------------------------------------- */ -void PairComb3::force_zeta(Param *parami, Param *paramj, double rsq, - double xcn, double ycn, double &zeta_ij, double &zeta_ji, double &fforce, +void PairComb3::force_zeta(Param *parami, Param *paramj, double rsq, + double xcn, double ycn, double &zeta_ij, double &zeta_ji, double &fforce, double &prefac_ij1, double &prefac_ij2, double &prefac_ij3, double &prefac_ij4, double &prefac_ij5, - double &prefac_ji1, double &prefac_ji2, double &prefac_ji3, + double &prefac_ji1, double &prefac_ji2, double &prefac_ji3, double &prefac_ji4, double &prefac_ji5, - int eflag, double &eng, double iq, double jq, + int eflag, double &eng, double iq, double jq, int i, int j, int nj, double bbtor, double kconjug, double lconjug) { double r,att_eng,att_force,bij; // att_eng is -cbj @@ -1817,10 +1817,10 @@ void PairComb3::force_zeta(Param *parami, Param *paramj, double rsq, // combines com6 & com7 below if ( parami->rad_flag>0 || parami->tor_flag!=0 ) { - prefac_ij2-=pradx; + prefac_ij2-=pradx; prefac_ji2-=prady; } - + // eng = attraction energy if (eflag) eng = 1.0*bij*att_eng; } @@ -1865,7 +1865,7 @@ double PairComb3::comb_fccc_d(double xcn) { double cut1 = ccutoff[0]; double cut2 = ccutoff[1]; - + if (xcn <= cut1) return 0.0; if (xcn >= cut2) return 0.0; return -MY_PI2/(cut2-cut1)*sin(MY_PI*(xcn-cut1)/(cut2-cut1)); @@ -1889,7 +1889,7 @@ double PairComb3::comb_fcch_d(double xcn) { double cut1 = ccutoff[2]; double cut2 = ccutoff[3]; - + if (xcn <= cut1) return 0.0; if (xcn >= cut2) return 0.0; return -MY_PI2/(cut2-cut1)*sin(MY_PI*(xcn-cut1)/(cut2-cut1)); @@ -1924,7 +1924,7 @@ double PairComb3::comb_fccch_d(double xcn) double PairComb3::comb_fcsw(double rsq) { double r = sqrt(rsq); - + if (r <= chicut1) return 1.0; if (r >= chicut2) return 0.0; return 0.5*(1.0 + cos(MY_PI*(r-chicut1)/(chicut2-chicut1))); @@ -1937,23 +1937,23 @@ double PairComb3::self(Param *param, double qi) double self_tmp, cmin, cmax, qmin, qmax; double s1=param->chi, s2=param->dj, s3=param->dk, s4=param->dl; - self_tmp = 0.0; + self_tmp = 0.0; qmin = param->qmin; qmax = param->qmax; cmin = cmax = 100.0; - + self_tmp = qi*(s1+qi*(s2+qi*(s3+qi*s4))); if (qi < qmin) self_tmp += cmin * pow((qi-qmin),4); if (qi > qmax) self_tmp += cmax * pow((qi-qmax),4); - + return self_tmp; } /* ---------------------------------------------------------------------- */ -void PairComb3::comb_fa(double r, Param *parami, Param *paramj, double iq, +void PairComb3::comb_fa(double r, Param *parami, Param *paramj, double iq, double jq, double &att_eng, double &att_force) { double Bsi; @@ -1993,8 +1993,8 @@ void PairComb3::comb_fa(double r, Param *parami, Param *paramj, double iq, /* ---------------------------------------------------------------------- */ -void PairComb3::comb_bij_d(double zet, Param *param, double r, int i, - double &tbij, double &tbij1, double &tbij2, +void PairComb3::comb_bij_d(double zet, Param *param, double r, int i, + double &tbij, double &tbij1, double &tbij2, double &tbij3, double &tbij4, double &tbij5, double xcn) { double pcorn,dpcorn,dxccij,dxchij,dxcoij; @@ -2006,7 +2006,7 @@ void PairComb3::comb_bij_d(double zet, Param *param, double r, int i, zetang=zeta; pow_n=param->powern; - zeta = pow(zetang,pow_n)+pcorn; + zeta = pow(zetang,pow_n)+pcorn; tmp_tbij=pow_n*pow(zetang,(pow_n-1.0)); if ((1.0 + zeta) < 0.1 ){ @@ -2014,13 +2014,13 @@ void PairComb3::comb_bij_d(double zet, Param *param, double r, int i, tbij = pow(1.0 + zeta, -0.5/pow_n); tbij1=0.0; } - else if (zeta > param->c1) { + else if (zeta > param->c1) { tbij = pow(zeta,-0.5/pow_n); tbij1 = -0.5/pow_n*pow(zeta,(-0.5/pow_n-1.0)); } else if (zeta > param->c2) { tbij = pow(zeta,-0.5/pow_n)-0.5/pow_n*pow(zeta,(-0.5/pow_n-1.0)); tbij1 = -0.5/pow_n/zeta; - } else if (fabs(zeta) < param->c4) { + } else if (fabs(zeta) < param->c4) { tbij = 1.0; tbij1 = 0.0; } else if (fabs(zeta) < param->c3) { @@ -2031,10 +2031,10 @@ void PairComb3::comb_bij_d(double zet, Param *param, double r, int i, tbij1 = -0.5/pow_n * pow(1.0 + zeta,(-1.0-0.5/pow_n)); } - tbij2 = tbij1 * dpcorn; + tbij2 = tbij1 * dpcorn; tbij3 = tbij1 * dxccij; tbij4 = tbij1 * dxchij; - tbij5 = tbij1 * dxcoij; + tbij5 = tbij1 * dxcoij; tbij1 = tbij1 * tmp_tbij; } @@ -2042,7 +2042,7 @@ void PairComb3::comb_bij_d(double zet, Param *param, double r, int i, /* ---------------------------------------------------------------------- */ void PairComb3::coord(Param *param, double r, int i, - double &pcorn, double &dpcorn, double &dxccij, + double &pcorn, double &dpcorn, double &dxccij, double &dxchij, double &dxcoij, double xcn) { int ixmin,iymin,izmin; @@ -2077,7 +2077,7 @@ void PairComb3::coord(Param *param, double r, int i, if(xcocn > maxz) xcocn = maxz; double xcntritot=xcccn+xchcn+xcocn; - + if(xcntritot > maxxcn[tri_flag-1]) { pcorn = vmaxxcn[tri_flag-1]+(xcntot-maxxcn[tri_flag-1])*dvmaxxcn[tri_flag-1]; dxccij = dxchij = dxcoij = dvmaxxcn[tri_flag-1]; @@ -2090,7 +2090,7 @@ void PairComb3::coord(Param *param, double r, int i, fabs(float(iymin)-xchcn)>1.0e-8 || fabs(float(izmin)-xcocn)>1.0e-8) { cntri_int(tri_flag,xcccn,xchcn,xcocn,ixmin,iymin,izmin, - pcorn,dxccij,dxchij,dxcoij,param); + pcorn,dxccij,dxchij,dxcoij,param); } else { pcorn = pcn_grid[tri_flag-1][ixmin][iymin][izmin]; @@ -2107,8 +2107,8 @@ void PairComb3::coord(Param *param, double r, int i, /* ---------------------------------------------------------------------- */ -void PairComb3::cntri_int(int tri_flag, double xval, double yval, - double zval, int ixmin, int iymin, int izmin, double &vval, +void PairComb3::cntri_int(int tri_flag, double xval, double yval, + double zval, int ixmin, int iymin, int izmin, double &vval, double &dvalx, double &dvaly, double &dvalz, Param *param) { double x; @@ -2121,7 +2121,7 @@ void PairComb3::cntri_int(int tri_flag, double xval, double yval, *pow(xval,iin3[j][0])*pow(yval,iin3[j][1]) *pow(zval,iin3[j][2]); vval += x; - if(xval>1.0e-8) {dvalx += x*iin3[j][0]/xval;} + if(xval>1.0e-8) {dvalx += x*iin3[j][0]/xval;} if(yval>1.0e-8) {dvaly += x*iin3[j][1]/yval;} if(zval>1.0e-8) {dvalz += x*iin3[j][2]/zval;} } @@ -2131,11 +2131,11 @@ void PairComb3::cntri_int(int tri_flag, double xval, double yval, double PairComb3::comb_gijk(double costheta, Param *param, double nco_tmp) { - double rmu1 = costheta; - double rmu2 = rmu1*rmu1; + double rmu1 = costheta; + double rmu2 = rmu1*rmu1; double rmu3 = rmu2*rmu1; - double rmu4 = rmu3*rmu1; - double rmu5 = rmu4*rmu1; + double rmu4 = rmu3*rmu1; + double rmu5 = rmu4*rmu1; double rmu6 = rmu5*rmu1; double co6 = param->pcos6*rmu6; double co5 = param->pcos5*rmu5; @@ -2154,10 +2154,10 @@ double PairComb3::comb_gijk(double costheta, Param *param, double nco_tmp) qtheta = comb_fccc(nco_tmp); astep = 2.0/ntab; rrmu = (rmu1+1.0)/astep; - k = int(rrmu); + k = int(rrmu); gmu1 = co6+co5+co4+co3+co2+co1+co0; gmu2 = pang[k]+(pang[k+1]-pang[k])*(rrmu-k); - gmu = gmu2+qtheta*(gmu1-gmu2); + gmu = gmu2+qtheta*(gmu1-gmu2); return gmu*pcross; } else if (param->ang_flag==2){ @@ -2172,7 +2172,7 @@ double PairComb3::comb_gijk(double costheta, Param *param, double nco_tmp) qtheta = comb_fccch(nco_tmp); gmu1 = co6+co5+co4+co3+co2+co1+co0; gmu2 = ch6+ch5+ch4+ch3+ch2+ch1+ch0; - gmu = gmu2+qtheta*(gmu1-gmu2); + gmu = gmu2+qtheta*(gmu1-gmu2); return gmu*pcross; } else { gmu = co6+co5+co4+co3+co2+co1+co0; @@ -2185,10 +2185,10 @@ double PairComb3::comb_gijk(double costheta, Param *param, double nco_tmp) void PairComb3::comb_gijk_d(double costheta, Param *param, double nco_tmp, double &gijk_d, double &com3jk) { - double rmu1 = costheta; - double rmu2 = rmu1*rmu1; + double rmu1 = costheta; + double rmu2 = rmu1*rmu1; double rmu3 = rmu2*rmu1; - double rmu4 = rmu3*rmu1; + double rmu4 = rmu3*rmu1; double rmu5 = rmu4*rmu1; double rmu6 = rmu5*rmu1; double co6 = param->pcos6; //*rmu5*6.0; @@ -2206,7 +2206,7 @@ void PairComb3::comb_gijk_d(double costheta, Param *param, double nco_tmp, int k; qtheta = comb_fccc(nco_tmp); dqtheta = comb_fccc_d(nco_tmp); - + astep = 2.0/ntab; rrmu = (rmu1+1.0)/astep; k = int(rrmu); @@ -2230,7 +2230,7 @@ void PairComb3::comb_gijk_d(double costheta, Param *param, double nco_tmp, double ch0 = ch_a[0]; qtheta = comb_fccch(nco_tmp); dqtheta = comb_fccch_d(nco_tmp); - + gmu1 =rmu6*co6+rmu5*co5+rmu4*co4 +rmu3*co3+rmu2*co2+rmu1*co1+co0; dgmu1 =6.0*rmu5*co6+5.0*rmu4*co5+4.0*rmu3*co4 @@ -2251,9 +2251,9 @@ void PairComb3::comb_gijk_d(double costheta, Param *param, double nco_tmp, /*------------------------------------------------------------------------- */ -void PairComb3::attractive(Param *parami, Param *paramj , Param *paramk, double prefac_ij1, - double prefac_ij2, double prefac_ij3, double prefac_ij4, - double prefac_ij5, double rsqij, double rsqik, double *delrij, +void PairComb3::attractive(Param *parami, Param *paramj , Param *paramk, double prefac_ij1, + double prefac_ij2, double prefac_ij3, double prefac_ij4, + double prefac_ij5, double rsqij, double rsqik, double *delrij, double *delrik, double *fi, double *fj,double *fk, int i, double xcn) { double rij_hat[3],rik_hat[3]; @@ -2262,7 +2262,7 @@ void PairComb3::attractive(Param *parami, Param *paramj , Param *paramk, double rij = sqrt(rsqij); rijinv = 1.0/rij; vec3_scale(rijinv,delrij,rij_hat); - + rik = sqrt(rsqik); rikinv = 1.0/rik; vec3_scale(rikinv,delrik,rik_hat); @@ -2276,7 +2276,7 @@ void PairComb3::attractive(Param *parami, Param *paramj , Param *paramk, double void PairComb3::comb_zetaterm_d(double prefac_ij1, double prefac_ij2, double prefac_ij3, double prefac_ij4, double prefac_ij5, - double *rij_hat, double rij, double *rik_hat, double rik, double *dri, + double *rij_hat, double rij, double *rik_hat, double rik, double *dri, double *drj, double *drk, Param *parami, Param *paramj, Param *paramk, double xcn) { double gijk,gijk_d,ex_delr,ex_delr_d,fc_k,cos_theta,tmp,rlm3; @@ -2294,7 +2294,7 @@ void PairComb3::comb_zetaterm_d(double prefac_ij1, double prefac_ij2, dfc_k = comb_fc_d(rik,paramk); rlm3 = parami->beta; tmp = pow(rlm3*(rij-rik),mint); - + if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); @@ -2311,11 +2311,11 @@ void PairComb3::comb_zetaterm_d(double prefac_ij1, double prefac_ij2, if(parami->kelementgp==2) {com6 = prefac_ij4*pcrossk*dfc_k;} if(parami->kelementgp==3) {com6 = prefac_ij5*pcrossk*dfc_k;} if(parami->rad_flag>=1 || parami->tor_flag!=0) - {com6+=prefac_ij2*pcrossk*dfc_k;} + {com6+=prefac_ij2*pcrossk*dfc_k;} } else { com6 = prefac_ij2*pcrossi*dfc_k; } - + if (parami->ang_flag==1 || parami->ang_flag==2) { com3j = com3jk*ex_delr*pcrossk*pcrossj*fc_k*dfc_i; com3k = com3jk*ex_delr*pcrossk*pcrossk*fc_k*dfc_k; @@ -2338,18 +2338,18 @@ void PairComb3::comb_zetaterm_d(double prefac_ij1, double prefac_ij2, vec3_scaleadd(fc_k*gijk*ex_delr_d,rij_hat,drj,drj); // com3 cont'd vec3_scaleadd(com3j,rij_hat,drj,drj); // com3j vec3_scale(prefac_ij1,drj,drj); - + vec3_scale(dfc_k*gijk*ex_delr,rik_hat,drk); // com1 vec3_scaleadd(fc_k*gijk_d*ex_delr,dcosdrk,drk,drk); // com2 vec3_scaleadd(-fc_k*gijk*ex_delr_d,rik_hat,drk,drk); // com3 cont'd - vec3_scaleadd(com3k,rik_hat,drk,drk); // com3k + vec3_scaleadd(com3k,rik_hat,drk,drk); // com3k vec3_scale(prefac_ij1,drk,drk); vec3_scaleadd(com6,rik_hat,drk,drk); // com6 } /* ---------------------------------------------------------------------- */ -void PairComb3::costheta_d(double *rij_hat, double rij, double *rik_hat, +void PairComb3::costheta_d(double *rij_hat, double rij, double *rik_hat, double rik, double *dri, double *drj, double *drk) { double cos_theta = vec3_dot(rij_hat,rik_hat); @@ -2365,7 +2365,7 @@ void PairComb3::costheta_d(double *rij_hat, double rij, double *rik_hat, /* ---------------------------------------------------------------------- */ void PairComb3::tables() - + { int i,j,k,m, nntypes, ncoul,nnbuf, ncoul_lim, inty, itype, jtype; int iparam_i, iparam_ij, iparam_ji; @@ -2375,19 +2375,19 @@ void PairComb3::tables() double afbshift, dafbshift, exp2ershift; int n = nelements; - - dra = 0.001; - drin = 0.100; + + dra = 0.001; + drin = 0.100; drbuf = 0.100; - nnbuf = int(drbuf/dra) +1; + nnbuf = int(drbuf/dra) +1; rc = cutmax; alf = 0.20; nmax = atom->nmax; - + nntypes = int((n+1)*n/2.0)+1; ncoul = int((rc-drin)/dra)+ nnbuf; ncoul_lim = int(ncoul * 1.20); - + // allocate arrays memory->create(intype,n,n,"pair:intype"); memory->create(erpaw,ncoul_lim,3,"pair:erpaw"); @@ -2411,11 +2411,11 @@ void PairComb3::tables() "pair:sht_first"); // set interaction number: 0-0=0, 1-1=1, 0-1=1-0=2 - + m = 0; k = n; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { - if (j == i) { + if (j == i) { intype[i][j] = m; m += 1; } else if (j != i && j > i) { @@ -2426,26 +2426,26 @@ void PairComb3::tables() } } } - + // default arrays to zero - + for (i = 0; i < ncoul; i ++) { for (j = 0; j < nntypes; j ++) { - fafb[i][j] = 0.0; - dfafb[i][j] = 0.0; - ddfafb[i][j] = 0.0; - phin[i][j] = 0.0; + fafb[i][j] = 0.0; + dfafb[i][j] = 0.0; + ddfafb[i][j] = 0.0; + phin[i][j] = 0.0; dphin[i][j] = 0.0; - afb[i][j] = 0.0; + afb[i][j] = 0.0; dafb[i][j] = 0.0; } } // direct 1/r energy with Slater 1S orbital overlap - + for (i = 0; i < n; i++) { if (map[i+1] < 0) continue; - r = drin - dra; + r = drin - dra; itype = map[i+1]; iparam_i = elem2param[itype][itype][itype]; z = params[iparam_i].esm; @@ -2455,7 +2455,7 @@ void PairComb3::tables() if (comm->me == 0 && screen) fprintf(screen," element[%d] = %-2s, z = %g\n",i+1,elements[map[i+1]],z); - + for (j = 0; j < ncoul; j++) { exp2er = exp(-2.0 * z * r); phin[j][i] = 1.0 - exp2er * (1.0 + 2.0 * z * r * (1.0 + z * r)); @@ -2470,7 +2470,7 @@ void PairComb3::tables() if (map[i+1] < 0) continue; for (j = 0; j < n; j ++) { if (map[j+1] < 0) continue; - r = drin - dra; + r = drin - dra; if (j == i) { itype = map[i+1]; inty = intype[itype][itype]; @@ -2478,23 +2478,23 @@ void PairComb3::tables() z = params[iparam_i].esm; zrc = z * rc; exp2ersh = exp(-2.0 * zrc); - fafash = -exp2ersh * (1.0 / rc + + fafash = -exp2ersh * (1.0 / rc + z * (11.0/8.0 + 3.0/4.0*zrc + zrc*zrc/6.0)); dfafash = exp2ersh * (1.0/(rc*rc) + 2.0*z/rc + z*z*(2.0 + 7.0/6.0*zrc + zrc*zrc/3.0)); for (k = 0; k < ncoul; k ++) { - zr = z * r; + zr = z * r; exp2er = exp(-2.0*zr); - F1 = -exp2er * (1.0 / r + + F1 = -exp2er * (1.0 / r + z * (11.0/8.0 + 3.0/4.0*zr + zr*zr/6.0)); dF1 = exp2er * (1.0/(r*r) + 2.0*z/r + z*z*(2.0 + 7.0/6.0*zr + zr*zr/3.0)); - ddF1 = -exp2er * (2.0/(r*r*r) + 4.0*z/(r*r) + 4.0*z*z/r + + ddF1 = -exp2er * (2.0/(r*r*r) + 4.0*z/(r*r) + 4.0*z*z/r + z*z*z/3.0*(17.0/2.0 + 5.0*zr + 2.0*zr*zr)); fafb[k][inty] = F1-fafash-(r-rc)*dfafash; dfafb[k][inty] = -(dF1 - dfafash); ddfafb[k][inty] = ddF1; - r += dra; + r += dra; } } else if (j != i) { itype = map[i+1]; @@ -2508,20 +2508,20 @@ void PairComb3::tables() eb3 = eb*eb*eb; E1 = ea*eb3*eb/((ea+eb)*(ea+eb)*(ea-eb)*(ea-eb)); E2 = eb*ea3*ea/((ea+eb)*(ea+eb)*(eb-ea)*(eb-ea)); - E3 = (3.0*ea*ea*eb3*eb-eb3*eb3) / + E3 = (3.0*ea*ea*eb3*eb-eb3*eb3) / ((ea+eb)*(ea+eb)*(ea+eb)*(ea-eb)*(ea-eb)*(ea-eb)); - E4 = (3.0*eb*eb*ea3*ea-ea3*ea3) / + E4 = (3.0*eb*eb*ea3*ea-ea3*ea3) / ((ea+eb)*(ea+eb)*(ea+eb)*(eb-ea)*(eb-ea)*(eb-ea)); exp2earsh = exp(-2.0*ea*rc); exp2ebrsh = exp(-2.0*eb*rc); fafbsh = -exp2earsh*(E1 + E3/rc)-exp2ebrsh*(E2 + E4/rc); - dfafbsh = + dfafbsh = exp2earsh*(2.0*ea*(E1+E3/rc)+E3/(rc*rc)) + exp2ebrsh*(2.0*eb*(E2+E4/rc)+E4/(rc*rc)); for (k = 0; k < ncoul; k ++) { exp2ear = exp(-2.0*ea*r); exp2ebr = exp(-2.0*eb*r); - fafb[k][inty] = + fafb[k][inty] = - exp2ear*(E1+E3/r) - exp2ebr*(E2+E4/r) - fafbsh - (r-rc) * dfafbsh; dfafb[k][inty] = -(exp2ear*(2.0*ea*(E1+E3/r) + E3/(r*r)) @@ -2530,9 +2530,9 @@ void PairComb3::tables() +2.0*E3/(r*r*r)) -exp2ebr*(4.0*eb*eb*(E2+E4/r)+4.0*eb*E4/(r*r) +2.0*E4/(r*r*r)); - r += dra; + r += dra; } - } + } } } @@ -2540,7 +2540,7 @@ void PairComb3::tables() r = dra * (i-1) + drin; erpaw[i][0] = erfc(r*alf); erpaw[i][1] = exp(-r*r*alf*alf); - } + } // end wolf summation // van der Waals @@ -2552,8 +2552,8 @@ void PairComb3::tables() vrc = new double[13]; rrc = new double[13]; - cc2 = new double[nntypes]; - cc3 = new double[nntypes]; + cc2 = new double[nntypes]; + cc3 = new double[nntypes]; memory->create(rvdw,2,nntypes,"pair:rvdw"); vrc[0] = rc; @@ -2568,8 +2568,8 @@ void PairComb3::tables() jtype = jj; inty = intype[itype][jtype]; iparam_ij = elem2param[itype][jtype][jtype]; - - // parameter check: eps > 0 + + // parameter check: eps > 0 if(params[iparam_ij].vdwflag > 0) { if(params[iparam_ij].vdwflag==1){ @@ -2578,7 +2578,7 @@ void PairComb3::tables() else { rvdw[0][inty] = params[iparam_ij].bigr - params[iparam_ij].bigd; } - + rvdw[1][inty] = params[iparam_ij].vsig * 0.950; // radius check: outer radius vs. sigma @@ -2625,11 +2625,11 @@ void PairComb3::tables() vepst = params[iparam_ij].veps; vsigt = vsigt*vsigt*vsigt*vsigt*vsigt*vsigt; - if(params[iparam_ij].vdwflag>0) { + if(params[iparam_ij].vdwflag>0) { if(r <= rvdw[0][inty]) { vvdw[k][inty] = 0.0; vdvdw[k][inty] = 0.0; - } + } else if ( r > rvdw[0][inty] && r <= rvdw[1][inty]) { drcc = r-rvdw[0][inty]; vvdw[k][inty] = drcc*drcc*(drcc*cc3[inty]+cc2[inty]); @@ -2646,7 +2646,7 @@ void PairComb3::tables() vvdw[k][inty]=0.0; vdvdw[k][inty]=0.0; } - r += dra; + r += dra; } } } @@ -2664,11 +2664,11 @@ void PairComb3::potal_calc(double &calc1, double &calc2, double &calc3) { double alf,rcoul,esucon; int m; - + rcoul = 0.0; for (m = 0; m < nparams; m++) if (params[m].lcut > rcoul) rcoul = params[m].lcut; - + alf = 0.20; esucon = force->qqr2e; @@ -2680,7 +2680,7 @@ void PairComb3::potal_calc(double &calc1, double &calc2, double &calc3) /* ---------------------------------------------------------------------- */ -void PairComb3::tri_point(double rsq, int &mr1, int &mr2, +void PairComb3::tri_point(double rsq, int &mr1, int &mr2, int &mr3, double &sr1, double &sr2, double &sr3) { double r, rin, dr, dd, rr1, rridr, rridr2; @@ -2710,7 +2710,7 @@ void PairComb3::tri_point(double rsq, int &mr1, int &mr2, /* ---------------------------------------------------------------------- */ void PairComb3::vdwaals(int inty, int mr1, int mr2, int mr3, double rsq, - double sr1, double sr2, double sr3, + double sr1, double sr2, double sr3, double &eng, double &fforce) { double r = sqrt(rsq); @@ -2721,9 +2721,9 @@ void PairComb3::vdwaals(int inty, int mr1, int mr2, int mr3, double rsq, /* ---------------------------------------------------------------------- */ -void PairComb3::direct(Param *parami, Param *paramj, int mr1, - int mr2, int mr3, double rsq, double sr1, double sr2, double sr3, - double iq, double jq, double fac11, double fac11e, +void PairComb3::direct(Param *parami, Param *paramj, int mr1, + int mr2, int mr3, double rsq, double sr1, double sr2, double sr3, + double iq, double jq, double fac11, double fac11e, double &pot_tmp, double &for_tmp, int i, int j) { double r,erfcc,fafbnl,potij,esucon; @@ -2755,7 +2755,7 @@ void PairComb3::direct(Param *parami, Param *paramj, int mr1, icurl=1; curlij1=curli; } - + if(jelegp==2 && curlj>curlji0) { jcurl=1; curlji1=curlj; @@ -2764,7 +2764,7 @@ void PairComb3::direct(Param *parami, Param *paramj, int mr1, if(icurl==1 || jcurl ==1) { xcoij = xcotmp[i]; xcoji = xcotmp[j]; - fcp1j = comb_fc_d(r,parami); + fcp1j = comb_fc_d(r,parami); if(icurl==1) { curli=curlij1+(curlij0-curlij1)*comb_fc_curl(xcoij,parami); @@ -2787,7 +2787,7 @@ void PairComb3::direct(Param *parami, Param *paramj, int mr1, sme1j = jq*curli*(afbj-fafbnl)*esucon; sme1 = sme1n + sme1j; sme2 = (potij + fafbnl * esucon) * iq * jq; - pot_tmp = 1.0 * (sme1+sme2); + pot_tmp = 1.0 * (sme1+sme2); // 1/r force (wrt r) @@ -2828,15 +2828,15 @@ void PairComb3::field(Param *parami, Param *paramj, double rsq, double iq, r4 = r3 * r; r5 = r4 * r; rc = parami->lcut; - rc2 = rc * rc; + rc2 = rc * rc; rc3 = rc*rc*rc; rc4 = rc3 * rc; rc5 = rc4 * rc; - cmi1 = parami->cmn1; + cmi1 = parami->cmn1; cmi2 = parami->cmn2; - cmj1 = paramj->cmn1; + cmj1 = paramj->cmn1; cmj2 = paramj->cmn2; - pcmi1 = parami->pcmn1; + pcmi1 = parami->pcmn1; pcmi2 = parami->pcmn2; rf3i = r3/(pow(r3,2)+pow(pcmi1,3)); @@ -2881,7 +2881,7 @@ double PairComb3::rad_init(double rsq2,Param *param,int i, /* ---------------------------------------------------------------------- */ -void PairComb3::rad_calc(double r, Param *parami, Param *paramj, +void PairComb3::rad_calc(double r, Param *parami, Param *paramj, double kconjug, double lconjug, int i, int j, double xcn, double ycn) { int ixmin, iymin, izmin; @@ -2893,16 +2893,16 @@ void PairComb3::rad_calc(double r, Param *parami, Param *paramj, yrad = -comb_fc(r,paramj)*paramj->pcross + ycn; zcon = 1.0 + pow(kconjug,2) + pow(lconjug,2); - if(xrad < 0.0) xrad = 0.0; + if(xrad < 0.0) xrad = 0.0; if(yrad < 0.0) yrad = 0.0; if(zcon < 1.0) zcon = 1.0; - if(xrad > maxxc) xrad = maxxc; + if(xrad > maxxc) xrad = maxxc; if(yrad > maxyc) yrad = maxyc; if(zcon > maxconj) zcon = maxconj; ixmin = int(xrad+1.0e-12); iymin = int(yrad+1.0e-12); izmin = int(zcon+1.0e-12); - radindx=parami->rad_flag-1; + radindx=parami->rad_flag-1; if (fabs(float(ixmin)-xrad)>1.0e-8 || fabs(float(iymin)-yrad)>1.0e-8 || fabs(float(izmin)-zcon)>1.0e-8) { @@ -2923,14 +2923,14 @@ void PairComb3::rad_calc(double r, Param *parami, Param *paramj, /* ---------------------------------------------------------------------- */ -void PairComb3::rad_int(int radindx,double xrad, double yrad, double zcon, int l, - int m, int n, double &vrad, double &pradx, double &prady, +void PairComb3::rad_int(int radindx,double xrad, double yrad, double zcon, int l, + int m, int n, double &vrad, double &pradx, double &prady, double &pradz) { int j; double x; - vrad = pradx = prady = pradz = 0.0; - if(l >= maxxc-1) { l=maxxc-1;} + vrad = pradx = prady = pradz = 0.0; + if(l >= maxxc-1) { l=maxxc-1;} if(m >= maxyc-1) { m=maxyc-1; } if(n >= maxconj-1) { n=maxconj-1;} @@ -2938,7 +2938,7 @@ void PairComb3::rad_int(int radindx,double xrad, double yrad, double zcon, int l x = rad_spl[radindx][l][m][n-1][j] * pow(xrad,iin3[j][0]) * pow(yrad,iin3[j][1]) * pow(zcon,iin3[j][2]); vrad += x; - if(xrad > 1.0e-8) pradx += x*iin3[j][0]/xrad; + if(xrad > 1.0e-8) pradx += x*iin3[j][0]/xrad; if(yrad > 1.0e-8) prady += x*iin3[j][1]/yrad; if(zcon > 1.0e-8) pradz += x*iin3[j][2]/zcon; } @@ -2975,14 +2975,14 @@ void PairComb3::rad_forceik(Param *paramk, double rsq2, double *delrk, } for (nm=0; nm<3; nm++) { - fi_rad[nm] = fktmp[nm]; - fk_rad[nm] = -fktmp[nm]; + fi_rad[nm] = fktmp[nm]; + fk_rad[nm] = -fktmp[nm]; } } /* ---------------------------------------------------------------------- */ -void PairComb3::rad_force(Param *paramm, double rsq3, +void PairComb3::rad_force(Param *paramm, double rsq3, double *delrm, double dpradk) { int nm; @@ -2998,7 +2998,7 @@ void PairComb3::rad_force(Param *paramm, double rsq3, fcp1m = comb_fc_d(rkm, paramm); - comkm = dpradk * fcp1m * paramm->pcross; + comkm = dpradk * fcp1m * paramm->pcross; ffmm2 = -comkm/rkm; for (nm=0; nm<3; nm++) { @@ -3013,8 +3013,8 @@ void PairComb3::rad_force(Param *paramm, double rsq3, /* ---------------------------------------------------------------------- */ -double PairComb3::bbtor1(int torindx, Param *paramk, Param *paraml, - double rsq1, double rsq2, double rsq3, double *delrj, +double PairComb3::bbtor1(int torindx, Param *paramk, Param *paraml, + double rsq1, double rsq2, double rsq3, double *delrj, double *delrk, double *delrl, double srmu) { double rmul, rij, rik, rjl; @@ -3031,7 +3031,7 @@ double PairComb3::bbtor1(int torindx, Param *paramk, Param *paraml, if(rmul > 0.1 ) { double fc1k, fc1l, TT1, TT2, rmut, btt, tork[3], torl[3]; - fc1k = comb_fc(rik,paramk); + fc1k = comb_fc(rik,paramk); fc1l = comb_fc(rjl,paraml); TT1 = rik*rjl*rij*rij*srmu*rmul; @@ -3043,16 +3043,16 @@ double PairComb3::bbtor1(int torindx, Param *paramk, Param *paraml, torl[2] = delrj[0]*delrl[1] - delrj[1]*delrl[0]; TT2 = vec3_dot(tork,torl); rmut = pow((TT2/TT1),2); - if(torindx>=1) { + if(torindx>=1) { btt = 1.0 - rmut; - return btt * fc1k * fc1l; + return btt * fc1k * fc1l; } else { - btt=paramk->ptork1-TT2/TT1; - btt=paramk->ptork2*pow(btt,2); - return btt * fc1k * fc1l; + btt=paramk->ptork1-TT2/TT1; + btt=paramk->ptork2*pow(btt,2); + return btt * fc1k * fc1l; } - + } else { return 0.0; } @@ -3060,7 +3060,7 @@ double PairComb3::bbtor1(int torindx, Param *paramk, Param *paraml, /* ---------------------------------------------------------------------- */ -void PairComb3::tor_calc(double r, Param *parami, Param *paramj, +void PairComb3::tor_calc(double r, Param *parami, Param *paramj, double kconjug, double lconjug, int i, int j, double xcn, double ycn) { int ixmin, iymin, izmin; @@ -3091,7 +3091,7 @@ void PairComb3::tor_calc(double r, Param *parami, Param *paramj, iymin = int(ytor+1.0e-12); izmin = int(zcon+1.0e-12); - torindx=torindx-1; + torindx=torindx-1; if (fabs(float(ixmin)-xtor)>1.0e-8 || fabs(float(iymin)-ytor)>1.0e-8 || @@ -3130,7 +3130,7 @@ void PairComb3::tor_int(int torindx,double xtor, double ytor, double zcon, int l * pow(ytor,iin3[j][1]) * pow(zcon,iin3[j][2]); vtor += x; - if(xtor > 1.0e-8 ) dtorx += x*iin3[j][0]/xtor; + if(xtor > 1.0e-8 ) dtorx += x*iin3[j][0]/xtor; if(ytor > 1.0e-8 ) dtory += x*iin3[j][1]/ytor; if(zcon > 1.0e-8 ) dtorz += x*iin3[j][2]/zcon; } @@ -3138,7 +3138,7 @@ void PairComb3::tor_int(int torindx,double xtor, double ytor, double zcon, int l /* ---------------------------------------------------------------------- */ -void PairComb3::tor_force(int torindx, Param *paramk, Param *paraml, +void PairComb3::tor_force(int torindx, Param *paramk, Param *paraml, double srmu, double rsq1,double rsq2, double rsq3, double *delrj, double *delrk, double *delrl) { @@ -3190,11 +3190,11 @@ void PairComb3::tor_force(int torindx, Param *paramk, Param *paraml, dt2djl[0] = delrj[1]*tork[2] - delrj[2]*tork[1]; dt2djl[1] = delrj[2]*tork[0] - delrj[0]*tork[2]; dt2djl[2] = delrj[0]*tork[1] - delrj[1]*tork[0]; - dt2dij[0] = -delrk[2]*torl[1] + delrl[2]*tork[1] + dt2dij[0] = -delrk[2]*torl[1] + delrl[2]*tork[1] + delrk[1]*torl[2] - delrl[1]*tork[2]; - dt2dij[1] = -delrk[0]*torl[2] + delrl[0]*tork[2] + dt2dij[1] = -delrk[0]*torl[2] + delrl[0]*tork[2] + delrk[2]*torl[0] - delrl[2]*tork[0]; - dt2dij[2] = -delrk[1]*torl[0] + delrl[1]*tork[0] + dt2dij[2] = -delrk[1]*torl[0] + delrl[1]*tork[0] + delrk[0]*torl[1] - delrl[0]*tork[1]; rmut = TT2/TT1; @@ -3207,7 +3207,7 @@ void PairComb3::tor_force(int torindx, Param *paramk, Param *paraml, btt=paramk->ptork1-rmut; btt=paramk->ptork2*pow(btt,2); AA = -2.0 * ptorr * paramk->ptork2 * - (paramk->ptork1-rmut) * fc1k * fc1l /TT1; + (paramk->ptork1-rmut) * fc1k * fc1l /TT1; } AA2 = AA * TT2; @@ -3216,10 +3216,10 @@ void PairComb3::tor_force(int torindx, Param *paramk, Param *paraml, tfij[2] = -dt1djl*AA2/rij/rjl; tfij[3] = AA2/rij/rij - dt1djl*AA2*rmul/rij/rij; tfik[0] = tfij[0]; - tfik[1] = (AA2/rik - btt*ptorr*fc1l*fcp1k)/rik - + tfik[1] = (AA2/rik - btt*ptorr*fc1l*fcp1k)/rik - dt1dik*AA2*rmu/rik/rik; tfjl[0] = tfij[2]; - tfjl[1] = (AA2/rjl - btt*ptorr*fc1k*fcp1l)/rjl - + tfjl[1] = (AA2/rjl - btt*ptorr*fc1k*fcp1l)/rjl - dt1djl*AA2*rmul/rjl/rjl; tjx[0] = tfij[0]*delrk[0] - tfij[1]*delrj[0]; @@ -3278,7 +3278,7 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) double potal,fac11,fac11e; int sht_jnum,*sht_jlist; tagint itag, jtag; - + double **x = atom->x; double *q = atom->q; tagint *tag = atom->tag; @@ -3332,7 +3332,7 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) sht_jlist = sht_first[i]; sht_jnum = sht_num[i]; - + // two-body interactions for (jj = 0; jj < jnum; jj++) { @@ -3354,7 +3354,7 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) iparam_ji = elem2param[jtype][itype][itype]; // long range q-dependent - + if (rsq1 > params[iparam_ij].lcutsq) continue; // polynomial three-point interpolation @@ -3364,7 +3364,7 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) qfo_direct(¶ms[iparam_ij],¶ms[iparam_ji], mr1,mr2,mr3,rsq1,sr1,sr2,sr3,fac11e,fqij,fqji, iq,jq,i,j); - + fqi += fqij; qf[j] += fqji; // field correction to self energy and charge force @@ -3406,17 +3406,17 @@ double PairComb3::combqeq(double *qf_fix, int &igroup) // charge force in Aij and Bij qfo_short(¶ms[iparam_ij],¶ms[iparam_ji], rsq1,iq,jq,fqij,fqji,i,j,nj); - + fqi += fqij; qf[j] += fqji; } qf[i] += fqi; - } - } - + } + } + comm->reverse_comm_pair(this); // sum charge force on each node and return it - + double eneg = 0.0; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; @@ -3443,13 +3443,13 @@ double PairComb3::qfo_self(Param *param, double qi) double s3 = param->dk; double s4 = param->dl; - self_d = 0.0; + self_d = 0.0; qmin = param->qmin; qmax = param->qmax; cmin = cmax = 100.0; self_d = s1+qi*(2.0*s2+qi*(3.0*s3+qi*4.0*s4)); - + if (qi < qmin) self_d += 4.0 * cmin * pow((qi-qmin),3); if (qi > qmax) self_d += 4.0 * cmax * pow((qi-qmax),3); @@ -3458,8 +3458,8 @@ double PairComb3::qfo_self(Param *param, double qi) /* ---------------------------------------------------------------------- */ -void PairComb3::qfo_direct(Param *parami, Param *paramj, int mr1, - int mr2, int mr3, double rsq, double sr1, double sr2, +void PairComb3::qfo_direct(Param *parami, Param *paramj, int mr1, + int mr2, int mr3, double rsq, double sr1, double sr2, double sr3, double fac11e, double &fqij, double &fqji, double iq, double jq, int i, int j) { @@ -3494,7 +3494,7 @@ void PairComb3::qfo_direct(Param *parami, Param *paramj, int mr1, if(icurl==1 || jcurl ==1) { double xcoij= xcotmp[i]; double xcoji= xcotmp[j]; - + if(icurl==1) { curli=curlij1+(curlij0-curlij1)*comb_fc_curl(xcoij,parami); } @@ -3562,7 +3562,7 @@ void PairComb3::qfo_field(Param *parami, Param *paramj, double rsq, /* ---------------------------------------------------------------------- */ void PairComb3::qfo_dipole(double fac11, int mr1, int mr2, int mr3, - int inty, double rsq, double *delrj, double sr1, double sr2, + int inty, double rsq, double *delrj, double sr1, double sr2, double sr3, double &fqij, double &fqji, int i, int j) { double erfcc, erfcd, dvdrr, dfafbnl, smf2; @@ -3629,7 +3629,7 @@ void PairComb3::qfo_short(Param *parami, Param *paramj, double rsq, Bsi = parami->aB - pow(QOchi,10); // YYBsin dBsi = -parami->bB * 10.0 * pow(QOchi,9.0); // YYBsiqp } - + if (jq < paramj->QL-0.2) { jq = paramj->QL-0.2; Dj = paramj->DL; @@ -3644,7 +3644,7 @@ void PairComb3::qfo_short(Param *parami, Param *paramj, double rsq, Bsj = paramj->aB - pow(QOchj,10); // YYBsij dBsj = -paramj->bB * 10.0 * pow(QOchj,9.0); // YYBsiqpj } - + LamDiLamDj = exp(0.5*(parami->lami*Di+paramj->lami*Dj)-rlm1*r); caj = 0.5 * tmp_fc * parami->bigA * LamDiLamDj; @@ -3669,7 +3669,7 @@ void PairComb3::qfo_short(Param *parami, Param *paramj, double rsq, /* ---------------------------------------------------------------------- */ void PairComb3::dipole_init(Param *parami, Param *paramj, double fac11, - double *delrj, double rsq, int mr1, int mr2, int mr3, double sr1, + double *delrj, double rsq, int mr1, int mr2, int mr3, double sr1, double sr2, double sr3, double iq, double jq, int i, int j) { double erfcc, erfcd, dvdrr, dfafbnl, smf2, phinn, phinj, efn, efj; @@ -3679,7 +3679,7 @@ void PairComb3::dipole_init(Param *parami, Param *paramj, double fac11, int inti = parami->ielement; int intj = paramj->ielement; int inty = intype[inti][intj]; - + for(nm=0; nm<3; nm++) Qext[nm] = 0.0; r = sqrt(rsq); @@ -3710,7 +3710,7 @@ void PairComb3::dipole_init(Param *parami, Param *paramj, double fac11, for (nm=0; nm<3; nm++) { dpl[i][nm] += (Qext[nm]/esucon + delrj[nm]*efn + poln[nm])*parami->polz*0.50; dpl[j][nm] += (Qext[nm]/esucon - delrj[nm]*efj + polj[nm])*paramj->polz*0.50; - } + } } @@ -3730,10 +3730,10 @@ double PairComb3::dipole_self(Param *parami, int i) /* ---------------------------------------------------------------------- */ -void PairComb3::dipole_calc(Param *parami, Param *paramj, double fac11, +void PairComb3::dipole_calc(Param *parami, Param *paramj, double fac11, double delx, double dely, double delz, double rsq, - int mr1, int mr2, int mr3, double sr1, double sr2, double sr3, - double iq, double jq, int i, int j, double &vionij, + int mr1, int mr2, int mr3, double sr1, double sr2, double sr3, + double iq, double jq, int i, int j, double &vionij, double &fvionij, double *ddprx) { double erfcc, erfcd, dvdrr, dfafbnl, ef, phinn, phinj, efn, efj; @@ -3745,7 +3745,7 @@ void PairComb3::dipole_calc(Param *parami, Param *paramj, double fac11, int inti = parami->ielement; int intj = paramj->ielement; int inty = intype[inti][intj]; - + r = sqrt(rsq); r3 = r * rsq; esucon = force->qqr2e; @@ -3803,7 +3803,7 @@ void PairComb3::dipole_calc(Param *parami, Param *paramj, double fac11, dcoef = rct * (phinn+phinj); for (nm = 0; nm < 3; nm ++) { - ddprx[nm] = dcoef * (ddpr*delr1[nm] - tmurn*dpl[j][nm] - tmurj*dpl[i][nm]) + ddprx[nm] = dcoef * (ddpr*delr1[nm] - tmurn*dpl[j][nm] - tmurj*dpl[i][nm]) + demuTmu * delr1[nm]; } @@ -3863,7 +3863,7 @@ double PairComb3::switching_d(double rr) /* ---------------------------------------------------------------------- */ -int PairComb3::pack_forward_comm(int n, int *list, double *buf, +int PairComb3::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; @@ -3881,15 +3881,15 @@ int PairComb3::pack_forward_comm(int n, int *list, double *buf, } } return m; -} - +} + /* ---------------------------------------------------------------------- */ - + void PairComb3::unpack_forward_comm(int n, int first, double *buf) -{ +{ int i,m,last; - - m = 0; + + m = 0; last = first + n ; if (pack_flag == 1) { for (i = first; i < last; i++) @@ -3898,16 +3898,16 @@ void PairComb3::unpack_forward_comm(int n, int first, double *buf) for (i = first; i < last; i++) NCo[i] = buf[m++]; } -} +} /* ---------------------------------------------------------------------- */ int PairComb3::pack_reverse_comm(int n, int first, double *buf) { int i,m,last; - + m = 0; - last = first + n; + last = first + n; if (pack_flag == 1) { for (i = first; i < last; i++) buf[m++] = qf[i]; @@ -3916,15 +3916,15 @@ int PairComb3::pack_reverse_comm(int n, int first, double *buf) buf[m++] = NCo[i]; } return m; -} - +} + /* ---------------------------------------------------------------------- */ - + void PairComb3::unpack_reverse_comm(int n, int *list, double *buf) -{ +{ int i,j,m; - m = 0; + m = 0; if (pack_flag == 1) { for (i = 0; i < n; i++) { j = list[i]; @@ -3936,10 +3936,10 @@ void PairComb3::unpack_reverse_comm(int n, int *list, double *buf) NCo[j] += buf[m++]; } } -} +} /* ---------------------------------------------------------------------- - memory usage of local atom-based arrays + memory usage of local atom-based arrays ------------------------------------------------------------------------- */ double PairComb3::memory_usage() diff --git a/src/MANYBODY/pair_comb3.h b/src/MANYBODY/pair_comb3.h index e525fa416a7aab08f6bc61a948d12d078ef9c79b..94490e00b54fac1fa259b9cef79c94a96fce78ad 100644 --- a/src/MANYBODY/pair_comb3.h +++ b/src/MANYBODY/pair_comb3.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -54,7 +54,7 @@ class PairComb3 : public Pair { double chi,dj,dk,dl,dm,esm,cmn1,cmn2,pcmn1,pcmn2; double coulcut, lcut, lcutsq; double veps, vsig, pcna, pcnb, pcnc, pcnd, polz, curl, pcross; - double paaa, pbbb; + double paaa, pbbb; double curlcut1, curlcut2, curl0; }; @@ -76,7 +76,7 @@ class PairComb3 : public Pair { // Short range neighbor list void Short_neigh(); int pgsize, oneatom; - int *sht_num, **sht_first; + int *sht_num, **sht_first; MyPage<int> *ipage; // loop up tables and flags @@ -93,7 +93,7 @@ class PairComb3 : public Pair { int cflag; int nsplpcn,nsplrad,nspltor; int maxx,maxy,maxz,maxxc,maxyc,maxconj; - int maxxcn[4]; + int maxxcn[4]; double vmaxxcn[4],dvmaxxcn[4]; int ntab; double iin2[16][2],iin3[64][3]; @@ -111,11 +111,11 @@ class PairComb3 : public Pair { double ddpang[20001]; //coordination spline arrays - double pcn_grid[4][5][5][5]; + double pcn_grid[4][5][5][5]; double pcn_gridx[4][5][5][5]; double pcn_gridy[4][5][5][5]; double pcn_gridz[4][5][5][5]; - double pcn_cubs[4][4][4][4][64]; + double pcn_cubs[4][4][4][4][64]; //coordination spline arrays double rad_grid[3][5][5][11]; @@ -125,7 +125,7 @@ class PairComb3 : public Pair { double rad_spl[3][4][4][10][64]; //torsion spline arrays - double tor_grid[1][5][5][11]; + double tor_grid[1][5][5][11]; double tor_gridx[1][5][5][11]; double tor_gridy[1][5][5][11]; double tor_gridz[1][5][5][11]; @@ -152,11 +152,11 @@ class PairComb3 : public Pair { // short range terms void attractive(Param *, Param *, Param *, double, double, double, double, - double, double, double, double *, double *, double *, + double, double, double, double *, double *, double *, double *, double *, int, double); - virtual void comb_fa(double, Param *, Param *, double, double, + virtual void comb_fa(double, Param *, Param *, double, double, double &, double &); - virtual void repulsive(Param *, Param *,double, double &, int, + virtual void repulsive(Param *, Param *,double, double &, int, double &, double, double); // bond order terms @@ -166,17 +166,17 @@ class PairComb3 : public Pair { double zeta(Param *, Param *, double, double, double *, double *, int, double); void comb_bij_d(double, Param *, double, int, double &, double &, double &, double &, double &, double &, double); - void coord(Param *, double, int, double &, double &, + void coord(Param *, double, int, double &, double &, double &, double &, double &, double); - void comb_zetaterm_d(double, double, double, double, double, - double *, double, double *, double, double *, double *, + void comb_zetaterm_d(double, double, double, double, double, + double *, double, double *, double, double *, double *, double *, Param *, Param *, Param *, double); void costheta_d(double *, double, double *, double, double *, double *, double *); - void force_zeta(Param *, Param *, double, double, double, double &, - double &, double &, double &, double &, double &, double &, - double &, double &, double &, double &, double &, double &, - int, double &, double,double, int, int, int, + void force_zeta(Param *, Param *, double, double, double, double &, + double &, double &, double &, double &, double &, double &, + double &, double &, double &, double &, double &, double &, + int, double &, double,double, int, int, int, double , double , double); void cntri_int(int, double, double, double, int, int, int, double &, double &, double &, double &, Param *); @@ -184,14 +184,14 @@ class PairComb3 : public Pair { // Legendre polynomials void selfp6p(Param *, Param *, double, double &, double &); double ep6p(Param *, Param *, double, double, double *, double * ,double &); - void fp6p(Param *, Param *, double, double, double *, double *, double *, + void fp6p(Param *, Param *, double, double, double *, double *, double *, double *, double *); // long range q-dependent terms double self(Param *, double); void tables(); void potal_calc(double &, double &, double &); - void tri_point(double, int &, int &, int &, double &, double &, + void tri_point(double, int &, int &, int &, double &, double &, double &); void vdwaals(int,int,int,int,double,double,double,double, double &, double &); @@ -206,7 +206,7 @@ class PairComb3 : public Pair { // radical terms double rad_init(double, Param *, int, double &, double); - void rad_calc(double, Param *, Param *, double, double, int, + void rad_calc(double, Param *, Param *, double, double, int, int, double, double); void rad_int(int , double, double, double, int, int, int, double &, double &, double &, double &); @@ -214,27 +214,27 @@ class PairComb3 : public Pair { void rad_force(Param *, double, double *, double); // torsion terms - double bbtor1(int, Param *, Param *, double, double, double, + double bbtor1(int, Param *, Param *, double, double, double, double *, double *, double *, double); //modified by TAO - void tor_calc(double, Param *, Param *, double, double, int, + void tor_calc(double, Param *, Param *, double, double, int, int, double, double); void tor_int(int , double, double, double, int, int, int, double &, double &, double &, double &); - void tor_force(int, Param *, Param *, double, double, double, + void tor_force(int, Param *, Param *, double, double, double, double, double *, double *, double *); //modified by TAO // charge force terms double qfo_self(Param *, double); - void qfo_short(Param *, Param *, double, double, double, + void qfo_short(Param *, Param *, double, double, double, double &, double &, int, int, int); - void qfo_direct(Param *, Param *, int, int, int, double, - double, double, double, double, double &, double &, + void qfo_direct(Param *, Param *, int, int, int, double, + double, double, double, double, double &, double &, double, double, int, int); void qfo_field(Param *, Param *,double,double ,double ,double &, double &); - void qfo_dipole(double, int, int, int, int, double, double *, double, + void qfo_dipole(double, int, int, int, int, double, double *, double, double, double, double &, double &, int, int); void qsolve(double *); - + // dipole - polarization terms double dipole_self(Param *, int); void dipole_init(Param *, Param *, double, double *, double, diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 5b832d0ab4aefce9f3058c5478f1ce9be52367a1..dc6727e1d5ab3ae174608bdbc7d5e7c233d0c5af 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -15,10 +15,10 @@ Contributing authors: Stephen Foiles (SNL), Murray Daw (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eam.h" #include "atom.h" #include "force.h" @@ -815,7 +815,7 @@ double PairEAM::single(int i, int j, int itype, int jtype, /* ---------------------------------------------------------------------- */ -int PairEAM::pack_forward_comm(int n, int *list, double *buf, +int PairEAM::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/MANYBODY/pair_eam.h b/src/MANYBODY/pair_eam.h index ca971757049dbbc3ea8a5a4454191e5fa0344e0f..a941b95402abdbbc4cf104083b1998cf7c41e493 100644 --- a/src/MANYBODY/pair_eam.h +++ b/src/MANYBODY/pair_eam.h @@ -20,7 +20,7 @@ PairStyle(eam,PairEAM) #ifndef LMP_PAIR_EAM_H #define LMP_PAIR_EAM_H -#include "stdio.h" +#include <stdio.h> #include "pair.h" namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index 13336ef823a07d3854a221cf680a09c9aaae3092..8d040f0d390d76f8320a4e18acdf987669f7f6f3 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -15,9 +15,9 @@ Contributing authors: Stephen Foiles (SNL), Murray Daw (SNL) ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eam_alloy.h" #include "atom.h" #include "comm.h" diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index 16f017c64b74bca6be2eae70530067598ca8f78d..b929920449ca24014df1fdf2dcd8578460c2d1c0 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -15,9 +15,9 @@ Contributing authors: Tim Lau (MIT) ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eam_fs.h" #include "atom.h" #include "comm.h" diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index 196e899534ebc96e4a6c36d791df8005c10933cd..c25f3d92e63ed43ef494a2ea022f04d80fcccc57 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -15,10 +15,10 @@ Contributing author: Xiaowang Zhou (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eim.h" #include "atom.h" #include "force.h" @@ -1084,7 +1084,7 @@ double PairEIM::funccoul(int i, int j, double r) /* ---------------------------------------------------------------------- */ -int PairEIM::pack_forward_comm(int n, int *list, double *buf, +int PairEIM::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/MANYBODY/pair_eim.h b/src/MANYBODY/pair_eim.h index 92261bb3945a6db319044f62b49bde5b31d78371..9b2d518a2a20d97af6ed3cc25cdb56c2ea10198f 100644 --- a/src/MANYBODY/pair_eim.h +++ b/src/MANYBODY/pair_eim.h @@ -20,7 +20,7 @@ PairStyle(eim,PairEIM) #ifndef LMP_PAIR_EIM_H #define LMP_PAIR_EIM_H -#include "stdio.h" +#include <stdio.h> #include "pair.h" namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index 464f50cacbe9c00c75259fcb1ca255438befd9f0..fde0342dcc1090735ce3e8506970f666fe74c1d1 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -16,11 +16,11 @@ based on pair_airebo by Ase Henry (MIT) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "mpi.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <mpi.h> #include "pair_lcbop.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index 6acd3a2f46cdb6e795a763959433da100e48555d..c099c7c4a1be2e64f5a664551b05c77fcaf718bf 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -22,7 +22,7 @@ PairStyle(lcbop,PairLCBOP) #include "pair.h" #include "my_page.h" -#include "math.h" +#include <math.h> #include "math_const.h" namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index a98bacd274362c71b90f248fa2798dc3d098b682..cd9b2ccd0d596731d77cda1f8aba5d4dfe9bf1ff 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ (based on Stillinger-Weber pair style) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_nb3b_harmonic.h" #include "atom.h" #include "neighbor.h" @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; #define MAXLINE 1024 #define DELTA 4 #define SMALL 0.001 -#define PI 3.141592653589793238462643383279 +#define PI 3.141592653589793238462643383279 /* ---------------------------------------------------------------------- */ @@ -170,7 +170,7 @@ void PairNb3bHarmonic::allocate() } /* ---------------------------------------------------------------------- - global settings + global settings ------------------------------------------------------------------------- */ void PairNb3bHarmonic::settings(int narg, char **arg) @@ -226,7 +226,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) } // read potential file and initialize potential parameters - + read_file(arg[2]); setup(); @@ -388,7 +388,7 @@ void PairNb3bHarmonic::read_file(char *file) params[nparams].cutoff = atof(words[5]); if (params[nparams].k_theta < 0.0 || params[nparams].theta0 < 0.0 || - params[nparams].cutoff < 0.0) + params[nparams].cutoff < 0.0) error->all(FLERR,"Illegal nb3b/harmonic parameter"); nparams++; @@ -416,7 +416,7 @@ void PairNb3bHarmonic::setup() for (k = 0; k < nelements; k++) { n = -1; for (m = 0; m < nparams; m++) { - if (i == params[m].ielement && j == params[m].jelement && + if (i == params[m].ielement && j == params[m].jelement && k == params[m].kelement) { if (n >= 0) error->all(FLERR,"Potential file has duplicate entry"); n = m; @@ -430,7 +430,7 @@ void PairNb3bHarmonic::setup() // set cutsq using shortcut to reduce neighbor list for accelerated // calculations. cut must remain unchanged as it is a potential parameter - // (cut = a*sigma) + // (cut = a*sigma) for (m = 0; m < nparams; m++) { @@ -448,12 +448,12 @@ void PairNb3bHarmonic::setup() rtmp = sqrt(params[m].cutsq); if (rtmp > cutmax) cutmax = rtmp; } -} +} /* ---------------------------------------------------------------------- */ -void PairNb3bHarmonic::threebody(Param *paramij, Param *paramik, +void PairNb3bHarmonic::threebody(Param *paramij, Param *paramik, Param *paramijk, double rsq1, double rsq2, double *delr1, double *delr2, @@ -463,32 +463,32 @@ void PairNb3bHarmonic::threebody(Param *paramij, Param *paramik, double r1,r2,c,s,a,a11,a12,a22; // angle (cos and sin) - + r1 = sqrt(rsq1); r2 = sqrt(rsq2); - + c = delr1[0]*delr2[0] + delr1[1]*delr2[1] + delr1[2]*delr2[2]; c /= r1*r2; - + if (c > 1.0) c = 1.0; if (c < -1.0) c = -1.0; - + s = sqrt(1.0 - c*c); if (s < SMALL) s = SMALL; s = 1.0/s; - + // force & energy - + dtheta = acos(c) - paramijk->theta0; tk = paramijk->k_theta * dtheta; - + if (eflag) eng = tk*dtheta; - + a = -2.0 * tk * s; a11 = a*c / rsq1; a12 = -a / (r1*r2); a22 = a*c / rsq2; - + fj[0] = a11*delr1[0] + a12*delr2[0]; fj[1] = a11*delr1[1] + a12*delr2[1]; fj[2] = a11*delr1[2] + a12*delr2[2]; diff --git a/src/MANYBODY/pair_nb3b_harmonic.h b/src/MANYBODY/pair_nb3b_harmonic.h index 1469c914446429c6e413d3490f64e2d9b75daa58..064fd2c6c0202c97f63fc965f31ceed985faf06c 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.h +++ b/src/MANYBODY/pair_nb3b_harmonic.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -40,7 +40,7 @@ class PairNb3bHarmonic : public Pair { double cut,cutsq; int ielement,jelement,kelement; }; - + double cutmax; // max cutoff for all elements int nelements; // # of unique elements char **elements; // names of unique elements diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index b9d3755e6cdf3f04e373f305cf6827ae9ef9c60c..0d3587204694ccf3a1932d67a0a349a96ca6a1b0 100755 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ Based on pair_tersoff by Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_polymorphic.h" #include "atom.h" #include "neighbor.h" @@ -280,7 +280,7 @@ void PairPolymorphic::compute(int eflag, int vflag) costheta = (delr1[0]*delr2[0] + delr1[1]*delr2[1] + delr1[2]*delr2[2]) / (r1*r2); - iparam_ijk = elem3param[jel][iel][kel]; + iparam_ijk = elem3param[jel][iel][kel]; TripletParameters & trip = tripletParameters[iparam_ijk]; wfac= (q.W)->value(r2); @@ -331,7 +331,7 @@ void PairPolymorphic::compute(int eflag, int vflag) iparam_ijk = elem3param[jel][iel][kel]; TripletParameters & trip = tripletParameters[iparam_ijk]; - + attractive(&q,&trip,prefactor,r1,r2,delr1,delr2,fi,fj,fk); f[i][0] += fi[0]; @@ -366,7 +366,7 @@ void PairPolymorphic::allocate() } /* ---------------------------------------------------------------------- - global settings + global settings ------------------------------------------------------------------------- */ void PairPolymorphic::settings(int narg, char **arg) @@ -459,8 +459,8 @@ void PairPolymorphic::coeff(int narg, char **arg) // type_map = atom type to element in potential file if (type_map) { delete [] type_map; } type_map = new int[ntypes+1]; - for (int i = 0; i < ntypes+1; i++) { - type_map[i] = -1; + for (int i = 0; i < ntypes+1; i++) { + type_map[i] = -1; } // elements = list of requested element names (ntypes long) char** elements = new char*[ntypes]; @@ -479,7 +479,7 @@ void PairPolymorphic::coeff(int narg, char **arg) setup(); if (elements) - for (int i = 0; i < ntypes; i++) + for (int i = 0; i < ntypes; i++) if (elements[i]) delete [] elements[i]; delete [] elements; @@ -547,7 +547,7 @@ void PairPolymorphic::read_file(char *file, char** elements) break; } } - if (j == nelements) + if (j == nelements) error->all(FLERR,"Element not defined in potential file"); } if (comm->me == 0) { printf("\n"); } @@ -586,42 +586,42 @@ void PairPolymorphic::read_file(char *file, char** elements) read_line(fp,line); ptr = strtok(line," \t\n\r\f"); // 1st token strcpy(ftype,ptr); - p.U = create_function(ftype,fp); + p.U = create_function(ftype,fp); } for (int i = 0; i < npair; i++) { // V PairParameters & p = pairParameters[i]; read_line(fp,line); ptr = strtok(line," \t\n\r\f"); // 1st token strcpy(ftype,ptr); - p.V = create_function(ftype,fp); + p.V = create_function(ftype,fp); } for (int i = 0; i < npair; i++) { // W PairParameters & p = pairParameters[i]; read_line(fp,line); ptr = strtok(line," \t\n\r\f"); // 1st token strcpy(ftype,ptr); - p.W = create_function(ftype,fp); + p.W = create_function(ftype,fp); } for (int i = 0; i < npair; i++) { // P PairParameters & p = pairParameters[i]; read_line(fp,line); ptr = strtok(line," \t\n\r\f"); // 1st token strcpy(ftype,ptr); - p.P = create_function(ftype,fp); + p.P = create_function(ftype,fp); } for (int i = 0; i < ntriple; i++) { // G TripletParameters & p = tripletParameters[i]; read_line(fp,line); ptr = strtok(line," \t\n\r\f"); // 1st token strcpy(ftype,ptr); - p.G = create_function(ftype,fp); + p.G = create_function(ftype,fp); } for (int i = 0; i < npair; i++) { // F PairParameters & p = pairParameters[i]; read_line(fp,line); ptr = strtok(line," \t\n\r\f"); // 1st token strcpy(ftype,ptr); - p.F = create_function(ftype,fp); + p.F = create_function(ftype,fp); } if (comm->me == 0) { fclose(fp); } } @@ -633,11 +633,11 @@ C1function * PairPolymorphic::create_function(char* ftype, FILE* fp) char * ptr; if (strcmp(ftype,"spline")==0) { // N, min, max, values C1tabularFunction * f = new C1tabularFunction(); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); int n = atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double xmin = atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double xmax = atof(ptr); double * table = new double[n]; read_array(fp,n,table); @@ -646,28 +646,28 @@ C1function * PairPolymorphic::create_function(char* ftype, FILE* fp) return f; } else if (strcmp(ftype,"constant") == 0) { - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double c = atof(ptr); return new C1constant(c); } else if (strcmp(ftype,"exponential") == 0) { - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double c = atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double lambda = atof(ptr); return new C1exponential(c,lambda); } else if (strcmp(ftype,"sine") == 0) { - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double c = atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double w = atof(ptr); return new C1sine(c,w); } else if (strcmp(ftype,"cosine") == 0) { - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double c = atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(NULL," \t\n\r\f"); double w = atof(ptr); return new C1cosine(c,w); } @@ -717,7 +717,7 @@ void PairPolymorphic::attractive(PairParameters *p, TripletParameters *trip, rijinv = 1.0/rij; vec3_scale(rijinv,delrij,rij_hat); - + rikinv = 1.0/rik; vec3_scale(rikinv,delrik,rik_hat); diff --git a/src/MANYBODY/pair_polymorphic.h b/src/MANYBODY/pair_polymorphic.h index 8e7950263c3df35a0bf5280fb7fc0b6ee8d7c840..901fdaecc0fe93033bbbf940f025fb23a8f1f139 100755 --- a/src/MANYBODY/pair_polymorphic.h +++ b/src/MANYBODY/pair_polymorphic.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -26,7 +26,7 @@ namespace LAMMPS_NS { //=========================================== class C1function { - public: + public: C1function(){}; virtual ~C1function() {}; virtual double value(double x)=0; @@ -34,7 +34,7 @@ class C1function { }; //=========================================== class C1constant : public C1function { - public: + public: C1constant(double C): C_(C) {}; C1constant(): C_(0) {}; virtual double value(double x) { return C_; } @@ -44,7 +44,7 @@ class C1constant : public C1function { }; //=========================================== class C1exponential : public C1function { - public: + public: C1exponential(double C, double lambda): C_(C),lambda_(lambda) {}; C1exponential(): C_(0),lambda_(0) {}; virtual double value(double x) { return C_*exp(lambda_*x); } @@ -54,7 +54,7 @@ class C1exponential : public C1function { }; //=========================================== class C1sine : public C1function { - public: + public: C1sine(double C, double lambda): C_(C),lambda_(lambda) {}; C1sine(): C_(0),lambda_(0) {}; virtual double value(double x) { return C_*sin(lambda_*x); } @@ -64,7 +64,7 @@ class C1sine : public C1function { }; //=========================================== class C1cosine : public C1function { - public: + public: C1cosine(double C, double lambda): C_(C),lambda_(lambda) {}; C1cosine(): C_(0),lambda_(0) {}; virtual double value(double x) { return C_*cos(lambda_*x); } @@ -115,7 +115,7 @@ class C1tabularFunction : public C1function { { resize(n); xmin = x1; - xmax = x2; + xmax = x2; memcpy(ys,values,n*sizeof(double)); initialize(); } @@ -256,11 +256,11 @@ class PairPolymorphic : public Pair { bool eta; // global indicator int nx,nr,ng; // table sizes double maxX; - + // parameter sets PairParameters * pairParameters; // for I-J interaction TripletParameters * tripletParameters; // for I-J-K interaction - + char **elements; // names of unique elements int **elem2param; // map: element pairs to parameters int ***elem3param; // map: element triplets to parameters @@ -291,7 +291,7 @@ class PairPolymorphic : public Pair { return x[0]*y[0] + x[1]*y[1] + x[2]*y[2]; } - inline void vec3_add(const double x[3], const double y[3], + inline void vec3_add(const double x[3], const double y[3], double * const z) const { z[0] = x[0]+y[0]; z[1] = x[1]+y[1]; z[2] = x[2]+y[2]; } @@ -301,7 +301,7 @@ class PairPolymorphic : public Pair { y[0] = k*x[0]; y[1] = k*x[1]; y[2] = k*x[2]; } - inline void vec3_scaleadd(const double k, const double x[3], + inline void vec3_scaleadd(const double k, const double x[3], const double y[3], double * const z) const { z[0] = k*x[0]+y[0]; z[1] = k*x[1]+y[1]; diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 5cdd8f778e66b3f511114b9520afbd4ba89ec8d6..700d0b3a83bd10984aac5cd8e6d948d870ac9b8c 100755 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -15,10 +15,10 @@ Contributing author: Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_sw.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index 44712e691e44ec9ca272b33781b463548159d0ce..e5d34f07a5ab2512d679126881cc796554320caa 100755 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -15,10 +15,10 @@ Contributing author: Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index 558e96de37e1a1fb7e224162ddc2061221027fad..6cbf418dbe56c3c1e3ea1cdcc9a65c00bd916b82 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -13,13 +13,13 @@ /* ---------------------------------------------------------------------- Contributing author: Aidan Thompson (SNL) - original Tersoff implementation - Vitaly Dozhdikov (JIHT of RAS) - MOD addition + Vitaly Dozhdikov (JIHT of RAS) - MOD addition ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_mod.h" #include "atom.h" #include "neighbor.h" @@ -162,15 +162,15 @@ void PairTersoffMOD::read_file(char *file) params[nparams].c4 = atof(words[18]); params[nparams].c5 = atof(words[19]); - // currently only allow m exponent of 1 + // currently only allow m exponent of 1 params[nparams].powermint = int(params[nparams].powerm); if ( - params[nparams].lam3 < 0.0 || params[nparams].powern < 0.0 || - params[nparams].beta < 0.0 || params[nparams].lam2 < 0.0 || + params[nparams].lam3 < 0.0 || params[nparams].powern < 0.0 || + params[nparams].beta < 0.0 || params[nparams].lam2 < 0.0 || params[nparams].bigb < 0.0 || params[nparams].bigr < 0.0 || - params[nparams].bigd < 0.0 || + params[nparams].bigd < 0.0 || params[nparams].bigd > params[nparams].bigr || params[nparams].lam3 < 0.0 || params[nparams].biga < 0.0 || params[nparams].powerm - params[nparams].powermint != 0.0 || @@ -201,7 +201,7 @@ void PairTersoffMOD::setup() for (k = 0; k < nelements; k++) { n = -1; for (m = 0; m < nparams; m++) { - if (i == params[m].ielement && j == params[m].jelement && + if (i == params[m].ielement && j == params[m].jelement && k == params[m].kelement) { if (n >= 0) error->all(FLERR,"Potential file has duplicate entry"); n = m; @@ -227,7 +227,7 @@ void PairTersoffMOD::setup() cutmax = 0.0; for (m = 0; m < nparams; m++) if (params[m].cut > cutmax) cutmax = params[m].cut; -} +} /* ---------------------------------------------------------------------- */ @@ -238,7 +238,7 @@ double PairTersoffMOD::zeta(Param *param, double rsqij, double rsqik, rij = sqrt(rsqij); rik = sqrt(rsqik); - costheta = (delrij[0]*delrik[0] + delrij[1]*delrik[1] + + costheta = (delrij[0]*delrik[0] + delrij[1]*delrik[1] + delrij[2]*delrik[2]) / (rij*rik); if (param->powermint == 3) arg = pow(param->lam3 * (rij-rik),3.0); @@ -247,7 +247,7 @@ double PairTersoffMOD::zeta(Param *param, double rsqij, double rsqik, if (arg > 69.0776) ex_delr = 1.e30; else if (arg < -69.0776) ex_delr = 0.0; else ex_delr = exp(arg); - + return ters_fc(rik,param) * ters_gijk_mod(costheta,param) * ex_delr; } @@ -257,10 +257,10 @@ double PairTersoffMOD::ters_fc(double r, Param *param) { double ters_R = param->bigr; double ters_D = param->bigd; - + if (r < ters_R-ters_D) return 1.0; if (r > ters_R+ters_D) return 0.0; - return 0.5*(1.0 - 1.125*sin(MY_PI2*(r - ters_R)/ters_D) - + return 0.5*(1.0 - 1.125*sin(MY_PI2*(r - ters_R)/ters_D) - 0.125*sin(3*MY_PI2*(r - ters_R)/ters_D)); } @@ -270,10 +270,10 @@ double PairTersoffMOD::ters_fc_d(double r, Param *param) { double ters_R = param->bigr; double ters_D = param->bigd; - + if (r < ters_R-ters_D) return 0.0; if (r > ters_R+ters_D) return 0.0; - return -(0.375*MY_PI4/ters_D) * (3*cos(MY_PI2*(r - ters_R)/ters_D) + + return -(0.375*MY_PI4/ters_D) * (3*cos(MY_PI2*(r - ters_R)/ters_D) + cos(3*MY_PI2*(r - ters_R)/ters_D)); } @@ -295,9 +295,9 @@ double PairTersoffMOD::ters_bij_d(double zeta, Param *param) if (tmp > param->ca1) return -0.5*(param->powern/param->powern_del)* pow(tmp,-0.5*(param->powern/param->powern_del)) / zeta; if (tmp < param->ca4) return 0.0; - + double tmp_n = pow(tmp,param->powern); - return -0.5 *(param->powern/param->powern_del)* + return -0.5 *(param->powern/param->powern_del)* pow(1.0+tmp_n, -1.0-(1.0/(2.0*param->powern_del)))*tmp_n / zeta; } diff --git a/src/MANYBODY/pair_tersoff_mod.h b/src/MANYBODY/pair_tersoff_mod.h index fc9ac6687768e685ab0cd4c515790423581d0ec5..d11fdf1dbb7391becc02eef2792faed5bab33397 100644 --- a/src/MANYBODY/pair_tersoff_mod.h +++ b/src/MANYBODY/pair_tersoff_mod.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -18,7 +18,7 @@ PairStyle(tersoff/mod,PairTersoffMOD) #else #ifndef LMP_PAIR_TERSOFF_MOD_H -#define LMP_PAIR_TERSOFF_MOD_H +#define LMP_PAIR_TERSOFF_MOD_H #include "pair_tersoff.h" @@ -28,7 +28,7 @@ class PairTersoffMOD : public PairTersoff { public: PairTersoffMOD(class LAMMPS *); ~PairTersoffMOD() {} - + protected: void read_file(char *); virtual void setup(); @@ -54,7 +54,7 @@ class PairTersoffMOD : public PairTersoff { const double ters_c5 = param->c5; const double tmp_h = (param->h - costheta)*(param->h - costheta); - return ters_c1 + (ters_c2*tmp_h/(ters_c3 + tmp_h)) * + return ters_c1 + (ters_c2*tmp_h/(ters_c3 + tmp_h)) * (1.0 + ters_c4*exp(-ters_c5*tmp_h)); } @@ -68,9 +68,9 @@ class PairTersoffMOD : public PairTersoff { const double g1 = (param->h - costheta)/(ters_c3 + tmp_h); const double g2 = exp(-ters_c5*tmp_h); - return -2.0*ters_c2*g1*((1 + ters_c4*g2)*(1 + g1*(costheta - param->h)) - + return -2.0*ters_c2*g1*((1 + ters_c4*g2)*(1 + g1*(costheta - param->h)) - tmp_h*ters_c4*ters_c5*g2); - } + } }; } diff --git a/src/MANYBODY/pair_tersoff_zbl.cpp b/src/MANYBODY/pair_tersoff_zbl.cpp index 95c3dd711ce5d6a5ce7c3a7c4794d684aca2e780..b900283ca34a0c609d06aa29cdeb14b6ea1cfdf5 100644 --- a/src/MANYBODY/pair_tersoff_zbl.cpp +++ b/src/MANYBODY/pair_tersoff_zbl.cpp @@ -16,10 +16,10 @@ David Farrell (NWU) - ZBL addition ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_zbl.h" #include "atom.h" #include "update.h" diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index c8e6d65dc0a60e1604672eaf38d1c88303d2a1d0..7c2e8c4c0960ee83ff032d5c8df9d63c45531105 100755 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -16,10 +16,10 @@ Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_vashishta.h" #include "atom.h" #include "neighbor.h" @@ -496,7 +496,7 @@ void PairVashishta::setup() params[m].lam1inv = 1.0/params[m].lambda1; params[m].lam4inv = 1.0/params[m].lambda4; params[m].zizj = params[m].zi*params[m].zj * force->qqr2e; - // note that bigd does not have 1/2 factor + // note that bigd does not have 1/2 factor params[m].mbigd = params[m].bigd; params[m].heta = params[m].bigh*params[m].eta; params[m].big2b = 2.0*params[m].bigb; @@ -513,14 +513,14 @@ void PairVashishta::setup() exp(-params[m].lam1rc); params[m].vrcc3 = params[m].mbigd*params[m].rc4inv * exp(-params[m].lam4rc); - params[m].vrc = params[m].bigh*params[m].rceta + - params[m].vrcc2 - params[m].vrcc3 - + params[m].vrc = params[m].bigh*params[m].rceta + + params[m].vrcc2 - params[m].vrcc3 - params[m].bigw*params[m].rc6inv; - params[m].dvrc = - params[m].vrcc3 * (4.0*params[m].rcinv+params[m].lam4inv) + params[m].dvrc = + params[m].vrcc3 * (4.0*params[m].rcinv+params[m].lam4inv) + params[m].big6w * params[m].rc6inv * params[m].rcinv - - params[m].heta * params[m].rceta*params[m].rcinv + - params[m].heta * params[m].rceta*params[m].rcinv - params[m].vrcc2 * (params[m].rcinv+params[m].lam1inv); params[m].c0 = params[m].cut*params[m].dvrc - params[m].vrc; } @@ -551,11 +551,11 @@ void PairVashishta::twobody(Param *param, double rsq, double &fforce, vc2 = param->zizj * exp(-lam1r)/r; vc3 = param->mbigd * r4inv*exp(-lam4r); - fforce = (param->dvrc*r + fforce = (param->dvrc*r - (4.0*vc3 + lam4r*vc3+param->big6w*r6inv - param->heta*reta - vc2 - lam1r*vc2) ) * rinvsq; - if (eflag) eng = param->bigh*reta + if (eflag) eng = param->bigh*reta + vc2 - vc3 - param->bigw*r6inv - r*param->dvrc + param->c0; } diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index fe20ce389de4016c0e9e03ac18c4e7342a06e4ef..7cdee69c39ca65a16eb8734ac8398506b0719719 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -16,10 +16,10 @@ Alexander Stukowski ------------------------------------------------------------------------- */ -#include "math.h" -#include "float.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <string.h> #include "fix_atom_swap.h" #include "atom.h" #include "atom_vec.h" @@ -61,7 +61,7 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : if (narg < 10) error->all(FLERR,"Illegal fix atom/swap command"); dynamic_group_allow = 1; - + vector_flag = 1; size_vector = 2; global_freq = 1; @@ -75,9 +75,9 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : nevery = force->inumeric(FLERR,arg[3]); ncycles = force->inumeric(FLERR,arg[4]); - seed = force->inumeric(FLERR,arg[5]); + seed = force->inumeric(FLERR,arg[5]); double temperature = force->numeric(FLERR,arg[6]); - beta = 1.0/(force->boltz*temperature); + beta = 1.0/(force->boltz*temperature); if (ncycles < 0) error->all(FLERR,"Illegal fix atom/swap command"); if (seed <= 0) error->all(FLERR,"Illegal fix atom/swap command"); @@ -85,7 +85,7 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : memory->create(type_list,atom->ntypes,"atom/swap:type_list"); memory->create(mu,atom->ntypes+1,"atom/swap:mu"); for (int i = 1; i <= atom->ntypes; i++) mu[i] = 0.0; - + // read options from end of input line options(narg-7,&arg[7]); @@ -97,7 +97,7 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : // random number generator, not the same for all procs random_unequal = new RanPark(lmp,seed); - + // set up reneighboring force_reneighbor = 1; @@ -128,13 +128,13 @@ void FixAtomSwap::options(int narg, char **arg) { if (narg < 0) error->all(FLERR,"Illegal fix atom/swap command"); - regionflag = 0; + regionflag = 0; conserve_ke_flag = 1; semi_grand_flag = 0; nswaptypes = 0; nmutypes = 0; - iregion = -1; - + iregion = -1; + int iarg = 0; while (iarg < narg) { if (strcmp(arg[iarg],"region") == 0) { @@ -208,7 +208,7 @@ int FixAtomSwap::setmask() /* ---------------------------------------------------------------------- */ void FixAtomSwap::init() -{ +{ char *id_pe = (char *) "thermo_pe"; int ipe = modify->find_compute(id_pe); c_pe = modify->compute[ipe]; @@ -217,7 +217,7 @@ void FixAtomSwap::init() if (nswaptypes < 2) error->all(FLERR,"Must specify at least 2 types in fix atom/swap command"); - + if (semi_grand_flag) { if (nswaptypes != nmutypes) error->all(FLERR,"Need nswaptypes mu values in fix atom/swap command"); @@ -227,7 +227,7 @@ void FixAtomSwap::init() if (nmutypes != 0) error->all(FLERR,"Mu not allowed when not using semi-grand in fix atom/swap command"); } - + for (int iswaptype = 0; iswaptype < nswaptypes; iswaptype++) if (type_list[iswaptype] <= 0 || type_list[iswaptype] > atom->ntypes) error->all(FLERR,"Invalid atom type in fix atom/swap command"); @@ -261,15 +261,15 @@ void FixAtomSwap::init() } } } - + memory->create(sqrt_mass_ratio,atom->ntypes+1,atom->ntypes+1,"atom/swap:sqrt_mass_ratio"); for (int itype = 1; itype <= atom->ntypes; itype++) for (int jtype = 1; jtype <= atom->ntypes; jtype++) sqrt_mass_ratio[itype][jtype] = sqrt(atom->mass[itype]/atom->mass[jtype]); - + // check to see if itype and jtype cutoffs are the same // if not, reneighboring will be needed between swaps - + double **cutsq = force->pair->cutsq; unequal_cutoffs = false; for (int iswaptype = 0; iswaptype < nswaptypes; iswaptype++) @@ -277,10 +277,10 @@ void FixAtomSwap::init() for (int ktype = 1; ktype <= atom->ntypes; ktype++) if (cutsq[type_list[iswaptype]][ktype] != cutsq[type_list[jswaptype]][ktype]) unequal_cutoffs = true; - + // check that no swappable atoms are in atom->firstgroup // swapping such an atom might not leave firstgroup atoms first - + if (atom->firstgroup >= 0) { int *mask = atom->mask; int firstgroupbit = group->bitmask[atom->firstgroup]; @@ -288,7 +288,7 @@ void FixAtomSwap::init() int flag = 0; for (int i = 0; i < atom->nlocal; i++) if ((mask[i] == groupbit) && (mask[i] && firstgroupbit)) flag = 1; - + int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); @@ -306,7 +306,7 @@ void FixAtomSwap::pre_exchange() // just return if should not be called on this timestep if (next_reneighbor != update->ntimestep) return; - + if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); comm->exchange(); @@ -314,9 +314,9 @@ void FixAtomSwap::pre_exchange() if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); neighbor->build(); - + energy_stored = energy_full(); - + int nsuccess = 0; if (semi_grand_flag) { update_semi_grand_atoms_list(); @@ -325,7 +325,7 @@ void FixAtomSwap::pre_exchange() update_swap_atoms_list(); for (int i = 0; i < ncycles; i++) nsuccess += attempt_swap(); } - + nswap_attempts += ncycles; nswap_successes += nsuccess; @@ -355,7 +355,7 @@ int FixAtomSwap::attempt_semi_grand() } atom->type[i] = jtype; } - + if (unequal_cutoffs) { if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); @@ -367,19 +367,19 @@ int FixAtomSwap::attempt_semi_grand() } else { comm->forward_comm_fix(this); } - + if (force->kspace) force->kspace->qsum_qsq(); double energy_after = energy_full(); int success = 0; - if (i >= 0) - if (random_unequal->uniform() < + if (i >= 0) + if (random_unequal->uniform() < exp(-beta*(energy_after - energy_before + mu[jtype] - mu[itype]))) success = 1; - + int success_all = 0; MPI_Allreduce(&success,&success_all,1,MPI_INT,MPI_MAX,world); - + if (success_all) { update_semi_grand_atoms_list(); energy_stored = energy_after; @@ -397,7 +397,7 @@ int FixAtomSwap::attempt_semi_grand() } if (force->kspace) force->kspace->qsum_qsq(); energy_stored = energy_before; - + if (unequal_cutoffs) { if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); @@ -409,7 +409,7 @@ int FixAtomSwap::attempt_semi_grand() } else { comm->forward_comm_fix(this); } - } + } return 0; } @@ -420,14 +420,14 @@ int FixAtomSwap::attempt_semi_grand() int FixAtomSwap::attempt_swap() { if ((niswap == 0) || (njswap == 0)) return 0; - + double energy_before = energy_stored; int i = pick_i_swap_atom(); int j = pick_j_swap_atom(); int itype = type_list[0]; int jtype = type_list[1]; - + if (i >= 0) { atom->type[i] = jtype; if (atom->q_flag) atom->q[i] = qtype[1]; @@ -436,7 +436,7 @@ int FixAtomSwap::attempt_swap() atom->type[j] = itype; if (atom->q_flag) atom->q[j] = qtype[0]; } - + if (unequal_cutoffs) { if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); @@ -448,10 +448,10 @@ int FixAtomSwap::attempt_swap() } else { comm->forward_comm_fix(this); } - + double energy_after = energy_full(); - if (random_equal->uniform() < + if (random_equal->uniform() < exp(beta*(energy_before - energy_after))) { update_swap_atoms_list(); energy_stored = energy_after; @@ -478,7 +478,7 @@ int FixAtomSwap::attempt_swap() if (atom->q_flag) atom->q[j] = qtype[1]; } energy_stored = energy_before; - + if (unequal_cutoffs) { if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); @@ -499,13 +499,13 @@ int FixAtomSwap::attempt_swap() ------------------------------------------------------------------------- */ double FixAtomSwap::energy_full() -{ +{ int eflag = 1; int vflag = 0; if (modify->n_pre_neighbor) modify->pre_neighbor(); if (modify->n_pre_force) modify->pre_force(vflag); - + if (force->pair) force->pair->compute(eflag,vflag); if (atom->molecular) { @@ -516,10 +516,10 @@ double FixAtomSwap::energy_full() } if (force->kspace) force->kspace->compute(eflag,vflag); - + if (modify->n_post_force) modify->post_force(vflag); if (modify->n_end_of_step) modify->end_of_step(); - + update->eflag_global = update->ntimestep; double total_energy = c_pe->compute_scalar(); @@ -582,7 +582,7 @@ void FixAtomSwap::update_semi_grand_atoms_list() { int nlocal = atom->nlocal; double **x = atom->x; - + if (nlocal > atom_swap_nmax) { memory->sfree(local_swap_atom_list); atom_swap_nmax = atom->nmax; @@ -591,9 +591,9 @@ void FixAtomSwap::update_semi_grand_atoms_list() } nswap_local = 0; - + if (regionflag) { - + for (int i = 0; i < nlocal; i++) { if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]) == 1) { if (atom->mask[i] & groupbit) { @@ -637,7 +637,7 @@ void FixAtomSwap::update_swap_atoms_list() int nlocal = atom->nlocal; int *type = atom->type; double **x = atom->x; - + if (nlocal > atom_swap_nmax) { memory->sfree(local_swap_iatom_list); memory->sfree(local_swap_jatom_list); @@ -650,9 +650,9 @@ void FixAtomSwap::update_swap_atoms_list() niswap_local = 0; njswap_local = 0; - + if (regionflag) { - + for (int i = 0; i < nlocal; i++) { if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]) == 1) { if (atom->mask[i] & groupbit) { @@ -684,7 +684,7 @@ void FixAtomSwap::update_swap_atoms_list() MPI_Allreduce(&niswap_local,&niswap,1,MPI_INT,MPI_SUM,world); MPI_Scan(&niswap_local,&niswap_before,1,MPI_INT,MPI_SUM,world); niswap_before -= niswap_local; - + MPI_Allreduce(&njswap_local,&njswap,1,MPI_INT,MPI_SUM,world); MPI_Scan(&njswap_local,&njswap_before,1,MPI_INT,MPI_SUM,world); njswap_before -= njswap_local; @@ -698,7 +698,7 @@ int FixAtomSwap::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *type = atom->type; double *q = atom->q; - + m = 0; if (atom->q_flag) { @@ -725,7 +725,7 @@ void FixAtomSwap::unpack_forward_comm(int n, int first, double *buf) int *type = atom->type; double *q = atom->q; - + m = 0; last = first + n; @@ -791,7 +791,7 @@ void FixAtomSwap::restart(char *buf) seed = static_cast<int> (list[n++]); random_equal->reset(seed); - + seed = static_cast<int> (list[n++]); random_unequal->reset(seed); diff --git a/src/MC/fix_atom_swap.h b/src/MC/fix_atom_swap.h index 464c6a7239b675bd50aa02e110a2fecffe0bfbb6..066b0a3c8a9afa11fa6d3325457c005f1864dc4b 100644 --- a/src/MC/fix_atom_swap.h +++ b/src/MC/fix_atom_swap.h @@ -20,7 +20,7 @@ FixStyle(atom/swap,FixAtomSwap) #ifndef LMP_FIX_MCSWAP_H #define LMP_FIX_MCSWAP_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { @@ -65,12 +65,12 @@ class FixAtomSwap : public Fix { int nswaptypes,nmutypes; int *type_list; double *mu; - + double nswap_attempts; double nswap_successes; bool unequal_cutoffs; - + int atom_swap_nmax; double beta; double *qtype; @@ -82,7 +82,7 @@ class FixAtomSwap : public Fix { class RanPark *random_equal; class RanPark *random_unequal; - + class Compute *c_pe; void options(int, char **); diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index bede607d762012f13d0aeb2bb26443c892a82972..8e48f633e0c49b2f2fddc22c32fb1453e75c436b 100755 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "fix_bond_break.h" #include "update.h" #include "respa.h" @@ -402,7 +402,7 @@ void FixBondBreak::check_ghosts() int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall) + if (flagall) error->all(FLERR,"Fix bond/break needs ghost atoms from further away"); lastcheck = update->ntimestep; } @@ -465,7 +465,7 @@ void FixBondBreak::update_topology() if (influenced) rebuild_special_one(i); } - + int newton_bond = force->newton_bond; int all; @@ -829,7 +829,7 @@ void FixBondBreak::print_bb() /* ---------------------------------------------------------------------- */ -void FixBondBreak::print_copy(const char *str, tagint m, +void FixBondBreak::print_copy(const char *str, tagint m, int n1, int n2, int n3, int *v) { printf("%s %i: %d %d %d nspecial: ",str,m,n1,n2,n3); diff --git a/src/MC/fix_bond_break.h b/src/MC/fix_bond_break.h index 51f926ce9333daf57e5a81788731de190fb0f603..ba0e0f63b608154f283050b6ac045c258c458e7d 100755 --- a/src/MC/fix_bond_break.h +++ b/src/MC/fix_bond_break.h @@ -71,7 +71,7 @@ class FixBondBreak : public Fix { void break_impropers(int, tagint, tagint); void rebuild_special_one(int); int dedup(int, int, tagint *); - + // DEBUG void print_bb(); diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 7b4e8a03dbef499198d56e068cac01cc59397fe7..6db8644cac480957d56a11a29fb63171b9664f85 100755 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "fix_bond_create.h" #include "update.h" #include "respa.h" @@ -222,19 +222,19 @@ void FixBondCreate::init() if (atype && force->angle) { angleflag = 1; - if (atype > atom->nangletypes) + if (atype > atom->nangletypes) error->all(FLERR,"Fix bond/create angle type is invalid"); } else angleflag = 0; if (dtype && force->dihedral) { dihedralflag = 1; - if (dtype > atom->ndihedraltypes) + if (dtype > atom->ndihedraltypes) error->all(FLERR,"Fix bond/create dihedral type is invalid"); } else dihedralflag = 0; if (itype && force->improper) { improperflag = 1; - if (itype > atom->nimpropertypes) + if (itype > atom->nimpropertypes) error->all(FLERR,"Fix bond/create improper type is invalid"); } else improperflag = 0; @@ -294,7 +294,7 @@ void FixBondCreate::setup(int vflag) bondcount[i]++; if (newton_bond) { m = atom->map(bond_atom[i][j]); - if (m < 0) + if (m < 0) error->one(FLERR,"Fix bond/create needs ghost atoms " "from further away"); bondcount[m]++; @@ -605,7 +605,7 @@ void FixBondCreate::check_ghosts() int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall) + if (flagall) error->all(FLERR,"Fix bond/create needs ghost atoms from further away"); lastcheck = update->ntimestep; } @@ -729,7 +729,7 @@ void FixBondCreate::rebuild_special_one(int m) cn2 = cn1; for (i = 0; i < cn1; i++) { n = atom->map(copy[i]); - if (n < 0) + if (n < 0) error->one(FLERR,"Fix bond/create needs ghost atoms from further away"); slist = special[n]; n1 = nspecial[n][0]; @@ -748,7 +748,7 @@ void FixBondCreate::rebuild_special_one(int m) cn3 = cn2; for (i = cn1; i < cn2; i++) { n = atom->map(copy[i]); - if (n < 0) + if (n < 0) error->one(FLERR,"Fix bond/create needs ghost atoms from further away"); slist = special[n]; n1 = nspecial[n][0]; @@ -842,7 +842,7 @@ void FixBondCreate::create_angles(int m) for (i = 0; i < n1; i++) { i2 = s1list[i]; i2local = atom->map(i2); - if (i2local < 0) + if (i2local < 0) error->one(FLERR,"Fix bond/create needs ghost atoms from further away"); s2list = special[i2local]; n2 = nspecial[i2local][0]; @@ -923,7 +923,7 @@ void FixBondCreate::create_dihedrals(int m) i3 = s2list[j]; if (force->newton_bond && i2 > i3) continue; i3local = atom->map(i3); - if (i3local < 0) + if (i3local < 0) error->one(FLERR,"Fix bond/create needs ghost atoms from further away"); s3list = special[i3local]; n3 = nspecial[i3local][0]; @@ -962,7 +962,7 @@ void FixBondCreate::create_dihedrals(int m) i1 = s2list[i]; if (force->newton_bond && i2 > i1) continue; i1local = atom->map(i1); - if (i1local < 0) + if (i1local < 0) error->one(FLERR,"Fix bond/create needs ghost atoms from further away"); s3list = special[i1local]; n3 = nspecial[i1local][0]; @@ -1012,7 +1012,7 @@ void FixBondCreate::create_dihedrals(int m) for (i = 0; i < n1; i++) { i2 = s1list[i]; i2local = atom->map(i2); - if (i2local < 0) + if (i2local < 0) error->one(FLERR,"Fix bond/create needs ghost atoms from further away"); s2list = special[i2local]; n2 = nspecial[i2local][0]; @@ -1021,7 +1021,7 @@ void FixBondCreate::create_dihedrals(int m) i3 = s2list[j]; if (i3 == i1) continue; i3local = atom->map(i3); - if (i3local < 0) + if (i3local < 0) error->one(FLERR,"Fix bond/create needs ghost atoms from further away"); s3list = special[i3local]; n3 = nspecial[i3local][0]; @@ -1138,7 +1138,7 @@ void FixBondCreate::create_impropers(int m) for (i = 0; i < n2; i++) { i1 = s2list[i]; i1local = atom->map(i1); - if (i1local < 0) + if (i1local < 0) error->one(FLERR,"Fix bond/create needs ghost atoms from further away"); s1list = special[i1local]; n1 = nspecial[i1local][0]; @@ -1410,7 +1410,7 @@ void FixBondCreate::print_bb() printf("\n"); printf("TAG " TAGINT_FORMAT ": %d ndihedrals: ",atom->tag[i],atom->num_dihedral[i]); for (int j = 0; j < atom->num_dihedral[i]; j++) { - printf(" " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " + printf(" " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT ",", atom->dihedral_atom1[i][j], atom->dihedral_atom2[i][j],atom->dihedral_atom3[i][j], atom->dihedral_atom4[i][j]); @@ -1418,7 +1418,7 @@ void FixBondCreate::print_bb() printf("\n"); printf("TAG " TAGINT_FORMAT ": %d nimpropers: ",atom->tag[i],atom->num_improper[i]); for (int j = 0; j < atom->num_improper[i]; j++) { - printf(" " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " + printf(" " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT ",",atom->improper_atom1[i][j], atom->improper_atom2[i][j],atom->improper_atom3[i][j], atom->improper_atom4[i][j]); @@ -1435,7 +1435,7 @@ void FixBondCreate::print_bb() /* ---------------------------------------------------------------------- */ -void FixBondCreate::print_copy(const char *str, tagint m, +void FixBondCreate::print_copy(const char *str, tagint m, int n1, int n2, int n3, int *v) { printf("%s " TAGINT_FORMAT ": %d %d %d nspecial: ",str,m,n1,n2,n3); diff --git a/src/MC/fix_bond_create.h b/src/MC/fix_bond_create.h index 707b754067f2bfd1f52262e179389457fe0943e0..403b1ae3402f405c8e6ad735a6e204dc1707cfdb 100755 --- a/src/MC/fix_bond_create.h +++ b/src/MC/fix_bond_create.h @@ -71,7 +71,7 @@ class FixBondCreate : public Fix { class RanMars *random; class NeighList *list; - + int countflag,commflag; int nlevels_respa; int nangles,ndihedrals,nimpropers; diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 448c1641597897a475708f9cc925209bcf881096..0c36cecb3099002d0e020a908267897222470cfd 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_bond_swap.h" #include "atom.h" #include "force.h" @@ -652,7 +652,7 @@ int FixBondSwap::modify_param(int narg, char **arg) strcpy(id_temp,arg[1]); int icompute = modify->find_compute(id_temp); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID"); temperature = modify->compute[icompute]; diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index d41e3ef325131b5ab453830e83b17889262fcd2c..a9c7ad439c510790e6a53845708c95fba3670970 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -15,9 +15,9 @@ Contributing author: Paul Crozier, Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_gcmc.h" #include "atom.h" #include "atom_vec.h" @@ -62,11 +62,11 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : { if (narg < 11) error->all(FLERR,"Illegal fix gcmc command"); - if (atom->molecular == 2) + if (atom->molecular == 2) error->all(FLERR,"Fix gcmc does not (yet) work with atom_style template"); dynamic_group_allow = 1; - + vector_flag = 1; size_vector = 8; global_freq = 1; @@ -103,17 +103,17 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : // random number generator, not the same for all procs random_unequal = new RanPark(lmp,seed); - + // error checks on region and its extent being inside simulation box - region_xlo = region_xhi = region_ylo = region_yhi = + region_xlo = region_xhi = region_ylo = region_yhi = region_zlo = region_zhi = 0.0; if (regionflag) { if (domain->regions[iregion]->bboxflag == 0) error->all(FLERR,"Fix gcmc region does not support a bounding box"); if (domain->regions[iregion]->dynamic_check()) error->all(FLERR,"Fix gcmc region cannot be dynamic"); - + region_xlo = domain->regions[iregion]->extent_xlo; region_xhi = domain->regions[iregion]->extent_xhi; region_ylo = domain->regions[iregion]->extent_ylo; @@ -127,7 +127,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix gcmc region extends outside simulation box"); // estimate region volume using MC trials - + double coord[3]; int inside = 0; int attempts = 10000000; @@ -135,7 +135,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - if (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) != 0) + if (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) != 0) inside++; } @@ -214,10 +214,10 @@ void FixGCMC::options(int narg, char **arg) mode = ATOM; max_rotation_angle = 10*MY_PI/180; - regionflag = 0; - iregion = -1; + regionflag = 0; + iregion = -1; region_volume = 0; - max_region_attempts = 1000; + max_region_attempts = 1000; molecule_group = 0; molecule_group_bit = 0; molecule_group_inversebit = 0; @@ -300,7 +300,7 @@ void FixGCMC::options(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); if (ngroups >= ngroupsmax) { ngroupsmax = ngroups+1; - groupstrings = (char **) + groupstrings = (char **) memory->srealloc(groupstrings, ngroupsmax*sizeof(char *), "fix_gcmc:groupstrings"); @@ -316,7 +316,7 @@ void FixGCMC::options(int narg, char **arg) ngrouptypesmax = ngrouptypes+1; grouptypes = (int*) memory->srealloc(grouptypes,ngrouptypesmax*sizeof(int), "fix_gcmc:grouptypes"); - grouptypestrings = (char**) + grouptypestrings = (char**) memory->srealloc(grouptypestrings, ngrouptypesmax*sizeof(char *), "fix_gcmc:grouptypestrings"); @@ -351,11 +351,11 @@ FixGCMC::~FixGCMC() memory->destroy(atom_coord); memory->destroy(coords); memory->destroy(imageflags); - + delete [] idshake; if (ngroups > 0) { - for (int igroup = 0; igroup < ngroups; igroup++) + for (int igroup = 0; igroup < ngroups; igroup++) delete [] groupstrings[igroup]; memory->sfree(groupstrings); } @@ -363,7 +363,7 @@ FixGCMC::~FixGCMC() if (ngrouptypes > 0) { memory->destroy(grouptypes); memory->destroy(grouptypebits); - for (int igroup = 0; igroup < ngrouptypes; igroup++) + for (int igroup = 0; igroup < ngrouptypes; igroup++) delete [] grouptypestrings[igroup]; memory->sfree(grouptypestrings); } @@ -381,14 +381,14 @@ int FixGCMC::setmask() /* ---------------------------------------------------------------------- */ void FixGCMC::init() -{ +{ triclinic = domain->triclinic; // decide whether to switch to the full_energy option if (!full_flag) { - if ((force->kspace) || + if ((force->kspace) || (force->pair == NULL) || (force->pair->single_enable == 0) || (force->pair_match("hybrid",0)) || @@ -396,11 +396,11 @@ void FixGCMC::init() (triclinic == 1) ) { full_flag = true; - if (comm->me == 0) + if (comm->me == 0) error->warning(FLERR,"Fix gcmc using full_energy option"); } } - + if (full_flag) { char *id_pe = (char *) "thermo_pe"; int ipe = modify->find_compute(id_pe); @@ -445,7 +445,7 @@ void FixGCMC::init() "All mol IDs should be set for fix gcmc group atoms"); } - if (((mode == MOLECULE) && (atom->molecule_flag == 0)) || + if (((mode == MOLECULE) && (atom->molecule_flag == 0)) || ((mode == MOLECULE) && (!atom->tag_enable || !atom->map_style))) error->all(FLERR, "Fix gcmc molecule command requires that " @@ -481,14 +481,14 @@ void FixGCMC::init() group_arg[3] = (char *) "all"; group->assign(4,group_arg); exclusion_group = group->find(group_arg[0]); - if (exclusion_group == -1) + if (exclusion_group == -1) error->all(FLERR,"Could not find fix gcmc exclusion group ID"); exclusion_group_bit = group->bitmask[exclusion_group]; - + // neighbor list exclusion setup // turn off interactions between group all and the exclusion group - - int narg = 4; + + int narg = 4; char **arg = new char*[narg];; arg[0] = (char *) "exclude"; arg[1] = (char *) "group"; @@ -499,7 +499,7 @@ void FixGCMC::init() delete [] group_arg; delete [] arg; } - + // create a new group for temporary use with selected molecules if (mode == MOLECULE) { @@ -514,17 +514,17 @@ void FixGCMC::init() group_arg[2] = digits; group->assign(3,group_arg); molecule_group = group->find(group_arg[0]); - if (molecule_group == -1) + if (molecule_group == -1) error->all(FLERR,"Could not find fix gcmc rotation group ID"); molecule_group_bit = group->bitmask[molecule_group]; molecule_group_inversebit = molecule_group_bit ^ ~0; delete [] group_arg[0]; delete [] group_arg; } - - // get all of the needed molecule data if mode == MOLECULE, + + // get all of the needed molecule data if mode == MOLECULE, // otherwise just get the gas mass - + if (mode == MOLECULE) { onemols[imol]->compute_mass(); @@ -535,15 +535,15 @@ void FixGCMC::init() onemols[imol]->x[i][1] -= onemols[imol]->com[1]; onemols[imol]->x[i][2] -= onemols[imol]->com[2]; } - + } else gas_mass = atom->mass[ngcmc_type]; - + if (gas_mass <= 0.0) error->all(FLERR,"Illegal fix gcmc gas mass <= 0"); - + // check that no deletable atoms are in atom->firstgroup // deleting such an atom would not leave firstgroup atoms first - + if (atom->firstgroup >= 0) { int *mask = atom->mask; int firstgroupbit = group->bitmask[atom->firstgroup]; @@ -551,14 +551,14 @@ void FixGCMC::init() int flag = 0; for (int i = 0; i < atom->nlocal; i++) if ((mask[i] == groupbit) && (mask[i] && firstgroupbit)) flag = 1; - + int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); if (flagall) error->all(FLERR,"Cannot do GCMC on atoms in atom_modify first group"); } - + // compute beta, lambda, sigma, and the zz factor beta = 1.0/(force->boltz*reservoir_temperature); @@ -568,17 +568,17 @@ void FixGCMC::init() sigma = sqrt(force->boltz*reservoir_temperature*tfac_insert/gas_mass/force->mvv2e); zz = exp(beta*chemical_potential)/(pow(lambda,3.0)); if (pressure_flag) zz = pressure*fugacity_coeff*beta/force->nktv2p; - - imagezero = ((imageint) IMGMAX << IMG2BITS) | + + imagezero = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; // construct group bitmask for all new atoms // aggregated over all group keywords - + groupbitall = 1 | groupbit; for (int igroup = 0; igroup < ngroups; igroup++) { int jgroup = group->find(groupstrings[igroup]); - if (jgroup == -1) + if (jgroup == -1) error->all(FLERR,"Could not find specified fix gcmc group ID"); groupbitall |= group->bitmask[jgroup]; } @@ -590,7 +590,7 @@ void FixGCMC::init() memory->create(grouptypebits,ngrouptypes,"fix_gcmc:grouptypebits"); for (int igroup = 0; igroup < ngrouptypes; igroup++) { int jgroup = group->find(grouptypestrings[igroup]); - if (jgroup == -1) + if (jgroup == -1) error->all(FLERR,"Could not find specified fix gcmc group ID"); grouptypebits[igroup] = group->bitmask[jgroup]; } @@ -668,9 +668,9 @@ void FixGCMC::pre_exchange() atom->nghost = 0; comm->borders(); if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); - + } else { - + if (mode == MOLECULE) { for (int i = 0; i < ncycles; i++) { int random_int_fraction = @@ -705,11 +705,11 @@ void FixGCMC::pre_exchange() void FixGCMC::attempt_atomic_translation() { ntranslation_attempts += 1.0; - + if (ngas == 0) return; int i = pick_random_gas_atom(); - + int success = 0; if (i >= 0) { double **x = atom->x; @@ -723,7 +723,7 @@ void FixGCMC::attempt_atomic_translation() ry = 2*random_unequal->uniform() - 1.0; rz = 2*random_unequal->uniform() - 1.0; rsq = rx*rx + ry*ry + rz*rz; - } + } coord[0] = x[i][0] + displace*rx; coord[1] = x[i][1] + displace*ry; coord[2] = x[i][2] + displace*rz; @@ -735,17 +735,17 @@ void FixGCMC::attempt_atomic_translation() ry = 2*random_unequal->uniform() - 1.0; rz = 2*random_unequal->uniform() - 1.0; rsq = rx*rx + ry*ry + rz*rz; - } + } coord[0] = x[i][0] + displace*rx; coord[1] = x[i][1] + displace*ry; coord[2] = x[i][2] + displace*rz; } } - if (!domain->inside_nonperiodic(coord)) + if (!domain->inside_nonperiodic(coord)) error->one(FLERR,"Fix gcmc put atom outside box"); double energy_after = energy(i,ngcmc_type,-1,coord); - if (random_unequal->uniform() < + if (random_unequal->uniform() < exp(beta*(energy_before - energy_after))) { x[i][0] = coord[0]; x[i][1] = coord[1]; @@ -777,13 +777,13 @@ void FixGCMC::attempt_atomic_deletion() ndeletion_attempts += 1.0; if (ngas == 0) return; - + int i = pick_random_gas_atom(); int success = 0; if (i >= 0) { double deletion_energy = energy(i,ngcmc_type,-1,atom->x[i]); - if (random_unequal->uniform() < + if (random_unequal->uniform() < ngas*exp(beta*deletion_energy)/(zz*volume)) { atom->avec->copy(atom->nlocal-1,i,1); atom->nlocal--; @@ -854,7 +854,7 @@ void FixGCMC::attempt_atomic_insertion() int proc_flag = 0; if (triclinic == 0) { domain->remap(coord); - if (!domain->inside(coord)) + if (!domain->inside(coord)) error->one(FLERR,"Fix gcmc put atom outside box"); if (coord[0] >= sublo[0] && coord[0] < subhi[0] && coord[1] >= sublo[1] && coord[1] < subhi[1] && @@ -926,7 +926,7 @@ void FixGCMC::attempt_molecule_translation() if (translation_molecule == -1) return; double energy_before_sum = molecule_energy(translation_molecule); - + double **x = atom->x; double rx,ry,rz; double com_displace[3],coord[3]; @@ -940,7 +940,7 @@ void FixGCMC::attempt_molecule_translation() com_displace[0] = displace*rx; com_displace[1] = displace*ry; com_displace[2] = displace*rz; - + int nlocal = atom->nlocal; if (regionflag) { int *mask = atom->mask; @@ -964,7 +964,7 @@ void FixGCMC::attempt_molecule_translation() ry = 2*random_equal->uniform() - 1.0; rz = 2*random_equal->uniform() - 1.0; rsq = rx*rx + ry*ry + rz*rz; - } + } coord[0] = com[0] + displace*rx; coord[1] = com[1] + displace*ry; coord[2] = com[2] + displace*rz; @@ -980,7 +980,7 @@ void FixGCMC::attempt_molecule_translation() coord[0] = x[i][0] + com_displace[0]; coord[1] = x[i][1] + com_displace[1]; coord[2] = x[i][2] + com_displace[2]; - if (!domain->inside_nonperiodic(coord)) + if (!domain->inside_nonperiodic(coord)) error->one(FLERR,"Fix gcmc put atom outside box"); energy_after += energy(i,atom->type[i],translation_molecule,coord); } @@ -989,7 +989,7 @@ void FixGCMC::attempt_molecule_translation() double energy_after_sum = 0.0; MPI_Allreduce(&energy_after,&energy_after_sum,1,MPI_DOUBLE,MPI_SUM,world); - if (random_equal->uniform() < + if (random_equal->uniform() < exp(beta*(energy_before_sum - energy_after_sum))) { for (int i = 0; i < nlocal; i++) { if (atom->molecule[i] == translation_molecule) { @@ -1020,7 +1020,7 @@ void FixGCMC::attempt_molecule_rotation() tagint rotation_molecule = pick_random_gas_molecule(); if (rotation_molecule == -1) return; - + double energy_before_sum = molecule_energy(rotation_molecule); int nlocal = atom->nlocal; @@ -1065,7 +1065,7 @@ void FixGCMC::attempt_molecule_rotation() xtmp[0] -= com[0]; xtmp[1] -= com[1]; xtmp[2] -= com[2]; - MathExtra::matvec(rotmat,xtmp,atom_coord[n]); + MathExtra::matvec(rotmat,xtmp,atom_coord[n]); atom_coord[n][0] += com[0]; atom_coord[n][1] += com[1]; atom_coord[n][2] += com[2]; @@ -1073,7 +1073,7 @@ void FixGCMC::attempt_molecule_rotation() xtmp[1] = atom_coord[n][1]; xtmp[2] = atom_coord[n][2]; domain->remap(xtmp); - if (!domain->inside(xtmp)) + if (!domain->inside(xtmp)) error->one(FLERR,"Fix gcmc put atom outside box"); energy_after += energy(i,atom->type[i],rotation_molecule,xtmp); n++; @@ -1083,7 +1083,7 @@ void FixGCMC::attempt_molecule_rotation() double energy_after_sum = 0.0; MPI_Allreduce(&energy_after,&energy_after_sum,1,MPI_DOUBLE,MPI_SUM,world); - if (random_equal->uniform() < + if (random_equal->uniform() < exp(beta*(energy_before_sum - energy_after_sum))) { int n = 0; for (int i = 0; i < nlocal; i++) { @@ -1115,13 +1115,13 @@ void FixGCMC::attempt_molecule_deletion() ndeletion_attempts += 1.0; if (ngas == 0) return; - + tagint deletion_molecule = pick_random_gas_molecule(); if (deletion_molecule == -1) return; double deletion_energy_sum = molecule_energy(deletion_molecule); - if (random_equal->uniform() < + if (random_equal->uniform() < ngas*exp(beta*deletion_energy_sum)/(zz*volume*natoms_per_molecule)) { int i = 0; while (i < atom->nlocal) { @@ -1150,19 +1150,19 @@ void FixGCMC::attempt_molecule_insertion() double com_coord[3]; if (regionflag) { int region_attempt = 0; - com_coord[0] = region_xlo + random_equal->uniform() * + com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); - com_coord[1] = region_ylo + random_equal->uniform() * + com_coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); - com_coord[2] = region_zlo + random_equal->uniform() * + com_coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); while (domain->regions[iregion]->match(com_coord[0],com_coord[1], com_coord[2]) == 0) { - com_coord[0] = region_xlo + random_equal->uniform() * + com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); - com_coord[1] = region_ylo + random_equal->uniform() * + com_coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); - com_coord[2] = region_zlo + random_equal->uniform() * + com_coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); region_attempt++; if (region_attempt >= max_region_attempts) return; @@ -1177,11 +1177,11 @@ void FixGCMC::attempt_molecule_insertion() lamda[0] = random_equal->uniform(); lamda[1] = random_equal->uniform(); lamda[2] = random_equal->uniform(); - + // wasteful, but necessary - + if (lamda[0] == 1.0) lamda[0] = 0.0; - if (lamda[1] == 1.0) lamda[1] = 0.0; + if (lamda[1] == 1.0) lamda[1] = 0.0; if (lamda[2] == 1.0) lamda[2] = 0.0; domain->lamda2x(lamda,com_coord); @@ -1204,7 +1204,7 @@ void FixGCMC::attempt_molecule_insertion() MathExtra::norm3(r); MathExtra::axisangle_to_quat(r,theta,quat); MathExtra::quat_to_mat(quat,rotmat); - + double insertion_energy = 0.0; bool procflag[natoms_per_molecule]; @@ -1222,7 +1222,7 @@ void FixGCMC::attempt_molecule_insertion() xtmp[1] = atom_coord[i][1]; xtmp[2] = atom_coord[i][2]; domain->remap(xtmp); - if (!domain->inside(xtmp)) + if (!domain->inside(xtmp)) error->one(FLERR,"Fix gcmc put atom outside box"); procflag[i] = false; @@ -1253,28 +1253,28 @@ void FixGCMC::attempt_molecule_insertion() MPI_DOUBLE,MPI_SUM,world); if (random_equal->uniform() < zz*volume*natoms_per_molecule* - exp(-beta*insertion_energy_sum)/(ngas + natoms_per_molecule)) { + exp(-beta*insertion_energy_sum)/(ngas + natoms_per_molecule)) { tagint maxmol = 0; for (int i = 0; i < atom->nlocal; i++) maxmol = MAX(maxmol,atom->molecule[i]); tagint maxmol_all; MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); maxmol_all++; - if (maxmol_all >= MAXTAGINT) + if (maxmol_all >= MAXTAGINT) error->all(FLERR,"Fix gcmc ran out of available molecule IDs"); tagint maxtag = 0; for (int i = 0; i < atom->nlocal; i++) maxtag = MAX(maxtag,atom->tag[i]); tagint maxtag_all; MPI_Allreduce(&maxtag,&maxtag_all,1,MPI_LMP_TAGINT,MPI_MAX,world); - + int nlocalprev = atom->nlocal; - + double vnew[3]; vnew[0] = random_equal->gaussian()*sigma; vnew[1] = random_equal->gaussian()*sigma; vnew[2] = random_equal->gaussian()*sigma; - + for (int i = 0; i < natoms_per_molecule; i++) { if (procflag[i]) { atom->avec->create_atom(onemols[imol]->type[i],atom_coord[i]); @@ -1298,13 +1298,13 @@ void FixGCMC::attempt_molecule_insertion() atom->v[m][0] = vnew[0]; atom->v[m][1] = vnew[1]; atom->v[m][2] = vnew[2]; - + atom->add_molecule_atom(onemols[imol],i,m,maxtag_all); modify->create_attribute(m); } } - if (shakeflag) + if (shakeflag) fixshake->set_molecule(nlocalprev,maxtag_all,imol,com_coord,vnew,quat); atom->natoms += natoms_per_molecule; @@ -1328,22 +1328,22 @@ void FixGCMC::attempt_molecule_insertion() void FixGCMC::attempt_atomic_translation_full() { ntranslation_attempts += 1.0; - + if (ngas == 0) return; double energy_before = energy_stored; - + int i = pick_random_gas_atom(); double **x = atom->x; double xtmp[3]; - + xtmp[0] = xtmp[1] = xtmp[2] = 0.0; - + tagint tmptag = -1; - + if (i >= 0) { - + double rsq = 1.1; double rx,ry,rz; rx = ry = rz = 0.0; @@ -1353,7 +1353,7 @@ void FixGCMC::attempt_atomic_translation_full() ry = 2*random_unequal->uniform() - 1.0; rz = 2*random_unequal->uniform() - 1.0; rsq = rx*rx + ry*ry + rz*rz; - } + } coord[0] = x[i][0] + displace*rx; coord[1] = x[i][1] + displace*ry; coord[2] = x[i][2] + displace*rz; @@ -1365,13 +1365,13 @@ void FixGCMC::attempt_atomic_translation_full() ry = 2*random_unequal->uniform() - 1.0; rz = 2*random_unequal->uniform() - 1.0; rsq = rx*rx + ry*ry + rz*rz; - } + } coord[0] = x[i][0] + displace*rx; coord[1] = x[i][1] + displace*ry; coord[2] = x[i][2] + displace*rz; } } - if (!domain->inside_nonperiodic(coord)) + if (!domain->inside_nonperiodic(coord)) error->one(FLERR,"Fix gcmc put atom outside box"); xtmp[0] = x[i][0]; xtmp[1] = x[i][1]; @@ -1379,33 +1379,33 @@ void FixGCMC::attempt_atomic_translation_full() x[i][0] = coord[0]; x[i][1] = coord[1]; x[i][2] = coord[2]; - + tmptag = atom->tag[i]; } - + double energy_after = energy_full(); - - if (random_equal->uniform() < + + if (random_equal->uniform() < exp(beta*(energy_before - energy_after))) { energy_stored = energy_after; ntranslation_successes += 1.0; } else { - + tagint tmptag_all; MPI_Allreduce(&tmptag,&tmptag_all,1,MPI_LMP_TAGINT,MPI_MAX,world); - + double xtmp_all[3]; MPI_Allreduce(&xtmp,&xtmp_all,3,MPI_DOUBLE,MPI_SUM,world); - + for (int i = 0; i < atom->nlocal; i++) { - if (tmptag_all == atom->tag[i]) { + if (tmptag_all == atom->tag[i]) { x[i][0] = xtmp_all[0]; x[i][1] = xtmp_all[1]; x[i][2] = xtmp_all[2]; } } energy_stored = energy_before; - } + } update_gas_atoms_list(); } @@ -1420,7 +1420,7 @@ void FixGCMC::attempt_atomic_deletion_full() ndeletion_attempts += 1.0; if (ngas == 0) return; - + double energy_before = energy_stored; const int i = pick_random_gas_atom(); @@ -1437,16 +1437,16 @@ void FixGCMC::attempt_atomic_deletion_full() if (force->kspace) force->kspace->qsum_qsq(); double energy_after = energy_full(); - if (random_equal->uniform() < + if (random_equal->uniform() < ngas*exp(beta*(energy_before - energy_after))/(zz*volume)) { if (i >= 0) { atom->avec->copy(atom->nlocal-1,i,1); - atom->nlocal--; + atom->nlocal--; } atom->natoms--; - if (atom->map_style) atom->map_init(); - ndeletion_successes += 1.0; - energy_stored = energy_after; + if (atom->map_style) atom->map_init(); + ndeletion_successes += 1.0; + energy_stored = energy_after; } else { if (i >= 0) { atom->mask[i] = tmpmask; @@ -1467,7 +1467,7 @@ void FixGCMC::attempt_atomic_insertion_full() ninsertion_attempts += 1.0; double energy_before = energy_stored; - + double coord[3]; if (regionflag) { int region_attempt = 0; @@ -1501,11 +1501,11 @@ void FixGCMC::attempt_atomic_insertion_full() domain->lamda2x(lamda,coord); } } - + int proc_flag = 0; if (triclinic == 0) { domain->remap(coord); - if (!domain->inside(coord)) + if (!domain->inside(coord)) error->one(FLERR,"Fix gcmc put atom outside box"); if (coord[0] >= sublo[0] && coord[0] < subhi[0] && coord[1] >= sublo[1] && coord[1] < subhi[1] && @@ -1522,7 +1522,7 @@ void FixGCMC::attempt_atomic_insertion_full() // add to groups // optionally add to type-based groups - + atom->mask[m] = groupbitall; for (int igroup = 0; igroup < ngrouptypes; igroup++) { if (ngcmc_type == grouptypes[igroup]) @@ -1545,7 +1545,7 @@ void FixGCMC::attempt_atomic_insertion_full() comm->borders(); if (force->kspace) force->kspace->qsum_qsq(); double energy_after = energy_full(); - + if (random_equal->uniform() < zz*volume*exp(beta*(energy_before - energy_after))/(ngas+1)) { @@ -1573,7 +1573,7 @@ void FixGCMC::attempt_molecule_translation_full() if (translation_molecule == -1) return; double energy_before = energy_stored; - + double **x = atom->x; double rx,ry,rz; double com_displace[3],coord[3]; @@ -1587,7 +1587,7 @@ void FixGCMC::attempt_molecule_translation_full() com_displace[0] = displace*rx; com_displace[1] = displace*ry; com_displace[2] = displace*rz; - + int nlocal = atom->nlocal; if (regionflag) { int *mask = atom->mask; @@ -1611,7 +1611,7 @@ void FixGCMC::attempt_molecule_translation_full() ry = 2*random_equal->uniform() - 1.0; rz = 2*random_equal->uniform() - 1.0; rsq = rx*rx + ry*ry + rz*rz; - } + } coord[0] = com[0] + displace*rx; coord[1] = com[1] + displace*ry; coord[2] = com[2] + displace*rz; @@ -1620,7 +1620,7 @@ void FixGCMC::attempt_molecule_translation_full() com_displace[1] = displace*ry; com_displace[2] = displace*rz; } - + for (int i = 0; i < nlocal; i++) { if (atom->molecule[i] == translation_molecule) { x[i][0] += com_displace[0]; @@ -1633,7 +1633,7 @@ void FixGCMC::attempt_molecule_translation_full() double energy_after = energy_full(); - if (random_equal->uniform() < + if (random_equal->uniform() < exp(beta*(energy_before - energy_after))) { ntranslation_successes += 1.0; energy_stored = energy_after; @@ -1658,10 +1658,10 @@ void FixGCMC::attempt_molecule_rotation_full() nrotation_attempts += 1.0; if (ngas == 0) return; - + tagint rotation_molecule = pick_random_gas_molecule(); if (rotation_molecule == -1) return; - + double energy_before = energy_stored; int nlocal = atom->nlocal; @@ -1703,14 +1703,14 @@ void FixGCMC::attempt_molecule_rotation_full() if (mask[i] & molecule_group_bit) { atom_coord[n][0] = x[i][0]; atom_coord[n][1] = x[i][1]; - atom_coord[n][2] = x[i][2]; - image_orig[n] = image[i]; + atom_coord[n][2] = x[i][2]; + image_orig[n] = image[i]; double xtmp[3]; domain->unmap(x[i],image[i],xtmp); xtmp[0] -= com[0]; xtmp[1] -= com[1]; xtmp[2] -= com[2]; - MathExtra::matvec(rotmat,xtmp,x[i]); + MathExtra::matvec(rotmat,xtmp,x[i]); x[i][0] += com[0]; x[i][1] += com[1]; x[i][2] += com[2]; @@ -1721,13 +1721,13 @@ void FixGCMC::attempt_molecule_rotation_full() n++; } } - + double energy_after = energy_full(); - if (random_equal->uniform() < + if (random_equal->uniform() < exp(beta*(energy_before - energy_after))) { nrotation_successes += 1.0; - energy_stored = energy_after; + energy_stored = energy_after; } else { energy_stored = energy_before; int n = 0; @@ -1752,12 +1752,12 @@ void FixGCMC::attempt_molecule_deletion_full() ndeletion_attempts += 1.0; if (ngas == 0) return; - + tagint deletion_molecule = pick_random_gas_molecule(); if (deletion_molecule == -1) return; double energy_before = energy_stored; - + int m = 0; double q_tmp[natoms_per_molecule]; int tmpmask[atom->nlocal]; @@ -1774,7 +1774,7 @@ void FixGCMC::attempt_molecule_deletion_full() } } if (force->kspace) force->kspace->qsum_qsq(); - double energy_after = energy_full(); + double energy_after = energy_full(); // energy_before corrected by energy_intra @@ -1803,7 +1803,7 @@ void FixGCMC::attempt_molecule_deletion_full() atom->q[i] = q_tmp[m]; m++; } - } + } } if (force->kspace) force->kspace->qsum_qsq(); } @@ -1817,7 +1817,7 @@ void FixGCMC::attempt_molecule_insertion_full() { double lamda[3]; ninsertion_attempts += 1.0; - + double energy_before = energy_stored; tagint maxmol = 0; @@ -1825,33 +1825,33 @@ void FixGCMC::attempt_molecule_insertion_full() tagint maxmol_all; MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); maxmol_all++; - if (maxmol_all >= MAXTAGINT) + if (maxmol_all >= MAXTAGINT) error->all(FLERR,"Fix gcmc ran out of available molecule IDs"); int insertion_molecule = maxmol_all; - + tagint maxtag = 0; for (int i = 0; i < atom->nlocal; i++) maxtag = MAX(maxtag,atom->tag[i]); tagint maxtag_all; MPI_Allreduce(&maxtag,&maxtag_all,1,MPI_LMP_TAGINT,MPI_MAX,world); int nlocalprev = atom->nlocal; - + double com_coord[3]; if (regionflag) { int region_attempt = 0; - com_coord[0] = region_xlo + random_equal->uniform() * + com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); - com_coord[1] = region_ylo + random_equal->uniform() * + com_coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); - com_coord[2] = region_zlo + random_equal->uniform() * + com_coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); while (domain->regions[iregion]->match(com_coord[0],com_coord[1], com_coord[2]) == 0) { - com_coord[0] = region_xlo + random_equal->uniform() * + com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); - com_coord[1] = region_ylo + random_equal->uniform() * + com_coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); - com_coord[2] = region_zlo + random_equal->uniform() * + com_coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); region_attempt++; if (region_attempt >= max_region_attempts) return; @@ -1866,18 +1866,18 @@ void FixGCMC::attempt_molecule_insertion_full() lamda[0] = random_equal->uniform(); lamda[1] = random_equal->uniform(); lamda[2] = random_equal->uniform(); - + // wasteful, but necessary - + if (lamda[0] == 1.0) lamda[0] = 0.0; - if (lamda[1] == 1.0) lamda[1] = 0.0; + if (lamda[1] == 1.0) lamda[1] = 0.0; if (lamda[2] == 1.0) lamda[2] = 0.0; domain->lamda2x(lamda,com_coord); } } - + // generate point in unit cube // then restrict to unit sphere @@ -1899,7 +1899,7 @@ void FixGCMC::attempt_molecule_insertion_full() vnew[0] = random_equal->gaussian()*sigma; vnew[1] = random_equal->gaussian()*sigma; vnew[2] = random_equal->gaussian()*sigma; - + for (int i = 0; i < natoms_per_molecule; i++) { double xtmp[3]; MathExtra::matvec(rotmat,onemols[imol]->x[i],xtmp); @@ -1911,7 +1911,7 @@ void FixGCMC::attempt_molecule_insertion_full() imageint imagetmp = imagezero; domain->remap(xtmp,imagetmp); - if (!domain->inside(xtmp)) + if (!domain->inside(xtmp)) error->one(FLERR,"Fix gcmc put atom outside box"); int proc_flag = 0; @@ -1953,7 +1953,7 @@ void FixGCMC::attempt_molecule_insertion_full() } } - if (shakeflag) + if (shakeflag) fixshake->set_molecule(nlocalprev,maxtag_all,imol,com_coord,vnew,quat); atom->natoms += natoms_per_molecule; @@ -1974,8 +1974,8 @@ void FixGCMC::attempt_molecule_insertion_full() double deltaphi = zz*volume*natoms_per_molecule* exp(beta*(energy_before - (energy_after - energy_intra)))/(ngas + natoms_per_molecule); - if (random_equal->uniform() < deltaphi) { - + if (random_equal->uniform() < deltaphi) { + ninsertion_successes += 1.0; energy_stored = energy_after; @@ -1986,7 +1986,7 @@ void FixGCMC::attempt_molecule_insertion_full() atom->ndihedrals -= onemols[imol]->ndihedrals; atom->nimpropers -= onemols[imol]->nimpropers; atom->natoms -= natoms_per_molecule; - + energy_stored = energy_before; int i = 0; while (i < atom->nlocal) { @@ -2042,7 +2042,7 @@ double FixGCMC::energy(int i, int itype, tagint imolecule, double *coord) } /* ---------------------------------------------------------------------- - compute the energy of the given gas molecule in its current position + compute the energy of the given gas molecule in its current position sum across all procs that own atoms of the given molecule ------------------------------------------------------------------------- */ @@ -2056,7 +2056,7 @@ double FixGCMC::molecule_energy(tagint gas_molecule_id) double mol_energy_sum = 0.0; MPI_Allreduce(&mol_energy,&mol_energy_sum,1,MPI_DOUBLE,MPI_SUM,world); - + return mol_energy_sum; } @@ -2065,7 +2065,7 @@ double FixGCMC::molecule_energy(tagint gas_molecule_id) ------------------------------------------------------------------------- */ double FixGCMC::energy_full() -{ +{ if (triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); comm->exchange(); @@ -2076,9 +2076,9 @@ double FixGCMC::energy_full() neighbor->build(); int eflag = 1; int vflag = 0; - + if (modify->n_pre_force) modify->pre_force(vflag); - + if (force->pair) force->pair->compute(eflag,vflag); if (atom->molecular) { @@ -2089,13 +2089,13 @@ double FixGCMC::energy_full() } if (force->kspace) force->kspace->compute(eflag,vflag); - + if (modify->n_post_force) modify->post_force(vflag); if (modify->n_end_of_step) modify->end_of_step(); - + update->eflag_global = update->ntimestep; double total_energy = c_pe->compute_scalar(); - + return total_energy; } @@ -2132,7 +2132,7 @@ tagint FixGCMC::pick_random_gas_molecule() tagint gas_molecule_id_all = 0; MPI_Allreduce(&gas_molecule_id,&gas_molecule_id_all,1, MPI_LMP_TAGINT,MPI_MAX,world); - + return gas_molecule_id_all; } @@ -2142,9 +2142,9 @@ tagint FixGCMC::pick_random_gas_molecule() void FixGCMC::toggle_intramolecular(int i) { if (atom->avec->bonds_allow) - for (int m = 0; m < atom->num_bond[i]; m++) + for (int m = 0; m < atom->num_bond[i]; m++) atom->bond_type[i][m] = -atom->bond_type[i][m]; - + if (atom->avec->angles_allow) for (int m = 0; m < atom->num_angle[i]; m++) atom->angle_type[i][m] = -atom->angle_type[i][m]; @@ -2152,12 +2152,12 @@ void FixGCMC::toggle_intramolecular(int i) if (atom->avec->dihedrals_allow) for (int m = 0; m < atom->num_dihedral[i]; m++) atom->dihedral_type[i][m] = -atom->dihedral_type[i][m]; - + if (atom->avec->impropers_allow) for (int m = 0; m < atom->num_improper[i]; m++) atom->improper_type[i][m] = -atom->improper_type[i][m]; } - + /* ---------------------------------------------------------------------- update the list of gas atoms ------------------------------------------------------------------------- */ @@ -2168,7 +2168,7 @@ void FixGCMC::update_gas_atoms_list() int *mask = atom->mask; tagint *molecule = atom->molecule; double **x = atom->x; - + if (nlocal > gcmc_nmax) { memory->sfree(local_gas_list); gcmc_nmax = atom->nmax; @@ -2177,11 +2177,11 @@ void FixGCMC::update_gas_atoms_list() } ngas_local = 0; - + if (regionflag) { - + if (mode == MOLECULE) { - + tagint maxmol = 0; for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]); tagint maxmol_all; @@ -2204,7 +2204,7 @@ void FixGCMC::update_gas_atoms_list() comy[imolecule] = com[1]; comz[imolecule] = com[2]; } - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (domain->regions[iregion]->match(comx[molecule[i]], @@ -2214,7 +2214,7 @@ void FixGCMC::update_gas_atoms_list() } } } - + } else { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { diff --git a/src/MC/fix_gcmc.h b/src/MC/fix_gcmc.h index ece963c7c93a195ce5e158949d3143b15a267c71..668ce5a1edbe834bbcc6999eed9d17e50028e8c0 100644 --- a/src/MC/fix_gcmc.h +++ b/src/MC/fix_gcmc.h @@ -20,7 +20,7 @@ FixStyle(gcmc,FixGCMC) #ifndef LMP_FIX_GCMC_H #define LMP_FIX_GCMC_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { @@ -74,7 +74,7 @@ class FixGCMC : public Fix { bool pressure_flag; // true if user specified reservoir pressure bool charge_flag; // true if user specified atomic charge bool full_flag; // true if doing full system energy calculations - + int natoms_per_molecule; // number of atoms in each gas molecule int groupbitall; // group bitmask for inserted atoms @@ -82,8 +82,8 @@ class FixGCMC : public Fix { char** groupstrings; // list of group-ids for inserted atoms int ngrouptypes; // number of type-based group-ids for inserted atoms char** grouptypestrings; // list of type-based group-ids for inserted atoms - int* grouptypebits; // list of type-based group bitmasks - int* grouptypes; // list of type-based group types + int* grouptypebits; // list of type-based group bitmasks + int* grouptypes; // list of type-based group types double ntranslation_attempts; double ntranslation_successes; double nrotation_attempts; @@ -119,7 +119,7 @@ class FixGCMC : public Fix { class RanPark *random_equal; class RanPark *random_unequal; - + class Atom *model_atom; class Molecule **onemols; @@ -130,7 +130,7 @@ class FixGCMC : public Fix { int shakeflag; char *idshake; int triclinic; // 0 = orthog box, 1 = triclinic - + class Compute *c_pe; void options(int, char **); @@ -254,7 +254,7 @@ Self-explanatory. E: Illegal fix gcmc gas mass <= 0 -The computed mass of the designated gas molecule or atom type was less +The computed mass of the designated gas molecule or atom type was less than or equal to zero. E: Cannot do gcmc on atoms in atom_modify first group diff --git a/src/MC/fix_tfmc.cpp b/src/MC/fix_tfmc.cpp index fb8bd19e77cfca9f1ea1502d59f4a07cd393f8f5..a59542e8906e1b4e814fb65c5a95c94a7e0605c9 100755 --- a/src/MC/fix_tfmc.cpp +++ b/src/MC/fix_tfmc.cpp @@ -16,10 +16,10 @@ ------------------------------------------------------------------------- */ #include "fix_tfmc.h" -#include "mpi.h" -#include "string.h" -#include "math.h" -#include "float.h" +#include <mpi.h> +#include <string.h> +#include <math.h> +#include <float.h> #include "atom.h" #include "force.h" #include "update.h" @@ -43,11 +43,11 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : // although we are not doing MD, we would like to use tfMC as an MD "drop in" time_integrate = 1; - + d_max = force->numeric(FLERR,arg[3]); T_set = force->numeric(FLERR,arg[4]); seed = force->inumeric(FLERR,arg[5]); - + if (d_max <= 0) error->all(FLERR,"Fix tfmc displacement length must be > 0"); if (T_set <= 0) error->all(FLERR,"Fix tfmc temperature must be > 0"); if (seed <= 0) error->all(FLERR,"Illegal fix tfmc random seed"); @@ -76,16 +76,16 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : // error checks if (comflag) if (xflag < 0 || xflag > 1 || yflag < 0 || yflag > 1 || - zflag < 0 || zflag > 1) + zflag < 0 || zflag > 1) error->all(FLERR,"Illegal fix tfmc command"); - if (xflag + yflag + zflag == 0) + if (xflag + yflag + zflag == 0) comflag = 0; if (rotflag) { xd = NULL; nmax = -1; } - + random_num = new RanMars(lmp,seed + comm->me); } @@ -125,7 +125,7 @@ void FixTFMC::init() // obtain lowest mass in the system // We do this here, in init(), rather than in initial_integrate(). - // This might seem somewhat odd: after all, another atom could be added with a + // This might seem somewhat odd: after all, another atom could be added with a // mass smaller than mass_min (in the case of a per-particle mass), so mass_min // should change during the run. However, this would imply that the overall // meaning of the input Delta is not very well-defined, because its meaning @@ -174,7 +174,7 @@ void FixTFMC::initial_integrate(int vflag) int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; - // in case we wish to track (and zero) the com movement + // in case we wish to track (and zero) the com movement if (comflag) { xcm_d[0] = 0.0; xcm_d[1] = 0.0; @@ -249,11 +249,11 @@ void FixTFMC::initial_integrate(int vflag) tagint *image = atom->image; group->xcm(igroup,masstotal,cm); - // to zero rotations, we can employ the same principles the - // velocity command uses to zero the angular momentum. of course, - // there is no (conserved) momentum in MC, but we can substitute + // to zero rotations, we can employ the same principles the + // velocity command uses to zero the angular momentum. of course, + // there is no (conserved) momentum in MC, but we can substitute // "velocities" by a displacement vector and proceed from there. - // this of course requires "forking" group->angmom(), which is + // this of course requires "forking" group->angmom(), which is // what we do here. double p[3]; diff --git a/src/MC/pair_dsmc.cpp b/src/MC/pair_dsmc.cpp index 444c49f25d021c015d6405234b8aeac71f66b29e..7aa0237a91ffea889079984f185de897567c2a81 100644 --- a/src/MC/pair_dsmc.cpp +++ b/src/MC/pair_dsmc.cpp @@ -15,10 +15,10 @@ Contributing authors: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_dsmc.h" #include "atom.h" #include "comm.h" @@ -28,7 +28,7 @@ #include "domain.h" #include "update.h" #include "random_mars.h" -#include "limits.h" +#include <limits.h> using namespace LAMMPS_NS; diff --git a/src/MEAM/pair_meam.cpp b/src/MEAM/pair_meam.cpp index f3fbe0a70d4350ad55a0a96003aecd53ba8e6c80..a350c66a96282718d4a3b63eae1f699cd53c62e5 100644 --- a/src/MEAM/pair_meam.cpp +++ b/src/MEAM/pair_meam.cpp @@ -15,10 +15,10 @@ Contributing author: Greg Wagner (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_meam.h" #include "atom.h" #include "force.h" @@ -730,7 +730,7 @@ void PairMEAM::read_files(char *globalfile, char *userfile) /* ---------------------------------------------------------------------- */ -int PairMEAM::pack_forward_comm(int n, int *list, double *buf, +int PairMEAM::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,k,m; diff --git a/src/MISC/compute_msd_nongauss.cpp b/src/MISC/compute_msd_nongauss.cpp index c5b22a4595029ce1553b9f674130d3d3ef51d486..4639fa7916c116ef0f4786819c716b0cf91474b3 100644 --- a/src/MISC/compute_msd_nongauss.cpp +++ b/src/MISC/compute_msd_nongauss.cpp @@ -15,7 +15,7 @@ Contributing authors: Rob Hoy ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_msd_nongauss.h" #include "atom.h" #include "update.h" diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp index f24cb1c9500e38980ee3a4b0d848da2e0b0477f3..02f16085057bd82c3dc29f0789907e3a586ab0ce 100644 --- a/src/MISC/compute_ti.cpp +++ b/src/MISC/compute_ti.cpp @@ -15,9 +15,9 @@ Contributing author: Sai Jayaraman (University of Notre Dame) ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "atom.h" -#include "string.h" +#include <string.h> #include "compute_ti.h" #include "update.h" #include "modify.h" @@ -42,7 +42,7 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : peflag = 1; peratom_flag = 1; - peatomflag = 1; + peatomflag = 1; scalar_flag = 1; extscalar = 1; timeflag = 1; @@ -166,7 +166,7 @@ double ComputeTI::compute_scalar() for (int m = 0; m < nterms; m++) { int total_flag = 0; - if ((ihi[m]-ilo[m])==atom->ntypes) total_flag = 1; + if ((ihi[m]-ilo[m])==atom->ntypes) total_flag = 1; eng = 0.0; value1 = input->variable->compute_equal(ivar1[m]); value2 = input->variable->compute_equal(ivar2[m]); @@ -176,26 +176,26 @@ double ComputeTI::compute_scalar() if (total_flag) { eng = pptr[m]->eng_vdwl + pptr[m]->eng_coul; MPI_Allreduce(&eng,&engall,1,MPI_DOUBLE,MPI_SUM,world); - } - else { + } + else { int npair = nlocal; double *eatom = pptr[m]->eatom; - + if (force->newton_pair) npair += atom->nghost; - for (int i = 0; i < npair; i++) - if ((ilo[m]<=type[i])&(ihi[m]>=type[i])) eng += eatom[i]; + for (int i = 0; i < npair; i++) + if ((ilo[m]<=type[i])&(ihi[m]>=type[i])) eng += eatom[i]; MPI_Allreduce(&eng,&engall,1,MPI_DOUBLE,MPI_SUM,world); } dUdl += engall/value1 * value2; - + } else if (which[m] == TAIL) { double vol = domain->xprd*domain->yprd*domain->zprd; - if (total_flag) + if (total_flag) eng = force->pair->etail / vol; else { - eng = 0; + eng = 0; for (int it = 1; it <= atom->ntypes; it++) { - int jt; + int jt; if ((it >= ilo[m])&&(it <=ihi[m])) jt = it; else jt = ilo[m]; for (; jt <=ihi[m];jt++) { @@ -203,28 +203,28 @@ double ComputeTI::compute_scalar() force->pair->init_one(it,jt); eng += force->pair->etail_ij; } - if (it !=jt) eng += force->pair->etail_ij; + if (it !=jt) eng += force->pair->etail_ij; } } - eng /= vol; + eng /= vol; } dUdl += eng/value1 * value2; - + } else if (which[m] == KSPACE) { - if (total_flag) + if (total_flag) eng = force->kspace->energy; - else { + else { double *eatom = force->kspace->eatom; for(int i = 0; i < nlocal; i++) - if ((ilo[m]<=type[i])&(ihi[m]>=type[i])) - eng += eatom[i]; + if ((ilo[m]<=type[i])&(ihi[m]>=type[i])) + eng += eatom[i]; MPI_Allreduce(&eng,&engall,1,MPI_DOUBLE,MPI_SUM,world); eng = engall; } dUdl += eng/value1 * value2; } } - + scalar = dUdl; return scalar; } diff --git a/src/MISC/compute_ti.h b/src/MISC/compute_ti.h index d6c054fd079a813be52a901013ca2d4d80506871..d1557a436e03ac0d402e3d16c5ac84c295b16d40 100644 --- a/src/MISC/compute_ti.h +++ b/src/MISC/compute_ti.h @@ -35,7 +35,7 @@ class ComputeTI : public Compute { int nterms; int *which; int *ivar1,*ivar2; - int *ilo, *ihi; + int *ilo, *ihi; char **var1,**var2; class Pair **pptr; char **pstyle; diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index 7aa3f72ce04e885349f777bbb04428b0454e75c9..bfac27fa52ebea745517437272ca4f0d2f9f90f3 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_deposit.h" #include "atom.h" #include "atom_vec.h" @@ -107,17 +107,17 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix deposit molecule must have coordinates"); if (onemols[i]->typeflag == 0) error->all(FLERR,"Fix deposit molecule must have atom types"); - if (ntype+onemols[i]->ntypes <= 0 || + if (ntype+onemols[i]->ntypes <= 0 || ntype+onemols[i]->ntypes > atom->ntypes) error->all(FLERR,"Invalid atom type in fix deposit mol command"); - + if (atom->molecular == 2 && onemols != atom->avec->onemols) error->all(FLERR,"Fix deposit molecule template ID must be same " "as atom_style template ID"); onemols[i]->check_attributes(0); // fix deposit uses geoemetric center of molecule for insertion - + onemols[i]->compute_center(); } } @@ -253,7 +253,7 @@ void FixDeposit::init() // for finite size spherical particles: // warn if near < 2 * maxrad of existing and inserted particles // since may lead to overlaps - // if inserted molecule does not define diameters, + // if inserted molecule does not define diameters, // use AtomVecSphere::create_atom() default radius = 0.5 if (atom->radius_flag) { @@ -482,7 +482,7 @@ void FixDeposit::pre_exchange() domain->x2lamda(coords[m],lamda); newcoord = lamda; } else newcoord = coords[m]; - + flag = 0; if (newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] && newcoord[1] >= sublo[1] && newcoord[1] < subhi[1] && @@ -496,7 +496,7 @@ void FixDeposit::pre_exchange() if (comm->mysplit[2][1] == 1.0 && newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] && newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) flag = 1; - } + } } else if (dimension == 2 && newcoord[1] >= domain->boxhi[1]) { if (comm->layout != LAYOUT_TILED) { if (comm->myloc[1] == comm->procgrid[1]-1 && @@ -524,7 +524,7 @@ void FixDeposit::pre_exchange() atom->v[n][0] = vnew[0]; atom->v[n][1] = vnew[1]; atom->v[n][2] = vnew[2]; - if (mode == MOLECULE) + if (mode == MOLECULE) atom->add_molecule_atom(onemols[imol],m,n,maxtag_all); modify->create_attribute(n); } @@ -668,9 +668,9 @@ void FixDeposit::options(int narg, char **arg) if (mode != MOLECULE) error->all(FLERR,"Illegal fix deposit command"); if (iarg+nmol+1 > narg) error->all(FLERR,"Illegal fix deposit command"); molfrac[0] = force->numeric(FLERR,arg[iarg+1]); - for (int i = 1; i < nmol; i++) + for (int i = 1; i < nmol; i++) molfrac[i] = molfrac[i-1] + force->numeric(FLERR,arg[iarg+i+1]); - if (molfrac[nmol-1] < 1.0-EPSILON || molfrac[nmol-1] > 1.0+EPSILON) + if (molfrac[nmol-1] < 1.0-EPSILON || molfrac[nmol-1] > 1.0+EPSILON) error->all(FLERR,"Illegal fix deposit command"); molfrac[nmol-1] = 1.0; iarg += nmol+1; @@ -711,13 +711,13 @@ void FixDeposit::options(int narg, char **arg) globalflag = 0; lo = force->numeric(FLERR,arg[iarg+1]); hi = force->numeric(FLERR,arg[iarg+2]); - deltasq = force->numeric(FLERR,arg[iarg+3]) * + deltasq = force->numeric(FLERR,arg[iarg+3]) * force->numeric(FLERR,arg[iarg+3]); iarg += 4; } else if (strcmp(arg[iarg],"near") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); - nearsq = force->numeric(FLERR,arg[iarg+1]) * + nearsq = force->numeric(FLERR,arg[iarg+1]) * force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"attempt") == 0) { diff --git a/src/MISC/fix_deposit.h b/src/MISC/fix_deposit.h index 81c555a660a270e735558622ab40e091a2d4c393..ea047bd518ecb0bae978f3c7d7d0aec917504b9c 100644 --- a/src/MISC/fix_deposit.h +++ b/src/MISC/fix_deposit.h @@ -20,7 +20,7 @@ FixStyle(deposit,FixDeposit) #ifndef LMP_FIX_DEPOSIT_H #define LMP_FIX_DEPOSIT_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index c472bf9f1607d3515f811fb99cf4069cbd22ac10..85ed926834119b409c7609feef660e1ea76f8a83 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,9 +16,9 @@ Stan Moore (Sandia) for dipole terms ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_efield.h" #include "atom.h" #include "update.h" @@ -149,14 +149,14 @@ void FixEfield::init() qflag = muflag = 0; if (atom->q_flag) qflag = 1; if (atom->mu_flag && atom->torque_flag) muflag = 1; - if (!qflag && !muflag) + if (!qflag && !muflag) error->all(FLERR,"Fix efield requires atom attribute q or mu"); // check variables if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) + if (xvar < 0) error->all(FLERR,"Variable name for fix efield does not exist"); if (input->variable->equalstyle(xvar)) xstyle = EQUAL; else if (input->variable->atomstyle(xvar)) xstyle = ATOM; @@ -164,7 +164,7 @@ void FixEfield::init() } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) + if (yvar < 0) error->all(FLERR,"Variable name for fix efield does not exist"); if (input->variable->equalstyle(yvar)) ystyle = EQUAL; else if (input->variable->atomstyle(yvar)) ystyle = ATOM; @@ -172,7 +172,7 @@ void FixEfield::init() } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) + if (zvar < 0) error->all(FLERR,"Variable name for fix efield does not exist"); if (input->variable->equalstyle(zvar)) zstyle = EQUAL; else if (input->variable->atomstyle(zvar)) zstyle = ATOM; @@ -180,7 +180,7 @@ void FixEfield::init() } if (estr) { evar = input->variable->find(estr); - if (evar < 0) + if (evar < 0) error->all(FLERR,"Variable name for fix efield does not exist"); if (input->variable->atomstyle(evar)) estyle = ATOM; else error->all(FLERR,"Variable for fix efield is invalid style"); @@ -295,7 +295,7 @@ void FixEfield::post_force(int vflag) f[i][0] += fx; f[i][1] += fy; f[i][2] += fz; - + domain->unmap(x[i],image[i],unwrap); fsum[0] -= fx*unwrap[0]+fy*unwrap[1]+fz*unwrap[2]; fsum[1] += fx; @@ -412,7 +412,7 @@ double FixEfield::memory_usage() double bytes = 0.0; if (varflag == ATOM) bytes = atom->nmax*4 * sizeof(double); return bytes; -} +} /* ---------------------------------------------------------------------- return energy added by fix diff --git a/src/MISC/fix_efield.h b/src/MISC/fix_efield.h index 48466b3250ea35e460469cef9333d076fc77847e..93272ba9bfcb3dc9ecde6c76142c4cdf3ff472a0 100644 --- a/src/MISC/fix_efield.h +++ b/src/MISC/fix_efield.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/MISC/fix_evaporate.cpp b/src/MISC/fix_evaporate.cpp index 8eca5c6015fa8e28795943f1bbfb5c6247546b89..873227449d7226979744d7d64be0a0de7297c46e 100644 --- a/src/MISC/fix_evaporate.cpp +++ b/src/MISC/fix_evaporate.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_evaporate.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/MISC/fix_gld.cpp b/src/MISC/fix_gld.cpp index 998d7f4ebe981239e5fdf3ee077c5973994b7bd5..0266d2501c49959e602ae6cb15d7d3b63f474f5b 100644 --- a/src/MISC/fix_gld.cpp +++ b/src/MISC/fix_gld.cpp @@ -12,13 +12,13 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: Stephen Bond (SNL) and - Andrew Baczewski (Michigan State/SNL) + Contributing authors: Stephen Bond (SNL) and + Andrew Baczewski (Michigan State/SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_gld.h" #include "math_extra.h" #include "atom.h" @@ -129,8 +129,8 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"zero") == 0) { - if (iarg+2 > narg) { - error->all(FLERR, "Illegal fix gld command"); + if (iarg+2 > narg) { + error->all(FLERR, "Illegal fix gld command"); } if (strcmp(arg[iarg+1],"no") == 0) { } else if (strcmp(arg[iarg+1],"yes") == 0) { @@ -139,11 +139,11 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix gld command"); } iarg += 2; - } + } else if (strcmp(arg[iarg],"frozen") == 0) { if (iarg+2 > narg) { error->all(FLERR, "Illegal fix gld command"); - } + } if (strcmp(arg[iarg+1],"no") == 0) { } else if (strcmp(arg[iarg+1],"yes") == 0) { freezeflag = 1; @@ -157,7 +157,7 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : } } } - } else { + } else { error->all(FLERR, "Illegal fix gld command"); } iarg += 2; @@ -233,7 +233,7 @@ void FixGLD::initial_integrate(int vflag) double *rmass = atom->rmass; double *mass = atom->mass; int *type = atom->type; - int *mask = atom->mask; + int *mask = atom->mask; int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; @@ -271,19 +271,19 @@ void FixGLD::initial_integrate(int vflag) double rmult = sqrt(2.0*kT*ck/dtv)*(1.-theta)/ftm2v; // random force -#ifdef GLD_GAUSSIAN_DISTRO +#ifdef GLD_GAUSSIAN_DISTRO fran[0] = rmult*random->gaussian(); - fran[1] = rmult*random->gaussian(); - fran[2] = rmult*random->gaussian(); -#endif - -#ifdef GLD_UNIFORM_DISTRO + fran[1] = rmult*random->gaussian(); + fran[2] = rmult*random->gaussian(); +#endif + +#ifdef GLD_UNIFORM_DISTRO rmult *= sqrt(12.0); // correct variance of uniform distribution fran[0] = rmult*(random->uniform() - 0.5); fran[1] = rmult*(random->uniform() - 0.5); fran[2] = rmult*(random->uniform() - 0.5); #endif - + // sum of random forces fsum[0] += fran[0]; fsum[1] += fran[1]; @@ -358,7 +358,7 @@ void FixGLD::initial_integrate(int vflag) s_gld[i][k] += fran[0]; s_gld[i][k+1] += fran[1]; s_gld[i][k+2] += fran[2]; - + icoeff += 1; } @@ -465,7 +465,7 @@ void FixGLD::final_integrate_respa(int ilevel, int iloop) /* ---------------------------------------------------------------------- Called when a change to the target temperature is requested mid-run -------------------------------------------------------------------------- */ +------------------------------------------------------------------------- */ void FixGLD::reset_target(double t_new) { @@ -486,10 +486,10 @@ void FixGLD::reset_dt() /* ---------------------------------------------------------------------- memory usage of local atom-based arrays ------------------------------------------------------------------------- */ - + double FixGLD::memory_usage() { - double bytes = atom->nmax*3*prony_terms*sizeof(double); + double bytes = atom->nmax*3*prony_terms*sizeof(double); return bytes; } @@ -542,8 +542,8 @@ int FixGLD::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- - Pack extended variables assoc. w/ atom i into buffer for - writing to a restart file + Pack extended variables assoc. w/ atom i into buffer for + writing to a restart file ------------------------------------------------------------------------- */ int FixGLD::pack_restart(int i, double *buf) @@ -582,7 +582,7 @@ void FixGLD::unpack_restart(int nlocal, int nth) } /* ---------------------------------------------------------------------- - Returns the number of items in atomic restart data associated with + Returns the number of items in atomic restart data associated with local atom nlocal. Used in determining the total extra data stored by fixes on a given processor. ------------------------------------------------------------------------- */ @@ -603,7 +603,7 @@ int FixGLD::maxsize_restart() } /* ---------------------------------------------------------------------- - Initializes the extended variables to equilibrium distribution + Initializes the extended variables to equilibrium distribution at t_start. ------------------------------------------------------------------------- */ diff --git a/src/MISC/fix_gld.h b/src/MISC/fix_gld.h index 7270da46344a14378638d44626f94bb0622afa89..abb328654436ee8bc2d2cdceacf155580ebfec2d 100644 --- a/src/MISC/fix_gld.h +++ b/src/MISC/fix_gld.h @@ -47,7 +47,7 @@ class FixGLD : public Fix { int size_restart(int); int maxsize_restart(); void init_s_gld(); - + protected: double dtv,dtf; double *step_respa; diff --git a/src/MISC/fix_oneway.cpp b/src/MISC/fix_oneway.cpp index 2f25b714b053935a0620629606a91826376272b0..758beed5536f273e331a2b814e2cc81b606d4593 100644 --- a/src/MISC/fix_oneway.cpp +++ b/src/MISC/fix_oneway.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (ICTP, Italy) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_oneway.h" #include "atom.h" #include "domain.h" diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index efcffdd1e566b3e2590c710801074fd81ddc584d..df41981f3d966a910ae560f9c260283f6bf31505 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -15,10 +15,10 @@ Contributing authors: Koenraad Janssens and David Olmsted (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" -#include "mpi.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> +#include <mpi.h> #include "fix_orient_fcc.h" #include "atom.h" #include "update.h" diff --git a/src/MISC/fix_thermal_conductivity.cpp b/src/MISC/fix_thermal_conductivity.cpp index ceec08a9212a722b2a45dfee5f6c7425a3c1f445..b465188fbbe795239fec3e11e927da61c46c9e05 100644 --- a/src/MISC/fix_thermal_conductivity.cpp +++ b/src/MISC/fix_thermal_conductivity.cpp @@ -16,10 +16,10 @@ for swapping atoms of different masses ------------------------------------------------------------------------- */ -#include "math.h" -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "fix_thermal_conductivity.h" #include "atom.h" #include "force.h" diff --git a/src/MISC/fix_ttm.cpp b/src/MISC/fix_ttm.cpp index f3e25d5ff0cf3406d4c82e85da6c849ec1ff0016..f5157139bacb525e5b3cb2fa16673c46adecf97d 100644 --- a/src/MISC/fix_ttm.cpp +++ b/src/MISC/fix_ttm.cpp @@ -16,10 +16,10 @@ Carolyn Phillips (University of Michigan) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_ttm.h" #include "atom.h" #include "force.h" diff --git a/src/MISC/fix_viscosity.cpp b/src/MISC/fix_viscosity.cpp index d875f8e9c84cfe0e0d2d2193fea9facca5c9d66f..2b8807c60528302c7db2f3c123bed47be0bc1ed3 100644 --- a/src/MISC/fix_viscosity.cpp +++ b/src/MISC/fix_viscosity.cpp @@ -16,10 +16,10 @@ for swapping atoms of different masses ------------------------------------------------------------------------- */ -#include "math.h" -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "fix_viscosity.h" #include "atom.h" #include "domain.h" @@ -73,7 +73,7 @@ FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"swap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix viscosity command"); nswap = force->inumeric(FLERR,arg[iarg+1]); - if (nswap <= 0) + if (nswap <= 0) error->all(FLERR,"Fix viscosity swap value must be positive"); iarg += 2; } else if (strcmp(arg[iarg],"vtarget") == 0) { diff --git a/src/MISC/pair_nm_cut.cpp b/src/MISC/pair_nm_cut.cpp index b8bbb57dfeb4ede108855f1228e5da8547599467..f0c9806fb8183722a0188e2bbb6028117ca9da9c 100644 --- a/src/MISC/pair_nm_cut.cpp +++ b/src/MISC/pair_nm_cut.cpp @@ -15,10 +15,10 @@ Contributing Author: Julien Devemy (ICCF) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_nm_cut.h" #include "atom.h" #include "comm.h" @@ -114,8 +114,8 @@ void PairNMCut::compute(int eflag, int vflag) rminv = pow(r2inv,mm[itype][jtype]/2.0); rninv = pow(r2inv,nn[itype][jtype]/2.0); - forcenm = e0nm[itype][jtype]*nm[itype][jtype] * - (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + forcenm = e0nm[itype][jtype]*nm[itype][jtype] * + (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - r0m[itype][jtype]/pow(r,mm[itype][jtype])); fpair = factor_lj*forcenm*r2inv; @@ -129,8 +129,8 @@ void PairNMCut::compute(int eflag, int vflag) } if (eflag) { - evdwl = e0nm[itype][jtype] * - (mm[itype][jtype]*r0n[itype][jtype]*rninv - + evdwl = e0nm[itype][jtype] * + (mm[itype][jtype]*r0n[itype][jtype]*rninv - nn[itype][jtype]*r0m[itype][jtype]*rminv) - offset[itype][jtype]; evdwl *= factor_lj; } @@ -241,11 +241,11 @@ double PairNMCut::init_one(int i, int j) nm[i][j] = nn[i][j]*mm[i][j]; e0nm[i][j] = e0[i][j]/(nn[i][j]-mm[i][j]); r0n[i][j] = pow(r0[i][j],nn[i][j]); - r0m[i][j] = pow(r0[i][j],mm[i][j]); + r0m[i][j] = pow(r0[i][j],mm[i][j]); if (offset_flag) { - offset[i][j] = e0nm[i][j] * - ((mm[i][j]*r0n[i][j] / pow(cut[i][j],nn[i][j])) - + offset[i][j] = e0nm[i][j] * + ((mm[i][j]*r0n[i][j] / pow(cut[i][j],nn[i][j])) - (nn[i][j]*r0m[i][j] / pow(cut[i][j],mm[i][j]))); } else offset[i][j] = 0.0; @@ -282,9 +282,9 @@ double PairNMCut::init_one(int i, int j) double rrr1 = pow(r0[i][j],nn[i][j])*(1-nn[i][j]); double rrr2 = pow(r0[i][j],mm[i][j])*(1-mm[i][j]); - etail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * + etail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * (rr1*pow(cut[i][j],p1)-rr2*pow(cut[i][j],p2)); - ptail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * + ptail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * nn[i][j]*mm[i][j]*(rrr1*pow(cut[i][j],p1)-rrr2*pow(cut[i][j],p2)); } @@ -408,14 +408,14 @@ double PairNMCut::single(int i, int j, int itype, int jtype, r2inv = 1.0/rsq; r = sqrt(rsq); - forcenm = e0nm[itype][jtype]*nm[itype][jtype] * - (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + forcenm = e0nm[itype][jtype]*nm[itype][jtype] * + (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - r0m[itype][jtype]/pow(r,mm[itype][jtype])); fforce = factor_lj*forcenm*r2inv; - phinm = e0nm[itype][jtype] * - (mm[itype][jtype] * r0n[itype][jtype]/pow(r,nn[itype][jtype]) - - nn[itype][jtype]*r0m[itype][jtype] /pow(r,mm[itype][jtype])) - + phinm = e0nm[itype][jtype] * + (mm[itype][jtype] * r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + nn[itype][jtype]*r0m[itype][jtype] /pow(r,mm[itype][jtype])) - offset[itype][jtype]; return factor_lj*phinm; } diff --git a/src/MISC/pair_nm_cut_coul_cut.cpp b/src/MISC/pair_nm_cut_coul_cut.cpp index 33bddb522363d31d9b7ef9328e5f8eebb765ea03..61326ee1eb1d3f947414edba1929eb889774ebfc 100644 --- a/src/MISC/pair_nm_cut_coul_cut.cpp +++ b/src/MISC/pair_nm_cut_coul_cut.cpp @@ -15,10 +15,10 @@ Contributing Author: Julien Devemy (ICCF) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_nm_cut_coul_cut.h" #include "atom.h" #include "comm.h" @@ -126,8 +126,8 @@ void PairNMCutCoulCut::compute(int eflag, int vflag) r = sqrt(rsq); rminv = pow(r2inv,mm[itype][jtype]/2.0); rninv = pow(r2inv,nn[itype][jtype]/2.0); - forcenm = e0nm[itype][jtype]*nm[itype][jtype] * - (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + forcenm = e0nm[itype][jtype]*nm[itype][jtype] * + (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - r0m[itype][jtype]/pow(r,mm[itype][jtype])); } else forcenm = 0.0; @@ -147,10 +147,10 @@ void PairNMCutCoulCut::compute(int eflag, int vflag) ecoul = factor_coul * qqrd2e * qtmp*q[j]*sqrt(r2inv); else ecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - evdwl = e0nm[itype][jtype]*(mm[itype][jtype] * - r0n[itype][jtype]*rninv - - nn[itype][jtype] * - r0m[itype][jtype]*rminv) - + evdwl = e0nm[itype][jtype]*(mm[itype][jtype] * + r0n[itype][jtype]*rninv - + nn[itype][jtype] * + r0m[itype][jtype]*rminv) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; @@ -289,11 +289,11 @@ double PairNMCutCoulCut::init_one(int i, int j) nm[i][j] = nn[i][j]*mm[i][j]; e0nm[i][j] = e0[i][j]/(nn[i][j]-mm[i][j]); r0n[i][j] = pow(r0[i][j],nn[i][j]); - r0m[i][j] = pow(r0[i][j],mm[i][j]); + r0m[i][j] = pow(r0[i][j],mm[i][j]); if (offset_flag) { offset[i][j] = e0nm[i][j] * - ((mm[i][j]*r0n[i][j] / pow(cut_lj[i][j],nn[i][j])) - + ((mm[i][j]*r0n[i][j] / pow(cut_lj[i][j],nn[i][j])) - (nn[i][j]*r0m[i][j] / pow(cut_lj[i][j],mm[i][j]))); } else offset[i][j] = 0.0; @@ -332,9 +332,9 @@ double PairNMCutCoulCut::init_one(int i, int j) double rrr1 = pow(r0[i][j],nn[i][j])*(1-nn[i][j]); double rrr2 = pow(r0[i][j],mm[i][j])*(1-mm[i][j]); - etail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * + etail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * (rr1*pow(cut_lj[i][j],p1)-rr2*pow(cut_lj[i][j],p2)); - ptail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * + ptail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * nn[i][j]*mm[i][j]*(rrr1*pow(cut_lj[i][j],p1)-rrr2*pow(cut_lj[i][j],p2)); } @@ -469,8 +469,8 @@ double PairNMCutCoulCut::single(int i, int j, int itype, int jtype, else forcecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { r = sqrt(rsq); - forcenm = e0nm[itype][jtype]*nm[itype][jtype] * - (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + forcenm = e0nm[itype][jtype]*nm[itype][jtype] * + (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - r0m[itype][jtype]/pow(r,mm[itype][jtype])); } else forcenm = 0.0; fforce = (factor_coul*forcecoul + factor_lj*forcenm) * r2inv; @@ -481,8 +481,8 @@ double PairNMCutCoulCut::single(int i, int j, int itype, int jtype, eng += factor_coul*phicoul; } if (rsq < cut_ljsq[itype][jtype]) { - phinm = e0nm[itype][jtype] * - (mm[itype][jtype]*r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + phinm = e0nm[itype][jtype] * + (mm[itype][jtype]*r0n[itype][jtype]/pow(r,nn[itype][jtype]) - nn[itype][jtype]*r0m[itype][jtype]/pow(r,mm[itype][jtype])) - offset[itype][jtype]; eng += factor_lj*phinm; diff --git a/src/MISC/pair_nm_cut_coul_long.cpp b/src/MISC/pair_nm_cut_coul_long.cpp index b613b584c20007b1b735e7d8185e5296fd29e5f2..0cd12ac0358d08db8b55ad25a9e62c500b3307ec 100644 --- a/src/MISC/pair_nm_cut_coul_long.cpp +++ b/src/MISC/pair_nm_cut_coul_long.cpp @@ -15,10 +15,10 @@ Contributing Author: Julien Devemy (ICCF) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_nm_cut_coul_long.h" #include "atom.h" #include "comm.h" @@ -165,8 +165,8 @@ void PairNMCutCoulLong::compute(int eflag, int vflag) r = sqrt(rsq); rminv = pow(r2inv,mm[itype][jtype]/2.0); rninv = pow(r2inv,nn[itype][jtype]/2.0); - forcenm = e0nm[itype][jtype]*nm[itype][jtype] * - (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + forcenm = e0nm[itype][jtype]*nm[itype][jtype] * + (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - r0m[itype][jtype]/pow(r,mm[itype][jtype])); } else forcenm = 0.0; @@ -193,8 +193,8 @@ void PairNMCutCoulLong::compute(int eflag, int vflag) } else ecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - evdwl = e0nm[itype][jtype] * - (mm[itype][jtype]*r0n[itype][jtype]*rninv - + evdwl = e0nm[itype][jtype] * + (mm[itype][jtype]*r0n[itype][jtype]*rninv - nn[itype][jtype]*r0m[itype][jtype]*rminv) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; @@ -337,11 +337,11 @@ double PairNMCutCoulLong::init_one(int i, int j) nm[i][j] = nn[i][j]*mm[i][j]; e0nm[i][j] = e0[i][j]/(nn[i][j]-mm[i][j]); r0n[i][j] = pow(r0[i][j],nn[i][j]); - r0m[i][j] = pow(r0[i][j],mm[i][j]); + r0m[i][j] = pow(r0[i][j],mm[i][j]); if (offset_flag) { - offset[i][j] = e0nm[i][j] * - ((mm[i][j]*r0n[i][j] / pow(cut_lj[i][j],nn[i][j])) - + offset[i][j] = e0nm[i][j] * + ((mm[i][j]*r0n[i][j] / pow(cut_lj[i][j],nn[i][j])) - (nn[i][j]*r0m[i][j] / pow(cut_lj[i][j],mm[i][j]))); } else offset[i][j] = 0.0; @@ -381,7 +381,7 @@ double PairNMCutCoulLong::init_one(int i, int j) etail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j] * (rr1*pow(cut_lj[i][j],p1)-rr2*pow(cut_lj[i][j],p2)); - ptail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j]*nn[i][j]*mm[i][j] * + ptail_ij = 2.0*MY_PI*all[0]*all[1]*e0nm[i][j]*nn[i][j]*mm[i][j] * (rrr1*pow(cut_lj[i][j],p1)-rrr2*pow(cut_lj[i][j],p2)); } @@ -545,8 +545,8 @@ double PairNMCutCoulLong::single(int i, int j, int itype, int jtype, if (rsq < cut_ljsq[itype][jtype]) { r = sqrt(rsq); - forcenm = e0nm[itype][jtype]*nm[itype][jtype] * - (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + forcenm = e0nm[itype][jtype]*nm[itype][jtype] * + (r0n[itype][jtype]/pow(r,nn[itype][jtype]) - r0m[itype][jtype]/pow(r,mm[itype][jtype])); } else forcenm = 0.0; @@ -565,8 +565,8 @@ double PairNMCutCoulLong::single(int i, int j, int itype, int jtype, } if (rsq < cut_ljsq[itype][jtype]) { - phinm = e0nm[itype][jtype] * - (mm[itype][jtype]*r0n[itype][jtype]/pow(r,nn[itype][jtype]) - + phinm = e0nm[itype][jtype] * + (mm[itype][jtype]*r0n[itype][jtype]/pow(r,nn[itype][jtype]) - nn[itype][jtype]*r0m[itype][jtype]/pow(r,mm[itype][jtype])) - offset[itype][jtype]; eng += factor_lj*phinm; diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 228ea1c601cafea24072f1062f45c0e9398ffebc..c2d44b26dde801fbf23be044c62dd2beeb5b1f7f 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -15,8 +15,8 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_charmm.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/angle_charmm.h b/src/MOLECULE/angle_charmm.h index 738ec69e113d7e5008c7ed4e27ede1fe416e0df7..fa27866be38750ae04cf08ddaab0d6fed5ab479e 100644 --- a/src/MOLECULE/angle_charmm.h +++ b/src/MOLECULE/angle_charmm.h @@ -20,7 +20,7 @@ AngleStyle(charmm,AngleCharmm) #ifndef LMP_ANGLE_CHARMM_H #define LMP_ANGLE_CHARMM_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index f43c7bc6e94c44f25ee4bd51864a829cc76b8652..135d4bbf8f103edbb936ef4c2eb099f90c52daa0 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_cosine.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/angle_cosine.h b/src/MOLECULE/angle_cosine.h index 7e06aa150f5946a93ba54af86272919cf149f37a..a6581f11bde0bd01e2c5459000df9495c146a9da 100644 --- a/src/MOLECULE/angle_cosine.h +++ b/src/MOLECULE/angle_cosine.h @@ -20,7 +20,7 @@ AngleStyle(cosine,AngleCosine) #ifndef LMP_ANGLE_COSINE_H #define LMP_ANGLE_COSINE_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/angle_cosine_delta.cpp b/src/MOLECULE/angle_cosine_delta.cpp index 08124142e57799fbb9772707b6070dd57579b73b..fe482eb3ebef6fe18160c602c143ed3712747700 100644 --- a/src/MOLECULE/angle_cosine_delta.cpp +++ b/src/MOLECULE/angle_cosine_delta.cpp @@ -15,8 +15,8 @@ Contributing author: Axel Kohlmeyer (Temple U), akohlmey at gmail.com ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_cosine_delta.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/angle_cosine_delta.h b/src/MOLECULE/angle_cosine_delta.h index 70fdf315eecf0c2ffecdb2a76f5e70dae147a7f6..b29064e35eadbcb2d4fd6ad8efc6b4994fef5995 100644 --- a/src/MOLECULE/angle_cosine_delta.h +++ b/src/MOLECULE/angle_cosine_delta.h @@ -20,7 +20,7 @@ AngleStyle(cosine/delta,AngleCosineDelta) #ifndef LMP_ANGLE_COSINE_DELTA_H #define LMP_ANGLE_COSINE_DELTA_H -#include "stdio.h" +#include <stdio.h> #include "angle_cosine_squared.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index 8198f3d4b4dab6953e147b670622dfd34bc282d8..dbd93b3b7b2da57486766f1fb4353f793f108481 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -15,8 +15,8 @@ Contributing author: Tod A Pascal (Caltech) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_cosine_periodic.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/angle_cosine_periodic.h b/src/MOLECULE/angle_cosine_periodic.h index f9485539f06f2335efcc3368844518ed97faa85e..9b7f06227241f929095e0b00f153c413f98e05e3 100644 --- a/src/MOLECULE/angle_cosine_periodic.h +++ b/src/MOLECULE/angle_cosine_periodic.h @@ -20,7 +20,7 @@ AngleStyle(cosine/periodic, AngleCosinePeriodic) #ifndef LMP_ANGLE_PERIODIC_H #define LMP_ANGLE_PERIODIC_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 578d641de3a1e9deab38f1bb4ec00d239422a445..6d073f156eb1035d7f3bf1bd3456160e257e7c21 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -15,8 +15,8 @@ Contributing author: Naveen Michaud-Agrawal (Johns Hopkins U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_cosine_squared.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/angle_cosine_squared.h b/src/MOLECULE/angle_cosine_squared.h index a9f6572c47ffea585348ad3812618df23dfd646a..b9f79f923fb794e5c4c0842c2da44023d9db18ec 100644 --- a/src/MOLECULE/angle_cosine_squared.h +++ b/src/MOLECULE/angle_cosine_squared.h @@ -20,7 +20,7 @@ AngleStyle(cosine/squared,AngleCosineSquared) #ifndef LMP_ANGLE_COSINE_SQUARED_H #define LMP_ANGLE_COSINE_SQUARED_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index 4fdf42ed49c8b9667731c5a75bf03e7ca7757dc2..cffc3182ddf8e20374ea3649c4d634a8b7fa0fbf 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_harmonic.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/angle_harmonic.h b/src/MOLECULE/angle_harmonic.h index 0731980f440e1c6bb5fac4c042407c1c72a03a36..177e7cbadb7b404167bbdf91484a342c8ae6c211 100644 --- a/src/MOLECULE/angle_harmonic.h +++ b/src/MOLECULE/angle_harmonic.h @@ -20,7 +20,7 @@ AngleStyle(harmonic,AngleHarmonic) #ifndef LMP_ANGLE_HARMONIC_H #define LMP_ANGLE_HARMONIC_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index cf8b62cc9b75d2164d02e862cf4e1194597aec1c..9dd9925725f0540503554d8cef23051b9c6df3b4 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -15,9 +15,9 @@ Contributing author: Chuanfu Luo (luochuanfu@gmail.com) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "angle_table.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/angle_table.h b/src/MOLECULE/angle_table.h index 99f547052e9bc742c95d65430e6b44d1b93610e4..cb04aa61253657b4a30bf53d7b8ddb5e07673cd9 100644 --- a/src/MOLECULE/angle_table.h +++ b/src/MOLECULE/angle_table.h @@ -20,7 +20,7 @@ AngleStyle(table,AngleTable) #ifndef LMP_ANGLE_TABLE_H #define LMP_ANGLE_TABLE_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/atom_vec_angle.cpp b/src/MOLECULE/atom_vec_angle.cpp index 8241c693aabf349fe437ca09f6174fbb3c6b6d81..7053f0eb30b7b1976282bf16f49f5c87d0ae35a5 100644 --- a/src/MOLECULE/atom_vec_angle.cpp +++ b/src/MOLECULE/atom_vec_angle.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_angle.h" #include "atom.h" #include "comm.h" @@ -865,7 +865,7 @@ int AtomVecAngle::pack_data_hybrid(int i, double *buf) void AtomVecAngle::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT " " TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " " TAGINT_FORMAT " %d %-1.16e %-1.16e %-1.16e %d %d %d\n", (tagint) ubuf(buf[i][0]).i,(tagint) ubuf(buf[i][1]).i, (int) ubuf(buf[i][2]).i, diff --git a/src/MOLECULE/atom_vec_bond.cpp b/src/MOLECULE/atom_vec_bond.cpp index f53c71736e1ea456c9fefb30c3aa01aa62e17bae..bae924c28add23da39dc550f7c3ea1427607e1b6 100644 --- a/src/MOLECULE/atom_vec_bond.cpp +++ b/src/MOLECULE/atom_vec_bond.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_bond.h" #include "atom.h" #include "comm.h" diff --git a/src/MOLECULE/atom_vec_full.cpp b/src/MOLECULE/atom_vec_full.cpp index 006917ce493c845b67b5288147da6e75239f9f27..ba85a1280b46545963ab5f700508ae433cd38621 100644 --- a/src/MOLECULE/atom_vec_full.cpp +++ b/src/MOLECULE/atom_vec_full.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_full.h" #include "atom.h" #include "comm.h" diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index 3e347af5c984d43068dcc1a051a993f1cd4b8b28..23786d7641a7464f63ddd93a910fa110fc50ee5a 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_molecular.h" #include "atom.h" #include "comm.h" @@ -918,7 +918,7 @@ void AtomVecMolecular::create_atom(int itype, double *coord) initialize other atom quantities ------------------------------------------------------------------------- */ -void AtomVecMolecular::data_atom(double *coord, imageint imagetmp, +void AtomVecMolecular::data_atom(double *coord, imageint imagetmp, char **values) { int nlocal = atom->nlocal; @@ -1002,7 +1002,7 @@ int AtomVecMolecular::pack_data_hybrid(int i, double *buf) void AtomVecMolecular::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT " " TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " " TAGINT_FORMAT " %d %-1.16e %-1.16e %-1.16e %d %d %d\n", (tagint) ubuf(buf[i][0]).i,(tagint) ubuf(buf[i][1]).i, (int) ubuf(buf[i][2]).i, diff --git a/src/MOLECULE/atom_vec_template.cpp b/src/MOLECULE/atom_vec_template.cpp index 546b44282564fc46a4549e2e08d293f8fe6e672b..5d3b0a326492fe1ca1aef37be2d20b2e2a762c1a 100644 --- a/src/MOLECULE/atom_vec_template.cpp +++ b/src/MOLECULE/atom_vec_template.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "atom_vec_template.h" #include "atom.h" #include "molecule.h" @@ -750,7 +750,7 @@ void AtomVecTemplate::data_atom(double *coord, imageint imagetmp, char **values) if (molindex[nlocal] < 0 || molindex[nlocal] >= nset) error->one(FLERR,"Invalid template index in Atoms section of data file"); - if (molatom[nlocal] < 0 || + if (molatom[nlocal] < 0 || molatom[nlocal] >= onemols[molindex[nlocal]]->natoms) error->one(FLERR,"Invalid template atom in Atoms section of data file"); @@ -826,7 +826,7 @@ int AtomVecTemplate::pack_data_hybrid(int i, double *buf) void AtomVecTemplate::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT " " TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " " TAGINT_FORMAT " %d %d %d %-1.16e %-1.16e %-1.16e %d %d %d\n", (tagint) ubuf(buf[i][0]).i,(tagint) ubuf(buf[i][1]).i, (int) ubuf(buf[i][2]).i,(int) ubuf(buf[i][3]).i, diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index e72fbaa40abf5e24f9ea453d4d4eeffff398c244..66c5c08174f42c69c7ad7cc2ec18c0194046da5b 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_fene.h" #include "atom.h" #include "neighbor.h" @@ -85,7 +85,7 @@ void BondFENE::compute(int eflag, int vflag) if (rlogarg < 0.1) { char str[128]; - sprintf(str,"FENE bond too long: " BIGINT_FORMAT " " + sprintf(str,"FENE bond too long: " BIGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " %g", update->ntimestep,atom->tag[i1],atom->tag[i2],sqrt(rsq)); error->warning(FLERR,str,0); @@ -242,7 +242,7 @@ void BondFENE::write_data(FILE *fp) /* ---------------------------------------------------------------------- */ -double BondFENE::single(int type, double rsq, int i, int j, +double BondFENE::single(int type, double rsq, int i, int j, double &fforce) { double r0sq = r0[type] * r0[type]; diff --git a/src/MOLECULE/bond_fene.h b/src/MOLECULE/bond_fene.h index 3ad7fa95fa98a12f19a1815bad9ee70e42d26137..6124478567e8bfd550c1a90af645b800a2572660 100644 --- a/src/MOLECULE/bond_fene.h +++ b/src/MOLECULE/bond_fene.h @@ -20,7 +20,7 @@ BondStyle(fene,BondFENE) #ifndef LMP_BOND_FENE_H #define LMP_BOND_FENE_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index 6f616b98dd355ae2025ff22193c9f11932fb162b..f65632cc3f3400df7555ab1c9aa8838a8ddc432c 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_fene_expand.h" #include "atom.h" #include "neighbor.h" @@ -90,7 +90,7 @@ void BondFENEExpand::compute(int eflag, int vflag) if (rlogarg < 0.1) { char str[128]; - sprintf(str,"FENE bond too long: " BIGINT_FORMAT " " + sprintf(str,"FENE bond too long: " BIGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " %g", update->ntimestep,atom->tag[i1],atom->tag[i2],sqrt(rsq)); error->warning(FLERR,str,0); diff --git a/src/MOLECULE/bond_fene_expand.h b/src/MOLECULE/bond_fene_expand.h index 0d2f535cb807de71724c80bf479b2e860d06c54d..1971c6f428037558dace9aa741f85dcc0ad06d89 100644 --- a/src/MOLECULE/bond_fene_expand.h +++ b/src/MOLECULE/bond_fene_expand.h @@ -20,7 +20,7 @@ BondStyle(fene/expand,BondFENEExpand) #ifndef LMP_BOND_FENE_EXPAND_H #define LMP_BOND_FENE_EXPAND_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index 573e610238941cdca53f20abfc86ed68952288ef..8c5663bf79c1a97f70c857568979b6dbd1ff8572 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_harmonic.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/bond_harmonic.h b/src/MOLECULE/bond_harmonic.h index 4c723528952e7b3df2aa88527aa7ca125d2b53a4..7c7125b04ce233b5543b552ceb65b89ffea146f9 100644 --- a/src/MOLECULE/bond_harmonic.h +++ b/src/MOLECULE/bond_harmonic.h @@ -20,7 +20,7 @@ BondStyle(harmonic,BondHarmonic) #ifndef LMP_BOND_HARMONIC_H #define LMP_BOND_HARMONIC_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index 03af2dd1c6a434ea3c01ad7d82731246923e2ee8..da2717899a670b60f206d8809585c40c84da011b 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -15,8 +15,8 @@ Contributing author: Jeff Greathouse (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_morse.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/bond_morse.h b/src/MOLECULE/bond_morse.h index f19b05f5dfa2aa765f6f76fecb4a0389cad44a6b..74379c91ee766b50996ad32d97219bfbb7d31ecd 100644 --- a/src/MOLECULE/bond_morse.h +++ b/src/MOLECULE/bond_morse.h @@ -20,7 +20,7 @@ BondStyle(morse,BondMorse) #ifndef LMP_BOND_MORSE_H #define LMP_BOND_MORSE_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/bond_nonlinear.cpp b/src/MOLECULE/bond_nonlinear.cpp index 0ed5f0f4e8bd32c2efcc63db41cec77f97cd540f..9da2993c54b3b048cd2de44595e05429ad03dd0d 100644 --- a/src/MOLECULE/bond_nonlinear.cpp +++ b/src/MOLECULE/bond_nonlinear.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_nonlinear.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/bond_nonlinear.h b/src/MOLECULE/bond_nonlinear.h index c7c7c27b22846259d9a9b3b25fd814680fdf3002..5d2448b112b45d24229f5e1768911fe211b82f18 100644 --- a/src/MOLECULE/bond_nonlinear.h +++ b/src/MOLECULE/bond_nonlinear.h @@ -20,7 +20,7 @@ BondStyle(nonlinear,BondNonlinear) #ifndef LMP_BOND_NONLINEAR_H #define LMP_BOND_NONLINEAR_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index 84a82c9bb4f4b37a471acedbe4b550a182c9b372..c92048b2ca354349adb4690516514fb17a5fbcc1 100755 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -15,8 +15,8 @@ Contributing authors: Chris Lorenz and Mark Stevens (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_quartic.h" #include "atom.h" #include "neighbor.h" @@ -236,7 +236,7 @@ void BondQuartic::init_style() if (force->angle || force->dihedral || force->improper) error->all(FLERR, "Bond style quartic cannot be used with 3,4-body interactions"); - if (atom->molecular == 2) + if (atom->molecular == 2) error->all(FLERR, "Bond style quartic cannot be used with atom style template"); diff --git a/src/MOLECULE/bond_quartic.h b/src/MOLECULE/bond_quartic.h index 9788626f1378dae85578eb911d0cda396313bb4a..21bd7f00b4055a92e407fb0e4429b9de778f2e26 100644 --- a/src/MOLECULE/bond_quartic.h +++ b/src/MOLECULE/bond_quartic.h @@ -20,7 +20,7 @@ BondStyle(quartic,BondQuartic) #ifndef LMP_BOND_QUARTIC_H #define LMP_BOND_QUARTIC_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 99d0bb2ab5c17bd0f2aceab5e1dc23855b0d6e09..fc42faeeeae97d50c0d194cde8efe97fb3e7eba4 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -15,9 +15,9 @@ Contributing author: Chuanfu Luo (luochuanfu@gmail.com) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "bond_table.h" #include "atom.h" #include "neighbor.h" diff --git a/src/MOLECULE/bond_table.h b/src/MOLECULE/bond_table.h index 91d78461d1d929154acdcf953eb96f86c579ac66..8b84b1b66d6540abb9115dd72252ee36b74985e5 100644 --- a/src/MOLECULE/bond_table.h +++ b/src/MOLECULE/bond_table.h @@ -20,7 +20,7 @@ BondStyle(table,BondTable) #ifndef LMP_BOND_TABLE_H #define LMP_BOND_TABLE_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 5e8fef6442f54f0ab5f540280a5d27085b33fd7e..8b6909f1ad3df52c3f6ce18a61f9280ced338771 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -15,9 +15,9 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "dihedral_charmm.h" #include "atom.h" #include "comm.h" @@ -149,8 +149,8 @@ void DihedralCharmm::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/MOLECULE/dihedral_charmm.h b/src/MOLECULE/dihedral_charmm.h index 6ebb4f977a354f3fe2db6c6ccb6bb56d73345bf8..411646990494726c07a10c6c364d6bf8c83ec05d 100644 --- a/src/MOLECULE/dihedral_charmm.h +++ b/src/MOLECULE/dihedral_charmm.h @@ -20,7 +20,7 @@ DihedralStyle(charmm,DihedralCharmm) #ifndef LMP_DIHEDRAL_CHARMM_H #define LMP_DIHEDRAL_CHARMM_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index 865500cfdc0e4c5c431a781b34b896cfdc511f64..f9ea31ac7cfcb521064151eec30444abfa7f3ca2 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -15,9 +15,9 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "dihedral_harmonic.h" #include "atom.h" #include "comm.h" @@ -136,8 +136,8 @@ void DihedralHarmonic::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/MOLECULE/dihedral_harmonic.h b/src/MOLECULE/dihedral_harmonic.h index 40ebdf26a0e163d00cfeeb14501922bd2f531e16..db8789675d8c87f3e076ed9284d6c8cea69025ce 100644 --- a/src/MOLECULE/dihedral_harmonic.h +++ b/src/MOLECULE/dihedral_harmonic.h @@ -20,7 +20,7 @@ DihedralStyle(harmonic,DihedralHarmonic) #ifndef LMP_DIHEDRAL_HARMONIC_H #define LMP_DIHEDRAL_HARMONIC_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index f6fb9f32983c4a9069ce8dc3fd33d09c8d550db8..b0565e29fb090fc57f54fba7cc9af2e107a9a278 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -16,9 +16,9 @@ Mark Stevens (Sandia) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "dihedral_helix.h" #include "atom.h" #include "neighbor.h" @@ -164,8 +164,8 @@ void DihedralHelix::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/MOLECULE/dihedral_helix.h b/src/MOLECULE/dihedral_helix.h index c9cd014c56a816cf218350f3d539ed0dd65df211..61aef1d2ecadeb27b892797b774847650ccb6e06 100644 --- a/src/MOLECULE/dihedral_helix.h +++ b/src/MOLECULE/dihedral_helix.h @@ -20,7 +20,7 @@ DihedralStyle(helix,DihedralHelix) #ifndef LMP_DIHEDRAL_HELIX_H #define LMP_DIHEDRAL_HELIX_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index 48f4f2b45fcb32785ccf279b8933d36c7f98c957..0842595fba01c500aeb8ea9e308b22ed1e640c24 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -15,8 +15,8 @@ Contributing author: Mathias Puetz (SNL) and friends ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "dihedral_multi_harmonic.h" #include "atom.h" #include "neighbor.h" @@ -155,8 +155,8 @@ void DihedralMultiHarmonic::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/MOLECULE/dihedral_multi_harmonic.h b/src/MOLECULE/dihedral_multi_harmonic.h index b77f85ddfff6f7f1cb6a26ecf0c0457523983935..8f40b56a5ffb80ae428c8f059246173abb4b9d66 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.h +++ b/src/MOLECULE/dihedral_multi_harmonic.h @@ -20,7 +20,7 @@ DihedralStyle(multi/harmonic,DihedralMultiHarmonic) #ifndef LMP_DIHEDRAL_MULTI_HARMONIC_H #define LMP_DIHEDRAL_MULTI_HARMONIC_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index b85f0d36f7d9fefdef5d001874359969b7a39167..609fac74bdd21c05d2e2b179eb9fecb6f0327b55 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -15,8 +15,8 @@ Contributing author: Mark Stevens (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "dihedral_opls.h" #include "atom.h" #include "comm.h" @@ -164,8 +164,8 @@ void DihedralOPLS::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/MOLECULE/dihedral_opls.h b/src/MOLECULE/dihedral_opls.h index 106dbe2431779a6b80c0301ff623f3fc4e93a7f1..0a127d3ac178ebffb97a616dc64acb19abea91df 100644 --- a/src/MOLECULE/dihedral_opls.h +++ b/src/MOLECULE/dihedral_opls.h @@ -20,7 +20,7 @@ DihedralStyle(opls,DihedralOPLS) #ifndef LMP_DIHEDRAL_OPLS_H #define LMP_DIHEDRAL_OPLS_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index fde5738c5150a760406c831fe768dfdc40f0f385..28b3612c7838ca497356b5cab562f2d4dc24f445 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "improper_cvff.h" #include "atom.h" #include "comm.h" @@ -150,8 +150,8 @@ void ImproperCvff::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/MOLECULE/improper_cvff.h b/src/MOLECULE/improper_cvff.h index 7717fe7b64f37117323c977774b5e93eff92359d..8e997e3ff4a5f8caf9f1ca75ed1661055f4ed9fc 100644 --- a/src/MOLECULE/improper_cvff.h +++ b/src/MOLECULE/improper_cvff.h @@ -20,7 +20,7 @@ ImproperStyle(cvff,ImproperCvff) #ifndef LMP_IMPROPER_CVFF_H #define LMP_IMPROPER_CVFF_H -#include "stdio.h" +#include <stdio.h> #include "improper.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index c11601347b3c1c4688fca01399428d7a2d86ccc7..56ddce6f5bc772b1fc99a28f547441f22a8ea69d 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "improper_harmonic.h" #include "atom.h" #include "comm.h" @@ -124,8 +124,8 @@ void ImproperHarmonic::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/MOLECULE/improper_harmonic.h b/src/MOLECULE/improper_harmonic.h index c4c606b5579fbc08afd31ba44a9d1b9cd874989a..b5132ab7ffc636f6f0f0d411ab0a951ebd4c048c 100644 --- a/src/MOLECULE/improper_harmonic.h +++ b/src/MOLECULE/improper_harmonic.h @@ -20,7 +20,7 @@ ImproperStyle(harmonic,ImproperHarmonic) #ifndef LMP_IMPROPER_HARMONIC_H #define LMP_IMPROPER_HARMONIC_H -#include "stdio.h" +#include <stdio.h> #include "improper.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 28b3fe8924fbf6b9d40e3ddc67d908d619d230d4..14551e6c5c4f191b6b7964602f5f6e57e27ffe5e 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -15,9 +15,9 @@ Contributing author: Tod A Pascal (Caltech) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "improper_umbrella.h" #include "atom.h" #include "comm.h" @@ -128,8 +128,8 @@ void ImproperUmbrella::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/MOLECULE/improper_umbrella.h b/src/MOLECULE/improper_umbrella.h index 110330374705f049eb18cb6f44c7793b620ef13a..f590a63c3277f7e2b4fe63988e0c06391eabb9bc 100644 --- a/src/MOLECULE/improper_umbrella.h +++ b/src/MOLECULE/improper_umbrella.h @@ -20,7 +20,7 @@ ImproperStyle(umbrella,ImproperUmbrella) #ifndef LMP_IMPROPER_UMBRELLA_H #define LMP_IMPROPER_UMBRELLA_H -#include "stdio.h" +#include <stdio.h> #include "improper.h" namespace LAMMPS_NS { diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index cfb2dfeb5744032140cc979520b736dff5a24c0d..af54c9bdfa736b7d51cb4bd6476ff3c28b20292d 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -15,10 +15,10 @@ Contributing author: Tod A Pascal (Caltech) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_hbond_dreiding_lj.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.cpp b/src/MOLECULE/pair_hbond_dreiding_morse.cpp index f0b31b1bafac1cad3b30c7b4cc988b772b59127c..ab793405dde71defb98c792fdfe9ef26e1252a32 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_morse.cpp @@ -15,10 +15,10 @@ Contributing author: Tod A Pascal (Caltech) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_hbond_dreiding_morse.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index 89f43503351065c749dc25ee517bc753b01ce43e..0d08a672ad411c2265484038fda82d1521b1e5b9 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_charmm_coul_charmm.h" #include "atom.h" #include "comm.h" diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.cpp index 19a44f2878a13112dca5351e055608f6dff6688d..3421f88eb3c1edc1217f53da2f093ccde2aaa4e5 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm_implicit.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "pair_lj_charmm_coul_charmm_implicit.h" #include "atom.h" #include "force.h" diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index 3ba9ee7edba83d6e7eab767c8cbbecb0b555fbaf..0f5a1f68d11565f7e86463c4959eb886397c04cc 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -15,9 +15,9 @@ Contributing author: Pavel Elkind (Gothenburg University) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_tip4p_cut.h" #include "atom.h" #include "force.h" @@ -31,7 +31,7 @@ #include "memory.h" #include "error.h" -using namespace LAMMPS_NS; +using namespace LAMMPS_NS; using namespace MathConst; /* ---------------------------------------------------------------------- */ @@ -488,7 +488,7 @@ void PairLJCutTIP4PCut::init_style() error->all(FLERR,"Must use a bond style with TIP4P potential"); if (force->angle == NULL) error->all(FLERR,"Must use an angle style with TIP4P potential"); - + neighbor->request(this,instance_me); // set alpha parameter @@ -525,14 +525,14 @@ double PairLJCutTIP4PCut::init_one(int i, int j) double ratio = sigma[i][j] / cut_lj[i][j]; offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0)); } else offset[i][j] = 0.0; - + cut_ljsq[j][i] = cut_ljsq[i][j]; lj1[j][i] = lj1[i][j]; lj2[j][i] = lj2[i][j]; lj3[j][i] = lj3[i][j]; lj4[j][i] = lj4[i][j]; offset[j][i] = offset[i][j]; - + // compute I,J contribution to long-range tail correction // count total # of atoms of type I and J via Allreduce @@ -562,15 +562,15 @@ double PairLJCutTIP4PCut::init_one(int i, int j) // check that LJ epsilon = 0.0 for water H // set LJ cutoff to 0.0 for any interaction involving water H // so LJ term isn't calculated in compute() - + if ((i == typeH && epsilon[i][i] != 0.0) || (j == typeH && epsilon[j][j] != 0.0)) error->all(FLERR,"Water H epsilon must be 0.0 for " "pair style lj/cut/tip4p/cut"); - + if (i == typeH || j == typeH) cut_ljsq[j][i] = cut_ljsq[i][j] = 0.0; - + return cut; } diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index f6a0d0bb4364df6c7075a3a78650264b2e4f66bd..47aa7730474d9f81004b63ee525b2e78656ac00f 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -15,8 +15,8 @@ Contributing author: Pavel Elkind (Gothenburg University) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_tip4p_cut.h" #include "atom.h" #include "force.h" @@ -30,7 +30,7 @@ #include "memory.h" #include "error.h" -using namespace LAMMPS_NS; +using namespace LAMMPS_NS; using namespace MathConst; /* ---------------------------------------------------------------------- */ @@ -419,7 +419,7 @@ void PairTIP4PCut::init_style() error->all(FLERR,"Must use a bond style with TIP4P potential"); if (force->angle == NULL) error->all(FLERR,"Must use an angle style with TIP4P potential"); - + neighbor->request(this,instance_me); // set alpha parameter diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 8ac03829ee607f9a53f0f3182306f38da8dc7184..a44297f1416847db174002c5c3445c956d8dd664 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -15,7 +15,7 @@ Contributing author: Paul Coffman (IBM) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "dump_atom_mpiio.h" #include "domain.h" #include "atom.h" diff --git a/src/MPIIO/dump_cfg_mpiio.cpp b/src/MPIIO/dump_cfg_mpiio.cpp index 285eb038b48242ba08bf28e7052589311afd76e2..50683ecf642e59c1699688c07a53b2b46299104b 100644 --- a/src/MPIIO/dump_cfg_mpiio.cpp +++ b/src/MPIIO/dump_cfg_mpiio.cpp @@ -15,9 +15,9 @@ Contributing author: Paul Coffman (IBM) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "dump_cfg_mpiio.h" #include "atom.h" #include "domain.h" @@ -290,7 +290,7 @@ void DumpCFGMPIIO::write_header(bigint n) else if (unwrapflag == 1) scale = UNWRAPEXPAND; char str[64]; - + sprintf(str,"Number of particles = %s\n",BIGINT_FORMAT); headerSize += sprintf(((char*)&((char*)headerBuffer)[headerSize]),str,n); headerSize += sprintf(((char*)&((char*)headerBuffer)[headerSize]),"A = %g Angstrom (basic length-scale)\n",scale); @@ -372,24 +372,24 @@ int DumpCFGMPIIO::convert_string_omp(int n, double *mybuf) mpifh_buffer_line_per_thread[tid] = (char *) realloc(mpifh_buffer_line_per_thread[tid],(mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char)); bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char); } - for (int j = 0; j < size_one; j++) { + for (int j = 0; j < size_one; j++) { if (j == 0) { mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"%f \n",(mybuf[bufOffset[tid]+m])); } else if (j == 1) { mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"%s \n",typenames[(int) mybuf[bufOffset[tid]+m]]); } else if (j >= 2) { - if (vtype[j] == INT) + if (vtype[j] == INT) mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],static_cast<int> (mybuf[bufOffset[tid]+m])); - else if (vtype[j] == DOUBLE) + else if (vtype[j] == DOUBLE) mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],mybuf[bufOffset[tid]+m]); - else if (vtype[j] == STRING) + else if (vtype[j] == STRING) mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],typenames[(int) mybuf[bufOffset[tid]+m]]); - else if (vtype[j] == BIGINT) + else if (vtype[j] == BIGINT) mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],static_cast<bigint> (mybuf[bufOffset[tid]+m])); } m++; } // for j - mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"\n"); + mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"\n"); } // for i } // wrap flag else if (unwrapflag == 1) { @@ -398,7 +398,7 @@ int DumpCFGMPIIO::convert_string_omp(int n, double *mybuf) mpifh_buffer_line_per_thread[tid] = (char *) realloc(mpifh_buffer_line_per_thread[tid],(mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char)); bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char); } - for (int j = 0; j < size_one; j++) { + for (int j = 0; j < size_one; j++) { double unwrap_coord; if (j == 0) { //offset += sprintf(&sbuf[offset],"%f \n",mybuf[m]); @@ -411,39 +411,39 @@ int DumpCFGMPIIO::convert_string_omp(int n, double *mybuf) //offset += sprintf(&sbuf[offset],vformat[j],unwrap_coord); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],unwrap_coord); } else if (j >= 5 ) { - if (vtype[j] == INT) - //offset += + if (vtype[j] == INT) + //offset += // sprintf(&sbuf[offset],vformat[j],static_cast<int> (mybuf[m])); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],static_cast<int> (mybuf[bufOffset[tid]+m])); - else if (vtype[j] == DOUBLE) + else if (vtype[j] == DOUBLE) // offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],mybuf[bufOffset[tid]+m]); - else if (vtype[j] == STRING) - // offset += + else if (vtype[j] == STRING) + // offset += // sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],typenames[(int) mybuf[bufOffset[tid]+m]]); - else if (vtype[j] == BIGINT) - // offset += + else if (vtype[j] == BIGINT) + // offset += // sprintf(&sbuf[offset],vformat[j],static_cast<bigint> (mybuf[m])); mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),vformat[j],static_cast<bigint> (mybuf[bufOffset[tid]+m])); } m++; } // for j - mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"\n"); + mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),"\n"); } // for i } // unwrap flag } // pragma omp parallel - + #pragma omp barrier mpifhStringCount = 0; for (i=0;i<nthreads;i++) { mpifhStringCount += mpifhStringCountPerThread[i]; } - + memory->destroy(bufOffset); memory->destroy(bufRange); memory->destroy(bufLength); - + if (mpifhStringCount > 0) { if (mpifhStringCount > maxsbuf) { if (mpifhStringCount > MAXSMALLINT) return -1; @@ -452,19 +452,19 @@ int DumpCFGMPIIO::convert_string_omp(int n, double *mybuf) } sbuf[0] = '\0'; } - + for (int i=0;i<nthreads;i++) { strcat(sbuf,mpifh_buffer_line_per_thread[i]); free(mpifh_buffer_line_per_thread[i]); } - + memory->destroy(mpifhStringCountPerThread); free(mpifh_buffer_line_per_thread); - + } // else omp return mpifhStringCount; - + } #endif diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index baf74222ccc6667c61edd2c8aa82aba6c4899666..1cfb0ab81b5e0f47f5f12e1a0e579e75342977c5 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -15,9 +15,9 @@ Contributing author: Paul Coffman (IBM) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "dump_custom_mpiio.h" #include "atom.h" #include "force.h" diff --git a/src/MPIIO/dump_xyz_mpiio.cpp b/src/MPIIO/dump_xyz_mpiio.cpp index 3c6d0b7d7d255121f590815826e1d62fb71d8f1e..f673d2e9d46d0e60adf9de22a7d8aae3ff2aa97f 100644 --- a/src/MPIIO/dump_xyz_mpiio.cpp +++ b/src/MPIIO/dump_xyz_mpiio.cpp @@ -15,9 +15,9 @@ Contributing author: Paul Coffman (IBM) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "dump_xyz_mpiio.h" #include "atom.h" #include "force.h" diff --git a/src/MPIIO/restart_mpiio.cpp b/src/MPIIO/restart_mpiio.cpp index b769a58a8a368b61e07658c8e29e7faa8f9f6530..8ad1dccdca9fe60fb5a29fdb2f5cf20d328eb4d2 100644 --- a/src/MPIIO/restart_mpiio.cpp +++ b/src/MPIIO/restart_mpiio.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Coffman (IBM) ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "restart_mpiio.h" #include "error.h" -#include "limits.h" +#include <limits.h> using namespace LAMMPS_NS; diff --git a/src/OPT/pair_eam_opt.cpp b/src/OPT/pair_eam_opt.cpp index 1f20db29a254389dca118c36845d720450908162..66b2e7283cae49a29eca6a33aa70b1ddc3b6c4b9 100644 --- a/src/OPT/pair_eam_opt.cpp +++ b/src/OPT/pair_eam_opt.cpp @@ -19,8 +19,8 @@ Vincent Natoli, Stone Ridge Technology ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_eam_opt.h" #include "atom.h" #include "comm.h" diff --git a/src/OPT/pair_lj_charmm_coul_long_opt.cpp b/src/OPT/pair_lj_charmm_coul_long_opt.cpp index 136b9fc64dc2000961695bfd626ea763e4964ea0..b98dd36dd138fe7f93a60c2445decb3bd3f3736b 100644 --- a/src/OPT/pair_lj_charmm_coul_long_opt.cpp +++ b/src/OPT/pair_lj_charmm_coul_long_opt.cpp @@ -18,8 +18,8 @@ Vincent Natoli, Stone Ridge Technology ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_lj_charmm_coul_long_opt.h" #include "atom.h" #include "force.h" diff --git a/src/OPT/pair_lj_cut_coul_long_opt.cpp b/src/OPT/pair_lj_cut_coul_long_opt.cpp index 2ff5fc7bd6b00c61623147921cc9986b8b29356c..140d4d023a688e52a2b65386442525a63d26570f 100644 --- a/src/OPT/pair_lj_cut_coul_long_opt.cpp +++ b/src/OPT/pair_lj_cut_coul_long_opt.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_long_opt.h" #include "atom.h" #include "force.h" diff --git a/src/OPT/pair_lj_cut_opt.cpp b/src/OPT/pair_lj_cut_opt.cpp index 170a3aa72896e2dee7d9613af47c1888a157be50..0812a56f015cd1f888c1eee840f00484a645ce61 100644 --- a/src/OPT/pair_lj_cut_opt.cpp +++ b/src/OPT/pair_lj_cut_opt.cpp @@ -18,7 +18,7 @@ Vincent Natoli, Stone Ridge Technology ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "pair_lj_cut_opt.h" #include "atom.h" #include "force.h" diff --git a/src/OPT/pair_lj_cut_tip4p_long_opt.cpp b/src/OPT/pair_lj_cut_tip4p_long_opt.cpp index e045eeec75a6f321839679d96e50358e7697950c..2cca32baeca39e3b4b114563f928e4127bcb8a34 100644 --- a/src/OPT/pair_lj_cut_tip4p_long_opt.cpp +++ b/src/OPT/pair_lj_cut_tip4p_long_opt.cpp @@ -15,7 +15,7 @@ OPT version: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_tip4p_long_opt.h" #include "atom.h" #include "domain.h" diff --git a/src/OPT/pair_lj_long_coul_long_opt.cpp b/src/OPT/pair_lj_long_coul_long_opt.cpp index 538abb051eb5a8b88d65f2dc342c6599e9343f41..9004e5c93cbe57007584de2105e6e29af2e65d0a 100644 --- a/src/OPT/pair_lj_long_coul_long_opt.cpp +++ b/src/OPT/pair_lj_long_coul_long_opt.cpp @@ -15,7 +15,7 @@ OPT version: Wayne Mitchell (Loyola University New Orleans) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_long_coul_long_opt.h" #include "atom.h" #include "force.h" @@ -43,11 +43,11 @@ PairLJLongCoulLongOpt::PairLJLongCoulLongOpt(LAMMPS *lmp) : PairLJLongCoulLong(l void PairLJLongCoulLongOpt::compute(int eflag, int vflag) { - + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; int order1 = ewald_order&(1<<1), order6 = ewald_order&(1<<6); - + if (order6) { if (order1) { if (!ndisptablebits) { @@ -289,11 +289,11 @@ void PairLJLongCoulLongOpt::compute(int eflag, int vflag) void PairLJLongCoulLongOpt::compute_outer(int eflag, int vflag) { - + if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; int order1 = ewald_order&(1<<1), order6 = ewald_order&(1<<6); - + if (order6) { if (order1) { if (!ndisptablebits) { @@ -540,7 +540,7 @@ void PairLJLongCoulLongOpt::eval() { double evdwl,ecoul,fpair; evdwl = ecoul = 0.0; - + double **x = atom->x, *x0 = x[0]; double **f = atom->f, *f0 = f[0], *fi = f0; double *q = atom->q; @@ -549,7 +549,7 @@ void PairLJLongCoulLongOpt::eval() double *special_coul = force->special_coul; double *special_lj = force->special_lj; double qqrd2e = force->qqrd2e; - + int i, j; int *ineigh, *ineighn, *jneigh, *jneighn, typei, typej, ni; double qi = 0.0, qri = 0.0; @@ -557,9 +557,9 @@ void PairLJLongCoulLongOpt::eval() double rsq, r2inv, force_coul, force_lj; double g2 = g_ewald_6*g_ewald_6, g6 = g2*g2*g2, g8 = g6*g2; vector xi, d; - + ineighn = (ineigh = list->ilist)+list->inum; - + for (; ineigh<ineighn; ++ineigh) { // loop over my atoms i = *ineigh; fi = f0+3*i; if (ORDER1) qri = (qi = q[i])*qqrd2e; // initialize constants @@ -568,20 +568,20 @@ void PairLJLongCoulLongOpt::eval() cutsqi = cutsq[typei]; cut_ljsqi = cut_ljsq[typei]; memcpy(xi, x0+(i+(i<<1)), sizeof(vector)); jneighn = (jneigh = list->firstneigh[i])+list->numneigh[i]; - + for (; jneigh<jneighn; ++jneigh) { // loop over neighbors j = *jneigh; ni = sbmask(j); j &= NEIGHMASK; - + { register double *xj = x0+(j+(j<<1)); d[0] = xi[0] - xj[0]; // pair vector d[1] = xi[1] - xj[1]; d[2] = xi[2] - xj[2]; } - + if ((rsq = vec_dot(d, d)) >= cutsqi[typej = type[j]]) continue; r2inv = 1.0/rsq; - + if (ORDER1 && (rsq < cut_coulsq)) { // coulombic if (!CTABLE || rsq <= tabinnersq) { // series real space register double r = sqrt(rsq), x = g_ewald*r; @@ -614,7 +614,7 @@ void PairLJLongCoulLongOpt::eval() } } else force_coul = ecoul = 0.0; - + if (rsq < cut_ljsqi[typej]) { // lj if (ORDER6) { // long-range lj if(!LJTABLE || rsq <= tabinnerdispsq) { // series real space @@ -667,9 +667,9 @@ void PairLJLongCoulLongOpt::eval() } } else force_lj = evdwl = 0.0; - + fpair = (force_coul+force_lj)*r2inv; - + if (NEWTON_PAIR || j < nlocal) { register double *fj = f0+(j+(j<<1)), f; fi[0] += f = d[0]*fpair; fj[0] -= f; @@ -681,12 +681,12 @@ void PairLJLongCoulLongOpt::eval() fi[1] += d[1]*fpair; fi[2] += d[2]*fpair; } - + if (EVFLAG) ev_tally(i,j,nlocal,NEWTON_PAIR, evdwl,ecoul,fpair,d[0],d[1],d[2]); } } - + if (vflag_fdotr) virial_fdotr_compute(); } @@ -699,7 +699,7 @@ void PairLJLongCoulLongOpt::eval_outer() { double evdwl,ecoul,fvirial,fpair; evdwl = ecoul = 0.0; - + double **x = atom->x, *x0 = x[0]; double **f = atom->f, *f0 = f[0], *fi = f0; double *q = atom->q; @@ -709,7 +709,7 @@ void PairLJLongCoulLongOpt::eval_outer() double *special_lj = force->special_lj; int newton_pair = force->newton_pair; double qqrd2e = force->qqrd2e; - + int i, j; int *ineigh, *ineighn, *jneigh, *jneighn, typei, typej, ni, respa_flag; double qi = 0.0, qri = 0.0; @@ -718,16 +718,16 @@ void PairLJLongCoulLongOpt::eval_outer() double g2 = g_ewald_6*g_ewald_6, g6 = g2*g2*g2, g8 = g6*g2; double respa_lj = 0.0, respa_coul = 0.0, frespa = 0.0; vector xi, d; - + double cut_in_off = cut_respa[2]; double cut_in_on = cut_respa[3]; - + double cut_in_diff = cut_in_on - cut_in_off; double cut_in_off_sq = cut_in_off*cut_in_off; double cut_in_on_sq = cut_in_on*cut_in_on; - + ineighn = (ineigh = listouter->ilist)+listouter->inum; - + for (; ineigh<ineighn; ++ineigh) { // loop over my atoms i = *ineigh; fi = f0+3*i; if (ORDER1) qri = (qi = q[i])*qqrd2e; // initialize constants @@ -736,20 +736,20 @@ void PairLJLongCoulLongOpt::eval_outer() cutsqi = cutsq[typei]; cut_ljsqi = cut_ljsq[typei]; memcpy(xi, x0+(i+(i<<1)), sizeof(vector)); jneighn = (jneigh = listouter->firstneigh[i])+listouter->numneigh[i]; - + for (; jneigh<jneighn; ++jneigh) { // loop over neighbors j = *jneigh; ni = sbmask(j); j &= NEIGHMASK; - + { register double *xj = x0+(j+(j<<1)); d[0] = xi[0] - xj[0]; // pair vector d[1] = xi[1] - xj[1]; d[2] = xi[2] - xj[2]; } - + if ((rsq = vec_dot(d, d)) >= cutsqi[typej = type[j]]) continue; r2inv = 1.0/rsq; - + frespa = 1.0; // check whether and how to compute respa corrections respa_coul = 0; respa_lj = 0; @@ -758,7 +758,7 @@ void PairLJLongCoulLongOpt::eval_outer() register double rsw = (sqrt(rsq)-cut_in_off)/cut_in_diff; frespa = 1-rsw*rsw*(3.0-2.0*rsw); } - + if (ORDER1 && (rsq < cut_coulsq)) { // coulombic if (!CTABLE || rsq <= tabinnersq) { // series real space register double r = sqrt(rsq), s = qri*q[j]; @@ -799,7 +799,7 @@ void PairLJLongCoulLongOpt::eval_outer() } } } - + else force_coul = respa_coul = ecoul = 0.0; if (rsq < cut_ljsqi[typej]) { // lennard-jones @@ -855,9 +855,9 @@ void PairLJLongCoulLongOpt::eval_outer() } } else force_lj = respa_lj = evdwl = 0.0; - + fpair = (force_coul+force_lj)*r2inv; - + if (NEWTON_PAIR || j < nlocal) { register double *fj = f0+(j+(j<<1)), f; fi[0] += f = d[0]*fpair; fj[0] -= f; @@ -869,7 +869,7 @@ void PairLJLongCoulLongOpt::eval_outer() fi[1] += d[1]*fpair; fi[2] += d[2]*fpair; } - + if (EVFLAG) { fvirial = (force_coul + force_lj + respa_coul + respa_lj)*r2inv; ev_tally(i,j,nlocal,newton_pair, diff --git a/src/OPT/pair_morse_opt.cpp b/src/OPT/pair_morse_opt.cpp index 6fcb9843a63c58e99679ca4e6e3883e87a212148..e63fbd0938c5cb235b22d10d92d86d84797513e9 100644 --- a/src/OPT/pair_morse_opt.cpp +++ b/src/OPT/pair_morse_opt.cpp @@ -18,8 +18,8 @@ Vincent Natoli, Stone Ridge Technology ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_morse_opt.h" #include "atom.h" #include "force.h" diff --git a/src/PERI/atom_vec_peri.cpp b/src/PERI/atom_vec_peri.cpp index a5fafb04a043913cadbb8710abcaf886d75f40e8..3e6a72289a6d3afa7e6c4ccb7105f0f64d342221 100644 --- a/src/PERI/atom_vec_peri.cpp +++ b/src/PERI/atom_vec_peri.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Parks (SNL) ------------------------------------------------------------------------- */ -#include "float.h" -#include "stdlib.h" -#include "string.h" +#include <float.h> +#include <stdlib.h> +#include <string.h> #include "atom_vec_peri.h" #include "atom.h" #include "comm.h" @@ -877,7 +877,7 @@ int AtomVecPeri::pack_data_hybrid(int i, double *buf) void AtomVecPeri::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, buf[i][2],buf[i][3],buf[i][4],buf[i][5],buf[i][6], @@ -912,7 +912,7 @@ int AtomVecPeri::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecPeri::pack_property_atom(int index, double *buf, +void AtomVecPeri::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; diff --git a/src/PERI/compute_damage_atom.cpp b/src/PERI/compute_damage_atom.cpp index 7a8cbfd3dd05a2590c1409cfd316e9a66770a60b..cf8cf35cd393e706bd510734faba45394e7bb029 100644 --- a/src/PERI/compute_damage_atom.cpp +++ b/src/PERI/compute_damage_atom.cpp @@ -15,7 +15,7 @@ Contributing author: Mike Parks (SNL) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_damage_atom.h" #include "atom.h" #include "update.h" @@ -102,13 +102,13 @@ void ComputeDamageAtom::compute_peratom() damage_temp = 0.0; for (jj = 0; jj < jnum; jj++) { if (partner[i][jj] == 0) continue; - + // look up local index of this partner particle // skip if particle is "lost" - + j = atom->map(partner[i][jj]); if (j < 0) continue; - + damage_temp += vfrac[j]; } diff --git a/src/PERI/compute_dilatation_atom.cpp b/src/PERI/compute_dilatation_atom.cpp index 366c5bcda9643e0b885498a1e2b6d9ceb0583c64..20993fab47b2d0f8f3cf76542e151813f519b363 100644 --- a/src/PERI/compute_dilatation_atom.cpp +++ b/src/PERI/compute_dilatation_atom.cpp @@ -15,7 +15,7 @@ Contributing author: Rezwanur Rahman, John Foster (UTSA) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_dilatation_atom.h" #include "atom.h" #include "update.h" @@ -72,8 +72,8 @@ void ComputeDilatationAtom::init() if (force->pair_match("peri/lps",1)) isLPS = 1; if (force->pair_match("peri/ves",1)) isVES = 1; if (force->pair_match("peri/eps",1)) isEPS = 1; - - if (isPMB) + + if (isPMB) error->all(FLERR,"Compute dilatation/atom cannot be used " "with this pair style"); diff --git a/src/PERI/compute_dilatation_atom.h b/src/PERI/compute_dilatation_atom.h index 9aac5677605db8d311598a72823076511ffa550f..a247cc929152426c7f13e0923ced84199eb2c978 100644 --- a/src/PERI/compute_dilatation_atom.h +++ b/src/PERI/compute_dilatation_atom.h @@ -27,8 +27,8 @@ namespace LAMMPS_NS { class ComputeDilatationAtom : public Compute { friend class PairPeriPMB; friend class PairPeriLPS; - friend class PairPeriVES; - friend class PairPeriEPS; + friend class PairPeriVES; + friend class PairPeriEPS; public: ComputeDilatationAtom(class LAMMPS *, int, char **); ~ComputeDilatationAtom(); diff --git a/src/PERI/compute_plasticity_atom.cpp b/src/PERI/compute_plasticity_atom.cpp index ac089fe7a6e5d9d5afd5bf098e5199bd8dfe7f8e..2c47f18b1fc57219d9d7ef27ebb8ff74d754b169 100644 --- a/src/PERI/compute_plasticity_atom.cpp +++ b/src/PERI/compute_plasticity_atom.cpp @@ -15,7 +15,7 @@ Contributing author: Rezwanur Rahman, John Foster (UTSA) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_plasticity_atom.h" #include "atom.h" #include "update.h" @@ -36,7 +36,7 @@ ComputePlasticityAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { if (narg != 3) error->all(FLERR,"Illegal compute plasticity/atom command"); - + if (!force->pair_match("peri/eps",1)) error->all(FLERR,"Compute plasticity/atom cannot be used " "with this pair style"); diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index a26507ae5414e3557cf2f6b296d902e68a088470..a84ce31609de4706a0b02d988d810d42e9985751 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -15,7 +15,7 @@ Contributing authors: Mike Parks (SNL), Ezwanur Rahman, J.T. Foster (UTSA) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_peri_neigh.h" #include "pair_peri_pmb.h" #include "pair_peri_lps.h" @@ -47,7 +47,7 @@ FixPeriNeigh::FixPeriNeigh(LAMMPS *lmp,int narg, char **arg) : if (force->pair_match("peri/lps",1)) isLPS = 1; if (force->pair_match("peri/ves",1)) isVES = 1; if (force->pair_match("peri/eps",1)) isEPS = 1; - + restart_global = 1; restart_peratom = 1; first = 1; @@ -225,7 +225,7 @@ void FixPeriNeigh::setup(int vflag) memory->destroy(deviatorextention); memory->destroy(deviatorBackextention); memory->destroy(deviatorPlasticextension); - memory->destroy(lambdaValue); + memory->destroy(lambdaValue); memory->destroy(r0); memory->destroy(npartner); @@ -235,7 +235,7 @@ void FixPeriNeigh::setup(int vflag) deviatorBackextention = NULL; deviatorPlasticextension = NULL; lambdaValue = NULL; - r0 = NULL; + r0 = NULL; grow_arrays(atom->nmax); // create partner list and r0 values from neighbor list @@ -270,11 +270,11 @@ void FixPeriNeigh::setup(int vflag) if (rsq <= cutsq[itype][jtype]) { partner[i][npartner[i]] = tag[j]; if (isVES) - deviatorextention[i][npartner[i]] = + deviatorextention[i][npartner[i]] = deviatorBackextention[i][npartner[i]] = 0.0; if (isEPS) deviatorPlasticextension[i][npartner[i]] = 0.0; - r0[i][npartner[i]] = sqrt(rsq); + r0[i][npartner[i]] = sqrt(rsq); npartner[i]++; vinter[i] += vfrac[j]; } @@ -332,7 +332,7 @@ void FixPeriNeigh::setup(int vflag) double delx0 = xtmp0 - x0[j][0]; double dely0 = ytmp0 - x0[j][1]; double delz0 = ztmp0 - x0[j][2]; - + double rsq0 = delx0*delx0 + dely0*dely0 + delz0*delz0; jtype = type[j]; @@ -347,8 +347,8 @@ void FixPeriNeigh::setup(int vflag) // for PMB, influence = 1.0, otherwise invoke influence function - if (isPMB) - wvolume[i] += 1.0 * rsq0 * vfrac[j] * vfrac_scale; + if (isPMB) + wvolume[i] += 1.0 * rsq0 * vfrac[j] * vfrac_scale; else if (isLPS) wvolume[i] += pairlps->influence_function(delx0,dely0,delz0) * rsq0 * vfrac[j] * vfrac_scale; @@ -357,7 +357,7 @@ void FixPeriNeigh::setup(int vflag) rsq0 * vfrac[j] * vfrac_scale; else if (isEPS) wvolume[i] += paireps->influence_function(delx0,dely0,delz0) * - rsq0 * vfrac[j] * vfrac_scale; + rsq0 * vfrac[j] * vfrac_scale; } } @@ -391,7 +391,7 @@ void FixPeriNeigh::setup(int vflag) ------------------------------------------------------------------------- */ double FixPeriNeigh::memory_usage() -{ +{ int nmax = atom->nmax; int bytes = nmax * sizeof(int); bytes += nmax*maxpartner * sizeof(tagint); @@ -399,14 +399,14 @@ double FixPeriNeigh::memory_usage() if (isVES) { bytes += nmax*maxpartner * sizeof(double); bytes += nmax*maxpartner * sizeof(double); - } + } if (isEPS) { bytes += nmax*maxpartner * sizeof(double); bytes += nmax * sizeof(double); - } + } bytes += nmax * sizeof(double); bytes += nmax * sizeof(double); - return bytes; + return bytes; } /* ---------------------------------------------------------------------- @@ -426,7 +426,7 @@ void FixPeriNeigh::grow_arrays(int nmax) if (isEPS) memory->grow(deviatorPlasticextension,nmax,maxpartner, "peri_neigh:deviatorPlasticextension"); memory->grow(r0,nmax,maxpartner,"peri_neigh:r0"); - if (isEPS) memory->grow(lambdaValue,nmax,"peri_neigh:lambdaValue"); + if (isEPS) memory->grow(lambdaValue,nmax,"peri_neigh:lambdaValue"); memory->grow(vinter,nmax,"peri_neigh:vinter"); memory->grow(wvolume,nmax,"peri_neigh:wvolume"); } @@ -443,7 +443,7 @@ void FixPeriNeigh::copy_arrays(int i, int j, int delflag) if (isVES) { deviatorextention[j][m] = deviatorextention[i][m]; deviatorBackextention[j][m] = deviatorBackextention[i][m]; - } + } if (isEPS) deviatorPlasticextension[j][m] = deviatorPlasticextension[i][m]; r0[j][m] = r0[i][m]; @@ -469,14 +469,14 @@ int FixPeriNeigh::pack_exchange(int i, double *buf) if (isVES) { buf[m++] = deviatorextention[i][n]; buf[m++] = deviatorBackextention[i][n]; - } + } if (isEPS) buf[m++] = deviatorPlasticextension[i][n]; buf[m++] = r0[i][n]; } if (isVES) buf[0] = m/4; else if (isEPS) buf[0] = m/3; else buf[0] = m/2; - if (isEPS) buf[m++] = lambdaValue[i]; + if (isEPS) buf[m++] = lambdaValue[i]; buf[m++] = vinter[i]; buf[m++] = wvolume[i]; return m; @@ -492,12 +492,12 @@ int FixPeriNeigh::unpack_exchange(int nlocal, double *buf) npartner[nlocal] = static_cast<int> (buf[m++]); for (int n = 0; n < npartner[nlocal]; n++) { partner[nlocal][n] = static_cast<tagint> (buf[m++]); - if (isVES) { + if (isVES) { deviatorextention[nlocal][n] = buf[m++]; deviatorBackextention[nlocal][n] = buf[m++]; } if (isEPS) deviatorPlasticextension[nlocal][n] = buf[m++]; - r0[nlocal][n] = buf[m++]; + r0[nlocal][n] = buf[m++]; } if (isEPS) lambdaValue[nlocal] = buf[m++]; vinter[nlocal] = buf[m++]; @@ -580,17 +580,17 @@ int FixPeriNeigh::pack_restart(int i, double *buf) buf[m++] = npartner[i]; for (int n = 0; n < npartner[i]; n++) { buf[m++] = partner[i][n]; - if (isVES) { + if (isVES) { buf[m++] = deviatorextention[i][n]; buf[m++] = deviatorBackextention[i][n]; - } + } if (isEPS) buf[m++] = deviatorPlasticextension[i][n]; buf[m++] = r0[i][n]; } if (isEPS) buf[m++] = lambdaValue[i]; buf[m++] = vinter[i]; buf[m++] = wvolume[i]; - return m; + return m; } /* ---------------------------------------------------------------------- @@ -611,16 +611,16 @@ void FixPeriNeigh::unpack_restart(int nlocal, int nth) npartner[nlocal] = static_cast<int> (extra[nlocal][m++]); for (int n = 0; n < npartner[nlocal]; n++) { partner[nlocal][n] = static_cast<tagint> (extra[nlocal][m++]); - if (isVES) { + if (isVES) { deviatorextention[nlocal][n] = extra[nlocal][m++]; deviatorBackextention[nlocal][n] = extra[nlocal][m++]; - } + } if (isEPS) deviatorPlasticextension[nlocal][n] = extra[nlocal][m++]; r0[nlocal][n] = extra[nlocal][m++]; } if (isEPS) lambdaValue[nlocal] = extra[nlocal][m++]; vinter[nlocal] = extra[nlocal][m++]; - wvolume[nlocal] = extra[nlocal][m++]; + wvolume[nlocal] = extra[nlocal][m++]; } /* ---------------------------------------------------------------------- @@ -631,7 +631,7 @@ int FixPeriNeigh::maxsize_restart() { if (isVES) return 4*maxpartner + 4; if (isEPS) return 3*maxpartner + 5; - return 2*maxpartner + 4; + return 2*maxpartner + 4; } /* ---------------------------------------------------------------------- @@ -642,5 +642,5 @@ int FixPeriNeigh::size_restart(int nlocal) { if (isVES) return 4*npartner[nlocal] + 4; if (isEPS) return 3*npartner[nlocal] + 5; - return 2*npartner[nlocal] + 4; + return 2*npartner[nlocal] + 4; } diff --git a/src/PERI/fix_peri_neigh.h b/src/PERI/fix_peri_neigh.h index 30d3d8143694b058cc9e1a648d22b1ed97b56321..79006ab5415e296240001636ed0f1bd5e103b793 100644 --- a/src/PERI/fix_peri_neigh.h +++ b/src/PERI/fix_peri_neigh.h @@ -63,13 +63,13 @@ class FixPeriNeigh : public Fix { int maxpartner; // max # of peridynamic neighs for any atom int *npartner; // # of neighbors for each atom tagint **partner; // neighs for each atom, stored as global IDs - double **deviatorextention; // Deviatoric extention - double **deviatorBackextention; // Deviatoric back extention - double **deviatorPlasticextension; // Deviatoric plastic extension + double **deviatorextention; // Deviatoric extention + double **deviatorBackextention; // Deviatoric back extention + double **deviatorPlasticextension; // Deviatoric plastic extension double *lambdaValue; double **r0; // initial distance to partners double **r1; // instanteneous distance to partners - double *thetaValue; // dilatation + double *thetaValue; // dilatation double *vinter; // sum of vfrac for bonded neighbors double *wvolume; // weighted volume of particle int isPMB,isLPS,isVES,isEPS; // which flavor of PD diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index 1d9361a3625dee3a98a18b16e767fab2f8569fbb..ecf6f0a3fa8d9c40bf6fdd0326fd488fab8c2f63 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -15,9 +15,9 @@ Contributing author: Rezwanur Rahman, John Foster (UTSA) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "pair_peri_eps.h" #include "atom.h" #include "domain.h" @@ -108,7 +108,7 @@ void PairPeriEPS::compute(int eflag, int vflag) double *s0 = atom->s0; double **x0 = atom->x0; double **r0 = ((FixPeriNeigh *) modify->fix[ifix_peri])->r0; - double **deviatorPlasticextension = + double **deviatorPlasticextension = ((FixPeriNeigh *) modify->fix[ifix_peri])->deviatorPlasticextension; tagint **partner = ((FixPeriNeigh *) modify->fix[ifix_peri])->partner; int *npartner = ((FixPeriNeigh *) modify->fix[ifix_peri])->npartner; @@ -146,7 +146,7 @@ void PairPeriEPS::compute(int eflag, int vflag) itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; - + for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; @@ -204,10 +204,10 @@ void PairPeriEPS::compute(int eflag, int vflag) } // grow bond forces array if necessary - + int maxpartner = 0; for (i = 0; i < nlocal; i++) maxpartner = MAX(maxpartner,npartner[i]); - + if (atom->nmax > nmax) { memory->destroy(s0_new); @@ -215,21 +215,21 @@ void PairPeriEPS::compute(int eflag, int vflag) nmax = atom->nmax; memory->create(s0_new,nmax,"pair:s0_new"); memory->create(theta,nmax,"pair:theta"); - + } - + // ******** temp array to store Plastic extension *********** /// // create on heap to reduce stack use and to allow for faster zeroing double **deviatorPlasticExtTemp; memory->create(deviatorPlasticExtTemp,nlocal,maxpartner,"pair:plastext"); memset(&(deviatorPlasticExtTemp[0][0]),0,sizeof(double)*nlocal*maxpartner); // ******** temp array to store Plastic extension *********** /// - - + + // compute the dilatation on each particle compute_dilatation(); - + // communicate dilatation (theta) of each particle comm->forward_comm_pair(this); @@ -268,27 +268,27 @@ void PairPeriEPS::compute(int eflag, int vflag) itype = type[i]; jnum = npartner[i]; first = true; - + double yieldStress = m_yieldstress[itype][itype]; double horizon = cut[itype][itype]; double tdnorm = compute_DeviatoricForceStateNorm(i); - double pointwiseYieldvalue = 25.0 * yieldStress * + double pointwiseYieldvalue = 25.0 * yieldStress * yieldStress / 8 / M_PI / pow(horizon,5); - - + + double fsurf = (tdnorm * tdnorm)/2 - pointwiseYieldvalue; bool elastic = true; double alphavalue = (15 * shearmodulus[itype][itype]) /wvolume[i]; - - + + if (fsurf>0) { elastic = false; deltalambda = ((tdnorm /sqrt(2.0 * pointwiseYieldvalue)) - 1.0) / alphavalue; double templambda = lambdaValue[i]; lambdaValue[i] = templambda + deltalambda; - } + } for (jj = 0; jj < jnum; jj++) { if (partner[i][jj] == 0) continue; @@ -320,7 +320,7 @@ void PairPeriEPS::compute(int eflag, int vflag) if (fabs(dr) < 2.2204e-016) { dr = 0.0; - } + } // scale vfrac[j] if particle j near the horizon @@ -328,35 +328,35 @@ void PairPeriEPS::compute(int eflag, int vflag) vfrac_scale = (-1.0/(2*half_lc))*(r0[i][jj]) + (1.0 + ((delta - half_lc)/(2*half_lc) ) ); else vfrac_scale = 1.0; - + omega_plus = influence_function(-1.0*delx0,-1.0*dely0,-1.0*delz0); omega_minus = influence_function(delx0,dely0,delz0); - - //Elastic Part + + //Elastic Part rk = ((3.0 * bulkmodulus[itype][itype]) * ( (omega_plus * theta[i] / wvolume[i]) + ( omega_minus * theta[j] / wvolume[j] ) ) ) * r0[i][jj]; - + if (r > 0.0) fbond = -((rk/r) * vfrac[j] * vfrac_scale); else fbond = 0.0; - + //Plastic part - + double deviatoric_extension = dr - (theta[i]* r0[i][jj] / 3.0); edpNp1 = deviatorPlasticextension[i][jj]; - + double tdtrialValue = ( 15 * shearmodulus[itype][itype]) * - ( (omega_plus / wvolume[i]) + (omega_minus / wvolume[j]) ) * - (deviatoric_extension - edpNp1); - + ( (omega_plus / wvolume[i]) + (omega_minus / wvolume[j]) ) * + (deviatoric_extension - edpNp1); + if(elastic) { rkNew = tdtrialValue; } else { rkNew = (sqrt(2.0*pointwiseYieldvalue) * tdtrialValue) / tdnorm; deviatorPlasticExtTemp[i][jj] = edpNp1 + rkNew * deltalambda; - } - - + } + + if (r > 0.0) fbondElastoPlastic = -((rkNew/r) * vfrac[j] * vfrac_scale); else fbondElastoPlastic = 0.0; @@ -364,17 +364,17 @@ void PairPeriEPS::compute(int eflag, int vflag) // total Force state: elastic + plastic fbondFinal=fbond+fbondElastoPlastic; fbond=fbondFinal; - - + + f[i][0] += delx*fbond; f[i][1] += dely*fbond; f[i][2] += delz*fbond; - + // since I-J is double counted, set newton off & use 1/2 factor and I,I if (eflag) evdwl = (0.5 * 15 * shearmodulus[itype][itype]/wvolume[i] * - omega_plus * (deviatoric_extension - edpNp1) * + omega_plus * (deviatoric_extension - edpNp1) * (deviatoric_extension-edpNp1)) * vfrac[j] * vfrac_scale; if (evflag) ev_tally(i,i,nlocal,0,0.5*evdwl,0.0, 0.5*fbond*vfrac[i],delx,dely,delz); @@ -395,13 +395,13 @@ void PairPeriEPS::compute(int eflag, int vflag) (alpha[itype][jtype] * stretch)); first = false; - } + } } // store new s0 memcpy(s0,s0_new,sizeof(double)*nlocal); - + memcpy(&(deviatorPlasticextension[0][0]), &(deviatorPlasticExtTemp[0][0]), sizeof(double)*nlocal*maxpartner); @@ -502,7 +502,7 @@ void PairPeriEPS::init_style() { // error checks - if (!atom->peri_flag) + if (!atom->peri_flag) error->all(FLERR,"Pair style peri requires atom style peri"); if (atom->map_style == 0) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); @@ -607,7 +607,7 @@ double PairPeriEPS::influence_function(double xi_x, double xi_y, double xi_z) { double r = sqrt(xi_x*xi_x + xi_y*xi_y + xi_z*xi_z); double omega; - + if (fabs(r) < 2.2204e-016) error->one(FLERR,"Divide by 0 in influence function"); omega = 1.0/r; @@ -726,11 +726,11 @@ double PairPeriEPS::compute_DeviatoricForceStateNorm(int i) tagint **partner = ((FixPeriNeigh *) modify->fix[ifix_peri])->partner; int *npartner = ((FixPeriNeigh *) modify->fix[ifix_peri])->npartner; double *wvolume = ((FixPeriNeigh *) modify->fix[ifix_peri])->wvolume; - double **deviatorPlasticextension = + double **deviatorPlasticextension = ((FixPeriNeigh *) modify->fix[ifix_peri])->deviatorPlasticextension; int periodic = domain->xperiodic || domain->yperiodic || domain->zperiodic; - + // compute the dilatation theta xtmp = x[i][0]; @@ -749,7 +749,7 @@ double PairPeriEPS::compute_DeviatoricForceStateNorm(int i) if (j < 0) { partner[i][jj] = 0; continue; - } + } delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; @@ -762,10 +762,10 @@ double PairPeriEPS::compute_DeviatoricForceStateNorm(int i) r = sqrt(rsq); dr = r - r0[i][jj]; if (fabs(dr) < 2.2204e-016) dr = 0.0; - + // scale vfrac[j] if particle j near the horizon double vfrac_scale; - + jtype = type[j]; double delta = cut[itype][jtype]; @@ -775,21 +775,21 @@ double PairPeriEPS::compute_DeviatoricForceStateNorm(int i) vfrac_scale = (-1.0/(2*half_lc))*(r0[i][jj]) + (1.0 + ((delta - half_lc)/(2*half_lc) ) ); else vfrac_scale = 1.0; - + double ed = dr - (theta[i] * r0[i][jj])/3; double edPNP1 = deviatorPlasticextension[i][jj]; jtype = type[j]; delta = cut[itype][jtype]; - + double omega_plus = influence_function(-1.0*delx0,-1.0*dely0,-1.0*delz0); double omega_minus = influence_function(delx0,dely0,delz0); - + tdtrial = ( 15 * shearmodulus[itype][itype]) * ((omega_plus * theta[i] / wvolume[i]) + ( omega_minus * theta[j] / wvolume[j] ) ) * (ed - edPNP1); - - norm += tdtrial * tdtrial * vfrac[j] * vfrac_scale; + + norm += tdtrial * tdtrial * vfrac[j] * vfrac_scale; } return sqrt(norm); } diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index 00c7f3dc3f2601a85b81f417914a7c511c6d4c04..7b2ccec92cce19f3e29c84669eb2a7dab94a96e9 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -15,9 +15,9 @@ Contributing author: Mike Parks (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "pair_peri_lps.h" #include "atom.h" #include "domain.h" @@ -285,7 +285,7 @@ void PairPeriLPS::compute(int eflag, int vflag) omega_plus = influence_function(-1.0*delx0,-1.0*dely0,-1.0*delz0); omega_minus = influence_function(delx0,dely0,delz0); - + rk = ( (3.0 * bulkmodulus[itype][itype]) - (5.0 * shearmodulus[itype][itype]) ) * vfrac[j] * vfrac_scale * ( (omega_plus * theta[i] / wvolume[i]) + @@ -303,8 +303,8 @@ void PairPeriLPS::compute(int eflag, int vflag) // since I-J is double counted, set newton off & use 1/2 factor and I,I double deviatoric_extension = dr - (theta[i]* r0[i][jj] / 3.0); - - + + if (eflag) evdwl = 0.5 * 15 * (shearmodulus[itype][itype]/wvolume[i]) * omega_plus*(deviatoric_extension * deviatoric_extension) * vfrac[j] * vfrac_scale; @@ -326,7 +326,7 @@ void PairPeriLPS::compute(int eflag, int vflag) (alpha[itype][jtype] * stretch)); first = false; - } + } } // store new s0 diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 2b68a2522724bae058dc7e47582207fdb4018026..bc971cb2442ff175a9e01433701fea438dd2a974 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -15,10 +15,10 @@ Contributing author: Mike Parks (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "float.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <string.h> #include "pair_peri_pmb.h" #include "atom.h" #include "domain.h" @@ -359,7 +359,7 @@ void PairPeriPMB::init_style() { // error checks - if (!atom->peri_flag) + if (!atom->peri_flag) error->all(FLERR,"Pair style peri requires atom style peri"); if (atom->map_style == 0) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index 12c076850080c591045845e52687138c6c1a85a6..c34fb87e20f2f0f6df8009d7c1199694396f240e 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -15,9 +15,9 @@ Contributing authors: Rezwanur Rahman, J.T. Foster (UTSA) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "pair_peri_ves.h" #include "atom.h" #include "domain.h" @@ -111,9 +111,9 @@ void PairPeriVES::compute(int eflag, int vflag) double *s0 = atom->s0; double **x0 = atom->x0; double **r0 = ((FixPeriNeigh *) modify->fix[ifix_peri])->r0; - double **deviatorextention = + double **deviatorextention = ((FixPeriNeigh *) modify->fix[ifix_peri])->deviatorextention; - double **deviatorBackextention = + double **deviatorBackextention = ((FixPeriNeigh *) modify->fix[ifix_peri])->deviatorBackextention; tagint **partner = ((FixPeriNeigh *) modify->fix[ifix_peri])->partner; int *npartner = ((FixPeriNeigh *) modify->fix[ifix_peri])->npartner; @@ -258,7 +258,7 @@ void PairPeriVES::compute(int eflag, int vflag) itype = type[i]; jnum = npartner[i]; first = true; - + for (jj = 0; jj < jnum; jj++) { if (partner[i][jj] == 0) continue; j = atom->map(partner[i][jj]); @@ -299,7 +299,7 @@ void PairPeriVES::compute(int eflag, int vflag) omega_plus = influence_function(-1.0*delx0,-1.0*dely0,-1.0*delz0); omega_minus = influence_function(delx0,dely0,delz0); - + rk = ( (3.0 * bulkmodulus[itype][itype]) * vfrac[j] * vfrac_scale * ( (omega_plus * theta[i] / wvolume[i]) + ( omega_minus * theta[j] / wvolume[j] ) ) ) * r0[i][jj]; @@ -309,37 +309,37 @@ void PairPeriVES::compute(int eflag, int vflag) // for viscoelasticity lambdai=m_lambdai[itype][itype]; - double taui = m_taubi[itype][itype]; + double taui = m_taubi[itype][itype]; double c1 = taui/timestepsize; decay=exp(-1.0/c1); betai=1.-c1*(1.-decay); - double deviatoric_extension = + double deviatoric_extension = dr - (theta[i]* r0[i][jj] / 3.0); deltaed = deviatoric_extension-deviatorextention[i][jj]; - + // back extention at current step - edbNp1 = deviatorextention[i][jj]*(1-decay) + + edbNp1 = deviatorextention[i][jj]*(1-decay) + deviatorBackextention[i][jj]*decay+betai*deltaed; - rkNew = ((1-lambdai)*15.0) * + rkNew = ((1-lambdai)*15.0) * ( shearmodulus[itype][itype] * vfrac[j] * vfrac_scale ) * - ( (omega_plus / wvolume[i]) + (omega_minus / wvolume[j]) ) * + ( (omega_plus / wvolume[i]) + (omega_minus / wvolume[j]) ) * deviatoric_extension; - rkNew += (lambdai*15.0) * + rkNew += (lambdai*15.0) * ( shearmodulus[itype][itype] * vfrac[j] * vfrac_scale ) * - ( (omega_plus / wvolume[i]) + (omega_minus / wvolume[j]) ) * + ( (omega_plus / wvolume[i]) + (omega_minus / wvolume[j]) ) * (deviatoric_extension-edbNp1); if (r > 0.0) fbondViscoElastic = -(rkNew/r); else fbondViscoElastic = 0.0; - // total Force: elastic + viscoelastic + // total Force: elastic + viscoelastic fbondFinal=fbond+fbondViscoElastic; fbond=fbondFinal; - + f[i][0] += delx*fbond; f[i][1] += dely*fbond; f[i][2] += delz*fbond; @@ -347,10 +347,10 @@ void PairPeriVES::compute(int eflag, int vflag) // since I-J is double counted, set newton off & use 1/2 factor and I,I if (eflag) evdwl = ((0.5 * 15 * (1 - lambdai) * shearmodulus[itype][itype]/wvolume[i] * - omega_plus * deviatoric_extension * - deviatoric_extension) + + omega_plus * deviatoric_extension * + deviatoric_extension) + (0.5 * 15 * lambdai * shearmodulus[itype][itype]/wvolume[i] * - omega_plus * (deviatoric_extension-edbNp1) * + omega_plus * (deviatoric_extension-edbNp1) * (deviatoric_extension-edbNp1))) * vfrac[j] * vfrac_scale; if (evflag) ev_tally(i,i,nlocal,0,0.5*evdwl,0.0, 0.5*fbond*vfrac[i],delx,dely,delz); @@ -375,7 +375,7 @@ void PairPeriVES::compute(int eflag, int vflag) (alpha[itype][jtype] * stretch)); first = false; - } + } } // store new s0 @@ -482,7 +482,7 @@ void PairPeriVES::init_style() { // error checks - if (!atom->peri_flag) + if (!atom->peri_flag) error->all(FLERR,"Pair style peri requires atom style peri"); if (atom->map_style == 0) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); diff --git a/src/PERI/pair_peri_ves.h b/src/PERI/pair_peri_ves.h index 6c39e98e651211faf75b64f17ce8e3a8c66f6927..8aae4265106937931d7dedfdf29239b8c4e0be40 100644 --- a/src/PERI/pair_peri_ves.h +++ b/src/PERI/pair_peri_ves.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class PairPeriVES : public Pair { public: double *theta; - double *elastic_energy; + double *elastic_energy; PairPeriVES(class LAMMPS *); virtual ~PairPeriVES(); @@ -45,8 +45,8 @@ class PairPeriVES : public Pair { void read_restart_settings(FILE *) {} double memory_usage(); double influence_function(double, double, double); - void compute_dilatation(); - + void compute_dilatation(); + protected: int ifix_peri; diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 47e96f71926b877073d1ec2bf5613efacda1b037..e4888df9d370baa55416a6d5ec9c5c6a185c4833 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -17,11 +17,11 @@ Kurt Anderson (anderk5@rpi.edu) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> #include "workspace.h" #include "fix_poems.h" #include "atom.h" @@ -165,7 +165,7 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : tagint itmp; MPI_Allreduce(&maxmol_tag,&itmp,1,MPI_LMP_TAGINT,MPI_MAX,world); - if (itmp+1 > MAXSMALLINT) + if (itmp+1 > MAXSMALLINT) error->all(FLERR,"Too many molecules for fix poems"); int maxmol = (int) itmp; @@ -208,7 +208,7 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : if (natom2body[i] > MAXBODY) flag = 1; int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall) + if (flagall) error->all(FLERR,"Atom in too many rigid bodies - boost MAXBODY"); // create all nbody-length arrays @@ -1057,7 +1057,7 @@ void FixPOEMS::jointbuild() bodyflag[jlist[i][1]]++; } for (i = 0; i < nbody; i++) - if (bodyflag[i] > 2) + if (bodyflag[i] > 2) error->all(FLERR,"Tree structure in joint connections"); delete [] bodyflag; diff --git a/src/PYTHON/python.cpp b/src/PYTHON/python.cpp index 607181a1ec4db1f12c98c3c91d930c31086751d1..c9947f35219b83c7852f88c133b77f7cbc133440 100644 --- a/src/PYTHON/python.cpp +++ b/src/PYTHON/python.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "Python.h" +#include <Python.h> #include "python.h" #include "force.h" #include "input.h" @@ -75,7 +75,7 @@ void Python::command(int narg, char **arg) if (noutput) { str = input->variable->pythonstyle(pfuncs[ifunc].ovarname, pfuncs[ifunc].name); - if (!str) + if (!str) error->all(FLERR,"Python variable does not match Python function"); } @@ -185,7 +185,7 @@ void Python::command(int narg, char **arg) PyObject *pModule = (PyObject *) pyMain; PyObject *pFunc = PyObject_GetAttrString(pModule,pfuncs[ifunc].name); if (!pFunc) error->all(FLERR,"Could not find Python function"); - if (!PyCallable_Check(pFunc)) + if (!PyCallable_Check(pFunc)) error->all(FLERR,"Python function is not callable"); pfuncs[ifunc].pFunc = (void *) pFunc; @@ -216,28 +216,28 @@ void Python::invoke_function(int ifunc, char *result) if (itype == INT) { if (pfuncs[ifunc].ivarflag[i]) { str = input->variable->retrieve(pfuncs[ifunc].svalue[i]); - if (!str) + if (!str) error->all(FLERR,"Could not evaluate Python function input variable"); pValue = PyInt_FromLong(atoi(str)); } else pValue = PyInt_FromLong(pfuncs[ifunc].ivalue[i]); } else if (itype == DOUBLE) { if (pfuncs[ifunc].ivarflag[i]) { str = input->variable->retrieve(pfuncs[ifunc].svalue[i]); - if (!str) + if (!str) error->all(FLERR,"Could not evaluate Python function input variable"); pValue = PyFloat_FromDouble(atof(str)); } else pValue = PyFloat_FromDouble(pfuncs[ifunc].dvalue[i]); } else if (itype == STRING) { if (pfuncs[ifunc].ivarflag[i]) { str = input->variable->retrieve(pfuncs[ifunc].svalue[i]); - if (!str) + if (!str) error->all(FLERR,"Could not evaluate Python function input variable"); pValue = PyString_FromString(str); } else pValue = PyString_FromString(pfuncs[ifunc].svalue[i]); } else if (itype == PTR) { pValue = PyCObject_FromVoidPtr((void *) lmp,NULL); } - PyTuple_SetItem(pArgs,i,pValue); + PyTuple_SetItem(pArgs,i,pValue); } // call the Python function @@ -297,7 +297,7 @@ int Python::create_entry(char *name) if (ifunc < 0) { ifunc = nfunc; nfunc++; - pfuncs = (PyFunc *) + pfuncs = (PyFunc *) memory->srealloc(pfuncs,nfunc*sizeof(struct PyFunc),"python:pfuncs"); int n = strlen(name) + 1; pfuncs[ifunc].name = new char[n]; @@ -306,10 +306,10 @@ int Python::create_entry(char *name) pfuncs[ifunc].ninput = ninput; pfuncs[ifunc].noutput = noutput; - + if (!format && ninput+noutput) error->all(FLERR,"Invalid python command"); - else if (format && strlen(format) != ninput+noutput) + else if (format && strlen(format) != ninput+noutput) error->all(FLERR,"Invalid python command"); // process inputs as values or variables @@ -361,12 +361,12 @@ int Python::create_entry(char *name) } else if (type == 'p') { pfuncs[ifunc].ivarflag[i] = 0; pfuncs[ifunc].itype[i] = PTR; - if (strcmp(istr[i],"SELF") != 0) + if (strcmp(istr[i],"SELF") != 0) error->all(FLERR,"Invalid python command"); } else error->all(FLERR,"Invalid python command"); } - + // process output as value or variable pfuncs[ifunc].ovarname = NULL; diff --git a/src/PYTHON/python.h b/src/PYTHON/python.h index 55525c266be2d43425181132c0acd4603a873a39..d1622728ac38962903e298b04653fa5faaf213b9 100644 --- a/src/PYTHON/python.h +++ b/src/PYTHON/python.h @@ -34,7 +34,7 @@ class Python : protected Pointers { char **istr; char *ostr,*format; void *pyMain; - + struct PyFunc { char *name; int ninput,noutput; diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 96e7a036b9a00e2690e3c7b63e94b137ad900275..0c322634db95e38f950a516315437a9e1662b294 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -16,10 +16,10 @@ Based on fix qeq/reax by H. Metin Aktulga ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_qeq.h" #include "atom.h" #include "comm.h" @@ -49,7 +49,7 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 8) error->all(FLERR,"Illegal fix qeq command"); - + nevery = force->inumeric(FLERR,arg[3]); cutoff = force->numeric(FLERR,arg[4]); tolerance = force->numeric(FLERR,arg[5]); @@ -101,7 +101,7 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : s_hist = t_hist = NULL; grow_arrays(atom->nmax); atom->add_callback(0); - + for( int i = 0; i < atom->nmax; i++ ) for (int j = 0; j < nprev; ++j ) s_hist[i][j] = t_hist[i][j] = atom->q[i]; @@ -618,7 +618,7 @@ double FixQEq::parallel_dot( double *v1, double *v2, int n) if (atom->mask[i] & groupbit) my_dot += v1[i] * v2[i]; } - + MPI_Allreduce( &my_dot, &res, 1, MPI_DOUBLE, MPI_SUM, world ); return res; diff --git a/src/QEQ/fix_qeq_dynamic.cpp b/src/QEQ/fix_qeq_dynamic.cpp index 42f9cd324da46fbee5c563596cbd217fa6c32935..8e8247e121b4dad2a6cfa0f7867f0bf6bec40674 100644 --- a/src/QEQ/fix_qeq_dynamic.cpp +++ b/src/QEQ/fix_qeq_dynamic.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_qeq_dynamic.h" #include "atom.h" #include "comm.h" @@ -39,8 +39,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -FixQEqDynamic::FixQEqDynamic(LAMMPS *lmp, int narg, char **arg) : - FixQEq(lmp, narg, arg) +FixQEqDynamic::FixQEqDynamic(LAMMPS *lmp, int narg, char **arg) : + FixQEq(lmp, narg, arg) { qdamp = 0.10; qstep = 0.02; @@ -76,7 +76,7 @@ void FixQEqDynamic::init() neighbor->requests[irequest]->half = 1; neighbor->requests[irequest]->full = 0; - if (tolerance < 1e-4) + if (tolerance < 1e-4) if (comm->me == 0) error->warning(FLERR,"Fix qeq/dynamic tolerance may be too small" " for damped dynamics"); diff --git a/src/QEQ/fix_qeq_point.cpp b/src/QEQ/fix_qeq_point.cpp index d7dcb0d9a4828c24ca77a5b386d02455598a628b..9af70a445abe3431c536993ef7a666c267c89bda 100644 --- a/src/QEQ/fix_qeq_point.cpp +++ b/src/QEQ/fix_qeq_point.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_qeq_point.h" #include "atom.h" #include "comm.h" @@ -45,7 +45,7 @@ FixQEqPoint::FixQEqPoint(LAMMPS *lmp, int narg, char **arg) : void FixQEqPoint::init() { - if (!atom->q_flag) + if (!atom->q_flag) error->all(FLERR,"Fix qeq/point requires atom attribute q"); ngroup = group->count(igroup); diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index 7c7ca6d155822d80197ecfc8aaea2e7339631aca..661dd73f7b1c9f0ffae392a356297f454b431958 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_qeq_shielded.h" #include "atom.h" #include "comm.h" @@ -45,7 +45,7 @@ FixQEqShielded::FixQEqShielded(LAMMPS *lmp, int narg, char **arg) : void FixQEqShielded::init() { - if (!atom->q_flag) + if (!atom->q_flag) error->all(FLERR,"Fix qeq/shielded requires atom attribute q"); ngroup = group->count(igroup); @@ -64,7 +64,7 @@ void FixQEqShielded::init() int i; for (i = 1; i <= ntypes; i++) { - if (gamma[i] == 0.0) + if (gamma[i] == 0.0) error->all(FLERR,"Invalid param file for fix qeq/shielded"); } @@ -219,7 +219,7 @@ void FixQEqShielded::compute_H() /* ---------------------------------------------------------------------- */ double FixQEqShielded::calculate_H( double r, double gamma ) -{ +{ double Taper, denom; Taper = Tap[7] * r + Tap[6]; diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 36b3b2c65fa2af424faa379729758b2d4b72c10f..ad1c65210069da9668f91e963afd4ec171b50398 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_qeq_slater.h" #include "atom.h" #include "comm.h" @@ -42,8 +42,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixQEqSlater::FixQEqSlater(LAMMPS *lmp, int narg, char **arg) : - FixQEq(lmp, narg, arg) +FixQEqSlater::FixQEqSlater(LAMMPS *lmp, int narg, char **arg) : + FixQEq(lmp, narg, arg) { alpha = 0.20; @@ -64,7 +64,7 @@ FixQEqSlater::FixQEqSlater(LAMMPS *lmp, int narg, char **arg) : void FixQEqSlater::init() { - if (!atom->q_flag) + if (!atom->q_flag) error->all(FLERR,"Fix qeq/slater requires atom attribute q"); ngroup = group->count(igroup); @@ -78,7 +78,7 @@ void FixQEqSlater::init() int ntypes = atom->ntypes; for (int i = 1; i <= ntypes; i++) { - if (zeta[i] == 0.0) + if (zeta[i] == 0.0) error->all(FLERR,"Invalid param file for fix qeq/slater"); } @@ -106,7 +106,7 @@ void FixQEqSlater::extract_streitz() gamma = (double *) pair->extract("gamma",tmp); zeta = (double *) pair->extract("zeta",tmp); zcore = (double *) pair->extract("zcore",tmp); - if (chi == NULL || eta == NULL || gamma == NULL + if (chi == NULL || eta == NULL || gamma == NULL || zeta == NULL || zcore == NULL) error->all(FLERR, "Fix qeq/slater could not extract params from pair coul/streitz"); @@ -230,7 +230,7 @@ void FixQEqSlater::compute_H() /* ---------------------------------------------------------------------- */ -double FixQEqSlater::calculate_H(double zei, double zej, double zj, +double FixQEqSlater::calculate_H(double zei, double zej, double zj, double r, double &zjtmp) { double rinv = 1.0/r; @@ -283,7 +283,7 @@ double FixQEqSlater::calculate_H(double zei, double zej, double zj, /* ---------------------------------------------------------------------- */ -double FixQEqSlater::calculate_H_wolf(double zei, double zej, double zj, +double FixQEqSlater::calculate_H_wolf(double zei, double zej, double zj, double r, double &zjtmp) { double rinv = 1.0/r; @@ -339,14 +339,14 @@ double FixQEqSlater::calculate_H_wolf(double zei, double zej, double zj, ((zei+zej)*(zei+zej)*(zei+zej)*(zej-zei)*(zej-zei)*(zej-zei)); eshift = -exp2zirsh*(e1+e3/rc) - exp2zjrsh*(e2+e4/rc); - ci_fifj = -exp2zir*(e1+e3/r) - exp2zjr*(e2+e4/r) + ci_fifj = -exp2zir*(e1+e3/r) - exp2zjr*(e2+e4/r) - eshift - (r-rc)*fshift; } etmp1 = erfcr/r - erfcrc/rc; etmp2 = 1.00 * (ci_jfi - ci_fifj); etmp3 = 0.50 * (etmp1 + ci_fifj); - + zjtmp += qqrd2e * zj * etmp2; return qqrd2e * etmp3; diff --git a/src/REAX/fix_reax_bonds.cpp b/src/REAX/fix_reax_bonds.cpp index 7efc20f82d919e901eec571a503a5f2ce411a6fb..2574d991aec3023a674d80c34f5079ece41eb7ad 100644 --- a/src/REAX/fix_reax_bonds.cpp +++ b/src/REAX/fix_reax_bonds.cpp @@ -19,8 +19,8 @@ #error LAMMPS_BIGBIG is not supported by the REAX package #endif -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_reax_bonds.h" #include "pair_reax_fortran.h" #include "atom.h" diff --git a/src/REAX/fix_reax_bonds.h b/src/REAX/fix_reax_bonds.h index 9bb1743f95c24da1a1e275589222e79c1daeac6c..dc7c6d389e829e751f5781ee6d2c7aa5be2fe822 100644 --- a/src/REAX/fix_reax_bonds.h +++ b/src/REAX/fix_reax_bonds.h @@ -20,7 +20,7 @@ FixStyle(reax/bonds,FixReaxBonds) #ifndef LMP_FIX_REAX_BONDS_H #define LMP_FIX_REAX_BONDS_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/REAX/pair_reax.cpp b/src/REAX/pair_reax.cpp index e3674cb40172079c51983daa0cf2729071f3bf52..642bf78d9152d76df051d6c74a137691e87b1fba 100644 --- a/src/REAX/pair_reax.cpp +++ b/src/REAX/pair_reax.cpp @@ -20,11 +20,11 @@ and Ardi Van Duin's original ReaxFF code ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_reax.h" #include "pair_reax_fortran.h" #include "atom.h" @@ -626,7 +626,7 @@ double PairREAX::init_one(int i, int j) /* ---------------------------------------------------------------------- */ -int PairREAX::pack_forward_comm(int n, int *list, double *buf, +int PairREAX::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index 7f1db90481fce9dedbf62c83666e7f38dd44629c..7ff803459edc811e989b3c3decb24017e91a2869 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -15,10 +15,10 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "compute_event_displace.h" #include "atom.h" #include "domain.h" diff --git a/src/REPLICA/fix_event.cpp b/src/REPLICA/fix_event.cpp index 77cb2dc31424b740bdb8629ee467856954b98186..f3276178e2ac9c59ca20859d27605b2f2ee651f5 100644 --- a/src/REPLICA/fix_event.cpp +++ b/src/REPLICA/fix_event.cpp @@ -15,8 +15,8 @@ Contributing author: Mike Brown (SNL), Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_event.h" #include "atom.h" #include "update.h" diff --git a/src/REPLICA/fix_event_prd.cpp b/src/REPLICA/fix_event_prd.cpp index 57db1e17b7873f1eb229a2727a02f5a54b89f79a..863caa64f240f999b920bf11ebe9bf7cf0e17ccd 100644 --- a/src/REPLICA/fix_event_prd.cpp +++ b/src/REPLICA/fix_event_prd.cpp @@ -15,8 +15,8 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_event_prd.h" #include "atom.h" #include "update.h" diff --git a/src/REPLICA/fix_event_tad.cpp b/src/REPLICA/fix_event_tad.cpp index aed1d75437cdd081f1fb80b10fcb0776844f8784..b2d74855faf08cb6001256be13e9a1caf894ce84 100644 --- a/src/REPLICA/fix_event_tad.cpp +++ b/src/REPLICA/fix_event_tad.cpp @@ -15,8 +15,8 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_event_tad.h" #include "atom.h" #include "update.h" diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp index e254339da57d2729d70d22064b06ab2a485cb35f..c66fa2dd04b5b9f9ae0025192e547d7bfbf222dc 100644 --- a/src/REPLICA/fix_neb.cpp +++ b/src/REPLICA/fix_neb.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_neb.h" #include "universe.h" #include "update.h" diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 6e5399ba8263bbea09a013d5127272c3268de4b9..68d2af8bd9d4024fb2966435692397eb6ccecb35 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -15,11 +15,11 @@ // due to OpenMPI bug which sets INT64_MAX via its mpi.h // before lmptype.h can set flags to insure it is done correctly -#include "lmptype.h" -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include "lmptype.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "neb.h" #include "universe.h" #include "atom.h" @@ -418,11 +418,11 @@ void NEB::readfile(char *file, int flag) for (i = 0; i < nchunk; i++) { next = strchr(buf,'\n'); - + values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) values[j] = strtok(NULL," \t\n\r\f"); - + // adjust atom coord based on replica fraction // for flag = 0, interpolate for intermediate and final replicas // for flag = 1, replace existing coord with new coord diff --git a/src/REPLICA/neb.h b/src/REPLICA/neb.h index 08ab5c989b8a296e821b5bef02e66cfab5d10abe..00719dcc95fa5ae1456448c0129e08375956b7ea 100644 --- a/src/REPLICA/neb.h +++ b/src/REPLICA/neb.h @@ -20,7 +20,7 @@ CommandStyle(neb,NEB) #ifndef LMP_NEB_H #define LMP_NEB_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index 57aaf485f49a7e46de181f729d2e58700cafaacf..fcdfa67cccd0271cddf21258ac9650043dbe432b 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -19,11 +19,11 @@ // due to OpenMPI bug which sets INT64_MAX via its mpi.h // before lmptype.h can set flags to insure it is done correctly -#include "lmptype.h" -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include "lmptype.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "prd.h" #include "universe.h" #include "update.h" @@ -431,12 +431,12 @@ void PRD::command(int narg, char **arg) if (me_universe == 0) { if (universe->uscreen) fprintf(universe->uscreen, - "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT + "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT " atoms\n", timer->get_wall(Timer::TOTAL),nprocs_universe,nsteps,atom->natoms); if (universe->ulogfile) fprintf(universe->ulogfile, - "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT + "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT " atoms\n", timer->get_wall(Timer::TOTAL),nprocs_universe,nsteps,atom->natoms); } @@ -695,7 +695,7 @@ void PRD::share_event(int ireplica, int flag, int decrement) if (flag != 2) delta *= universe->nworlds; if (delta > 0 && flag != 2) delta -= decrement; delta += corr_adjust; - + // delta passed to store_event_prd() should make its clock update // be consistent with clock in main PRD loop // don't change the clock or timestep if this is a restart diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index 0f46867f99bc587ac44b42f3a84908995c7e67bc..25043a0f8a3645229053099f9627cf7a8bffe4b7 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -19,11 +19,11 @@ // due to OpenMPI bug which sets INT64_MAX via its mpi.h // before lmptype.h can set flags to insure it is done correctly -#include "lmptype.h" -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include "lmptype.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "tad.h" #include "universe.h" #include "update.h" @@ -104,14 +104,14 @@ void TAD::command(int narg, char **arg) char *id_compute = new char[strlen(arg[6])+1]; strcpy(id_compute,arg[6]); - + // quench minimizer is set by min_style command // NEB minimizer is set by options, default = quickmin int n = strlen(update->minimize_style) + 1; min_style = new char[n]; strcpy(min_style,update->minimize_style); - + options(narg-7,&arg[7]); // total # of timesteps must be multiple of t_event @@ -396,12 +396,12 @@ void TAD::command(int narg, char **arg) if (me_universe == 0) { if (universe->uscreen) fprintf(universe->uscreen, - "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT + "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT " atoms\n", timer->get_wall(Timer::TOTAL),nprocs_universe,nsteps,atom->natoms); - if (universe->ulogfile) + if (universe->ulogfile) fprintf(universe->ulogfile, - "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT + "Loop time of %g on %d procs for %d steps with " BIGINT_FORMAT " atoms\n", timer->get_wall(Timer::TOTAL),nprocs_universe,nsteps,atom->natoms); } diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 8771ab53758642a83d3f8a3694e6435777c6bfc4..17c2c30fcaa390e3d6004bd3a4d09108bc0985dd 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -15,9 +15,9 @@ Contributing author: Mark Sears (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "temper.h" #include "universe.h" #include "domain.h" diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index dbb2660eb51eaf78a344ece79eedb281f3bc48ac..5985c756ad1fff8d70e7e0b8e567a2e0e8002751 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -15,7 +15,7 @@ Contributing authors: Yuxing Peng and Chris Knight (U Chicago) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "verlet_split.h" #include "universe.h" #include "neighbor.h" @@ -52,7 +52,7 @@ VerletSplit::VerletSplit(LAMMPS *lmp, int narg, char **arg) : if (universe->procs_per_world[0] % universe->procs_per_world[1]) error->universe_all(FLERR,"Verlet/split requires Rspace partition " "size be multiple of Kspace partition size"); - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"Verlet/split can only currently be used with " "comm_style brick"); @@ -217,7 +217,7 @@ VerletSplit::~VerletSplit() void VerletSplit::init() { - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"Verlet/split can only currently be used with " "comm_style brick"); if (!force->kspace && comm->me == 0) diff --git a/src/RIGID/compute_erotate_rigid.cpp b/src/RIGID/compute_erotate_rigid.cpp index 336f988ee94889f5312a92913c298a932c0b8307..2b156b5ca91c19cf326981487cdc425704b5714a 100644 --- a/src/RIGID/compute_erotate_rigid.cpp +++ b/src/RIGID/compute_erotate_rigid.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_erotate_rigid.h" #include "update.h" #include "force.h" @@ -52,7 +52,7 @@ ComputeERotateRigid::~ComputeERotateRigid() void ComputeERotateRigid::init() { irfix = modify->find_fix(rfix); - if (irfix < 0) + if (irfix < 0) error->all(FLERR,"Fix ID for compute erotate/rigid does not exist"); int flag = 1; diff --git a/src/RIGID/compute_ke_rigid.cpp b/src/RIGID/compute_ke_rigid.cpp index 671e17f69b2e0876f79cde4ec90435c821964517..7bd2a032c9238943c0c83208475d5145c8153cb6 100644 --- a/src/RIGID/compute_ke_rigid.cpp +++ b/src/RIGID/compute_ke_rigid.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_ke_rigid.h" #include "update.h" #include "force.h" diff --git a/src/RIGID/fix_rattle.cpp b/src/RIGID/fix_rattle.cpp index 59fa6ed359ff9f10f4a6f4a6e4f3511c4c1b890f..f07e5fe2528eb2fa120b023cc4aa075b1aa30de1 100644 --- a/src/RIGID/fix_rattle.cpp +++ b/src/RIGID/fix_rattle.cpp @@ -15,11 +15,11 @@ Contributing author: Peter Wirnsberger (University of Cambridge) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" -#include "stdio.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> #include "fix_rattle.h" #include "atom.h" #include "atom_vec.h" @@ -79,7 +79,7 @@ FixRattle::FixRattle(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ FixRattle::~FixRattle() -{ +{ memory->destroy(vp); } @@ -89,11 +89,11 @@ int FixRattle::setmask() { int mask = 0; mask |= PRE_NEIGHBOR; - mask |= POST_FORCE; + mask |= POST_FORCE; mask |= POST_FORCE_RESPA; mask |= FINAL_INTEGRATE; mask |= FINAL_INTEGRATE_RESPA; - if (RATTLE_DEBUG) mask |= END_OF_STEP; + if (RATTLE_DEBUG) mask |= END_OF_STEP; return mask; } @@ -149,10 +149,10 @@ void FixRattle::post_force(int vflag) int m; for (int i = 0; i < nlist; i++) { m = list[i]; - if (shake_flag[m] == 2) vrattle2(m); - else if (shake_flag[m] == 3) vrattle3(m); - else if (shake_flag[m] == 4) vrattle4(m); - else vrattle3angle(m); + if (shake_flag[m] == 2) vrattle2(m); + else if (shake_flag[m] == 3) vrattle3(m); + else if (shake_flag[m] == 4) vrattle4(m); + else vrattle3angle(m); } } @@ -231,7 +231,7 @@ void FixRattle::vrattle3angle(int m) domain->minimum_image(r02); domain->minimum_image(r12); - // v01,v02,v12 = velocity differences + // v01,v02,v12 = velocity differences MathExtra::sub3(vp[i1],vp[i0],vp01); MathExtra::sub3(vp[i2],vp[i0],vp02); MathExtra::sub3(vp[i2],vp[i1],vp12); @@ -252,7 +252,7 @@ void FixRattle::vrattle3angle(int m) a[0][1] = (imass[0] ) * MathExtra::dot3(r01,r02); a[0][2] = (-imass[1] ) * MathExtra::dot3(r01,r12); a[1][0] = a[0][1]; - a[1][1] = (imass[0] + imass[2]) * MathExtra::dot3(r02,r02); + a[1][1] = (imass[0] + imass[2]) * MathExtra::dot3(r02,r02); a[1][2] = (imass[2] ) * MathExtra::dot3(r02,r12); a[2][0] = a[0][2]; a[2][1] = a[1][2]; @@ -268,15 +268,15 @@ void FixRattle::vrattle3angle(int m) // add corrections to the velocities if processor owns atom if (i0 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i0][k] -= imass[0]* ( l[0] * r01[k] + l[1] * r02[k] ); - } + } if (i1 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i1][k] -= imass[1] * ( -l[0] * r01[k] + l[2] * r12[k] ); } if (i2 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i2][k] -= imass[2] * ( -l[1] * r02[k] - l[2] * r12[k] ); } } @@ -309,16 +309,16 @@ void FixRattle::vrattle2(int m) } // Lagrange multiplier: exact solution - double l01 = - MathExtra::dot3(r01,vp01) / + double l01 = - MathExtra::dot3(r01,vp01) / (MathExtra::dot3(r01,r01) * (imass[0] + imass[1])); // add corrections to the velocities if the process owns this atom if (i0 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i0][k] -= imass[0] * l01 * r01[k]; - } + } if (i1 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i1][k] -= imass[1] * (-l01) * r01[k]; } } @@ -339,7 +339,7 @@ void FixRattle::vrattle3(int m) // r01,r02 = distance vec between atoms, with PBC MathExtra::sub3(x[i1],x[i0],r01); MathExtra::sub3(x[i2],x[i0],r02); - + domain->minimum_image(r01); domain->minimum_image(r02); @@ -372,15 +372,15 @@ void FixRattle::vrattle3(int m) // add corrections to the velocities if the process owns this atom if (i0 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i0][k] -= imass[0] * ( l[0] * r01[k] + l[1] * r02[k] ); - } - if (i1 < nlocal) + } + if (i1 < nlocal) for (int k=0; k<3; k++) { v[i1][k] -= imass[1] * ( -l[0] * r01[k] ); } if (i2 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i2][k] -= imass[2] * ( -l[1] * r02[k] ); } } @@ -447,26 +447,26 @@ void FixRattle::vrattle4(int m) // add corrections to the velocities if the process owns this atom if (i0 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i0][k] -= imass[0] * ( l[0] * r01[k] + l[1] * r02[k] + l[2] * r03[k]); - } + } if (i1 < nlocal) { - for (int k=0; k<3; k++) - v[i1][k] -= imass[1] * (-l[0] * r01[k]); + for (int k=0; k<3; k++) + v[i1][k] -= imass[1] * (-l[0] * r01[k]); } if (i2 < nlocal) { - for (int k=0; k<3; k++) + for (int k=0; k<3; k++) v[i2][k] -= imass[2] * ( -l[1] * r02[k]); } if (i3 < nlocal) { - for (int k=0; k<3; k++) - v[i3][k] -= imass[3] * ( -l[2] * r03[k]); + for (int k=0; k<3; k++) + v[i3][k] -= imass[3] * ( -l[2] * r03[k]); } } /* ---------------------------------------------------------------------- */ -void FixRattle::solve2x2exactly(const double a[][2], +void FixRattle::solve2x2exactly(const double a[][2], const double c[], double l[]) { double determ, determinv; @@ -485,24 +485,24 @@ void FixRattle::solve2x2exactly(const double a[][2], /* ---------------------------------------------------------------------- */ -void FixRattle::solve3x3exactly(const double a[][3], +void FixRattle::solve3x3exactly(const double a[][3], const double c[], double l[]) { double ai[3][3]; double determ, determinv; - + // calculate the determinant of the matrix - determ = a[0][0]*a[1][1]*a[2][2] + a[0][1]*a[1][2]*a[2][0] + - a[0][2]*a[1][0]*a[2][1] - a[0][0]*a[1][2]*a[2][1] - + determ = a[0][0]*a[1][1]*a[2][2] + a[0][1]*a[1][2]*a[2][0] + + a[0][2]*a[1][0]*a[2][1] - a[0][0]*a[1][2]*a[2][1] - a[0][1]*a[1][0]*a[2][2] - a[0][2]*a[1][1]*a[2][0]; - + // check if matrix is actually invertible if (determ == 0.0) error->one(FLERR,"RATTLE determinant = 0.0"); // calculate the inverse 3x3 matrix: A^(-1) = (ai_jk) determinv = 1.0/determ; ai[0][0] = determinv * (a[1][1]*a[2][2] - a[1][2]*a[2][1]); - ai[0][1] = -determinv * (a[0][1]*a[2][2] - a[0][2]*a[2][1]); + ai[0][1] = -determinv * (a[0][1]*a[2][2] - a[0][2]*a[2][1]); ai[0][2] = determinv * (a[0][1]*a[1][2] - a[0][2]*a[1][1]); ai[1][0] = -determinv * (a[1][0]*a[2][2] - a[1][2]*a[2][0]); ai[1][1] = determinv * (a[0][0]*a[2][2] - a[0][2]*a[2][0]); @@ -514,9 +514,9 @@ void FixRattle::solve3x3exactly(const double a[][3], // calculate the solution: (l01, l02, l12)^T = A^(-1) * c for (int i=0; i<3; i++) { l[i] = 0; - for (int j=0; j<3; j++) + for (int j=0; j<3; j++) l[i] += ai[i][j] * c[j]; - } + } } /* ---------------------------------------------------------------------- */ @@ -632,7 +632,7 @@ int FixRattle::pack_forward_comm(int n, int *list, double *buf, break; } return m; -} +} /* ---------------------------------------------------------------------- */ @@ -686,7 +686,7 @@ void FixRattle::coordinate_constraints_end_of_step() { /* ---------------------------------------------------------------------- DEBUGGING methods - The functions below allow you to check whether the + The functions below allow you to check whether the coordinate and velocity constraints are satisfied at the end of the timestep only enabled if RATTLE_DEBUG is set to 1 at top of file @@ -698,7 +698,7 @@ void FixRattle::end_of_step() // communicate velocities and coordinates (x and v) if (nprocs > 1) { comm_mode = V; - comm->forward_comm_fix(this); + comm->forward_comm_fix(this); comm_mode = X; comm->forward_comm_fix(this); } @@ -716,9 +716,9 @@ bool FixRattle::check_constraints(double **v, bool checkr, bool checkv) int i=0; while (i < nlist && ret) { m = list[i]; - if (shake_flag[m] == 2) ret = check2(v,m,checkr,checkv); - else if (shake_flag[m] == 3) ret = check3(v,m,checkr,checkv); - else if (shake_flag[m] == 4) ret = check4(v,m,checkr,checkv); + if (shake_flag[m] == 2) ret = check2(v,m,checkr,checkv); + else if (shake_flag[m] == 3) ret = check3(v,m,checkr,checkv); + else if (shake_flag[m] == 4) ret = check4(v,m,checkr,checkv); else ret = check3angle(v,m,checkr,checkv); i++; } @@ -733,7 +733,7 @@ bool FixRattle::check2(double **v, int m, bool checkr, bool checkv) double r01[3],v01[3]; const double tol = tolerance; double bond1 = bond_distance[shake_type[m][0]]; - + tagint i0 = atom->map(shake_atom[m][0]); tagint i1 = atom->map(shake_atom[m][1]); @@ -742,12 +742,12 @@ bool FixRattle::check2(double **v, int m, bool checkr, bool checkv) MathExtra::sub3(v[i1],v[i0],v01); stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol)); - if (!stat) + if (!stat) error->one(FLERR,"RATTLE coordinate constraints are not satisfied " "up to desired tolerance"); stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol)); - if (!stat) + if (!stat) error->one(FLERR,"RATTLE velocity constraints are not satisfied " "up to desired tolerance"); return stat; @@ -763,14 +763,14 @@ bool FixRattle::check3(double **v, int m, bool checkr, bool checkv) const double tol = tolerance; double bond1 = bond_distance[shake_type[m][0]]; double bond2 = bond_distance[shake_type[m][1]]; - + i0 = atom->map(shake_atom[m][0]); i1 = atom->map(shake_atom[m][1]); i2 = atom->map(shake_atom[m][2]); MathExtra::sub3(x[i1],x[i0],r01); MathExtra::sub3(x[i2],x[i0],r02); - + domain->minimum_image(r01); domain->minimum_image(r02); @@ -779,13 +779,13 @@ bool FixRattle::check3(double **v, int m, bool checkr, bool checkv) stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol || fabs(sqrt(MathExtra::dot3(r02,r02))-bond2) > tol)); - if (!stat) + if (!stat) error->one(FLERR,"RATTLE coordinate constraints are not satisfied " "up to desired tolerance"); - stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol || + stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol || fabs(MathExtra::dot3(r02,v02)) > tol)); - if (!stat) + if (!stat) error->one(FLERR,"RATTLE velocity constraints are not satisfied " "up to desired tolerance"); return stat; @@ -819,17 +819,17 @@ bool FixRattle::check4(double **v, int m, bool checkr, bool checkv) MathExtra::sub3(v[i2],v[i0],v02); MathExtra::sub3(v[i3],v[i0],v03); - stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol || - fabs(sqrt(MathExtra::dot3(r02,r02))-bond2) > tol || + stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol || + fabs(sqrt(MathExtra::dot3(r02,r02))-bond2) > tol || fabs(sqrt(MathExtra::dot3(r03,r03))-bond3) > tol)); - if (!stat) + if (!stat) error->one(FLERR,"RATTLE coordinate constraints are not satisfied " "up to desired tolerance"); - stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol || - fabs(MathExtra::dot3(r02,v02)) > tol || + stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol || + fabs(MathExtra::dot3(r02,v02)) > tol || fabs(MathExtra::dot3(r03,v03)) > tol)); - if (!stat) + if (!stat) error->one(FLERR,"RATTLE velocity constraints are not satisfied " "up to desired tolerance"); return stat; @@ -862,17 +862,17 @@ bool FixRattle::check3angle(double **v, int m, bool checkr, bool checkv) MathExtra::sub3(v[i2],v[i0],v02); MathExtra::sub3(v[i2],v[i1],v12); - stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol || - fabs(sqrt(MathExtra::dot3(r02,r02))-bond2) > tol || + stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol || + fabs(sqrt(MathExtra::dot3(r02,r02))-bond2) > tol || fabs(sqrt(MathExtra::dot3(r12,r12))-bond12) > tol)); - if (!stat) + if (!stat) error->one(FLERR,"RATTLE coordinate constraints are not satisfied " "up to desired tolerance"); - stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol || - fabs(MathExtra::dot3(r02,v02)) > tol || + stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol || + fabs(MathExtra::dot3(r02,v02)) > tol || fabs(MathExtra::dot3(r12,v12)) > tol)); - if (!stat) + if (!stat) error->one(FLERR,"RATTLE velocity constraints are not satisfied " "up to desired tolerance"); return stat; diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 2f7cc31f155123ad82bfe084b4230fbf8ee2656d..32917a53d73e714ab65589290597df70f2a8802d 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_rigid.h" #include "math_extra.h" #include "atom.h" @@ -132,7 +132,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : tagint itmp; MPI_Allreduce(&maxmol_tag,&itmp,1,MPI_LMP_TAGINT,MPI_MAX,world); - if (itmp+1 > MAXSMALLINT) + if (itmp+1 > MAXSMALLINT) error->all(FLERR,"Too many molecules for fix rigid"); maxmol = (int) itmp; @@ -251,7 +251,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } // number of linear rigid bodies is counted later - nlinear = 0; + nlinear = 0; // parse optional args @@ -270,12 +270,12 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : pcouple = NONE; pstyle = ANISO; dimension = domain->dimension; - + for (int i = 0; i < 3; i++) { p_start[i] = p_stop[i] = p_period[i] = 0.0; p_flag[i] = 0; } - + while (iarg < narg) { if (strcmp(arg[iarg],"force") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix rigid command"); @@ -341,7 +341,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"langevin") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix rigid command"); - if (strcmp(style,"rigid") != 0 && strcmp(style,"rigid/nve") != 0 && + if (strcmp(style,"rigid") != 0 && strcmp(style,"rigid/nve") != 0 && strcmp(style,"rigid/omp") != 0 && strcmp(style,"rigid/nve/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); langflag = 1; @@ -357,7 +357,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"temp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0 && - strcmp(style,"rigid/nvt/omp") != 0 && + strcmp(style,"rigid/nvt/omp") != 0 && strcmp(style,"rigid/npt/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); tstat_flag = 1; @@ -369,13 +369,13 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"iso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0 && - strcmp(style,"rigid/npt/omp") != 0 && + strcmp(style,"rigid/npt/omp") != 0 && strcmp(style,"rigid/nph/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); pcouple = XYZ; p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { @@ -387,12 +387,12 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"aniso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0 && - strcmp(style,"rigid/npt/omp") != 0 && + strcmp(style,"rigid/npt/omp") != 0 && strcmp(style,"rigid/nph/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { @@ -404,7 +404,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0 && - strcmp(style,"rigid/npt/omp") != 0 && + strcmp(style,"rigid/npt/omp") != 0 && strcmp(style,"rigid/nph/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); p_start[0] = force->numeric(FLERR,arg[iarg+1]); @@ -416,7 +416,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0 && - strcmp(style,"rigid/npt/omp") != 0 && + strcmp(style,"rigid/npt/omp") != 0 && strcmp(style,"rigid/nph/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); p_start[1] = force->numeric(FLERR,arg[iarg+1]); @@ -428,7 +428,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0 && - strcmp(style,"rigid/npt/omp") != 0 && + strcmp(style,"rigid/npt/omp") != 0 && strcmp(style,"rigid/nph/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); p_start[2] = force->numeric(FLERR,arg[iarg+1]); @@ -448,7 +448,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"dilate") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid npt/nph command"); if (strcmp(arg[iarg+1],"all") == 0) allremap = 1; else { @@ -466,8 +466,8 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"tparam") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); - if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0 && - strcmp(style,"rigid/nvt/omp") != 0 && + if (strcmp(style,"rigid/nvt") != 0 && strcmp(style,"rigid/npt") != 0 && + strcmp(style,"rigid/nvt/omp") != 0 && strcmp(style,"rigid/npt/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); t_chain = force->inumeric(FLERR,arg[iarg+1]); @@ -477,8 +477,8 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid command"); - if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0 && - strcmp(style,"rigid/npt/omp") != 0 && + if (strcmp(style,"rigid/npt") != 0 && strcmp(style,"rigid/nph") != 0 && + strcmp(style,"rigid/npt/omp") != 0 && strcmp(style,"rigid/nph/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); p_chain = force->inumeric(FLERR,arg[iarg+1]); @@ -495,16 +495,16 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix rigid command"); } - + // set pstat_flag pstat_flag = 0; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) if (p_flag[i]) pstat_flag = 1; if (pcouple == XYZ || (dimension == 2 && pcouple == XY)) pstyle = ISO; else pstyle = ANISO; - + // initialize Marsaglia RNG with processor-unique seed if (langflag) random = new RanMars(lmp,seed + me); @@ -1035,7 +1035,7 @@ void FixRigid::final_integrate_respa(int ilevel, int iloop) xcmimage flags are relative to xcm so that body can be unwrapped if don't do this, would need xcm to move with true image flags then a body could end up very far away from box - set_xv() will then compute huge displacements every step to + set_xv() will then compute huge displacements every step to reset coords of all body atoms to be back inside the box, ditto for triclinic box flip, which causes numeric problems ------------------------------------------------------------------------- */ @@ -1089,7 +1089,7 @@ int FixRigid::dof(int tgroup) // cannot count DOF correctly unless setup_bodies_static() has been called if (!setupflag) { - if (comm->me == 0) + if (comm->me == 0) error->warning(FLERR,"Cannot count rigid body degrees-of-freedom " "before bodies are initialized"); return 0; @@ -1668,7 +1668,7 @@ void FixRigid::setup_bodies_static() // set rigid body image flags to default values for (ibody = 0; ibody < nbody; ibody++) - imagebody[ibody] = ((imageint) IMGMAX << IMG2BITS) | + imagebody[ibody] = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; // overwrite masstotal, center-of-mass, image flags with file values @@ -2122,7 +2122,7 @@ void FixRigid::setup_bodies_dynamic() vxcm vycm vzcm lx ly lz ix iy iz ------------------------------------------------------------------------- */ -void FixRigid::readfile(int which, double *vec, +void FixRigid::readfile(int which, double *vec, double **array1, double **array2, double **array3, imageint *ivec, int *inbody) { @@ -2131,7 +2131,7 @@ void FixRigid::readfile(int which, double *vec, FILE *fp; char *eof,*start,*next,*buf; char line[MAXLINE]; - + if (me == 0) { fp = fopen(infile,"r"); if (fp == NULL) { @@ -2170,7 +2170,7 @@ void FixRigid::readfile(int which, double *vec, if (nwords != ATTRIBUTE_PERBODY) error->all(FLERR,"Incorrect rigid body format in fix rigid file"); - + // loop over lines of rigid body attributes // tokenize the line into values // id = rigid body ID @@ -2180,19 +2180,19 @@ void FixRigid::readfile(int which, double *vec, for (int i = 0; i < nchunk; i++) { next = strchr(buf,'\n'); - + values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) values[j] = strtok(NULL," \t\n\r\f"); - + id = atoi(values[0]); if (rstyle == MOLECULE) { - if (id <= 0 || id > maxmol) + if (id <= 0 || id > maxmol) error->all(FLERR,"Invalid rigid body ID in fix rigid file"); id = mol2body[id]; } else id--; - if (id < 0 || id >= nbody) + if (id < 0 || id >= nbody) error->all(FLERR,"Invalid rigid body ID in fix rigid file"); inbody[id] = 1; @@ -2210,8 +2210,8 @@ void FixRigid::readfile(int which, double *vec, xbox = atoi(values[17]); ybox = atoi(values[18]); zbox = atoi(values[19]); - ivec[id] = ((imageint) (xbox + IMGMAX) & IMGMASK) | - (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + ivec[id] = ((imageint) (xbox + IMGMAX) & IMGMASK) | + (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } else { array1[id][0] = atof(values[5]); @@ -2224,7 +2224,7 @@ void FixRigid::readfile(int which, double *vec, buf = next + 1; } - + nread += nchunk; } @@ -2557,7 +2557,7 @@ double FixRigid::extract_ke() { double ke = 0.0; for (int i = 0; i < nbody; i++) - ke += masstotal[i] * + ke += masstotal[i] * (vcm[i][0]*vcm[i][0] + vcm[i][1]*vcm[i][1] + vcm[i][2]*vcm[i][2]); return 0.5*ke; diff --git a/src/RIGID/fix_rigid.h b/src/RIGID/fix_rigid.h index 50314bd792121c8fd439065f4338af64d820ff3a..94692da367cf61d93d16dd625dc940efecfa5574 100644 --- a/src/RIGID/fix_rigid.h +++ b/src/RIGID/fix_rigid.h @@ -39,7 +39,7 @@ class FixRigid : public Fix { void write_restart_file(char *); virtual double compute_scalar(); virtual int modify_param(int, char **) {return 0;} - + double memory_usage(); void grow_arrays(int); void copy_arrays(int, int, int); @@ -58,7 +58,7 @@ class FixRigid : public Fix { double extract_ke(); double extract_erotational(); double compute_array(int, int); - + protected: int me,nprocs; double dtv,dtf,dtq; @@ -121,14 +121,14 @@ class FixRigid : public Fix { int pstat_flag; // NPT settings double p_start[3],p_stop[3]; double p_period[3],p_freq[3]; - int p_flag[3]; + int p_flag[3]; int pcouple,pstyle; int p_chain; int allremap; // remap all atoms int dilate_group_bit; // mask for dilation group char *id_dilate; // group name to dilate - + class RanMars *random; class AtomVecEllipsoid *avec_ellipsoid; class AtomVecLine *avec_line; @@ -142,7 +142,7 @@ class FixRigid : public Fix { void set_v(); void setup_bodies_static(); void setup_bodies_dynamic(); - void readfile(int, double *, double **, double **, double **, + void readfile(int, double *, double **, double **, double **, imageint *, int *); }; diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 5bed48f3d5594a1547160fdac414c2784578d8c8..6a1476ba357c06e9a31904a2f90b0c714f329fc7 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,9 +17,9 @@ Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_rigid_nh.h" #include "math_extra.h" #include "atom.h" @@ -50,12 +50,12 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : FixRigid(lmp, narg, arg) { // error checks: could be moved up to FixRigid - - if ((p_flag[0] == 1 && p_period[0] <= 0.0) || - (p_flag[1] == 1 && p_period[1] <= 0.0) || - (p_flag[2] == 1 && p_period[2] <= 0.0)) + + if ((p_flag[0] == 1 && p_period[0] <= 0.0) || + (p_flag[1] == 1 && p_period[1] <= 0.0) || + (p_flag[2] == 1 && p_period[2] <= 0.0)) error->all(FLERR,"Fix rigid npt/nph period must be > 0.0"); - + if (dimension == 2 && p_flag[2]) error->all(FLERR,"Invalid fix rigid npt/nph command for a 2d simulation"); if (dimension == 2 && (pcouple == YZ || pcouple == XZ)) @@ -83,7 +83,7 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : if (p_flag[2] && domain->zperiodic == 0) error->all(FLERR, "Cannot use fix rigid npt/nph on a non-periodic dimension"); - + if (pcouple == XYZ && dimension == 3 && (p_start[0] != p_start[1] || p_start[0] != p_start[2] || p_stop[0] != p_stop[1] || p_stop[0] != p_stop[2] || @@ -113,39 +113,39 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix rigid nvt/npt/nph damping parameters must be > 0.0"); // memory allocation and initialization - + memory->create(conjqm,nbody,4,"rigid_nh:conjqm"); if (tstat_flag || pstat_flag) { allocate_chain(); allocate_order(); } - + if (tstat_flag) { eta_t[0] = eta_r[0] = 0.0; eta_dot_t[0] = eta_dot_r[0] = 0.0; f_eta_t[0] = f_eta_r[0] = 0.0; - + for (int i = 1; i < t_chain; i++) { eta_t[i] = eta_r[i] = 0.0; eta_dot_t[i] = eta_dot_r[i] = 0.0; } } - + if (pstat_flag) { epsilon_dot[0] = epsilon_dot[1] = epsilon_dot[2] = 0.0; eta_b[0] = eta_dot_b[0] = f_eta_b[0] = 0.0; - for (int i = 1; i < p_chain; i++) + for (int i = 1; i < p_chain; i++) eta_b[i] = eta_dot_b[i] = 0.0; } // rigid body pointers - + nrigidfix = 0; rfix = NULL; vol0 = 0.0; t0 = 1.0; - + tcomputeflag = 0; pcomputeflag = 0; } @@ -159,16 +159,16 @@ FixRigidNH::~FixRigidNH() deallocate_chain(); deallocate_order(); } - + if (rfix) delete [] rfix; if (tcomputeflag) { modify->delete_compute(id_temp); delete [] id_temp; } - + // delete pressure if fix created it - + if (pstat_flag) { if (pcomputeflag) modify->delete_compute(id_press); delete [] id_press; @@ -182,7 +182,7 @@ int FixRigidNH::setmask() int mask = 0; mask = FixRigid::setmask(); if (tstat_flag || pstat_flag) mask |= THERMO_ENERGY; - + return mask; } @@ -202,25 +202,25 @@ void FixRigidNH::init() } // initialize thermostats - // set timesteps, constants + // set timesteps, constants // store Yoshida-Suzuki integrator parameters - + dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; dtq = 0.5 * update->dt; - + boltz = force->boltz; nktv2p = force->nktv2p; mvv2e = force->mvv2e; - + if (force->kspace) kspace_flag = 1; else kspace_flag = 0; - nf_t = dimension * nbody; + nf_t = dimension * nbody; if (dimension == 3) { nf_r = dimension * nbody; for (int ibody = 0; ibody < nbody; ibody++) - for (int k = 0; k < domain->dimension; k++) + for (int k = 0; k < domain->dimension; k++) if (fabs(inertia[ibody][k]) < EPSILON) nf_r--; } else if (dimension == 2) { nf_r = nbody; @@ -228,12 +228,12 @@ void FixRigidNH::init() if (fabs(inertia[ibody][2]) < EPSILON) nf_r--; } - g_f = nf_t + nf_r; + g_f = nf_t + nf_r; onednft = 1.0 + (double)(dimension) / (double)g_f; onednfr = (double) (dimension) / (double)g_f; // see Table 1 in Kamberaj et al - + if (tstat_flag || pstat_flag) { if (t_order == 3) { w[0] = 1.0 / (2.0 - pow(2.0, 1.0/3.0)); @@ -249,30 +249,30 @@ void FixRigidNH::init() } int icompute; - if (tcomputeflag) { + if (tcomputeflag) { icompute = modify->find_compute(id_temp); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Temperature ID for fix rigid nvt/npt/nph does not exist"); temperature = modify->compute[icompute]; } if (pstat_flag) { - if (domain->triclinic) + if (domain->triclinic) error->all(FLERR,"Fix rigid npt/nph does not yet allow triclinic box"); - + // ensure no conflict with fix deform for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; - if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || + if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2])) error->all(FLERR,"Cannot use fix rigid npt/nph and fix deform on " "same component of stress tensor"); } // set frequency - + p_freq_max = 0.0; p_freq_max = MAX(p_freq[0],p_freq[1]); p_freq_max = MAX(p_freq_max,p_freq[2]); @@ -289,10 +289,10 @@ void FixRigidNH::init() // set pressure compute ptr icompute = modify->find_compute(id_press); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Pressure ID for fix rigid npt/nph does not exist"); pressure = modify->compute[icompute]; - + // detect if any rigid fixes exist so rigid bodies move on remap // rfix[] = indices to each fix rigid // this will include self @@ -317,7 +317,7 @@ void FixRigidNH::init() void FixRigidNH::setup(int vflag) { FixRigid::setup(vflag); - + double mbody[3]; akin_t = akin_r = 0.0; for (int ibody = 0; ibody < nbody; ibody++) { @@ -328,17 +328,17 @@ void FixRigidNH::setup(int vflag) conjqm[ibody][1] *= 2.0; conjqm[ibody][2] *= 2.0; conjqm[ibody][3] *= 2.0; - + if (tstat_flag || pstat_flag) { - akin_t += masstotal[ibody]*(vcm[ibody][0]*vcm[ibody][0] + + akin_t += masstotal[ibody]*(vcm[ibody][0]*vcm[ibody][0] + vcm[ibody][1]*vcm[ibody][1] + vcm[ibody][2]*vcm[ibody][2]); - akin_r += angmom[ibody][0]*omega[ibody][0] + + akin_r += angmom[ibody][0]*omega[ibody][0] + angmom[ibody][1]*omega[ibody][1] + angmom[ibody][2]*omega[ibody][2]; } } // compute target temperature - + if (tstat_flag) compute_temp_target(); else if (pstat_flag) { t0 = temperature->compute_scalar(); @@ -352,8 +352,8 @@ void FixRigidNH::setup(int vflag) // compute target pressure // compute current pressure // trigger virial computation on next timestep - - if (pstat_flag) { + + if (pstat_flag) { if (pstyle == ISO) { temperature->compute_scalar(); pressure->compute_scalar(); @@ -364,9 +364,9 @@ void FixRigidNH::setup(int vflag) couple(); pressure->addstep(update->ntimestep+1); } - + // initialize thermostat/barostat settings - + double kt, t_mass, tb_mass; kt = boltz * t_target; @@ -374,7 +374,7 @@ void FixRigidNH::setup(int vflag) t_mass = kt / (t_freq*t_freq); q_t[0] = nf_t * t_mass; q_r[0] = nf_r * t_mass; - for (int i = 1; i < t_chain; i++) + for (int i = 1; i < t_chain; i++) q_t[i] = q_r[i] = t_mass; for (int i = 1; i < t_chain; i++) { @@ -382,16 +382,16 @@ void FixRigidNH::setup(int vflag) f_eta_r[i] = (q_r[i-1] * eta_dot_r[i-1] * eta_dot_r[i-1] - kt)/q_r[i]; } } - + // initial forces on barostat thermostat variables - + if (pstat_flag) { for (int i = 0; i < 3; i++) if (p_flag[i]) { epsilon_mass[i] = (g_f + dimension) * kt / (p_freq[i]*p_freq[i]); epsilon[i] = log(vol0)/dimension; - } - + } + tb_mass = kt / (p_freq_max * p_freq_max); q_b[0] = dimension * dimension * tb_mass; for (int i = 1; i < p_chain; i++) { @@ -399,9 +399,9 @@ void FixRigidNH::setup(int vflag) f_eta_b[i] = (q_b[i] * eta_dot_b[i-1] * eta_dot_b[i-1] - kt)/q_b[i]; } } - + // update order/timestep dependent coefficients - + if (tstat_flag || pstat_flag) { for (int i = 0; i < t_order; i++) { wdti1[i] = w[i] * dtv / t_iter; @@ -410,7 +410,7 @@ void FixRigidNH::setup(int vflag) } } - if (pstat_flag) { + if (pstat_flag) { compute_press_target(); nh_epsilon_dot(); } @@ -426,7 +426,7 @@ void FixRigidNH::initial_integrate(int vflag) double tmp,scale_r,scale_t[3],scale_v[3]; double dtfm,mbody[3],tbody[3],fquat[4]; double dtf2 = dtf * 2.0; - + // compute scale variables scale_t[0] = scale_t[1] = scale_t[2] = 1.0; @@ -439,7 +439,7 @@ void FixRigidNH::initial_integrate(int vflag) scale_t[0] = scale_t[1] = scale_t[2] = tmp; tmp = exp(-dtq * eta_dot_r[0]); scale_r = tmp; - } + } if (pstat_flag) { akin_t = akin_r = 0.0; @@ -455,28 +455,28 @@ void FixRigidNH::initial_integrate(int vflag) tmp = dtq * epsilon_dot[2]; scale_v[2] = dtv * exp(tmp) * maclaurin_series(tmp); } - + // update xcm, vcm, quat, conjqm and angmom for (int ibody = 0; ibody < nbody; ibody++) { - + // step 1.1 - update vcm by 1/2 step - + dtfm = dtf / masstotal[ibody]; vcm[ibody][0] += dtfm * fcm[ibody][0] * fflag[ibody][0]; vcm[ibody][1] += dtfm * fcm[ibody][1] * fflag[ibody][1]; vcm[ibody][2] += dtfm * fcm[ibody][2] * fflag[ibody][2]; - + if (tstat_flag || pstat_flag) { vcm[ibody][0] *= scale_t[0]; vcm[ibody][1] *= scale_t[1]; vcm[ibody][2] *= scale_t[2]; - + tmp = vcm[ibody][0]*vcm[ibody][0] + vcm[ibody][1]*vcm[ibody][1] + vcm[ibody][2]*vcm[ibody][2]; akin_t += masstotal[ibody]*tmp; } - + // step 1.2 - update xcm by full step if (!pstat_flag) { @@ -488,56 +488,56 @@ void FixRigidNH::initial_integrate(int vflag) xcm[ibody][1] += scale_v[1] * vcm[ibody][1]; xcm[ibody][2] += scale_v[2] * vcm[ibody][2]; } - + // step 1.3 - apply torque (body coords) to quaternion momentum - + torque[ibody][0] *= tflag[ibody][0]; torque[ibody][1] *= tflag[ibody][1]; torque[ibody][2] *= tflag[ibody][2]; - + MathExtra::transpose_matvec(ex_space[ibody],ey_space[ibody],ez_space[ibody], torque[ibody],tbody); MathExtra::quatvec(quat[ibody],tbody,fquat); - + conjqm[ibody][0] += dtf2 * fquat[0]; conjqm[ibody][1] += dtf2 * fquat[1]; conjqm[ibody][2] += dtf2 * fquat[2]; conjqm[ibody][3] += dtf2 * fquat[3]; - + if (tstat_flag || pstat_flag) { conjqm[ibody][0] *= scale_r; conjqm[ibody][1] *= scale_r; conjqm[ibody][2] *= scale_r; conjqm[ibody][3] *= scale_r; } - + // step 1.4 to 1.13 - use no_squish rotate to update p and q - + MathExtra::no_squish_rotate(3,conjqm[ibody],quat[ibody],inertia[ibody],dtq); MathExtra::no_squish_rotate(2,conjqm[ibody],quat[ibody],inertia[ibody],dtq); MathExtra::no_squish_rotate(1,conjqm[ibody],quat[ibody],inertia[ibody],dtv); MathExtra::no_squish_rotate(2,conjqm[ibody],quat[ibody],inertia[ibody],dtq); MathExtra::no_squish_rotate(3,conjqm[ibody],quat[ibody],inertia[ibody],dtq); - + // update exyz_space // transform p back to angmom // update angular velocity - + MathExtra::q_to_exyz(quat[ibody],ex_space[ibody],ey_space[ibody], ez_space[ibody]); MathExtra::invquatvec(quat[ibody],conjqm[ibody],mbody); MathExtra::matvec(ex_space[ibody],ey_space[ibody],ez_space[ibody], mbody,angmom[ibody]); - + angmom[ibody][0] *= 0.5; angmom[ibody][1] *= 0.5; angmom[ibody][2] *= 0.5; - + MathExtra::angmom_to_omega(angmom[ibody],ex_space[ibody],ey_space[ibody], ez_space[ibody],inertia[ibody],omega[ibody]); - + if (tstat_flag || pstat_flag) { - akin_r += angmom[ibody][0]*omega[ibody][0] + + akin_r += angmom[ibody][0]*omega[ibody][0] + angmom[ibody][1]*omega[ibody][1] + angmom[ibody][2]*omega[ibody][2]; } } @@ -550,7 +550,7 @@ void FixRigidNH::initial_integrate(int vflag) compute_temp_target(); nhc_temp_integrate(); } - + // update thermostat chains coupled with barostat // refer to update_nhcb() in Kamberaj et al. @@ -571,14 +571,14 @@ void FixRigidNH::initial_integrate(int vflag) // from quarternion and omega set_xv(); - + // remap simulation box by full step // redo KSpace coeffs since volume has changed if (pstat_flag) { remap(); if (kspace_flag) force->kspace->setup(); - } + } } /* ---------------------------------------------------------------------- */ @@ -592,7 +592,7 @@ void FixRigidNH::final_integrate() double dtf2 = dtf * 2.0; // compute scale variables - + scale_t[0] = scale_t[1] = scale_t[2] = 1.0; scale_r = 1.0; @@ -600,25 +600,25 @@ void FixRigidNH::final_integrate() tmp = exp(-1.0 * dtq * eta_dot_t[0]); scale_t[0] = scale_t[1] = scale_t[2] = tmp; scale_r = exp(-1.0 * dtq * eta_dot_r[0]); - } - + } + if (pstat_flag) { scale_t[0] *= exp(-dtq * (epsilon_dot[0] + mtk_term2)); scale_t[1] *= exp(-dtq * (epsilon_dot[1] + mtk_term2)); scale_t[2] *= exp(-dtq * (epsilon_dot[2] + mtk_term2)); scale_r *= exp(-dtq * (pdim * mtk_term2)); - + // reset akin_t and akin_r, to be accumulated for use in nh_epsilon_dot() akin_t = akin_r = 0.0; } - + // sum over atoms to get force and torque on rigid body - + double **x = atom->x; double **f = atom->f; int nlocal = atom->nlocal; - + double xprd = domain->xprd; double yprd = domain->yprd; double zprd = domain->zprd; @@ -632,7 +632,7 @@ void FixRigidNH::final_integrate() double xunwrap,yunwrap,zunwrap,dx,dy,dz; for (ibody = 0; ibody < nbody; ibody++) for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; - + for (i = 0; i < nlocal; i++) { if (body[i] < 0) continue; ibody = body[i]; @@ -640,7 +640,7 @@ void FixRigidNH::final_integrate() sum[ibody][0] += f[i][0]; sum[ibody][1] += f[i][1]; sum[ibody][2] += f[i][2]; - + xbox = (xcmimage[i] & IMGMASK) - IMGMAX; ybox = (xcmimage[i] >> IMGBITS & IMGMASK) - IMGMAX; zbox = (xcmimage[i] >> IMG2BITS) - IMGMAX; @@ -658,12 +658,12 @@ void FixRigidNH::final_integrate() dx = xunwrap - xcm[ibody][0]; dy = yunwrap - xcm[ibody][1]; dz = zunwrap - xcm[ibody][2]; - + sum[ibody][3] += dy*f[i][2] - dz*f[i][1]; sum[ibody][4] += dz*f[i][0] - dx*f[i][2]; sum[ibody][5] += dx*f[i][1] - dy*f[i][0]; } - + // extended particles add their torque to torque of body if (extended) { @@ -682,7 +682,7 @@ void FixRigidNH::final_integrate() } MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); - + // update vcm and angmom // include Langevin thermostat forces // fflag,tflag = 0 for some dimensions in 2d @@ -696,35 +696,35 @@ void FixRigidNH::final_integrate() torque[ibody][2] = all[ibody][5] + langextra[ibody][5]; // update vcm by 1/2 step - + dtfm = dtf / masstotal[ibody]; if (tstat_flag || pstat_flag) { vcm[ibody][0] *= scale_t[0]; vcm[ibody][1] *= scale_t[1]; vcm[ibody][2] *= scale_t[2]; } - + vcm[ibody][0] += dtfm * fcm[ibody][0] * fflag[ibody][0]; vcm[ibody][1] += dtfm * fcm[ibody][1] * fflag[ibody][1]; vcm[ibody][2] += dtfm * fcm[ibody][2] * fflag[ibody][2]; - + if (pstat_flag) { tmp = vcm[ibody][0]*vcm[ibody][0] + vcm[ibody][1]*vcm[ibody][1] + vcm[ibody][2]*vcm[ibody][2]; akin_t += masstotal[ibody]*tmp; } - + // update conjqm, then transform to angmom, set velocity again // virial is already setup from initial_integrate - + torque[ibody][0] *= tflag[ibody][0]; torque[ibody][1] *= tflag[ibody][1]; torque[ibody][2] *= tflag[ibody][2]; - + MathExtra::transpose_matvec(ex_space[ibody],ey_space[ibody], ez_space[ibody],torque[ibody],tbody); MathExtra::quatvec(quat[ibody],tbody,fquat); - + if (tstat_flag || pstat_flag) { conjqm[ibody][0] = scale_r * conjqm[ibody][0] + dtf2 * fquat[0]; conjqm[ibody][1] = scale_r * conjqm[ibody][1] + dtf2 * fquat[1]; @@ -740,17 +740,17 @@ void FixRigidNH::final_integrate() MathExtra::invquatvec(quat[ibody],conjqm[ibody],mbody); MathExtra::matvec(ex_space[ibody],ey_space[ibody],ez_space[ibody], mbody,angmom[ibody]); - + angmom[ibody][0] *= 0.5; angmom[ibody][1] *= 0.5; - angmom[ibody][2] *= 0.5; - + angmom[ibody][2] *= 0.5; + MathExtra::angmom_to_omega(angmom[ibody],ex_space[ibody],ey_space[ibody], ez_space[ibody],inertia[ibody],omega[ibody]); - + if (pstat_flag) { - akin_r += angmom[ibody][0]*omega[ibody][0] + - angmom[ibody][1]*omega[ibody][1] + + akin_r += angmom[ibody][0]*omega[ibody][0] + + angmom[ibody][1]*omega[ibody][1] + angmom[ibody][2]*omega[ibody][2]; } } @@ -765,7 +765,7 @@ void FixRigidNH::final_integrate() // compute current and target pressures // update epsilon dot using akin_t and akin_r - + if (pstat_flag) { if (pstyle == ISO) { temperature->compute_scalar(); @@ -789,68 +789,68 @@ void FixRigidNH::nhc_temp_integrate() { int i,j,k; double kt,gfkt_t,gfkt_r,tmp,ms,s,s2; - + kt = boltz * t_target; gfkt_t = nf_t * kt; gfkt_r = nf_r * kt; // update thermostat masses - + double t_mass = boltz * t_target / (t_freq * t_freq); q_t[0] = nf_t * t_mass; q_r[0] = nf_r * t_mass; for (i = 1; i < t_chain; i++) q_t[i] = q_r[i] = t_mass; - + // update force of thermostats coupled to particles - + f_eta_t[0] = (akin_t * mvv2e - gfkt_t) / q_t[0]; f_eta_r[0] = (akin_r * mvv2e - gfkt_r) / q_r[0]; - + // multiple timestep iteration - + for (i = 0; i < t_iter; i++) { for (j = 0; j < t_order; j++) { - + // update thermostat velocities half step - + eta_dot_t[t_chain-1] += wdti2[j] * f_eta_t[t_chain-1]; eta_dot_r[t_chain-1] += wdti2[j] * f_eta_r[t_chain-1]; - + for (k = 1; k < t_chain; k++) { tmp = wdti4[j] * eta_dot_t[t_chain-k]; ms = maclaurin_series(tmp); s = exp(-1.0 * tmp); s2 = s * s; - eta_dot_t[t_chain-k-1] = eta_dot_t[t_chain-k-1] * s2 + + eta_dot_t[t_chain-k-1] = eta_dot_t[t_chain-k-1] * s2 + wdti2[j] * f_eta_t[t_chain-k-1] * s * ms; - + tmp = wdti4[j] * eta_dot_r[t_chain-k]; ms = maclaurin_series(tmp); s = exp(-1.0 * tmp); s2 = s * s; - eta_dot_r[t_chain-k-1] = eta_dot_r[t_chain-k-1] * s2 + + eta_dot_r[t_chain-k-1] = eta_dot_r[t_chain-k-1] * s2 + wdti2[j] * f_eta_r[t_chain-k-1] * s * ms; } - + // update thermostat positions a full step - + for (k = 0; k < t_chain; k++) { eta_t[k] += wdti1[j] * eta_dot_t[k]; eta_r[k] += wdti1[j] * eta_dot_r[k]; } - - // update thermostat forces - + + // update thermostat forces + for (k = 1; k < t_chain; k++) { f_eta_t[k] = q_t[k-1] * eta_dot_t[k-1] * eta_dot_t[k-1] - kt; f_eta_t[k] /= q_t[k]; f_eta_r[k] = q_r[k-1] * eta_dot_r[k-1] * eta_dot_r[k-1] - kt; f_eta_r[k] /= q_r[k]; } - + // update thermostat velocities a full step - + for (k = 0; k < t_chain-1; k++) { tmp = wdti4[j] * eta_dot_t[k+1]; ms = maclaurin_series(tmp); @@ -859,7 +859,7 @@ void FixRigidNH::nhc_temp_integrate() eta_dot_t[k] = eta_dot_t[k] * s2 + wdti2[j] * f_eta_t[k] * s * ms; tmp = q_t[k] * eta_dot_t[k] * eta_dot_t[k] - kt; f_eta_t[k+1] = tmp / q_t[k+1]; - + tmp = wdti4[j] * eta_dot_r[k+1]; ms = maclaurin_series(tmp); s = exp(-1.0 * tmp); @@ -868,7 +868,7 @@ void FixRigidNH::nhc_temp_integrate() tmp = q_r[k] * eta_dot_r[k] * eta_dot_r[k] - kt; f_eta_r[k+1] = tmp / q_r[k+1]; } - + eta_dot_t[t_chain-1] += wdti2[j] * f_eta_t[t_chain-1]; eta_dot_r[t_chain-1] += wdti2[j] * f_eta_r[t_chain-1]; } @@ -883,9 +883,9 @@ void FixRigidNH::nhc_press_integrate() double tmp,s,s2,ms,kecurrent; double kt = boltz * t_target; double lkt_press = kt; - + // update thermostat masses - + double tb_mass = kt / (p_freq_max * p_freq_max); q_b[0] = dimension * dimension * tb_mass; for (int i = 1; i < p_chain; i++) { @@ -893,11 +893,11 @@ void FixRigidNH::nhc_press_integrate() f_eta_b[i] = q_b[i-1] * eta_dot_b[i-1] * eta_dot_b[i-1] - kt; f_eta_b[i] /= q_b[i]; } - + // update forces acting on thermostat - + kecurrent = 0.0; - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) if (p_flag[i]) { epsilon_mass[i] = (g_f + dimension) * kt / (p_freq[i] * p_freq[i]); kecurrent += epsilon_mass[i] * epsilon_dot[i] * epsilon_dot[i]; @@ -907,37 +907,37 @@ void FixRigidNH::nhc_press_integrate() f_eta_b[0] = (kecurrent - lkt_press) / q_b[0]; // multiple timestep iteration - + for (i = 0; i < t_iter; i++) { for (j = 0; j < t_order; j++) { // update thermostat velocities a half step - + eta_dot_b[p_chain-1] += wdti2[j] * f_eta_b[p_chain-1]; - + for (k = 1; k < p_chain; k++) { tmp = wdti4[j] * eta_dot_b[p_chain-k]; ms = maclaurin_series(tmp); s = exp(-0.5 * tmp); s2 = s * s; - eta_dot_b[p_chain-k-1] = eta_dot_b[p_chain-k-1] * s2 + + eta_dot_b[p_chain-k-1] = eta_dot_b[p_chain-k-1] * s2 + wdti2[j] * f_eta_b[p_chain-k-1] * s * ms; } - + // update thermostat positions - + for (k = 0; k < p_chain; k++) eta_b[k] += wdti1[j] * eta_dot_b[k]; - + // update thermostat forces - + for (k = 1; k < p_chain; k++) { f_eta_b[k] = q_b[k-1] * eta_dot_b[k-1] * eta_dot_b[k-1] - kt; f_eta_b[k] /= q_b[k]; } // update thermostat velocites a full step - + for (k = 0; k < p_chain-1; k++) { tmp = wdti4[j] * eta_dot_b[k+1]; ms = maclaurin_series(tmp); @@ -947,13 +947,13 @@ void FixRigidNH::nhc_press_integrate() tmp = q_b[k] * eta_dot_b[k] * eta_dot_b[k] - kt; f_eta_b[k+1] = tmp / q_b[k+1]; } - + eta_dot_b[p_chain-1] += wdti2[j] * f_eta_b[p_chain-1]; } } } -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- compute kinetic energy in the extended Hamiltonian conserved quantity = sum of returned energy and potential energy -----------------------------------------------------------------------*/ @@ -963,24 +963,24 @@ double FixRigidNH::compute_scalar() const double kt = boltz * t_target; double energy; int i; - + energy = FixRigid::compute_scalar(); - + if (tstat_flag) { - + // thermostat chain energy: from equation 12 in Kameraj et al (JCP 2005) energy += kt * (nf_t * eta_t[0] + nf_r * eta_r[0]); - - for (i = 1; i < t_chain; i++) + + for (i = 1; i < t_chain; i++) energy += kt * (eta_t[i] + eta_r[i]); - + for (i = 0; i < t_chain; i++) { energy += 0.5 * q_t[i] * (eta_dot_t[i] * eta_dot_t[i]); energy += 0.5 * q_r[i] * (eta_dot_r[i] * eta_dot_r[i]); } } - + if (pstat_flag) { // using equation 22 in Kameraj et al for H_NPT @@ -990,7 +990,7 @@ double FixRigidNH::compute_scalar() if (p_flag[i]) e += epsilon_mass[i] * epsilon_dot[i] * epsilon_dot[i]; energy += e*(0.5/pdim); - + double vol; if (dimension == 2) vol = domain->xprd * domain->yprd; else vol = domain->xprd * domain->yprd * domain->zprd; @@ -1003,7 +1003,7 @@ double FixRigidNH::compute_scalar() energy += 0.5 * q_b[i] * (eta_dot_b[i] * eta_dot_b[i]); } } - + return energy; } @@ -1012,7 +1012,7 @@ double FixRigidNH::compute_scalar() void FixRigidNH::couple() { double *tensor = pressure->vector; - + if (pstyle == ISO) { p_current[0] = p_current[1] = p_current[2] = pressure->scalar; } else if (pcouple == XYZ) { @@ -1043,30 +1043,30 @@ void FixRigidNH::remap() { int i; double oldlo,oldhi,ctr,expfac; - + double **x = atom->x; int *mask = atom->mask; int nlocal = atom->nlocal; - + // epsilon is not used, except for book-keeping - + for (i = 0; i < 3; i++) epsilon[i] += dtq * epsilon_dot[i]; - + // convert pertinent atoms and rigid bodies to lamda coords - + if (allremap) domain->x2lamda(nlocal); else { for (i = 0; i < nlocal; i++) if (mask[i] & dilate_group_bit) domain->x2lamda(x[i],x[i]); } - + if (nrigidfix) for (i = 0; i < nrigidfix; i++) modify->fix[rfix[i]]->deform(0); - + // reset global and local box to new size/shape - + for (i = 0; i < 3; i++) { if (p_flag[i]) { oldlo = domain->boxlo[i]; @@ -1080,16 +1080,16 @@ void FixRigidNH::remap() domain->set_global_box(); domain->set_local_box(); - + // convert pertinent atoms and rigid bodies back to box coords - + if (allremap) domain->lamda2x(nlocal); else { for (i = 0; i < nlocal; i++) if (mask[i] & dilate_group_bit) domain->lamda2x(x[i],x[i]); } - + if (nrigidfix) for (i = 0; i< nrigidfix; i++) modify->fix[rfix[i]]->deform(1); @@ -1103,7 +1103,7 @@ void FixRigidNH::compute_temp_target() { double delta = update->ntimestep - update->beginstep; if (delta != 0.0) delta /= update->endstep - update->beginstep; - + t_target = t_start + delta * (t_stop-t_start); } @@ -1115,7 +1115,7 @@ void FixRigidNH::compute_press_target() { double delta = update->ntimestep - update->beginstep; if (delta != 0.0) delta /= update->endstep - update->beginstep; - + p_hydro = 0.0; for (int i = 0; i < 3; i++) if (p_flag[i]) { @@ -1138,9 +1138,9 @@ void FixRigidNH::nh_epsilon_dot() else volume = domain->xprd*domain->yprd*domain->zprd; // MTK terms - + mtk_term1 = (akin_t + akin_r) * mvv2e / g_f; - + scale = exp(-1.0 * dtq * eta_dot_b[0]); for (i = 0; i < 3; i++) @@ -1150,7 +1150,7 @@ void FixRigidNH::nh_epsilon_dot() epsilon_dot[i] += dtq * f_epsilon; epsilon_dot[i] *= scale; } - + mtk_term2 = 0.0; for (i = 0; i < 3; i++) if (p_flag[i]) mtk_term2 += epsilon_dot[i]; @@ -1158,15 +1158,15 @@ void FixRigidNH::nh_epsilon_dot() } /* ---------------------------------------------------------------------- - pack entire state of Fix into one write + pack entire state of Fix into one write ------------------------------------------------------------------------- */ void FixRigidNH::write_restart(FILE *fp) { if (tstat_flag == 0 && pstat_flag == 0) return; - + int nsize = 2; // tstat_flag and pstat_flag - + if (tstat_flag) { nsize += 1; // t_chain nsize += 4*t_chain; // eta_t, eta_r, eta_dot_t, eta_dot_r @@ -1176,12 +1176,12 @@ void FixRigidNH::write_restart(FILE *fp) nsize += 7; // p_chain, epsilon(3) and epsilon_dot(3) nsize += 2*p_chain; } - + double *list; memory->create(list,nsize,"rigid_nh:list"); - + int n = 0; - + list[n++] = tstat_flag; if (tstat_flag) { list[n++] = t_chain; @@ -1192,7 +1192,7 @@ void FixRigidNH::write_restart(FILE *fp) list[n++] = eta_dot_r[i]; } } - + list[n++] = pstat_flag; if (pstat_flag) { list[n++] = epsilon[0]; @@ -1201,25 +1201,25 @@ void FixRigidNH::write_restart(FILE *fp) list[n++] = epsilon_dot[0]; list[n++] = epsilon_dot[1]; list[n++] = epsilon_dot[2]; - + list[n++] = p_chain; for (int i = 0; i < p_chain; i++) { list[n++] = eta_b[i]; list[n++] = eta_dot_b[i]; } } - + if (comm->me == 0) { int size = (nsize)*sizeof(double); fwrite(&size,sizeof(int),1,fp); fwrite(list,sizeof(double),nsize,fp); } - + memory->destroy(list); } /* ---------------------------------------------------------------------- - use state info from restart file to restart the Fix + use state info from restart file to restart the Fix ------------------------------------------------------------------------- */ void FixRigidNH::restart(char *buf) @@ -1227,7 +1227,7 @@ void FixRigidNH::restart(char *buf) int n = 0; double *list = (double *) buf; int flag = static_cast<int> (list[n++]); - + if (flag) { int m = static_cast<int> (list[n++]); if (tstat_flag && m == t_chain) { @@ -1248,7 +1248,7 @@ void FixRigidNH::restart(char *buf) epsilon_dot[0] = list[n++]; epsilon_dot[1] = list[n++]; epsilon_dot[2] = list[n++]; - + int m = static_cast<int> (list[n++]); if (pstat_flag && m == p_chain) { for (int i = 0; i < p_chain; i++) { @@ -1335,7 +1335,7 @@ void FixRigidNH::allocate_chain() f_eta_t = new double[t_chain]; f_eta_r = new double[t_chain]; } - + if (pstat_flag) { q_b = new double[p_chain]; eta_b = new double[p_chain]; @@ -1375,7 +1375,7 @@ void FixRigidNH::deallocate_chain() delete [] f_eta_t; delete [] f_eta_r; } - + if (pstat_flag) { delete [] q_b; delete [] eta_b; diff --git a/src/RIGID/fix_rigid_nh.h b/src/RIGID/fix_rigid_nh.h index 64bfa37f908f20ca0149e5f5392e0dc95e011418..684579b8af34ea022b5a5635614eec31438a9314 100644 --- a/src/RIGID/fix_rigid_nh.h +++ b/src/RIGID/fix_rigid_nh.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -32,26 +32,26 @@ class FixRigidNH : public FixRigid { void write_restart(FILE *); void restart(char *buf); void reset_target(double); - + protected: double **conjqm; // conjugate quaternion momentum double boltz,nktv2p,mvv2e; // boltzman constant, conversion factors int nf_t,nf_r; // trans/rot degrees of freedom - double onednft,onednfr; // factors 1 + dimension/trans(rot) + double onednft,onednfr; // factors 1 + dimension/trans(rot) // degrees of freedom double *w,*wdti1,*wdti2,*wdti4; // Yoshida-Suzuki coefficients double *q_t,*q_r; // trans/rot thermostat masses double *eta_t,*eta_r; // trans/rot thermostat positions double *eta_dot_t,*eta_dot_r; // trans/rot thermostat velocities double *f_eta_t,*f_eta_r; // trans/rot thermostat forces - + double epsilon_mass[3], *q_b; // baro/thermo masses double epsilon[3],*eta_b; // baro/thermo positions double epsilon_dot[3],*eta_dot_b; // baro/thermo velocities double *f_eta_b; // thermo forces double akin_t,akin_r; // translational/rotational kinetic energies - + int kspace_flag; // 1 if KSpace invoked, 0 if not int nrigidfix; // number of rigid fixes int *rfix; // indicies of rigid fixes @@ -61,9 +61,9 @@ class FixRigidNH : public FixRigid { int pdim,g_f; // number of barostatted dims, total DoFs double p_hydro; // hydrostatic target pressure double p_freq_max; // maximum barostat frequency - + double mtk_term1,mtk_term2; // Martyna-Tobias-Klein corrections - + double t_current,t_target; double p_current[3],p_target[3]; @@ -72,7 +72,7 @@ class FixRigidNH : public FixRigid { int tcomputeflag,pcomputeflag; void couple(); - void remap(); + void remap(); void nhc_temp_integrate(); void nhc_press_integrate(); diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index 39d778cba54627739d95c37bd75171ef8224ae66..5708bb66027242ecedb6a6f507e24521b8b45d29 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,9 +17,9 @@ Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_rigid_nh_small.h" #include "math_extra.h" #include "atom.h" @@ -51,16 +51,16 @@ enum{FULL_BODY,INITIAL,FINAL,FORCE_TORQUE,VCM_ANGMOM,XCM_MASS,ITENSOR,DOF}; FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : FixRigidSmall(lmp, narg, arg) -{ +{ // error checks - - if ((p_flag[0] == 1 && p_period[0] <= 0.0) || - (p_flag[1] == 1 && p_period[1] <= 0.0) || - (p_flag[2] == 1 && p_period[2] <= 0.0)) + + if ((p_flag[0] == 1 && p_period[0] <= 0.0) || + (p_flag[1] == 1 && p_period[1] <= 0.0) || + (p_flag[2] == 1 && p_period[2] <= 0.0)) error->all(FLERR,"Fix rigid/small npt/nph period must be > 0.0"); dimension = domain->dimension; - + if (dimension == 2 && p_flag[2]) error->all(FLERR,"Invalid fix rigid/small npt/nph command " "for a 2d simulation"); @@ -98,7 +98,7 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Cannot use fix rigid/small npt/nph on a " "non-periodic dimension"); - + if (pcouple == XYZ && dimension == 3 && (p_start[0] != p_start[1] || p_start[0] != p_start[2] || p_stop[0] != p_stop[1] || p_stop[0] != p_stop[2] || @@ -129,38 +129,38 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : "must be > 0.0"); // memory allocation and initialization - + if (tstat_flag || pstat_flag) { allocate_chain(); allocate_order(); } - + if (tstat_flag) { eta_t[0] = eta_r[0] = 0.0; eta_dot_t[0] = eta_dot_r[0] = 0.0; f_eta_t[0] = f_eta_r[0] = 0.0; - + for (int i = 1; i < t_chain; i++) { eta_t[i] = eta_r[i] = 0.0; eta_dot_t[i] = eta_dot_r[i] = 0.0; } } - + if (pstat_flag) { epsilon_dot[0] = epsilon_dot[1] = epsilon_dot[2] = 0.0; eta_b[0] = eta_dot_b[0] = f_eta_b[0] = 0.0; - for (int i = 1; i < p_chain; i++) + for (int i = 1; i < p_chain; i++) eta_b[i] = eta_dot_b[i] = 0.0; } // rigid body pointers - + nrigidfix = 0; rfix = NULL; vol0 = 0.0; t0 = 1.0; - + tcomputeflag = 0; pcomputeflag = 0; } @@ -173,16 +173,16 @@ FixRigidNHSmall::~FixRigidNHSmall() deallocate_chain(); deallocate_order(); } - + if (rfix) delete [] rfix; if (tcomputeflag) { modify->delete_compute(id_temp); delete [] id_temp; } - + // delete pressure if fix created it - + if (pstat_flag) { if (pcomputeflag) modify->delete_compute(id_press); delete [] id_press; @@ -196,7 +196,7 @@ int FixRigidNHSmall::setmask() int mask = 0; mask = FixRigidSmall::setmask(); if (tstat_flag || pstat_flag) mask |= THERMO_ENERGY; - + return mask; } @@ -216,13 +216,13 @@ void FixRigidNHSmall::init() } // initialize thermostats - // set timesteps, constants + // set timesteps, constants // store Yoshida-Suzuki integrator parameters - + dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; dtq = 0.5 * update->dt; - + boltz = force->boltz; nktv2p = force->nktv2p; mvv2e = force->mvv2e; @@ -231,7 +231,7 @@ void FixRigidNHSmall::init() else kspace_flag = 0; // see Table 1 in Kamberaj et al - + if (tstat_flag || pstat_flag) { if (t_order == 3) { w[0] = 1.0 / (2.0 - pow(2.0, 1.0/3.0)); @@ -247,30 +247,30 @@ void FixRigidNHSmall::init() } int icompute; - if (tcomputeflag) { + if (tcomputeflag) { icompute = modify->find_compute(id_temp); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Temperature ID for fix rigid nvt/npt/nph does not exist"); temperature = modify->compute[icompute]; } if (pstat_flag) { - if (domain->triclinic) + if (domain->triclinic) error->all(FLERR,"Fix rigid npt/nph does not yet allow triclinic box"); - + // ensure no conflict with fix deform for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; - if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || + if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2])) error->all(FLERR,"Cannot use fix rigid npt/nph and fix deform on " "same component of stress tensor"); } // set frequency - + p_freq_max = 0.0; p_freq_max = MAX(p_freq[0],p_freq[1]); p_freq_max = MAX(p_freq_max,p_freq[2]); @@ -287,10 +287,10 @@ void FixRigidNHSmall::init() // set pressure compute ptr icompute = modify->find_compute(id_press); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Pressure ID for fix rigid npt/nph does not exist"); pressure = modify->compute[icompute]; - + // detect if any rigid fixes exist so rigid bodies move on remap // rfix[] = indices to each fix rigid // this will include self @@ -317,13 +317,13 @@ void FixRigidNHSmall::setup(int vflag) FixRigidSmall::setup(vflag); // total translational and rotational degrees of freedom - - nf_t = dimension * nlocal_body; + + nf_t = dimension * nlocal_body; if (dimension == 3) { nf_r = dimension * nlocal_body; for (int ibody = 0; ibody < nlocal_body; ibody++) { Body *b = &body[ibody]; - for (int k = 0; k < dimension; k++) + for (int k = 0; k < dimension; k++) if (fabs(b->inertia[k]) < EPSILON) nf_r--; } } else if (dimension == 2) { @@ -341,10 +341,10 @@ void FixRigidNHSmall::setup(int vflag) nf_t = nfall[0]; nf_r = nfall[1]; - g_f = nf_t + nf_r; + g_f = nf_t + nf_r; onednft = 1.0 + (double)(dimension) / (double)g_f; onednfr = (double) (dimension) / (double)g_f; - + double mbody[3]; akin_t = akin_r = 0.0; for (int ibody = 0; ibody < nlocal_body; ibody++) { @@ -356,7 +356,7 @@ void FixRigidNHSmall::setup(int vflag) b->conjqm[1] *= 2.0; b->conjqm[2] *= 2.0; b->conjqm[3] *= 2.0; - + if (tstat_flag || pstat_flag) { akin_t += b->mass*(b->vcm[0]*b->vcm[0] + b->vcm[1]*b->vcm[1] + b->vcm[2]*b->vcm[2]); @@ -364,9 +364,9 @@ void FixRigidNHSmall::setup(int vflag) b->angmom[2]*b->omega[2]; } } - + // accumulate translational and rotational kinetic energies - + if (tstat_flag || pstat_flag) { double ke[2],keall[2]; ke[0] = akin_t; @@ -375,9 +375,9 @@ void FixRigidNHSmall::setup(int vflag) akin_t = keall[0]; akin_r = keall[1]; } - + // compute target temperature - + if (tstat_flag) compute_temp_target(); else if (pstat_flag) { t0 = temperature->compute_scalar(); @@ -391,10 +391,10 @@ void FixRigidNHSmall::setup(int vflag) // compute target pressure // compute current pressure // trigger virial computation on next timestep - - if (pstat_flag) { + + if (pstat_flag) { compute_press_target(); - + if (pstyle == ISO) { temperature->compute_scalar(); pressure->compute_scalar(); @@ -406,9 +406,9 @@ void FixRigidNHSmall::setup(int vflag) couple(); pressure->addstep(update->ntimestep+1); } - + // initialize thermostat/barostat settings - + double kt, t_mass, tb_mass; kt = boltz * t_target; @@ -416,7 +416,7 @@ void FixRigidNHSmall::setup(int vflag) t_mass = kt / (t_freq*t_freq); q_t[0] = nf_t * t_mass; q_r[0] = nf_r * t_mass; - for (int i = 1; i < t_chain; i++) + for (int i = 1; i < t_chain; i++) q_t[i] = q_r[i] = t_mass; for (int i = 1; i < t_chain; i++) { @@ -424,16 +424,16 @@ void FixRigidNHSmall::setup(int vflag) f_eta_r[i] = (q_r[i-1] * eta_dot_r[i-1] * eta_dot_r[i-1] - kt)/q_r[i]; } } - + // initial forces on barostat thermostat variables - + if (pstat_flag) { for (int i = 0; i < 3; i++) if (p_flag[i]) { epsilon_mass[i] = (g_f + dimension) * kt / (p_freq[i]*p_freq[i]); epsilon[i] = log(vol0)/dimension; - } - + } + tb_mass = kt / (p_freq_max * p_freq_max); q_b[0] = dimension * dimension * tb_mass; for (int i = 1; i < p_chain; i++) { @@ -441,9 +441,9 @@ void FixRigidNHSmall::setup(int vflag) f_eta_b[i] = (q_b[i] * eta_dot_b[i-1] * eta_dot_b[i-1] - kt)/q_b[i]; } } - + // update order/timestep dependent coefficients - + if (tstat_flag || pstat_flag) { for (int i = 0; i < t_order; i++) { wdti1[i] = w[i] * dtv / t_iter; @@ -452,7 +452,7 @@ void FixRigidNHSmall::setup(int vflag) } } - if (pstat_flag) { + if (pstat_flag) { compute_press_target(); nh_epsilon_dot(); } @@ -468,7 +468,7 @@ void FixRigidNHSmall::initial_integrate(int vflag) double tmp,scale_r,scale_t[3],scale_v[3]; double dtfm,mbody[3],tbody[3],fquat[4]; double dtf2 = dtf * 2.0; - + // compute scale variables scale_t[0] = scale_t[1] = scale_t[2] = 1.0; @@ -480,7 +480,7 @@ void FixRigidNHSmall::initial_integrate(int vflag) scale_t[0] = scale_t[1] = scale_t[2] = tmp; tmp = exp(-dtq * eta_dot_r[0]); scale_r = tmp; - } + } if (pstat_flag) { scale_t[0] *= exp(-dtq * (epsilon_dot[0] + mtk_term2)); @@ -495,25 +495,25 @@ void FixRigidNHSmall::initial_integrate(int vflag) tmp = dtq * epsilon_dot[2]; scale_v[2] = dtv * exp(tmp) * maclaurin_series(tmp); } - + // update xcm, vcm, quat, conjqm and angmom for (int ibody = 0; ibody < nlocal_body; ibody++) { Body *b = &body[ibody]; - + // step 1.1 - update vcm by 1/2 step - + dtfm = dtf / b->mass; b->vcm[0] += dtfm * b->fcm[0]; b->vcm[1] += dtfm * b->fcm[1]; b->vcm[2] += dtfm * b->fcm[2]; - + if (tstat_flag || pstat_flag) { b->vcm[0] *= scale_t[0]; b->vcm[1] *= scale_t[1]; b->vcm[2] *= scale_t[2]; } - + // step 1.2 - update xcm by full step if (!pstat_flag) { @@ -525,51 +525,51 @@ void FixRigidNHSmall::initial_integrate(int vflag) b->xcm[1] += scale_v[1] * b->vcm[1]; b->xcm[2] += scale_v[2] * b->vcm[2]; } - + // step 1.3 - apply torque (body coords) to quaternion momentum - + MathExtra::transpose_matvec(b->ex_space,b->ey_space,b->ez_space, b->torque,tbody); MathExtra::quatvec(b->quat,tbody,fquat); - + b->conjqm[0] += dtf2 * fquat[0]; b->conjqm[1] += dtf2 * fquat[1]; b->conjqm[2] += dtf2 * fquat[2]; b->conjqm[3] += dtf2 * fquat[3]; - + if (tstat_flag || pstat_flag) { b->conjqm[0] *= scale_r; b->conjqm[1] *= scale_r; b->conjqm[2] *= scale_r; b->conjqm[3] *= scale_r; } - + // step 1.4 to 1.13 - use no_squish rotate to update p and q - + no_squish_rotate(3,b->conjqm,b->quat,b->inertia,dtq); no_squish_rotate(2,b->conjqm,b->quat,b->inertia,dtq); no_squish_rotate(1,b->conjqm,b->quat,b->inertia,dtv); no_squish_rotate(2,b->conjqm,b->quat,b->inertia,dtq); no_squish_rotate(3,b->conjqm,b->quat,b->inertia,dtq); - + // update exyz_space // transform p back to angmom // update angular velocity - + MathExtra::q_to_exyz(b->quat,b->ex_space,b->ey_space, b->ez_space); MathExtra::invquatvec(b->quat,b->conjqm,mbody); MathExtra::matvec(b->ex_space,b->ey_space,b->ez_space, mbody,b->angmom); - + b->angmom[0] *= 0.5; b->angmom[1] *= 0.5; b->angmom[2] *= 0.5; - + MathExtra::angmom_to_omega(b->angmom,b->ex_space,b->ey_space, b->ez_space,b->inertia,b->omega); } - + // forward communicate updated info of all bodies commflag = INITIAL; @@ -581,13 +581,13 @@ void FixRigidNHSmall::initial_integrate(int vflag) akin_t = akin_r = 0.0; for (int ibody = 0; ibody < nlocal_body; ibody++) { - Body *b = &body[ibody]; + Body *b = &body[ibody]; akin_t += b->mass*(b->vcm[0]*b->vcm[0] + b->vcm[1]*b->vcm[1] + b->vcm[2]*b->vcm[2]); akin_r += b->angmom[0]*b->omega[0] + b->angmom[1]*b->omega[1] + b->angmom[2]*b->omega[2]; } - + double ke[2],keall[2]; ke[0] = akin_t; ke[1] = akin_r; @@ -604,7 +604,7 @@ void FixRigidNHSmall::initial_integrate(int vflag) compute_temp_target(); nhc_temp_integrate(); } - + // update thermostat chains coupled with barostat // refer to update_nhcb() in Kamberaj et al. @@ -625,14 +625,14 @@ void FixRigidNHSmall::initial_integrate(int vflag) // from quarternion and omega set_xv(); - + // remap simulation box by full step // redo KSpace coeffs since volume has changed if (pstat_flag) { remap(); if (kspace_flag) force->kspace->setup(); - } + } } /* ---------------------------------------------------------------------- */ @@ -646,7 +646,7 @@ void FixRigidNHSmall::final_integrate() double dtf2 = dtf * 2.0; // compute scale variables - + scale_t[0] = scale_t[1] = scale_t[2] = 1.0; scale_r = 1.0; @@ -654,21 +654,21 @@ void FixRigidNHSmall::final_integrate() tmp = exp(-1.0 * dtq * eta_dot_t[0]); scale_t[0] = scale_t[1] = scale_t[2] = tmp; scale_r = exp(-1.0 * dtq * eta_dot_r[0]); - } - + } + if (pstat_flag) { scale_t[0] *= exp(-dtq * (epsilon_dot[0] + mtk_term2)); scale_t[1] *= exp(-dtq * (epsilon_dot[1] + mtk_term2)); scale_t[2] *= exp(-dtq * (epsilon_dot[2] + mtk_term2)); scale_r *= exp(-dtq * (pdim * mtk_term2)); } - + // sum over atoms to get force and torque on rigid body - + double **x = atom->x; double **f = atom->f; int nlocal = atom->nlocal; - + double dx,dy,dz; double unwrap[3]; double *xcm,*fcm,*tcm; @@ -700,7 +700,7 @@ void FixRigidNHSmall::final_integrate() tcm[1] += dz*f[i][0] - dx*f[i][2]; tcm[2] += dx*f[i][1] - dy*f[i][0]; } - + // extended particles add their torque to torque of body if (extended) { @@ -737,7 +737,7 @@ void FixRigidNHSmall::final_integrate() tcm[2] += langextra[ibody][5]; } } - + // update vcm and angmom // include Langevin thermostat forces // fflag,tflag = 0 for some dimensions in 2d @@ -760,11 +760,11 @@ void FixRigidNHSmall::final_integrate() // update conjqm, then transform to angmom, set velocity again // virial is already setup from initial_integrate - + MathExtra::transpose_matvec(b->ex_space,b->ey_space, b->ez_space,b->torque,tbody); MathExtra::quatvec(b->quat,tbody,fquat); - + if (tstat_flag || pstat_flag) { b->conjqm[0] = scale_r * b->conjqm[0] + dtf2 * fquat[0]; b->conjqm[1] = scale_r * b->conjqm[1] + dtf2 * fquat[1]; @@ -779,11 +779,11 @@ void FixRigidNHSmall::final_integrate() MathExtra::invquatvec(b->quat,b->conjqm,mbody); MathExtra::matvec(b->ex_space,b->ey_space,b->ez_space,mbody,b->angmom); - + b->angmom[0] *= 0.5; b->angmom[1] *= 0.5; - b->angmom[2] *= 0.5; - + b->angmom[2] *= 0.5; + MathExtra::angmom_to_omega(b->angmom,b->ex_space,b->ey_space, b->ez_space,b->inertia,b->omega); } @@ -799,13 +799,13 @@ void FixRigidNHSmall::final_integrate() akin_t = akin_r = 0.0; for (int ibody = 0; ibody < nlocal_body; ibody++) { - Body *b = &body[ibody]; + Body *b = &body[ibody]; akin_t += b->mass*(b->vcm[0]*b->vcm[0] + b->vcm[1]*b->vcm[1] + b->vcm[2]*b->vcm[2]); akin_r += b->angmom[0]*b->omega[0] + b->angmom[1]*b->omega[1] + b->angmom[2]*b->omega[2]; } - + double ke[2],keall[2]; ke[0] = akin_t; ke[1] = akin_r; @@ -824,7 +824,7 @@ void FixRigidNHSmall::final_integrate() // compute current and target pressures // update epsilon dot using akin_t and akin_r - + if (pstat_flag) { if (pstyle == ISO) { temperature->compute_scalar(); @@ -848,68 +848,68 @@ void FixRigidNHSmall::nhc_temp_integrate() { int i,j,k; double kt,gfkt_t,gfkt_r,tmp,ms,s,s2; - + kt = boltz * t_target; gfkt_t = nf_t * kt; gfkt_r = nf_r * kt; // update thermostat masses - + double t_mass = boltz * t_target / (t_freq * t_freq); q_t[0] = nf_t * t_mass; q_r[0] = nf_r * t_mass; for (i = 1; i < t_chain; i++) q_t[i] = q_r[i] = t_mass; - + // update force of thermostats coupled to particles - + f_eta_t[0] = (akin_t * mvv2e - gfkt_t) / q_t[0]; f_eta_r[0] = (akin_r * mvv2e - gfkt_r) / q_r[0]; - + // multiple timestep iteration - + for (i = 0; i < t_iter; i++) { for (j = 0; j < t_order; j++) { - + // update thermostat velocities half step - + eta_dot_t[t_chain-1] += wdti2[j] * f_eta_t[t_chain-1]; eta_dot_r[t_chain-1] += wdti2[j] * f_eta_r[t_chain-1]; - + for (k = 1; k < t_chain; k++) { tmp = wdti4[j] * eta_dot_t[t_chain-k]; ms = maclaurin_series(tmp); s = exp(-1.0 * tmp); s2 = s * s; - eta_dot_t[t_chain-k-1] = eta_dot_t[t_chain-k-1] * s2 + + eta_dot_t[t_chain-k-1] = eta_dot_t[t_chain-k-1] * s2 + wdti2[j] * f_eta_t[t_chain-k-1] * s * ms; - + tmp = wdti4[j] * eta_dot_r[t_chain-k]; ms = maclaurin_series(tmp); s = exp(-1.0 * tmp); s2 = s * s; - eta_dot_r[t_chain-k-1] = eta_dot_r[t_chain-k-1] * s2 + + eta_dot_r[t_chain-k-1] = eta_dot_r[t_chain-k-1] * s2 + wdti2[j] * f_eta_r[t_chain-k-1] * s * ms; } - + // update thermostat positions a full step - + for (k = 0; k < t_chain; k++) { eta_t[k] += wdti1[j] * eta_dot_t[k]; eta_r[k] += wdti1[j] * eta_dot_r[k]; } - - // update thermostat forces - + + // update thermostat forces + for (k = 1; k < t_chain; k++) { f_eta_t[k] = q_t[k-1] * eta_dot_t[k-1] * eta_dot_t[k-1] - kt; f_eta_t[k] /= q_t[k]; f_eta_r[k] = q_r[k-1] * eta_dot_r[k-1] * eta_dot_r[k-1] - kt; f_eta_r[k] /= q_r[k]; } - + // update thermostat velocities a full step - + for (k = 0; k < t_chain-1; k++) { tmp = wdti4[j] * eta_dot_t[k+1]; ms = maclaurin_series(tmp); @@ -918,7 +918,7 @@ void FixRigidNHSmall::nhc_temp_integrate() eta_dot_t[k] = eta_dot_t[k] * s2 + wdti2[j] * f_eta_t[k] * s * ms; tmp = q_t[k] * eta_dot_t[k] * eta_dot_t[k] - kt; f_eta_t[k+1] = tmp / q_t[k+1]; - + tmp = wdti4[j] * eta_dot_r[k+1]; ms = maclaurin_series(tmp); s = exp(-1.0 * tmp); @@ -927,7 +927,7 @@ void FixRigidNHSmall::nhc_temp_integrate() tmp = q_r[k] * eta_dot_r[k] * eta_dot_r[k] - kt; f_eta_r[k+1] = tmp / q_r[k+1]; } - + eta_dot_t[t_chain-1] += wdti2[j] * f_eta_t[t_chain-1]; eta_dot_r[t_chain-1] += wdti2[j] * f_eta_r[t_chain-1]; } @@ -942,9 +942,9 @@ void FixRigidNHSmall::nhc_press_integrate() double tmp,s,s2,ms,kecurrent; double kt = boltz * t_target; double lkt_press = kt; - + // update thermostat masses - + double tb_mass = kt / (p_freq_max * p_freq_max); q_b[0] = dimension * dimension * tb_mass; for (int i = 1; i < p_chain; i++) { @@ -952,11 +952,11 @@ void FixRigidNHSmall::nhc_press_integrate() f_eta_b[i] = q_b[i-1] * eta_dot_b[i-1] * eta_dot_b[i-1] - kt; f_eta_b[i] /= q_b[i]; } - + // update forces acting on thermostat - + kecurrent = 0.0; - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) if (p_flag[i]) { epsilon_mass[i] = (g_f + dimension) * kt / (p_freq[i] * p_freq[i]); kecurrent += epsilon_mass[i] * epsilon_dot[i] * epsilon_dot[i]; @@ -966,37 +966,37 @@ void FixRigidNHSmall::nhc_press_integrate() f_eta_b[0] = (kecurrent - lkt_press) / q_b[0]; // multiple timestep iteration - + for (i = 0; i < t_iter; i++) { for (j = 0; j < t_order; j++) { // update thermostat velocities a half step - + eta_dot_b[p_chain-1] += wdti2[j] * f_eta_b[p_chain-1]; - + for (k = 1; k < p_chain; k++) { tmp = wdti4[j] * eta_dot_b[p_chain-k]; ms = maclaurin_series(tmp); s = exp(-0.5 * tmp); s2 = s * s; - eta_dot_b[p_chain-k-1] = eta_dot_b[p_chain-k-1] * s2 + + eta_dot_b[p_chain-k-1] = eta_dot_b[p_chain-k-1] * s2 + wdti2[j] * f_eta_b[p_chain-k-1] * s * ms; } - + // update thermostat positions - + for (k = 0; k < p_chain; k++) eta_b[k] += wdti1[j] * eta_dot_b[k]; - + // update thermostat forces - + for (k = 1; k < p_chain; k++) { f_eta_b[k] = q_b[k-1] * eta_dot_b[k-1] * eta_dot_b[k-1] - kt; f_eta_b[k] /= q_b[k]; } // update thermostat velocites a full step - + for (k = 0; k < p_chain-1; k++) { tmp = wdti4[j] * eta_dot_b[k+1]; ms = maclaurin_series(tmp); @@ -1006,13 +1006,13 @@ void FixRigidNHSmall::nhc_press_integrate() tmp = q_b[k] * eta_dot_b[k] * eta_dot_b[k] - kt; f_eta_b[k+1] = tmp / q_b[k+1]; } - + eta_dot_b[p_chain-1] += wdti2[j] * f_eta_b[p_chain-1]; } } } -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- compute kinetic energy in the extended Hamiltonian conserved quantity = sum of returned energy and potential energy -----------------------------------------------------------------------*/ @@ -1022,22 +1022,22 @@ double FixRigidNHSmall::compute_scalar() int i,k; double kt = boltz * t_target; double energy,ke_t,ke_q,tmp,Pkq[4]; - + double *vcm,*quat; - + // compute the kinetic parts of H_NVE in Kameraj et al (JCP 2005, pp 224114) - + // translational and rotational kinetic energies ke_t = 0.0; ke_q = 0.0; - + for (int i = 0; i < nlocal_body; i++) { vcm = body[i].vcm; quat = body[i].quat; ke_t += body[i].mass * (vcm[0]*vcm[0] + vcm[1]*vcm[1] + vcm[2]*vcm[2]); - + for (k = 1; k < 4; k++) { if (k == 1) { Pkq[0] = -quat[1]; @@ -1053,43 +1053,43 @@ double FixRigidNHSmall::compute_scalar() Pkq[0] = -quat[3]; Pkq[1] = quat[2]; Pkq[2] = -quat[1]; - Pkq[3] = quat[0]; + Pkq[3] = quat[0]; } - + tmp = body[i].conjqm[0]*Pkq[0] + body[i].conjqm[1]*Pkq[1] + body[i].conjqm[2]*Pkq[2] + body[i].conjqm[3]*Pkq[3]; tmp *= tmp; - + if (fabs(body[i].inertia[k-1]) < 1e-6) tmp = 0.0; - else tmp /= (8.0 * body[i].inertia[k-1]); + else tmp /= (8.0 * body[i].inertia[k-1]); ke_q += tmp; } } - + double ke[2],keall[2]; ke[0] = ke_t; ke[1] = ke_q; MPI_Allreduce(ke,keall,2,MPI_DOUBLE,MPI_SUM,world); ke_t = keall[0]; ke_q = keall[1]; - + energy = (ke_t + ke_q) * mvv2e; - + if (tstat_flag) { - + // thermostat chain energy: from equation 12 in Kameraj et al (JCP 2005) energy += kt * (nf_t * eta_t[0] + nf_r * eta_r[0]); - - for (i = 1; i < t_chain; i++) + + for (i = 1; i < t_chain; i++) energy += kt * (eta_t[i] + eta_r[i]); - + for (i = 0; i < t_chain; i++) { energy += 0.5 * q_t[i] * (eta_dot_t[i] * eta_dot_t[i]); energy += 0.5 * q_r[i] * (eta_dot_r[i] * eta_dot_r[i]); } } - + if (pstat_flag) { // using equation 22 in Kameraj et al for H_NPT @@ -1099,7 +1099,7 @@ double FixRigidNHSmall::compute_scalar() if (p_flag[i]) e += epsilon_mass[i] * epsilon_dot[i] * epsilon_dot[i]; energy += e*(0.5/pdim); - + double vol; if (dimension == 2) vol = domain->xprd * domain->yprd; else vol = domain->xprd * domain->yprd * domain->zprd; @@ -1112,7 +1112,7 @@ double FixRigidNHSmall::compute_scalar() energy += 0.5 * q_b[i] * (eta_dot_b[i] * eta_dot_b[i]); } } - + return energy; } @@ -1121,7 +1121,7 @@ double FixRigidNHSmall::compute_scalar() void FixRigidNHSmall::couple() { double *tensor = pressure->vector; - + if (pstyle == ISO) { p_current[0] = p_current[1] = p_current[2] = pressure->scalar; } else if (pcouple == XYZ) { @@ -1152,30 +1152,30 @@ void FixRigidNHSmall::remap() { int i; double oldlo,oldhi,ctr,expfac; - + double **x = atom->x; int *mask = atom->mask; int nlocal = atom->nlocal; - + // epsilon is not used, except for book-keeping - + for (i = 0; i < 3; i++) epsilon[i] += dtq * epsilon_dot[i]; - + // convert pertinent atoms and rigid bodies to lamda coords - + if (allremap) domain->x2lamda(nlocal); else { for (i = 0; i < nlocal; i++) if (mask[i] & dilate_group_bit) domain->x2lamda(x[i],x[i]); } - + if (nrigidfix) for (i = 0; i < nrigidfix; i++) modify->fix[rfix[i]]->deform(0); - + // reset global and local box to new size/shape - + for (i = 0; i < 3; i++) { if (p_flag[i]) { oldlo = domain->boxlo[i]; @@ -1189,16 +1189,16 @@ void FixRigidNHSmall::remap() domain->set_global_box(); domain->set_local_box(); - + // convert pertinent atoms and rigid bodies back to box coords - + if (allremap) domain->lamda2x(nlocal); else { for (i = 0; i < nlocal; i++) if (mask[i] & dilate_group_bit) domain->lamda2x(x[i],x[i]); } - + if (nrigidfix) for (i = 0; i< nrigidfix; i++) modify->fix[rfix[i]]->deform(1); @@ -1212,7 +1212,7 @@ void FixRigidNHSmall::compute_temp_target() { double delta = update->ntimestep - update->beginstep; if (delta != 0.0) delta /= update->endstep - update->beginstep; - + t_target = t_start + delta * (t_stop-t_start); } @@ -1224,7 +1224,7 @@ void FixRigidNHSmall::compute_press_target() { double delta = update->ntimestep - update->beginstep; if (delta != 0.0) delta /= update->endstep - update->beginstep; - + p_hydro = 0.0; for (int i = 0; i < 3; i++) if (p_flag[i]) { @@ -1247,9 +1247,9 @@ void FixRigidNHSmall::nh_epsilon_dot() else volume = domain->xprd*domain->yprd*domain->zprd; // MTK terms - + mtk_term1 = (akin_t + akin_r) * mvv2e / g_f; - + scale = exp(-1.0 * dtq * eta_dot_b[0]); for (i = 0; i < 3; i++) @@ -1259,7 +1259,7 @@ void FixRigidNHSmall::nh_epsilon_dot() epsilon_dot[i] += dtq * f_epsilon; epsilon_dot[i] *= scale; } - + mtk_term2 = 0.0; for (i = 0; i < 3; i++) if (p_flag[i]) mtk_term2 += epsilon_dot[i]; @@ -1267,15 +1267,15 @@ void FixRigidNHSmall::nh_epsilon_dot() } /* ---------------------------------------------------------------------- - pack entire state of Fix into one write + pack entire state of Fix into one write ------------------------------------------------------------------------- */ void FixRigidNHSmall::write_restart(FILE *fp) { if (tstat_flag == 0 && pstat_flag == 0) return; - + int nsize = 2; // tstat_flag and pstat_flag - + if (tstat_flag) { nsize += 1; // t_chain nsize += 4*t_chain; // eta_t, eta_r, eta_dot_t, eta_dot_r @@ -1285,12 +1285,12 @@ void FixRigidNHSmall::write_restart(FILE *fp) nsize += 7; // p_chain, epsilon(3) and epsilon_dot(3) nsize += 2*p_chain; } - + double *list; memory->create(list,nsize,"rigid_nh:list"); - + int n = 0; - + list[n++] = tstat_flag; if (tstat_flag) { list[n++] = t_chain; @@ -1301,7 +1301,7 @@ void FixRigidNHSmall::write_restart(FILE *fp) list[n++] = eta_dot_r[i]; } } - + list[n++] = pstat_flag; if (pstat_flag) { list[n++] = epsilon[0]; @@ -1310,25 +1310,25 @@ void FixRigidNHSmall::write_restart(FILE *fp) list[n++] = epsilon_dot[0]; list[n++] = epsilon_dot[1]; list[n++] = epsilon_dot[2]; - + list[n++] = p_chain; for (int i = 0; i < p_chain; i++) { list[n++] = eta_b[i]; list[n++] = eta_dot_b[i]; } } - + if (comm->me == 0) { int size = (nsize)*sizeof(double); fwrite(&size,sizeof(int),1,fp); fwrite(list,sizeof(double),nsize,fp); } - + memory->destroy(list); } /* ---------------------------------------------------------------------- - use state info from restart file to restart the Fix + use state info from restart file to restart the Fix ------------------------------------------------------------------------- */ void FixRigidNHSmall::restart(char *buf) @@ -1336,7 +1336,7 @@ void FixRigidNHSmall::restart(char *buf) int n = 0; double *list = (double *) buf; int flag = static_cast<int> (list[n++]); - + if (flag) { int m = static_cast<int> (list[n++]); if (tstat_flag && m == t_chain) { @@ -1357,7 +1357,7 @@ void FixRigidNHSmall::restart(char *buf) epsilon_dot[0] = list[n++]; epsilon_dot[1] = list[n++]; epsilon_dot[2] = list[n++]; - + int m = static_cast<int> (list[n++]); if (pstat_flag && m == p_chain) { for (int i = 0; i < p_chain; i++) { @@ -1444,7 +1444,7 @@ void FixRigidNHSmall::allocate_chain() f_eta_t = new double[t_chain]; f_eta_r = new double[t_chain]; } - + if (pstat_flag) { q_b = new double[p_chain]; eta_b = new double[p_chain]; @@ -1484,7 +1484,7 @@ void FixRigidNHSmall::deallocate_chain() delete [] f_eta_t; delete [] f_eta_r; } - + if (pstat_flag) { delete [] q_b; delete [] eta_b; diff --git a/src/RIGID/fix_rigid_nh_small.h b/src/RIGID/fix_rigid_nh_small.h index aed112a632005d6246fc3d73be521487f75c7cd6..f771b8c41b5b8bfb8ca6782e813110e64dcbedcd 100644 --- a/src/RIGID/fix_rigid_nh_small.h +++ b/src/RIGID/fix_rigid_nh_small.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -32,11 +32,11 @@ class FixRigidNHSmall : public FixRigidSmall { void write_restart(FILE *); void restart(char *buf); void reset_target(double); - + protected: double boltz,nktv2p,mvv2e; // boltzman constant, conversion factors - int dimension; // # of dimensions + int dimension; // # of dimensions int nf_t,nf_r; // trans/rot degrees of freedom double onednft,onednfr; // factors 1 + dimension/trans(rot) degrees of freedom double *w,*wdti1,*wdti2,*wdti4; // Yoshida-Suzuki coefficients @@ -44,13 +44,13 @@ class FixRigidNHSmall : public FixRigidSmall { double *eta_t,*eta_r; // trans/rot thermostat positions double *eta_dot_t,*eta_dot_r; // trans/rot thermostat velocities double *f_eta_t,*f_eta_r; // trans/rot thermostat forces - + double epsilon_mass[3], *q_b; // baro/thermo masses double epsilon[3],*eta_b; // baro/thermo positions double epsilon_dot[3],*eta_dot_b; // baro/thermo velocities double *f_eta_b; // thermo forces double akin_t,akin_r; // translational/rotational kinetic energies - + int kspace_flag; // 1 if KSpace invoked, 0 if not int nrigidfix; // number of rigid fixes int *rfix; // indicies of rigid fixes @@ -60,18 +60,18 @@ class FixRigidNHSmall : public FixRigidSmall { int pdim,g_f; // number of barostatted dims, total DoFs double p_hydro; // hydrostatic target pressure double p_freq_max; // maximum barostat frequency - + double mtk_term1,mtk_term2; // Martyna-Tobias-Klein corrections double t_target,t_current; double t_freq; - + char *id_temp,*id_press; class Compute *temperature,*pressure; int tcomputeflag,pcomputeflag; void couple(); - void remap(); + void remap(); void nhc_temp_integrate(); void nhc_press_integrate(); diff --git a/src/RIGID/fix_rigid_nph.cpp b/src/RIGID/fix_rigid_nph.cpp index 663511553beb8cdee0a1f98e44cba46754f6570e..c0aa3b7040e0224a495af26dd7e934d2ab4b018f 100644 --- a/src/RIGID/fix_rigid_nph.cpp +++ b/src/RIGID/fix_rigid_nph.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,7 +17,7 @@ Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_rigid_nph.h" #include "domain.h" #include "modify.h" @@ -29,14 +29,14 @@ using namespace LAMMPS_NS; FixRigidNPH::FixRigidNPH(LAMMPS *lmp, int narg, char **arg) : FixRigidNH(lmp, narg, arg) -{ +{ // other setting are made by parent scalar_flag = 1; restart_global = 1; box_change_size = 1; extscalar = 1; - + // error checks if (pstat_flag == 0) @@ -65,15 +65,15 @@ FixRigidNPH::FixRigidNPH(LAMMPS *lmp, int narg, char **arg) : char **newarg = new char*[3]; newarg[0] = id_temp; newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; + newarg[2] = (char *) "temp"; modify->add_compute(3,newarg); delete [] newarg; tcomputeflag = 1; - + // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - + n = strlen(id) + 7; id_press = new char[n]; strcpy(id_press,id); diff --git a/src/RIGID/fix_rigid_nph.h b/src/RIGID/fix_rigid_nph.h index 58054c17a7f2823747f2299d21709b569f326071..836c357d8f7a63acf06911d641289522f6760254 100644 --- a/src/RIGID/fix_rigid_nph.h +++ b/src/RIGID/fix_rigid_nph.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_nph_small.cpp b/src/RIGID/fix_rigid_nph_small.cpp index f7eef137915bd78e91a7b93fc86a7a76855913fc..4e3e54766f7cbc8e7b179d63e0c5da394d51f956 100644 --- a/src/RIGID/fix_rigid_nph_small.cpp +++ b/src/RIGID/fix_rigid_nph_small.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,7 +17,7 @@ Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_rigid_nph_small.h" #include "domain.h" #include "modify.h" @@ -29,24 +29,24 @@ using namespace LAMMPS_NS; FixRigidNPHSmall::FixRigidNPHSmall(LAMMPS *lmp, int narg, char **arg) : FixRigidNHSmall(lmp, narg, arg) -{ +{ // other setting are made by parent scalar_flag = 1; restart_global = 1; box_change_size = 1; extscalar = 1; - + // error checks if (pstat_flag == 0) error->all(FLERR,"Pressure control must be used with fix nph/small"); if (tstat_flag == 1) error->all(FLERR,"Temperature control must not be used with fix nph/small"); - if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 || + if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 || p_stop[0] < 0.0 || p_stop[1] < 0.0 || p_stop[2] < 0.0) error->all(FLERR,"Target pressure for fix rigid/nph cannot be < 0.0"); - + // convert input periods to frequency p_freq[0] = p_freq[1] = p_freq[2] = 0.0; @@ -68,15 +68,15 @@ FixRigidNPHSmall::FixRigidNPHSmall(LAMMPS *lmp, int narg, char **arg) : char **newarg = new char*[3]; newarg[0] = id_temp; newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; + newarg[2] = (char *) "temp"; modify->add_compute(3,newarg); delete [] newarg; tcomputeflag = 1; - + // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - + n = strlen(id) + 7; id_press = new char[n]; strcpy(id_press,id); diff --git a/src/RIGID/fix_rigid_nph_small.h b/src/RIGID/fix_rigid_nph_small.h index 8dae871a82a457ce83e312bd95f641a7e3424765..073fbee5eb1b100a44352b64a6b8c755b465ab61 100644 --- a/src/RIGID/fix_rigid_nph_small.h +++ b/src/RIGID/fix_rigid_nph_small.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_npt.cpp b/src/RIGID/fix_rigid_npt.cpp index 2e88ab34b095c2bddc07e3eae6c97eb63b3481a4..24e12e41c235e37b26b9fa77b1f353d9c440223a 100644 --- a/src/RIGID/fix_rigid_npt.cpp +++ b/src/RIGID/fix_rigid_npt.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,7 +17,7 @@ Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_rigid_npt.h" #include "domain.h" #include "modify.h" @@ -29,14 +29,14 @@ using namespace LAMMPS_NS; FixRigidNPT::FixRigidNPT(LAMMPS *lmp, int narg, char **arg) : FixRigidNH(lmp, narg, arg) -{ +{ // other setting are made by parent scalar_flag = 1; restart_global = 1; box_change_size = 1; extscalar = 1; - + // error checks if (tstat_flag == 0 || pstat_flag == 0) @@ -49,7 +49,7 @@ FixRigidNPT::FixRigidNPT(LAMMPS *lmp, int narg, char **arg) : if (t_chain < 1) error->all(FLERR,"Illegal fix rigid/npt command"); if (t_iter < 1) error->all(FLERR,"Illegal fix rigid/npt command"); - if (t_order != 3 && t_order != 5) + if (t_order != 3 && t_order != 5) error->all(FLERR,"Fix rigid/npt temperature order must be 3 or 5"); // convert input periods to frequency @@ -75,15 +75,15 @@ FixRigidNPT::FixRigidNPT(LAMMPS *lmp, int narg, char **arg) : char **newarg = new char*[3]; newarg[0] = id_temp; newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; + newarg[2] = (char *) "temp"; modify->add_compute(3,newarg); delete [] newarg; tcomputeflag = 1; - + // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - + n = strlen(id) + 7; id_press = new char[n]; strcpy(id_press,id); diff --git a/src/RIGID/fix_rigid_npt.h b/src/RIGID/fix_rigid_npt.h index 73881dc19362990f320f5d314f56a6ffcd0cf86e..09efecdae8620d437eac5378780782fb7c801a83 100644 --- a/src/RIGID/fix_rigid_npt.h +++ b/src/RIGID/fix_rigid_npt.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_npt_small.cpp b/src/RIGID/fix_rigid_npt_small.cpp index 472cccf85a6d02682a136f748dcb85a57cb2767a..551ef50ca91ce84b8d00dc1ed3e41c754bb18ad3 100644 --- a/src/RIGID/fix_rigid_npt_small.cpp +++ b/src/RIGID/fix_rigid_npt_small.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,7 +17,7 @@ Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_rigid_npt_small.h" #include "domain.h" #include "modify.h" @@ -29,21 +29,21 @@ using namespace LAMMPS_NS; FixRigidNPTSmall::FixRigidNPTSmall(LAMMPS *lmp, int narg, char **arg) : FixRigidNHSmall(lmp, narg, arg) -{ +{ // other setting are made by parent scalar_flag = 1; restart_global = 1; box_change_size = 1; extscalar = 1; - + // error checks if (tstat_flag == 0 || pstat_flag == 0) error->all(FLERR,"Did not set temp or press for fix rigid/npt/small"); if (t_start <= 0.0 || t_stop <= 0.0) error->all(FLERR,"Target temperature for fix rigid/npt/small cannot be 0.0"); - if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 || + if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 || p_stop[0] < 0.0 || p_stop[1] < 0.0 || p_stop[2] < 0.0) error->all(FLERR,"Target pressure for fix rigid/npt/small cannot be < 0.0"); @@ -53,7 +53,7 @@ FixRigidNPTSmall::FixRigidNPTSmall(LAMMPS *lmp, int narg, char **arg) : if (t_chain < 1) error->all(FLERR,"Fix rigid npt/small t_chain should not be less than 1"); if (t_iter < 1) error->all(FLERR,"Fix rigid npt/small t_chain should not be less than 1"); - if (t_order != 3 && t_order != 5) + if (t_order != 3 && t_order != 5) error->all(FLERR,"Fix rigid npt/small t_order must be 3 or 5"); // convert input periods to frequency @@ -79,15 +79,15 @@ FixRigidNPTSmall::FixRigidNPTSmall(LAMMPS *lmp, int narg, char **arg) : char **newarg = new char*[3]; newarg[0] = id_temp; newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; + newarg[2] = (char *) "temp"; modify->add_compute(3,newarg); delete [] newarg; tcomputeflag = 1; - + // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - + n = strlen(id) + 7; id_press = new char[n]; strcpy(id_press,id); diff --git a/src/RIGID/fix_rigid_npt_small.h b/src/RIGID/fix_rigid_npt_small.h index fd762e7dbb63b0c6c693fffdcfa42e78a288b8c5..82bac2780e5163866f876d9dbf2f8d232e207ea2 100644 --- a/src/RIGID/fix_rigid_npt_small.h +++ b/src/RIGID/fix_rigid_npt_small.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_nve.cpp b/src/RIGID/fix_rigid_nve.cpp index 6cde617e5941a76c1fea690af0cd06efc1cf1099..731940b64855a5663c767489135ad610bda295e8 100644 --- a/src/RIGID/fix_rigid_nve.cpp +++ b/src/RIGID/fix_rigid_nve.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_nve.h b/src/RIGID/fix_rigid_nve.h index 98e1e00574cb35f981b542870c5acf8719ebd45a..22039eaf0946a01a2bde83ba04e767fdfa1dc5b5 100644 --- a/src/RIGID/fix_rigid_nve.h +++ b/src/RIGID/fix_rigid_nve.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_nve_small.cpp b/src/RIGID/fix_rigid_nve_small.cpp index fdea05db091644058532d7f064dcc4023925b9a6..25ec7234642d6f0e5344f79db2de6e7f41a040de 100644 --- a/src/RIGID/fix_rigid_nve_small.cpp +++ b/src/RIGID/fix_rigid_nve_small.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_nve_small.h b/src/RIGID/fix_rigid_nve_small.h index db9485cbf56bbf5a3b855710f3757006a4f2c1e3..f534a3efa84c120a6b69d2d5c5b9371ddd1db01c 100644 --- a/src/RIGID/fix_rigid_nve_small.h +++ b/src/RIGID/fix_rigid_nve_small.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_nvt.cpp b/src/RIGID/fix_rigid_nvt.cpp index 0f5593777cd7816640f61a94e4280ee1b770937d..f7723d03c8e564e3bef5a054b65a72521ddac31f 100644 --- a/src/RIGID/fix_rigid_nvt.cpp +++ b/src/RIGID/fix_rigid_nvt.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -26,13 +26,13 @@ using namespace LAMMPS_NS; FixRigidNVT::FixRigidNVT(LAMMPS *lmp, int narg, char **arg) : FixRigidNH(lmp, narg, arg) -{ +{ // other settings are made by parent scalar_flag = 1; restart_global = 1; extscalar = 1; - + // error checking // convert input period to frequency @@ -45,6 +45,6 @@ FixRigidNVT::FixRigidNVT(LAMMPS *lmp, int narg, char **arg) : if (t_chain < 1) error->all(FLERR,"Illegal fix rigid/nvt command"); if (t_iter < 1) error->all(FLERR,"Illegal fix rigid/nvt command"); - if (t_order != 3 && t_order != 5) - error->all(FLERR,"Fix rigid/nvt temperature order must be 3 or 5"); + if (t_order != 3 && t_order != 5) + error->all(FLERR,"Fix rigid/nvt temperature order must be 3 or 5"); } diff --git a/src/RIGID/fix_rigid_nvt.h b/src/RIGID/fix_rigid_nvt.h index 293b4abec35da416adcf4ab697a627cc6fe52f5b..11091125aea0940c107e3fe2497a6520ac082536 100644 --- a/src/RIGID/fix_rigid_nvt.h +++ b/src/RIGID/fix_rigid_nvt.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_nvt_small.cpp b/src/RIGID/fix_rigid_nvt_small.cpp index f21f7168ac515e747b350eb931d2d9acbc39c275..42fd31537b48c2260d61b84831af308396568533 100644 --- a/src/RIGID/fix_rigid_nvt_small.cpp +++ b/src/RIGID/fix_rigid_nvt_small.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -26,13 +26,13 @@ using namespace LAMMPS_NS; FixRigidNVTSmall::FixRigidNVTSmall(LAMMPS *lmp, int narg, char **arg) : FixRigidNHSmall(lmp, narg, arg) -{ +{ // other settings are made by parent scalar_flag = 1; restart_global = 1; extscalar = 1; - + // error checking // convert input period to frequency @@ -45,6 +45,6 @@ FixRigidNVTSmall::FixRigidNVTSmall(LAMMPS *lmp, int narg, char **arg) : if (t_chain < 1) error->all(FLERR,"Fix rigid nvt/small t_chain should not be less than 1"); if (t_iter < 1) error->all(FLERR,"Fix rigid nvt/small t_iter should not be less than 1"); - if (t_order != 3 && t_order != 5) - error->all(FLERR,"Fix rigid nvt/small t_order must be 3 or 5"); + if (t_order != 3 && t_order != 5) + error->all(FLERR,"Fix rigid nvt/small t_order must be 3 or 5"); } diff --git a/src/RIGID/fix_rigid_nvt_small.h b/src/RIGID/fix_rigid_nvt_small.h index 62d550ac2849b5088fa02d1029b6ba6c4fbe3137..5fd0ce290ad2fb8fa7fe23ef9e080fcc09ce9a9e 100644 --- a/src/RIGID/fix_rigid_nvt_small.h +++ b/src/RIGID/fix_rigid_nvt_small.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index fb9c0b42e8f464ccc62392535bb0f58d78fffeae..d1263ff0a795cbc6f374d83d286f4cce8a801a21 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_rigid_small.h" #include "math_extra.h" #include "atom.h" @@ -101,7 +101,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // parse args for rigid body specification if (narg < 4) error->all(FLERR,"Illegal fix rigid/small command"); - if (strcmp(arg[3],"molecule") != 0) + if (strcmp(arg[3],"molecule") != 0) error->all(FLERR,"Illegal fix rigid/small command"); if (atom->molecule_flag == 0) @@ -188,7 +188,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"temp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); - if (strcmp(style,"rigid/nvt/small") != 0 && + if (strcmp(style,"rigid/nvt/small") != 0 && strcmp(style,"rigid/npt/small") != 0) error->all(FLERR,"Illegal fix rigid command"); tstat_flag = 1; @@ -199,13 +199,13 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"iso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); - if (strcmp(style,"rigid/npt/small") != 0 && + if (strcmp(style,"rigid/npt/small") != 0 && strcmp(style,"rigid/nph/small") != 0) error->all(FLERR,"Illegal fix rigid/small command"); pcouple = XYZ; p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { @@ -216,12 +216,12 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"aniso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); - if (strcmp(style,"rigid/npt/small") != 0 && + if (strcmp(style,"rigid/npt/small") != 0 && strcmp(style,"rigid/nph/small") != 0) error->all(FLERR,"Illegal fix rigid/small command"); p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { @@ -265,7 +265,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"dilate") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small nvt/npt/nph command"); if (strcmp(arg[iarg+1],"all") == 0) allremap = 1; else { @@ -283,7 +283,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"tparam") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); - if (strcmp(style,"rigid/nvt/small") != 0 && + if (strcmp(style,"rigid/nvt/small") != 0 && strcmp(style,"rigid/npt/small") != 0) error->all(FLERR,"Illegal fix rigid/small command"); t_chain = force->numeric(FLERR,arg[iarg+1]); @@ -293,7 +293,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command"); - if (strcmp(style,"rigid/npt/small") != 0 && + if (strcmp(style,"rigid/npt/small") != 0 && strcmp(style,"rigid/nph/small") != 0) error->all(FLERR,"Illegal fix rigid/small command"); p_chain = force->numeric(FLERR,arg[iarg+1]); @@ -313,7 +313,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix rigid/small molecule must have atom types"); // fix rigid/small uses center, masstotal, COM, inertia of molecule - + onemols[i]->compute_center(); onemols[i]->compute_mass(); onemols[i]->compute_com(); @@ -324,7 +324,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // set pstat_flag pstat_flag = 0; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) if (p_flag[i]) pstat_flag = 1; if (pcouple == XYZ || (domain->dimension == 2 && pcouple == XY)) pstyle = ISO; @@ -445,7 +445,7 @@ FixRigidSmall::~FixRigidSmall() // delete locally stored arrays memory->sfree(body); - + memory->destroy(bodyown); memory->destroy(bodytag); memory->destroy(atom2body); @@ -736,7 +736,7 @@ void FixRigidSmall::post_force(int vflag) langextra[ibody][0] = gamma1*vcm[0] + gamma2*(random->uniform()-0.5); langextra[ibody][1] = gamma1*vcm[1] + gamma2*(random->uniform()-0.5); langextra[ibody][2] = gamma1*vcm[2] + gamma2*(random->uniform()-0.5); - + gamma1 = -1.0 / t_period / ftm2v; gamma2 = tsqrt * sqrt(24.0*boltz/t_period/dt/mvv2e) / ftm2v; langextra[ibody][3] = inertia[0]*gamma1*omega[0] + @@ -833,7 +833,7 @@ void FixRigidSmall::final_integrate() } // update vcm and angmom, recompute omega - + for (int ibody = 0; ibody < nlocal_body; ibody++) { Body *b = &body[ibody]; @@ -900,10 +900,10 @@ void FixRigidSmall::final_integrate_respa(int ilevel, int iloop) (2) change in imagebody due to xcm remap xcmimage flags are always -1,0,-1 so that body can be unwrapped around in-box xcm and stay close to simulation box - if just inferred unwrapped from atom image flags, + if just inferred unwrapped from atom image flags, then a body could end up very far away when unwrapped by true image flags - then set_xv() will compute huge displacements every step to reset coords of + then set_xv() will compute huge displacements every step to reset coords of all the body atoms to be back inside the box, ditto for triclinic box flip note: so just want to avoid that numeric probem? ------------------------------------------------------------------------- */ @@ -913,7 +913,7 @@ void FixRigidSmall::pre_neighbor() for (int ibody = 0; ibody < nlocal_body; ibody++) { Body *b = &body[ibody]; domain->remap(b->xcm,b->image); - } + } nghost_body = 0; commflag = FULL_BODY; @@ -967,7 +967,7 @@ int FixRigidSmall::dof(int tgroup) // cannot count DOF correctly unless setup_bodies_static() has been called if (!setupflag) { - if (comm->me == 0) + if (comm->me == 0) error->warning(FLERR,"Cannot count rigid body degrees-of-freedom " "before bodies are fully initialized"); return 0; @@ -1472,10 +1472,10 @@ void FixRigidSmall::create_bodies() flag = 0; for (i = 0; i < n; i++) - if (bbox[i][0] == bbox[i][1] && bbox[i][2] == bbox[i][3] && + if (bbox[i][0] == bbox[i][1] && bbox[i][2] == bbox[i][3] && bbox[i][4] == bbox[i][5]) flag = 1; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall) + if (flagall) error->all(FLERR,"One or more rigid bodies are a single particle"); // ctr = center pt of each rigid body my atoms are part of @@ -1855,7 +1855,7 @@ void FixRigidSmall::setup_bodies_static() // set rigid body image flags to default values for (ibody = 0; ibody < nlocal_body; ibody++) - body[ibody].image = ((imageint) IMGMAX << IMG2BITS) | + body[ibody].image = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; // overwrite masstotal, center-of-mass, image flags with file values @@ -2330,7 +2330,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) FILE *fp; char *eof,*start,*next,*buf; char line[MAXLINE]; - + // create local hash with key/value pairs // key = mol ID of bodies my atoms own // value = index into local body array @@ -2353,7 +2353,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) + if (eof == NULL) error->one(FLERR,"Unexpected end of fix rigid/small file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; @@ -2381,7 +2381,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (nwords != ATTRIBUTE_PERBODY) error->all(FLERR,"Incorrect rigid body format in fix rigid/small file"); - + // loop over lines of rigid body attributes // tokenize the line into values // id = rigid body ID = mol-ID @@ -2390,13 +2390,13 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) for (int i = 0; i < nchunk; i++) { next = strchr(buf,'\n'); - + values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) values[j] = strtok(NULL," \t\n\r\f"); id = ATOTAGINT(values[0]); - if (id <= 0 || id > maxmol) + if (id <= 0 || id > maxmol) error->all(FLERR,"Invalid rigid body ID in fix rigid/small file"); if (hash->find(id) == hash->end()) { buf = next + 1; @@ -2419,8 +2419,8 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) xbox = atoi(values[17]); ybox = atoi(values[18]); zbox = atoi(values[19]); - body[m].image = ((imageint) (xbox + IMGMAX) & IMGMASK) | - (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + body[m].image = ((imageint) (xbox + IMGMAX) & IMGMASK) | + (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } else { array[m][0] = atof(values[5]); @@ -2433,7 +2433,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) buf = next + 1; } - + nread += nchunk; } @@ -2555,7 +2555,7 @@ void FixRigidSmall::write_restart_file(char *file) static_cast<int> (buf[i][18]), static_cast<int> (buf[i][19])); } - + } else { MPI_Recv(&tmp,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); MPI_Rsend(&buf[0][0],sendrow*ncol,MPI_DOUBLE,0,0,world); @@ -3212,11 +3212,11 @@ void FixRigidSmall::reset_atom2body() if (iowner == -1) { char str[128]; sprintf(str, - "Rigid body atoms " TAGINT_FORMAT " " TAGINT_FORMAT + "Rigid body atoms " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, atom->tag[i],bodytag[i],comm->me,update->ntimestep); error->one(FLERR,str); - + } atom2body[i] = bodyown[iowner]; } @@ -3353,7 +3353,7 @@ double FixRigidSmall::extract_erotational() double erotate = 0.0; for (int i = 0; i < nlocal_body; i++) { - // for Iw^2 rotational term, need wbody = angular velocity in body frame + // for Iw^2 rotational term, need wbody = angular velocity in body frame // not omega = angular velocity in space frame inertia = body[i].inertia; @@ -3393,7 +3393,7 @@ double FixRigidSmall::compute_scalar() vcm = body[i].vcm; t += body[i].mass * (vcm[0]*vcm[0] + vcm[1]*vcm[1] + vcm[2]*vcm[2]); - // for Iw^2 rotational term, need wbody = angular velocity in body frame + // for Iw^2 rotational term, need wbody = angular velocity in body frame // not omega = angular velocity in space frame inertia = body[i].inertia; @@ -3481,7 +3481,7 @@ void FixRigidSmall::check(int flag) for (int i = atom->nlocal; i < atom->nlocal + atom->nghost; i++) { if (bodyown[i] >= 0) { - if (bodyown[i] < nlocal_body || + if (bodyown[i] < nlocal_body || bodyown[i] >= nlocal_body+nghost_body) { printf("Values %d %d: %d %d %d\n", i,atom->tag[i],bodyown[i],nlocal_body,nghost_body); @@ -3500,7 +3500,7 @@ void FixRigidSmall::check(int flag) printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); errorx->one(FLERR,"BAD III"); } - if (bodytag[body[i].ilocal] != atom->tag[body[i].ilocal] || + if (bodytag[body[i].ilocal] != atom->tag[body[i].ilocal] || bodyown[body[i].ilocal] != i) { printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); errorx->one(FLERR,"BAD JJJ"); @@ -3508,7 +3508,7 @@ void FixRigidSmall::check(int flag) } for (int i = nlocal_body; i < nlocal_body + nghost_body; i++) { - if (body[i].ilocal < atom->nlocal || + if (body[i].ilocal < atom->nlocal || body[i].ilocal >= atom->nlocal + atom->nghost) { printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); errorx->one(FLERR,"BAD KKK"); diff --git a/src/RIGID/fix_rigid_small.h b/src/RIGID/fix_rigid_small.h index 5d6c2fe36316f97c19b2796b7b0836590068b060..96c8f4e4dcccd6845ef968c5ba2d5b7dc66289b9 100644 --- a/src/RIGID/fix_rigid_small.h +++ b/src/RIGID/fix_rigid_small.h @@ -155,12 +155,12 @@ class FixRigidSmall : public Fix { class RanMars *random; // RNG int tstat_flag,pstat_flag; // 0/1 = no/yes thermostat/barostat - + int t_chain,t_iter,t_order; double p_start[3],p_stop[3]; double p_period[3],p_freq[3]; - int p_flag[3]; + int p_flag[3]; int pcouple,pstyle; int p_chain; diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index d82445560ae3c1d3bda6820c4f47a74d4069d564..18811eee6af88df0003073d8ff284d3e07d392fa 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -11,11 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" -#include "stdio.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> #include "fix_shake.h" #include "atom.h" #include "atom_vec.h" @@ -355,7 +355,7 @@ void FixShake::init() // set equilibrium angle distances int nlocal = atom->nlocal; - + for (i = 1; i <= atom->nangletypes; i++) { if (angle_flag[i] == 0) continue; if (force->angle == NULL) @@ -436,7 +436,7 @@ void FixShake::setup(int vflag) // half timestep constraint on pre-step, full timestep thereafter if (strstr(update->integrate_style,"verlet")) { - respa = 0; + respa = 0; dtv = update->dt; dtfsq = 0.5 * update->dt * update->dt * force->ftm2v; FixShake::post_force(vflag); @@ -444,7 +444,7 @@ void FixShake::setup(int vflag) } else { respa = 1; - dtv = step_respa[0]; + dtv = step_respa[0]; dtf_innerhalf = 0.5 * step_respa[0] * force->ftm2v; dtf_inner = dtf_innerhalf; @@ -499,7 +499,7 @@ void FixShake::pre_neighbor() atom2 = atom->map(shake_atom[i][1]); if (atom1 == -1 || atom2 == -1) { char str[128]; - sprintf(str,"Shake atoms " TAGINT_FORMAT " " TAGINT_FORMAT + sprintf(str,"Shake atoms " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, shake_atom[i][0],shake_atom[i][1],me,update->ntimestep); error->one(FLERR,str); @@ -511,7 +511,7 @@ void FixShake::pre_neighbor() atom3 = atom->map(shake_atom[i][2]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) { char str[128]; - sprintf(str,"Shake atoms " + sprintf(str,"Shake atoms " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, shake_atom[i][0],shake_atom[i][1],shake_atom[i][2], @@ -526,8 +526,8 @@ void FixShake::pre_neighbor() atom4 = atom->map(shake_atom[i][3]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) { char str[128]; - sprintf(str,"Shake atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Shake atoms " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, shake_atom[i][0],shake_atom[i][1], @@ -570,7 +570,7 @@ void FixShake::post_force(int vflag) else if (shake_flag[m] == 4) shake4(m); else shake3angle(m); } - + // store vflag for coordinate_constraints_end_of_step() vflag_post_force = vflag; @@ -670,7 +670,7 @@ void FixShake::find_clusters() tagint tagprev; double massone; tagint *buf; - + if (me == 0 && screen) { if (!rattle) fprintf(screen,"Finding SHAKE clusters ...\n"); else fprintf(screen,"Finding RATTLE clusters ...\n"); @@ -685,7 +685,7 @@ void FixShake::find_clusters() double *rmass = atom->rmass; int **nspecial = atom->nspecial; tagint **special = atom->special; - + int *molindex = atom->molindex; int *molatom = atom->molatom; @@ -956,7 +956,7 @@ void FixShake::find_clusters() comm->ring(size,sizeof(tagint),buf,2,ring_nshake,buf); // store partner info returned to me - + m = 0; while (m < size) { i = atom->map(buf[m]); @@ -2289,7 +2289,7 @@ int FixShake::bondtype_findset(int i, tagint n1, tagint n2, int setflag) tagint *batom = atommols[imol]->bond_atom[iatom]; btype = atommols[imol]->bond_type[iatom]; nbonds = atommols[imol]->num_bond[iatom]; - + for (m = 0; m < nbonds; m++) { if (n1 == tag[i] && n2 == batom[m]+tagprev) break; if (n1 == batom[m]+tagprev && n2 == tag[i]) break; @@ -2346,7 +2346,7 @@ int FixShake::angletype_findset(int i, tagint n1, tagint n2, int setflag) tagint *aatom3 = atommols[imol]->angle_atom3[iatom]; atype = atommols[imol]->angle_type[iatom]; nangles = atommols[imol]->num_angle[iatom]; - + for (m = 0; m < nangles; m++) { if (n1 == aatom1[m]+tagprev && n2 == aatom3[m]+tagprev) break; if (n1 == aatom3[m]+tagprev && n2 == aatom1[m]+tagprev) break; @@ -2456,7 +2456,7 @@ void FixShake::update_arrays(int i, int atom_offset) shake_atom[i][0] += atom_offset; shake_atom[i][1] += atom_offset; shake_atom[i][2] += atom_offset; - } else if (flag == 2) { + } else if (flag == 2) { shake_atom[i][0] += atom_offset; shake_atom[i][1] += atom_offset; } else if (flag == 3) { @@ -2602,7 +2602,7 @@ int FixShake::unpack_exchange(int nlocal, double *buf) /* ---------------------------------------------------------------------- */ -int FixShake::pack_forward_comm(int n, int *list, double *buf, +int FixShake::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; @@ -2691,7 +2691,7 @@ void FixShake::coordinate_constraints_end_of_step() { dtfsq = 0.5 * update->dt * update->dt * force->ftm2v; FixShake::post_force(vflag_post_force); if (!rattle) dtfsq = update->dt * update->dt * force->ftm2v; - } + } else { dtf_innerhalf = 0.5 * step_respa[0] * force->ftm2v; dtf_inner = dtf_innerhalf; diff --git a/src/RIGID/fix_shake.h b/src/RIGID/fix_shake.h index 049971ca4cc345dceb55394576b4802bbf296128..564d2fa96ecda0f966362a7c9a944194c544c8b7 100644 --- a/src/RIGID/fix_shake.h +++ b/src/RIGID/fix_shake.h @@ -61,7 +61,7 @@ class FixShake : public Fix { int max_iter; // max # of SHAKE iterations int output_every; // SHAKE stat output every so often bigint next_output; // timestep for next output - + // settings from input command int *bond_flag,*angle_flag; // bond/angle types to constrain int *type_flag; // constrain bonds to these types diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 310fc82633c0627e9fa38b963f320735de780500..e14d88aad9c9ef0e0b90bbb7cac92c1b61d16b59 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_append_atoms.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index c6d4978513705baab4a14cbcfbe36f91d12596cd..42b835860274a85f21264d0c5676a1ad6c0fd697 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -17,9 +17,9 @@ See Reed, Fried, Joannopoulos, Phys Rev Lett, 90, 235503 (2003) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_msst.h" #include "atom.h" #include "force.h" diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index 78079dbb641e4e96d8f2844349224f8ff3aea339..36500100cdc671517e0c63e3634c5bc826691a3c 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_nphug.h" #include "modify.h" #include "error.h" @@ -21,10 +21,10 @@ #include "force.h" #include "domain.h" #include "group.h" -#include "math.h" +#include <math.h> #include "memory.h" #include "comm.h" -#include "math.h" +#include <math.h> using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index 9217a24f6f57f7895c4c98469ad6cad8f3d2fcb6..443b2670cb1c9391831c6a656897e50ae3e96720 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_wall_piston.h" #include "atom.h" #include "modify.h" diff --git a/src/SNAP/compute_sna_atom.cpp b/src/SNAP/compute_sna_atom.cpp index 128eca00a9a3e8562f9fa3af35c4c3e2649e49c6..1f7c943719d9c4da6ce97fbf9d24b60b0573579f 100644 --- a/src/SNAP/compute_sna_atom.cpp +++ b/src/SNAP/compute_sna_atom.cpp @@ -5,14 +5,14 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #include "sna.h" -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "compute_sna_atom.h" #include "atom.h" #include "update.h" @@ -39,7 +39,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; - + if (narg < nargmin) error->all(FLERR,"Illegal compute sna/atom command"); // default values @@ -50,7 +50,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : // offset by 1 to match up with types - memory->create(radelem,ntypes+1,"sna/atom:radelem"); + memory->create(radelem,ntypes+1,"sna/atom:radelem"); memory->create(wjelem,ntypes+1,"sna/atom:wjelem"); rcutfac = atof(arg[3]); @@ -83,19 +83,19 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"diagonal") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute sna/atom command"); diagonalstyle = atoi(arg[iarg+1]); if (diagonalstyle < 0 || diagonalstyle > 3) error->all(FLERR,"Illegal compute sna/atom command"); iarg += 2; } else if (strcmp(arg[iarg],"rmin0") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute sna/atom command"); rmin0 = atof(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"switchflag") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute sna/atom command"); switchflag = atoi(arg[iarg+1]); iarg += 2; @@ -121,7 +121,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : nmax = 0; njmax = 0; sna = NULL; - + } /* ---------------------------------------------------------------------- */ @@ -139,10 +139,10 @@ ComputeSNAAtom::~ComputeSNAAtom() void ComputeSNAAtom::init() { - if (force->pair == NULL) + if (force->pair == NULL) error->all(FLERR,"Compute sna/atom requires a pair style be defined"); - if (cutmax > force->pair->cutforce) + if (cutmax > force->pair->cutforce) error->all(FLERR,"Compute sna/atom cutoff is longer than pairwise cutoff"); // need an occasional full neighbor list @@ -223,7 +223,7 @@ void ComputeSNAAtom::compute_peratom() const int jnum = numneigh[i]; // insure rij, inside, and typej are of size jnum - + snaptr[tid]->grow_rij(jnum); // rij[][3] = displacements between atom I and those neighbors @@ -234,7 +234,7 @@ void ComputeSNAAtom::compute_peratom() for (int jj = 0; jj < jnum; jj++) { int j = jlist[jj]; j &= NEIGHMASK; - + const double delx = xtmp - x[j][0]; const double dely = ytmp - x[j][1]; const double delz = ztmp - x[j][2]; @@ -265,7 +265,7 @@ void ComputeSNAAtom::compute_peratom() } /* ---------------------------------------------------------------------- - memory usage + memory usage ------------------------------------------------------------------------- */ double ComputeSNAAtom::memory_usage() diff --git a/src/SNAP/compute_sna_atom.h b/src/SNAP/compute_sna_atom.h index ff5471d03dd80d43136dd7874e76c7e068bc814a..af62d7cf3b5caf9464da0370f4029021e14eefbf 100644 --- a/src/SNAP/compute_sna_atom.h +++ b/src/SNAP/compute_sna_atom.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -21,7 +21,7 @@ ComputeStyle(sna/atom,ComputeSNAAtom) #define LMP_COMPUTE_SNA_ATOM_H #include "compute.h" - + namespace LAMMPS_NS { class ComputeSNAAtom : public Compute { diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index 5b5d4728edff5ea07b93ea2be92046a1520715c1..8767ca174574f9ae1af892938515daa69dba15d9 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -5,14 +5,14 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #include "sna.h" -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "compute_snad_atom.h" #include "atom.h" #include "update.h" @@ -69,14 +69,14 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : cutsq[i][j] = cutsq[j][i] = cut*cut; } } - + // process optional args int iarg = nargmin; while (iarg < narg) { if (strcmp(arg[iarg],"diagonal") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute snad/atom command"); diagonalstyle = atof(arg[iarg+1]); if (diagonalstyle < 0 || diagonalstyle > 3) @@ -88,7 +88,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : rmin0 = atof(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"switchflag") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute snad/atom command"); switchflag = atoi(arg[iarg+1]); iarg += 2; @@ -132,11 +132,11 @@ ComputeSNADAtom::~ComputeSNADAtom() void ComputeSNADAtom::init() { - if (force->pair == NULL) + if (force->pair == NULL) error->all(FLERR,"Compute snad/atom requires a pair style be defined"); // TODO: Not sure what to do with this error check since cutoff radius is not // a single number - //if (sqrt(cutsq) > force->pair->cutforce) + //if (sqrt(cutsq) > force->pair->cutforce) //error->all(FLERR,"Compute snad/atom cutoff is longer than pairwise cutoff"); // need an occasional full neighbor list @@ -241,12 +241,12 @@ void ComputeSNADAtom::compute_peratom() for (int jj = 0; jj < jnum; jj++) { int j = jlist[jj]; j &= NEIGHMASK; - + const double delx = x[j][0] - xtmp; const double dely = x[j][1] - ytmp; const double delz = x[j][2] - ztmp; const double rsq = delx*delx + dely*dely + delz*delz; - int jtype = type[j]; + int jtype = type[j]; if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { snaptr[tid]->rij[ninside][0] = delx; snaptr[tid]->rij[ninside][1] = dely; @@ -300,7 +300,7 @@ int ComputeSNADAtom::pack_reverse_comm(int n, int first, double *buf) m = 0; last = first + n; - for (i = first; i < last; i++) + for (i = first; i < last; i++) for (icoeff = 0; icoeff < size_peratom_cols; icoeff++) buf[m++] = snad[i][icoeff]; return comm_reverse; @@ -321,7 +321,7 @@ void ComputeSNADAtom::unpack_reverse_comm(int n, int *list, double *buf) } /* ---------------------------------------------------------------------- - memory usage + memory usage ------------------------------------------------------------------------- */ double ComputeSNADAtom::memory_usage() diff --git a/src/SNAP/compute_snad_atom.h b/src/SNAP/compute_snad_atom.h index 6dbd310e444ff1ad6e3ab3beb1dd6e2667e4b436..31f5bf252d2ee8fde1739ea3e9b3e54a29e013ee 100644 --- a/src/SNAP/compute_snad_atom.h +++ b/src/SNAP/compute_snad_atom.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -21,7 +21,7 @@ ComputeStyle(snad/atom,ComputeSNADAtom) #define LMP_COMPUTE_SNAD_ATOM_H #include "compute.h" - + namespace LAMMPS_NS { class ComputeSNADAtom : public Compute { diff --git a/src/SNAP/compute_snav_atom.cpp b/src/SNAP/compute_snav_atom.cpp index 6394321eb46f198d27ecec9afa253fc42d21436a..cbe53821b80554ba0fb791910ac41a7f979819c4 100644 --- a/src/SNAP/compute_snav_atom.cpp +++ b/src/SNAP/compute_snav_atom.cpp @@ -5,14 +5,14 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #include "sna.h" -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "compute_snav_atom.h" #include "atom.h" #include "update.h" @@ -78,19 +78,19 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"diagonal") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute snav/atom command"); diagonalstyle = atof(arg[iarg+1]); if (diagonalstyle < 0 || diagonalstyle > 3) error->all(FLERR,"Illegal compute snav/atom command"); iarg += 2; } else if (strcmp(arg[iarg],"rmin0") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute snav/atom command"); rmin0 = atof(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"switchflag") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal compute snav/atom command"); switchflag = atoi(arg[iarg+1]); iarg += 2; @@ -135,11 +135,11 @@ delete [] snaptr; void ComputeSNAVAtom::init() { - if (force->pair == NULL) + if (force->pair == NULL) error->all(FLERR,"Compute snav/atom requires a pair style be defined"); // TODO: Not sure what to do with this error check since cutoff radius is not // a single number - //if (sqrt(cutsq) > force->pair->cutforce) + //if (sqrt(cutsq) > force->pair->cutforce) // error->all(FLERR,"Compute snav/atom cutoff is longer than pairwise cutoff"); // need an occasional full neighbor list @@ -244,7 +244,7 @@ void ComputeSNAVAtom::compute_peratom() for (int jj = 0; jj < jnum; jj++) { int j = jlist[jj]; j &= NEIGHMASK; - + const double delx = x[j][0] - xtmp; const double dely = x[j][1] - ytmp; const double delz = x[j][2] - ztmp; @@ -277,7 +277,7 @@ void ComputeSNAVAtom::compute_peratom() double *snavi = snav[i]+typeoffset; double *snavj = snav[j]+typeoffset; - + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { snavi[icoeff] += snaptr[tid]->dbvec[icoeff][0]*xtmp; snavi[icoeff+ncoeff] += snaptr[tid]->dbvec[icoeff][1]*ytmp; @@ -310,7 +310,7 @@ int ComputeSNAVAtom::pack_reverse_comm(int n, int first, double *buf) m = 0; last = first + n; - for (i = first; i < last; i++) + for (i = first; i < last; i++) for (icoeff = 0; icoeff < size_peratom_cols; icoeff++) buf[m++] = snav[i][icoeff]; return comm_reverse; @@ -331,7 +331,7 @@ void ComputeSNAVAtom::unpack_reverse_comm(int n, int *list, double *buf) } /* ---------------------------------------------------------------------- - memory usage + memory usage ------------------------------------------------------------------------- */ double ComputeSNAVAtom::memory_usage() diff --git a/src/SNAP/compute_snav_atom.h b/src/SNAP/compute_snav_atom.h index 0c4d1cf7887a8d22f3a9e392127f25f2ead61ddf..0252be705966e200a9e7e71e19d020e575ebfa68 100644 --- a/src/SNAP/compute_snav_atom.h +++ b/src/SNAP/compute_snav_atom.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -21,7 +21,7 @@ ComputeStyle(snav/atom,ComputeSNAVAtom) #define LMP_COMPUTE_SNAV_ATOM_H #include "compute.h" - + namespace LAMMPS_NS { class ComputeSNAVAtom : public Compute { diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index 39962b210fe573610f3bbba5822a1677ccf463fc..d3f132bd046e88d084ea7aa33373d4c537d26765 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "pair_snap.h" #include "atom.h" #include "atom_vec.h" @@ -104,7 +104,7 @@ PairSNAP::PairSNAP(LAMMPS *lmp) : Pair(lmp) PairSNAP::~PairSNAP() { if (nelements) { - for (int i = 0; i < nelements; i++) + for (int i = 0; i < nelements; i++) delete[] elements[i]; delete[] elements; memory->destroy(radelem); @@ -121,7 +121,7 @@ PairSNAP::~PairSNAP() double timeave[5]; double timeave_mpi[5]; double timemax_mpi[5]; - + for (int i = 0; i < 5; i++) { time[i] = 0; timeave[i] = 0; @@ -135,7 +135,7 @@ PairSNAP::~PairSNAP() MPI_Reduce(timeave, timeave_mpi, 5, MPI_DOUBLE, MPI_SUM, 0, world); MPI_Reduce(time, timemax_mpi, 5, MPI_DOUBLE, MPI_MAX, 0, world); #endif - + for (int tid = 0; tid<nthreads; tid++) delete sna[tid]; delete [] sna; @@ -197,7 +197,7 @@ void PairSNAP::compute_regular(int eflag, int vflag) jnum = numneigh[i]; // insure rij, inside, wj, and rcutij are of size jnum - + snaptr->grow_rij(jnum); // rij[][3] = displacements between atom I and those neighbors @@ -216,7 +216,7 @@ void PairSNAP::compute_regular(int eflag, int vflag) rsq = delx*delx + dely*dely + delz*delz; int jtype = type[j]; int jelem = map[jtype]; - + if (rsq < cutsq[itype][jtype]&&rsq>1e-20) { snaptr->rij[ninside][0] = delx; snaptr->rij[ninside][1] = dely; @@ -229,7 +229,7 @@ void PairSNAP::compute_regular(int eflag, int vflag) } // compute Ui, Zi, and Bi for atom I - + snaptr->compute_ui(ninside); snaptr->compute_zi(); if (!gammaoneflag) { @@ -257,7 +257,7 @@ void PairSNAP::compute_regular(int eflag, int vflag) for (int k = 1; k <= ncoeff; k++) { double bgb; - if (gammaoneflag) + if (gammaoneflag) bgb = coeffi[k]; else bgb = coeffi[k]* gamma*pow(snaptr->bvec[k-1],gamma-1.0); @@ -281,7 +281,7 @@ void PairSNAP::compute_regular(int eflag, int vflag) } if (eflag) { - + // evdwl = energy of atom I, sum over coeffs_k * Bi_k evdwl = coeffi[0]; @@ -297,7 +297,7 @@ void PairSNAP::compute_regular(int eflag, int vflag) } } - + if (vflag_fdotr) virial_fdotr_compute(); } @@ -573,7 +573,7 @@ void PairSNAP::compute_optimized(int eflag, int vflag) for (k = 1; k <= ncoeff; k++) { double bgb; - if (gammaoneflag) + if (gammaoneflag) bgb = coeffi[k]; else bgb = coeffi[k]* gamma*pow(sna[tid]->bvec[k-1],gamma-1.0); @@ -1306,8 +1306,8 @@ void PairSNAP::settings(int narg, char **arg) // optimization flags set if (!use_optimized) - if (nthreads > 1 || - use_shared_arrays || + if (nthreads > 1 || + use_shared_arrays || do_load_balance || schedule_user) error->all(FLERR,"Illegal pair_style command"); @@ -1327,7 +1327,7 @@ void PairSNAP::coeff(int narg, char **arg) if (!allocated) allocate(); if (nelements) { - for (int i = 0; i < nelements; i++) + for (int i = 0; i < nelements; i++) delete[] elements[i]; delete[] elements; memory->destroy(radelem); @@ -1461,7 +1461,7 @@ void PairSNAP::init_style() double PairSNAP::init_one(int i, int j) { if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); - return (radelem[map[i]] + + return (radelem[map[i]] + radelem[map[j]])*rcutfac; } @@ -1505,7 +1505,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if ((ptr = strchr(line,'#'))) *ptr = '\0'; nwords = atom->count_words(line); } - if (nwords != 2) + if (nwords != 2) error->all(FLERR,"Incorrect format in SNAP coefficient file"); // words = ptrs to all words in line @@ -1520,20 +1520,20 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) int nelemfile = atoi(words[0]); ncoeff = atoi(words[1])-1; - // Set up element lists + // Set up element lists memory->create(radelem,nelements,"pair:radelem"); memory->create(wjelem,nelements,"pair:wjelem"); memory->create(coeffelem,nelements,ncoeff+1,"pair:coeffelem"); int *found = new int[nelements]; - for (int ielem = 0; ielem < nelements; ielem++) + for (int ielem = 0; ielem < nelements; ielem++) found[ielem] = 0; // Loop over elements in the SNAP coefficient file for (int ielemfile = 0; ielemfile < nelemfile; ielemfile++) { - + if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); if (ptr == NULL) { @@ -1542,13 +1542,13 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) } else n = strlen(line) + 1; } MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) + if (eof) error->all(FLERR,"Incorrect format in SNAP coefficient file"); MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(line,n,MPI_CHAR,0,world); nwords = atom->count_words(line); - if (nwords != 3) + if (nwords != 3) error->all(FLERR,"Incorrect format in SNAP coefficient file"); iword = 0; @@ -1569,7 +1569,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (strcmp(elemtmp,elements[ielem]) == 0) break; if (ielem == nelements) { if (comm->me == 0) - for (int icoeff = 0; icoeff <= ncoeff; icoeff++) + for (int icoeff = 0; icoeff <= ncoeff; icoeff++) ptr = fgets(line,MAXLINE,fpcoeff); continue; } @@ -1578,7 +1578,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (found[ielem]) { if (comm->me == 0) - for (int icoeff = 0; icoeff <= ncoeff; icoeff++) + for (int icoeff = 0; icoeff <= ncoeff; icoeff++) ptr = fgets(line,MAXLINE,fpcoeff); continue; } @@ -1589,13 +1589,13 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (comm->me == 0) { - if (screen) fprintf(screen,"SNAP Element = %s, Radius %g, Weight %g \n", + if (screen) fprintf(screen,"SNAP Element = %s, Radius %g, Weight %g \n", elements[ielem], radelem[ielem], wjelem[ielem]); - if (logfile) fprintf(logfile,"SNAP Element = %s, Radius %g, Weight %g \n", + if (logfile) fprintf(logfile,"SNAP Element = %s, Radius %g, Weight %g \n", elements[ielem], radelem[ielem], wjelem[ielem]); } - for (int icoeff = 0; icoeff <= ncoeff; icoeff++) { + for (int icoeff = 0; icoeff <= ncoeff; icoeff++) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); if (ptr == NULL) { @@ -1605,20 +1605,20 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) } MPI_Bcast(&eof,1,MPI_INT,0,world); - if (eof) + if (eof) error->all(FLERR,"Incorrect format in SNAP coefficient file"); MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(line,n,MPI_CHAR,0,world); nwords = atom->count_words(line); - if (nwords != 1) + if (nwords != 1) error->all(FLERR,"Incorrect format in SNAP coefficient file"); iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); coeffelem[ielem][icoeff] = atof(words[0]); - + } } @@ -1667,7 +1667,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) nwords = atom->count_words(line); if (nwords == 0) continue; - if (nwords != 2) + if (nwords != 2) error->all(FLERR,"Incorrect format in SNAP parameter file"); // words = ptrs to all words in line diff --git a/src/SNAP/sna.cpp b/src/SNAP/sna.cpp index 00e2b9df747b4f1476679dee0689e26b0c549c7e..65a23671a42a5cd8322fa2e3489322bcb4d4b64a 100644 --- a/src/SNAP/sna.cpp +++ b/src/SNAP/sna.cpp @@ -16,11 +16,11 @@ ------------------------------------------------------------------------- */ #include "sna.h" -#include "math.h" +#include <math.h> #include "math_const.h" #include "math_extra.h" -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "openmp_snap.h" #include "memory.h" @@ -51,11 +51,11 @@ using namespace MathConst; m2 = beta+b or 2*beta = 2*m2 - j2 m = gamma+c 2*gamma = 2*m - j - in this way: + in this way: - -a <= alpha <= a - -b <= beta <= b - -c <= gamma <= c + -a <= alpha <= a + -b <= beta <= b + -c <= gamma <= c becomes: @@ -65,10 +65,10 @@ using namespace MathConst; and the requirement that a+b+c be integral implies that - j1+j2+j must be even. + j1+j2+j must be even. The requirement that: - - gamma = alpha+beta + + gamma = alpha+beta becomes: @@ -88,7 +88,7 @@ using namespace MathConst; 0 <= ma, mb <= j. For the bispectrum components B(J1,J2,J) we convert to: - + j1 = 2*J1 j2 = 2*J2 j = 2*J @@ -101,8 +101,8 @@ using namespace MathConst; |j1-j2| <= j <= j1+j2, for j1+j2+j even integer - or - + or + j = |j1-j2|, |j1-j2|+2,...,j1+j2-2,j1+j2 [1] Albert Bartok-Partay, "Gaussian Approximation..." @@ -291,7 +291,7 @@ void SNA::grow_rij(int newnmax) memory->destroy(rcutij); memory->create(rij, nmax, 3, "pair:rij"); memory->create(inside, nmax, "pair:inside"); - memory->create(wj, nmax, "pair:wj"); + memory->create(wj, nmax, "pair:wj"); memory->create(rcutij, nmax, "pair:rcutij"); } } @@ -304,7 +304,7 @@ void SNA::compute_ui(int jnum) double rsq, r, x, y, z, z0, theta0; // utot(j,ma,mb) = 0 for all j,ma,ma - // utot(j,ma,ma) = 1 for all j,ma + // utot(j,ma,ma) = 1 for all j,ma // for j in neighbors of i: // compute r0 = (x,y,z,z0) // utot(j,ma,mb) += u(r0;j,ma,mb) for all j,ma,mb @@ -344,7 +344,7 @@ void SNA::compute_ui_omp(int jnum, int sub_threads) double rsq, r, x, y, z, z0, theta0; // utot(j,ma,mb) = 0 for all j,ma,ma - // utot(j,ma,ma) = 1 for all j,ma + // utot(j,ma,ma) = 1 for all j,ma // for j in neighbors of i: // compute r0 = (x,y,z,z0) // utot(j,ma,mb) += u(r0;j,ma,mb) for all j,ma,mb @@ -412,7 +412,7 @@ void SNA::compute_zi() for(int ma = 0; ma <= j; ma++) { zarray_r[j1][j2][j][ma][mb] = 0.0; zarray_i[j1][j2][j][ma][mb] = 0.0; - + for(int ma1 = MAX(0, (2 * ma - j - j2 + j1) / 2); ma1 <= MIN(j1, (2 * ma - j + j2 + j1) / 2); ma1++) { sumb1_r = 0.0; @@ -424,10 +424,10 @@ void SNA::compute_zi() mb1 <= MIN(j1, (2 * mb - j + j2 + j1) / 2); mb1++) { mb2 = (2 * mb - j - (2 * mb1 - j1) + j2) / 2; - sumb1_r += cgarray[j1][j2][j][mb1][mb2] * + sumb1_r += cgarray[j1][j2][j][mb1][mb2] * (uarraytot_r[j1][ma1][mb1] * uarraytot_r[j2][ma2][mb2] - uarraytot_i[j1][ma1][mb1] * uarraytot_i[j2][ma2][mb2]); - sumb1_i += cgarray[j1][j2][j][mb1][mb2] * + sumb1_i += cgarray[j1][j2][j][mb1][mb2] * (uarraytot_r[j1][ma1][mb1] * uarraytot_i[j2][ma2][mb2] + uarraytot_i[j1][ma1][mb1] * uarraytot_r[j2][ma2][mb2]); } // end loop over mb1 @@ -829,7 +829,7 @@ void SNA::compute_dbidrj() double sumzdu_r[3]; double** jjjzarray_r; double** jjjzarray_i; - double jjjmambzarray_r; + double jjjmambzarray_r; double jjjmambzarray_i; #ifdef TIMING_INFO @@ -1182,21 +1182,21 @@ void SNA::compute_uarray(double x, double y, double z, rootpq = rootpqarray[j - ma][j - mb]; uarray_r[j][ma][mb] += rootpq * - (a_r * uarray_r[j - 1][ma][mb] + + (a_r * uarray_r[j - 1][ma][mb] + a_i * uarray_i[j - 1][ma][mb]); uarray_i[j][ma][mb] += rootpq * - (a_r * uarray_i[j - 1][ma][mb] - + (a_r * uarray_i[j - 1][ma][mb] - a_i * uarray_r[j - 1][ma][mb]); rootpq = rootpqarray[ma + 1][j - mb]; uarray_r[j][ma + 1][mb] = -rootpq * - (b_r * uarray_r[j - 1][ma][mb] + + (b_r * uarray_r[j - 1][ma][mb] + b_i * uarray_i[j - 1][ma][mb]); uarray_i[j][ma + 1][mb] = -rootpq * - (b_r * uarray_i[j - 1][ma][mb] - + (b_r * uarray_i[j - 1][ma][mb] - b_i * uarray_r[j - 1][ma][mb]); } } @@ -1216,7 +1216,7 @@ void SNA::compute_uarray(double x, double y, double z, } else { uarray_r[j][j-ma][j-mb] = -uarray_r[j][ma][mb]; uarray_i[j][j-ma][j-mb] = uarray_i[j][ma][mb]; - } + } } } } @@ -1254,21 +1254,21 @@ void SNA::compute_uarray_omp(double x, double y, double z, rootpq = rootpqarray[j - ma][j - mb]; uarray_r[j][ma][mb] += rootpq * - (a_r * uarray_r[j - 1][ma][mb] + + (a_r * uarray_r[j - 1][ma][mb] + a_i * uarray_i[j - 1][ma][mb]); uarray_i[j][ma][mb] += rootpq * - (a_r * uarray_i[j - 1][ma][mb] - + (a_r * uarray_i[j - 1][ma][mb] - a_i * uarray_r[j - 1][ma][mb]); rootpq = rootpqarray[ma + 1][j - mb]; uarray_r[j][ma + 1][mb] = -rootpq * - (b_r * uarray_r[j - 1][ma][mb] + + (b_r * uarray_r[j - 1][ma][mb] + b_i * uarray_i[j - 1][ma][mb]); uarray_i[j][ma + 1][mb] = -rootpq * - (b_r * uarray_i[j - 1][ma][mb] - + (b_r * uarray_i[j - 1][ma][mb] - b_i * uarray_r[j - 1][ma][mb]); } } @@ -1284,21 +1284,21 @@ void SNA::compute_uarray_omp(double x, double y, double z, rootpq = rootpqarray[j - ma][mb]; uarray_r[j][ma][mb] += rootpq * - (b_r * uarray_r[j - 1][ma][mb - 1] - + (b_r * uarray_r[j - 1][ma][mb - 1] - b_i * uarray_i[j - 1][ma][mb - 1]); uarray_i[j][ma][mb] += rootpq * - (b_r * uarray_i[j - 1][ma][mb - 1] + + (b_r * uarray_i[j - 1][ma][mb - 1] + b_i * uarray_r[j - 1][ma][mb - 1]); rootpq = rootpqarray[ma + 1][mb]; uarray_r[j][ma + 1][mb] = rootpq * - (a_r * uarray_r[j - 1][ma][mb - 1] - + (a_r * uarray_r[j - 1][ma][mb - 1] - a_i * uarray_i[j - 1][ma][mb - 1]); uarray_i[j][ma + 1][mb] = rootpq * - (a_r * uarray_i[j - 1][ma][mb - 1] + + (a_r * uarray_i[j - 1][ma][mb - 1] + a_i * uarray_r[j - 1][ma][mb - 1]); } } @@ -1776,7 +1776,7 @@ void SNA::init_clebsch_gordan() sum = 0.0; - for (int z = MAX(0, MAX(-(j - j2 + aa2) + for (int z = MAX(0, MAX(-(j - j2 + aa2) / 2, -(j - j1 - bb2) / 2)); z <= MIN((j1 + j2 - j) / 2, MIN((j1 - aa2) / 2, (j2 + bb2) / 2)); @@ -1807,7 +1807,7 @@ void SNA::init_clebsch_gordan() } /* ---------------------------------------------------------------------- - pre-compute table of sqrt[p/m2], p, q = 1,twojmax + pre-compute table of sqrt[p/m2], p, q = 1,twojmax the p = 0, q = 0 entries are allocated and skipped for convenience. ------------------------------------------------------------------------- */ diff --git a/src/SNAP/sna.h b/src/SNAP/sna.h index 260d4bfe353212f620125e34459167532b30b399..ccc37866d5231ecc5b6ecbc6d0551727cf5fc22d 100644 --- a/src/SNAP/sna.h +++ b/src/SNAP/sna.h @@ -122,9 +122,9 @@ private: void compute_duarray(double, double, double, double, double, double, double, double); - // if number of atoms are small use per atom arrays + // if number of atoms are small use per atom arrays // for twojmax arrays, rij, inside, bvec - // this will increase the memory footprint considerably, + // this will increase the memory footprint considerably, // but allows parallel filling and reuse of these arrays int use_shared_arrays; diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 52c0abd560a24b02a98592a5374389051a352a22..35eb21254c7787375e39528364a678e1216ed42d 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -15,9 +15,9 @@ Contributing authors: Jeremy Lechman (SNL), Pieter in 't Veld (BASF) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_srd.h" #include "math_extra.h" #include "atom.h" @@ -185,9 +185,9 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 2; } else if (strcmp(arg[iarg],"rescale") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - if (strcmp(arg[iarg+1],"no") == 0) + if (strcmp(arg[iarg+1],"no") == 0) rescale_rotate = rescale_collide = 0; - else if (strcmp(arg[iarg+1],"yes") == 0) + else if (strcmp(arg[iarg+1],"yes") == 0) rescale_rotate = rescale_collide = 1; else if (strcmp(arg[iarg+1],"rotate") == 0) { rescale_rotate = 1; @@ -337,7 +337,7 @@ void FixSRD::init() error->all(FLERR,"Fix srd no-slip requires atom attribute torque"); if (initflag && update->dt != dt_big) error->all(FLERR,"Cannot change timestep once fix srd is setup"); - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"Fix srd can only currently be used with " "comm_style brick"); @@ -745,7 +745,7 @@ void FixSRD::post_force(int vflag) if (ix < 0 || ix >= nbin2x || iy < 0 || iy >= nbin2y || iz < 0 || iz >= nbin2z) { if (screen) { - fprintf(screen,"SRD particle " TAGINT_FORMAT + fprintf(screen,"SRD particle " TAGINT_FORMAT " on step " BIGINT_FORMAT "\n", atom->tag[i],update->ntimestep); fprintf(screen,"v = %g %g %g\n",v[i][0],v[i][1],v[i][2]); @@ -961,7 +961,7 @@ void FixSRD::reset_velocities() if (dimension == 3) axis = irandom / 2; vsq = 0.0; - for (j = binhead[i]; j >= 0; j = binnext[j]) { + for (j = binhead[i]; j >= 0; j = binnext[j]) { if (axis == 0) { u[0] = v[j][0]-vave[0]; u[1] = sign ? v[j][2]-vave[2] : vave[2]-v[j][2]; @@ -983,7 +983,7 @@ void FixSRD::reset_velocities() if (n > 1) vbin[i].value[0] = vsq; } - + if (shifts[shiftflag].commflag) xbin_comm(shiftflag,1); if (tstat) { @@ -1009,11 +1009,11 @@ void FixSRD::reset_velocities() // tbin = thermal temperature of particles in bin // scale = scale factor for thermal velocity - + tbin = vbin[i].value[0]/(n-dof_tstat) * tfactor; scale = sqrt(temperature_srd/tbin); vsq = 0.0; - for (j = binhead[i]; j >= 0; j = binnext[j]) { + for (j = binhead[i]; j >= 0; j = binnext[j]) { u[0] = (v[j][0] - vave[0]) * scale; u[1] = (v[j][1] - vave[1]) * scale; u[2] = (v[j][2] - vave[2]) * scale; @@ -1246,7 +1246,7 @@ void FixSRD::xbin_unpack(double *buf, BinAve *vbin, int n, int *list, int nval) int m = 0; for (int i = 0; i < n; i++) { j = list[i]; - for (k = 0; k < nval; k++) + for (k = 0; k < nval; k++) vbin[j].value[k] += buf[m++]; } } @@ -1339,7 +1339,7 @@ void FixSRD::collisions_single() if (type != WALL) { sprintf(str, "SRD particle " TAGINT_FORMAT " started " - "inside big particle " TAGINT_FORMAT + "inside big particle " TAGINT_FORMAT " on step " BIGINT_FORMAT " bounce %d", atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); if (insideflag == INSIDE_ERROR) error->one(FLERR,str); @@ -1498,7 +1498,7 @@ void FixSRD::collisions_multi() if (type != WALL) { sprintf(str, "SRD particle " TAGINT_FORMAT " started " - "inside big particle " TAGINT_FORMAT + "inside big particle " TAGINT_FORMAT " on step " BIGINT_FORMAT " bounce %d", atom->tag[i],atom->tag[j],update->ntimestep,ibounce+1); if (insideflag == INSIDE_ERROR) error->one(FLERR,str); @@ -2505,7 +2505,7 @@ int FixSRD::update_srd(int i, double dt, double *xscoll, double *vsnew, xs[2] < srdlo[2] || xs[2] > srdhi[2]) { if (screen) { error->warning(FLERR,"Fix srd particle moved outside valid domain"); - fprintf(screen," particle " TAGINT_FORMAT + fprintf(screen," particle " TAGINT_FORMAT " on proc %d at timestep " BIGINT_FORMAT, atom->tag[i],me,update->ntimestep); fprintf(screen," xnew %g %g %g\n",xs[0],xs[1],xs[2]); @@ -4007,7 +4007,7 @@ void FixSRD::print_collision(int i, int j, int ibounce, double **v = atom->v; if (type != WALL) { - printf("COLLISION between SRD " TAGINT_FORMAT + printf("COLLISION between SRD " TAGINT_FORMAT " and BIG " TAGINT_FORMAT "\n",atom->tag[i],atom->tag[j]); printf(" bounce # = %d\n",ibounce+1); printf(" local indices: %d %d\n",i,j); diff --git a/src/SRD/fix_wall_srd.cpp b/src/SRD/fix_wall_srd.cpp index d192b55c4abaeae173430d440e3ac98d402462b0..95ec8e796ab56c09d4f4b2f7c6daffdb5eaab2ee 100644 --- a/src/SRD/fix_wall_srd.cpp +++ b/src/SRD/fix_wall_srd.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_wall_srd.h" #include "atom.h" #include "modify.h" diff --git a/src/STUBS/mpi.c b/src/STUBS/mpi.c index 38174bb1de2f2de77f82bc1a0d12d7dffd69ebcf..202e19bcfd2333ad2321a0b14078060a40133c37 100644 --- a/src/STUBS/mpi.c +++ b/src/STUBS/mpi.c @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -13,12 +13,12 @@ /* Single-processor "stub" versions of MPI routines */ -#include "stdlib.h" -#include "string.h" -#include "stdio.h" -#include "stdint.h" +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdint.h> #include <sys/time.h> -#include "mpi.h" +#include <mpi.h> /* data structure for double/int */ @@ -250,7 +250,7 @@ int MPI_Waitall(int n, MPI_Request *request, MPI_Status *status) /* ---------------------------------------------------------------------- */ -int MPI_Waitany(int count, MPI_Request *request, int *index, +int MPI_Waitany(int count, MPI_Request *request, int *index, MPI_Status *status) { printf("MPI Stub WARNING: Should not wait on message from self\n"); @@ -306,7 +306,7 @@ MPI_Comm MPI_Comm_f2c(MPI_Fint comm) { return comm; }; //* ---------------------------------------------------------------------- */ -int MPI_Comm_group(MPI_Comm comm, MPI_Group *group) +int MPI_Comm_group(MPI_Comm comm, MPI_Group *group) { *group = comm; return 0; @@ -314,7 +314,7 @@ int MPI_Comm_group(MPI_Comm comm, MPI_Group *group) /* ---------------------------------------------------------------------- */ -int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm) +int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm) { *newcomm = group; return 0; @@ -371,7 +371,7 @@ int MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank) /* store size of user datatype in extra lists */ -int MPI_Type_contiguous(int count, MPI_Datatype oldtype, +int MPI_Type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype *newtype) { if (nextra_datatype == MAXEXTRA_DATATYPE) return -1; @@ -384,7 +384,7 @@ int MPI_Type_contiguous(int count, MPI_Datatype oldtype, /* ---------------------------------------------------------------------- */ -/* set value of user datatype to internal negative index, +/* set value of user datatype to internal negative index, based on match of ptr */ int MPI_Type_commit(MPI_Datatype *datatype) @@ -556,7 +556,7 @@ int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, /* copy values from data1 to data2 */ -int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, +int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) { diff --git a/src/STUBS/mpi.h b/src/STUBS/mpi.h index 1344de76df40a70ac96e6dc360f6d35c8d429877..01a4b85173d0f6be01f7cd0dae87e50d7b172374 100644 --- a/src/STUBS/mpi.h +++ b/src/STUBS/mpi.h @@ -14,7 +14,7 @@ #ifndef MPI_STUBS #define MPI_STUBS -#include "stdlib.h" +#include <stdlib.h> /* use C bindings for MPI interface */ @@ -64,7 +64,7 @@ extern "C" { #define MPI_MAX_PROCESSOR_NAME 128 -typedef void MPI_User_function(void *invec, void *inoutvec, +typedef void MPI_User_function(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype); /* MPI data structs */ @@ -127,7 +127,7 @@ int MPI_Cart_shift(MPI_Comm comm, int direction, int displ, int *source, int *dest); int MPI_Cart_rank(MPI_Comm comm, int *coords, int *rank); -int MPI_Type_contiguous(int count, MPI_Datatype oldtype, +int MPI_Type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype *newtype); int MPI_Type_commit(MPI_Datatype *datatype); int MPI_Type_free(MPI_Datatype *datatype); @@ -158,8 +158,8 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm); -int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, - void *recvbuf, int recvcount, MPI_Datatype recvtype, +int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm); int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount, diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index b13719add378d2032edf9e07e62a0767ffd48004..0dc10e1773224e22b37b2578ec8f5e49cf1c2fa9 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -35,11 +35,11 @@ #include "ATC_CouplingMomentumEnergy.h" #include "LammpsInterface.h" // other -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include <sstream> -using namespace LAMMPS_NS; +using namespace LAMMPS_NS; using namespace FixConst; using std::string; @@ -64,7 +64,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), // Set LAMMPS pointer on LammpsInterface ATC::LammpsInterface::instance()->set_lammps(lmp); - /*! \page man_fix_atc fix atc command + /*! \page man_fix_atc fix atc command \section syntax fix <fixID> <group> atc <type> <parameter_file> - fixID = name of fix @@ -87,10 +87,10 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), fix do Verlet integration and the /post-processing does not. After instantiating this fix, several other fix_modify commands will be needed to set up the problem, e.g. define the finite element mesh and - prescribe initial and boundary conditions. + prescribe initial and boundary conditions. The following coupling example is typical, but non-exhaustive:\n - + <TT> # ... commands to create and initialize the MD system \n @@ -121,7 +121,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), # initial fix to designate post-processing and the group to apply it to \n # no material file is allowed nor required \n fix AtC internal atc hardy \n \n - # for hardy fix, specific kernel function (function type and range) to + # for hardy fix, specific kernel function (function type and range) to # be used as a localization function \n fix AtC kernel quartic_sphere 10.0 \n \n # create a uniform 1 x 1 x 1 mesh that covers region contain the group \n @@ -149,7 +149,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), ... \n\n </TT> - Note coupling and post-processing can be combined in the same simulations + Note coupling and post-processing can be combined in the same simulations using separate fixes. \n For detailed exposition of the theory and algorithms please see:\n @@ -158,7 +158,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), Special Issue of Computer Methods and Applied Mechanics (2008) 197:3351. \n - Zimmerman, JA; Webb, EB; Hoyt, JJ;. Jones, RE; Klein, PA; Bammann, DJ, <VAR> Calculation of stress in atomistic simulation. </VAR> - Special Issue of Modelling and Simulation in Materials Science and + Special Issue of Modelling and Simulation in Materials Science and Engineering (2004), 12:S319. \n - Zimmerman, JA; Jones, RE; Templeton, JA, <VAR> A material frame approach for evaluating continuum variables in @@ -179,17 +179,17 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), Journal of Chemical Physics (2013), 139:054115. \n Please refer to the standard - finite element (FE) texts, e.g. T.J.R Hughes <VAR> The finite element + finite element (FE) texts, e.g. T.J.R Hughes <VAR> The finite element method </VAR>, Dover 2003, for the basics of FE simulation. \section restrictions - Thermal and two_temperature (coupling) types use a Verlet time-integration + Thermal and two_temperature (coupling) types use a Verlet time-integration algorithm. - The hardy type does not contain its own time-integrator and must be used + The hardy type does not contain its own time-integrator and must be used with a separate fix that does contain one, e.g. nve, nvt, etc. - Currently, - - the coupling is restricted to thermal physics + Currently, + - the coupling is restricted to thermal physics - the FE computations are done in serial on each processor. \section related @@ -279,7 +279,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - \ref man_remove_species - \ref man_remove_molecule - Note: a set of example input files with the attendant material files are + Note: a set of example input files with the attendant material files are included with this package \section default none @@ -297,7 +297,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), try { // Postprocessing - if (strcmp(arg[3],"field")==0) + if (strcmp(arg[3],"field")==0) { if (atomCount == 0) { if (me==0) printf("ATC: can't construct transfer, no atoms in group \n"); @@ -308,8 +308,8 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), atc_ = new ATC::ATC_TransferPartitionOfUnity(groupName, array_atom, this); - } - else { + } + else { if (me==0) printf("ATC: constructing shape function field estimate with parameter file %s\n",arg[4]); string matParamFile = arg[4]; atc_ = new ATC::ATC_TransferPartitionOfUnity(groupName, @@ -317,7 +317,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), matParamFile); } } - else if (strcmp(arg[3],"hardy")==0) + else if (strcmp(arg[3],"hardy")==0) { if (atomCount == 0) { if (me==0) printf("ATC: Can't construct transfer, no atoms in group \n"); @@ -328,8 +328,8 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), atc_ = new ATC::ATC_TransferKernel(groupName, array_atom, this); - } - else { + } + else { if (me==0) printf("ATC: constructing kernel field estimate with parameter file %s\n",arg[4]); string matParamFile = arg[4]; atc_ = new ATC::ATC_TransferKernel(groupName, @@ -338,7 +338,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), } } // PhysicsTypes - else if (strcmp(arg[3],"thermal")==0) + else if (strcmp(arg[3],"thermal")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing thermal coupling with parameter file %s\n",arg[4]); @@ -346,7 +346,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile); } - else if (strcmp(arg[3],"two_temperature")==0) + else if (strcmp(arg[3],"two_temperature")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing two_temperature coupling with parameter file %s\n",arg[4]); @@ -354,7 +354,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::TWO_TEMPERATURE); } - else if (strcmp(arg[3],"drift_diffusion")==0) + else if (strcmp(arg[3],"drift_diffusion")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing drift_diffusion coupling with parameter file %s\n",arg[4]); @@ -362,7 +362,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::DRIFT_DIFFUSION); } - else if (strcmp(arg[3],"drift_diffusion-equilibrium")==0) + else if (strcmp(arg[3],"drift_diffusion-equilibrium")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing drift_diffusion-equilibrium coupling with parameter file %s\n",arg[4]); @@ -370,7 +370,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::DRIFT_DIFFUSION_EQUILIBRIUM); } - else if (strcmp(arg[3],"drift_diffusion-schrodinger")==0) + else if (strcmp(arg[3],"drift_diffusion-schrodinger")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing drift_diffusion-schrodinger coupling with parameter file %s\n",arg[4]); @@ -378,7 +378,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::DRIFT_DIFFUSION_SCHRODINGER); } - else if (strcmp(arg[3],"drift_diffusion-schrodinger-slice")==0) + else if (strcmp(arg[3],"drift_diffusion-schrodinger-slice")==0) { string matParamFile = arg[4]; if (me==0) printf("Constructing ATC transfer (drift_diffusion-schrodinger-slice) with parameter file %s\n",arg[4]); @@ -386,7 +386,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::DRIFT_DIFFUSION_SCHRODINGER_SLICE); } - else if (strcmp(arg[3],"convective_drift_diffusion")==0) + else if (strcmp(arg[3],"convective_drift_diffusion")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing convective_drift_diffusion coupling with parameter file %s\n",arg[4]); @@ -394,7 +394,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::CONVECTIVE_DRIFT_DIFFUSION); } - else if (strcmp(arg[3],"convective_drift_diffusion-equilibrium")==0) + else if (strcmp(arg[3],"convective_drift_diffusion-equilibrium")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing convective_drift_diffusion-equilibrium coupling with parameter file %s\n",arg[4]); @@ -402,7 +402,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::CONVECTIVE_DRIFT_DIFFUSION_EQUILIBRIUM); } - else if (strcmp(arg[3],"convective_drift_diffusion-schrodinger")==0) + else if (strcmp(arg[3],"convective_drift_diffusion-schrodinger")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing convective_drift_diffusion-schrodinger coupling with parameter file %s\n",arg[4]); @@ -410,7 +410,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::CONVECTIVE_DRIFT_DIFFUSION_SCHRODINGER); } - else if (strcmp(arg[3],"elastic")==0) + else if (strcmp(arg[3],"elastic")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing elastic coupling with parameter file %s\n",arg[4]); @@ -419,7 +419,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), matParamFile, ATC::ELASTIC); } - else if (strcmp(arg[3],"electrostatic")==0) + else if (strcmp(arg[3],"electrostatic")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing electrostatic mechanical coupling with parameter file %s\n",arg[4]); @@ -429,7 +429,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), ATC::ELASTIC, ATC::ELECTROSTATIC); } - else if (strcmp(arg[3],"electrostatic-equilibrium")==0) + else if (strcmp(arg[3],"electrostatic-equilibrium")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing equilibrium electrostatic coupling with parameter file %s\n",arg[4]); @@ -439,7 +439,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), ATC::ELASTIC, ATC::ELECTROSTATIC_EQUILIBRIUM); } - else if (strcmp(arg[3],"shear")==0) + else if (strcmp(arg[3],"shear")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing viscous/shear coupling with parameter file %s\n",arg[4]); @@ -464,7 +464,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile, ATC::FEM_EFIELD); } - else if (strcmp(arg[3],"thermo_elastic")==0) + else if (strcmp(arg[3],"thermo_elastic")==0) { string matParamFile = arg[4]; if (me==0) printf("ATC: constructing thermo-mechanical coupling with parameter file %s\n",arg[4]); @@ -472,7 +472,7 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), array_atom, this, matParamFile); } - else + else { lmp->error->all(FLERR,"Unknown physics type in ATC"); } @@ -485,9 +485,9 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), lmp->atom->add_callback(0); // we write our own restart file - restart_global = 0; - - + restart_global = 0; + + // Set output computation data based on transfer info scalar_flag = atc_->scalar_flag(); @@ -503,13 +503,13 @@ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), peratom_flag = atc_->peratom_flag(); size_peratom_cols = atc_->size_peratom_cols(); peratom_freq = atc_->peratom_freq(); - + // set comm size needed by this fix - comm_forward = atc_->comm_forward(); + comm_forward = atc_->comm_forward(); // call this fix every step - nevery = 1; + nevery = 1; } /*----------------------------------------------------------------------- */ @@ -545,7 +545,7 @@ int FixATC::setmask() int FixATC::modify_param(int narg, char** arg) { - bool match; + bool match; // pass on to transfer layer try { @@ -701,15 +701,15 @@ void FixATC::unpack_restart(int nlocal, int nth){ /* ---------------------------------------------------------------------- maxsize of any atom's restart data ------------------------------------------------------------------------- */ - + int FixATC::maxsize_restart(){ return 0; } - + /* ---------------------------------------------------------------------- size of atom nlocal's restart data ------------------------------------------------------------------------- */ - + int FixATC::size_restart(int nlocal){ return 0; } @@ -719,7 +719,7 @@ int FixATC::size_restart(int nlocal){ ------------------------------------------------------------------------- */ void FixATC::write_restart(FILE *fp){ - + char ** args = new char*[2]; args[0] = new char[50]; args[1] = new char[50]; @@ -741,7 +741,7 @@ void FixATC::write_restart(FILE *fp){ ------------------------------------------------------------------------- */ void FixATC::restart(char *buf){ - + char ** args = new char*[2]; args[0] = new char[50]; args[1] = new char[50]; @@ -840,7 +840,7 @@ void FixATC::pre_neighbor() { try { atc_->pre_neighbor(); - comm->forward_comm_fix(this); + comm->forward_comm_fix(this); } catch (ATC::ATC_Error& atcError) { ATC::LammpsInterface::instance()->print_msg(atcError.error_description()); @@ -850,9 +850,9 @@ void FixATC::pre_neighbor() /* ---------------------------------------------------------------------- */ void FixATC::pre_force(int vflag) { - + try { - atc_->pre_force(); + atc_->pre_force(); } catch (ATC::ATC_Error& atcError) { ATC::LammpsInterface::instance()->print_msg(atcError.error_description()); @@ -862,9 +862,9 @@ void FixATC::pre_force(int vflag) /* ---------------------------------------------------------------------- */ void FixATC::post_force(int vflag) { - + try { - atc_->post_force(); + atc_->post_force(); } catch (ATC::ATC_Error& atcError) { ATC::LammpsInterface::instance()->print_msg(atcError.error_description()); @@ -912,7 +912,7 @@ void FixATC::min_setup_pre_neighbor() void FixATC::min_pre_force(int vflag) { try { - atc_->min_pre_force(); + atc_->min_pre_force(); } catch (ATC::ATC_Error& atcError) { ATC::LammpsInterface::instance()->print_msg(atcError.error_description()); @@ -924,7 +924,7 @@ void FixATC::min_pre_force(int vflag) void FixATC::min_post_force(int vflag) { try { - atc_->min_post_force(); + atc_->min_post_force(); } catch (ATC::ATC_Error& atcError) { ATC::LammpsInterface::instance()->print_msg(atcError.error_description()); @@ -933,17 +933,17 @@ void FixATC::min_post_force(int vflag) } /* ---------------------------------------------------------------------- */ -double FixATC::compute_scalar() +double FixATC::compute_scalar() { return atc_->compute_scalar(); } /* ---------------------------------------------------------------------- */ -double FixATC::compute_vector(int n) +double FixATC::compute_vector(int n) { return atc_->compute_vector(n); } /* ---------------------------------------------------------------------- */ -double FixATC::compute_array(int irow, int icol) +double FixATC::compute_array(int irow, int icol) { return atc_->compute_array(irow,icol); } diff --git a/src/USER-ATC/fix_atc.h b/src/USER-ATC/fix_atc.h index dd58becfa22f62c433a7840989e650906b77e879..b87c585e73a0b137217889adae22482c58ecfa40 100644 --- a/src/USER-ATC/fix_atc.h +++ b/src/USER-ATC/fix_atc.h @@ -17,19 +17,19 @@ namespace LAMMPS_NS { class NeighList; /** - * @class FixATC - * @brief Class for an atom-to-continuum (ATC) Lammps fix. + * @class FixATC + * @brief Class for an atom-to-continuum (ATC) Lammps fix. */ class FixATC : public Fix { - public: + public: /** constructor & destructor */ FixATC(class LAMMPS *, int, char **); ~FixATC(); /** initialization functions */ void init(); - void init_list(int id, NeighList *ptr) ; + void init_list(int id, NeighList *ptr) ; void setup(int vflag); void min_setup(int vflag); @@ -55,32 +55,32 @@ namespace LAMMPS_NS { void min_setup_pre_exchange(); void min_pre_exchange(); - double memory_usage(); + double memory_usage(); void grow_arrays(int); void copy_arrays(int, int, int); /** pack_exchange called from atom_vec->pack_exchange() - and packs fix-specific data for a given real (local) + and packs fix-specific data for a given real (local) atom being sent to another processor. */ int pack_exchange(int, double *); /** unpack_exchange called from atom_vec->unpack_exchange() - and unpacks fix-specific data for a given real (local) + and unpacks fix-specific data for a given real (local) atom received from another processor. */ int unpack_exchange(int, double *); /** pack_comm called from comm->forward_comm_fix and packs fix-specific data for a given ghost atom from exchange with another proc */ - int pack_forward_comm(int , int *, double *, int, int *); - + int pack_forward_comm(int , int *, double *, int, int *); + /** unpack_comm called from comm->forward_comm_fix and unpacks fix-specific data for a given ghost atom from exchange with another proc */ void unpack_forward_comm(int, int, double *); /** pre_neighbor is used to modify fix-specific data - and is called before neighbor list is built in + and is called before neighbor list is built in neighbor->build(). */ void pre_neighbor(); void setup_pre_neighbor(); diff --git a/src/USER-AWPMD/atom_vec_wavepacket.cpp b/src/USER-AWPMD/atom_vec_wavepacket.cpp index 525262af0cb4d754d16698fd5fb655f2b86da930..33048efba6d8c24f112dc36bc288179679165ff3 100644 --- a/src/USER-AWPMD/atom_vec_wavepacket.cpp +++ b/src/USER-AWPMD/atom_vec_wavepacket.cpp @@ -15,9 +15,9 @@ Contributing author: Ilya Valuev (JIHT, Moscow, Russia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom_vec_wavepacket.h" #include "atom.h" #include "comm.h" @@ -908,7 +908,7 @@ void AtomVecWavepacket::create_atom(int itype, double *coord) AWPMD: 0-tag 1-type 2-q 3-spin 4-eradius 5-etag 6-cs_re 7-cs_im ------------------------------------------------------------------------- */ -void AtomVecWavepacket::data_atom(double *coord, imageint imagetmp, +void AtomVecWavepacket::data_atom(double *coord, imageint imagetmp, char **values) { int nlocal = atom->nlocal; @@ -1039,7 +1039,7 @@ int AtomVecWavepacket::pack_data_hybrid(int i, double *buf) void AtomVecWavepacket::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %d %-1.16e %d %-1.16e %d %-1.16e %-1.16e %-1.16e " "%-1.16e %-1.16e %d %d %d\n", (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, @@ -1128,7 +1128,7 @@ int AtomVecWavepacket::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecWavepacket::pack_property_atom(int index, double *buf, +void AtomVecWavepacket::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; diff --git a/src/USER-AWPMD/fix_nve_awpmd.cpp b/src/USER-AWPMD/fix_nve_awpmd.cpp index c4a3820e6b0721f95a08b9ccf5be77d1e76bb924..3ad425030d3d2ebfc81531f73e63e43b92dc68f6 100644 --- a/src/USER-AWPMD/fix_nve_awpmd.cpp +++ b/src/USER-AWPMD/fix_nve_awpmd.cpp @@ -15,16 +15,16 @@ Contributing author: Ilya Valuev (JIHT, Moscow, Russia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_nve_awpmd.h" #include "atom.h" #include "force.h" #include "update.h" #include "respa.h" #include "error.h" -#include "math.h" +#include <math.h> #include "TCP/wpmd_split.h" diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index e9ca0352f235ed8fe85cf7bb2f5d6d22753b9e4f..29feb37ca15eeea7f20701cad24a45fa21642aa2 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -15,10 +15,10 @@ Contributing author: Ilya Valuev (JIHT, Moscow, Russia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_awpmd_cut.h" #include "atom.h" #include "update.h" diff --git a/src/USER-CG-CMM/angle_sdk.cpp b/src/USER-CG-CMM/angle_sdk.cpp index 87fd7f5439727c91e18a1d3e54e978367fea9d3c..31136e5cd93e9392b8bf59fbd93790be5232779f 100644 --- a/src/USER-CG-CMM/angle_sdk.cpp +++ b/src/USER-CG-CMM/angle_sdk.cpp @@ -17,8 +17,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_sdk.h" #include "atom.h" #include "neighbor.h" diff --git a/src/USER-CG-CMM/angle_sdk.h b/src/USER-CG-CMM/angle_sdk.h index f4885d5e0df248c16a8eeb2b2fbb726637b6ec13..fbd54611874417c01bfc28f015dcb60877223108 100644 --- a/src/USER-CG-CMM/angle_sdk.h +++ b/src/USER-CG-CMM/angle_sdk.h @@ -21,7 +21,7 @@ AngleStyle(cg/cmm,AngleSDK) #ifndef LMP_ANGLE_SDK_H #define LMP_ANGLE_SDK_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/USER-CG-CMM/lj_sdk_common.h b/src/USER-CG-CMM/lj_sdk_common.h index ddf14eb01f083498ce7056abb19a239cf13958d0..f8f7a66ce9bd9570af5528b29aab1d4e627dbfef 100644 --- a/src/USER-CG-CMM/lj_sdk_common.h +++ b/src/USER-CG-CMM/lj_sdk_common.h @@ -19,7 +19,7 @@ #ifndef LMP_LJ_SDK_COMMON_H #define LMP_LJ_SDK_COMMON_H -#include "string.h" +#include <string.h> namespace LAMMPS_NS { namespace LJSDKParms { diff --git a/src/USER-CG-CMM/pair_lj_sdk.cpp b/src/USER-CG-CMM/pair_lj_sdk.cpp index ef53e5db16fce2fdfffaa93c4db6ad56a7f3cd93..1ab93447f4bd6d17f8b56d157d4e3c555df83262 100644 --- a/src/USER-CG-CMM/pair_lj_sdk.cpp +++ b/src/USER-CG-CMM/pair_lj_sdk.cpp @@ -16,10 +16,10 @@ This style is a simplified re-implementation of the CG/CMM pair style ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_sdk.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp b/src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp index 591a81fe53c545fc1bd005ea23c307b507d43b73..1549acfc283ae4a5004a5d506417cb791b90273b 100644 --- a/src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp +++ b/src/USER-CG-CMM/pair_lj_sdk_coul_long.cpp @@ -16,10 +16,10 @@ This style is a simplified re-implementation of the CG/CMM pair style ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_sdk_coul_long.h" #include "atom.h" #include "comm.h" @@ -190,7 +190,7 @@ void PairLJSDKCoulLong::eval() fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; table = ftable[itable] + fraction*dftable[itable]; forcecoul = qtmp*q[j] * table; - if (EFLAG) ecoul = qtmp*q[j] * + if (EFLAG) ecoul = qtmp*q[j] * (etable[itable] + fraction*detable[itable]); if (factor_coul < 1.0) { table = ctable[itable] + fraction*dctable[itable]; @@ -319,7 +319,7 @@ void PairLJSDKCoulLong::settings(int narg, char **arg) void PairLJSDKCoulLong::coeff(int narg, char **arg) { - if (narg < 5 || narg > 6) + if (narg < 5 || narg > 6) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -394,16 +394,16 @@ double PairLJSDKCoulLong::init_one(int i, int j) double cut = MAX(cut_lj[i][j],cut_coul); cut_ljsq[i][j] = cut_lj[i][j] * cut_lj[i][j]; - lj1[i][j] = lj_prefact[ljt] * lj_pow1[ljt] * epsilon[i][j] * + lj1[i][j] = lj_prefact[ljt] * lj_pow1[ljt] * epsilon[i][j] * pow(sigma[i][j],lj_pow1[ljt]); - lj2[i][j] = lj_prefact[ljt] * lj_pow2[ljt] * epsilon[i][j] * + lj2[i][j] = lj_prefact[ljt] * lj_pow2[ljt] * epsilon[i][j] * pow(sigma[i][j],lj_pow2[ljt]); lj3[i][j] = lj_prefact[ljt] * epsilon[i][j] * pow(sigma[i][j],lj_pow1[ljt]); lj4[i][j] = lj_prefact[ljt] * epsilon[i][j] * pow(sigma[i][j],lj_pow2[ljt]); if (offset_flag) { double ratio = sigma[i][j] / cut_lj[i][j]; - offset[i][j] = lj_prefact[ljt] * epsilon[i][j] * + offset[i][j] = lj_prefact[ljt] * epsilon[i][j] * (pow(ratio,lj_pow1[ljt]) - pow(ratio,lj_pow2[ljt])); } else offset[i][j] = 0.0; diff --git a/src/USER-CG-CMM/pair_lj_sdk_coul_msm.cpp b/src/USER-CG-CMM/pair_lj_sdk_coul_msm.cpp index 726f089877bf84f76aa5d1c0a6da9ac7f2c463ea..ddca927a681bf94752825621698f0949bbd8112a 100644 --- a/src/USER-CG-CMM/pair_lj_sdk_coul_msm.cpp +++ b/src/USER-CG-CMM/pair_lj_sdk_coul_msm.cpp @@ -16,10 +16,10 @@ This style is a simplified re-implementation of the CG/CMM pair style ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_sdk_coul_msm.h" #include "atom.h" #include "comm.h" @@ -158,7 +158,7 @@ void PairLJSDKCoulMSM::eval_msm() fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; table = ftable[itable] + fraction*dftable[itable]; forcecoul = qtmp*q[j] * table; - if (EFLAG) ecoul = qtmp*q[j] * + if (EFLAG) ecoul = qtmp*q[j] * (etable[itable] + fraction*detable[itable]); if (factor_coul < 1.0) { table = ctable[itable] + fraction*dctable[itable]; diff --git a/src/USER-CG-CMM/pair_lj_sdk_coul_msm.h b/src/USER-CG-CMM/pair_lj_sdk_coul_msm.h index d9d086f9ab1bf7c62ab2b35a7ecff1034769b786..be56c0cec347b59b01ffd0143a29c366192ed49a 100644 --- a/src/USER-CG-CMM/pair_lj_sdk_coul_msm.h +++ b/src/USER-CG-CMM/pair_lj_sdk_coul_msm.h @@ -36,7 +36,7 @@ class PairLJSDKCoulMSM : public PairLJSDKCoulLong { virtual void compute(int, int); virtual double single(int, int, int, int, double, double, double, double &); virtual void *extract(const char *, int &); - + private: template <int EVFLAG, int EFLAG, int NEWTON_PAIR> void eval_msm(); diff --git a/src/USER-COLVARS/colvarproxy_lammps.cpp b/src/USER-COLVARS/colvarproxy_lammps.cpp index 579b24f790b9566218cb058faae454cdefeb53c0..d48e5479087a1c38f790a20b1c2665ae17938225 100644 --- a/src/USER-COLVARS/colvarproxy_lammps.cpp +++ b/src/USER-COLVARS/colvarproxy_lammps.cpp @@ -1,5 +1,5 @@ -#include "mpi.h" +#include <mpi.h> #include "lammps.h" #include "atom.h" #include "error.h" diff --git a/src/USER-CUDA/comm_cuda.cpp b/src/USER-CUDA/comm_cuda.cpp index bf813c4f8bf306965d5bd98eaef08256dd56052c..a03f873ce2091a15da7955639971b1e852365090 100644 --- a/src/USER-CUDA/comm_cuda.cpp +++ b/src/USER-CUDA/comm_cuda.cpp @@ -19,7 +19,7 @@ #error LAMMPS_BIGBIG not supported by this file #endif -#include "mpi.h" +#include <mpi.h> #include <cmath> #include <cstring> #include <cstdio> diff --git a/src/USER-CUDA/compute_pe_cuda.cpp b/src/USER-CUDA/compute_pe_cuda.cpp index 57685e52f3f934910642cee31f730bb673ed603b..b8661c9702a5c2d1d64dca44a5518e1645cae130 100644 --- a/src/USER-CUDA/compute_pe_cuda.cpp +++ b/src/USER-CUDA/compute_pe_cuda.cpp @@ -34,7 +34,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include <cstring> #include "compute_pe_cuda.h" #include "atom.h" diff --git a/src/USER-CUDA/compute_pressure_cuda.cpp b/src/USER-CUDA/compute_pressure_cuda.cpp index e87264d722dab63f84af691fe6c11d7dfe2f760c..c92e918ad0ecf4c2ff479270030ec922fde1b2da 100644 --- a/src/USER-CUDA/compute_pressure_cuda.cpp +++ b/src/USER-CUDA/compute_pressure_cuda.cpp @@ -34,7 +34,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include <cstring> #include <cstdlib> #include "compute_pressure_cuda.h" diff --git a/src/USER-CUDA/compute_temp_cuda.cpp b/src/USER-CUDA/compute_temp_cuda.cpp index 1db65294c61a10e016fffca18c4a3b8521056d4d..85afa07258b38c949841c26bebc4e779c473157e 100644 --- a/src/USER-CUDA/compute_temp_cuda.cpp +++ b/src/USER-CUDA/compute_temp_cuda.cpp @@ -34,7 +34,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include <cstdlib> #include <cstdio> #include <cstring> diff --git a/src/USER-CUDA/compute_temp_partial_cuda.cpp b/src/USER-CUDA/compute_temp_partial_cuda.cpp index 3de4fbb354652ab60ff2a8286c785f770b82f65c..b366c546f659d5ec7e65f5d6236f60947ef5acb8 100644 --- a/src/USER-CUDA/compute_temp_partial_cuda.cpp +++ b/src/USER-CUDA/compute_temp_partial_cuda.cpp @@ -34,7 +34,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include <cstdlib> #include <cstdio> #include <cstring> diff --git a/src/USER-CUDA/cuda.cpp b/src/USER-CUDA/cuda.cpp index 909b1259e57888fc2ef5ca5e1416bcab68249688..995289a792619c7bb4b98fedd5f9fc72880b8a50 100644 --- a/src/USER-CUDA/cuda.cpp +++ b/src/USER-CUDA/cuda.cpp @@ -65,7 +65,7 @@ Cuda::Cuda(LAMMPS* lmp) : Pointers(lmp) if (universe->me == 0) { - if(shared_data.compile_settings.prec_glob != sizeof(CUDA_CFLOAT) / 4) + if(shared_data.compile_settings.prec_glob != sizeof(CUDA_CFLOAT) / 4) printf("\n\n # CUDA WARNING: Compile Settings of cuda and cpp code differ! \n" " # CUDA WARNING: Global Precision: cuda %i cpp %i\n\n", shared_data.compile_settings.prec_glob, (int) sizeof(CUDA_CFLOAT) / 4); @@ -239,7 +239,7 @@ Cuda::~Cuda() void Cuda::accelerator(int narg, char **arg) { - // this error should not happen + // this error should not happen if (device_set) error->all(FLERR,"USER-CUDA device is already activated"); @@ -277,11 +277,11 @@ void Cuda::accelerator(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"thread") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package cuda command"); - if (strcmp(arg[iarg+1],"auto") == 0) + if (strcmp(arg[iarg+1],"auto") == 0) shared_data.pair.override_block_per_atom = -1; - else if (strcmp(arg[iarg+1],"tpa") == 0) + else if (strcmp(arg[iarg+1],"tpa") == 0) shared_data.pair.override_block_per_atom = 0; - else if (strcmp(arg[iarg+1],"bpa") == 0) + else if (strcmp(arg[iarg+1],"bpa") == 0) shared_data.pair.override_block_per_atom = 1; else error->all(FLERR,"Illegal package cuda command"); iarg += 2; @@ -299,7 +299,7 @@ void Cuda::accelerator(int narg, char **arg) } else if (strcmp(arg[iarg],"pinned") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package cuda command"); pinned = force->inumeric(FLERR,arg[iarg+1]) == 0 ? false : true; - if ((pinned == false) && (universe->me == 0)) + if ((pinned == false) && (universe->me == 0)) printf(" #CUDA: Pinned memory is not used for communication\n"); iarg += 2; } else error->all(FLERR,"Illegal package cuda command"); diff --git a/src/USER-CUDA/domain_cuda.cpp b/src/USER-CUDA/domain_cuda.cpp index 43b1dc24a314a9816d780036134042d2c1cd3c2f..997a42a6810a393a1bd26462f747f39e46558cc5 100644 --- a/src/USER-CUDA/domain_cuda.cpp +++ b/src/USER-CUDA/domain_cuda.cpp @@ -15,11 +15,11 @@ Contributing author (triclinic) : Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" -#include "stdio.h" -#include "math.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <math.h> #include "domain_cuda.h" #include "style_region.h" #include "atom.h" diff --git a/src/USER-CUDA/fft3d_cuda.cpp b/src/USER-CUDA/fft3d_cuda.cpp index 05994ea6df1d5412393f1e140da1260c08a46066..42ec4b16ee974bf9bc0d4bb065ebe7c0f2825014 100644 --- a/src/USER-CUDA/fft3d_cuda.cpp +++ b/src/USER-CUDA/fft3d_cuda.cpp @@ -38,7 +38,7 @@ Contributing authors: Jim Shepherd (GA Tech) added SGI SCSL support ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include <cstdio> #include <cstdlib> #include <cmath> diff --git a/src/USER-CUDA/fft3d_wrap_cuda.cpp b/src/USER-CUDA/fft3d_wrap_cuda.cpp index 80fc7b82287e0bb7ac28e9db428bad67749324f4..f02c38d8313d1aa9544234820b24567f4afbc33c 100644 --- a/src/USER-CUDA/fft3d_wrap_cuda.cpp +++ b/src/USER-CUDA/fft3d_wrap_cuda.cpp @@ -34,7 +34,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "fft3d_wrap_cuda.h" #include "error.h" diff --git a/src/USER-CUDA/fix_aveforce_cuda.cpp b/src/USER-CUDA/fix_aveforce_cuda.cpp index 917058fa3a25c520ce5b441120f259d76b3e55bb..9b4ceaa67c868c03bd75f48ea2f7cf93773c7fea 100644 --- a/src/USER-CUDA/fix_aveforce_cuda.cpp +++ b/src/USER-CUDA/fix_aveforce_cuda.cpp @@ -22,7 +22,7 @@ ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include <cstring> #include <cstdlib> #include "fix_aveforce_cuda.h" diff --git a/src/USER-CUDA/fix_shake_cuda.cpp b/src/USER-CUDA/fix_shake_cuda.cpp index 070274cedd108628880a10ce35460011225fcc6b..92274d1d4672432be8797be84ab591e0d14f0579 100644 --- a/src/USER-CUDA/fix_shake_cuda.cpp +++ b/src/USER-CUDA/fix_shake_cuda.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include <cmath> #include <cstdlib> #include <cstring> @@ -2793,7 +2793,7 @@ void FixShakeCuda::post_force_respa(int vflag, int ilevel, int iloop) /* ---------------------------------------------------------------------- */ -int FixShakeCuda::pack_forward_comm(int n, int* list, double* buf, +int FixShakeCuda::pack_forward_comm(int n, int* list, double* buf, int pbc_flag, int* pbc) { if(cuda->finished_setup) { diff --git a/src/USER-CUDA/neighbor_cuda.cpp b/src/USER-CUDA/neighbor_cuda.cpp index eb46a44b3c27e45b868f237f084c14117cdfe73d..015e85ff0754b09ace10b6970f988091e380ae4b 100644 --- a/src/USER-CUDA/neighbor_cuda.cpp +++ b/src/USER-CUDA/neighbor_cuda.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "neighbor_cuda.h" #include "user_cuda.h" #include "atom.h" diff --git a/src/USER-CUDA/pair_eam_cuda.cpp b/src/USER-CUDA/pair_eam_cuda.cpp index f3dcdd16f50e89caa5eb51fcd7afea3b76ace18b..3db0c66cd63b4c969987c32d3f4b5503c87a2d0b 100644 --- a/src/USER-CUDA/pair_eam_cuda.cpp +++ b/src/USER-CUDA/pair_eam_cuda.cpp @@ -231,7 +231,7 @@ void PairEAMCuda::array2spline() /* ---------------------------------------------------------------------- */ -int PairEAMCuda::pack_forward_comm(int n, int* iswap, double* buf, +int PairEAMCuda::pack_forward_comm(int n, int* iswap, double* buf, int pbc_flag, int* pbc) { Cuda_PairEAMCuda_PackComm(&cuda->shared_data, n, *iswap, buf); diff --git a/src/USER-CUDA/pair_eam_cuda.h b/src/USER-CUDA/pair_eam_cuda.h index 27f0f45d27906301264d525a0a8d8091fba7da04..973fc20a459b94a53ead62b1ba0dbf7904a6a0df 100644 --- a/src/USER-CUDA/pair_eam_cuda.h +++ b/src/USER-CUDA/pair_eam_cuda.h @@ -57,7 +57,7 @@ class PairEAMCuda : public PairEAM void init_list(int, class NeighList *); void init_style(); void array2spline(); - int pack_forward_comm(int n, int *iswap, double *buf, + int pack_forward_comm(int n, int *iswap, double *buf, int pbc_flag, int *pbc); void unpack_forward_comm(int n, int first, double *buf); protected: diff --git a/src/USER-CUDA/pair_gran_hooke_cuda.cpp b/src/USER-CUDA/pair_gran_hooke_cuda.cpp index 88cf2a2c28dcad4c23f42b2341e419083fd291b5..3f60475ad5322f7e2cb89b08db25f8291f6f8990 100644 --- a/src/USER-CUDA/pair_gran_hooke_cuda.cpp +++ b/src/USER-CUDA/pair_gran_hooke_cuda.cpp @@ -197,12 +197,12 @@ void PairGranHookeCuda::init_style() onerad_dynamic[i] = onerad_frozen[i] = 0.0; if (ipour >= 0) { itype = i; - onerad_dynamic[i] = + onerad_dynamic[i] = *((double *) modify->fix[ipour]->extract("radius",itype)); } if (idep >= 0) { itype = i; - onerad_dynamic[i] = + onerad_dynamic[i] = *((double *) modify->fix[idep]->extract("radius",itype)); } } diff --git a/src/USER-CUDA/pair_tersoff_zbl_cuda.cpp b/src/USER-CUDA/pair_tersoff_zbl_cuda.cpp index 32588ed04a40bb8e2d3e4aaef3d9460aeb370e73..91dcf6189eb3c139f9443721339a7cb79ee3c3a8 100644 --- a/src/USER-CUDA/pair_tersoff_zbl_cuda.cpp +++ b/src/USER-CUDA/pair_tersoff_zbl_cuda.cpp @@ -16,10 +16,10 @@ David Farrell (NWU) - ZBL addition ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_zbl_cuda.h" #include "atom.h" #include "update.h" diff --git a/src/USER-CUDA/pppm_cuda.cpp b/src/USER-CUDA/pppm_cuda.cpp index d770fa350dff29edfb99db4b09b48784b09e7a51..b322c9dd171eb80beb2f75ea17934964fe05bc01 100644 --- a/src/USER-CUDA/pppm_cuda.cpp +++ b/src/USER-CUDA/pppm_cuda.cpp @@ -38,7 +38,7 @@ Contributing authors: Roy Pollock (LLNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include <cstring> #include <cstdio> #include <cstdlib> @@ -96,7 +96,7 @@ void printArray(double*** data,int nx, int ny, int nz) } /* ---------------------------------------------------------------------- */ -PPPMCuda::PPPMCuda(LAMMPS *lmp, int narg, char **arg) : +PPPMCuda::PPPMCuda(LAMMPS *lmp, int narg, char **arg) : PPPMOld(lmp, (narg==2?1:narg), arg) { cuda = lmp->cuda; @@ -209,7 +209,7 @@ void PPPMCuda::init() // error check if (domain->dimension == 2) error->all(FLERR,"Cannot use PPPMCuda with 2d simulation"); - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"PPPMCuda can only currently be used with " "comm_style brick"); @@ -695,7 +695,7 @@ void PPPMCuda::compute(int eflag, int vflag) delete cu_part2grid; delete [] adev_data_array; adev_data_array=new dev_array[1]; - cu_part2grid = new cCudaData<int , int , yx > + cu_part2grid = new cCudaData<int , int , yx > ((int*)part2grid,adev_data_array, nmax,3); pppm_device_update(&cuda->shared_data,cu_part2grid->dev_data(), diff --git a/src/USER-CUDA/pppm_old.cpp b/src/USER-CUDA/pppm_old.cpp index 22d23c4b58790c93b019828feebd092dd9313c59..2cc4c18626e675e4b3106a54dc6c3cded1d0c2e7 100755 --- a/src/USER-CUDA/pppm_old.cpp +++ b/src/USER-CUDA/pppm_old.cpp @@ -16,11 +16,11 @@ per-atom energy/virial & group/group energy/force added by Stan Moore (BYU) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> #include "pppm_old.h" #include "math_const.h" #include "atom.h" diff --git a/src/USER-CUDA/pppm_old.h b/src/USER-CUDA/pppm_old.h index b849a4e3fcb369f487f001f251d05e0569ee690d..57a92e1202ffbc8f62b214761574c32ab1df41f5 100644 --- a/src/USER-CUDA/pppm_old.h +++ b/src/USER-CUDA/pppm_old.h @@ -21,7 +21,7 @@ KSpaceStyle(pppm/old,PPPMOld) #define LMP_PPPM_OLD_H #include "lmptype.h" -#include "mpi.h" +#include <mpi.h> #ifdef FFT_SINGLE typedef float FFT_SCALAR; diff --git a/src/USER-CUDA/verlet_cuda.cpp b/src/USER-CUDA/verlet_cuda.cpp index 2a216b5b460c22e3bc36494a099da6bb24443d42..f382117567b95c58e4b6e1f24501bc60beadc6f0 100644 --- a/src/USER-CUDA/verlet_cuda.cpp +++ b/src/USER-CUDA/verlet_cuda.cpp @@ -53,7 +53,7 @@ #include <ctime> #include <cmath> #ifdef _OPENMP -#include "omp.h" +#include <omp.h> #endif using namespace LAMMPS_NS; diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index e275b5eb1a502864897c760886ec561f5018f774..fc76a8f867d98f1bb914c286e8065b75428cc5c2 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -15,9 +15,9 @@ Contributing authors: Shawn Coleman & Douglas Spearot (Arkansas) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "math_const.h" #include "compute_saed.h" #include "compute_saed_consts.h" @@ -29,8 +29,8 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> using namespace LAMMPS_NS; using namespace MathConst; @@ -61,16 +61,16 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : me = comm->me; // Checking errors specific to the compute - if (dimension == 2) + if (dimension == 2) error->all(FLERR,"Compute SAED does not work with 2d structures"); - if (narg < 4+ntypes) + if (narg < 4+ntypes) error->all(FLERR,"Illegal Compute SAED Command"); - if (triclinic == 1) - error->all(FLERR,"Compute SAED does not work with triclinic structures"); - + if (triclinic == 1) + error->all(FLERR,"Compute SAED does not work with triclinic structures"); + vector_flag = 1; extvector = 0; - + // Store radiation wavelength lambda = atof(arg[3]); if (lambda < 0) @@ -82,7 +82,7 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < ntypes; i++){ ztype[i] = SAEDmaxType + 1; } - for (int i=0; i<ntypes; i++) { + for (int i=0; i<ntypes; i++) { for(int j = 0; j < SAEDmaxType; j++){ if (strcasecmp(arg[iarg],SAEDtypeList[j]) == 0) { ztype[i] = j; @@ -99,40 +99,40 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : c[0] = 1; c[1] = 1; c[2] = 1; dR_Ewald = 0.01 / 2; manual = false; - double manual_double=0; + double manual_double=0; echo = false; // Process optional args while (iarg < narg) { - + if (strcmp(arg[iarg],"Kmax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal Compute SAED Command"); Kmax = atof(arg[iarg+1]); - if (Kmax / 2 < 0 || Kmax / 2 > 6) + if (Kmax / 2 < 0 || Kmax / 2 > 6) error->all(FLERR,"Compute SAED: |K|max/2 must be between 0 and 6 "); iarg += 2; - + } else if (strcmp(arg[iarg],"Zone") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal Compute SAED Command"); Zone[0] = atof(arg[iarg+1]); Zone[1] = atof(arg[iarg+2]); Zone[2] = atof(arg[iarg+3]); iarg += 4; - + } else if (strcmp(arg[iarg],"c") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal Compute SAED Command"); c[0] = atof(arg[iarg+1]); c[1] = atof(arg[iarg+2]); c[2] = atof(arg[iarg+3]); - if (c[0] < 0 || c[1] < 0 || c[2] < 0) - error->all(FLERR,"Compute SAED: dKs must be greater than 0"); + if (c[0] < 0 || c[1] < 0 || c[2] < 0) + error->all(FLERR,"Compute SAED: dKs must be greater than 0"); iarg += 4; - + } else if (strcmp(arg[iarg],"dR_Ewald") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal Compute SAED Command"); dR_Ewald = atof(arg[iarg+1]); - if (dR_Ewald < 0) - error->all(FLERR,"Compute SAED: dR_Ewald slice must be greater than 0"); + if (dR_Ewald < 0) + error->all(FLERR,"Compute SAED: dR_Ewald slice must be greater than 0"); iarg += 2; } else if (strcmp(arg[iarg],"echo") == 0) { @@ -141,41 +141,41 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"manual") == 0) { manual = true; - manual_double = 1; - iarg += 1; - + manual_double = 1; + iarg += 1; + } else error->all(FLERR,"Illegal Compute SAED Command"); } - + // Zone flag to capture entire recrocal space volume if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ } else { - R_Ewald = (1 / lambda); - double Rnorm = R_Ewald/ sqrt(Zone[0] * Zone[0] + + R_Ewald = (1 / lambda); + double Rnorm = R_Ewald/ sqrt(Zone[0] * Zone[0] + Zone[1] * Zone[1] + Zone[2]* Zone[2]); - Zone[0] = Zone[0] * Rnorm; - Zone[1] = Zone[1] * Rnorm; - Zone[2] = Zone[2] * Rnorm; + Zone[0] = Zone[0] * Rnorm; + Zone[1] = Zone[1] * Rnorm; + Zone[2] = Zone[2] * Rnorm; } // Procedure to determine how many rows are needed given the constraints on 2theta - // Calculating spacing between reciprical lattice points + // Calculating spacing between reciprical lattice points // Using distance based on periodic repeating distance - if (!manual) { + if (!manual) { if (!periodicity[0] && !periodicity[1] && !periodicity[2]) error->all(FLERR,"Compute SAED must have at least one periodic boundary unless manual spacing specified"); double *prd; - double ave_inv = 0.0; + double ave_inv = 0.0; prd = domain->prd; if (periodicity[0]){ - prd_inv[0] = 1 / prd[0]; + prd_inv[0] = 1 / prd[0]; ave_inv += prd_inv[0]; - } + } if (periodicity[1]){ prd_inv[1] = 1 / prd[1]; ave_inv += prd_inv[1]; - } + } if (periodicity[2]){ prd_inv[2] = 1 / prd[2]; ave_inv += prd_inv[2]; @@ -184,34 +184,34 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : // Using the average inverse dimensions for non-periodic direction ave_inv = ave_inv / (periodicity[0] + periodicity[1] + periodicity[2]); if (!periodicity[0]){ - prd_inv[0] = ave_inv; - } + prd_inv[0] = ave_inv; + } if (!periodicity[1]){ prd_inv[1] = ave_inv; - } + } if (!periodicity[2]){ prd_inv[2] = ave_inv; } } - // Use manual mapping of reciprocal lattice + // Use manual mapping of reciprocal lattice if (manual) { for (int i=0; i<3; i++) { prd_inv[i] = 1.0; } - } - + } + // Find reprical spacing and integer dimensions for (int i=0; i<3; i++) { dK[i] = prd_inv[i]*c[i]; Knmax[i] = ceil(Kmax / dK[i]); } - + // Finding the intersection of the reciprical space and Ewald sphere int n = 0; double dinv2, r2, EmdR2, EpdR2; double K[3]; - + // Zone flag to capture entire recrocal space volume if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ for (int k = -Knmax[2]; k <= Knmax[2]; k++) { @@ -222,9 +222,9 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : K[2] = k * dK[2]; dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]); if (dinv2 < Kmax * Kmax) n++; - } + } } - } + } } else { for (int k = -Knmax[2]; k <= Knmax[2]; k++) { for (int j = -Knmax[1]; j <= Knmax[1]; j++) { @@ -238,14 +238,14 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : for (int m=0; m<3; m++) r2 += pow(K[m] - Zone[m],2.0); EmdR2 = pow(R_Ewald - dR_Ewald,2); - EpdR2 = pow(R_Ewald + dR_Ewald,2); + EpdR2 = pow(R_Ewald + dR_Ewald,2); if ( (r2 > EmdR2 ) && (r2 < EpdR2 ) ) { n++; } } - } + } } - } + } } if (me == 0) { @@ -254,13 +254,13 @@ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : fprintf(screen,"Reciprocal point spacing in k1,k2,k3 = %g %g %g\n-----\n", dK[0], dK[1], dK[2]); } - } + } nRows = n; size_vector = n; memory->create(vector,size_vector,"saed:vector"); memory->create(store_tmp,3*size_vector,"saed:store_tmp"); - + // Create vector of variables to be passed to fix ave/time/saed saed_var[0] = lambda; @@ -291,7 +291,7 @@ void ComputeSAED::init() double dinv2, r2, EmdR2, EpdR2; double K[3]; int n = 0; - + // Zone 0 0 0 flag to capture entire recrocal space volume if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ for (int k = -Knmax[2]; k <= Knmax[2]; k++) { @@ -307,8 +307,8 @@ void ComputeSAED::init() store_tmp[3*n+2] = k; n++; } - } - } + } + } } } else { for (int k = -Knmax[2]; k <= Knmax[2]; k++) { @@ -323,7 +323,7 @@ void ComputeSAED::init() for (int m=0; m<3; m++) r2 += pow(K[m] - Zone[m],2.0); EmdR2 = pow(R_Ewald - dR_Ewald,2); - EpdR2 = pow(R_Ewald + dR_Ewald,2); + EpdR2 = pow(R_Ewald + dR_Ewald,2); if ( (r2 > EmdR2 ) && (r2 < EpdR2 ) ) { store_tmp[3*n] = i; store_tmp[3*n+1] = j; @@ -332,8 +332,8 @@ void ComputeSAED::init() } } } - } - } + } + } } if (n != nRows) error->all(FLERR,"Compute SAED Nrows inconsistent"); @@ -379,7 +379,7 @@ void ComputeSAED::compute_vector() typelocal[nlocalgroup]=type[ii]; nlocalgroup++; } - } + } /* double *x = new double [3*nlocal]; @@ -397,10 +397,10 @@ void ComputeSAED::compute_vector() // determining paramater set to use based on maximum S = sin(theta)/lambda double Smax = Kmax / 2; - + int offset = 0; // offset the ASFSAED matrix for appropriate value if (Smax <= 2) offset = 0; - if (Smax > 2) offset = 10; + if (Smax > 2) offset = 10; // Setting up OMP #if defined(_OPENMP) @@ -429,7 +429,7 @@ void ComputeSAED::compute_vector() double K[3]; double dinv2 = 0.0; double dinv = 0.0; - double SinTheta_lambda = 0.0; + double SinTheta_lambda = 0.0; double inners = 0.0; #if defined(_OPENMP) @@ -442,11 +442,11 @@ void ComputeSAED::compute_vector() K[0] = i * dK[0]; K[1] = j * dK[1]; K[2] = k * dK[2]; - + dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]); dinv = sqrt(dinv2); SinTheta_lambda = 0.5*dinv; - + Fatom1 = 0.0; Fatom2 = 0.0; @@ -508,14 +508,14 @@ void ComputeSAED::compute_vector() bytes += 3.0 * nlocalgroup * sizeof(double); // xlocal bytes += nlocalgroup * sizeof(int); // typelocal bytes += 3.0 * nRows * sizeof(int); // store_temp - + if (me == 0 && echo) { if (screen) fprintf(screen," 100%% \nTime ellapsed during compute_saed = %0.2f sec using %0.2f Mbytes/processor\n-----\n", t2-t0, bytes/1024.0/1024.0); } delete [] xlocal; - delete [] typelocal; + delete [] typelocal; delete [] scratch; delete [] Fvec; } @@ -532,7 +532,7 @@ double ComputeSAED::memory_usage() bytes += 3.0 * nlocalgroup * sizeof(double); // xlocal bytes += nlocalgroup * sizeof(int); // typelocal bytes += 3.0 * nRows * sizeof(int); // store_temp - + return bytes; } diff --git a/src/USER-DIFFRACTION/compute_saed.h b/src/USER-DIFFRACTION/compute_saed.h index 0118b648116d48bd9529eb4165a0ca173e3c388e..89e57f5097fc473867be477e48876d0950ceac5e 100644 --- a/src/USER-DIFFRACTION/compute_saed.h +++ b/src/USER-DIFFRACTION/compute_saed.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -31,7 +31,7 @@ class ComputeSAED : public Compute { void init(); void compute_vector(); double memory_usage(); -//testing +//testing double saed_var[10]; private: diff --git a/src/USER-DIFFRACTION/compute_saed_consts.h b/src/USER-DIFFRACTION/compute_saed_consts.h index 3d62829c893bc4370489988ab40fa0b1bea6017f..0cce0abfc2b7d9c0ccc2e2088439adc2b95c4b67 100644 --- a/src/USER-DIFFRACTION/compute_saed_consts.h +++ b/src/USER-DIFFRACTION/compute_saed_consts.h @@ -16,20 +16,20 @@ /* The paramaters for analytical approximation of the atomic scattering factors -used for electron diffraction are gathered from the resources: +used for electron diffraction are gathered from the resources: -Colliex C et al 2004 Electron diffraction International Tables for -Crystallography Volume C: Mathematical, Physical, and Chemical Tables +Colliex C et al 2004 Electron diffraction International Tables for +Crystallography Volume C: Mathematical, Physical, and Chemical Tables ed E Prince (Norwell, MA: Kluwer) pp 259429 -Peng L-M, Ren G, Dudarev S L and Whelan MJ 1996 Robust parameterization of -elastic and absorptive electron atomic scattering factors +Peng L-M, Ren G, Dudarev S L and Whelan MJ 1996 Robust parameterization of +elastic and absorptive electron atomic scattering factors Acta Crystallogr.A 52 25776 */ #define SAEDmaxType 98 -// list of element types associated with atomic scattering factor constants +// list of element types associated with atomic scattering factor constants static const char *SAEDtypeList[SAEDmaxType] = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index ffd1f1c9dd78bcd99679712c26bf2c3fc96228a3..5d30cfc8770bd1943c67481371e777328e19d550 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,9 +16,9 @@ Updated: 06/17/2015-2 ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "math_const.h" #include "compute_xrd.h" #include "compute_xrd_consts.h" @@ -30,8 +30,8 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> using namespace LAMMPS_NS; using namespace MathConst; @@ -62,11 +62,11 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : me = comm->me; // Checking errors - if (dimension == 2) + if (dimension == 2) error->all(FLERR,"Compute XRD does not work with 2d structures"); - if (narg < 4+ntypes) + if (narg < 4+ntypes) error->all(FLERR,"Illegal Compute XRD Command"); - if (triclinic == 1) + if (triclinic == 1) error->all(FLERR,"Compute XRD does not work with triclinic structures"); array_flag = 1; @@ -78,12 +78,12 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute SAED: Wavelength must be greater than zero"); // Define atom types for atomic scattering factor coefficients - int iarg = 4; + int iarg = 4; ztype = new int[ntypes]; for (int i = 0; i < ntypes; i++){ ztype[i] = XRDmaxType + 1; } - for (int i = 0; i < ntypes; i++) { + for (int i = 0; i < ntypes; i++) { for(int j = 0; j < XRDmaxType; j++){ if (strcasecmp(arg[iarg],XRDtypeList[j]) == 0) { ztype[i] = j; @@ -96,7 +96,7 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : // Set defaults for optional args Min2Theta = 1; - Max2Theta = 179; + Max2Theta = 179; radflag = 1; c[0] = 1; c[1] = 1; c[2] = 1; LP = 1; @@ -114,11 +114,11 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : Max2Theta = Max2Theta * MY_PI / 180; radflag = 0; } - if (Min2Theta <= 0) + if (Min2Theta <= 0) error->all(FLERR,"Minimum 2theta value must be greater than zero"); - if (Max2Theta >= MY_PI ) + if (Max2Theta >= MY_PI ) error->all(FLERR,"Maximum 2theta value must be less than 180 degrees"); - if (Max2Theta-Min2Theta <= 0) + if (Max2Theta-Min2Theta <= 0) error->all(FLERR,"Two-theta range must be greater than zero"); iarg += 3; @@ -127,16 +127,16 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : c[0] = atof(arg[iarg+1]); c[1] = atof(arg[iarg+2]); c[2] = atof(arg[iarg+3]); - if (c[0] < 0 || c[1] < 0 || c[2] < 0) - error->all(FLERR,"Compute XRD: c's must be greater than 0"); + if (c[0] < 0 || c[1] < 0 || c[2] < 0) + error->all(FLERR,"Compute XRD: c's must be greater than 0"); iarg += 4; - + } else if (strcmp(arg[iarg],"LP") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal Compute XRD Command"); LP = atof(arg[iarg+1]); - if (!(LP == 1 || LP == 0)) - error->all(FLERR,"Compute XRD: LP must have value of 0 or 1"); + if (!(LP == 1 || LP == 0)) + error->all(FLERR,"Compute XRD: LP must have value of 0 or 1"); iarg += 2; } else if (strcmp(arg[iarg],"echo") == 0) { @@ -145,31 +145,31 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"manual") == 0) { manual = true; - iarg += 1; - + iarg += 1; + } else error->all(FLERR,"Illegal Compute XRD Command"); } - + Kmax = 2 * sin(Max2Theta) / lambda; - - // Calculating spacing between reciprocal lattice points + + // Calculating spacing between reciprocal lattice points // Using distance based on periodic repeating distance - if (!manual) { + if (!manual) { if (!periodicity[0] && !periodicity[1] && !periodicity[2]) error->all(FLERR,"Compute SAED must have at least one periodic boundary unless manual spacing specified"); double *prd; - double ave_inv = 0.0; + double ave_inv = 0.0; prd = domain->prd; if (periodicity[0]){ - prd_inv[0] = 1 / prd[0]; + prd_inv[0] = 1 / prd[0]; ave_inv += prd_inv[0]; - } + } if (periodicity[1]){ prd_inv[1] = 1 / prd[1]; ave_inv += prd_inv[1]; - } + } if (periodicity[2]){ prd_inv[2] = 1 / prd[2]; ave_inv += prd_inv[2]; @@ -178,35 +178,35 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : // Using the average inverse dimensions for non-periodic direction ave_inv = ave_inv / (periodicity[0] + periodicity[1] + periodicity[2]); if (!periodicity[0]){ - prd_inv[0] = ave_inv; - } + prd_inv[0] = ave_inv; + } if (!periodicity[1]){ prd_inv[1] = ave_inv; - } + } if (!periodicity[2]){ prd_inv[2] = ave_inv; } } - // Use manual mapping of reciprocal lattice + // Use manual mapping of reciprocal lattice if (manual) { for (int i=0; i<3; i++) { prd_inv[i] = 1.0; } - } - + } + // Find reciprocal spacing and integer dimensions for (int i=0; i<3; i++) { dK[i] = prd_inv[i]*c[i]; Knmax[i] = ceil(Kmax / dK[i]); - } - + } + // Finding the intersection of the reciprocal space and Ewald sphere int nRows = 0; double dinv2= 0.0; double ang = 0.0; double K[3]; - + // Procedure to determine how many rows are needed given the constraints on 2theta for (int i = -Knmax[0]; i <= Knmax[0]; i++) { for (int j = -Knmax[1]; j <= Knmax[1]; j++) { @@ -221,22 +221,22 @@ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : nRows++; } } - } + } } - } - + } + size_array_rows = nRows; size_array_cols = 2; - + if (me == 0) { if (screen && echo) { fprintf(screen,"-----\nCompute XRD id:%s, # of atoms:%d, # of relp:%d\n",id,natoms,nRows); fprintf(screen,"Reciprocal point spacing in k1,k2,k3 = %g %g %g\n-----\n", dK[0], dK[1], dK[2]); } - } - + } + memory->create(array,size_array_rows,size_array_cols,"xrd:array"); memory->create(store_tmp,3*size_array_rows,"xrd:store_tmp"); } @@ -287,7 +287,7 @@ void ComputeXRD::init() } } } - if (n != size_array_rows) + if (n != size_array_rows) error->all(FLERR,"Compute XRD compute_array() rows mismatch"); } @@ -307,7 +307,7 @@ void ComputeXRD::compute_array() double *Fvec = new double[2*size_array_rows]; // Strct factor (real & imaginary) // -- Note: array rows correspond to different RELP - + ntypes = atom->ntypes; int nlocal = atom->nlocal; int *type = atom->type; @@ -333,7 +333,7 @@ void ComputeXRD::compute_array() typelocal[nlocalgroup]=type[ii]; nlocalgroup++; } - } + } // Setting up OMP #if defined(_OPENMP) @@ -387,14 +387,14 @@ void ComputeXRD::compute_array() K[0] = i * dK[0]; K[1] = j * dK[1]; K[2] = k * dK[2]; - + dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]); dinv = sqrt(dinv2); SinTheta_lambda = 0.5*dinv; - SinTheta = SinTheta_lambda * lambda; + SinTheta = SinTheta_lambda * lambda; ang = asin( SinTheta ); Cos2Theta = cos( 2 * ang); - CosTheta = cos( ang ); + CosTheta = cos( ang ); Fatom1 = 0.0; Fatom2 = 0.0; @@ -433,7 +433,7 @@ void ComputeXRD::compute_array() } m++; } - } + } } // End of pragma omp for region } else { @@ -447,11 +447,11 @@ void ComputeXRD::compute_array() K[0] = i * dK[0]; K[1] = j * dK[1]; K[2] = k * dK[2]; - + dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]); dinv = sqrt(dinv2); SinTheta_lambda = 0.5*dinv; - + Fatom1 = 0.0; Fatom2 = 0.0; @@ -489,7 +489,7 @@ void ComputeXRD::compute_array() } } } // End of pragma omp for region - } // End of if LP=1 check + } // End of if LP=1 check delete [] f; } // End of pragma omp parallel region @@ -511,7 +511,7 @@ void ComputeXRD::compute_array() bytes += 3.0 * nlocalgroup * sizeof(double); // xlocal bytes += nlocalgroup * sizeof(int); // typelocal bytes += 3.0 * size_array_rows * sizeof(int); // store_temp - + if (me == 0 && echo) { if (screen) fprintf(screen," 100%% \nTime ellapsed during compute_xrd = %0.2f sec using %0.2f Mbytes/processor\n-----\n", t2-t0, bytes/1024.0/1024.0); @@ -535,7 +535,7 @@ double ComputeXRD::memory_usage() bytes += nlocalgroup * sizeof(int); // typelocal bytes += ntypes * sizeof(double); // f bytes += 3.0 * size_array_rows * sizeof(int); // store_temp - + return bytes; } diff --git a/src/USER-DIFFRACTION/compute_xrd.h b/src/USER-DIFFRACTION/compute_xrd.h index d3df948adcbd2bc4a5941626ddecd17e7a7fea4c..92a59fcf23f779628900aee25524a0ef1c06ff92 100644 --- a/src/USER-DIFFRACTION/compute_xrd.h +++ b/src/USER-DIFFRACTION/compute_xrd.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -37,7 +37,7 @@ class ComputeXRD : public Compute { int *ztype; // Atomic number of the different atom types double Min2Theta; // Minimum 2theta value (input in 2theta rad) double Max2Theta; // Maximum 2theta value (input in 2theta rad) - double Kmax; // Maximum reciprocal distance to explore + double Kmax; // Maximum reciprocal distance to explore double c[3]; // Resolution parameters for reciprocal space explored int Knmax[3]; // maximum integer value for K points in each dimension double dK[3]; // Parameters controlling resolution of reciprocal space explored @@ -45,13 +45,13 @@ class ComputeXRD : public Compute { int LP; // Switch to turn on Lorentz-Polarization factor 1=on bool echo; // echo compute_array progress bool manual; // Turn on manual recpiprocal map - + int ntypes; int nlocalgroup; double lambda; // Radiation wavelenght (distance units) int radflag; int *store_tmp; - + }; } diff --git a/src/USER-DIFFRACTION/compute_xrd_consts.h b/src/USER-DIFFRACTION/compute_xrd_consts.h index e3f2a0ca6732654a2b3bc122686fbd02b44aaa3b..1ca0d6bd669cd1c9816dd813526124da507577ae 100644 --- a/src/USER-DIFFRACTION/compute_xrd_consts.h +++ b/src/USER-DIFFRACTION/compute_xrd_consts.h @@ -16,49 +16,49 @@ /* The paramaters for analytical approximation of the atomic scattering factors -used for x-ray diffraction are gathered from the resources: +used for x-ray diffraction are gathered from the resources: -Brown P J, Fox A G, Maslen E N, O’Keefe M A and Willis B T M 2004 Intensity -of diffraction intensities International Tables for Crystallography -Volume C: Mathematical, Physical, and Chemical Tables +Brown P J, Fox A G, Maslen E N, O’Keefe M A and Willis B T M 2004 Intensity +of diffraction intensities International Tables for Crystallography +Volume C: Mathematical, Physical, and Chemical Tables ed E Prince (Norwell, MA: Kluwer Academic Publishers) pp 55495 Fox A G, O’Keefe M A and Tabbernor M A 1989 Relativistic Hartree Fock -x-ray and electron atomic scattering factors at high angles +x-ray and electron atomic scattering factors at high angles Acta Crystallogr. A 45 78693 */ #define XRDmaxType 210 static const char *XRDtypeList[XRDmaxType] = { - "H", "He1-", "He", "Li", "Li1+", - "Be", "Be2+", "B", "C", "Cval", - "N", "O", "O1-", "F", "F1-", - "Ne", "Na", "Na1+", "Mg", "Mg2+", - "Al", "Al3+", "Si", "Sival", "Si4+", - "P", "S", "Cl", "Cl1-", "Ar", - "K", "Ca", "Ca2+", "Sc", "Sc3+", - "Ti", "Ti2+", "Ti3+", "Ti4+", "V", - "V2+", "V3+", "V5+", "Cr", "Cr2+", - "Cr3+", "Mn", "Mn2+", "Mn3+", "Mn4+", - "Fe", "Fe2+", "Fe3+", "Co", "Co2+", - "Co", "Ni", "Ni2+", "Ni3+", "Cu", - "Cu1+", "Cu2+", "Zn", "Zn2+", "Ga", - "Ga3+", "Ge", "Ge4+", "As", "Se", - "Br", "Br1-", "Kr", "Rb", "Rb1+", - "Sr", "Sr2+", "Y", "Y3+", "Zr", - "Zr4+", "Nb", "Nb3+", "Nb5+", "Mo", - "Mo3+", "Mo5+", "Mo6+", "Tc", "Ru", - "Ru3+", "Ru4+", "Rh", "Rh3+", "Rh4+", - "Pd", "Pd2+", "Pd4+", "Ag", "Ag1+", - "Ag2+", "Cd", "Cd2+", "In", "In3+", - "Sn", "Sn2+", "Sn4+", "Sb", "Sb3+", - "Sb5+", "Te", "I", "I1-", "Xe", - "Cs", "Cs1+", "Ba", "Ba2+", "La", - "La3+", "Ce", "Ce3+", "Ce4+", "Pr", - "Pr3+", "Pr4+", "Nd", "Nd3+", "Pm", - "Pm3+", "Sm", "Sm3+", "Eu", "Eu2+", - "Eu3+", "Gd", "Gd3+", "Tb", "Tb3+", + "H", "He1-", "He", "Li", "Li1+", + "Be", "Be2+", "B", "C", "Cval", + "N", "O", "O1-", "F", "F1-", + "Ne", "Na", "Na1+", "Mg", "Mg2+", + "Al", "Al3+", "Si", "Sival", "Si4+", + "P", "S", "Cl", "Cl1-", "Ar", + "K", "Ca", "Ca2+", "Sc", "Sc3+", + "Ti", "Ti2+", "Ti3+", "Ti4+", "V", + "V2+", "V3+", "V5+", "Cr", "Cr2+", + "Cr3+", "Mn", "Mn2+", "Mn3+", "Mn4+", + "Fe", "Fe2+", "Fe3+", "Co", "Co2+", + "Co", "Ni", "Ni2+", "Ni3+", "Cu", + "Cu1+", "Cu2+", "Zn", "Zn2+", "Ga", + "Ga3+", "Ge", "Ge4+", "As", "Se", + "Br", "Br1-", "Kr", "Rb", "Rb1+", + "Sr", "Sr2+", "Y", "Y3+", "Zr", + "Zr4+", "Nb", "Nb3+", "Nb5+", "Mo", + "Mo3+", "Mo5+", "Mo6+", "Tc", "Ru", + "Ru3+", "Ru4+", "Rh", "Rh3+", "Rh4+", + "Pd", "Pd2+", "Pd4+", "Ag", "Ag1+", + "Ag2+", "Cd", "Cd2+", "In", "In3+", + "Sn", "Sn2+", "Sn4+", "Sb", "Sb3+", + "Sb5+", "Te", "I", "I1-", "Xe", + "Cs", "Cs1+", "Ba", "Ba2+", "La", + "La3+", "Ce", "Ce3+", "Ce4+", "Pr", + "Pr3+", "Pr4+", "Nd", "Nd3+", "Pm", + "Pm3+", "Sm", "Sm3+", "Eu", "Eu2+", + "Eu3+", "Gd", "Gd3+", "Tb", "Tb3+", "Dy", "Dy3+", "Ho", "Ho3+", "Er", "Er3+", "Tm", "Tm3+", "Yb", "Yb2+", "Yb3+", "Lu", "Lu3+", "Hf", "Hf4+", @@ -82,425 +82,425 @@ static const double ASFXRD[XRDmaxType][9] = { B3, A4, B4, C */ {0.489918, 20.6593, 0.262003, 7.74039, 0.196767, - 49.5519, 0.049879, 2.20159, 0.001305}, + 49.5519, 0.049879, 2.20159, 0.001305}, {0.897661, 53.1368, 0.565616, 15.187, 0.415815, - 186.576, 0.116973, 3.56709, 0.002389}, + 186.576, 0.116973, 3.56709, 0.002389}, { 0.8734, 9.1037, 0.6309, 3.3568, 0.3112, - 22.9276, 0.178, 0.9821, 0.0064}, + 22.9276, 0.178, 0.9821, 0.0064}, { 1.1282, 3.9546, 0.7508, 1.0524, 0.6175, - 85.3905, 0.4653, 68.261, 0.0377}, + 85.3905, 0.4653, 68.261, 0.0377}, { 0.6968, 4.6237, 0.7888, 1.9557, 0.3414, - 0.6316, 0.7029, 0.542, 0.0167}, + 0.6316, 0.7029, 0.542, 0.0167}, { 1.5919, 43.6427, 1.1278, 1.8623, 0.5391, - 103.483, 0.7029, 0.542, 0.0385}, + 103.483, 0.7029, 0.542, 0.0385}, { 6.2603, 0.0027, 0.8849, 0.8313, 0.7993, - 2.2758, 0.1647, 5.1146, -6.1092}, + 2.2758, 0.1647, 5.1146, -6.1092}, { 2.0545, 23.2185, 1.3326, 1.021, 1.0979, - 60.3498, 0.7068, 0.1403, -0.1932}, + 60.3498, 0.7068, 0.1403, -0.1932}, { 2.31, 20.8439, 1.02, 10.2075, 1.5886, - 0.5687, 0.865, 51.6512, 0.2156}, + 0.5687, 0.865, 51.6512, 0.2156}, { 2.26069, 22.6907, 1.56165, 0.656665, 1.05075, - 9.75618, 0.839259, 55.5949, 0.286977}, + 9.75618, 0.839259, 55.5949, 0.286977}, { 12.2126, 0.0057, 3.1322, 9.8933, 2.0125, - 28.9975, 1.1663, 0.5826, -11.529}, + 28.9975, 1.1663, 0.5826, -11.529}, { 3.0485, 13.2771, 2.2868, 5.7011, 1.5463, - 0.3239, 0.867, 32.9089, 0.2508}, + 0.3239, 0.867, 32.9089, 0.2508}, { 4.1916, 12.8573, 1.63969, 4.17236, 1.52673, - -47.0179, 20.307, -0.01404, 21.9412}, + -47.0179, 20.307, -0.01404, 21.9412}, { 3.5392, 10.2825, 2.6412, 4.2944, 1.517, - 0.2615, 1.0243, 26.1476, 0.2776}, + 0.2615, 1.0243, 26.1476, 0.2776}, { 3.6322, 5.27756, 3.51057, 14.7353, 1.26064, - 0.442258, 0.940706, 47.3437, 0.653396}, + 0.442258, 0.940706, 47.3437, 0.653396}, { 3.9553, 8.4042, 3.1125, 3.4262, 1.4546, - 0.2306, 1.1251, 21.7184, 0.3515}, + 0.2306, 1.1251, 21.7184, 0.3515}, { 4.7626, 3.285, 3.1736, 8.8422, 1.2674, - 0.3136, 1.1128, 129.424, 0.676}, + 0.3136, 1.1128, 129.424, 0.676}, { 3.2565, 2.6671, 3.9362, 6.1153, 1.3998, - 0.2001, 1.0032, 14.039, 0.404}, + 0.2001, 1.0032, 14.039, 0.404}, { 5.4204, 2.8275, 2.1735, 79.2611, 1.2269, - 0.3808, 2.3073, 7.1937, 0.8584}, + 0.3808, 2.3073, 7.1937, 0.8584}, { 3.4988, 2.1676, 3.8378, 4.7542, 1.3284, - 0.185, 0.8497, 10.1411, 0.4853}, + 0.185, 0.8497, 10.1411, 0.4853}, { 6.4202, 3.0387, 1.9002, 0.7426, 1.5936, - 31.5472, 1.9646, 85.0886, 1.1151}, + 31.5472, 1.9646, 85.0886, 1.1151}, { 4.17448, 1.93816, 3.3876, 4.14553, 1.20296, - 0.228753, 0.528137, 8.28524, 0.706786}, + 0.228753, 0.528137, 8.28524, 0.706786}, { 6.2915, 2.4386, 3.0353, 32.3337, 1.9891, - 0.6785, 1.541, 81.6937, 1.1407}, + 0.6785, 1.541, 81.6937, 1.1407}, { 5.66269, 2.6652, 3.07164, 38.6634, 2.62446, - 0.916946, 1.3932, 93.5458, 1.24707}, + 0.916946, 1.3932, 93.5458, 1.24707}, { 4.43918, 1.64167, 3.20345, 3.43757, 1.19453, - 0.2149, 0.41653, 6.65365, 0.746297}, + 0.2149, 0.41653, 6.65365, 0.746297}, { 6.4345, 1.9067, 4.1791, 27.157, 1.78, - 0.526, 1.4908, 68.1645, 1.1149}, + 0.526, 1.4908, 68.1645, 1.1149}, { 6.9053, 1.4679, 5.2034, 22.2151, 1.4379, - 0.2536, 1.5863, 56.172, 0.8669}, + 0.2536, 1.5863, 56.172, 0.8669}, { 11.4604, 0.0104, 7.1964, 1.1662, 6.2556, - 18.5194, 1.6455, 47.7784, -9.5574}, + 18.5194, 1.6455, 47.7784, -9.5574}, { 18.2915, 0.0066, 7.2084, 1.1717, 6.5337, - 19.5424, 2.3386, 60.4486, -16.378}, + 19.5424, 2.3386, 60.4486, -16.378}, { 7.4845, 0.9072, 6.7723, 14.8407, 0.6539, - 43.8983, 1.6442, 33.3929, 1.4445}, + 43.8983, 1.6442, 33.3929, 1.4445}, { 8.2186, 12.7949, 7.4398, 0.7748, 1.0519, - 213.187, 0.8659, 41.6841, 1.4228}, + 213.187, 0.8659, 41.6841, 1.4228}, { 8.6266, 10.4421, 7.3873, 0.6599, 1.5899, - 85.7484, 1.0211, 178.437, 1.3751}, + 85.7484, 1.0211, 178.437, 1.3751}, { 15.6348, -0.0074, 7.9518, 0.6089, 8.4372, - 10.3116, 0.8537, 25.9905, -14.875}, + 10.3116, 0.8537, 25.9905, -14.875}, { 9.189, 9.0213, 7.3679, 0.5729, 1.6409, - 136.108, 1.468, 51.3531, 1.3329}, + 136.108, 1.468, 51.3531, 1.3329}, { 13.4008, 0.29854, 8.0273, 7.9629, 1.65943, - -0.28604, 1.57936, 16.0662, -6.6667}, + -0.28604, 1.57936, 16.0662, -6.6667}, { 9.7595, 7.8508, 7.3558, 0.5, 1.6991, - 35.6338, 1.9021, 116.105, 1.2807}, + 35.6338, 1.9021, 116.105, 1.2807}, { 9.11423, 7.5243, 7.62174, 0.457585, 2.2793, - 19.5361, 0.087899, 61.6558, 0.897155}, + 19.5361, 0.087899, 61.6558, 0.897155}, { 17.7344, 0.22061, 8.73816, 7.04716, 5.25691, - -0.15762, 1.92134, 15.9768, -14.652}, + -0.15762, 1.92134, 15.9768, -14.652}, { 19.5114, 0.178847, 8.23473, 6.67018, 2.01341, - -0.29263, 1.5208, 12.9464, -13.28}, + -0.29263, 1.5208, 12.9464, -13.28}, { 10.2971, 6.8657, 7.3511, 0.4385, 2.0703, - 26.8938, 2.0571, 102.478, 1.2199}, + 26.8938, 2.0571, 102.478, 1.2199}, { 10.106, 6.8818, 7.3541, 0.4409, 2.2884, - 20.3004, 0.0223, 115.122, 1.2298}, + 20.3004, 0.0223, 115.122, 1.2298}, { 9.43141, 6.39535, 7.7419, 0.383349, 2.15343, - 15.1908, 0.016865, 63.969, 0.656565}, + 15.1908, 0.016865, 63.969, 0.656565}, { 15.6887, 0.679003, 8.14208, 5.40135, 2.03081, - 9.97278, -9.576, 0.940464, 1.7143}, + 9.97278, -9.576, 0.940464, 1.7143}, { 10.6406, 6.1038, 7.3537, 0.392, 3.324, - 20.2626, 1.4922, 98.7399, 1.1832}, + 20.2626, 1.4922, 98.7399, 1.1832}, { 9.54034, 5.66078, 7.7509, 0.344261, 3.58274, - 13.3075, 0.509107, 32.4224, 0.616898}, + 13.3075, 0.509107, 32.4224, 0.616898}, { 9.6809, 5.59463, 7.81136, 0.334393, 2.87603, - 12.8288, 0.113575, 32.8761, 0.518275}, + 12.8288, 0.113575, 32.8761, 0.518275}, { 11.2819, 5.3409, 7.3573, 0.3432, 3.0193, - 17.8674, 2.2441, 83.7543, 1.0896}, + 17.8674, 2.2441, 83.7543, 1.0896}, { 10.8061, 5.2796, 7.362, 0.3435, 3.5268, - 14.343, 0.2184, 41.3235, 1.0874}, + 14.343, 0.2184, 41.3235, 1.0874}, { 9.84521, 4.91797, 7.87194, 0.294393, 3.56531, - 10.8171, 0.323613, 24.1281, 0.393974}, + 10.8171, 0.323613, 24.1281, 0.393974}, { 9.96253, 4.8485, 7.97057, 0.283303, 2.76067, - 10.4852, 0.054447, 27.573, 0.251877}, + 10.4852, 0.054447, 27.573, 0.251877}, { 11.7695, 4.7611, 7.3573, 0.3072, 3.5222, - 15.3535, 2.3045, 76.8805, 1.0369}, + 15.3535, 2.3045, 76.8805, 1.0369}, { 11.0424, 4.6538, 7.374, 0.3053, 4.1346, - 12.0546, 0.4399, 31.2809, 1.0097}, + 12.0546, 0.4399, 31.2809, 1.0097}, { 11.1764, 4.6147, 7.3863, 0.3005, 3.3948, - 11.6729, 0.0724, 38.5566, 0.9707}, + 11.6729, 0.0724, 38.5566, 0.9707}, { 12.2841, 4.2791, 7.3409, 0.2784, 4.0034, - 13.5359, 2.3488, 71.1692, 1.0118}, + 13.5359, 2.3488, 71.1692, 1.0118}, { 11.2296, 4.1231, 7.3883, 0.2726, 4.7393, - 10.2443, 0.7108, 25.6466, 0.9324}, + 10.2443, 0.7108, 25.6466, 0.9324}, { 10.338, 3.90969, 7.88173, 0.238668, 4.76795, - 8.35583, 0.725591, 18.3491, 0.286667}, + 8.35583, 0.725591, 18.3491, 0.286667}, { 12.8376, 3.8785, 7.292, 0.2565, 4.4438, - 12.1763, 2.38, 66.3421, 1.0341}, + 12.1763, 2.38, 66.3421, 1.0341}, { 11.4166, 3.6766, 7.4005, 0.2449, 5.3442, - 8.873, 0.9773, 22.1626, 0.8614}, + 8.873, 0.9773, 22.1626, 0.8614}, { 10.7806, 3.5477, 7.75868, 0.22314, 5.22746, - 7.64468, 0.847114, 16.9673, 0.386044}, + 7.64468, 0.847114, 16.9673, 0.386044}, { 13.338, 3.5828, 7.1676, 0.247, 5.6158, - 11.3966, 1.6735, 64.8126, 1.191}, + 11.3966, 1.6735, 64.8126, 1.191}, { 11.9475, 3.3669, 7.3573, 0.2274, 6.2455, - 8.6625, 1.5578, 25.8487, 0.89}, + 8.6625, 1.5578, 25.8487, 0.89}, { 11.8168, 3.37484, 7.11181, 0.244078, 5.78135, - 7.9876, 1.14523, 19.897, 1.14431}, + 7.9876, 1.14523, 19.897, 1.14431}, { 14.0743, 3.2655, 7.0318, 0.2333, 5.1652, - 10.3163, 2.41, 58.7097, 1.3041}, + 10.3163, 2.41, 58.7097, 1.3041}, { 11.9719, 2.9946, 7.3862, 0.2031, 6.4668, - 7.0826, 1.394, 18.0995, 0.7807}, + 7.0826, 1.394, 18.0995, 0.7807}, { 15.2354, 3.0669, 6.7006, 0.2412, 4.3591, - 10.7805, 2.9623, 61.4135, 1.7189}, + 10.7805, 2.9623, 61.4135, 1.7189}, { 12.692, 2.81262, 6.69883, 0.22789, 6.06692, - 6.36441, 1.0066, 14.4122, 1.53545}, + 6.36441, 1.0066, 14.4122, 1.53545}, { 16.0816, 2.8509, 6.3747, 0.2516, 3.7068, - 11.4468, 3.683, 54.7625, 2.1313}, + 11.4468, 3.683, 54.7625, 2.1313}, { 12.9172, 2.53718, 6.70003, 0.205855, 6.06791, - 5.47913, 0.859041, 11.603, 1.45572}, + 5.47913, 0.859041, 11.603, 1.45572}, { 16.6723, 2.6345, 6.0701, 0.2647, 3.4313, - 12.9479, 4.2779, 47.7972, 2.531}, + 12.9479, 4.2779, 47.7972, 2.531}, { 17.0006, 2.4098, 5.8196, 0.2726, 3.9731, - 15.2372, 4.3543, 43.8163, 2.8409}, + 15.2372, 4.3543, 43.8163, 2.8409}, { 17.1789, 2.1723, 5.2358, 16.5796, 5.6377, - 0.2609, 3.9851, 41.4328, 2.9557}, + 0.2609, 3.9851, 41.4328, 2.9557}, { 17.1718, 2.2059, 6.3338, 19.3345, 5.5754, - 0.2871, 3.7272, 58.1535, 3.1776}, + 0.2871, 3.7272, 58.1535, 3.1776}, { 17.3555, 1.9384, 6.7286, 16.5623, 5.5493, - 0.2261, 3.5375, 39.3972, 2.825}, + 0.2261, 3.5375, 39.3972, 2.825}, { 17.1784, 1.7888, 9.6435, 17.3151, 5.1399, - 0.2748, 1.5292, 164.934, 3.4873}, + 0.2748, 1.5292, 164.934, 3.4873}, { 17.5816, 1.7139, 7.6598, 14.7957, 5.8981, - 0.1603, 2.7817, 31.2087, 2.0782}, + 0.1603, 2.7817, 31.2087, 2.0782}, { 17.5663, 1.5564, 9.8184, 14.0988, 5.422, - 0.1664, 2.6694, 132.376, 2.5064}, + 0.1664, 2.6694, 132.376, 2.5064}, { 18.0874, 1.4907, 8.1373, 12.6963, 2.5654, - -24.5651, 34.193, -0.0138, 41.4025}, + -24.5651, 34.193, -0.0138, 41.4025}, { 17.776, 1.4029, 10.2946, 12.8006, 5.72629, - 0.125599, 3.26588, 104.354, 1.91213}, + 0.125599, 3.26588, 104.354, 1.91213}, { 17.9268, 1.35417, 9.1531, 11.2145, 1.76795, - -22.6599, 33.108, -0.01319, 40.2602}, + -22.6599, 33.108, -0.01319, 40.2602}, { 17.8765, 1.27618, 10.948, 11.916, 5.41732, - 0.117622, 3.65721, 87.6627, 2.06929}, + 0.117622, 3.65721, 87.6627, 2.06929}, { 18.1668, 1.2148, 10.0562, 10.1483, 1.01118, - 21.6054, -2.6479, -0.10276, 9.41454}, + 21.6054, -2.6479, -0.10276, 9.41454}, { 17.6142, 1.18865, 12.0144, 11.766, 4.04183, - 0.204785, 3.53346, 69.7957, 3.75591}, + 0.204785, 3.53346, 69.7957, 3.75591}, { 19.8812, 0.019175, 18.0653, 1.13305, 11.0177, - 10.1621, 1.94715, 28.3389, -12.912}, + 10.1621, 1.94715, 28.3389, -12.912}, { 17.9163, 1.12446, 13.3417, 0.028781, 10.799, - 9.28206, 0.337905, 25.7228, -6.3934}, + 9.28206, 0.337905, 25.7228, -6.3934}, { 3.7025, 0.2772, 17.2356, 1.0958, 12.8876, - 11.004, 3.7429, 61.6584, 4.3875}, + 11.004, 3.7429, 61.6584, 4.3875}, { 21.1664, 0.014734, 18.2017, 1.03031, 11.7423, - 9.53659, 2.30951, 26.6307, -14.421}, + 9.53659, 2.30951, 26.6307, -14.421}, { 21.0149, 0.014345, 18.0992, 1.02238, 11.4632, - 8.78809, 0.740625, 23.3452, -14.316}, + 8.78809, 0.740625, 23.3452, -14.316}, { 17.8871, 1.03649, 11.175, 8.48061, 6.57891, - 0.058881, 0, 0, 0.344941}, + 0.058881, 0, 0, 0.344941}, { 19.1301, 0.864132, 11.0948, 8.14487, 4.64901, - 21.5707, 2.71263, 86.8472, 5.40428}, + 21.5707, 2.71263, 86.8472, 5.40428}, { 19.2674, 0.80852, 12.9182, 8.43467, 4.86337, - 24.7997, 1.56756, 94.2928, 5.37814}, + 24.7997, 1.56756, 94.2928, 5.37814}, { 18.5638, 0.847329, 13.2885, 8.37164, 9.32602, - 0.017662, 3.00964, 22.887, -3.1892}, + 0.017662, 3.00964, 22.887, -3.1892}, { 18.5003, 0.844582, 13.1787, 8.12534, 4.71304, - 0.36495, 2.18535, 20.8504, 1.42357}, + 0.36495, 2.18535, 20.8504, 1.42357}, { 19.2957, 0.751536, 14.3501, 8.21758, 4.73425, - 25.8749, 1.28918, 98.6062, 5.328}, + 25.8749, 1.28918, 98.6062, 5.328}, { 18.8785, 0.764252, 14.1259, 7.84438, 3.32515, - 21.2487, -6.1989, -0.01036, 11.8678}, + 21.2487, -6.1989, -0.01036, 11.8678}, { 18.8545, 0.760825, 13.9806, 7.62436, 2.53464, - 19.3317, -5.6526, -0.0102, 11.2835}, + 19.3317, -5.6526, -0.0102, 11.2835}, { 19.3319, 0.698655, 15.5017, 7.98929, 5.29537, - 25.2052, 0.605844, 76.8986, 5.26593}, + 25.2052, 0.605844, 76.8986, 5.26593}, { 19.1701, 0.696219, 15.2096, 7.55573, 4.32234, - 22.5057, 0, 0, 5.2916}, + 22.5057, 0, 0, 5.2916}, { 19.2493, 0.683839, 14.79, 7.14833, 2.89289, - 17.9144, -7.9492, 0.005127, 13.0174}, + 17.9144, -7.9492, 0.005127, 13.0174}, { 19.2808, 0.6446, 16.6885, 7.4726, 4.8045, - 24.6605, 1.0463, 99.8156, 5.179}, + 24.6605, 1.0463, 99.8156, 5.179}, { 19.1812, 0.646179, 15.9719, 7.19123, 5.27475, - 21.7326, 0.357534, 66.1147, 5.21572}, + 21.7326, 0.357534, 66.1147, 5.21572}, { 19.1643, 0.645643, 16.2456, 7.18544, 4.3709, - 21.4072, 0, 0, 5.21404}, + 21.4072, 0, 0, 5.21404}, { 19.2214, 0.5946, 17.6444, 6.9089, 4.461, - 24.7008, 1.6029, 87.4825, 5.0694}, + 24.7008, 1.6029, 87.4825, 5.0694}, { 19.1514, 0.597922, 17.2535, 6.80639, 4.47128, - 20.2521, 0, 0, 5.11937}, + 20.2521, 0, 0, 5.11937}, { 19.1624, 0.5476, 18.5596, 6.3776, 4.2948, - 25.8499, 2.0396, 92.8029, 4.9391}, + 25.8499, 2.0396, 92.8029, 4.9391}, { 19.1045, 0.551522, 18.1108, 6.3247, 3.78897, - 17.3595, 0, 0, 4.99635}, + 17.3595, 0, 0, 4.99635}, { 19.1889, 5.8303, 19.1005, 0.5031, 4.4585, - 26.8909, 2.4663, 83.9571, 4.7821}, + 26.8909, 2.4663, 83.9571, 4.7821}, { 19.1094, 0.5036, 19.0548, 5.8378, 4.5648, - 23.3752, 0.487, 62.2061, 4.7861}, + 23.3752, 0.487, 62.2061, 4.7861}, { 18.9333, 5.764, 19.7131, 0.4655, 3.4182, - 14.0049, 0.0193, -0.7583, 3.9182}, + 14.0049, 0.0193, -0.7583, 3.9182}, { 19.6418, 5.3034, 19.0455, 0.4607, 5.0371, - 27.9074, 2.6827, 75.2825, 4.5909}, + 27.9074, 2.6827, 75.2825, 4.5909}, { 18.9755, 0.467196, 18.933, 5.22126, 5.10789, - 19.5902, 0.288753, 55.5113, 4.69626}, + 19.5902, 0.288753, 55.5113, 4.69626}, { 19.8685, 5.44853, 19.0302, 0.467973, 2.41253, - 14.1259, 0, 0, 4.69263}, + 14.1259, 0, 0, 4.69263}, { 19.9644, 4.81742, 19.0138, 0.420885, 6.14487, - 28.5284, 2.5239, 70.8403, 4.352}, + 28.5284, 2.5239, 70.8403, 4.352}, { 20.1472, 4.347, 18.9949, 0.3814, 7.5138, - 27.766, 2.2735, 66.8776, 4.0712}, + 27.766, 2.2735, 66.8776, 4.0712}, { 20.2332, 4.3579, 18.997, 0.3815, 7.8069, - 29.5259, 2.8868, 84.9304, 4.0714}, + 29.5259, 2.8868, 84.9304, 4.0714}, { 20.2933, 3.9282, 19.0298, 0.344, 8.9767, - 26.4659, 1.99, 64.2658, 3.7118}, + 26.4659, 1.99, 64.2658, 3.7118}, { 20.3892, 3.569, 19.1062, 0.3107, 10.662, - 24.3879, 1.4953, 213.904, 3.3352}, + 24.3879, 1.4953, 213.904, 3.3352}, { 20.3524, 3.552, 19.1278, 0.3086, 10.2821, - 23.7128, 0.9615, 59.4565, 3.2791}, + 23.7128, 0.9615, 59.4565, 3.2791}, { 20.3361, 3.216, 19.297, 0.2756, 10.888, - 20.2073, 2.6959, 167.202, 2.7731}, + 20.2073, 2.6959, 167.202, 2.7731}, { 20.1807, 3.21367, 19.1136, 0.28331, 10.9054, - 20.0558, 0.77634, 51.746, 3.02902}, + 20.0558, 0.77634, 51.746, 3.02902}, { 20.578, 2.94817, 19.599, 0.244475, 11.3727, - 18.7726, 3.28719, 133.124, 2.14678}, + 18.7726, 3.28719, 133.124, 2.14678}, { 20.2489, 2.9207, 19.3763, 0.250698, 11.6323, - 17.8211, 0.336048, 54.9453, 2.4086}, + 17.8211, 0.336048, 54.9453, 2.4086}, { 21.1671, 2.81219, 19.7695, 0.226836, 11.8513, - 17.6083, 3.33049, 127.113, 1.86264}, + 17.6083, 3.33049, 127.113, 1.86264}, { 20.8036, 2.77691, 19.559, 0.23154, 11.9369, - 16.5408, 0.612376, 43.1692, 2.09013}, + 16.5408, 0.612376, 43.1692, 2.09013}, { 20.3235, 2.65941, 19.8186, 0.21885, 12.1233, - 15.7992, 0.144583, 62.2355, 1.5918}, + 15.7992, 0.144583, 62.2355, 1.5918}, { 22.044, 2.77393, 19.6697, 0.222087, 12.3856, - 16.7669, 2.82428, 143.644, 2.0583}, + 16.7669, 2.82428, 143.644, 2.0583}, { 21.3727, 2.6452, 19.7491, 0.214299, 12.1329, - 15.323, 0.97518, 36.4065, 1.77132}, + 15.323, 0.97518, 36.4065, 1.77132}, { 20.9413, 2.54467, 20.0539, 0.202481, 12.4668, - 14.8137, 0.296689, 45.4643, 1.24285}, + 14.8137, 0.296689, 45.4643, 1.24285}, { 22.6845, 2.66248, 19.6847, 0.210628, 12.774, - 15.885, 2.85137, 137.903, 1.98486}, + 15.885, 2.85137, 137.903, 1.98486}, { 21.961, 2.52722, 19.9339, 0.199237, 12.12, - 14.1783, 1.51031, 30.8717, 1.47588}, + 14.1783, 1.51031, 30.8717, 1.47588}, { 23.3405, 2.5627, 19.6095, 0.202088, 13.1235, - 15.1009, 2.87516, 132.721, 2.02876}, + 15.1009, 2.87516, 132.721, 2.02876}, { 22.5527, 2.4174, 20.1108, 0.185769, 12.0671, - 13.1275, 2.07492, 27.4491, 1.19499}, + 13.1275, 2.07492, 27.4491, 1.19499}, { 24.0042, 2.47274, 19.4258, 0.196451, 13.4396, - 14.3996, 2.89604, 128.007, 2.20963}, + 14.3996, 2.89604, 128.007, 2.20963}, { 23.1504, 2.31641, 20.2599, 0.174081, 11.9202, - 12.1571, 2.71488, 24.8242, 0.954586}, + 12.1571, 2.71488, 24.8242, 0.954586}, { 24.6274, 2.3879, 19.0886, 0.1942, 13.7603, - 13.7546, 2.9227, 123.174, 2.5745}, + 13.7546, 2.9227, 123.174, 2.5745}, { 24.0063, 2.27783, 19.9504, 0.17353, 11.8034, - 11.6096, 3.87243, 26.5156, 1.36389}, + 11.6096, 3.87243, 26.5156, 1.36389}, { 23.7497, 2.22258, 20.3745, 0.16394, 11.8509, - 11.311, 3.26503, 22.9966, 0.759344}, + 11.311, 3.26503, 22.9966, 0.759344}, { 25.0709, 2.25341, 19.0798, 0.181951, 13.8518, - 12.9331, 3.54545, 101.398, 2.4196}, + 12.9331, 3.54545, 101.398, 2.4196}, { 24.3466, 2.13553, 20.4208, 0.155525, 11.8708, - 10.5782, 3.7149, 21.7029, 0.645089}, + 10.5782, 3.7149, 21.7029, 0.645089}, { 25.8976, 2.24256, 18.2185, 0.196143, 14.3167, - 12.6648, 2.95354, 115.362, 3.58324}, + 12.6648, 2.95354, 115.362, 3.58324}, { 24.9559, 2.05601, 20.3271, 0.149525, 12.2471, - 10.0499, 3.773, 21.2773, 0.691967}, + 10.0499, 3.773, 21.2773, 0.691967}, { 26.507, 2.1802, 17.6383, 0.202172, 14.5596, - 12.1899, 2.96577, 111.874, 4.29728}, + 12.1899, 2.96577, 111.874, 4.29728}, { 25.5395, 1.9804, 20.2861, 0.143384, 11.9812, - 9.34972, 4.50073, 19.581, 0.68969}, + 9.34972, 4.50073, 19.581, 0.68969}, { 26.9049, 2.07051, 17.294, 0.19794, 14.5583, - 11.4407, 3.63837, 92.6566, 4.56796}, + 11.4407, 3.63837, 92.6566, 4.56796}, { 26.1296, 1.91072, 20.0994, 0.139358, 11.9788, - 8.80018, 4.93676, 18.5908, 0.852795}, + 8.80018, 4.93676, 18.5908, 0.852795}, { 27.6563, 2.07356, 16.4285, 0.223545, 14.9779, - 11.3604, 2.98233, 105.703, 5.92046}, + 11.3604, 2.98233, 105.703, 5.92046}, { 26.722, 1.84659, 19.7748, 0.13729, 12.1506, - 8.36225, 5.17379, 17.8974, 1.17613}, + 8.36225, 5.17379, 17.8974, 1.17613}, { 28.1819, 2.02859, 15.8851, 0.238849, 15.1542, - 10.9975, 2.98706, 102.961, 1.63929}, + 10.9975, 2.98706, 102.961, 1.63929}, { 27.3083, 1.78711, 19.332, 0.136974, 12.3339, - 7.96778, 5.38348, 17.2922, 1.63929}, + 7.96778, 5.38348, 17.2922, 1.63929}, { 28.6641, 1.9889, 15.4345, 0.257119, 15.3087, - 10.6647, 2.98963, 100.417, 7.56672}, + 10.6647, 2.98963, 100.417, 7.56672}, { 28.1209, 1.78503, 17.6817, 0.15997, 13.3335, - 8.18304, 5.14657, 20.39, 3.70983}, + 8.18304, 5.14657, 20.39, 3.70983}, { 27.8917, 1.73272, 18.7614, 0.13879, 12.6072, - 7.64412, 5.47647, 16.8153, 2.26001}, + 7.64412, 5.47647, 16.8153, 2.26001}, { 28.9476, 1.90182, 15.2208, 9.98519, 15.1, - 0.261033, 3.71601, 84.3298, 7.97628}, + 0.261033, 3.71601, 84.3298, 7.97628}, { 28.4628, 1.68216, 18.121, 0.142292, 12.8429, - 7.33727, 5.59415, 16.3535, 2.97573}, + 7.33727, 5.59415, 16.3535, 2.97573}, { 29.144, 1.83262, 15.1726, 9.5999, 14.7586, - 0.275116, 4.30013, 72.029, 8.58154}, + 0.275116, 4.30013, 72.029, 8.58154}, { 28.8131, 1.59136, 18.4601, 0.128903, 12.7285, - 6.76232, 5.59927, 14.0366, 2.39699}, + 6.76232, 5.59927, 14.0366, 2.39699}, { 29.2024, 1.77333, 15.2293, 9.37046, 14.5135, - 0.295977, 4.76492, 63.3644, 9.24354}, + 0.295977, 4.76492, 63.3644, 9.24354}, { 29.1587, 1.50711, 18.8407, 0.116741, 12.8268, - 6.31524, 5.38695, 12.4244, 1.78555}, + 6.31524, 5.38695, 12.4244, 1.78555}, { 29.0818, 1.72029, 15.43, 9.2259, 14.4327, - 0.321703, 5.11982, 57.056, 9.8875}, + 0.321703, 5.11982, 57.056, 9.8875}, { 29.4936, 1.42755, 19.3763, 0.104621, 13.0544, - 5.93667, 5.06412, 11.1972, 1.01074}, + 5.93667, 5.06412, 11.1972, 1.01074}, { 28.7621, 1.67191, 15.7189, 9.09227, 14.5564, - 0.3505, 5.44174, 52.0861, 10.472}, + 0.3505, 5.44174, 52.0861, 10.472}, { 28.1894, 1.62903, 16.155, 8.97948, 14.9305, - 0.382661, 5.67589, 48.1647, 11.0005}, + 0.382661, 5.67589, 48.1647, 11.0005}, { 30.419, 1.37113, 15.2637, 6.84706, 14.7458, - 0.165191, 5.06795, 18.003, 6.49804}, + 0.165191, 5.06795, 18.003, 6.49804}, { 27.3049, 1.59279, 16.7296, 8.86553, 15.6115, - 0.417916, 5.83377, 45.0011, 11.4722}, + 0.417916, 5.83377, 45.0011, 11.4722}, { 30.4156, 1.34323, 15.862, 7.10909, 13.6145, - 0.204633, 5.82008, 20.3254, 8.27903}, + 0.204633, 5.82008, 20.3254, 8.27903}, { 30.7058, 1.30923, 15.5512, 6.71983, 14.2326, - 0.167252, 5.53672, 17.4911, 6.96824}, + 0.167252, 5.53672, 17.4911, 6.96824}, { 27.0059, 1.51293, 17.7639, 8.81174, 15.7131, - 0.424593, 5.7837, 38.6103, 11.6883}, + 0.424593, 5.7837, 38.6103, 11.6883}, { 29.8429, 1.32927, 16.7224, 7.38979, 13.2153, - 0.263297, 6.35234, 22.9426, 9.85329}, + 0.263297, 6.35234, 22.9426, 9.85329}, { 30.9612, 1.24813, 15.9829, 6.60834, 13.7348, - 0.16864, 5.92034, 16.9392, 7.39534}, + 0.16864, 5.92034, 16.9392, 7.39534}, { 16.8819, 0.4611, 18.5913, 8.6216, 25.5582, - 1.4826, 5.86, 36.3956, 12.0658}, + 1.4826, 5.86, 36.3956, 12.0658}, { 28.0109, 1.35321, 17.8204, 7.7395, 14.3359, - 0.356752, 6.58077, 26.4043, 11.2299}, + 0.356752, 6.58077, 26.4043, 11.2299}, { 30.6886, 1.2199, 16.9029, 6.82872, 12.7801, - 0.212867, 6.52354, 18.659, 9.0968}, + 0.212867, 6.52354, 18.659, 9.0968}, { 20.6809, 0.545, 19.0417, 8.4484, 21.6575, - 1.5729, 5.9676, 38.3246, 12.6089}, + 1.5729, 5.9676, 38.3246, 12.6089}, { 25.0853, 1.39507, 18.4973, 7.65105, 16.8883, - 0.443378, 6.48216, 28.2262, 12.0205}, + 0.443378, 6.48216, 28.2262, 12.0205}, { 29.5641, 1.21152, 18.06, 7.05639, 12.8374, - 0.284738, 6.89912, 20.7482, 10.6268}, + 0.284738, 6.89912, 20.7482, 10.6268}, { 27.5446, 0.65515, 19.1584, 8.70751, 15.538, - 1.96347, 5.52593, 45.8149, 13.1746}, + 1.96347, 5.52593, 45.8149, 13.1746}, { 21.3985, 1.4711, 20.4723, 0.517394, 18.7478, - 7.43463, 6.82847, 28.8482, 12.5258}, + 7.43463, 6.82847, 28.8482, 12.5258}, { 30.8695, 1.1008, 18.3481, 6.53852, 11.9328, - 0.219074, 7.00574, 17.2114, 9.8027}, + 0.219074, 7.00574, 17.2114, 9.8027}, { 31.0617, 0.6902, 13.0637, 2.3576, 18.442, - 8.618, 5.9696, 47.2579, 13.4118}, + 8.618, 5.9696, 47.2579, 13.4118}, { 21.7886, 1.3366, 19.5682, 0.488383, 19.1406, - 6.7727, 7.01107, 23.8132, 12.4734}, + 6.7727, 7.01107, 23.8132, 12.4734}, { 32.1244, 1.00566, 18.8003, 6.10926, 12.0175, - 0.147041, 6.96886, 14.714, 8.08428}, + 0.147041, 6.96886, 14.714, 8.08428}, { 33.3689, 0.704, 12.951, 2.9238, 16.5877, - 8.7937, 6.4692, 48.0093, 13.5782}, + 8.7937, 6.4692, 48.0093, 13.5782}, { 21.8053, 1.2356, 19.5026, 6.24149, 19.1053, - 0.469999, 7.10295, 20.3185, 12.4711}, + 0.469999, 7.10295, 20.3185, 12.4711}, { 33.5364, 0.91654, 25.0946, 0.39042, 19.2497, - 5.71414, 6.91555, 12.8285, 6.7994}, + 5.71414, 6.91555, 12.8285, 6.7994}, { 34.6726, 0.700999, 15.4733, 3.55078, 13.1138, - 9.55642, 7.02588, 47.0045, 13.677}, + 9.55642, 7.02588, 47.0045, 13.677}, { 35.3163, 0.68587, 19.0211, 3.97458, 9.49887, - 11.3824, 7.42518, 45.4715, 13.7108}, + 11.3824, 7.42518, 45.4715, 13.7108}, { 35.5631, 0.6631, 21.2816, 4.0691, 8.0037, - 14.0422, 7.4433, 44.2473, 13.6905}, + 14.0422, 7.4433, 44.2473, 13.6905}, { 35.9299, 0.646453, 23.0547, 4.17619, 12.1439, - 23.1052, 2.11253, 150.645, 13.7247}, + 23.1052, 2.11253, 150.645, 13.7247}, { 35.763, 0.616341, 22.9064, 3.87135, 12.4739, - 19.9887, 3.21097, 142.325, 13.6211}, + 19.9887, 3.21097, 142.325, 13.6211}, { 35.215, 0.604909, 21.67, 3.5767, 7.91342, - 12.601, 7.65078, 29.8436, 13.5431}, + 12.601, 7.65078, 29.8436, 13.5431}, { 35.6597, 0.589092, 23.1032, 3.65155, 12.5977, - 18.599, 4.08655, 117.02, 13.5266}, + 18.599, 4.08655, 117.02, 13.5266}, { 35.1736, 0.579689, 22.1112, 3.41437, 8.19216, - 12.9187, 7.05545, 25.9443, 13.4637}, + 12.9187, 7.05545, 25.9443, 13.4637}, { 35.5645, 0.563359, 23.4219, 3.46204, 12.7473, - 17.8309, 4.80703, 99.1722, 13.4314}, + 17.8309, 4.80703, 99.1722, 13.4314}, { 35.1007, 0.555054, 22.4418, 3.24498, 9.78554, - 13.4661, 5.29444, 23.9533, 13.376}, + 13.4661, 5.29444, 23.9533, 13.376}, { 35.8847, 0.547751, 23.2948, 3.41519, 14.1891, - 16.9235, 4.17287, 105.251, 13.4287}, + 16.9235, 4.17287, 105.251, 13.4287}, { 36.0228, 0.5293, 23.4128, 3.3253, 14.9491, - 16.0927, 4.188, 100.613, 13.3966}, + 16.0927, 4.188, 100.613, 13.3966}, { 35.5747, 0.52048, 22.5259, 3.12293, 12.2165, - 12.7148, 5.37073, 26.3394, 13.3092}, + 12.7148, 5.37073, 26.3394, 13.3092}, { 35.3715, 0.516598, 22.5326, 3.05053, 12.0291, - 12.5723, 4.7984, 23.4582, 13.2671}, + 12.5723, 4.7984, 23.4582, 13.2671}, { 34.8509, 0.507079, 22.7584, 2.8903, 14.0099, - 13.1767, 1.21457, 25.2017, 13.1665}, + 13.1767, 1.21457, 25.2017, 13.1665}, { 36.1874, 0.511929, 23.5964, 3.25396, 15.6402, - 15.3622, 4.1855, 97.4908, 13.3573}, + 15.3622, 4.1855, 97.4908, 13.3573}, { 35.7074, 0.502322, 22.613, 3.03807, 12.9898, - 12.1449, 5.43227, 25.4928, 13.2544}, + 12.1449, 5.43227, 25.4928, 13.2544}, { 35.5103, 0.498626, 22.5787, 2.96627, 12.7766, - 11.9484, 4.92159, 22.7502, 13.2116}, + 11.9484, 4.92159, 22.7502, 13.2116}, { 35.0136, 0.48981, 22.7286, 2.81099, 14.3884, - 12.33, 1.75669, 22.6581, 13.113}, + 12.33, 1.75669, 22.6581, 13.113}, { 36.5254, 0.499384, 23.8083, 3.26371, 16.7707, - 14.9455, 3.47947, 105.98, 13.3812}, + 14.9455, 3.47947, 105.98, 13.3812}, { 35.84, 0.484938, 22.7169, 2.96118, 13.5807, - 11.5331, 5.66016, 24.3992, 13.1991}, + 11.5331, 5.66016, 24.3992, 13.1991}, { 35.6493, 0.481422, 22.646, 2.8902, 13.3595, - 11.316, 5.18831, 21.8301, 13.1555}, + 11.316, 5.18831, 21.8301, 13.1555}, { 35.1736, 0.473204, 22.7181, 2.73848, 14.7635, - 11.553, 2.28678, 20.9303, 13.0582}, + 11.553, 2.28678, 20.9303, 13.0582}, { 36.6706, 0.483629, 24.0992, 3.20647, 17.3415, - 14.3136, 3.49331, 102.273, 13.3592}, + 14.3136, 3.49331, 102.273, 13.3592}, { 36.6488, 0.465154, 24.4096, 3.08997, 17.399, - 13.4346, 4.21665, 88.4834, 13.2887}, + 13.4346, 4.21665, 88.4834, 13.2887}, { 36.7881, 0.451018, 24.7736, 3.04619, 17.8919, - 12.8946, 4.23284, 86.003, 13.2754}, + 12.8946, 4.23284, 86.003, 13.2754}, { 36.9185, 0.437533, 25.1995, 3.00775, 18.3317, - 12.4044, 4.24391, 83.7881, 13.2674}, + 12.4044, 4.24391, 83.7881, 13.2674}, }; #endif diff --git a/src/USER-DIFFRACTION/fix_saed_vtk.cpp b/src/USER-DIFFRACTION/fix_saed_vtk.cpp index 984c4a87e5725d4d90c2397e36068832d06e79a5..30ecc900e87183d8348adde056a334f861f9e598 100644 --- a/src/USER-DIFFRACTION/fix_saed_vtk.cpp +++ b/src/USER-DIFFRACTION/fix_saed_vtk.cpp @@ -16,8 +16,8 @@ Incorporating SAED: Shawn Coleman (Arkansas) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_saed_vtk.h" #include "update.h" #include "modify.h" @@ -29,7 +29,7 @@ #include "memory.h" #include "error.h" #include "force.h" -#include "math.h" +#include <math.h> #include "domain.h" using namespace LAMMPS_NS; @@ -67,7 +67,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : if (nvalues != 1) error->all(FLERR,"Illegal fix saed/vtk command"); options(narg,arg); - + which = 0; ids = NULL; @@ -90,9 +90,9 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : delete [] suffix; int icompute = modify->find_compute(ids); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Compute ID for fix saed/vtk does not exist"); - + Compute *compute = modify->compute[icompute]; // Check that specified compute is for SAED @@ -118,9 +118,9 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : // Standard error check for fix/ave/time if (compute->vector_flag == 0) error->all(FLERR,"Fix saed/vtk compute does not calculate a vector"); - if (compute->extvector != 0) - error->all(FLERR,"Illegal fix saed/vtk command"); - + if (compute->extvector != 0) + error->all(FLERR,"Illegal fix saed/vtk command"); + nrows = compute->size_vector; nvalues++; iarg++; @@ -154,7 +154,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : size_vector = nrows; if (nOutput == 0) { - + // SAED specific paramaters needed int *periodicity = domain->periodicity; // Zone flag to capture entire recrocal space volume @@ -184,7 +184,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : prd_inv[2] = 1 / prd[2]; ave_inv += prd_inv[2]; } - + // Using the average inverse dimensions for non-periodic direction ave_inv = ave_inv / (periodicity[0] + periodicity[1] + periodicity[2]); if (!periodicity[0]){ @@ -197,12 +197,12 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : prd_inv[2] = ave_inv; } - // Use manual mapping of reciprocal lattice + // Use manual mapping of reciprocal lattice if (manual) { for (int i=0; i<3; i++) { prd_inv[i] = 1.0; } - } + } // Find integer dimensions of the reciprocal lattice box bounds if ( (Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0) ){ @@ -210,13 +210,13 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : dK[i] = prd_inv[i]*c[i]; Knmax[i] = ceil(Kmax / dK[i]); Knmin[i] = -Knmax[i]; - } + } } else { for (int i=0; i<3; i++) { Knmax[i] = -10000; Knmin[i] = 10000; - } + } double dinv2 = 0.0; double r = 0.0; double K[3]; @@ -224,8 +224,8 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : for (int i=0; i<3; i++) { dK[i] = prd_inv[i]*c[i]; Ksearch[i] = ceil(Kmax / dK[i]); - } - + } + for (int k = -Ksearch[2]; k <= Ksearch[2]; k++) { for (int j = -Ksearch[1]; j <= Ksearch[1]; j++) { for (int i = -Ksearch[0]; i <= Ksearch[0]; i++) { @@ -237,21 +237,21 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : r=0.0; for (int m=0; m<3; m++) r += pow(K[m] - Zone[m],2.0); - r = sqrt(r); + r = sqrt(r); if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) ) ){ - + if ( i < Knmin[0] ) Knmin[0] = i; if ( j < Knmin[1] ) Knmin[1] = j; - if ( k < Knmin[2] ) Knmin[2] = k; - + if ( k < Knmin[2] ) Knmin[2] = k; + if ( i > Knmax[0] ) Knmax[0] = i; if ( j > Knmax[1] ) Knmax[1] = j; - if ( k > Knmax[2] ) Knmax[2] = k; + if ( k > Knmax[2] ) Knmax[2] = k; } } - } + } } - } + } } // Finding dimensions for vtk files @@ -306,7 +306,7 @@ void FixSAEDVTK::init() { // set current indices for all computes,fixes,variables - + int icompute = modify->find_compute(ids); if (icompute < 0) error->all(FLERR,"Compute ID for fix saed/vtk does not exist"); @@ -347,7 +347,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) int icompute = modify->find_compute(ids); if (icompute < 0) error->all(FLERR,"Compute ID for fix saed/vtk does not exist"); - + if (irepeat == 0) for (int i = 0; i < nrows; i++) vector[i] = 0.0; @@ -367,7 +367,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) } double *vector = compute->vector; - + // done if irepeat < nrepeat // else reset irepeat and nvalid @@ -405,8 +405,8 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) vector_total[i] += vector[i]; if (window_limit) vector_total[i] -= vector_list[iwindow][i]; vector_list[iwindow][i] = vector[i]; - } - + } + iwindow++; if (iwindow == nwindow) { iwindow = 0; @@ -420,7 +420,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) if (fp && me == 0) { if (nOutput > 0) { - fclose(fp); + fclose(fp); char nName [128]; sprintf(nName,"%s.%d.vtk",filename,nOutput); @@ -443,9 +443,9 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) fprintf(fp,"POINT_DATA %d\n", Dim[0] * Dim[1] * Dim[2] ); fprintf(fp,"SCALARS intensity float\n"); fprintf(fp,"LOOKUP_TABLE default\n"); - + filepos = ftell(fp); - + if (overwrite) fseek(fp,filepos,SEEK_SET); // Finding the intersection of the reciprical space and Ewald sphere @@ -509,7 +509,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) } } } - nOutput++; + nOutput++; } /* ---------------------------------------------------------------------- @@ -543,7 +543,7 @@ void FixSAEDVTK::options(int narg, char **arg) if (strcmp(arg[iarg],"file") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix saed/vtk command"); if (me == 0) { - + nOutput = 0; int n = strlen(arg[iarg+1]) + 1; filename = new char[n]; @@ -557,7 +557,7 @@ void FixSAEDVTK::options(int narg, char **arg) char str[128]; sprintf(str,"Cannot open fix saed/vtk file %s",nName); error->one(FLERR,str); - } + } } iarg += 2; } else if (strcmp(arg[iarg],"ave") == 0) { diff --git a/src/USER-DIFFRACTION/fix_saed_vtk.h b/src/USER-DIFFRACTION/fix_saed_vtk.h index a421112688f9e47d7b2889856a83fc09af38713e..b8cee21c3534a1e1a0d23e6570e55e23f2affda8 100644 --- a/src/USER-DIFFRACTION/fix_saed_vtk.h +++ b/src/USER-DIFFRACTION/fix_saed_vtk.h @@ -20,7 +20,7 @@ FixStyle(saed/vtk,FixSAEDVTK) #ifndef LMP_FIX_SAED_VTK_H #define LMP_FIX_SAED_VTK_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { @@ -60,7 +60,7 @@ class FixSAEDVTK : public Fix { void options(int, char **); bigint nextvalid(); - + class ComputeSAED *compute_saed; double Zone[3]; // Zone axis to view SAED @@ -77,7 +77,7 @@ class FixSAEDVTK : public Fix { double prd_inv[3]; // Inverse spacing of unit cell char *filename; // user-specified file - int nOutput; + int nOutput; int Dim[3]; bool manual; // Turn on manual recpiprocal map diff --git a/src/USER-DRUDE/compute_temp_drude.cpp b/src/USER-DRUDE/compute_temp_drude.cpp index 97d264647d57d3ddb392987cdd1e602a4aa3ad16..99578e65e0d26edbdb8cada6a18024c4a8f5a6cb 100644 --- a/src/USER-DRUDE/compute_temp_drude.cpp +++ b/src/USER-DRUDE/compute_temp_drude.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "compute_temp_drude.h" #include "atom.h" #include "update.h" @@ -67,9 +67,9 @@ void ComputeTempDrude::init() int ifix; for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; - if (ifix == modify->nfix) error->all(FLERR, "compute temp/drude requires fix drude"); + if (ifix == modify->nfix) error->all(FLERR, "compute temp/drude requires fix drude"); fix_drude = (FixDrude *) modify->fix[ifix]; - + if (!comm->ghost_velocity) error->all(FLERR,"compute temp/drude requires ghost velocities. Use comm_modify vel yes"); } @@ -143,7 +143,7 @@ int ComputeTempDrude::modify_param(int narg, char **arg) void ComputeTempDrude::compute_vector() { invoked_vector = update->ntimestep; - + int nlocal = atom->nlocal; int *mask = atom->mask; int *type = atom->type; @@ -159,12 +159,12 @@ void ComputeTempDrude::compute_vector() double *vcore, *vdrude; double kineng_core_loc = 0., kineng_drude_loc = 0.; for (int i=0; i<nlocal; i++){ - if (groupbit & mask[i] && drudetype[type[i]] != DRUDE_TYPE){ + if (groupbit & mask[i] && drudetype[type[i]] != DRUDE_TYPE){ if (drudetype[type[i]] == NOPOL_TYPE) { ecore = 0.; vcore = v[i]; if (temperature) temperature->remove_bias(i, vcore); - for (int k=0; k<dim; k++) ecore += vcore[k]*vcore[k]; + for (int k=0; k<dim; k++) ecore += vcore[k]*vcore[k]; if (temperature) temperature->restore_bias(i, vcore); if (rmass) mcore = rmass[i]; else mcore = mass[type[i]]; @@ -202,7 +202,7 @@ void ComputeTempDrude::compute_vector() } } } - + if (dynamic) dof_compute(); kineng_core_loc *= 0.5 * mvv2e; kineng_drude_loc *= 0.5 * mvv2e; diff --git a/src/USER-DRUDE/fix_drude.cpp b/src/USER-DRUDE/fix_drude.cpp index 46b49707dfd1f0475a9cf4931fc7e555c5293937..7f37b89effdf11397af93d31b76c3754148c5c5a 100644 --- a/src/USER-DRUDE/fix_drude.cpp +++ b/src/USER-DRUDE/fix_drude.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_drude.h" #include "atom.h" #include "comm.h" @@ -51,7 +51,7 @@ FixDrude::FixDrude(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix drude command"); } - drudeid = NULL; + drudeid = NULL; grow_arrays(atom->nmax); atom->add_callback(0); atom->add_callback(1); @@ -107,7 +107,7 @@ void FixDrude::build_drudeid(){ std::vector<tagint> drude_vec; // list of my Drudes' tags std::vector<tagint> core_drude_vec; partner_set = new std::set<tagint>[nlocal]; // Temporary sets of bond partner tags - + sptr = this; // Build list of my atoms' bond partners for (int i=0; i<nlocal; i++){ @@ -124,7 +124,7 @@ void FixDrude::build_drudeid(){ 4, ring_build_partner, NULL, 1); // Build the list of my Drudes' tags - // The only bond partners of a Drude particle is its core, + // The only bond partners of a Drude particle is its core, // so fill drudeid for my Drudes. for (int i=0; i<nlocal; i++){ if (drudetype[type[i]] == DRUDE_TYPE){ @@ -135,9 +135,9 @@ void FixDrude::build_drudeid(){ // At this point each of my Drudes knows its core. // Send my list of Drudes to other procs and myself // so that each core finds its Drude. - comm->ring(drude_vec.size(), sizeof(tagint), - (char *) drude_vec.data(), - 3, ring_search_drudeid, NULL, 1); + comm->ring(drude_vec.size(), sizeof(tagint), + (char *) drude_vec.data(), + 3, ring_search_drudeid, NULL, 1); delete [] partner_set; } @@ -159,7 +159,7 @@ void FixDrude::ring_search_drudeid(int size, char *cbuf){ tagint *last = first + size; std::set<tagint> drude_set(first, last); std::set<tagint>::iterator it; - + for (int i=0; i<nlocal; i++) { if (drudetype[type[i]] != CORE_TYPE || drudeid[i] > 0) continue; for (it = partner_set[i].begin(); it != partner_set[i].end(); it++) { // Drude-core are 1-2 neighbors @@ -286,14 +286,14 @@ void FixDrude::rebuild_special(){ int nspecmax, nspecmax_old, nspecmax_loc; nspecmax_loc = 0; for (int i=0; i<nlocal; i++) { - if (nspecmax_loc < nspecial[i][2]) nspecmax_loc = nspecial[i][2]; + if (nspecmax_loc < nspecial[i][2]) nspecmax_loc = nspecial[i][2]; } MPI_Allreduce(&nspecmax_loc, &nspecmax_old, 1, MPI_INT, MPI_MAX, world); if (comm->me == 0) { if (screen) fprintf(screen, "Old max number of 1-2 to 1-4 neighbors: %d\n", nspecmax_old); if (logfile) fprintf(logfile, "Old max number of 1-2 to 1-4 neighbors: %d\n", nspecmax_old); } - + // Build lists of drude and core-drude pairs std::vector<tagint> drude_vec, core_drude_vec, core_special_vec; for (int i=0; i<nlocal; i++) { @@ -306,17 +306,17 @@ void FixDrude::rebuild_special(){ } // Remove Drude particles from the special lists of each proc comm->ring(drude_vec.size(), sizeof(tagint), - (char *) drude_vec.data(), + (char *) drude_vec.data(), 9, ring_remove_drude, NULL, 1); // Add back Drude particles in the lists just after their core comm->ring(core_drude_vec.size(), sizeof(tagint), - (char *) core_drude_vec.data(), + (char *) core_drude_vec.data(), 10, ring_add_drude, NULL, 1); - + // Check size of special list nspecmax_loc = 0; for (int i=0; i<nlocal; i++) { - if (nspecmax_loc < nspecial[i][2]) nspecmax_loc = nspecial[i][2]; + if (nspecmax_loc < nspecial[i][2]) nspecmax_loc = nspecial[i][2]; } MPI_Allreduce(&nspecmax_loc, &nspecmax, 1, MPI_INT, MPI_MAX, world); if (comm->me == 0) { @@ -341,7 +341,7 @@ void FixDrude::rebuild_special(){ } // Copy core's list into their drude list comm->ring(core_special_vec.size(), sizeof(tagint), - (char *) core_special_vec.data(), + (char *) core_special_vec.data(), 11, ring_copy_drude, NULL, 1); } @@ -385,7 +385,7 @@ void FixDrude::ring_remove_drude(int size, char *cbuf){ * particle if they have one. ------------------------------------------------------------------------- */ void FixDrude::ring_add_drude(int size, char *cbuf){ - // Assume special array size is big enough + // Assume special array size is big enough // Add all particle just after their core in the special list Atom *atom = sptr->atom; int nlocal = atom->nlocal; @@ -394,7 +394,7 @@ void FixDrude::ring_add_drude(int size, char *cbuf){ int *type = atom->type; tagint *drudeid = sptr->drudeid; int *drudetype = sptr->drudetype; - + tagint *first = (tagint *) cbuf; tagint *last = first + size; std::map<tagint, tagint> core_drude_map; @@ -406,7 +406,7 @@ void FixDrude::ring_add_drude(int size, char *cbuf){ core_drude_map[core_tag] = *it; it++; } - + for (int i=0; i<nlocal; i++) { if (drudetype[type[i]] == DRUDE_TYPE) continue; if (core_drude_map.count(atom->tag[i]) > 0) { // I identify myself as a core, add my own drude @@ -449,11 +449,11 @@ void FixDrude::ring_copy_drude(int size, char *cbuf){ int *type = atom->type; tagint *drudeid = sptr->drudeid; int *drudetype = sptr->drudetype; - + tagint *first = (tagint *) cbuf; tagint *last = first + size; std::map<tagint, tagint*> core_special_map; - + tagint *it = first; while (it < last) { tagint core_tag = *it; @@ -462,7 +462,7 @@ void FixDrude::ring_copy_drude(int size, char *cbuf){ it += 2; it += (int) *it; } - + for (int i=0; i<nlocal; i++) { if (drudetype[type[i]] != DRUDE_TYPE) continue; if (core_special_map.count(drudeid[i]) > 0) { // My core is in this list, copy its special info @@ -482,8 +482,8 @@ void FixDrude::ring_copy_drude(int size, char *cbuf){ } } -/* ---------------------------------------------------------------------- - * Set drudeid when a new atom is created, +/* ---------------------------------------------------------------------- + * Set drudeid when a new atom is created, * special list must be up-to-date * ----------------------------------------------------------------------*/ void FixDrude::set_arrays(int i){ diff --git a/src/USER-DRUDE/fix_drude_transform.cpp b/src/USER-DRUDE/fix_drude_transform.cpp index 3edcdc01cae8f6ce67824cab99ed38232ee377b3..adbfd324df302a244189c7ea38495824d38ba4fc 100644 --- a/src/USER-DRUDE/fix_drude_transform.cpp +++ b/src/USER-DRUDE/fix_drude_transform.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /** Fix Drude Transform ******************************************************/ -#include "math.h" +#include <math.h> #include "fix_drude_transform.h" #include "atom.h" #include "domain.h" @@ -38,11 +38,11 @@ FixDrudeTransform<inverse>::FixDrudeTransform(LAMMPS *lmp, int narg, char **arg) /* ---------------------------------------------------------------------- */ template <bool inverse> -FixDrudeTransform<inverse>::~FixDrudeTransform() +FixDrudeTransform<inverse>::~FixDrudeTransform() { if (mcoeff) delete [] mcoeff; } - + /* ---------------------------------------------------------------------- */ template <bool inverse> void FixDrudeTransform<inverse>::init() @@ -50,7 +50,7 @@ void FixDrudeTransform<inverse>::init() int ifix; for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; - if (ifix == modify->nfix) error->all(FLERR, "fix drude/transform requires fix drude"); + if (ifix == modify->nfix) error->all(FLERR, "fix drude/transform requires fix drude"); fix_drude = (FixDrude *) modify->fix[ifix]; } @@ -73,7 +73,7 @@ void FixDrudeTransform<inverse>::setup(int) { double * rmass = atom->rmass, * mass = atom->mass; tagint * drudeid = fix_drude->drudeid; int * drudetype = fix_drude->drudetype; - + if (!rmass) { if (!mcoeff) mcoeff = new double[ntypes+1]; double mcoeff_loc[ntypes+1]; @@ -183,7 +183,7 @@ void FixDrudeTransform<inverse>::real_to_reduced() v[icore][k] += coeff * v[idrude][k]; f[icore][k] += f[idrude][k]; f[idrude][k] -= coeff * f[icore][k]; - } + } } } fix_drude->is_reduced = true; @@ -208,7 +208,7 @@ void FixDrudeTransform<inverse>::reduced_to_real() if (mask[i] & groupbit && drudetype[type[i]] != NOPOL_TYPE) { int j = (int) drudeid[i]; // local index of drude partner because drudeid is in reduced form if (drudetype[type[i]] == DRUDE_TYPE && j < nlocal) continue; - + if (drudetype[type[i]] == DRUDE_TYPE) { idrude = i; icore = j; @@ -241,7 +241,7 @@ void FixDrudeTransform<inverse>::reduced_to_real() v[idrude][k] += v[icore][k]; f[idrude][k] += coeff * f[icore][k]; f[icore][k] -= f[idrude][k]; - } + } } } for (int i=0; i<nlocal; i++) { diff --git a/src/USER-DRUDE/fix_langevin_drude.cpp b/src/USER-DRUDE/fix_langevin_drude.cpp index 041e7b79ae7ac83ab60d6d04fa70ea3d79f14dde..119328a1dd4d74a686807ec1392a8733c87222b1 100644 --- a/src/USER-DRUDE/fix_langevin_drude.cpp +++ b/src/USER-DRUDE/fix_langevin_drude.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_langevin_drude.h" #include "atom.h" #include "force.h" @@ -50,7 +50,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : size_vector = 6; comm_reverse = 3; //extscalar = 1; - + // core temperature tstr_core = NULL; if (strstr(arg[3],"v_") == arg[3]) { @@ -64,7 +64,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : tstyle_core = CONSTANT; } t_period_core = force->numeric(FLERR,arg[4]); - int seed_core = force->inumeric(FLERR,arg[5]); + int seed_core = force->inumeric(FLERR,arg[5]); // drude temperature tstr_drude = NULL; @@ -80,21 +80,21 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : } t_period_drude = force->numeric(FLERR,arg[7]); int seed_drude = force->inumeric(FLERR,arg[8]); - + // error checks if (t_period_core <= 0.0) error->all(FLERR,"Fix langevin/drude period must be > 0.0"); if (seed_core <= 0) error->all(FLERR,"Illegal langevin/drude seed"); if (t_period_drude <= 0.0) error->all(FLERR,"Fix langevin/drude period must be > 0.0"); - if (seed_drude <= 0) error->all(FLERR,"Illegal langevin/drude seed"); + if (seed_drude <= 0) error->all(FLERR,"Illegal langevin/drude seed"); random_core = new RanMars(lmp,seed_core); random_drude = new RanMars(lmp,seed_drude); - + int iarg = 9; zero = 0; - while (iarg < narg) { + while (iarg < narg) { if (strcmp(arg[iarg],"zero") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin/drude command"); if (strcmp(arg[iarg+1],"no") == 0) zero = 0; @@ -155,7 +155,7 @@ void FixLangevinDrude::init() int ifix; for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; - if (ifix == modify->nfix) error->all(FLERR, "fix langevin/drude requires fix drude"); + if (ifix == modify->nfix) error->all(FLERR, "fix langevin/drude requires fix drude"); fix_drude = (FixDrude *) modify->fix[ifix]; } @@ -171,7 +171,7 @@ void FixLangevinDrude::setup(int vflag) if (zero) { int *mask = atom->mask; int nlocal = atom->nlocal; - int *drudetype = fix_drude->drudetype; + int *drudetype = fix_drude->drudetype; int *type = atom->type; bigint ncore_loc = 0; for (int i=0; i<nlocal; i++) @@ -222,7 +222,7 @@ void FixLangevinDrude::post_force(int /*vflag*/) double *rmass = atom->rmass; double ftm2v = force->ftm2v, mvv2e = force->mvv2e; double kb = force->boltz, dt = update->dt; - + int *drudetype = fix_drude->drudetype; tagint *drudeid = fix_drude->drudeid; double vdrude[3], vcore[3]; // velocities in reduced representation @@ -230,7 +230,7 @@ void FixLangevinDrude::post_force(int /*vflag*/) double Ccore, Cdrude, Gcore, Gdrude; double fcoresum[3], fcoreloc[3]; int dim = domain->dimension; - + // Compute target core temperature if (tstyle_core == CONSTANT) t_target_core = t_start_core; // + delta * (t_stop-t_start_core); @@ -254,7 +254,7 @@ void FixLangevinDrude::post_force(int /*vflag*/) "negative drude temperature"); modify->addstep_compute(update->ntimestep + nevery); } - + // Clear ghost forces // They have already been communicated if needed for (int i = nlocal; i < nall; i++) { @@ -271,7 +271,7 @@ void FixLangevinDrude::post_force(int /*vflag*/) if (rmass) mi = rmass[i]; else - mi = mass[type[i]]; + mi = mass[type[i]]; Gcore = mi / t_period_core / ftm2v; Ccore = sqrt(2.0 * Gcore * kb * t_target_core / dt / ftm2v / mvv2e); if (temperature) temperature->remove_bias(i, v[i]); @@ -283,21 +283,21 @@ void FixLangevinDrude::post_force(int /*vflag*/) if (temperature) temperature->restore_bias(i, v[i]); } else { if (drudetype[type[i]] == DRUDE_TYPE) continue; // do with the core - + int j = atom->map(drudeid[i]); double mi, mj, mtot, mu; // i is core, j is drude if (rmass) { mi = rmass[i]; mj = rmass[j]; } else { - mi = mass[type[i]]; + mi = mass[type[i]]; mj = mass[type[j]]; - } + } mtot = mi + mj; mu = mi * mj / mtot; mi /= mtot; mj /= mtot; - + Gcore = mtot / t_period_core / ftm2v; Gdrude = mu / t_period_drude / ftm2v; Ccore = sqrt(2.0 * Gcore * kb * t_target_core / dt / ftm2v / mvv2e); @@ -309,14 +309,14 @@ void FixLangevinDrude::post_force(int /*vflag*/) } for (int k=0; k<dim; k++) { // TODO check whether a fix_modify temp can subtract a bias velocity - vcore[k] = mi * v[i][k] + mj * v[j][k]; + vcore[k] = mi * v[i][k] + mj * v[j][k]; vdrude[k] = v[j][k] - v[i][k]; - + fcore[k] = Ccore * random_core->gaussian() - Gcore * vcore[k]; fdrude[k] = Cdrude * random_drude->gaussian() - Gdrude * vdrude[k]; - + if (zero) fcoreloc[k] += fcore[k]; - + f[i][k] += mi * fcore[k] - fdrude[k]; f[j][k] += mj * fcore[k] + fdrude[k]; @@ -329,7 +329,7 @@ void FixLangevinDrude::post_force(int /*vflag*/) } } } - + if(zero) { // Remove the drift MPI_Allreduce(fcoreloc, fcoresum, dim, MPI_DOUBLE, MPI_SUM, world); for (int k=0; k<dim; k++) fcoresum[k] /= ncore; @@ -345,9 +345,9 @@ void FixLangevinDrude::post_force(int /*vflag*/) mi = rmass[i]; mj = rmass[j]; } else { - mi = mass[type[i]]; + mi = mass[type[i]]; mj = mass[type[j]]; - } + } mtot = mi + mj; mi /= mtot; mj /= mtot; diff --git a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp index d517eb7932ac7236ec7f7294d69aa56954066cef..ef3747e7b3fa9f48ea4a633172b9f146f5a251bf 100644 --- a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_thole_long.h" #include "atom.h" #include "comm.h" @@ -115,7 +115,7 @@ void PairLJCutTholeLong::compute(int eflag, int vflag) ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { i = ilist[ii]; @@ -133,7 +133,7 @@ void PairLJCutTholeLong::compute(int eflag, int vflag) di_closest = domain->closest_image(i, di); if (drudetype[type[i]] == CORE_TYPE) dqi = -q[di]; - else + else dqi = qi; } @@ -179,7 +179,7 @@ void PairLJCutTholeLong::compute(int eflag, int vflag) forcecoul -= (1.0-factor_coul)*prefactor; } } - + if (drudetype[type[i]] != NOPOL_TYPE && drudetype[type[j]] != NOPOL_TYPE){ if (j != di_closest){ @@ -242,7 +242,7 @@ void PairLJCutTholeLong::compute(int eflag, int vflag) } } } - + if (vflag_fdotr) virial_fdotr_compute(); } @@ -320,7 +320,7 @@ void PairLJCutTholeLong::coeff(int narg, char **arg) double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); double polar_one = force->numeric(FLERR,arg[4]); - double thole_one = thole_global; + double thole_one = thole_global; if (narg >=6) thole_one = force->numeric(FLERR,arg[5]); double cut_lj_one = cut_lj_global; @@ -650,7 +650,7 @@ double PairLJCutTholeLong::single(int i, int j, int itype, int jtype, factor_f = 0.5*(2. + (exp_asr * (-2. - asr * (2. + asr)))) - factor_coul; forcecoul += factor_f * dcoul; - factor_e = 0.5*(2. - (exp_asr * (2. + asr))) - factor_coul; + factor_e = 0.5*(2. - (exp_asr * (2. + asr))) - factor_coul; } } } else forcecoul = 0.0; diff --git a/src/USER-DRUDE/pair_thole.cpp b/src/USER-DRUDE/pair_thole.cpp index 5840dbc51be3b633cf1bb813876c83ecbd0986b1..13b1265a7edfc3109533aa8cb1d835693f9eabf6 100644 --- a/src/USER-DRUDE/pair_thole.cpp +++ b/src/USER-DRUDE/pair_thole.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_thole.h" #include "atom.h" #include "comm.h" @@ -213,7 +213,7 @@ void PairThole::settings(int narg, char **arg) void PairThole::coeff(int narg, char **arg) { - if (narg < 3 || narg > 5) + if (narg < 3 || narg > 5) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -222,7 +222,7 @@ void PairThole::coeff(int narg, char **arg) force->bounds(arg[1],atom->ntypes,jlo,jhi); double polar_one = force->numeric(FLERR,arg[2]); - double thole_one = thole_global; + double thole_one = thole_global; double cut_one = cut_global; if (narg >=4) thole_one = force->numeric(FLERR,arg[3]); if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); @@ -255,7 +255,7 @@ void PairThole::init_style() int ifix; for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; - if (ifix == modify->nfix) error->all(FLERR, "Pair thole requires fix drude"); + if (ifix == modify->nfix) error->all(FLERR, "Pair thole requires fix drude"); fix_drude = (FixDrude *) modify->fix[ifix]; neighbor->request(this,instance_me); @@ -401,7 +401,7 @@ double PairThole::single(int i, int j, int itype, int jtype, dcoul = force->qqrd2e * qi * qj * scale[itype][jtype] * rinv; factor_f = 0.5*(2. + (exp_asr * (-2. - asr * (2. + asr)))) - factor_coul; fforce = factor_f * dcoul * r2inv; - factor_e = 0.5*(2. - (exp_asr * (2. + asr))) - factor_coul; + factor_e = 0.5*(2. - (exp_asr * (2. + asr))) - factor_coul; phicoul = factor_e * dcoul; } diff --git a/src/USER-EFF/atom_vec_electron.cpp b/src/USER-EFF/atom_vec_electron.cpp index 5935c71402a83986362ff2df2faceb723648b05a..56d61fd74f99ffb6c237ecfc2c0487bcd0d37569 100644 --- a/src/USER-EFF/atom_vec_electron.cpp +++ b/src/USER-EFF/atom_vec_electron.cpp @@ -15,9 +15,9 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom_vec_electron.h" #include "atom.h" #include "comm.h" @@ -908,7 +908,7 @@ int AtomVecElectron::pack_data_hybrid(int i, double *buf) void AtomVecElectron::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %d %-1.16e %d %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i,buf[i][2], (int) ubuf(buf[i][3]).i,buf[i][4],buf[i][5],buf[i][6],buf[i][7], @@ -992,7 +992,7 @@ int AtomVecElectron::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecElectron::pack_property_atom(int index, double *buf, +void AtomVecElectron::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; @@ -1046,7 +1046,7 @@ bigint AtomVecElectron::memory_usage() if (atom->memcheck("spin")) bytes += memory->usage(spin,nmax); if (atom->memcheck("eradius")) bytes += memory->usage(eradius,nmax); if (atom->memcheck("ervel")) bytes += memory->usage(ervel,nmax); - if (atom->memcheck("erforce")) + if (atom->memcheck("erforce")) bytes += memory->usage(erforce,nmax*comm->nthreads); return bytes; diff --git a/src/USER-EFF/compute_ke_atom_eff.cpp b/src/USER-EFF/compute_ke_atom_eff.cpp index 3c29e801cb994b22b7266e9f0a2e1fc1689e82f0..93ad934d6d5a05c34081b3b7a400edb263789d8c 100644 --- a/src/USER-EFF/compute_ke_atom_eff.cpp +++ b/src/USER-EFF/compute_ke_atom_eff.cpp @@ -15,9 +15,9 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_ke_atom_eff.h" #include "atom.h" #include "update.h" diff --git a/src/USER-EFF/compute_ke_eff.cpp b/src/USER-EFF/compute_ke_eff.cpp index 7d3487b69b5aaa02674f6f9583e355b9f15a0467..80c7192708fab9c6aebb39181cf4b27829ddd1e4 100644 --- a/src/USER-EFF/compute_ke_eff.cpp +++ b/src/USER-EFF/compute_ke_eff.cpp @@ -15,9 +15,9 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "compute_ke_eff.h" #include "atom.h" #include "update.h" diff --git a/src/USER-EFF/compute_temp_deform_eff.cpp b/src/USER-EFF/compute_temp_deform_eff.cpp index 8ff1d6f768cdaa97041ea0447077efaec7e44ad1..12c72479cbe6b357cd3f5b286fa8052ecb100fe3 100644 --- a/src/USER-EFF/compute_temp_deform_eff.cpp +++ b/src/USER-EFF/compute_temp_deform_eff.cpp @@ -15,10 +15,10 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_temp_deform_eff.h" #include "domain.h" #include "atom.h" @@ -174,7 +174,7 @@ double ComputeTempDeformEff::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/USER-EFF/compute_temp_eff.cpp b/src/USER-EFF/compute_temp_eff.cpp index 2b4e5070912c4f6b69e24aef12804ea8c48549ba..251cdccaca7a83dc4cf2b866d075823d92b6892d 100644 --- a/src/USER-EFF/compute_temp_eff.cpp +++ b/src/USER-EFF/compute_temp_eff.cpp @@ -15,10 +15,10 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_temp_eff.h" #include "atom.h" #include "update.h" @@ -120,7 +120,7 @@ double ComputeTempEff::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/USER-EFF/compute_temp_region_eff.cpp b/src/USER-EFF/compute_temp_region_eff.cpp index 3c762e5d7bf1c14d7d246213068f8e0a3f62d059..1035a3e31bbbed7c1db89c508dd7d8739776a45a 100644 --- a/src/USER-EFF/compute_temp_region_eff.cpp +++ b/src/USER-EFF/compute_temp_region_eff.cpp @@ -15,10 +15,10 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_temp_region_eff.h" #include "atom.h" #include "update.h" @@ -148,7 +148,7 @@ double ComputeTempRegionEff::compute_scalar() tarray[1] = t; MPI_Allreduce(tarray,tarray_all,2,MPI_DOUBLE,MPI_SUM,world); dof = domain->dimension * tarray_all[0] - extra_dof; - if (dof < 0.0 && tarray_all[0] > 0.0) + if (dof < 0.0 && tarray_all[0] > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); int one = 0; diff --git a/src/USER-EFF/fix_langevin_eff.cpp b/src/USER-EFF/fix_langevin_eff.cpp index dec460da93b62d5463695cb2dfcd91e664924d4b..f2ca444de204b8b933b7645018f29386fb185f99 100644 --- a/src/USER-EFF/fix_langevin_eff.cpp +++ b/src/USER-EFF/fix_langevin_eff.cpp @@ -15,10 +15,10 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_langevin_eff.h" #include "math_extra.h" #include "atom.h" diff --git a/src/USER-EFF/fix_nh_eff.cpp b/src/USER-EFF/fix_nh_eff.cpp index ca38fc7e73e3d82195eddf826597b40cd54f08db..bbf5ac31f051de5841806ab81a8f12e600be00c2 100644 --- a/src/USER-EFF/fix_nh_eff.cpp +++ b/src/USER-EFF/fix_nh_eff.cpp @@ -15,8 +15,8 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "fix_nh_eff.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/USER-EFF/fix_nph_eff.cpp b/src/USER-EFF/fix_nph_eff.cpp index e580a3fc735a654ab094b81bd297490fea46170c..dc6bfe20d5d24c1f24650488e111c0708239ede4 100644 --- a/src/USER-EFF/fix_nph_eff.cpp +++ b/src/USER-EFF/fix_nph_eff.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nph_eff.h" #include "modify.h" #include "error.h" diff --git a/src/USER-EFF/fix_npt_eff.cpp b/src/USER-EFF/fix_npt_eff.cpp index baea9a16eadb12df63eaf64419e43f1b82870f6e..36a6f87cba01bdb473efbf95a303613bfb06a5f2 100644 --- a/src/USER-EFF/fix_npt_eff.cpp +++ b/src/USER-EFF/fix_npt_eff.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_npt_eff.h" #include "modify.h" #include "error.h" diff --git a/src/USER-EFF/fix_nve_eff.cpp b/src/USER-EFF/fix_nve_eff.cpp index d1aefaa7680a5d240037940575b7813673b5f0a9..09cd81a722165dfb9e9c7bacf39576f8707563bb 100644 --- a/src/USER-EFF/fix_nve_eff.cpp +++ b/src/USER-EFF/fix_nve_eff.cpp @@ -15,17 +15,17 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> #include "fix_nve_eff.h" #include "atom.h" #include "force.h" #include "update.h" #include "respa.h" #include "error.h" -#include "math.h" +#include <math.h> #include "domain.h" using namespace LAMMPS_NS; diff --git a/src/USER-EFF/fix_nvt_eff.cpp b/src/USER-EFF/fix_nvt_eff.cpp index 17e01a31bb2adf8bbd5542a1a2ccf4c2a7edb88b..36a9ff32930f3a01ee2441b62d42cad2e76170d3 100644 --- a/src/USER-EFF/fix_nvt_eff.cpp +++ b/src/USER-EFF/fix_nvt_eff.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "math.h" +#include <string.h> +#include <math.h> #include "fix_nvt_eff.h" #include "group.h" #include "modify.h" diff --git a/src/USER-EFF/fix_nvt_sllod_eff.cpp b/src/USER-EFF/fix_nvt_sllod_eff.cpp index 46b49331b01b0b4bd594b4c8b6cacd2b590666f7..1f6dea658f81616df4b812815675fa47ce13e3fa 100644 --- a/src/USER-EFF/fix_nvt_sllod_eff.cpp +++ b/src/USER-EFF/fix_nvt_sllod_eff.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "fix_nvt_sllod_eff.h" #include "math_extra.h" #include "atom.h" diff --git a/src/USER-EFF/fix_temp_rescale_eff.cpp b/src/USER-EFF/fix_temp_rescale_eff.cpp index 18ba739e0fb3bc482f4ece75ca5707913456529a..774cd1f2e303782236613686a10d5eca3146a2bc 100644 --- a/src/USER-EFF/fix_temp_rescale_eff.cpp +++ b/src/USER-EFF/fix_temp_rescale_eff.cpp @@ -15,9 +15,9 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_temp_rescale_eff.h" #include "atom.h" #include "force.h" diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index d8635c10a9494b66adde0920cb9e6ab9a720c4d8..b12e1f43b3e28741290881c1035a09cf4db0d950 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -15,10 +15,10 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eff_cut.h" #include "pair_eff_inline.h" #include "atom.h" @@ -806,11 +806,11 @@ void PairEffCut::settings(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"limit/eradius") == 0) { - limit_eradius_flag = 1; + limit_eradius_flag = 1; iarg += 1; } else if (strcmp(arg[iarg],"pressure/evirials") == 0) { - pressure_with_evirials_flag = 1; + pressure_with_evirials_flag = 1; iarg += 1; } else if (strcmp(arg[iarg],"ecp") == 0) { @@ -822,14 +822,14 @@ void PairEffCut::settings(int narg, char **arg) else if (strcmp(arg[iarg+1],"O") == 0) ecp_type[atype] = 8; else if (strcmp(arg[iarg+1],"Al") == 0) ecp_type[atype] = 13; else if (strcmp(arg[iarg+1],"Si") == 0) ecp_type[atype] = 14; - else error->all(FLERR, "Note: there are no default parameters for this atom ECP\n"); + else error->all(FLERR, "Note: there are no default parameters for this atom ECP\n"); iarg += 2; ecp_found = 1; - } + } } } - if (!ecp_found && atom->ecp_flag) + if (!ecp_found && atom->ecp_flag) error->all(FLERR,"Need to specify ECP type on pair_style command"); // Need to introduce 2 new constants w/out changing update.cpp @@ -921,7 +921,7 @@ void PairEffCut::coeff(int narg, char **arg) PAULI_CORE_C[ecp_type[ecp]] = force->numeric(FLERR,arg[4]); PAULI_CORE_D[ecp_type[ecp]] = force->numeric(FLERR,arg[5]); PAULI_CORE_E[ecp_type[ecp]] = force->numeric(FLERR,arg[6]); - } else error->all(FLERR,"Illegal pair_coeff command"); + } else error->all(FLERR,"Illegal pair_coeff command"); } } diff --git a/src/USER-FEP/compute_fep.cpp b/src/USER-FEP/compute_fep.cpp index dd7d29be42308472716243974de4a094b756b9ce..d3c3bf9409ec0946761ac5112633f174431df4ad 100644 --- a/src/USER-FEP/compute_fep.cpp +++ b/src/USER-FEP/compute_fep.cpp @@ -15,10 +15,10 @@ Contributing author: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "math.h" -#include "mpi.h" +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <mpi.h> #include "comm.h" #include "update.h" #include "atom.h" @@ -144,7 +144,7 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"yes") == 0) volumeflag = 1; else error->all(FLERR,"Illegal optional keyword in compute fep"); iarg += 2; - } else + } else error->all(FLERR,"Illegal optional keyword in compute fep"); } @@ -220,7 +220,7 @@ void ComputeFEP::init() if (pair == NULL) error->all(FLERR,"compute fep pair style " "does not exist"); void *ptr = pair->extract(pert->pparam,pert->pdim); - if (ptr == NULL) + if (ptr == NULL) error->all(FLERR,"compute fep pair style param not supported"); pert->array = (double **) ptr; @@ -335,10 +335,10 @@ void ComputeFEP::compute_vector() } // accumulate force/energy/virial from /gpu pair styles - // this is required as to empty the answer queue, + // this is required as to empty the answer queue, // otherwise the force compute on the GPU in the next step would be incorrect if (fixgpu) fixgpu->post_force(vflag); - + pe1 = compute_epair(); restore_qfev(); // restore charge, force, energy, virial array values @@ -398,14 +398,14 @@ void ComputeFEP::perturb_params() if (pert->aparam == CHARGE) { // modify charges int *atype = atom->type; - double *q = atom->q; + double *q = atom->q; int *mask = atom->mask; int natom = atom->nlocal + atom->nghost; - + for (i = 0; i < natom; i++) if (atype[i] >= pert->ilo && atype[i] <= pert->ihi) if (mask[i] & groupbit) - q[i] += delta; + q[i] += delta; } } @@ -519,9 +519,9 @@ void ComputeFEP::backup_qfev() double **f = atom->f; for (i = 0; i < natom; i++) { - f_orig[i][0] = f[i][0]; - f_orig[i][1] = f[i][1]; - f_orig[i][2] = f[i][2]; + f_orig[i][0] = f[i][0]; + f_orig[i][1] = f[i][1]; + f_orig[i][2] = f[i][2]; } eng_vdwl_orig = force->pair->eng_vdwl; @@ -552,7 +552,7 @@ void ComputeFEP::backup_qfev() } if (chgflag) { - double *q = atom->q; + double *q = atom->q; for (i = 0; i < nall; i++) q_orig[i] = q[i]; @@ -564,7 +564,7 @@ void ComputeFEP::backup_qfev() kvirial_orig[3] = force->kspace->virial[3]; kvirial_orig[4] = force->kspace->virial[4]; kvirial_orig[5] = force->kspace->virial[5]; - + if (update->eflag_atom) { double *keatom = force->kspace->eatom; for (i = 0; i < natom; i++) @@ -598,9 +598,9 @@ void ComputeFEP::restore_qfev() double **f = atom->f; for (i = 0; i < natom; i++) { - f[i][0] = f_orig[i][0]; - f[i][1] = f_orig[i][1]; - f[i][2] = f_orig[i][2]; + f[i][0] = f_orig[i][0]; + f[i][1] = f_orig[i][1]; + f[i][2] = f_orig[i][2]; } force->pair->eng_vdwl = eng_vdwl_orig; @@ -631,7 +631,7 @@ void ComputeFEP::restore_qfev() } if (chgflag) { - double *q = atom->q; + double *q = atom->q; for (i = 0; i < nall; i++) q[i] = q_orig[i]; @@ -643,7 +643,7 @@ void ComputeFEP::restore_qfev() force->kspace->virial[3] = kvirial_orig[3]; force->kspace->virial[4] = kvirial_orig[4]; force->kspace->virial[5] = kvirial_orig[5]; - + if (update->eflag_atom) { double *keatom = force->kspace->eatom; for (i = 0; i < natom; i++) diff --git a/src/USER-FEP/fix_adapt_fep.cpp b/src/USER-FEP/fix_adapt_fep.cpp index c033e7c45ad54454bc5d86c5f08fedacb4118720..54e90f4c6e4fa608960f1b88c80aa4c532515ba3 100644 --- a/src/USER-FEP/fix_adapt_fep.cpp +++ b/src/USER-FEP/fix_adapt_fep.cpp @@ -15,9 +15,9 @@ Charges by type and after option: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_adapt_fep.h" #include "atom.h" #include "update.h" @@ -123,8 +123,8 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : adapt[nadapt].aparam = DIAMETER; diamflag = 1; } else if (strcmp(arg[iarg+1],"charge") == 0) { - adapt[nadapt].aparam = CHARGE; - chgflag = 1; + adapt[nadapt].aparam = CHARGE; + chgflag = 1; } else error->all(FLERR,"Illegal fix adapt/fep command"); force->bounds(arg[iarg+2],atom->ntypes, adapt[nadapt].ilo,adapt[nadapt].ihi); @@ -289,7 +289,7 @@ void FixAdaptFEP::init() if (group->dynamic[igroup]) for (int i = 0; i < nadapt; i++) - if (adapt[i].which == ATOM) + if (adapt[i].which == ATOM) error->all(FLERR,"Cannot use dynamic group with fix adapt/fep atom"); // setup and error checks @@ -320,7 +320,7 @@ void FixAdaptFEP::init() if (pair == NULL) error->all(FLERR, "Fix adapt/fep pair style does not exist"); void *ptr = pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) + if (ptr == NULL) error->all(FLERR,"Fix adapt/fep pair style param not supported"); ad->pdim = 2; @@ -368,7 +368,7 @@ void FixAdaptFEP::init() } // fixes that store initial per-atom values - + if (id_fix_diam) { int ifix = modify->find_fix(id_fix_diam); if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID"); @@ -507,7 +507,7 @@ void FixAdaptFEP::change_settings() } } else if (ad->aparam == CHARGE) { int *atype = atom->type; - double *q = atom->q; + double *q = atom->q; int *mask = atom->mask; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; diff --git a/src/USER-FEP/fix_adapt_fep.h b/src/USER-FEP/fix_adapt_fep.h index 16a6d4b74012883885bbfed2b856f87ad14e74b2..cee19752e477db431d544767614b41a7fb3fb6b7 100644 --- a/src/USER-FEP/fix_adapt_fep.h +++ b/src/USER-FEP/fix_adapt_fep.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class FixAdaptFEP : public Fix { public: int diamflag; // 1 if atom diameters will vary, for AtomVecGranular - int chgflag; + int chgflag; FixAdaptFEP(class LAMMPS *, int, char **); ~FixAdaptFEP(); diff --git a/src/USER-FEP/pair_coul_cut_soft.cpp b/src/USER-FEP/pair_coul_cut_soft.cpp index dbb63f19a261718f5ee22932029da4ef9d43f389..b82abc1ed165ee2d6bc5eae94a64c0bef66fd2a6 100644 --- a/src/USER-FEP/pair_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_coul_cut_soft.cpp @@ -15,10 +15,10 @@ Soft-core version: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_cut_soft.h" #include "atom.h" #include "comm.h" @@ -179,7 +179,7 @@ void PairCoulCutSoft::settings(int narg, char **arg) void PairCoulCutSoft::coeff(int narg, char **arg) { - if (narg < 3 || narg > 4) + if (narg < 3 || narg > 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -357,7 +357,7 @@ double PairCoulCutSoft::single(int i, int j, int itype, int jtype, denc = sqrt(lam2[itype][jtype] + rsq); forcecoul = force->qqrd2e * lam1[itype][jtype] * atom->q[i]*atom->q[j] / (denc*denc*denc); - } else forcecoul = 0.0; + } else forcecoul = 0.0; fforce = factor_coul*forcecoul; if (rsq < cutsq[itype][jtype]) diff --git a/src/USER-FEP/pair_coul_long_soft.cpp b/src/USER-FEP/pair_coul_long_soft.cpp index be1d9a246c5505d623567300a4111833d7b46ca2..d20962810497339d133a56a595390d5985783e5d 100644 --- a/src/USER-FEP/pair_coul_long_soft.cpp +++ b/src/USER-FEP/pair_coul_long_soft.cpp @@ -16,10 +16,10 @@ Soft-core version: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_long_soft.h" #include "atom.h" #include "comm.h" @@ -201,7 +201,7 @@ void PairCoulLongSoft::settings(int narg, char **arg) void PairCoulLongSoft::coeff(int narg, char **arg) { - if (narg != 3) + if (narg != 3) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -361,7 +361,7 @@ double PairCoulLongSoft::single(int i, int j, int itype, int jtype, expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; - + denc = sqrt(lam2[itype][jtype] + rsq); prefactor = force->qqrd2e * lam1[itype][jtype] * atom->q[i]*atom->q[j] / (denc*denc*denc); @@ -390,6 +390,6 @@ void *PairCoulLongSoft::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; if (strcmp(str,"lambda") == 0) return (void *) lambda; - + return NULL; } diff --git a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp index 1f4a2529f59ea341969297d9e39ab3405e307121..d2a9a04ba61eddab1029a2e8f8d0a15d80719e65 100644 --- a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp @@ -16,10 +16,10 @@ Soft-core version: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_charmm_coul_long_soft.h" #include "atom.h" #include "comm.h" @@ -153,14 +153,14 @@ void PairLJCharmmCoulLongSoft::compute(int eflag, int vflag) if (rsq < cut_ljsq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0 * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj); forcelj = forcelj*switch1 + philj*switch2; } @@ -185,7 +185,7 @@ void PairLJCharmmCoulLongSoft::compute(int eflag, int vflag) } else ecoul = 0.0; if (rsq < cut_ljsq) { - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj); if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * @@ -270,7 +270,7 @@ void PairLJCharmmCoulLongSoft::compute_inner() r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); fpair = forcecoul + factor_lj*forcelj; @@ -365,14 +365,14 @@ void PairLJCharmmCoulLongSoft::compute_middle() r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0 * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj); forcelj = forcelj*switch1 + philj*switch2; } @@ -497,14 +497,14 @@ void PairLJCharmmCoulLongSoft::compute_outer(int eflag, int vflag) if (rsq < cut_ljsq && rsq > cut_in_off_sq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0 * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj); forcelj = forcelj*switch1 + philj*switch2; } @@ -535,7 +535,7 @@ void PairLJCharmmCoulLongSoft::compute_outer(int eflag, int vflag) if (rsq < cut_ljsq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj); if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * @@ -555,27 +555,27 @@ void PairLJCharmmCoulLongSoft::compute_outer(int eflag, int vflag) if (rsq <= cut_in_off_sq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0 * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj); forcelj = forcelj*switch1 + philj*switch2; } } else if (rsq <= cut_in_on_sq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0 * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj); forcelj = forcelj*switch1 + philj*switch2; } @@ -971,13 +971,13 @@ double PairLJCharmmCoulLongSoft::single(int i, int j, int itype, int jtype, if (rsq < cut_ljsq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * (cut_ljsq + 2.0*rsq - 3.0*cut_lj_innersq) / denom_lj; switch2 = 12.0 * (cut_ljsq-rsq) * (rsq-cut_lj_innersq) / denom_lj; - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj); forcelj = forcelj*switch1 + philj*switch2; } @@ -993,7 +993,7 @@ double PairLJCharmmCoulLongSoft::single(int i, int j, int itype, int jtype, } if (rsq < cut_ljsq) { - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; if (rsq > cut_lj_innersq) { switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) * diff --git a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp index e4c3f63b9517c28b5fc75c918553558fa682bc73..631d608afb03a4945f65d0c3cc0ffd9c8f17c89e 100644 --- a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp @@ -15,10 +15,10 @@ Soft-core version: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_cut_soft.h" #include "atom.h" #include "comm.h" @@ -121,11 +121,11 @@ void PairLJCutCoulCutSoft::compute(int eflag, int vflag) denc = sqrt(lj4[itype][jtype] + rsq); forcecoul = qqrd2e * lj1[itype][jtype] * qtmp*q[j] / (denc*denc*denc); } else forcecoul = 0.0; - + if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; @@ -145,7 +145,7 @@ void PairLJCutCoulCutSoft::compute(int eflag, int vflag) ecoul = factor_coul * qqrd2e * lj1[itype][jtype] * qtmp*q[j] / denc; else ecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; @@ -225,7 +225,7 @@ void PairLJCutCoulCutSoft::settings(int narg, char **arg) void PairLJCutCoulCutSoft::coeff(int narg, char **arg) { - if (narg < 5 || narg > 7) + if (narg < 5 || narg > 7) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -481,7 +481,7 @@ double PairLJCutCoulCutSoft::single(int i, int j, int itype, int jtype, if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; fforce = factor_coul*forcecoul + factor_lj*forcelj; @@ -492,7 +492,7 @@ double PairLJCutCoulCutSoft::single(int i, int j, int itype, int jtype, eng += factor_coul*phicoul; } if (rsq < cut_ljsq[itype][jtype]) { - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; eng += factor_lj*philj; } diff --git a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp index 6bb95380230e945a1df285214fcee3f1b492b320..1b3c2b5eceba08f9d2af7bdd2907e9c037264ee3 100644 --- a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp @@ -16,10 +16,10 @@ Soft-core version: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_long_soft.h" #include "atom.h" #include "comm.h" @@ -139,10 +139,10 @@ void PairLJCutCoulLongSoft::compute(int eflag, int vflag) expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; - + denc = sqrt(lj4[itype][jtype] + rsq); prefactor = qqrd2e * lj1[itype][jtype] * qtmp*q[j] / (denc*denc*denc); - + forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } else forcecoul = 0.0; @@ -150,7 +150,7 @@ void PairLJCutCoulLongSoft::compute(int eflag, int vflag) if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; @@ -173,7 +173,7 @@ void PairLJCutCoulLongSoft::compute(int eflag, int vflag) } else ecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; @@ -254,7 +254,7 @@ void PairLJCutCoulLongSoft::compute_inner() if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; @@ -349,7 +349,7 @@ void PairLJCutCoulLongSoft::compute_middle() if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; @@ -447,10 +447,10 @@ void PairLJCutCoulLongSoft::compute_outer(int eflag, int vflag) expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; - + denc = sqrt(lj4[itype][jtype] + rsq); fprefactor = qqrd2e * lj1[itype][jtype] * qtmp*q[j] / (denc*denc*denc); - + forcecoul = fprefactor * (erfc + EWALD_F*grij*expm2 - 1.0); if (rsq > cut_in_off_sq) { @@ -471,7 +471,7 @@ void PairLJCutCoulLongSoft::compute_outer(int eflag, int vflag) if (rsq < cut_ljsq[itype][jtype] && rsq > cut_in_off_sq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); if (rsq < cut_in_on_sq) { rsw = (sqrt(rsq) - cut_in_off)/cut_in_diff; @@ -500,7 +500,7 @@ void PairLJCutCoulLongSoft::compute_outer(int eflag, int vflag) if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; @@ -515,12 +515,12 @@ void PairLJCutCoulLongSoft::compute_outer(int eflag, int vflag) if (rsq <= cut_in_off_sq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else if (rsq < cut_in_on_sq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } fpair = forcecoul + factor_lj*forcelj; @@ -910,11 +910,11 @@ double PairLJCutCoulLongSoft::single(int i, int j, int itype, int jtype, expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; - + denc = sqrt(lj4[itype][jtype] + rsq); prefactor = force->qqrd2e * lj1[itype][jtype] * atom->q[i]*atom->q[j] / (denc*denc*denc); - + forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } else forcecoul = 0.0; @@ -922,7 +922,7 @@ double PairLJCutCoulLongSoft::single(int i, int j, int itype, int jtype, if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; @@ -937,7 +937,7 @@ double PairLJCutCoulLongSoft::single(int i, int j, int itype, int jtype, } if (rsq < cut_ljsq[itype][jtype]) { - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; eng += factor_lj*philj; } diff --git a/src/USER-FEP/pair_lj_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_soft.cpp index 95b74d0d1f19929439a06ce990383ad964a4f627..7f04158c1775adc23c2eafd46b9aba65085066ca 100644 --- a/src/USER-FEP/pair_lj_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_soft.cpp @@ -16,10 +16,10 @@ Soft-core version: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_soft.h" #include "atom.h" #include "comm.h" @@ -118,7 +118,7 @@ void PairLJCutSoft::compute(int eflag, int vflag) r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); fpair = factor_lj*forcelj; @@ -133,7 +133,7 @@ void PairLJCutSoft::compute(int eflag, int vflag) } if (eflag) { - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } @@ -202,7 +202,7 @@ void PairLJCutSoft::compute_inner() r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); fpair = factor_lj*forcelj; @@ -285,7 +285,7 @@ void PairLJCutSoft::compute_middle() r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); fpair = factor_lj*forcelj; @@ -372,7 +372,7 @@ void PairLJCutSoft::compute_outer(int eflag, int vflag) r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); fpair = factor_lj*forcelj; @@ -395,7 +395,7 @@ void PairLJCutSoft::compute_outer(int eflag, int vflag) if (eflag) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } @@ -404,7 +404,7 @@ void PairLJCutSoft::compute_outer(int eflag, int vflag) if (rsq <= cut_in_off_sq) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); fpair = factor_lj*forcelj; } else if (rsq < cut_in_on_sq) @@ -756,13 +756,13 @@ double PairLJCutSoft::single(int i, int j, int itype, int jtype, double rsq, if (rsq < cutsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; fforce = factor_lj*forcelj; if (rsq < cutsq[itype][jtype]) { - philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + philj = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; } else philj = 0.0; diff --git a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp index 0ea6cf7a7f1d9143ab6f808c7c905f572780e575..2edad28bf3f2dbda29b5aa83bd9bf94ee66ac837 100644 --- a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp @@ -17,10 +17,10 @@ Soft-core version: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_tip4p_long_soft.h" #include "angle.h" #include "atom.h" @@ -183,7 +183,7 @@ void PairLJCutTIP4PLongSoft::compute(int eflag, int vflag) r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); forcelj *= factor_lj; @@ -196,7 +196,7 @@ void PairLJCutTIP4PLongSoft::compute(int eflag, int vflag) f[j][2] -= delz*forcelj; if (eflag) { - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; diff --git a/src/USER-FEP/pair_tip4p_long_soft.cpp b/src/USER-FEP/pair_tip4p_long_soft.cpp index ef76da4994ccc45206372d11ef0f93aafed29f3c..027882cfba332f00a4fe6e91752c6dddd80cb285 100644 --- a/src/USER-FEP/pair_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_tip4p_long_soft.cpp @@ -17,10 +17,10 @@ Soft-core version: Agilio Padua (Univ Blaise Pascal & CNRS) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tip4p_long_soft.h" #include "angle.h" #include "atom.h" diff --git a/src/USER-H5MD/dump_h5md.cpp b/src/USER-H5MD/dump_h5md.cpp index 4af1e2ed4c9e9bcef6c0664af5a9c2003475881f..87cec4aef041cf09f5f3fe9e6400bce81a47a104 100644 --- a/src/USER-H5MD/dump_h5md.cpp +++ b/src/USER-H5MD/dump_h5md.cpp @@ -12,11 +12,11 @@ Contributing author: Pierre de Buyl (KU Leuven) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "limits.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> #include "ch5md.h" #include "dump_h5md.h" #include "domain.h" diff --git a/src/USER-INTEL/fix_intel.cpp b/src/USER-INTEL/fix_intel.cpp index 8bc37725098fb9a733225f9a20fcc9bbe3829352..602c20e5db250934f5b3ee68899a2cd756bde42c 100644 --- a/src/USER-INTEL/fix_intel.cpp +++ b/src/USER-INTEL/fix_intel.cpp @@ -95,11 +95,11 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 2; } else if (strcmp(arg[iarg],"mode") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); - if (strcmp(arg[iarg+1],"single") == 0) + if (strcmp(arg[iarg+1],"single") == 0) _precision_mode = PREC_MODE_SINGLE; - else if (strcmp(arg[iarg+1],"mixed") == 0) + else if (strcmp(arg[iarg+1],"mixed") == 0) _precision_mode = PREC_MODE_MIXED; - else if (strcmp(arg[iarg+1],"double") == 0) + else if (strcmp(arg[iarg+1],"double") == 0) _precision_mode = PREC_MODE_DOUBLE; else error->all(FLERR,"Illegal package intel command"); iarg += 2; @@ -176,7 +176,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // set OpenMP threads // nomp is user setting, default = 0 - + #if defined(_OPENMP) #if defined(__INTEL_COMPILER) kmp_set_blocktime(0); @@ -232,7 +232,7 @@ FixIntel::~FixIntel() double *time1 = off_watch_pair(); double *time2 = off_watch_neighbor(); int *overflow = get_off_overflow_flag(); - if (_offload_balance != 0.0 && time1 != NULL && time2 != NULL && + if (_offload_balance != 0.0 && time1 != NULL && time2 != NULL && overflow != NULL) { #pragma offload_transfer target(mic:_cop) \ nocopy(time1,time2,overflow:alloc_if(0) free_if(1)) @@ -315,7 +315,7 @@ void FixIntel::pair_init_check() #ifdef _LMP_INTEL_OFFLOAD if (_offload_balance != 0.0) atom->sortfreq = 1; - + if (force->newton_pair == 0) _offload_noghost = 0; else if (_offload_ghost == 0) @@ -327,7 +327,7 @@ void FixIntel::pair_init_check() double *time1 = off_watch_pair(); double *time2 = off_watch_neighbor(); int *overflow = get_off_overflow_flag(); - if (_offload_balance !=0.0 && time1 != NULL && time2 != NULL && + if (_offload_balance !=0.0 && time1 != NULL && time2 != NULL && overflow != NULL) { #pragma offload_transfer target(mic:_cop) \ nocopy(time1,time2:length(1) alloc_if(1) free_if(0)) \ @@ -419,7 +419,7 @@ void FixIntel::check_neighbor_intel() if (_offload_balance != 0.0 && neighbor->requests[i]->intel == 0) { _full_host_list = 1; _offload_noghost = 0; - } + } #endif if (neighbor->requests[i]->skip) error->all(FLERR, "Cannot yet use hybrid styles with Intel package."); @@ -532,7 +532,7 @@ void FixIntel::output_timing_data() { #endif double ht = timers[TIME_HOST_NEIGHBOR] + timers[TIME_HOST_PAIR] + timers[TIME_OFFLOAD_WAIT]; - double ct = timers[TIME_OFFLOAD_NEIGHBOR] + + double ct = timers[TIME_OFFLOAD_NEIGHBOR] + timers[TIME_OFFLOAD_PAIR]; double tt = MAX(ht,ct); if (timers[TIME_OFFLOAD_LATENCY] / tt > 0.07 && _separate_coi == 0) diff --git a/src/USER-INTEL/fix_intel.h b/src/USER-INTEL/fix_intel.h index 93716f9afc1b79e2258823728344ec097371cde8..18cd76be1d14c5be1b72dd2a2389e700b9dfff8f 100644 --- a/src/USER-INTEL/fix_intel.h +++ b/src/USER-INTEL/fix_intel.h @@ -31,7 +31,7 @@ namespace LAMMPS_NS { class IntelData; template <class flt_t, class acc_t> class IntelBuffers; - + class FixIntel : public Fix { public: FixIntel(class LAMMPS *, int, char **); @@ -49,13 +49,13 @@ class FixIntel : public Fix { typedef struct { double x,y,z; } lmp_ft; enum {PREC_MODE_SINGLE, PREC_MODE_MIXED, PREC_MODE_DOUBLE}; - + inline int precision() { return _precision_mode; } - inline IntelBuffers<float,float> * get_single_buffers() + inline IntelBuffers<float,float> * get_single_buffers() { return _single_buffers; } - inline IntelBuffers<float,double> * get_mixed_buffers() + inline IntelBuffers<float,double> * get_mixed_buffers() { return _mixed_buffers; } - inline IntelBuffers<double,double> * get_double_buffers() + inline IntelBuffers<double,double> * get_double_buffers() { return _double_buffers; } protected: @@ -77,7 +77,7 @@ class FixIntel : public Fix { inline void add_result_array(IntelBuffers<float,float>::vec3_acc_t *f_in, float *ev_in, const int offload, const int eatom = 0, const int vatom = 0); - inline void get_buffern(const int offload, int &nlocal, int &nall, + inline void get_buffern(const int offload, int &nlocal, int &nall, int &minlocal); #ifdef _LMP_INTEL_OFFLOAD @@ -101,7 +101,7 @@ class FixIntel : public Fix { inline int host_nall() { return _host_nall; } inline int separate_buffers() { return _separate_buffers; } inline int offload_noghost() { return _offload_noghost; } - inline void set_offload_noghost(const int v) + inline void set_offload_noghost(const int v) { if (_offload_ghost < 0) _offload_noghost = v; } inline void set_neighbor_host_sizes(); @@ -301,7 +301,7 @@ void FixIntel::add_results(const ft * _noalias const f_in, const acc_t * _noalias const enull = 0; int offset = _offload_nlocal; if (atom->torque) offset *= 2; - add_oresults(f_in + offset, enull, eatom, vatom, + add_oresults(f_in + offset, enull, eatom, vatom, _offload_min_ghost, _offload_nghost); } } else { @@ -311,7 +311,7 @@ void FixIntel::add_results(const ft * _noalias const f_in, const acc_t * _noalias const enull = 0; int offset = _host_used_local; if (atom->torque) offset *= 2; - add_oresults(f_in + offset, enull, eatom, + add_oresults(f_in + offset, enull, eatom, vatom, _host_min_ghost, _host_used_ghost); } } @@ -511,7 +511,7 @@ void FixIntel::add_off_results(const ft * _noalias const f_in, _offload_nall = _offload_nlocal + _offload_nghost; _offload_nlocal; } - + int nlocal = atom->nlocal; // Load balance? if (_offload_balance < 0.0) { @@ -625,8 +625,8 @@ pair styles. E: Cannot yet use hybrid styles with Intel package. -The hybrid pair style configuration is not yet supported by the Intel -package. Support is limited to hybrid/overlay or a hybrid style that does +The hybrid pair style configuration is not yet supported by the Intel +package. Support is limited to hybrid/overlay or a hybrid style that does not require a skip list. W: Leaving a core/node free can improve performance for offload diff --git a/src/USER-INTEL/intel_buffers.cpp b/src/USER-INTEL/intel_buffers.cpp index e430a1ebc4031b56218a50585a81f44182d5fb14..154db19258828fa54dc9b1b13606573681ec2691 100644 --- a/src/USER-INTEL/intel_buffers.cpp +++ b/src/USER-INTEL/intel_buffers.cpp @@ -101,7 +101,7 @@ void IntelBuffers<flt_t, acc_t>::free_buffers() /* ---------------------------------------------------------------------- */ template <class flt_t, class acc_t> -void IntelBuffers<flt_t, acc_t>::_grow(const int nall, const int nlocal, +void IntelBuffers<flt_t, acc_t>::_grow(const int nall, const int nlocal, const int nthreads, const int offload_end) { @@ -129,7 +129,7 @@ void IntelBuffers<flt_t, acc_t>::_grow(const int nall, const int nlocal, if (lmp->atom->ellipsoid != NULL) lmp->memory->create(_host_quat, _buf_size, "intel_host_quat"); } - + if (offload_end > 0) { lmp->memory->create(_off_f, f_stride * _off_threads, "intel_off_f"); const atom_t * const x = get_x(); @@ -252,7 +252,7 @@ void IntelBuffers<flt_t, acc_t>::free_local() /* ---------------------------------------------------------------------- */ template <class flt_t, class acc_t> -void IntelBuffers<flt_t, acc_t>::_grow_local(NeighList *list, +void IntelBuffers<flt_t, acc_t>::_grow_local(NeighList *list, const int offload_end) { free_local(); @@ -341,7 +341,7 @@ void IntelBuffers<flt_t, acc_t>::free_nbor_list() /* ---------------------------------------------------------------------- */ template <class flt_t, class acc_t> -void IntelBuffers<flt_t, acc_t>::_grow_nbor_list(NeighList *list, +void IntelBuffers<flt_t, acc_t>::_grow_nbor_list(NeighList *list, const int nlocal, const int offload_end) { @@ -449,7 +449,7 @@ void IntelBuffers<flt_t, acc_t>::grow_ccache(const int off_flag, int *ccachei = _ccachei; int *ccachej = _ccachej; - if (ccachex != NULL && ccachey !=NULL && ccachez != NULL && + if (ccachex != NULL && ccachey !=NULL && ccachez != NULL && ccachew != NULL && ccachei != NULL && ccachej !=NULL) { #pragma offload_transfer target(mic:_cop) \ nocopy(ccachex,ccachey:length(vsize) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/intel_buffers.h b/src/USER-INTEL/intel_buffers.h index 91dbb790cab91a51098b90d7d0ea1e0df7f19b2f..afd7fe46ed7c12a9fa0a47a758d77299827dd533 100644 --- a/src/USER-INTEL/intel_buffers.h +++ b/src/USER-INTEL/intel_buffers.h @@ -39,16 +39,16 @@ class IntelBuffers { public: typedef struct { flt_t x,y,z; int w; } atom_t; typedef struct { flt_t w,i,j,k; } quat_t; - typedef struct { flt_t x,y,z,w; } vec3_t; + typedef struct { flt_t x,y,z,w; } vec3_t; typedef struct { flt_t x,y,z,w; } vec4_t; typedef struct { acc_t x,y,z,w; } vec3_acc_t; - + IntelBuffers(class LAMMPS *lmp_in); ~IntelBuffers(); inline int get_stride(int nall) { int stride; - IP_PRE_get_stride(stride, nall, sizeof(vec3_acc_t), + IP_PRE_get_stride(stride, nall, sizeof(vec3_acc_t), lmp->atom->torque); return stride; } @@ -102,7 +102,7 @@ class IntelBuffers { } void free_binhead(); - + inline void grow_binhead() { #ifdef _LMP_INTEL_OFFLOAD if (lmp->neighbor->maxhead > _off_map_maxhead) @@ -125,7 +125,7 @@ class IntelBuffers { (INTEL_ONEATOM_FACTOR * INTEL_DATA_ALIGN); return mn * INTEL_DATA_ALIGN / sizeof(int); } - + void free_nbor_list(); inline void grow_nbor_list(NeighList *list, const int nlocal, @@ -144,35 +144,35 @@ class IntelBuffers { inline int * cnumneigh(const NeighList *list) { return _cnumneigh; } inline int * get_atombin() { return _atombin; } - inline atom_t * get_x(const int offload = 1) { + inline atom_t * get_x(const int offload = 1) { #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers && offload == 0) return _host_x; #endif - return _x; + return _x; } - inline flt_t * get_q(const int offload = 1) { + inline flt_t * get_q(const int offload = 1) { #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers && offload == 0) return _host_q; #endif - return _q; + return _q; } - inline quat_t * get_quat(const int offload = 1) { + inline quat_t * get_quat(const int offload = 1) { #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers && offload == 0) return _host_quat; #endif - return _quat; + return _quat; } inline vec3_acc_t * get_f() { return _f; } inline acc_t * get_ev_global() { return _ev_global; } inline acc_t * get_ev_global_host() { return _ev_global_host; } - inline void zero_ev() + inline void zero_ev() { for (int i = 0; i < 8; i++) _ev_global[i] = _ev_global_host[i] = 0.0; } inline flt_t ** get_cutneighsq() { return _cutneighsq; } inline int get_off_threads() { return _off_threads; } #ifdef _LMP_INTEL_OFFLOAD - inline void set_off_params(const int n, const int cop, - const int separate_buffers) - { _off_threads = n; _cop = cop; _separate_buffers = separate_buffers; } + inline void set_off_params(const int n, const int cop, + const int separate_buffers) + { _off_threads = n; _cop = cop; _separate_buffers = separate_buffers; } inline vec3_acc_t * get_off_f() { return _off_f; } #endif @@ -197,7 +197,7 @@ class IntelBuffers { } #ifdef _LMP_INTEL_OFFLOAD - inline void thr_pack_cop(const int ifrom, const int ito, + inline void thr_pack_cop(const int ifrom, const int ito, const int offset, const bool dotype = false) { double ** x = lmp->atom->x + offset; if (dotype == false) { @@ -219,7 +219,7 @@ class IntelBuffers { } } - inline void thr_pack_host(const int ifrom, const int ito, + inline void thr_pack_host(const int ifrom, const int ito, const int offset) { double ** x = lmp->atom->x + offset; for (int i = ifrom; i < ito; i++) { @@ -229,7 +229,7 @@ class IntelBuffers { } } - inline void pack_sep_from_single(const int host_min_local, + inline void pack_sep_from_single(const int host_min_local, const int used_local, const int host_min_ghost, const int used_ghost) { @@ -295,7 +295,7 @@ class IntelBuffers { bool _off_list_alloc; int _need_tag; #endif - + int _buf_size, _buf_local_size; _alignvar(acc_t _ev_global[8],64); _alignvar(acc_t _ev_global_host[8],64); diff --git a/src/USER-INTEL/intel_preprocess.h b/src/USER-INTEL/intel_preprocess.h index f4c8b5062932989bbe3cb76a0c00be288021d786..39809cf88292746bd8b165a6c75b86f0ac718396 100644 --- a/src/USER-INTEL/intel_preprocess.h +++ b/src/USER-INTEL/intel_preprocess.h @@ -298,7 +298,7 @@ inline double MIC_Wtime() { #define MIC_Wtime MPI_Wtime #define IP_PRE_pack_separate_buffers(fix, buffers, ago, offload, \ - nlocal, nall) + nlocal, nall) #define IP_PRE_get_transfern(ago, newton, evflag, eflag, vflag, \ buffers, offload, fix, separate_flag, \ @@ -323,7 +323,7 @@ inline double MIC_Wtime() { } #define IP_PRE_repack_for_offload(newton, separate_flag, nlocal, nall, \ - f_stride, x, q) + f_stride, x, q) #endif diff --git a/src/USER-INTEL/neigh_half_bin_intel.cpp b/src/USER-INTEL/neigh_half_bin_intel.cpp index 8b4fe4c101625dc62e9115bbe3dbab2bdaa53456..ca3f12135d4606b27e214838febc409ecf6a9b80 100644 --- a/src/USER-INTEL/neigh_half_bin_intel.cpp +++ b/src/USER-INTEL/neigh_half_bin_intel.cpp @@ -143,7 +143,7 @@ void Neighbor::half_bin_no_newton_intel(NeighList *list) int host_start = off_end;; #ifdef _LMP_INTEL_OFFLOAD if (fix->full_host_list()) host_start = 0; - if (exclude) + if (exclude) error->all(FLERR, "Exclusion lists not yet supported for Intel offload"); #endif @@ -214,7 +214,7 @@ void Neighbor::hbnni(const int offload, NeighList *list, void *buffers_in, #endif { int ifrom, ito, tid; - IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, + IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, sizeof(ATOM_T)); buffers->thr_pack(ifrom, ito, 0); } @@ -492,9 +492,9 @@ void Neighbor::hbnni(const int offload, NeighList *list, void *buffers_in, ofind_special(which, special, nspecial, i, tag[j], special_flag); #ifdef _LMP_INTEL_OFFLOAD if (j >= nlocal) { - if (j == nall) + if (j == nall) jlist[jj] = nall_offset; - else if (which > 0) + else if (which > 0) jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); else jlist[jj]-=ghost_offset; } else @@ -571,7 +571,7 @@ void Neighbor::half_bin_newton_intel(NeighList *list) #ifdef _LMP_INTEL_OFFLOAD if (fix->full_host_list()) host_start = 0; offload_noghost = fix->offload_noghost(); - if (exclude) + if (exclude) error->all(FLERR, "Exclusion lists not yet supported for Intel offload"); #endif @@ -587,7 +587,7 @@ void Neighbor::half_bin_newton_intel(NeighList *list) 0, off_end, fix); hbni<float,double,1,1>(0, list, fix->get_mixed_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbni<float,double,0,1>(1, list, fix->get_mixed_buffers(), @@ -602,25 +602,25 @@ void Neighbor::half_bin_newton_intel(NeighList *list) 0, off_end, fix); hbni<double,double,1,1>(0, list, fix->get_double_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbni<double,double,0,1>(1, list, fix->get_double_buffers(), 0, off_end, fix); hbni<double,double,0,1>(0, list, fix->get_double_buffers(), host_start, nlocal, fix); - } + } } else { #ifdef _LMP_INTEL_OFFLOAD if (offload_noghost) { - hbni<float,float,1,1>(1, list, fix->get_single_buffers(), 0, off_end, + hbni<float,float,1,1>(1, list, fix->get_single_buffers(), 0, off_end, fix); hbni<float,float,1,1>(0, list, fix->get_single_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { - hbni<float,float,0,1>(1, list, fix->get_single_buffers(), 0, off_end, + hbni<float,float,0,1>(1, list, fix->get_single_buffers(), 0, off_end, fix); hbni<float,float,0,1>(0, list, fix->get_single_buffers(), host_start, nlocal, fix); @@ -634,7 +634,7 @@ void Neighbor::half_bin_newton_intel(NeighList *list) 0, off_end, fix); hbni<float,double,1,0>(0, list, fix->get_mixed_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbni<float,double,0,0>(1, list, fix->get_mixed_buffers(), @@ -649,25 +649,25 @@ void Neighbor::half_bin_newton_intel(NeighList *list) 0, off_end, fix); hbni<double,double,1,0>(0, list, fix->get_double_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbni<double,double,0,0>(1, list, fix->get_double_buffers(), 0, off_end, fix); hbni<double,double,0,0>(0, list, fix->get_double_buffers(), host_start, nlocal, fix); - } + } } else { #ifdef _LMP_INTEL_OFFLOAD if (offload_noghost) { - hbni<float,float,1,0>(1, list, fix->get_single_buffers(), 0, off_end, + hbni<float,float,1,0>(1, list, fix->get_single_buffers(), 0, off_end, fix); hbni<float,float,1,0>(0, list, fix->get_single_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { - hbni<float,float,0,0>(1, list, fix->get_single_buffers(), 0, off_end, + hbni<float,float,0,0>(1, list, fix->get_single_buffers(), 0, off_end, fix); hbni<float,float,0,0>(0, list, fix->get_single_buffers(), host_start, nlocal, fix); @@ -703,7 +703,7 @@ void Neighbor::hbni(const int offload, NeighList *list, void *buffers_in, #endif { int ifrom, ito, tid; - IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, + IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, sizeof(ATOM_T)); buffers->thr_pack(ifrom, ito, 0); } @@ -717,7 +717,7 @@ void Neighbor::hbni(const int offload, NeighList *list, void *buffers_in, fix->start_watch(TIME_HOST_NEIGHBOR); if (INTEL_NBOR_PAD > 1) pad = INTEL_NBOR_PAD * sizeof(float) / sizeof(flt_t); - } + } const int pad_width = pad; if (aend-astart == 0) { @@ -845,7 +845,7 @@ void Neighbor::hbni(const int offload, NeighList *list, void *buffers_in, #ifdef _LMP_INTEL_OFFLOAD int lmin = e_nall, lmax = -1, gmin = e_nall, gmax = -1; #endif - + const int num = aend - astart; int tid, ifrom, ito; IP_PRE_omp_range_id(ifrom, ito, tid, num, nthreads); @@ -1044,7 +1044,7 @@ void Neighbor::hbni(const int offload, NeighList *list, void *buffers_in, if (j >= nlocal) { if (j == e_nall) jlist[jj] = nall_offset; - else if (which > 0) + else if (which > 0) jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); else jlist[jj]-=ghost_offset; } else @@ -1121,7 +1121,7 @@ void Neighbor::half_bin_newton_tri_intel(NeighList *list) #ifdef _LMP_INTEL_OFFLOAD if (fix->full_host_list()) host_start = 0; offload_noghost = fix->offload_noghost(); - if (exclude) + if (exclude) error->all(FLERR, "Exclusion lists not yet supported for Intel offload"); #endif @@ -1137,7 +1137,7 @@ void Neighbor::half_bin_newton_tri_intel(NeighList *list) 0, off_end, fix); hbnti<float,double,1,1>(0, list, fix->get_mixed_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbnti<float,double,0,1>(1, list, fix->get_mixed_buffers(), @@ -1153,7 +1153,7 @@ void Neighbor::half_bin_newton_tri_intel(NeighList *list) hbnti<double,double,1,1>(0, list, fix->get_double_buffers(), host_start, nlocal, fix, off_end); } else - #endif + #endif { hbnti<double,double,0,1>(1, list, fix->get_double_buffers(), 0, off_end, fix); @@ -1167,7 +1167,7 @@ void Neighbor::half_bin_newton_tri_intel(NeighList *list) 0, off_end, fix); hbnti<float,float,1,1>(0, list, fix->get_single_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbnti<float,float,0,1>(1, list, fix->get_single_buffers(), @@ -1184,7 +1184,7 @@ void Neighbor::half_bin_newton_tri_intel(NeighList *list) 0, off_end, fix); hbnti<float,double,1,0>(0, list, fix->get_mixed_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbnti<float,double,0,0>(1, list, fix->get_mixed_buffers(), @@ -1199,7 +1199,7 @@ void Neighbor::half_bin_newton_tri_intel(NeighList *list) 0, off_end, fix); hbnti<double,double,1,0>(0, list, fix->get_double_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbnti<double,double,0,0>(1, list, fix->get_double_buffers(), @@ -1214,7 +1214,7 @@ void Neighbor::half_bin_newton_tri_intel(NeighList *list) 0, off_end, fix); hbnti<float,float,1,0>(0, list, fix->get_single_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { hbnti<float,float,0,0>(1, list, fix->get_single_buffers(), @@ -1253,7 +1253,7 @@ void Neighbor::hbnti(const int offload, NeighList *list, void *buffers_in, #endif { int ifrom, ito, tid; - IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, + IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, sizeof(ATOM_T)); buffers->thr_pack(ifrom, ito, 0); } @@ -1548,9 +1548,9 @@ void Neighbor::hbnti(const int offload, NeighList *list, void *buffers_in, ofind_special(which, special, nspecial, i, tag[j], special_flag); #ifdef _LMP_INTEL_OFFLOAD if (j >= nlocal) { - if (j == e_nall) + if (j == e_nall) jlist[jj] = nall_offset; - else if (which > 0) + else if (which > 0) jlist[jj] = (j-ghost_offset) ^ (which << SBBITS); else jlist[jj]-=ghost_offset; } else @@ -1643,7 +1643,7 @@ void Neighbor::full_bin_intel(NeighList *list) 0, off_end, fix); fbi<float,double,1,1>(0, list, fix->get_mixed_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { fbi<float,double,0,1>(1, list, fix->get_mixed_buffers(), @@ -1658,7 +1658,7 @@ void Neighbor::full_bin_intel(NeighList *list) 0, off_end, fix); fbi<double,double,1,1>(0, list, fix->get_double_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { fbi<double,double,0,1>(1, list, fix->get_double_buffers(), @@ -1669,14 +1669,14 @@ void Neighbor::full_bin_intel(NeighList *list) } else { #ifdef _LMP_INTEL_OFFLOAD if (offload_noghost) { - fbi<float,float,1,1>(1, list, fix->get_single_buffers(), 0, off_end, + fbi<float,float,1,1>(1, list, fix->get_single_buffers(), 0, off_end, fix); fbi<float,float,1,1>(0, list, fix->get_single_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { - fbi<float,float,0,1>(1, list, fix->get_single_buffers(), 0, off_end, + fbi<float,float,0,1>(1, list, fix->get_single_buffers(), 0, off_end, fix); fbi<float,float,0,1>(0, list, fix->get_single_buffers(), host_start, nlocal, fix); @@ -1690,7 +1690,7 @@ void Neighbor::full_bin_intel(NeighList *list) 0, off_end, fix); fbi<float,double,1,0>(0, list, fix->get_mixed_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { fbi<float,double,0,0>(1, list, fix->get_mixed_buffers(), @@ -1705,7 +1705,7 @@ void Neighbor::full_bin_intel(NeighList *list) 0, off_end, fix); fbi<double,double,1,0>(0, list, fix->get_double_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { fbi<double,double,0,0>(1, list, fix->get_double_buffers(), @@ -1716,14 +1716,14 @@ void Neighbor::full_bin_intel(NeighList *list) } else { #ifdef _LMP_INTEL_OFFLOAD if (offload_noghost) { - fbi<float,float,1,0>(1, list, fix->get_single_buffers(), 0, off_end, + fbi<float,float,1,0>(1, list, fix->get_single_buffers(), 0, off_end, fix); fbi<float,float,1,0>(0, list, fix->get_single_buffers(), host_start, nlocal, fix, off_end); - } else + } else #endif { - fbi<float,float,0,0>(1, list, fix->get_single_buffers(), 0, off_end, + fbi<float,float,0,0>(1, list, fix->get_single_buffers(), 0, off_end, fix); fbi<float,float,0,0>(0, list, fix->get_single_buffers(), host_start, nlocal, fix); @@ -1957,7 +1957,7 @@ void Neighbor::fbi(const int offload, NeighList *list, void *buffers_in, } else { if (x[j].z < ztmp) flist = 1; else if (x[j].z == ztmp && x[j].y < ytmp) flist = 1; - else if (x[j].z == ztmp && x[j].y == ytmp && x[j].x < xtmp) + else if (x[j].z == ztmp && x[j].y == ytmp && x[j].x < xtmp) flist = 1; } if (flist) { @@ -1980,8 +1980,8 @@ void Neighbor::fbi(const int offload, NeighList *list, void *buffers_in, neighptr[n++] = j; } else neighptr[n++] = j; - } - + } + #ifdef _LMP_INTEL_OFFLOAD if (j < nlocal) { if (j < lmin) lmin = j; diff --git a/src/USER-INTEL/pair_gayberne_intel.cpp b/src/USER-INTEL/pair_gayberne_intel.cpp index 5eb76d891e10d2327094234c3c5898f1fb3b9895..5b3e65bf66a2c2edefc44c34cd70dc7974abc4e7 100644 --- a/src/USER-INTEL/pair_gayberne_intel.cpp +++ b/src/USER-INTEL/pair_gayberne_intel.cpp @@ -12,7 +12,7 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_gayberne_intel.h" #include "math_extra_intel.h" #include "atom.h" @@ -85,7 +85,7 @@ void PairGayBerneIntel::compute(int eflag, int vflag, #endif { int ifrom, ito, tid; - IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, + IP_PRE_omp_range_id_align(ifrom, ito, tid, nall, nthreads, sizeof(ATOM_T)); if (ago != 0) buffers->thr_pack(ifrom,ito,ago); @@ -156,16 +156,16 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, const int *ellipsoid = atom->ellipsoid; #ifdef _LMP_INTEL_OFFLOAD - if (fix->separate_buffers()) { - fix->start_watch(TIME_PACK); + if (fix->separate_buffers()) { + fix->start_watch(TIME_PACK); if (offload) { #pragma omp parallel default(none) \ shared(buffers,nlocal,nall,bonus,ellipsoid) - { - int ifrom, ito, tid; - int nthreads = comm->nthreads; - IP_PRE_omp_range_id_align(ifrom, ito, tid, nlocal, - nthreads, sizeof(ATOM_T)); + { + int ifrom, ito, tid; + int nthreads = comm->nthreads; + IP_PRE_omp_range_id_align(ifrom, ito, tid, nlocal, + nthreads, sizeof(ATOM_T)); if (ago != 0) buffers->thr_pack_cop(ifrom, ito, 0); for (int i = ifrom; i < ito; i++) { int qi = ellipsoid[i]; @@ -178,8 +178,8 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, } int nghost = nall - nlocal; if (nghost) { - IP_PRE_omp_range_align(ifrom, ito, tid, nall - nlocal, - nthreads, sizeof(ATOM_T)); + IP_PRE_omp_range_align(ifrom, ito, tid, nall - nlocal, + nthreads, sizeof(ATOM_T)); int offset = 0; ifrom += nlocal; ito += nlocal; @@ -197,7 +197,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, } } } - } + } } else { if (ago != 0) buffers->thr_pack_host(fix->host_min_local(), nlocal, 0); for (int i = fix->host_min_local(); i < nlocal; i++) { @@ -220,9 +220,9 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, quat[i].k = bonus[qi].quat[3]; } } - } - fix->stop_watch(TIME_PACK); - } + } + fix->stop_watch(TIME_PACK); + } #endif // const int * _noalias const ilist = list->ilist; @@ -268,9 +268,9 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, } else { if (INTEL_NBOR_PAD > 1) pad = INTEL_NBOR_PAD * sizeof(float) / sizeof(flt_t); - } + } const int pad_width = pad; - + #ifdef _LMP_INTEL_OFFLOAD int *overflow = fix->get_off_overflow_flag(); double *timer_compute = fix->off_watch_pair(); @@ -300,29 +300,29 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, #endif #ifdef _LMP_INTEL_OFFLOAD - if (separate_flag) { - if (separate_flag < 3) { - int all_local = nlocal; - int ghost_min = overflow[LMP_GHOST_MIN]; - nlocal = overflow[LMP_LOCAL_MAX] + 1; + if (separate_flag) { + if (separate_flag < 3) { + int all_local = nlocal; + int ghost_min = overflow[LMP_GHOST_MIN]; + nlocal = overflow[LMP_LOCAL_MAX] + 1; int nghost = overflow[LMP_GHOST_MAX] + 1 - ghost_min; if (nghost < 0) nghost = 0; nall = nlocal + nghost; - separate_flag--; - int flength; - if (NEWTON_PAIR) flength = nall; - else flength = nlocal; - IP_PRE_get_stride(f_stride, flength, sizeof(FORCE_T), - separate_flag); + separate_flag--; + int flength; + if (NEWTON_PAIR) flength = nall; + else flength = nlocal; + IP_PRE_get_stride(f_stride, flength, sizeof(FORCE_T), + separate_flag); if (nghost) { - if (nlocal < all_local || ghost_min > all_local) { + if (nlocal < all_local || ghost_min > all_local) { memmove(x + nlocal, x + ghost_min, - (nall - nlocal) * sizeof(ATOM_T)); + (nall - nlocal) * sizeof(ATOM_T)); memmove(quat + nlocal, quat + ghost_min, - (nall - nlocal) * sizeof(QUAT_T)); + (nall - nlocal) * sizeof(QUAT_T)); } } - } + } x[nall].x = (flt_t)INTEL_BIGP; x[nall].y = (flt_t)INTEL_BIGP; x[nall].z = (flt_t)INTEL_BIGP; @@ -330,7 +330,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, quat[nall].i = (flt_t)0.0; quat[nall].j = (flt_t)0.0; quat[nall].k = (flt_t)0.0; - } + } #endif acc_t oevdwl, ov0, ov1, ov2, ov3, ov4, ov5; @@ -462,7 +462,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, ME_transpose_times3(a2, temp, b2); ME_diag_times3a(shape2, a2, temp); ME_transpose_times3(a2, temp, g2); - + flt_t tempv_0, tempv_1, tempv_2, tempv2_0, tempv2_1, tempv2_2; flt_t temp1, temp2, temp3; @@ -471,13 +471,13 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, flt_t r = sqrt(rsq_form[jj]); // compute distance of closest approach - + flt_t g12_0, g12_1, g12_2, g12_3, g12_4, g12_5, g12_6, g12_7, g12_8; ME_plus3(g1, g2, g12); flt_t kappa_0, kappa_1, kappa_2; ME_mldivide3(g12, delx_form[jj], dely_form[jj], delz_form[jj], kappa, ierror); - + // tempv = G12^-1*r12hat flt_t inv_r = (flt_t)1.0 / r; @@ -521,7 +521,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, // force // compute dUr/dr - temp1 = ((flt_t)2.0 * varrho12 * varrho - varrho6 * varrho) / + temp1 = ((flt_t)2.0 * varrho12 * varrho - varrho6 * varrho) / sigma; temp1 = temp1 * (flt_t)24.0 * epsilon; flt_t u_slj = temp1 * pow(sigma12, (flt_t)3.0) * (flt_t)0.5; @@ -536,7 +536,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, flt_t dchi_0, dchi_1, dchi_2; temp1 = ME_dot3(iota, r12hat); - temp2 = (flt_t)-4.0 / rsq_form[jj] * mu * + temp2 = (flt_t)-4.0 / rsq_form[jj] * mu * pow(chi, (mu - (flt_t)1.0) / mu); dchi_0 = temp2 * (iota_0 - temp1 * r12hat_0); dchi_1 = temp2 * (iota_1 - temp1 * r12hat_1); @@ -650,19 +650,19 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, temp2 = u_r * chi; temp3 = chi * eta; - ttor_0 = (temp1 * dchi_0 + temp2 * deta_0 + temp3 * dUr_0) * + ttor_0 = (temp1 * dchi_0 + temp2 * deta_0 + temp3 * dUr_0) * (flt_t)-1.0; - ttor_1 = (temp1 * dchi_1 + temp2 * deta_1 + temp3 * dUr_1) * + ttor_1 = (temp1 * dchi_1 + temp2 * deta_1 + temp3 * dUr_1) * (flt_t)-1.0; - ttor_2 = (temp1 * dchi_2 + temp2 * deta_2 + temp3 * dUr_2) * + ttor_2 = (temp1 * dchi_2 + temp2 * deta_2 + temp3 * dUr_2) * (flt_t)-1.0; if (NEWTON_PAIR || j < nlocal) { - rtor_0 = (temp1 * dchi2_0 + temp2 * deta2_0 + temp3 * dUr2_0) * + rtor_0 = (temp1 * dchi2_0 + temp2 * deta2_0 + temp3 * dUr2_0) * (flt_t)-1.0; - rtor_1 = (temp1 * dchi2_1 + temp2 * deta2_1 + temp3 * dUr2_1) * + rtor_1 = (temp1 * dchi2_1 + temp2 * deta2_1 + temp3 * dUr2_1) * (flt_t)-1.0; - rtor_2 = (temp1 * dchi2_2 + temp2 * deta2_2 + temp3 * dUr2_2) * + rtor_2 = (temp1 * dchi2_2 + temp2 * deta2_2 + temp3 * dUr2_2) * (flt_t)-1.0; } @@ -712,7 +712,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, f[jp].y += rtor_1; f[jp].z += rtor_2; } - + if (EVFLAG) { flt_t ev_pre = (flt_t)0; if (NEWTON_PAIR || i < nlocal) @@ -730,7 +730,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, f[j*2].w += (flt_t)0.5 * evdwl; } } - + if (vflag == 1) { ev_pre *= (flt_t)-1.0; sv0 += ev_pre * delx_form[jj] * fforce_0; @@ -781,7 +781,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, else o_range = nlocal; if (offload == 0) o_range -= minlocal; - IP_PRE_omp_range_align(iifrom, iito, tid, o_range, nthreads, + IP_PRE_omp_range_align(iifrom, iito, tid, o_range, nthreads, sizeof(FORCE_T)); const int two_iito = iito * 2; @@ -1060,9 +1060,9 @@ void PairGayBerneIntel::ForceConst<flt_t>::set_ntypes(const int ntypes, int off_onel = one_length * nthreads; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oijc != NULL && olj34 != NULL && - oic != NULL && orsq_form != NULL && odelx_form != NULL && - odely_form != NULL && odelz_form != NULL && ojtype_form !=NULL && + if (ospecial_lj != NULL && oijc != NULL && olj34 != NULL && + oic != NULL && orsq_form != NULL && odelx_form != NULL && + odely_form != NULL && odelz_form != NULL && ojtype_form !=NULL && ojlist_form !=NULL && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_gayberne_intel.h b/src/USER-INTEL/pair_gayberne_intel.h index 9a4aae6c727ef90b8a71a564422b7c33dade6ff2..aaed31d567274792b9100fa46ff0f5cb644f0e2c 100644 --- a/src/USER-INTEL/pair_gayberne_intel.h +++ b/src/USER-INTEL/pair_gayberne_intel.h @@ -55,9 +55,9 @@ class PairGayBerneIntel : public PairGayBerne { template <class flt_t> class ForceConst { public: - typedef struct { - flt_t cutsq, lj1, lj2, offset, sigma, epsilon, lshape; - int form; + typedef struct { + flt_t cutsq, lj1, lj2, offset, sigma, epsilon, lshape; + int form; } fc_packed1; typedef struct { flt_t lj3, lj4; } fc_packed2; typedef struct { flt_t shape2[4], well[4]; } fc_packed3; diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp index 88a9012c29aec137fee076debb7b09691cd55209..7ed23d4dee97e4d7673e2341020159ab1f0b75f7 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -12,7 +12,7 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_charmm_coul_long_intel.h" #include "atom.h" #include "comm.h" @@ -52,7 +52,7 @@ PairLJCharmmCoulLongIntel::~PairLJCharmmCoulLongIntel() void PairLJCharmmCoulLongIntel::compute(int eflag, int vflag) { if (fix->precision()==FixIntel::PREC_MODE_MIXED) - compute<float,double>(eflag, vflag, fix->get_mixed_buffers(), + compute<float,double>(eflag, vflag, fix->get_mixed_buffers(), force_const_single); else if (fix->precision()==FixIntel::PREC_MODE_DOUBLE) compute<double,double>(eflag, vflag, fix->get_double_buffers(), @@ -79,7 +79,7 @@ void PairLJCharmmCoulLongIntel::compute(int eflag, int vflag, const int host_start = fix->host_start_pair(); const int offload_end = fix->offload_end_pair(); const int ago = neighbor->ago; - + if (ago != 0 && fix->separate_buffers() == 0) { fix->start_watch(TIME_PACK); #if defined(_OPENMP) @@ -87,13 +87,13 @@ void PairLJCharmmCoulLongIntel::compute(int eflag, int vflag, #endif { int ifrom, ito, tid; - IP_PRE_omp_range_id_align(ifrom, ito, tid, atom->nlocal+atom->nghost, + IP_PRE_omp_range_id_align(ifrom, ito, tid, atom->nlocal+atom->nghost, nthreads, sizeof(ATOM_T)); buffers->thr_pack(ifrom,ito,ago); } fix->stop_watch(TIME_PACK); } - + // -------------------- Regular version if (evflag || vflag_fdotr) { int ovflag = 0; @@ -176,7 +176,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, IP_PRE_get_transfern(ago, NEWTON_PAIR, EVFLAG, EFLAG, vflag, buffers, offload, fix, separate_flag, x_size, q_size, ev_size, f_stride); - + int tc; FORCE_T * _noalias f_start; acc_t * _noalias ev_global; @@ -221,7 +221,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, *timer_compute = MIC_Wtime(); #endif - IP_PRE_repack_for_offload(NEWTON_PAIR, separate_flag, nlocal, nall, + IP_PRE_repack_for_offload(NEWTON_PAIR, separate_flag, nlocal, nall, f_stride, x, q); acc_t oevdwl, oecoul, ov0, ov1, ov2, ov3, ov4, ov5; @@ -419,7 +419,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, if (eatom) { if (NEWTON_PAIR || i < nlocal) fwtmp += (flt_t)0.5 * evdwl + (flt_t)0.5 * ecoul; - if (NEWTON_PAIR || j < nlocal) + if (NEWTON_PAIR || j < nlocal) f[j].w += (flt_t)0.5 * evdwl + (flt_t)0.5 * ecoul; } } @@ -442,7 +442,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, #pragma omp barrier #endif IP_PRE_fdotr_acc_force(NEWTON_PAIR, EVFLAG, EFLAG, vflag, eatom, nall, - nlocal, minlocal, nthreads, f_start, f_stride, + nlocal, minlocal, nthreads, f_start, f_stride, x); } // end of omp parallel region if (EVFLAG) { @@ -487,7 +487,7 @@ void PairLJCharmmCoulLongIntel::init_style() error->all(FLERR, "The 'package intel' command is required for /intel styles"); fix = static_cast<FixIntel *>(modify->fix[ifix]); - + fix->pair_init_check(); #ifdef _LMP_INTEL_OFFLOAD _cop = fix->coprocessor_number(); diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp index 1aed04ed04009593f84a322b23eb74a3b66b5669..427d7be33f3e8e95d2a129aa64968b0e57aafd56 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp @@ -12,7 +12,7 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_long_intel.h" #include "atom.h" #include "comm.h" @@ -53,7 +53,7 @@ PairLJCutCoulLongIntel::~PairLJCutCoulLongIntel() void PairLJCutCoulLongIntel::compute(int eflag, int vflag) { if (fix->precision()==FixIntel::PREC_MODE_MIXED) - compute<float,double>(eflag, vflag, fix->get_mixed_buffers(), + compute<float,double>(eflag, vflag, fix->get_mixed_buffers(), force_const_single); else if (fix->precision()==FixIntel::PREC_MODE_DOUBLE) compute<double,double>(eflag, vflag, fix->get_double_buffers(), @@ -88,13 +88,13 @@ void PairLJCutCoulLongIntel::compute(int eflag, int vflag, #endif { int ifrom, ito, tid; - IP_PRE_omp_range_id_align(ifrom, ito, tid, atom->nlocal + atom->nghost, + IP_PRE_omp_range_id_align(ifrom, ito, tid, atom->nlocal + atom->nghost, nthreads, sizeof(ATOM_T)); buffers->thr_pack(ifrom,ito,ago); } fix->stop_watch(TIME_PACK); } - + if (evflag || vflag_fdotr) { int ovflag = 0; if (vflag_fdotr) ovflag = 2; @@ -216,7 +216,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, *timer_compute = MIC_Wtime(); #endif - IP_PRE_repack_for_offload(NEWTON_PAIR, separate_flag, nlocal, nall, + IP_PRE_repack_for_offload(NEWTON_PAIR, separate_flag, nlocal, nall, f_stride, x, q); acc_t oevdwl, oecoul, ov0, ov1, ov2, ov3, ov4, ov5; @@ -389,7 +389,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, if (eatom) { if (NEWTON_PAIR || i < nlocal) fwtmp += (flt_t)0.5 * evdwl + (flt_t)0.5 * ecoul; - if (NEWTON_PAIR || j < nlocal) + if (NEWTON_PAIR || j < nlocal) f[j].w += (flt_t)0.5 * evdwl + (flt_t)0.5 * ecoul; } } @@ -409,7 +409,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, #pragma omp barrier #endif IP_PRE_fdotr_acc_force(NEWTON_PAIR, EVFLAG, EFLAG, vflag, eatom, nall, - nlocal, minlocal, nthreads, f_start, f_stride, + nlocal, minlocal, nthreads, f_start, f_stride, x); } // end of omp parallel region if (EVFLAG) { @@ -454,7 +454,7 @@ void PairLJCutCoulLongIntel::init_style() error->all(FLERR, "The 'package intel' command is required for /intel styles"); fix = static_cast<FixIntel *>(modify->fix[ifix]); - + fix->pair_init_check(); #ifdef _LMP_INTEL_OFFLOAD _cop = fix->coprocessor_number(); diff --git a/src/USER-INTEL/pair_lj_cut_intel.cpp b/src/USER-INTEL/pair_lj_cut_intel.cpp index 9d7e1b0682edbae334035177ab16543d0cd27bc3..a3665b6588fe0d3949f435380c8f2122fa0d4ed0 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_intel.cpp @@ -12,7 +12,7 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_intel.h" #include "atom.h" #include "comm.h" @@ -163,7 +163,7 @@ void PairLJCutIntel::eval(const int offload, const int vflag, *timer_compute = MIC_Wtime(); #endif - IP_PRE_repack_for_offload(NEWTON_PAIR, separate_flag, nlocal, nall, + IP_PRE_repack_for_offload(NEWTON_PAIR, separate_flag, nlocal, nall, f_stride, x, 0); acc_t oevdwl, ov0, ov1, ov2, ov3, ov4, ov5; @@ -277,7 +277,7 @@ void PairLJCutIntel::eval(const int offload, const int vflag, f[i].x += fxtmp; f[i].y += fytmp; f[i].z += fztmp; - + IP_PRE_ev_tally_atom(EVFLAG, EFLAG, vflag, f, fwtmp); } // for ii @@ -285,7 +285,7 @@ void PairLJCutIntel::eval(const int offload, const int vflag, #pragma omp barrier #endif IP_PRE_fdotr_acc_force(NEWTON_PAIR, EVFLAG, EFLAG, vflag, eatom, nall, - nlocal, minlocal, nthreads, f_start, f_stride, + nlocal, minlocal, nthreads, f_start, f_stride, x); } // end omp if (EVFLAG) { diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 884d3436d3bac51c57eeb32a85064639b47399e5..0380147abf798aaa1969673b92e970370aa4a722 100755 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -15,10 +15,10 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_sw_intel.h" #include "atom.h" #include "neighbor.h" @@ -147,7 +147,7 @@ void PairSWIntel::compute(int eflag, int vflag, template <int SPQ, int EVFLAG, int EFLAG, class flt_t, class acc_t> void PairSWIntel::eval(const int offload, const int vflag, IntelBuffers<flt_t,acc_t> *buffers, - const ForceConst<flt_t> &fc, const int astart, + const ForceConst<flt_t> &fc, const int astart, const int aend, const int pad_width) { const int inum = aend - astart; @@ -323,10 +323,10 @@ void PairSWIntel::eval(const int offload, const int vflag, const int jtype = tjtype[jj]; const flt_t rsq1 = trsq[jj]; - const flt_t r1 = sqrt(rsq1); + const flt_t r1 = sqrt(rsq1); const flt_t rinvsq1 = (flt_t)1.0 / rsq1; const flt_t rainv1 = (flt_t)1.0 / (r1 - p2fi[jtype].cut); - + // two-body interactions, skip half of them flt_t rp, rq; if (SPQ == 1) { @@ -342,7 +342,7 @@ void PairSWIntel::eval(const int offload, const int vflag, flt_t expsrainv = exp(p2fi[jtype].sigma * rainv1); if (jj >= ejnumhalf) expsrainv = (flt_t)0.0; const flt_t fpair = (p2fi[jtype].c1 * rp - p2fi[jtype].c2 * rq + - (p2fi[jtype].c3 * rp -p2fi[jtype].c4 * rq) * + (p2fi[jtype].c3 * rp -p2fi[jtype].c4 * rq) * rainvsq) * expsrainv * rinvsq1; fxtmp -= delx * fpair; @@ -355,7 +355,7 @@ void PairSWIntel::eval(const int offload, const int vflag, if (EVFLAG) { if (EFLAG) { flt_t evdwl; - evdwl = (p2ei[jtype].c5 * rp - p2ei[jtype].c6 * rq) * + evdwl = (p2ei[jtype].c5 * rp - p2ei[jtype].c6 * rq) * expsrainv; sevdwl += evdwl; if (eatom) { @@ -390,7 +390,7 @@ void PairSWIntel::eval(const int offload, const int vflag, const flt_t expgsrainv2 = exp(gsrainv2); const flt_t rinv12 = (flt_t)1.0 / (r1 * r2); - const flt_t cs = (delx * delr2[0] + dely * delr2[1] + + const flt_t cs = (delx * delr2[0] + dely * delr2[1] + delz * delr2[2]) * rinv12; const flt_t delcs = cs - p3i[joffset + ktype].costheta; const flt_t delcssq = delcs*delcs; @@ -400,11 +400,11 @@ void PairSWIntel::eval(const int offload, const int vflag, else kfactor = (flt_t)1.0; const flt_t facexp = expgsrainv1*expgsrainv2*kfactor; - const flt_t facrad = p3i[joffset + ktype].lambda_epsilon * + const flt_t facrad = p3i[joffset + ktype].lambda_epsilon * facexp * delcssq; const flt_t frad1 = facrad*gsrainvsq1; const flt_t frad2 = facrad*gsrainvsq2; - const flt_t facang = p3i[joffset + ktype].lambda_epsilon2 * + const flt_t facang = p3i[joffset + ktype].lambda_epsilon2 * facexp * delcs; const flt_t facang12 = rinv12*facang; const flt_t csfacang = cs*facang; @@ -420,7 +420,7 @@ void PairSWIntel::eval(const int offload, const int vflag, fjxtmp += fjx; fjytmp += fjy; fjztmp += fjz; - + if (EVFLAG) { if (EFLAG) { const flt_t evdwl = facrad * (flt_t)0.5; @@ -430,7 +430,7 @@ void PairSWIntel::eval(const int offload, const int vflag, fjtmp += (acc_t)0.33333333 * facrad; } } - IP_PRE_ev_tally_nbor3v(vflag, fjx, fjy, fjz, + IP_PRE_ev_tally_nbor3v(vflag, fjx, fjy, fjz, delx, dely, delz); } } // for kk @@ -441,7 +441,7 @@ void PairSWIntel::eval(const int offload, const int vflag, if (EFLAG) if (eatom) f[j].w += fjtmp; } // for jj - + f[i].x += fxtmp; f[i].y += fytmp; f[i].z += fztmp; diff --git a/src/USER-INTEL/pair_sw_intel.h b/src/USER-INTEL/pair_sw_intel.h index 5bd54c5f49b8fcbf74a730997f1c8e544be0e6e1..a38dd75cf3381a298bf7b65ac314b0e606115f20 100755 --- a/src/USER-INTEL/pair_sw_intel.h +++ b/src/USER-INTEL/pair_sw_intel.h @@ -44,7 +44,7 @@ class PairSWIntel : public PairSW { const ForceConst<flt_t> &fc); template <int SPQ, int EVFLAG, int EFLAG, class flt_t, class acc_t> void eval(const int offload, const int vflag, - IntelBuffers<flt_t,acc_t> * buffers, const ForceConst<flt_t> &fc, + IntelBuffers<flt_t,acc_t> * buffers, const ForceConst<flt_t> &fc, const int astart, const int aend, const int pad_width); template <class flt_t, class acc_t> diff --git a/src/USER-INTEL/verlet_intel.cpp b/src/USER-INTEL/verlet_intel.cpp index 5d6a36ec46696cfa38459b8a9cf273448d7b46d0..587b2fbd44da57ec7c52cd2a98b9631ed0d9c6ce 100644 --- a/src/USER-INTEL/verlet_intel.cpp +++ b/src/USER-INTEL/verlet_intel.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "verlet_intel.h" #include "neighbor.h" #include "domain.h" @@ -159,7 +159,7 @@ void VerletIntel::setup() sync_mode = 1; } } - + if (sync_mode == 1) fix_intel->sync_coprocessor(); #endif @@ -237,7 +237,7 @@ void VerletIntel::setup_minimal(int flag) sync_mode = 1; } } - + if (sync_mode == 1) fix_intel->sync_coprocessor(); #endif diff --git a/src/USER-INTEL/verlet_split_intel.cpp b/src/USER-INTEL/verlet_split_intel.cpp index 806b3652f92edb6051b807312faead59b09733ac..644ebce9fc9cfb3e578d75a1ff7c7ecee018415c 100644 --- a/src/USER-INTEL/verlet_split_intel.cpp +++ b/src/USER-INTEL/verlet_split_intel.cpp @@ -15,7 +15,7 @@ Contributing authors: Yuxing Peng and Chris Knight (U Chicago) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "verlet_split_intel.h" #include "universe.h" #include "neighbor.h" @@ -52,7 +52,7 @@ VerletSplitIntel::VerletSplitIntel(LAMMPS *lmp, int narg, char **arg) : if (universe->procs_per_world[0] % universe->procs_per_world[1]) error->universe_all(FLERR,"Verlet/split requires Rspace partition " "size be multiple of Kspace partition size"); - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"Verlet/split can only currently be used with " "comm_style brick"); @@ -217,7 +217,7 @@ VerletSplitIntel::~VerletSplitIntel() void VerletSplitIntel::init() { - if (comm->style != 0) + if (comm->style != 0) error->universe_all(FLERR,"Verlet/split can only currently be used with " "comm_style brick"); if (!force->kspace && comm->me == 0) diff --git a/src/USER-LB/fix_lb_fluid.cpp b/src/USER-LB/fix_lb_fluid.cpp index e37ec438f1f7e9d1191342364d220ee0931d18b5..5b4463631f130a5be7c13f4846f20ee558885c14 100755 --- a/src/USER-LB/fix_lb_fluid.cpp +++ b/src/USER-LB/fix_lb_fluid.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,11 +17,11 @@ ------------------------------------------------------------------------- */ #include "fix_lb_fluid.h" -#include "math.h" -#include "mpi.h" -#include "stdlib.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <mpi.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> #include "comm.h" #include "memory.h" #include "error.h" @@ -46,17 +46,17 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : //===================================================================================================== // Sample inputfile call: // fix # group lb/fluid nevery typeLB viscosity densityinit_real - // - // where: nevery: call this fix every nevery timesteps. + // + // where: nevery: call this fix every nevery timesteps. // (keep this set to 1 for now). - // typeLB: there are two different integrators + // typeLB: there are two different integrators // in the code labelled "1" and "2". - // viscosity: the viscosity of the fluid. + // viscosity: the viscosity of the fluid. // densityinit_real: the density of the fluid. // // optional arguments: // "setArea" type node_area: set the surface area per node associated with a - // given atom type. By default the surface area + // given atom type. By default the surface area // is set at 1.0*dx_lb^2. // "setGamma" gamma: specify a user-defined value for the force // coupling constant, instead of using the default @@ -67,10 +67,10 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : // "dx" dx_lb: the lattice-Boltzmann grid spacing. // "dm" dm_lb: the lattice-Boltzmann mass unit. // "a0" a_0_real: the square of the sound speed in the fluid. - // "noise" Temperature seed: include noise in the system. + // "noise" Temperature seed: include noise in the system. // Temperature is the temperature for the fluid. - // seed is the seed for the random number generator. - // "calcforce" N group: print the force acting on a given group every + // seed is the seed for the random number generator. + // "calcforce" N group: print the force acting on a given group every // N timesteps. // "trilinear": use the trilinear interpolation stencil. // "read_restart" restart_file: restart a fluid run from restart_file. @@ -98,7 +98,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : typeLB = atoi(arg[4]); viscosity = atof(arg[5]); densityinit_real = atof(arg[6]); - + // Default values for optional arguments: force_diagnostic=0; noisestress = 0; @@ -157,7 +157,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix lb/fluid command: scaleGamma"); Gamma[itype] *= scalefactor; iarg += 3; - } + } else if(strcmp(arg[iarg],"dx")==0){ dx_lb = atof(arg[iarg+1]); iarg += 2; @@ -188,10 +188,10 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : iarg += 1; } else if(strcmp(arg[iarg],"read_restart")==0){ - readrestart = 1; + readrestart = 1; int nlength = strlen(arg[iarg+1]) + 16; char *filename = new char[nlength]; - strcpy(filename,arg[iarg+1]); + strcpy(filename,arg[iarg+1]); MPI_File_open(world,filename,MPI_MODE_RDONLY,MPI_INFO_NULL,&pFileRead); delete [] filename; iarg += 2; @@ -234,9 +234,9 @@ a z wall velocity without implementing fixed BCs in z"); }else{ initializeLB = &FixLbFluid::initializeLB19; equilibriumdist = &FixLbFluid::equilibriumdist19; - update_full = &FixLbFluid::update_full19; - } - + update_full = &FixLbFluid::update_full19; + } + //-------------------------------------------------------------------------- // perform initial allocation of atom-based array register // with Atom class @@ -248,7 +248,7 @@ a z wall velocity without implementing fixed BCs in z"); for(int i=0; i<atom->nmax; i++) for(int j=0; j<3; j++) hydroF[i][j] = 0.0; - + Ng_lb = NULL; w_lb = NULL; mg_lb = NULL; @@ -269,12 +269,12 @@ a z wall velocity without implementing fixed BCs in z"); Fftempz = NULL; //-------------------------------------------------------------------------- - // Set the lattice Boltzmann dt. + // Set the lattice Boltzmann dt. //-------------------------------------------------------------------------- dt_lb=nevery*(update->dt); //-------------------------------------------------------------------------- - // Set the lattice Boltzmann dx if it wasn't specified in the + // Set the lattice Boltzmann dx if it wasn't specified in the // input. //-------------------------------------------------------------------------- if(setdx == 1){ @@ -286,14 +286,14 @@ a z wall velocity without implementing fixed BCs in z"); char str[128]; sprintf(str,"Setting the lattice-Boltzmann dx to %10.6f",dx_lb); error->message(FLERR,str); - } + } } //-------------------------------------------------------------------------- - // If the area per node has not been set by the user, set to the + // If the area per node has not been set by the user, set to the // default value of dx_lb*dx_lb. //-------------------------------------------------------------------------- if(setGamma == 0){ - if(setArea == 0){ + if(setArea == 0){ if(comm->me==0){ error->message(FLERR,"Assuming an area per node of dx*dx for all of the MD particles. This should only be used if these all correspond to point particles; otherwise, change using the setArea keyword"); } @@ -313,7 +313,7 @@ a z wall velocity without implementing fixed BCs in z"); // Check to make sure that the total number of grid points in each direction // divides evenly among the processors in that direction. // Shrink-wrapped boundary conditions (which are not permitted by this fix) - // might cause a problem, so check for this. A full check of the boundary + // might cause a problem, so check for this. A full check of the boundary // conditions is performed in the init routine, rather than here, as it is // possible to change the BCs between runs. //-------------------------------------------------------------------------- @@ -346,7 +346,7 @@ a z wall velocity without implementing fixed BCs in z"); sprintf(errormessage,"With dx= %f, and the simulation domain divided by %i processors in the z direction, the simulation domain in the z direction must be a multiple of %f",dx_lb,comm->procgrid[2],comm->procgrid[2]*dx_lb); error->all(FLERR,errormessage); } - + //-------------------------------------------------------------------------- // Set the total number of grid points in each direction. //-------------------------------------------------------------------------- @@ -360,7 +360,7 @@ a z wall velocity without implementing fixed BCs in z"); subNbx= Nbx/comm->procgrid[0] + 2; subNby= Nby/comm->procgrid[1] + 2; subNbz= Nbz/comm->procgrid[2] + 2; - + //-------------------------------------------------------------------------- // In order to calculate the fluid forces correctly, need to have atleast // 5 grid points in each direction per processor. @@ -382,7 +382,7 @@ a z wall velocity without implementing fixed BCs in z"); }else{ sprintf(str,"Using a lattice-Boltzmann grid of %i by %i by %i total grid points.",Nbx,Nby,Nbz); } - error->message(FLERR,str); + error->message(FLERR,str); } //-------------------------------------------------------------------------- @@ -399,15 +399,15 @@ a z wall velocity without implementing fixed BCs in z"); //-------------------------------------------------------------------------- MPI_Aint lb,sizeofdouble; MPI_Type_get_extent(MPI_DOUBLE,&lb,&sizeofdouble); - + MPI_Type_vector(subNbz-2,numvel,numvel,MPI_DOUBLE,&oneslice); MPI_Type_commit(&oneslice); MPI_Type_create_hvector(subNby-2,1,numvel*subNbz*sizeofdouble,oneslice,&passxf); MPI_Type_commit(&passxf); - + MPI_Type_create_hvector(subNbx,1,numvel*subNbz*subNby*sizeofdouble,oneslice,&passyf); MPI_Type_commit(&passyf); - + MPI_Type_free(&oneslice); MPI_Type_vector(subNby,numvel,numvel*subNbz,MPI_DOUBLE,&oneslice); MPI_Type_commit(&oneslice); @@ -420,10 +420,10 @@ a z wall velocity without implementing fixed BCs in z"); MPI_Type_commit(&oneslice); MPI_Type_create_hvector(subNby+3,1,3*(subNbz+3)*sizeofdouble,oneslice,&passxu); MPI_Type_commit(&passxu); - + MPI_Type_create_hvector(subNbx+3,1,3*(subNbz+3)*(subNby+3)*sizeofdouble,oneslice,&passyu); MPI_Type_commit(&passyu); - + MPI_Type_free(&oneslice); MPI_Type_vector(subNby+3,3,3*(subNbz+3),MPI_DOUBLE,&oneslice); MPI_Type_commit(&oneslice); @@ -436,10 +436,10 @@ a z wall velocity without implementing fixed BCs in z"); MPI_Type_commit(&oneslice); MPI_Type_create_hvector(subNby+3,1,1*(subNbz+3)*sizeofdouble,oneslice,&passxrho); MPI_Type_commit(&passxrho); - + MPI_Type_create_hvector(subNbx+3,1,1*(subNbz+3)*(subNby+3)*sizeofdouble,oneslice,&passyrho); MPI_Type_commit(&passyrho); - + MPI_Type_free(&oneslice); MPI_Type_vector(subNby+3,1,1*(subNbz+3),MPI_DOUBLE,&oneslice); MPI_Type_commit(&oneslice); @@ -452,10 +452,10 @@ a z wall velocity without implementing fixed BCs in z"); MPI_Type_commit(&oneslice); MPI_Type_create_hvector(subNby+3,1,3*(subNbz+3)*sizeofdouble,oneslice,&passxtemp); MPI_Type_commit(&passxtemp); - + MPI_Type_create_hvector(subNbx+3,1,3*(subNbz+3)*5*sizeofdouble,oneslice,&passytemp); MPI_Type_commit(&passytemp); - + MPI_Type_free(&oneslice); MPI_Type_vector(subNby+3,3,3*5,MPI_DOUBLE,&oneslice); MPI_Type_commit(&oneslice); @@ -499,7 +499,7 @@ a z wall velocity without implementing fixed BCs in z"); // Rescale the variables to Lattice Boltzmann dimensionless units. //-------------------------------------------------------------------------- rescale(); - + //-------------------------------------------------------------------------- // Initialize the arrays. //-------------------------------------------------------------------------- @@ -513,7 +513,7 @@ FixLbFluid::~FixLbFluid() atom->delete_callback(id,0); memory->destroy(hydroF); - + memory->destroy(Ng_lb); memory->destroy(w_lb); memory->destroy(mg_lb); @@ -537,7 +537,7 @@ FixLbFluid::~FixLbFluid() memory->destroy(Fftempx); memory->destroy(Fftempy); memory->destroy(Fftempz); - + if(noisestress==1){ delete random; } @@ -574,8 +574,8 @@ void FixLbFluid::init(void) if(fabs(dt_lb_now - dt_lb) > 1.0e-12){ error->warning(FLERR,"Timestep has changed between runs with the same lb/fluid. Unphysical results may occur"); - } - + } + //-------------------------------------------------------------------------- // Make sure the size of the simulation domain has not changed // between runs. @@ -588,11 +588,11 @@ void FixLbFluid::init(void) if(domain->periodicity[2]==0){ Nbz_now += 1; } - + if(Nbx_now != Nbx || Nby_now != Nby || Nbz_now != Nbz){ error->all(FLERR,"the simulation domain can not change shape between runs with the same lb/fluid"); } - + //-------------------------------------------------------------------------- // Check to make sure that the chosen LAMMPS boundary types are compatible // with this fix. @@ -608,7 +608,7 @@ void FixLbFluid::init(void) if(domain->boundary[2][0] == 2 || domain->boundary[2][0] == 3){ error->all(FLERR,"the z-direction can not have shrink-wrap boundary conditions"); } - + //-------------------------------------------------------------------------- // Check if the lb/viscous fix is also called: //-------------------------------------------------------------------------- @@ -630,8 +630,8 @@ void FixLbFluid::init(void) if(!(groupbit_viscouslb || groupbit_pc || groupbit_rigid_pc_sphere) && comm->me==0){ error->message(FLERR,"Not adding the fluid force to any of the MD particles. To add this force use one of the lb/viscous, lb/pc, or lb/rigid/pc/sphere fixes"); } - - // If fix lb/viscous is called for a particular atom, make sure + + // If fix lb/viscous is called for a particular atom, make sure // lb/pc or lb/rigid/pc/sphere are not: if(fixviscouslb == 1){ int *mask = atom->mask; @@ -643,7 +643,7 @@ void FixLbFluid::init(void) error->one(FLERR,"should not use the lb/viscous command when integrating with the lb/rigid/pc/sphere fix"); } } - + } void FixLbFluid::setup(int vflag) @@ -653,7 +653,7 @@ void FixLbFluid::setup(int vflag) //-------------------------------------------------------------------------- if(step > 0) calc_fluidforce(); -} +} void FixLbFluid::initial_integrate(int vflag) { @@ -668,7 +668,7 @@ void FixLbFluid::initial_integrate(int vflag) printf(" F_x F_y F_z T_x T_y T_z\n"); printf("-------------------------------------------------------------------------------\n"); } - + if(printfluid > 0 && me == 0){ printf("---------------------------------------------------------------------\n"); printf(" density u_x u_y u_z \n"); @@ -687,8 +687,8 @@ void FixLbFluid::initial_integrate(int vflag) // distribution function. //-------------------------------------------------------------------------- (*this.*update_full)(); - - std::swap(f_lb,fnew); + + std::swap(f_lb,fnew); //-------------------------------------------------------------------------- // Calculate moments of the distribution function. @@ -709,7 +709,7 @@ void FixLbFluid::initial_integrate(int vflag) //-------------------------------------------------------------------------- if(printfluid > 0 && update->ntimestep > 0 && (update->ntimestep % printfluid == 0)) streamout(); - + } void FixLbFluid::post_force(int vflag) { @@ -718,10 +718,10 @@ void FixLbFluid::post_force(int vflag) } void FixLbFluid::end_of_step() -{ +{ if(fixviscouslb==0) calc_fluidforce(); - + if(printrestart>0){ if((update->ntimestep)%printrestart == 0){ write_restartfile(); @@ -784,7 +784,7 @@ void FixLbFluid::calc_fluidforce(void) MPI_Request requests[20]; double forceloc[3],force[3]; double torqueloc[3],torque[3]; - + //-------------------------------------------------------------------------- // Zero out arrays //-------------------------------------------------------------------------- @@ -799,8 +799,8 @@ void FixLbFluid::calc_fluidforce(void) for(i=0; i<atom->nmax; i++) for(j=0; j<3; j++) hydroF[i][j] = 0.0; - - + + double unwrap[3]; double dx,dy,dz; double massone; @@ -821,7 +821,7 @@ void FixLbFluid::calc_fluidforce(void) if(rmass) massone = rmass[i]; else massone = mass[type[i]]; - + sum[0] += unwrap[0]*massone; sum[1] += unwrap[1]*massone; sum[2] += unwrap[2]*massone; @@ -844,23 +844,23 @@ void FixLbFluid::calc_fluidforce(void) }else{ peskin_interpolation(i); } - + if(force_diagnostic > 0 && update->ntimestep > 0 && (update->ntimestep % force_diagnostic == 0)){ if(mask[i] & group->bitmask[igroupforce]){ - + domain->unmap(x[i],image[i],unwrap); dx = unwrap[0] - xcm[0]; dy = unwrap[1] - xcm[1]; dz = unwrap[2] - xcm[2]; - + forceloc[0] += hydroF[i][0]; forceloc[1] += hydroF[i][1]; forceloc[2] += hydroF[i][2]; torqueloc[0] += dy*hydroF[i][2] - dz*hydroF[i][1]; torqueloc[1] += dz*hydroF[i][0] - dx*hydroF[i][2]; torqueloc[2] += dx*hydroF[i][1] - dy*hydroF[i][0]; - } - } + } + } } } @@ -881,7 +881,7 @@ void FixLbFluid::calc_fluidforce(void) MPI_Irecv(&Fftempx[3][0][0][0],1,passxtemp,comm->procneigh[0][0],40,world,&requests[8]); MPI_Irecv(&Fftempx[4][0][0][0],1,passxtemp,comm->procneigh[0][0],50,world,&requests[9]); MPI_Waitall(10,requests,MPI_STATUS_IGNORE); - + for(j=0; j<subNby+3; j++){ for(k=0; k<subNbz+3; k++){ for(m=0; m<3; m++){ @@ -949,17 +949,17 @@ void FixLbFluid::calc_fluidforce(void) if(force_diagnostic > 0 && update->ntimestep > 0 && (update->ntimestep % force_diagnostic == 0)){ force[0] = force[1] = force[2] = 0.0; torque[0] = torque[1] = torque[2] =0.0; - - MPI_Allreduce(&forceloc[0],&force[0],3,MPI_DOUBLE,MPI_SUM,world); + + MPI_Allreduce(&forceloc[0],&force[0],3,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&torqueloc[0],&torque[0],3,MPI_DOUBLE,MPI_SUM,world); - + if(me==0){ printf("%E %E %E %E %E %E\n",force[0],force[1],force[2], torque[0],torque[1],torque[2]); } } - + } //========================================================================== // uses the Peskin stencil to perform the velocity, density and @@ -987,36 +987,36 @@ void FixLbFluid::peskin_interpolation(int i) //-------------------------------------------------------------------------- //Calculate nearest leftmost grid point. //Since array indices from 1 to subNb-2 correspond to the - // local subprocessor domain (not indices from 0), use the + // local subprocessor domain (not indices from 0), use the // ceiling value. //-------------------------------------------------------------------------- ix = (int)ceil((x[i][0]-domain->sublo[0])/dx_lb); iy = (int)ceil((x[i][1]-domain->sublo[1])/dx_lb); iz = (int)ceil((x[i][2]-domain->sublo[2])/dx_lb); - + //-------------------------------------------------------------------------- //Calculate distances to the nearest points. //-------------------------------------------------------------------------- dx1 = x[i][0] - (domain->sublo[0] + (ix-1)*dx_lb); dy1 = x[i][1] - (domain->sublo[1] + (iy-1)*dx_lb); dz1 = x[i][2] - (domain->sublo[2] + (iz-1)*dx_lb); - + // Need to convert these to lattice units: dx1 = dx1/dx_lb; dy1 = dy1/dx_lb; dz1 = dz1/dx_lb; - + unode[0]=0.0; unode[1]=0.0; unode[2]=0.0; mnode = 0.0; isten=0; - + //-------------------------------------------------------------------------- // Calculate the interpolation weights, and interpolated values of // the fluid velocity, and density. //-------------------------------------------------------------------------- for(ii=-1; ii<3; ii++){ rsq=(-dx1+ii)*(-dx1+ii); - + if(rsq>=4) weightx=0.0; else{ @@ -1056,7 +1056,7 @@ void FixLbFluid::peskin_interpolation(int i) izp = iz+kk; //The atom is allowed to be within one lattice grid point outside the - //local processor sub-domain. + //local processor sub-domain. if(ixp < -1 || ixp > (subNbx+1) || iyp < -1 || iyp > (subNby+1) || izp < -1 || izp > (subNbz+1)) error->one(FLERR,"Atom outside local processor simulation domain. Either unstable fluid pararmeters, or \ require more frequent neighborlist rebuilds"); @@ -1065,11 +1065,11 @@ require more frequent neighborlist rebuilds"); error->warning(FLERR,"Atom too close to lower z wall. Unphysical results may occur"); if(domain->periodicity[2] == 0 && comm->myloc[2] == (comm->procgrid[2]-1) && (izp > (subNbz-2) )) error->warning(FLERR,"Atom too close to upper z wall. Unphysical results may occur"); - + if(ixp==-1) ixp=subNbx+2; if(iyp==-1) iyp=subNby+2; if(izp==-1) izp=subNbz+2; - + FfP[isten] = weightx*weighty*weightz; // interpolated velocity based on delta function. for(k=0; k<3; k++){ @@ -1077,7 +1077,7 @@ require more frequent neighborlist rebuilds"); } if(setGamma==0) mnode += density_lb[ixp][iyp][izp]*FfP[isten]; - + isten++; } } @@ -1087,14 +1087,14 @@ require more frequent neighborlist rebuilds"); if(rmass) massone = rmass[i]; else massone = mass[type[i]]; - massone = massone/dm_lb; + massone = massone/dm_lb; gammavalue = 2.0*(mnode*massone)*dtoverdtcollision/(mnode+massone); - } + } else{ gammavalue = Gamma[type[i]]; } - + isten=0; for(ii=-1; ii<3; ii++) for(jj=-1; jj<3; jj++) @@ -1102,7 +1102,7 @@ require more frequent neighborlist rebuilds"); ixp = ix+ii; iyp = iy+jj; izp = iz+kk; - + if(ixp==-1) ixp=subNbx+2; if(iyp==-1) iyp=subNby+2; if(izp==-1) izp=subNbz+2; @@ -1111,7 +1111,7 @@ require more frequent neighborlist rebuilds"); for(k=0; k<3; k++){ Ff[ixp][iyp][izp][k] += gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*FfP[isten]; } - + isten++; } for(k=0; k<3; k++) @@ -1142,20 +1142,20 @@ void FixLbFluid::trilinear_interpolation(int i) //-------------------------------------------------------------------------- // Calculate nearest leftmost grid point. // Since array indices from 1 to subNb-2 correspond to the - // local subprocessor domain (not indices from 0), use the + // local subprocessor domain (not indices from 0), use the // ceiling value. //-------------------------------------------------------------------------- ix = (int)ceil((x[i][0]-domain->sublo[0])/dx_lb); iy = (int)ceil((x[i][1]-domain->sublo[1])/dx_lb); iz = (int)ceil((x[i][2]-domain->sublo[2])/dx_lb); - + //-------------------------------------------------------------------------- //Calculate distances to the nearest points. //-------------------------------------------------------------------------- dx1 = x[i][0] - (domain->sublo[0] + (ix-1)*dx_lb); dy1 = x[i][1] - (domain->sublo[1] + (iy-1)*dx_lb); dz1 = x[i][2] - (domain->sublo[2] + (iz-1)*dx_lb); - + //-------------------------------------------------------------------------- // Need to convert these to lattice units: //-------------------------------------------------------------------------- @@ -1174,13 +1174,13 @@ void FixLbFluid::trilinear_interpolation(int i) FfP[5] = dx1*(1.-dy1)*dz1; FfP[6] = dx1*dy1*(1.-dz1); FfP[7] = dx1*dy1*dz1; - + ixp = (ix+1); iyp = (iy+1); izp = (iz+1); //The atom is allowed to be within one lattice grid point outside the - //local processor sub-domain. + //local processor sub-domain. if(ix < 0 || ixp > (subNbx+1) || iy < 0 || iyp > (subNby+1) || iz < 0 || izp > (subNbz+1)) error->one(FLERR,"Atom outside local processor simulation domain. Either unstable fluid pararmeters, or \ require more frequent neighborlist rebuilds"); @@ -1188,9 +1188,9 @@ require more frequent neighborlist rebuilds"); if(domain->periodicity[2] == 0 && comm->myloc[2] == 0 && (iz < 1 || izp < 1)) error->warning(FLERR,"Atom too close to lower z wall. Unphysical results may occur"); if(domain->periodicity[2] == 0 && comm->myloc[2] == (comm->procgrid[2]-1) && (izp > (subNbz-2) || iz > (subNbz-2))) - error->warning(FLERR,"Atom too close to upper z wall. Unphysical results may occur"); - - + error->warning(FLERR,"Atom too close to upper z wall. Unphysical results may occur"); + + for (k=0; k<3; k++) { // tri-linearly interpolated velocity at node unode[k] = u_lb[ix][iy][iz][k]*FfP[0] + u_lb[ix][iy][izp][k]*FfP[1] @@ -1216,13 +1216,13 @@ require more frequent neighborlist rebuilds"); if(rmass) massone = rmass[i]; else massone = mass[type[i]]; - massone = massone/dm_lb; + massone = massone/dm_lb; gammavalue = 2.0*(mnode*massone)*dtoverdtcollision/(mnode+massone); }else{ gammavalue = Gamma[type[i]]; } - + for(k=0; k<3; k++){ Ff[ix][iy][iz][k] += gammavalue*((v[i][k]*dt_lb/dx_lb)-unode[k])*FfP[0]; @@ -1242,7 +1242,7 @@ require more frequent neighborlist rebuilds"); //========================================================================== // read in a fluid restart file. This is only used to restart the -// fluid portion of a LAMMPS simulation. +// fluid portion of a LAMMPS simulation. //========================================================================== void FixLbFluid::read_restartfile(void) { @@ -1272,7 +1272,7 @@ void FixLbFluid::read_restartfile(void) MPI_File_read_all(pFileRead,&f_lb[0][0][0][0],1,realtype,&status); if(typeLB == 2){ MPI_File_read_all(pFileRead,&feqold[0][0][0][0],1,realtype,&status); - MPI_File_read_all(pFileRead,&feqoldn[0][0][0][0],1,realtype,&status); + MPI_File_read_all(pFileRead,&feqoldn[0][0][0][0],1,realtype,&status); } MPI_Type_free(&realtype); @@ -1282,7 +1282,7 @@ void FixLbFluid::read_restartfile(void) } //========================================================================== -// write a fluid restart file. +// write a fluid restart file. //========================================================================== void FixLbFluid::write_restartfile(void) { @@ -1295,7 +1295,7 @@ void FixLbFluid::write_restartfile(void) char *hfile; hfile = new char[32]; sprintf(hfile,"FluidRestart_" BIGINT_FORMAT ".dat",update->ntimestep); - + MPI_File_open(world,hfile,MPI_MODE_WRONLY | MPI_MODE_CREATE, MPI_INFO_NULL,&fh); int realsizes[4] = {subNbx,subNby,subNbz,numvel}; @@ -1317,7 +1317,7 @@ void FixLbFluid::write_restartfile(void) MPI_File_write_all(fh,&f_lb[0][0][0][0],1,realtype,&status); if(typeLB == 2){ MPI_File_write_all(fh,&feqold[0][0][0][0],1,realtype,&status); - MPI_File_write_all(fh,&feqoldn[0][0][0][0],1,realtype,&status); + MPI_File_write_all(fh,&feqoldn[0][0][0][0],1,realtype,&status); } MPI_Type_free(&realtype); @@ -1330,22 +1330,22 @@ void FixLbFluid::write_restartfile(void) //========================================================================== // rescale the simulation parameters so that dx_lb=dt_lb=dm_lb=1. // This assumes that all the simulation parameters have been given in -// terms of distance, time and mass units. +// terms of distance, time and mass units. //========================================================================== void FixLbFluid::rescale(void) { vwtp = vwtp*dt_lb/dx_lb; vwbt = vwbt*dt_lb/dx_lb; - + bodyforcex = bodyforcex*dt_lb*dt_lb/dx_lb; bodyforcey = bodyforcey*dt_lb*dt_lb/dx_lb; bodyforcez = bodyforcez*dt_lb*dt_lb/dx_lb; - + tau=(3.0*viscosity/densityinit_real)*dt_lb*dt_lb/dx_lb/dx_lb; tau /= dt_lb; if(typeLB==1) tau = tau + 0.5; - + if(setGamma == 0){ for(int i=0; i<= atom->ntypes; i++){ NodeArea[i] = NodeArea[i]/dx_lb/dx_lb; @@ -1355,7 +1355,7 @@ void FixLbFluid::rescale(void) Gamma[i] = Gamma[i]*dt_lb/dm_lb; } } - + densityinit = densityinit_real*dx_lb*dx_lb*dx_lb/dm_lb; a_0 = a_0_real*dt_lb*dt_lb/(dx_lb*dx_lb); @@ -1529,13 +1529,13 @@ void FixLbFluid::initializeLB15(void) mg_lb[6][10]=2./3.;mg_lb[6][11]=2./3.;mg_lb[6][12]=2./3.;mg_lb[6][13]=2./3.;mg_lb[6][14]=2./3.; mg_lb[7][0]=0;mg_lb[7][1]=0;mg_lb[7][2]=0;mg_lb[7][3]=0;mg_lb[7][4]=0; mg_lb[7][5]=0;mg_lb[7][6]=0;mg_lb[7][7]=1;mg_lb[7][8]=-1;mg_lb[7][9]=1; - mg_lb[7][10]=-1;mg_lb[7][11]=1;mg_lb[7][12]=-1;mg_lb[7][13]=1;mg_lb[7][14]=-1; + mg_lb[7][10]=-1;mg_lb[7][11]=1;mg_lb[7][12]=-1;mg_lb[7][13]=1;mg_lb[7][14]=-1; mg_lb[8][0]=0;mg_lb[8][1]=0;mg_lb[8][2]=0;mg_lb[8][3]=0;mg_lb[8][4]=0; mg_lb[8][5]=0;mg_lb[8][6]=0;mg_lb[8][7]=1;mg_lb[8][8]=1;mg_lb[8][9]=-1; - mg_lb[8][10]=-1;mg_lb[8][11]=-1;mg_lb[8][12]=-1;mg_lb[8][13]=1;mg_lb[8][14]=1; + mg_lb[8][10]=-1;mg_lb[8][11]=-1;mg_lb[8][12]=-1;mg_lb[8][13]=1;mg_lb[8][14]=1; mg_lb[9][0]=0;mg_lb[9][1]=0;mg_lb[9][2]=0;mg_lb[9][3]=0;mg_lb[9][4]=0; mg_lb[9][5]=0;mg_lb[9][6]=0;mg_lb[9][7]=1;mg_lb[9][8]=-1;mg_lb[9][9]=-1; - mg_lb[9][10]=1;mg_lb[9][11]=-1;mg_lb[9][12]=1;mg_lb[9][13]=1;mg_lb[9][14]=-1; + mg_lb[9][10]=1;mg_lb[9][11]=-1;mg_lb[9][12]=1;mg_lb[9][13]=1;mg_lb[9][14]=-1; mg_lb[10][0]=0;mg_lb[10][1]=0;mg_lb[10][2]=-1./3.;mg_lb[10][3]=0;mg_lb[10][4]=1./3.; mg_lb[10][5]=0;mg_lb[10][6]=0;mg_lb[10][7]=2./3.;mg_lb[10][8]=2./3.;mg_lb[10][9]=-2./3.; mg_lb[10][10]=-2./3.;mg_lb[10][11]=2./3.;mg_lb[10][12]=2./3.;mg_lb[10][13]=-2./3.;mg_lb[10][14]=-2./3.; @@ -1618,7 +1618,7 @@ void FixLbFluid::initializeLB19(void) e[9][0] = -1; e[9][1] = 1; - e[9][2] = 0; + e[9][2] = 0; e[10][0] = -1; e[10][1] = -1; @@ -1710,7 +1710,7 @@ void FixLbFluid::initializeLB19(void) mg_lb[2][0] = 0.; mg_lb[2][1] = 0.; mg_lb[2][2] = 1.; mg_lb[2][3] = 0.; mg_lb[2][4] =-1.; mg_lb[2][5] = 0.; mg_lb[2][6] = 0.; mg_lb[2][7] = 1.; mg_lb[2][8] =-1.; mg_lb[2][9] = 1.; mg_lb[2][10]=-1.; mg_lb[2][11]= 0.; mg_lb[2][12]= 0.; mg_lb[2][13]= 0.; mg_lb[2][14]= 0.; - mg_lb[2][15]= 1.; mg_lb[2][16]= 1.; mg_lb[2][17]=-1.; mg_lb[2][18]=-1.; + mg_lb[2][15]= 1.; mg_lb[2][16]= 1.; mg_lb[2][17]=-1.; mg_lb[2][18]=-1.; mg_lb[3][0] = 0.; mg_lb[3][1] = 0.; mg_lb[3][2] = 0.; mg_lb[3][3] = 0.; mg_lb[3][4] = 0.; mg_lb[3][5] = 1.; mg_lb[3][6] =-1.; mg_lb[3][7] = 0.; mg_lb[3][8] = 0.; mg_lb[3][9] = 0.; @@ -1809,7 +1809,7 @@ void FixLbFluid::initializeLB19(void) } //========================================================================== -// Initialize the equilibrium distribution functions +// Initialize the equilibrium distribution functions // (this just uses the initial fluid parameters, and assumes no forces). //========================================================================== void FixLbFluid::initialize_feq(void) @@ -1828,13 +1828,13 @@ void FixLbFluid::initialize_feq(void) std::fill(&Ff[0][0][0][0],&Ff[0][0][0][0] + (subNbx+3)*(subNby+3)*(subNbz+3)*3,0.0); std::fill(&Fftempx[0][0][0][0],&Fftempx[0][0][0][0] + 5*(subNby+3)*(subNbz+3)*3,0.0); std::fill(&Fftempy[0][0][0][0],&Fftempy[0][0][0][0] + (subNbx+3)*5*(subNbz+3)*3,0.0); - std::fill(&Fftempz[0][0][0][0],&Fftempz[0][0][0][0] + (subNbx+3)*(subNby+3)*5*3,0.0); + std::fill(&Fftempz[0][0][0][0],&Fftempz[0][0][0][0] + (subNbx+3)*(subNby+3)*5*3,0.0); if(readrestart == 0){ step=0; parametercalc_full(); - (*this.*equilibriumdist)(1,subNbx-1,1,subNby-1,1,subNbz-1); + (*this.*equilibriumdist)(1,subNbx-1,1,subNby-1,1,subNbz-1); for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; @@ -1847,23 +1847,23 @@ void FixLbFluid::initialize_feq(void) MPI_Irecv(&feqn[0][1][1][0],1,passxf,comm->procneigh[0][0],20,world,&requests[5]); MPI_Isend(&feqn[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],20,world,&requests[6]); MPI_Irecv(&feqn[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],10,world,&requests[7]); - } + } MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][1][1][0],1,passyf,comm->procneigh[1][0],15,world,&requests[0]); - MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); + MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); if(typeLB == 2){ MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); - MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); + MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],10,world,&requests[7]); } MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&requests[0]); @@ -1875,9 +1875,9 @@ void FixLbFluid::initialize_feq(void) MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],10,world,&requests[7]); - } + } MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + //Save feqold. if(typeLB == 2){ for(i=0; i<subNbx; i++) @@ -1890,9 +1890,9 @@ void FixLbFluid::initialize_feq(void) } }else{ step = 1; - + read_restartfile(); - + if(typeLB == 2){ for(i=0; i<8; i++) requests[i]=MPI_REQUEST_NULL; @@ -1903,31 +1903,31 @@ void FixLbFluid::initialize_feq(void) MPI_Isend(&feqoldn[1][1][1][0],1,passxf,comm->procneigh[0][0],10,world,&requests[4]); MPI_Irecv(&feqoldn[0][1][1][0],1,passxf,comm->procneigh[0][0],20,world,&requests[5]); MPI_Isend(&feqoldn[subNbx-2][1][1][0],1,passxf,comm->procneigh[0][1],20,world,&requests[6]); - MPI_Irecv(&feqoldn[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],10,world,&requests[7]); + MPI_Irecv(&feqoldn[subNbx-1][1][1][0],1,passxf,comm->procneigh[0][1],10,world,&requests[7]); MPI_Waitall(8,requests,MPI_STATUS_IGNORE); - + for(i=0; i<8; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feqold[0][1][1][0],1,passyf,comm->procneigh[1][0],15,world,&requests[0]); - MPI_Irecv(&feqold[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); + MPI_Irecv(&feqold[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feqold[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feqold[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); MPI_Isend(&feqoldn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); - MPI_Irecv(&feqoldn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); + MPI_Irecv(&feqoldn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqoldn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); MPI_Irecv(&feqoldn[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],10,world,&requests[7]); MPI_Waitall(8,requests,MPI_STATUS_IGNORE); - + for(i=0; i<8; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feqold[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&requests[0]); MPI_Irecv(&feqold[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&requests[1]); MPI_Isend(&feqold[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&requests[2]); - MPI_Irecv(&feqold[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&requests[3]); + MPI_Irecv(&feqold[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&requests[3]); MPI_Isend(&feqoldn[0][0][1][0],1,passzf,comm->procneigh[2][0],10,world,&requests[4]); MPI_Irecv(&feqoldn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqoldn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); - MPI_Irecv(&feqoldn[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],10,world,&requests[7]); + MPI_Irecv(&feqoldn[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],10,world,&requests[7]); MPI_Waitall(8,requests,MPI_STATUS_IGNORE); } parametercalc_full(); @@ -1952,7 +1952,7 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i double S[2][3],std; int jj; - + double etacov[15],ghostnoise; @@ -1971,35 +1971,35 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i // Derivatives. drhox = (density_lb[iup][j][k] - density_lb[idwn][j][k])/2.0; - drhoxx = (density_lb[iup][j][k] - 2.0*density_lb[i][j][k] + + drhoxx = (density_lb[iup][j][k] - 2.0*density_lb[i][j][k] + density_lb[idwn][j][k]); drhoy = (density_lb[i][jup][k] - density_lb[i][jdwn][k])/2.0; - drhoyy = (density_lb[i][jup][k] - 2.0*density_lb[i][j][k] + + drhoyy = (density_lb[i][jup][k] - 2.0*density_lb[i][j][k] + density_lb[i][jdwn][k]); drhoz = (density_lb[i][j][kup] - density_lb[i][j][kdwn])/2.0; - drhozz = (density_lb[i][j][kup] - 2.0*density_lb[i][j][k] + + drhozz = (density_lb[i][j][kup] - 2.0*density_lb[i][j][k] + density_lb[i][j][kdwn]); // Need one-sided derivatives for the boundary of the domain, if fixed boundary // conditions are used. if(domain->periodicity[2]==0){ if(comm->myloc[2]==0 && k==1){ - drhoz = (-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k+1] - + drhoz = (-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k+1] - density_lb[i][j][k+2])/2.0; - drhozz = (-density_lb[i][j][k+3] + 4.0*density_lb[i][j][k+2] - + drhozz = (-density_lb[i][j][k+3] + 4.0*density_lb[i][j][k+2] - 5.0*density_lb[i][j][k+1] + 2.0*rho); } if(comm->myloc[2]==comm->procgrid[2]-1 && k==subNbz-2){ - drhoz = -(-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k-1] - + drhoz = -(-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k-1] - density_lb[i][j][k-2])/2.0; - drhozz = (-density_lb[i][j][k-3] + 4.0*density_lb[i][j][k-2] - + drhozz = (-density_lb[i][j][k-3] + 4.0*density_lb[i][j][k-2] - 5.0*density_lb[i][j][k-1] + 2.0*rho); } } - grs = drhox*drhox + drhoy*drhoy + drhoz*drhoz; + grs = drhox*drhox + drhoy*drhoy + drhoz*drhoz; p0 = rho*a_0-kappa_lb*rho*(drhoxx + drhoyy + drhozz); // kappa_lb is the square gradient coeff in the pressure tensor @@ -2033,7 +2033,7 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i (u_lb[i][j][k][0]*drhoz+u_lb[i][j][k][2]*drhox); Pyz = kappa_lb*drhoy*drhoz+tau*(1.0/3.0-dPdrho)* (u_lb[i][j][k][1]*drhoz+u_lb[i][j][k][2]*drhoy); - } + } Fx_w = Ff[i][j][k][0]; Fy_w = Ff[i][j][k][1]; @@ -2044,29 +2044,29 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i etacov[2] = rho*u_lb[i][j][k][1] + Fy_w*tau + rho*bodyforcey*tau; etacov[3] = rho*u_lb[i][j][k][2] + Fz_w*tau + rho*bodyforcez*tau; - etacov[4] = Pxx + rho*u_lb[i][j][k][0]*u_lb[i][j][k][0] -rho/3. + + etacov[4] = Pxx + rho*u_lb[i][j][k][0]*u_lb[i][j][k][0] -rho/3. + tau*(2.0*u_lb[i][j][k][0]*(Fx_w+rho*bodyforcex)); - etacov[5] = Pyy + rho*u_lb[i][j][k][1]*u_lb[i][j][k][1] -rho/3. + + etacov[5] = Pyy + rho*u_lb[i][j][k][1]*u_lb[i][j][k][1] -rho/3. + tau*(2.0*u_lb[i][j][k][1]*(Fy_w+rho*bodyforcey)); - etacov[6] = Pzz + rho*u_lb[i][j][k][2]*u_lb[i][j][k][2] -rho/3. + + etacov[6] = Pzz + rho*u_lb[i][j][k][2]*u_lb[i][j][k][2] -rho/3. + tau*(2.0*u_lb[i][j][k][2]*(Fz_w+rho*bodyforcez)); - etacov[7] = Pxy + rho*u_lb[i][j][k][0]*u_lb[i][j][k][1] + + etacov[7] = Pxy + rho*u_lb[i][j][k][0]*u_lb[i][j][k][1] + tau*(u_lb[i][j][k][0]*(Fy_w+rho*bodyforcey) + (Fx_w+rho*bodyforcex)*u_lb[i][j][k][1]); - etacov[8] = Pyz + rho*u_lb[i][j][k][1]*u_lb[i][j][k][2] + + etacov[8] = Pyz + rho*u_lb[i][j][k][1]*u_lb[i][j][k][2] + tau*(u_lb[i][j][k][1]*(Fz_w+rho*bodyforcez) + (Fy_w+rho*bodyforcey)*u_lb[i][j][k][2]); - etacov[9] = Pxz + rho*u_lb[i][j][k][0]*u_lb[i][j][k][2] + + etacov[9] = Pxz + rho*u_lb[i][j][k][0]*u_lb[i][j][k][2] + tau*(u_lb[i][j][k][0]*(Fz_w+rho*bodyforcez) + (Fx_w+rho*bodyforcex)*u_lb[i][j][k][2]); - etacov[10] = 0.0; - etacov[11] = 0.0; + etacov[10] = 0.0; + etacov[11] = 0.0; etacov[12] = 0.0; etacov[13] = rho*u_lb[i][j][k][0]*u_lb[i][j][k][1]*u_lb[i][j][k][2]; const double TrP = Pxx+Pyy+Pzz; etacov[14] = K_0*(rho-TrP); - + for (l=0; l<15; l++) { feq[i][j][k][l] = 0.0; - for (int ii=0; ii<15; ii++) + for (int ii=0; ii<15; ii++) feq[i][j][k][l] += w_lb[l]*mg_lb[ii][l]*etacov[ii]*Ng_lb[ii]; if(typeLB == 2){ @@ -2080,7 +2080,7 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i for(jj=0; jj<3; jj++) S[0][jj] = std*random->gaussian(); for(jj=0; jj<3; jj++) - S[1][jj] = std*random->gaussian(); + S[1][jj] = std*random->gaussian(); etacov[4] = (S[0][0]*sqrt(3.0-3.0*a_0)); etacov[5] = ((1.0-3.0*a_0)*S[0][0]/sqrt(3.0-3.0*a_0)+ @@ -2099,15 +2099,15 @@ void FixLbFluid::equilibriumdist15(int xstart, int xend, int ystart, int yend, i for (l=0; l<15; l++) { ghostnoise = w_lb[l]* - (mg_lb[4][l]*etacov[4]*Ng_lb[4] + mg_lb[5][l]*etacov[5]*Ng_lb[5] + - mg_lb[6][l]*etacov[6]*Ng_lb[6] + mg_lb[7][l]*etacov[7]*Ng_lb[7] + - mg_lb[8][l]*etacov[8]*Ng_lb[8] + mg_lb[9][l]*etacov[9]*Ng_lb[9] + + (mg_lb[4][l]*etacov[4]*Ng_lb[4] + mg_lb[5][l]*etacov[5]*Ng_lb[5] + + mg_lb[6][l]*etacov[6]*Ng_lb[6] + mg_lb[7][l]*etacov[7]*Ng_lb[7] + + mg_lb[8][l]*etacov[8]*Ng_lb[8] + mg_lb[9][l]*etacov[9]*Ng_lb[9] + mg_lb[10][l]*etacov[10]*Ng_lb[10] + mg_lb[11][l]*etacov[11]*Ng_lb[11] + mg_lb[12][l]*etacov[12]*Ng_lb[12] + mg_lb[13][l]*etacov[13]*Ng_lb[13] + mg_lb[14][l]*etacov[14]*Ng_lb[14]); feq[i][j][k][l] += ghostnoise*noisefactor; } - } + } } } } @@ -2131,7 +2131,7 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i double S[2][3],std; int jj; - + double etacov[19],ghostnoise; for (i=xstart; i<xend; i++) { @@ -2149,35 +2149,35 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i // Derivatives. drhox = (density_lb[iup][j][k] - density_lb[idwn][j][k])/2.0; - drhoxx = (density_lb[iup][j][k] - 2.0*density_lb[i][j][k] + + drhoxx = (density_lb[iup][j][k] - 2.0*density_lb[i][j][k] + density_lb[idwn][j][k]); drhoy = (density_lb[i][jup][k] - density_lb[i][jdwn][k])/2.0; - drhoyy = (density_lb[i][jup][k] - 2.0*density_lb[i][j][k] + + drhoyy = (density_lb[i][jup][k] - 2.0*density_lb[i][j][k] + density_lb[i][jdwn][k]); drhoz = (density_lb[i][j][kup] - density_lb[i][j][kdwn])/2.0; - drhozz = (density_lb[i][j][kup] - 2.0*density_lb[i][j][k] + + drhozz = (density_lb[i][j][kup] - 2.0*density_lb[i][j][k] + density_lb[i][j][kdwn]); // Need one-sided derivatives for the boundary of the domain, if fixed boundary // conditions are used. if(domain->periodicity[2]==0){ if(comm->myloc[2]==0 && k==1){ - drhoz = (-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k+1] - + drhoz = (-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k+1] - density_lb[i][j][k+2])/2.0; - drhozz = (-density_lb[i][j][k+3] + 4.0*density_lb[i][j][k+2] - + drhozz = (-density_lb[i][j][k+3] + 4.0*density_lb[i][j][k+2] - 5.0*density_lb[i][j][k+1] + 2.0*rho); } if(comm->myloc[2]==comm->procgrid[2]-1 && k==subNbz-2){ - drhoz = -(-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k-1] - + drhoz = -(-3.0*density_lb[i][j][k] + 4.0*density_lb[i][j][k-1] - density_lb[i][j][k-2])/2.0; - drhozz = (-density_lb[i][j][k-3] + 4.0*density_lb[i][j][k-2] - + drhozz = (-density_lb[i][j][k-3] + 4.0*density_lb[i][j][k-2] - 5.0*density_lb[i][j][k-1] + 2.0*rho); } } - grs = drhox*drhox + drhoy*drhoy + drhoz*drhoz; + grs = drhox*drhox + drhoy*drhoy + drhoz*drhoz; p0 = rho*a_0-kappa_lb*rho*(drhoxx + drhoyy + drhozz); // kappa_lb is the square gradient coeff in the pressure tensor @@ -2211,7 +2211,7 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i (u_lb[i][j][k][0]*drhoz+u_lb[i][j][k][2]*drhox); Pyz = kappa_lb*drhoy*drhoz+tau*(1.0/3.0-dPdrho)* (u_lb[i][j][k][1]*drhoz+u_lb[i][j][k][2]*drhoy); - } + } Fx_w = Ff[i][j][k][0]; Fy_w = Ff[i][j][k][1]; @@ -2222,20 +2222,20 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i etacov[2] = rho*u_lb[i][j][k][1] + Fy_w*tau + rho*bodyforcey*tau; etacov[3] = rho*u_lb[i][j][k][2] + Fz_w*tau + rho*bodyforcez*tau; - etacov[4] = Pxx + rho*u_lb[i][j][k][0]*u_lb[i][j][k][0] -rho/3. + + etacov[4] = Pxx + rho*u_lb[i][j][k][0]*u_lb[i][j][k][0] -rho/3. + tau*(2.0*u_lb[i][j][k][0]*(Fx_w+rho*bodyforcex)); - etacov[5] = Pyy + rho*u_lb[i][j][k][1]*u_lb[i][j][k][1] -rho/3. + + etacov[5] = Pyy + rho*u_lb[i][j][k][1]*u_lb[i][j][k][1] -rho/3. + tau*(2.0*u_lb[i][j][k][1]*(Fy_w+rho*bodyforcey)); - etacov[6] = Pzz + rho*u_lb[i][j][k][2]*u_lb[i][j][k][2] -rho/3. + + etacov[6] = Pzz + rho*u_lb[i][j][k][2]*u_lb[i][j][k][2] -rho/3. + tau*(2.0*u_lb[i][j][k][2]*(Fz_w+rho*bodyforcez)); - etacov[7] = Pxy + rho*u_lb[i][j][k][0]*u_lb[i][j][k][1] + + etacov[7] = Pxy + rho*u_lb[i][j][k][0]*u_lb[i][j][k][1] + tau*(u_lb[i][j][k][0]*(Fy_w+rho*bodyforcey) + (Fx_w+rho*bodyforcex)*u_lb[i][j][k][1]); - etacov[8] = Pxz + rho*u_lb[i][j][k][0]*u_lb[i][j][k][2] + + etacov[8] = Pxz + rho*u_lb[i][j][k][0]*u_lb[i][j][k][2] + tau*(u_lb[i][j][k][0]*(Fz_w+rho*bodyforcez) + (Fx_w+rho*bodyforcex)*u_lb[i][j][k][2]); - etacov[9] = Pyz + rho*u_lb[i][j][k][1]*u_lb[i][j][k][2] + + etacov[9] = Pyz + rho*u_lb[i][j][k][1]*u_lb[i][j][k][2] + tau*(u_lb[i][j][k][1]*(Fz_w+rho*bodyforcez) + (Fy_w+rho*bodyforcey)*u_lb[i][j][k][2]); - etacov[10] = 0.0; - etacov[11] = 0.0; + etacov[10] = 0.0; + etacov[11] = 0.0; etacov[12] = 0.0; etacov[13] = 0.0; etacov[14] = 0.0; @@ -2243,11 +2243,11 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i etacov[16] = 0.0; etacov[17] = 0.0; etacov[18] = 0.0; - + for (l=0; l<19; l++) { feq[i][j][k][l] = 0.0; - for (int ii=0; ii<19; ii++) + for (int ii=0; ii<19; ii++) feq[i][j][k][l] += w_lb[l]*mg_lb[ii][l]*etacov[ii]*Ng_lb[ii]; if(typeLB == 2){ @@ -2261,7 +2261,7 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i for(jj=0; jj<3; jj++) S[0][jj] = std*random->gaussian(); for(jj=0; jj<3; jj++) - S[1][jj] = std*random->gaussian(); + S[1][jj] = std*random->gaussian(); etacov[4] = (S[0][0]*sqrt(3.0-3.0*a_0)); etacov[5] = ((1.0-3.0*a_0)*S[0][0]/sqrt(3.0-3.0*a_0)+ @@ -2276,12 +2276,12 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i for (l=10; l<19; l++) { etacov[l] = sqrt(9.0*namp*rho/Ng_lb[l])*random->gaussian(); } - + for (l=0; l<19; l++) { ghostnoise = w_lb[l]* - (mg_lb[4][l]*etacov[4]*Ng_lb[4] + mg_lb[5][l]*etacov[5]*Ng_lb[5] + - mg_lb[6][l]*etacov[6]*Ng_lb[6] + mg_lb[7][l]*etacov[7]*Ng_lb[7] + - mg_lb[8][l]*etacov[8]*Ng_lb[8] + mg_lb[9][l]*etacov[9]*Ng_lb[9] + + (mg_lb[4][l]*etacov[4]*Ng_lb[4] + mg_lb[5][l]*etacov[5]*Ng_lb[5] + + mg_lb[6][l]*etacov[6]*Ng_lb[6] + mg_lb[7][l]*etacov[7]*Ng_lb[7] + + mg_lb[8][l]*etacov[8]*Ng_lb[8] + mg_lb[9][l]*etacov[9]*Ng_lb[9] + mg_lb[10][l]*etacov[10]*Ng_lb[10] + mg_lb[11][l]*etacov[11]*Ng_lb[11] + mg_lb[12][l]*etacov[12]*Ng_lb[12] + mg_lb[13][l]*etacov[13]*Ng_lb[13] + mg_lb[14][l]*etacov[14]*Ng_lb[14] + mg_lb[15][l]*etacov[15]*Ng_lb[15] @@ -2290,7 +2290,7 @@ void FixLbFluid::equilibriumdist19(int xstart, int xend, int ystart, int yend, i feq[i][j][k][l] += ghostnoise*noisefactor; } } - + } } } @@ -2309,7 +2309,7 @@ void FixLbFluid::parametercalc_full(void) //-------------------------------------------------------------------------- // send the boundaries of f_lb, as they will be needed later by the update - // routine, and use these to calculate the density and velocity on the + // routine, and use these to calculate the density and velocity on the // boundary. //-------------------------------------------------------------------------- for(i=0; i<4; i++) @@ -2324,7 +2324,7 @@ void FixLbFluid::parametercalc_full(void) for(i=0; i<4; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&f_lb[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[0]); - MPI_Irecv(&f_lb[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[1]); + MPI_Irecv(&f_lb[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[1]); MPI_Isend(&f_lb[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[2]); MPI_Irecv(&f_lb[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],10,world,&requests[3]); parametercalc_part(0,1,1,subNby-1,1,subNbz-1); @@ -2340,12 +2340,12 @@ void FixLbFluid::parametercalc_full(void) parametercalc_part(0,subNbx,0,1,1,subNbz-1); parametercalc_part(0,subNbx,subNby-1,subNby,1,subNbz-1); MPI_Waitall(4,requests,MPI_STATUS_IGNORE); - + parametercalc_part(0,subNbx,0,subNby,0,1); parametercalc_part(0,subNbx,0,subNby,subNbz-1,subNbz); //-------------------------------------------------------------------------- - // Send the remaining portions of the u array (and density array if Gamma + // Send the remaining portions of the u array (and density array if Gamma // is set the default way). //-------------------------------------------------------------------------- if(setGamma == 0) numrequests = 12; @@ -2413,7 +2413,7 @@ void FixLbFluid::parametercalc_full(void) MPI_Irecv(&density_lb[0][0][subNbz+1],1,passzrho,comm->procneigh[2][1],50,world,&requests2[requestcount+2]); requestcount=requestcount+3; } - } + } MPI_Waitall(requestcount,requests2,MPI_STATUS_IGNORE); } @@ -2435,15 +2435,15 @@ void FixLbFluid::parametercalc_part(int xstart, int xend, int ystart, int yend, u_lb[i][j][k][1]=0.0; u_lb[i][j][k][2]=0.0; for (m=0; m<numvel; m++) { - + density_lb[i][j][k] += f_lb[i][j][k][m]; - + u_lb[i][j][k][0] += f_lb[i][j][k][m]*e[m][0]; u_lb[i][j][k][1] += f_lb[i][j][k][m]*e[m][1]; u_lb[i][j][k][2] += f_lb[i][j][k][m]*e[m][2]; - + } - + //For the on-lattice wall scheme, need to set this velocity to zero. if(domain->periodicity[2]==0){ if(comm->myloc[2]==0){ @@ -2456,20 +2456,20 @@ void FixLbFluid::parametercalc_part(int xstart, int xend, int ystart, int yend, u_lb[i][j][k][2]=0.0; } } - + } - + u_lb[i][j][k][0]=u_lb[i][j][k][0]/density_lb[i][j][k]; u_lb[i][j][k][1]=u_lb[i][j][k][1]/density_lb[i][j][k]; u_lb[i][j][k][2]=u_lb[i][j][k][2]/density_lb[i][j][k]; } } } - + } //========================================================================== -// Update the distribution function over a simulation volume specified +// Update the distribution function over a simulation volume specified // by xstart,xend; ystart,yend; zstart,zend. //========================================================================== void FixLbFluid::update_periodic(int xstart, int xend, int ystart, int yend, int zstart, int zend) @@ -2480,7 +2480,7 @@ void FixLbFluid::update_periodic(int xstart, int xend, int ystart, int yend, int for(i=xstart; i<xend; i++) for(j=ystart; j<yend; j++) for(k=zstart; k<zend; k++){ - + if(typeLB==1){ for(m=0; m<numvel; m++){ imod = i-e[m][0]; @@ -2488,16 +2488,16 @@ void FixLbFluid::update_periodic(int xstart, int xend, int ystart, int yend, int kmod = k-e[m][2]; fnew[i][j][k][m] = f_lb[imod][jmod][kmod][m] + (feq[imod][jmod][kmod][m]-f_lb[imod][jmod][kmod][m])/tau; - } + } }else if(typeLB==2){ for(m=0; m<numvel; m++){ imod = i-e[m][0]; jmod = j-e[m][1]; kmod = k-e[m][2]; - + fnew[i][j][k][m] = feq[imod][jmod][kmod][m] + (f_lb[imod][jmod][kmod][m] - feq[imod][jmod][kmod][m])*expminusdtovertau; } - + fnew[i][j][k][0]+=Dcoeff*(feq[i][j][k][0]-feqold[i][j][k][0]); for(m=1; m<numvel; m++){ imod = i-e[m][0]; @@ -2506,13 +2506,13 @@ void FixLbFluid::update_periodic(int xstart, int xend, int ystart, int yend, int imodm = i+e[m][0]; jmodm = j+e[m][1]; kmodm = k+e[m][2]; - + fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))* (feqn[imodm][jmodm][kmodm][m] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); } - } - } + } + } } //========================================================================== @@ -2596,8 +2596,8 @@ void FixLbFluid::streamout(void) for(k=0; k<Nbz; k++){ printf("%16.12f %16.12f %16.12f %16.12f\n",altogether[i][j][k][0]*dm_lb/dx_lb/dx_lb/dx_lb,altogether[i][j][k][1]*dx_lb/dt_lb,altogether[i][j][k][2]*dx_lb/dt_lb,altogether[i][j][k][3]*dx_lb/dt_lb); } - - + + } else { istart=comm->myloc[0]*(subNbx-2); jstart=comm->myloc[1]*(subNby-2); @@ -2631,7 +2631,7 @@ void FixLbFluid::streamout(void) buf[0][0][1][2]=kend; MPI_Isend(&buf[0][0][0][0],size,MPI_DOUBLE,0,0,world,&request_send); - MPI_Wait(&request_send,&status); + MPI_Wait(&request_send,&status); } } @@ -2642,7 +2642,7 @@ void FixLbFluid::streamout(void) //========================================================================== void FixLbFluid::update_full15(void) { - + MPI_Request req_send15,req_recv15; MPI_Request req_send25,req_recv25; MPI_Request requests[8]; @@ -2662,12 +2662,12 @@ void FixLbFluid::update_full15(void) }else{ numrequests = 8; } - + //-------------------------------------------------------------------------- // Fixed z boundary conditions. //-------------------------------------------------------------------------- - if(domain->periodicity[2]==0){ - + if(domain->periodicity[2]==0){ + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[1][1][1][0],1,passxf,comm->procneigh[0][0],15,world,&requests[0]); @@ -2687,19 +2687,19 @@ void FixLbFluid::update_full15(void) for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][1][1][0],1,passyf,comm->procneigh[1][0],15,world,&requests[0]); - MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); + MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); if(typeLB == 2){ MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); - MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); + MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],10,world,&requests[7]); } update_periodic(1,2,2,subNby-2,2,subNbz-2); update_periodic(subNbx-2,subNbx-1,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&requests[0]); @@ -2711,7 +2711,7 @@ void FixLbFluid::update_full15(void) MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],10,world,&requests[7]); - } + } update_periodic(1,subNbx-1,1,2,2,subNbz-2); update_periodic(1,subNbx-1,subNby-2,subNby-1,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); @@ -2728,7 +2728,7 @@ void FixLbFluid::update_full15(void) imod = i-e[m][0]; jmod = j-e[m][1]; kmod = k-e[m][2]; - + fnew[i][j][k][m] = feq[imod][jmod][kmod][m] + (f_lb[imod][jmod][kmod][m]-feq[imod][jmod][kmod][m])*expminusdtovertau; } @@ -2739,9 +2739,9 @@ void FixLbFluid::update_full15(void) imodm = i+e[m][0]; jmodm = j+e[m][1]; kmodm = k+e[m][2]; - + if(m==5) - fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][6] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][6] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqoldn[imod][jmod][kmod][m] - feqoldn[imod][jmod][kmod][6] - feqn[imod][jmod][kmod][6]); else if(m==7) fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][11] - feqold[imod][jmod][kmod][m]) + @@ -2760,23 +2760,23 @@ void FixLbFluid::update_full15(void) (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][5] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==11) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m]-feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][7] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][7] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==12) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m]-feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][8] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][8] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==13) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m]-feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][9] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][9] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==14) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m]-feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][10] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][10] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else - fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqn[imodm][jmodm][kmodm][m] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); } } - } + } }else{ update_periodic(1,subNbx-1,1,subNby-1,1,2); } @@ -2790,7 +2790,7 @@ void FixLbFluid::update_full15(void) kmod = k-e[m][2]; fnew[i][j][k][m] = feq[imod][jmod][kmod][m] + (f_lb[imod][jmod][kmod][m]-feq[imod][jmod][kmod][m])*expminusdtovertau; - } + } for(m=0; m<15; m++){ imod = i-e[m][0]; jmod = j-e[m][1]; @@ -2798,9 +2798,9 @@ void FixLbFluid::update_full15(void) imodm = i+e[m][0]; jmodm = j+e[m][1]; kmodm = k+e[m][2]; - + if(m==6) - fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][5] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][5] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqoldn[imod][jmod][kmod][m] - feqoldn[imod][jmod][kmod][5] - feqn[imod][jmod][kmod][5]); else if(m==11) fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][7] - feqold[imod][jmod][kmod][m]) + @@ -2819,20 +2819,20 @@ void FixLbFluid::update_full15(void) (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][6] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==7) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][11] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][11] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==8) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][12] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][12] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==9) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][13] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][13] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==10) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][14] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][14] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else - fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqn[imodm][jmodm][kmodm][m] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); - + } } } @@ -2841,17 +2841,17 @@ void FixLbFluid::update_full15(void) update_periodic(1,subNbx-1,1,subNby-1,subNbz-2,subNbz-1); } } - + req_send15=MPI_REQUEST_NULL; req_recv25=MPI_REQUEST_NULL; req_send25=MPI_REQUEST_NULL; req_recv15=MPI_REQUEST_NULL; - + if(comm->myloc[2]==0){ MPI_Isend(&fnew[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&req_send15); MPI_Irecv(&fnew[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&req_recv25); } - + if(comm->myloc[2]==comm->procgrid[2]-1){ MPI_Isend(&fnew[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&req_send25); MPI_Irecv(&fnew[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&req_recv15); @@ -2859,18 +2859,18 @@ void FixLbFluid::update_full15(void) if(comm->myloc[2]==0){ MPI_Wait(&req_send15,&status); MPI_Wait(&req_recv25,&status); - + for(i=1;i<subNbx-1;i++){ for(j=1;j<subNby-1;j++){ k=1; if(typeLB == 1){ fnew[i][j][k][5]=fnew[i][j][k-1][6]; - tmp1=fnew[i][j][k-1][11]+fnew[i][j][k-1][12]+fnew[i][j][k-1][13]+fnew[i][j][k-1][14]; + tmp1=fnew[i][j][k-1][11]+fnew[i][j][k-1][12]+fnew[i][j][k-1][13]+fnew[i][j][k-1][14]; } else{ fnew[i][j][k][5]=fnew[i][j][k-1][6] + (0.5-Dcoeff*(tau+0.5))*feqn[i][j][k+1][5]; - tmp1=fnew[i][j][k-1][11]+fnew[i][j][k-1][12]+fnew[i][j][k-1][13]+fnew[i][j][k-1][14] + - (0.5-Dcoeff*(tau+0.5))*(feqn[i-1][j-1][k+1][7] + feqn[i+1][j-1][k+1][8] + + tmp1=fnew[i][j][k-1][11]+fnew[i][j][k-1][12]+fnew[i][j][k-1][13]+fnew[i][j][k-1][14] + + (0.5-Dcoeff*(tau+0.5))*(feqn[i-1][j-1][k+1][7] + feqn[i+1][j-1][k+1][8] + feqn[i+1][j+1][k+1][9] + feqn[i-1][j+1][k+1][10]); } @@ -2888,7 +2888,7 @@ void FixLbFluid::update_full15(void) rb=fnew[i][j][k][0]+fnew[i][j][k][1]+fnew[i][j][k][2]+fnew[i][j][k][3]+fnew[i][j][k][4]+ fnew[i][j][k][5]+fnew[i][j][k][6]+tmp1+fnew[i][j][k][11]+fnew[i][j][k][12]+ fnew[i][j][k][13]+fnew[i][j][k][14]; - + fnew[i][j][k][7] += 0.25*rb*vwbt; fnew[i][j][k][8] += 0.25*rb*vwbt; fnew[i][j][k][9] += -0.25*rb*vwbt; @@ -2900,22 +2900,22 @@ void FixLbFluid::update_full15(void) if(comm->myloc[2]==comm->procgrid[2]-1){ MPI_Wait(&req_send25,&status); MPI_Wait(&req_recv15,&status); - + for(i=1;i<subNbx-1;i++){ for(j=1;j<subNby-1;j++){ k=subNbz-2; - + if(typeLB == 1){ fnew[i][j][k][6]=fnew[i][j][k+1][5]; tmp1=fnew[i][j][k+1][7]+fnew[i][j][k+1][8]+fnew[i][j][k+1][9]+fnew[i][j][k+1][10]; } else{ fnew[i][j][k][6]=fnew[i][j][k+1][5] + (0.5-Dcoeff*(tau+0.5))*feqn[i][j][k-1][6]; - tmp1=fnew[i][j][k+1][7]+fnew[i][j][k+1][8]+fnew[i][j][k+1][9]+fnew[i][j][k+1][10] + - (0.5-Dcoeff*(tau+0.5))*(feqn[i-1][j-1][k-1][11] + feqn[i+1][j-1][k-1][12] + + tmp1=fnew[i][j][k+1][7]+fnew[i][j][k+1][8]+fnew[i][j][k+1][9]+fnew[i][j][k+1][10] + + (0.5-Dcoeff*(tau+0.5))*(feqn[i-1][j-1][k-1][11] + feqn[i+1][j-1][k-1][12] + feqn[i+1][j+1][k-1][13] + feqn[i-1][j+1][k-1][14]); } - + fnew[i][j][k][11]=-0.25*(fnew[i][j][k][1]+fnew[i][j][k][2]-fnew[i][j][k][3]- fnew[i][j][k][4]+2.0*fnew[i][j][k][7]-2.0*fnew[i][j][k][9]-tmp1); fnew[i][j][k][12]=0.25*(fnew[i][j][k][1]-fnew[i][j][k][2]-fnew[i][j][k][3]+ @@ -2925,19 +2925,19 @@ void FixLbFluid::update_full15(void) fnew[i][j][k][14]=-0.25*(fnew[i][j][k][1]-fnew[i][j][k][2]-fnew[i][j][k][3]+ fnew[i][j][k][4]-2.0*fnew[i][j][k][8]+2.0*fnew[i][j][k][10]-tmp1); - + rb=fnew[i][j][k][0]+fnew[i][j][k][1]+fnew[i][j][k][2]+fnew[i][j][k][3]+fnew[i][j][k][4]+ fnew[i][j][k][5]+fnew[i][j][k][6]+fnew[i][j][k][7]+fnew[i][j][k][8]+fnew[i][j][k][9]+ fnew[i][j][k][10]+tmp1; - + fnew[i][j][k][11] += 0.25*rb*vwtp; fnew[i][j][k][12] += 0.25*rb*vwtp; fnew[i][j][k][13] += -0.25*rb*vwtp; fnew[i][j][k][14] += -0.25*rb*vwtp; } - } + } } - + //-------------------------------------------------------------------------- // Periodic z boundary conditions. //-------------------------------------------------------------------------- @@ -2961,12 +2961,12 @@ void FixLbFluid::update_full15(void) for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][1][1][0],1,passyf,comm->procneigh[1][0],15,world,&requests[0]); - MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); + MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); if(typeLB == 2){ MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); - MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); + MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],10,world,&requests[7]); } @@ -2985,15 +2985,15 @@ void FixLbFluid::update_full15(void) MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],10,world,&requests[7]); - } + } update_periodic(1,subNbx-1,1,2,2,subNbz-2); update_periodic(1,subNbx-1,subNby-2,subNby-1,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + update_periodic(1,subNbx-1,1,subNby-1,1,2); update_periodic(1,subNbx-1,1,subNby-1,subNbz-2,subNbz-1); } - + } //========================================================================== @@ -3002,7 +3002,7 @@ void FixLbFluid::update_full15(void) //========================================================================== void FixLbFluid::update_full19(void) { - + MPI_Request req_send15,req_recv15; MPI_Request req_send25,req_recv25; MPI_Request requests[8]; @@ -3013,7 +3013,7 @@ void FixLbFluid::update_full19(void) int i,j,k,m; int imod,jmod,kmod; int imodm,jmodm,kmodm; - + //-------------------------------------------------------------------------- // If using the standard LB integrator, do not need to send info about feqn. //-------------------------------------------------------------------------- @@ -3022,12 +3022,12 @@ void FixLbFluid::update_full19(void) }else{ numrequests = 8; } - + //-------------------------------------------------------------------------- // Fixed z boundary conditions. //-------------------------------------------------------------------------- - if(domain->periodicity[2]==0){ - + if(domain->periodicity[2]==0){ + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[1][1][1][0],1,passxf,comm->procneigh[0][0],15,world,&requests[0]); @@ -3042,23 +3042,23 @@ void FixLbFluid::update_full19(void) } update_periodic(2,subNbx-2,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][1][1][0],1,passyf,comm->procneigh[1][0],15,world,&requests[0]); - MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); + MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); if(typeLB == 2){ MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); - MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); + MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],10,world,&requests[7]); } update_periodic(1,2,2,subNby-2,2,subNbz-2); update_periodic(subNbx-2,subNbx-1,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&requests[0]); @@ -3070,11 +3070,11 @@ void FixLbFluid::update_full19(void) MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],10,world,&requests[7]); - } + } update_periodic(1,subNbx-1,1,2,2,subNbz-2); update_periodic(1,subNbx-1,subNby-2,subNby-1,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + if(typeLB==1){ update_periodic(1,subNbx-1,1,subNby-1,1,2); update_periodic(1,subNbx-1,1,subNby-1,subNbz-2,subNbz-1); @@ -3087,10 +3087,10 @@ void FixLbFluid::update_full19(void) imod = i-e[m][0]; jmod = j-e[m][1]; kmod = k-e[m][2]; - + fnew[i][j][k][m] = feq[imod][jmod][kmod][m] + (f_lb[imod][jmod][kmod][m]-feq[imod][jmod][kmod][m])*expminusdtovertau; } - + for(m=0; m<19; m++){ imod = i-e[m][0]; jmod = j-e[m][1]; @@ -3098,9 +3098,9 @@ void FixLbFluid::update_full19(void) imodm = i+e[m][0]; jmodm = j+e[m][1]; kmodm = k+e[m][2]; - + if(m==5) - fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][6] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][6] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqoldn[imod][jmod][kmod][m] - feqoldn[imod][jmod][kmod][6] - feqn[imod][jmod][kmod][6]); else if(m==11) fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][12] - feqold[imod][jmod][kmod][m]) + @@ -3130,11 +3130,11 @@ void FixLbFluid::update_full19(void) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][17] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else - fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqn[imodm][jmodm][kmodm][m] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); } } - } + } }else{ update_periodic(1,subNbx-1,1,subNby-1,1,2); } @@ -3146,9 +3146,9 @@ void FixLbFluid::update_full19(void) imod = i-e[m][0]; jmod = j-e[m][1]; kmod = k-e[m][2]; - + fnew[i][j][k][m] = feq[imod][jmod][kmod][m] + (f_lb[imod][jmod][kmod][m]-feq[imod][jmod][kmod][m])*expminusdtovertau; - } + } for(m=0; m<19; m++){ imod = i-e[m][0]; jmod = j-e[m][1]; @@ -3156,40 +3156,40 @@ void FixLbFluid::update_full19(void) imodm = i+e[m][0]; jmodm = j+e[m][1]; kmodm = k+e[m][2]; - + if(m==6) - fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][5] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][5] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqoldn[imod][jmod][kmod][m] - feqoldn[imod][jmod][kmod][5] - feqn[imod][jmod][kmod][5]); else if(m==12) - fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][11] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][11] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqoldn[imod][jmod][kmod][m] - feqoldn[imod][jmod][kmod][11] - feqn[imod][jmod][kmod][11]); else if(m==14) - fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][13] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][13] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqoldn[imod][jmod][kmod][m] - feqoldn[imod][jmod][kmod][13] - feqn[imod][jmod][kmod][13]); else if(m==16) - fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][15] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][15] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqoldn[imod][jmod][kmod][m] - feqoldn[imod][jmod][kmod][15] - feqn[imod][jmod][kmod][15]); else if(m==18) - fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][17] - feqold[imod][jmod][kmod][m]) + + fnew[i][j][k][m] += Dcoeff*(feq[imod][jmod][kmod][17] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqoldn[imod][jmod][kmod][m] - feqoldn[imod][jmod][kmod][17] - feqn[imod][jmod][kmod][17]); else if(m==5) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][6] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][6] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==11) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][12] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][12] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==13) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][14] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][14] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==15) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][16] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else if(m==17) fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][18] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i][j][k][18] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); else - fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + - (0.5-Dcoeff*(tau+0.5))*(feqn[imodm][jmodm][kmodm][m] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); + fnew[i][j][k][m] += Dcoeff*(feq[i][j][k][m] - feqold[imod][jmod][kmod][m]) + + (0.5-Dcoeff*(tau+0.5))*(feqn[imodm][jmodm][kmodm][m] - feqoldn[i][j][k][m] - feqn[i][j][k][m] + feqoldn[imod][jmod][kmod][m]); } } } @@ -3198,17 +3198,17 @@ void FixLbFluid::update_full19(void) update_periodic(1,subNbx-1,1,subNby-1,subNbz-2,subNbz-1); } } - + req_send15=MPI_REQUEST_NULL; req_recv25=MPI_REQUEST_NULL; req_send25=MPI_REQUEST_NULL; req_recv15=MPI_REQUEST_NULL; - + if(comm->myloc[2]==0){ MPI_Isend(&fnew[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&req_send15); MPI_Irecv(&fnew[0][0][0][0],1,passzf,comm->procneigh[2][0],25,world,&req_recv25); } - + if(comm->myloc[2]==comm->procgrid[2]-1){ MPI_Isend(&fnew[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],25,world,&req_send25); MPI_Irecv(&fnew[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],15,world,&req_recv15); @@ -3216,11 +3216,11 @@ void FixLbFluid::update_full19(void) if(comm->myloc[2]==0){ MPI_Wait(&req_send15,&status); MPI_Wait(&req_recv25,&status); - + for(i=1;i<subNbx-1;i++){ for(j=1;j<subNby-1;j++){ k=1; - + if(typeLB == 1){ fnew[i][j][k][5]=fnew[i][j][k-1][6]; tmp1=fnew[i][j][k-1][12]+fnew[i][j][k-1][14]+fnew[i][j][k-1][16]+fnew[i][j][k-1][18]; @@ -3228,36 +3228,36 @@ void FixLbFluid::update_full19(void) else{ fnew[i][j][k][5]=fnew[i][j][k-1][6] + (0.5-Dcoeff*(tau+0.5))*feqn[i][j][k+1][5]; tmp1=fnew[i][j][k-1][12]+fnew[i][j][k-1][14]+fnew[i][j][k-1][16]+fnew[i][j][k-1][18] + - (0.5-Dcoeff*(tau+0.5))*(feqn[i-1][j][k+1][11] + feqn[i+1][j][k+1][13] + - feqn[i][j-1][k+1][15] + feqn[i][j+1][k+1][17]); + (0.5-Dcoeff*(tau+0.5))*(feqn[i-1][j][k+1][11] + feqn[i+1][j][k+1][13] + + feqn[i][j-1][k+1][15] + feqn[i][j+1][k+1][17]); } - + tmp2=fnew[i][j][k][3]+fnew[i][j][k][9]+fnew[i][j][k][10]+fnew[i][j][k][14]- fnew[i][j][k][1]-fnew[i][j][k][7]-fnew[i][j][k][8]-fnew[i][j][k][12]; - + rb=fnew[i][j][k][0]+fnew[i][j][k][1]+fnew[i][j][k][2]+fnew[i][j][k][3]+fnew[i][j][k][4]+ fnew[i][j][k][5]+fnew[i][j][k][6]+fnew[i][j][k][7]+fnew[i][j][k][8]+fnew[i][j][k][9]+ fnew[i][j][k][10]+fnew[i][j][k][12]+fnew[i][j][k][14]+fnew[i][j][k][16]+fnew[i][j][k][18]+tmp1; - + tmp3=rb*vwbt-fnew[i][j][k][2]+fnew[i][j][k][4]-fnew[i][j][k][7]+fnew[i][j][k][8]-fnew[i][j][k][9]+ fnew[i][j][k][10]-fnew[i][j][k][16]+fnew[i][j][k][18]; - + fnew[i][j][k][11] = 0.25*(tmp1+2.0*tmp2); fnew[i][j][k][13] = 0.25*(tmp1-2.0*tmp2); fnew[i][j][k][15] = 0.25*(tmp1+2.0*tmp3); fnew[i][j][k][17] = 0.25*(tmp1-2.0*tmp3); } } - + } if(comm->myloc[2]==comm->procgrid[2]-1){ MPI_Wait(&req_send25,&status); MPI_Wait(&req_recv15,&status); - + for(i=1;i<subNbx-1;i++){ for(j=1;j<subNby-1;j++){ k=subNbz-2; - + if(typeLB == 1){ fnew[i][j][k][6]=fnew[i][j][k+1][5]; tmp1=fnew[i][j][k+1][11]+fnew[i][j][k+1][13]+fnew[i][j][k+1][15]+fnew[i][j][k+1][17]; @@ -3265,33 +3265,33 @@ void FixLbFluid::update_full19(void) else{ fnew[i][j][k][6]=fnew[i][j][k+1][5] + (0.5-Dcoeff*(tau+0.5))*feqn[i][j][k-1][6]; tmp1=fnew[i][j][k+1][11]+fnew[i][j][k+1][13]+fnew[i][j][k+1][15]+fnew[i][j][k+1][17] + - (0.5-Dcoeff*(tau+0.5))*(feqn[i-1][j][k-1][12] + feqn[i+1][j][k-1][14] + + (0.5-Dcoeff*(tau+0.5))*(feqn[i-1][j][k-1][12] + feqn[i+1][j][k-1][14] + feqn[i][j-1][k-1][16] + feqn[i][j+1][k-1][18]); } - + tmp2=fnew[i][j][k][3]+fnew[i][j][k][9]+fnew[i][j][k][10]+fnew[i][j][k][13]-fnew[i][j][k][1]- fnew[i][j][k][7]-fnew[i][j][k][8]-fnew[i][j][k][11]; - + rb=fnew[i][j][k][0]+fnew[i][j][k][1]+fnew[i][j][k][2]+fnew[i][j][k][3]+fnew[i][j][k][4]+ fnew[i][j][k][5]+fnew[i][j][k][6]+fnew[i][j][k][7]+fnew[i][j][k][8]+fnew[i][j][k][9]+ fnew[i][j][k][10]+fnew[i][j][k][11]+fnew[i][j][k][13]+fnew[i][j][k][15]+fnew[i][j][k][17]+tmp1; - + tmp3=rb*vwtp-fnew[i][j][k][2]+fnew[i][j][k][4]-fnew[i][j][k][7]+fnew[i][j][k][8]-fnew[i][j][k][9]+ fnew[i][j][k][10]-fnew[i][j][k][15]+fnew[i][j][k][17]; - + fnew[i][j][k][12] = 0.25*(tmp1+2.0*tmp2); fnew[i][j][k][14] = 0.25*(tmp1-2.0*tmp2); fnew[i][j][k][16] = 0.25*(tmp1+2.0*tmp3); fnew[i][j][k][18] = 0.25*(tmp1-2.0*tmp3); } - } + } } - + //-------------------------------------------------------------------------- // Periodic z boundary conditions. //-------------------------------------------------------------------------- }else { - + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[1][1][1][0],1,passxf,comm->procneigh[0][0],15,world,&requests[0]); @@ -3306,23 +3306,23 @@ void FixLbFluid::update_full19(void) } update_periodic(2,subNbx-2,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][1][1][0],1,passyf,comm->procneigh[1][0],15,world,&requests[0]); - MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); + MPI_Irecv(&feq[0][0][1][0],1,passyf,comm->procneigh[1][0],25,world,&requests[1]); MPI_Isend(&feq[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],25,world,&requests[2]); MPI_Irecv(&feq[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],15,world,&requests[3]); if(typeLB == 2){ MPI_Isend(&feqn[0][1][1][0],1,passyf,comm->procneigh[1][0],10,world,&requests[4]); - MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); + MPI_Irecv(&feqn[0][0][1][0],1,passyf,comm->procneigh[1][0],20,world,&requests[5]); MPI_Isend(&feqn[0][subNby-2][1][0],1,passyf,comm->procneigh[1][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][subNby-1][1][0],1,passyf,comm->procneigh[1][1],10,world,&requests[7]); } update_periodic(1,2,2,subNby-2,2,subNbz-2); update_periodic(subNbx-2,subNbx-1,2,subNby-2,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + for(i=0; i<numrequests; i++) requests[i]=MPI_REQUEST_NULL; MPI_Isend(&feq[0][0][1][0],1,passzf,comm->procneigh[2][0],15,world,&requests[0]); @@ -3334,15 +3334,15 @@ void FixLbFluid::update_full19(void) MPI_Irecv(&feqn[0][0][0][0],1,passzf,comm->procneigh[2][0],20,world,&requests[5]); MPI_Isend(&feqn[0][0][subNbz-2][0],1,passzf,comm->procneigh[2][1],20,world,&requests[6]); MPI_Irecv(&feqn[0][0][subNbz-1][0],1,passzf,comm->procneigh[2][1],10,world,&requests[7]); - } + } update_periodic(1,subNbx-1,1,2,2,subNbz-2); update_periodic(1,subNbx-1,subNby-2,subNby-1,2,subNbz-2); MPI_Waitall(numrequests,requests,MPI_STATUS_IGNORE); - + update_periodic(1,subNbx-1,1,subNby-1,1,2); update_periodic(1,subNbx-1,1,subNby-1,subNbz-2,subNbz-1); } - + } diff --git a/src/USER-LB/fix_lb_fluid.h b/src/USER-LB/fix_lb_fluid.h index 98bb6504777ed8b7675dc77e9f6a4dcb3e66f9cf..8d81648e47a192bf690965d58de85981501609d5 100755 --- a/src/USER-LB/fix_lb_fluid.h +++ b/src/USER-LB/fix_lb_fluid.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. For more info, see the README file in the top-level LAMMPS directory. @@ -15,7 +15,7 @@ FixStyle(lb/fluid,FixLbFluid) -#else +#else #ifndef LMP_FIX_LB_FLUID_H #define LMP_FIX_LB_FLUID_H @@ -57,7 +57,7 @@ public: double dm_lb,dx_lb,dt_lb; // Lattice units for mass, distance, time. int Nbx,Nby,Nbz; // Total # of x,y,z grid points. - int subNbx,subNby,subNbz; // # of x,y,z, grid points (including buffer) + int subNbx,subNby,subNbz; // # of x,y,z, grid points (including buffer) // on local processor. int me, nprocs; // MPI variables: processor ID, # of processors MPI_Datatype oneslice; // MPI datatypes to pass arrays. @@ -66,9 +66,9 @@ public: MPI_Datatype passxrho,passyrho,passzrho; MPI_Datatype passxtemp,passytemp,passztemp; - double kB,densityinit,a_0; // Boltzmann constant, initial density, + double kB,densityinit,a_0; // Boltzmann constant, initial density, // and a_0 all in lattice units. - double *Gamma; + double *Gamma; double *NodeArea; int setGamma,setArea; double **hydroF; @@ -78,21 +78,21 @@ public: double ***density_lb; // fluid density double ****u_lb; // fluid velocity double ****f_lb; // distributions - double ****fnew; // used in the calculation of the new + double ****fnew; // used in the calculation of the new // distributions. double ****feq; // equilibrium distributions - double ****feqold; // equilibrium distributions from previous + double ****feqold; // equilibrium distributions from previous // timestep double ****feqn; // equilibrium distributions without noise. - double ****feqoldn; // equilibrium distributions from previous + double ****feqoldn; // equilibrium distributions from previous // timestep without noise. double ****Ff; // Force from the MD particles on the fluid. double ****Fftempx; double ****Fftempy; double ****Fftempz; - double *Ng_lb; // Lattice Boltzmann variables. + double *Ng_lb; // Lattice Boltzmann variables. double *w_lb; double **mg_lb; int **e; @@ -110,28 +110,28 @@ public: double ****altogether2; double bodyforcex,bodyforcey,bodyforcez; // Body Forces acting on the fluid (default=0) - double vwtp,vwbt; // Velocities of the z walls in the y - // direction. (must have fixed boundary + double vwtp,vwbt; // Velocities of the z walls in the y + // direction. (must have fixed boundary // conditions in z) - int noisestress; // 1 to include noise in the system, + int noisestress; // 1 to include noise in the system, // 0 otherwise. double namp,noisefactor; int seed; class RanMars *random; - int force_diagnostic; // 1 to print out the force action on a group + int force_diagnostic; // 1 to print out the force action on a group // of particles, 0 otherwise. - int igroupforce; // the group for which the force is to be + int igroupforce; // the group for which the force is to be // printed. - int typeLB; - - int trilinear_stencil; // 1 to use the trilinear stencil, 0 to use the + int typeLB; + + int trilinear_stencil; // 1 to use the trilinear stencil, 0 to use the // peskin stencil. int readrestart; // 1 to read in data from a restart file. - MPI_File pFileRead; + MPI_File pFileRead; int printrestart; // 1 to write data to a restart file. MPI_File pFileWrite; @@ -164,4 +164,4 @@ public: } #endif #endif - + diff --git a/src/USER-LB/fix_lb_momentum.cpp b/src/USER-LB/fix_lb_momentum.cpp index 63c89fe0400647013750a19e4f600721b0ff0a7b..18d98edda81cbbc373cbb7910a46228c448a91e8 100755 --- a/src/USER-LB/fix_lb_momentum.cpp +++ b/src/USER-LB/fix_lb_momentum.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -18,8 +18,8 @@ Contributing author: Naveen Michaud-Agrawal (Johns Hopkins U) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_lb_momentum.h" #include "atom.h" #include "domain.h" @@ -63,7 +63,7 @@ FixLbMomentum::FixLbMomentum(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix lb/momentum command"); if (linear) - if (xflag < 0 || xflag > 1 || yflag < 0 || yflag > 1 || + if (xflag < 0 || xflag > 1 || yflag < 0 || yflag > 1 || zflag < 0 || zflag > 1) error->all(FLERR,"Illegal fix lb/momentum command"); // cannot have 0 atoms in group @@ -74,7 +74,7 @@ FixLbMomentum::FixLbMomentum(LAMMPS *lmp, int narg, char **arg) : for(int ifix=0; ifix<modify->nfix; ifix++) if(strcmp(modify->fix[ifix]->style,"lb/fluid")==0) fix_lb_fluid = (FixLbFluid *)modify->fix[ifix]; - + } @@ -146,7 +146,7 @@ void FixLbMomentum::end_of_step() } MPI_Allreduce(&masslbloc,&masslb,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&momentumlbloc[0],&momentumlb[0],3,MPI_DOUBLE,MPI_SUM,world); - + momentumlb[0] *= dm_lb*dx_lb/dt_lb; momentumlb[1] *= dm_lb*dx_lb/dt_lb; momentumlb[2] *= dm_lb*dx_lb/dt_lb; @@ -156,7 +156,7 @@ void FixLbMomentum::end_of_step() vcmtotal[0] = (masstotal*vcm[0] + momentumlb[0])/(masslb + masstotal); vcmtotal[1] = (masstotal*vcm[1] + momentumlb[1])/(masslb + masstotal); vcmtotal[2] = (masstotal*vcm[2] + momentumlb[2])/(masslb + masstotal); - + //Subtract vcm from the particles. for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { @@ -200,7 +200,7 @@ void FixLbMomentum::end_of_step() u_lb[i][j][k][0]*ucmy*ucmz+ucmx*u_lb[i][j][k][1]*u_lb[i][j][k][2]- ucmx*u_lb[i][j][k][1]*ucmz-ucmx*ucmy*u_lb[i][j][k][2]+ ucmx*ucmy*ucmz); - etacov[14]=0.0; + etacov[14]=0.0; }else{ etacov[0] = 0.0; etacov[1] = rho*ucmx; @@ -212,8 +212,8 @@ void FixLbMomentum::end_of_step() etacov[7]=rho*(u_lb[i][j][k][0]*ucmy+u_lb[i][j][k][1]*ucmx-ucmx*ucmy); etacov[8]=rho*(u_lb[i][j][k][0]*ucmz+u_lb[i][j][k][2]*ucmx-ucmx*ucmz); etacov[9]=rho*(u_lb[i][j][k][1]*ucmz+u_lb[i][j][k][2]*ucmy-ucmy*ucmz); - etacov[10] = 0.0; - etacov[11] = 0.0; + etacov[10] = 0.0; + etacov[11] = 0.0; etacov[12] = 0.0; etacov[13] = 0.0; etacov[14] = 0.0; @@ -221,13 +221,13 @@ void FixLbMomentum::end_of_step() etacov[16] = 0.0; etacov[17] = 0.0; etacov[18] = 0.0; - } + } for(int l=0; l<numvel; l++) for(int ii=0; ii<numvel; ii++){ f_lb[i][j][k][l] -= w_lb[l]*mg_lb[ii][l]*etacov[ii]*Ng_lb[ii]; - } - + } + if(typeLB == 2){ double ****feqold = fix_lb_fluid->feqold; @@ -243,7 +243,7 @@ void FixLbMomentum::end_of_step() u_old[0] = u_old[0]/density_old; u_old[1] = u_old[1]/density_old; u_old[2] = u_old[2]/density_old; - + if(numvel==15){ etacov[0]=0.0; etacov[1]=density_old*ucmx; @@ -262,7 +262,7 @@ void FixLbMomentum::end_of_step() u_old[0]*ucmy*ucmz+ucmx*u_old[1]*u_old[2]- ucmx*u_old[1]*ucmz-ucmx*ucmy*u_old[2]+ ucmx*ucmy*ucmz); - etacov[14]=0.0; + etacov[14]=0.0; }else{ etacov[0] = 0.0; etacov[1] = density_old*ucmx; @@ -274,8 +274,8 @@ void FixLbMomentum::end_of_step() etacov[7] = density_old*(u_lb[i][j][k][0]*ucmy+u_lb[i][j][k][1]*ucmx-ucmx*ucmy); etacov[8] = density_old*(u_lb[i][j][k][0]*ucmz+u_lb[i][j][k][2]*ucmx-ucmx*ucmz); etacov[9] = density_old*(u_lb[i][j][k][1]*ucmz+u_lb[i][j][k][2]*ucmy-ucmy*ucmz); - etacov[10] = 0.0; - etacov[11] = 0.0; + etacov[10] = 0.0; + etacov[11] = 0.0; etacov[12] = 0.0; etacov[13] = 0.0; etacov[14] = 0.0; @@ -284,13 +284,13 @@ void FixLbMomentum::end_of_step() etacov[17] = 0.0; etacov[18] = 0.0; } - + for(int l=0; l<numvel; l++) for(int ii=0; ii<numvel; ii++){ feqold[i][j][k][l] -= w_lb[l]*mg_lb[ii][l]*etacov[ii]*Ng_lb[ii]; feqoldn[i][j][k][l] -= w_lb[l]*mg_lb[ii][l]*etacov[ii]*Ng_lb[ii]; } - } + } } } diff --git a/src/USER-LB/fix_lb_momentum.h b/src/USER-LB/fix_lb_momentum.h index a4277c0232c09374b5e7f4f12974d6fc820061c9..51c9f6f4a422dc3e3951324e1d804910bb43e535 100755 --- a/src/USER-LB/fix_lb_momentum.h +++ b/src/USER-LB/fix_lb_momentum.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-LB/fix_lb_pc.cpp b/src/USER-LB/fix_lb_pc.cpp index c8c518f0390b3aae98db98b6df4cce6f479b1d61..9ea1afc2eac962cbd44ab04ce8096896f0416ab0 100755 --- a/src/USER-LB/fix_lb_pc.cpp +++ b/src/USER-LB/fix_lb_pc.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -15,9 +15,9 @@ Contributing authors: Frances Mackay, Santtu Ollila, Colin Denniston (UWO) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_lb_pc.h" #include "atom.h" #include "force.h" @@ -29,7 +29,7 @@ #include "domain.h" #include "fix_lb_fluid.h" #include "modify.h" -#include "mpi.h" +#include <mpi.h> #include "group.h" using namespace LAMMPS_NS; @@ -64,7 +64,7 @@ FixLbPC::FixLbPC(LAMMPS *lmp, int narg, char **arg) : } if(groupbit_lb_fluid == 0) - error->all(FLERR,"the lb/fluid fix must also be used if using the lb/pc fix"); + error->all(FLERR,"the lb/fluid fix must also be used if using the lb/pc fix"); int *mask = atom->mask; int nlocal = atom->nlocal; @@ -72,7 +72,7 @@ FixLbPC::FixLbPC(LAMMPS *lmp, int narg, char **arg) : if((mask[j] & groupbit) && !(mask[j] & groupbit_lb_fluid)) error->one(FLERR,"can only use the lb/pc fix for an atom if also using the lb/fluid fix for that atom"); } - + } /* ---------------------------------------------------------------------- */ @@ -80,7 +80,7 @@ FixLbPC::FixLbPC(LAMMPS *lmp, int narg, char **arg) : FixLbPC::~FixLbPC() { atom->delete_callback(id,0); - + memory->destroy(force_old); memory->destroy(up); memory->destroy(up_old); @@ -108,7 +108,7 @@ void FixLbPC::init() double dt_lb = fix_lb_fluid->dt_lb; MPI_Comm_rank(world,&me); - + dtv = update->dt; dtf = update->dt * force->ftm2v; @@ -121,7 +121,7 @@ void FixLbPC::init() void FixLbPC::initial_integrate(int vflag) { double dtfm; - + double **x = atom->x; double dx[3]; double **v = atom->v; @@ -144,13 +144,13 @@ void FixLbPC::initial_integrate(int vflag) { force_old[i][2] = f[i][2]; } - + if(rmass){ for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { dtfm = dtf/rmass[i]; - expminusdttimesgamma = exp(-dtv*Gamma_MD[type[i]]/rmass[i]); - + expminusdttimesgamma = exp(-dtv*Gamma_MD[type[i]]/rmass[i]); + dx[0] = dtv*v[i][0] + 0.5*(f[i][0]*force->ftm2v - Gamma_MD[type[i]]*(v[i][0]-up[i][0]))*dtv*dtv/rmass[i]; dx[1] = dtv*v[i][1] + 0.5*(f[i][1]*force->ftm2v - Gamma_MD[type[i]]*(v[i][1]-up[i][1]))*dtv*dtv/rmass[i]; dx[2] = dtv*v[i][2] + 0.5*(f[i][2]*force->ftm2v - Gamma_MD[type[i]]*(v[i][2]-up[i][2]))*dtv*dtv/rmass[i]; @@ -158,20 +158,20 @@ void FixLbPC::initial_integrate(int vflag) { x[i][0] += dx[0]; x[i][1] += dx[1]; x[i][2] += dx[2]; - + // Approximation for v if(Gamma_MD[type[i]] == 0.0){ v[i][0] += f[i][0]*dtfm; v[i][1] += f[i][1]*dtfm; v[i][2] += f[i][2]*dtfm; }else{ - v[i][0] = (v[i][0]-up[i][0]-f[i][0]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + + v[i][0] = (v[i][0]-up[i][0]-f[i][0]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + f[i][0]*force->ftm2v/Gamma_MD[type[i]] + up[i][0]; - v[i][1] = (v[i][1]-up[i][1]-f[i][1]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + + v[i][1] = (v[i][1]-up[i][1]-f[i][1]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + f[i][1]*force->ftm2v/Gamma_MD[type[i]] + up[i][1]; - v[i][2] = (v[i][2]-up[i][2]-f[i][2]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + + v[i][2] = (v[i][2]-up[i][2]-f[i][2]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + f[i][2]*force->ftm2v/Gamma_MD[type[i]] + up[i][2]; - } + } } } @@ -180,7 +180,7 @@ void FixLbPC::initial_integrate(int vflag) { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { dtfm = dtf/mass[type[i]]; - expminusdttimesgamma = exp(-dtv*Gamma_MD[type[i]]/mass[type[i]]); + expminusdttimesgamma = exp(-dtv*Gamma_MD[type[i]]/mass[type[i]]); dx[0] = dtv*v[i][0] + 0.5*(f[i][0]*force->ftm2v - Gamma_MD[type[i]]*(v[i][0]-up[i][0]))*dtv*dtv/mass[type[i]]; dx[1] = dtv*v[i][1] + 0.5*(f[i][1]*force->ftm2v - Gamma_MD[type[i]]*(v[i][1]-up[i][1]))*dtv*dtv/mass[type[i]]; @@ -189,18 +189,18 @@ void FixLbPC::initial_integrate(int vflag) { x[i][0] += dx[0]; x[i][1] += dx[1]; x[i][2] += dx[2]; - + // Approximation for v if(Gamma_MD[type[i]] == 0.0){ v[i][0] += f[i][0]*dtfm; v[i][1] += f[i][1]*dtfm; v[i][2] += f[i][2]*dtfm; }else{ - v[i][0] = (v[i][0]-up[i][0]-f[i][0]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + + v[i][0] = (v[i][0]-up[i][0]-f[i][0]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + f[i][0]*force->ftm2v/Gamma_MD[type[i]] + up[i][0]; - v[i][1] = (v[i][1]-up[i][1]-f[i][1]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + + v[i][1] = (v[i][1]-up[i][1]-f[i][1]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + f[i][1]*force->ftm2v/Gamma_MD[type[i]] + up[i][1]; - v[i][2] = (v[i][2]-up[i][2]-f[i][2]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + + v[i][2] = (v[i][2]-up[i][2]-f[i][2]*force->ftm2v/Gamma_MD[type[i]])*expminusdttimesgamma + f[i][2]*force->ftm2v/Gamma_MD[type[i]] + up[i][2]; } } @@ -222,14 +222,14 @@ void FixLbPC::final_integrate() if (igroup == atom->firstgroup) nlocal = atom->nfirst; compute_up(); - + if(rmass){ for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { dtfm = dtf/rmass[i]; expminusdttimesgamma = exp(-dtv*Gamma_MD[type[i]]/rmass[i]); DMDcoeff = (dtv - rmass[i]*(1.0-expminusdttimesgamma)/Gamma_MD[type[i]]); - + if(Gamma_MD[type[i]] == 0.0){ v[i][0] += 0.5*(f[i][0] - force_old[i][0])*dtfm; v[i][1] += 0.5*(f[i][1] - force_old[i][1])*dtfm; @@ -239,7 +239,7 @@ void FixLbPC::final_integrate() v[i][1] += DMDcoeff*((f[i][1] - force_old[i][1])*force->ftm2v/Gamma_MD[type[i]] + up[i][1] - up_old[i][1])/dtv; v[i][2] += DMDcoeff*((f[i][2] - force_old[i][2])*force->ftm2v/Gamma_MD[type[i]] + up[i][2] - up_old[i][2])/dtv; } - + } } @@ -250,7 +250,7 @@ void FixLbPC::final_integrate() dtfm = dtf/mass[type[i]]; expminusdttimesgamma = exp(-dtv*Gamma_MD[type[i]]/mass[type[i]]); DMDcoeff = (dtv - mass[type[i]]*(1.0-expminusdttimesgamma)/Gamma_MD[type[i]]); - + if(Gamma_MD[type[i]] == 0.0){ v[i][0] += 0.5*(f[i][0] - force_old[i][0])*dtfm; v[i][1] += 0.5*(f[i][1] - force_old[i][1])*dtfm; @@ -259,7 +259,7 @@ void FixLbPC::final_integrate() v[i][0] += DMDcoeff*((f[i][0] - force_old[i][0])*force->ftm2v/Gamma_MD[type[i]] + up[i][0] - up_old[i][0])/dtv; v[i][1] += DMDcoeff*((f[i][1] - force_old[i][1])*force->ftm2v/Gamma_MD[type[i]] + up[i][1] - up_old[i][1])/dtv; v[i][2] += DMDcoeff*((f[i][2] - force_old[i][2])*force->ftm2v/Gamma_MD[type[i]] + up[i][2] - up_old[i][2])/dtv; - } + } } } @@ -359,18 +359,18 @@ int FixLbPC::unpack_exchange(int nlocal, double *buf) double dt_lb = fix_lb_fluid->dt_lb; double FfP[64]; int trilinear_stencil = fix_lb_fluid->trilinear_stencil; - + for(i=0; i<nlocal; i++){ if(mask[i] & groupbit){ //Calculate nearest leftmost grid point. //Since array indices from 1 to subNb-2 correspond to the - // local subprocessor domain (not indices from 0), use the + // local subprocessor domain (not indices from 0), use the // ceiling value. ix = (int)ceil((x[i][0]-domain->sublo[0])/dx_lb); iy = (int)ceil((x[i][1]-domain->sublo[1])/dx_lb); iz = (int)ceil((x[i][2]-domain->sublo[2])/dx_lb); - + //Calculate distances to the nearest points. dx1 = x[i][0] - (domain->sublo[0] + (ix-1)*dx_lb); dy1 = x[i][1] - (domain->sublo[1] + (iy-1)*dx_lb); @@ -380,13 +380,13 @@ int FixLbPC::unpack_exchange(int nlocal, double *buf) dx1 = dx1/dx_lb; dy1 = dy1/dx_lb; dz1 = dz1/dx_lb; - + up[i][0]=0.0; up[i][1]=0.0; up[i][2]=0.0; if(trilinear_stencil==0){ isten=0; for(ii=-1; ii<3; ii++){ rsq=(-dx1+ii)*(-dx1+ii); - + if(rsq>=4) weightx=0.0; else{ @@ -424,12 +424,12 @@ int FixLbPC::unpack_exchange(int nlocal, double *buf) ixp = ix+ii; iyp = iy+jj; izp = iz+kk; - - + + if(ixp==-1) ixp=subNbx+2; if(iyp==-1) iyp=subNby+2; if(izp==-1) izp=subNbz+2; - + FfP[isten] = weightx*weighty*weightz; // interpolated velocity based on delta function. for(k=0; k<3; k++){ @@ -447,11 +447,11 @@ int FixLbPC::unpack_exchange(int nlocal, double *buf) FfP[5] = dx1*(1.-dy1)*dz1; FfP[6] = dx1*dy1*(1.-dz1); FfP[7] = dx1*dy1*dz1; - + ixp = (ix+1); iyp = (iy+1); izp = (iz+1); - + for (k=0; k<3; k++) { // tri-linearly interpolated velocity at node up[i][k] = u_lb[ix][iy][iz][k]*FfP[0] + u_lb[ix][iy][izp][k]*FfP[1] @@ -460,9 +460,9 @@ int FixLbPC::unpack_exchange(int nlocal, double *buf) + u_lb[ixp][iy][iz][k]*FfP[4] + u_lb[ixp][iy][izp][k]*FfP[5] + u_lb[ixp][iyp][iz][k]*FfP[6] - + u_lb[ixp][iyp][izp][k]*FfP[7]; + + u_lb[ixp][iyp][izp][k]*FfP[7]; } - } + } for(k=0; k<3; k++) up[i][k] = up[i][k]*dx_lb/dt_lb; diff --git a/src/USER-LB/fix_lb_pc.h b/src/USER-LB/fix_lb_pc.h index 1804810afd17cc63fa264812de33c9b62902d149..7d0be65e6096cd411156219a86dbc57f7db6296f 100755 --- a/src/USER-LB/fix_lb_pc.h +++ b/src/USER-LB/fix_lb_pc.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -52,7 +52,7 @@ namespace LAMMPS_NS { double **up_old; void compute_up(void); - class FixLbFluid *fix_lb_fluid; + class FixLbFluid *fix_lb_fluid; }; } diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp index c031d1b7827687e556bec13ee28505fa53b10fd3..54637ce349f1fa2ae834a96a7fdc8558913fecc8 100755 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ Based on fix_rigid (version from 2008). ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_lb_rigid_pc_sphere.h" #include "atom.h" #include "atom_vec.h" @@ -54,7 +54,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - + body = NULL; up = NULL; grow_arrays(atom->nmax); @@ -62,12 +62,12 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : // by default assume all of the particles interact with the fluid. inner_nodes = 0; - + // parse command-line args // set nbody and body[i] for each atom if (narg < 4) error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); - + // single rigid body // nbody = 1 // all atoms in fix group are part of body @@ -108,7 +108,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : tagint itmp; MPI_Allreduce(&maxmol_tag,&itmp,1,MPI_LMP_TAGINT,MPI_MAX,world); - if (itmp+1 > MAXSMALLINT) + if (itmp+1 > MAXSMALLINT) error->all(FLERR,"Too many molecules for fix lb/rigid/pc/sphere"); int maxmol = (int) itmp; @@ -145,14 +145,14 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : if (narg < 5) error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); nbody = atoi(arg[4]); if (nbody <= 0) error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); - if (narg < 5+nbody) + if (narg < 5+nbody) error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); iarg = 5 + nbody; int *igroups = new int[nbody]; for (ibody = 0; ibody < nbody; ibody++) { igroups[ibody] = group->find(arg[5+ibody]); - if (igroups[ibody] == -1) + if (igroups[ibody] == -1) error->all(FLERR,"Could not find fix lb/rigid/pc/sphere group ID"); } @@ -172,13 +172,13 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall) + if (flagall) error->all(FLERR,"One or more atoms belong to multiple rigid bodies"); delete [] igroups; }else error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); - + // error check on nbody if (nbody == 0) error->all(FLERR,"No rigid bodies defined"); @@ -286,7 +286,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : iarg += 5; // specify if certain particles are inside the rigid spherical body, - // and therefore should not + // and therefore should not } else if(strcmp(arg[iarg],"innerNodes")==0){ inner_nodes = 1; igroupinner = group->find(arg[iarg+1]); @@ -315,7 +315,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : // nrigid[n] = # of atoms in Nth rigid body // error if one or zero atoms - + int *ncount = new int[nbody]; for (ibody = 0; ibody < nbody; ibody++) ncount[ibody] = 0; @@ -323,9 +323,9 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : for (i = 0; i < nlocal; i++) if (body[i] >= 0) ncount[body[i]]++; - + MPI_Allreduce(ncount,nrigid,nbody,MPI_INT,MPI_SUM,world); - + //count the number of atoms in the shell. if(inner_nodes == 1){ int *mask = atom->mask; @@ -335,7 +335,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : if(body[i] >= 0) ncount[body[i]]++; } } - + MPI_Allreduce(ncount,nrigid_shell,nbody,MPI_INT,MPI_SUM,world); }else { for(ibody=0; ibody < nbody; ibody++) nrigid_shell[ibody]=nrigid[ibody]; @@ -351,14 +351,14 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : // set here, so image value will persist from run to run for (ibody = 0; ibody < nbody; ibody++) - imagebody[ibody] = ((imageint) IMGMAX << IMG2BITS) | + imagebody[ibody] = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; // print statistics int nsum = 0; for (ibody = 0; ibody < nbody; ibody++) nsum += nrigid[ibody]; - + if (comm->me == 0) { if (screen) fprintf(screen,"%d rigid bodies with %d atoms\n",nbody,nsum); if (logfile) fprintf(logfile,"%d rigid bodies with %d atoms\n",nbody,nsum); @@ -374,7 +374,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : if(groupbit_lb_fluid == 0) error->all(FLERR,"the lb/fluid fix must also be used if using the lb/rigid/pc/sphere fix"); - + int *mask = atom->mask; if(inner_nodes == 1){ for(int j=0; j<nlocal; j++){ @@ -384,15 +384,15 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : // If inner nodes are present, which should not interact with the fluid, make // sure these are not used by the lb/fluid fix to apply a force to the fluid. if((mask[j] & groupbit) && (mask[j] & groupbit_lb_fluid) && (mask[j] & group->bitmask[igroupinner])) - error->one(FLERR,"the inner nodes specified in lb/rigid/pc/sphere should not be included in the lb/fluid fix"); + error->one(FLERR,"the inner nodes specified in lb/rigid/pc/sphere should not be included in the lb/fluid fix"); } }else{ for(int j=0; j<nlocal; j++){ if((mask[j] & groupbit) && !(mask[j] & groupbit_lb_fluid)) error->one(FLERR,"use the innerNodes keyword in the lb/rigid/pc/sphere fix for atoms which do not interact with the lb/fluid"); } - } - + } + } /* ---------------------------------------------------------------------- */ @@ -402,12 +402,12 @@ FixLbRigidPCSphere::~FixLbRigidPCSphere() // unregister callbacks to this fix from Atom class atom->delete_callback(id,0); - + // delete locally stored arrays - + memory->destroy(body); memory->destroy(up); - + // delete nbody-length arrays memory->destroy(nrigid); @@ -474,7 +474,7 @@ void FixLbRigidPCSphere::init() double **x = atom->x; imageint *image = atom->image; double *rmass = atom->rmass; - double *mass = atom->mass; + double *mass = atom->mass; int *periodicity = domain->periodicity; double xprd = domain->xprd; double yprd = domain->yprd; @@ -500,14 +500,14 @@ void FixLbRigidPCSphere::init() } if(extended) error->warning(FLERR,"Fix lb/rigid/pc/sphere assumes point particles"); - + // compute masstotal & center-of-mass of each rigid body for (ibody = 0; ibody < nbody; ibody++) for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; int xbox,ybox,zbox; double massone,xunwrap,yunwrap,zunwrap; - + for (i = 0; i < nlocal; i++) { if (body[i] < 0) continue; ibody = body[i]; @@ -539,9 +539,9 @@ void FixLbRigidPCSphere::init() sum[ibody][4] += massone; } } - + MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); - + for (ibody = 0; ibody < nbody; ibody++) { masstotal[ibody] = all[ibody][3]; masstotal_shell[ibody] = all[ibody][4]; @@ -564,25 +564,25 @@ void FixLbRigidPCSphere::init() if(inner_nodes == 1){ if(!(mask[i] & group->bitmask[igroupinner])){ ibody = body[i]; - + xbox = (image[i] & IMGMASK) - IMGMAX; ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; zbox = (image[i] >> IMG2BITS) - IMGMAX; - + xunwrap = x[i][0] + xbox*xprd; yunwrap = x[i][1] + ybox*yprd; zunwrap = x[i][2] + zbox*zprd; - + dx = xunwrap - xcm[ibody][0]; dy = yunwrap - xcm[ibody][1]; dz = zunwrap - xcm[ibody][2]; - + sum[ibody][0] += dx*dx + dy*dy + dz*dz; sum[ibody][1] += Gamma[type[i]]; } }else{ ibody = body[i]; - + xbox = (image[i] & IMGMASK) - IMGMAX; ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; zbox = (image[i] >> IMG2BITS) - IMGMAX; @@ -606,7 +606,7 @@ void FixLbRigidPCSphere::init() sphereradius[ibody] = sqrt(all[ibody][0]/nrigid_shell[ibody]); Gamma_MD[ibody] = all[ibody][1]*dm_lb/dt_lb/nrigid_shell[ibody]; } - + // Check that all atoms in the rigid body have the same value of gamma. double eps = 1.0e-7; for (i=0; i<nlocal; i++){ @@ -622,11 +622,11 @@ void FixLbRigidPCSphere::init() ibody = body[i]; if(Gamma_MD[ibody]*dt_lb/dm_lb - Gamma[type[i]] > eps) - error->one(FLERR,"All atoms in a rigid body must have the same gamma value"); + error->one(FLERR,"All atoms in a rigid body must have the same gamma value"); } } - + // remap the xcm of each body back into simulation box if needed // only really necessary the 1st time a run is performed @@ -642,7 +642,7 @@ void FixLbRigidPCSphere::init() } if (ndof > 0.0) tfactor = force->mvv2e / (ndof * force->boltz); else tfactor = 0.0; - + } /* ---------------------------------------------------------------------- */ @@ -650,7 +650,7 @@ void FixLbRigidPCSphere::setup(int vflag) { int i,n,ibody; double massone; - + // vcm = velocity of center-of-mass of each rigid body // fcm = force on center-of-mass of each rigid body @@ -671,7 +671,7 @@ void FixLbRigidPCSphere::setup(int vflag) for (ibody = 0; ibody < nbody; ibody++) for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; - + for (i = 0; i < nlocal; i++) { if (body[i] < 0) continue; ibody = body[i]; @@ -685,7 +685,7 @@ void FixLbRigidPCSphere::setup(int vflag) sum[ibody][4] += f[i][1]; sum[ibody][5] += f[i][2]; } - + MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); for (ibody = 0; ibody < nbody; ibody++) { @@ -707,13 +707,13 @@ void FixLbRigidPCSphere::setup(int vflag) for (i = 0; i < nlocal; i++) { if (body[i] < 0) continue; ibody = body[i]; - + domain->unmap(x[i],image[i],unwrap); - + dx = unwrap[0] - xcm[ibody][0]; dy = unwrap[1] - xcm[ibody][1]; dz = unwrap[2] - xcm[ibody][2]; - + if (rmass) massone = rmass[i]; else massone = mass[type[i]]; @@ -783,13 +783,13 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) for (ibody = 0; ibody < nbody; ibody++) for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; // Store the fluid velocity at the center of mass - + for (i = 0; i < nlocal; i++) { if (body[i] < 0) continue; ibody = body[i]; if (rmass) massone = rmass[i]; else massone = mass[type[i]]; - + if(inner_nodes == 1){ if(!(mask[i] & group->bitmask[igroupinner])){ sum[ibody][0] += up[i][0]*massone; @@ -800,7 +800,7 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) sum[ibody][0] += up[i][0]*massone; sum[ibody][1] += up[i][1]*massone; sum[ibody][2] += up[i][2]*massone; - } + } } MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); @@ -819,7 +819,7 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) ibody = body[i]; domain->unmap(x[i],image[i],unwrap); - + dx = unwrap[0] - xcm[ibody][0]; dy = unwrap[1] - xcm[ibody][1]; dz = unwrap[2] - xcm[ibody][2]; @@ -872,7 +872,7 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) torque_old[ibody][2] = torque[ibody][2]; torque_fluid_old[ibody][0] = torque_fluid[ibody][0]; torque_fluid_old[ibody][1] = torque_fluid[ibody][1]; - torque_fluid_old[ibody][2] = torque_fluid[ibody][2]; + torque_fluid_old[ibody][2] = torque_fluid[ibody][2]; ucm_old[ibody][0] = ucm[ibody][0]; ucm_old[ibody][1] = ucm[ibody][1]; ucm_old[ibody][2] = ucm[ibody][2]; @@ -899,7 +899,7 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) force_factor = force->ftm2v/Gamma_MD[ibody]/nrigid_shell[ibody]; if(fflag[ibody][0]==1){ - vcm[ibody][0] = expminusdttimesgamma*(vcm[ibody][0] - ucm[ibody][0] - fcm[ibody][0]*force_factor) + vcm[ibody][0] = expminusdttimesgamma*(vcm[ibody][0] - ucm[ibody][0] - fcm[ibody][0]*force_factor) + ucm[ibody][0] + fcm[ibody][0]*force_factor; } if(fflag[ibody][1]==1){ @@ -918,19 +918,19 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) if(tflag[ibody][0]==1){ omega[ibody][0] = expminusdttimesgamma*(omega[ibody][0] - (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* - (force->ftm2v*torque[ibody][0] + torque_fluid[ibody][0])) + + (force->ftm2v*torque[ibody][0] + torque_fluid[ibody][0])) + (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* (force->ftm2v*torque[ibody][0] + torque_fluid[ibody][0]); } if(tflag[ibody][1]==1){ omega[ibody][1] = expminusdttimesgamma*(omega[ibody][1] - (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* - (force->ftm2v*torque[ibody][1] + torque_fluid[ibody][1])) + + (force->ftm2v*torque[ibody][1] + torque_fluid[ibody][1])) + (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* (force->ftm2v*torque[ibody][1] + torque_fluid[ibody][1]); } if(tflag[ibody][2]==1){ omega[ibody][2] = expminusdttimesgamma*(omega[ibody][2] - (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* - (force->ftm2v*torque[ibody][2] + torque_fluid[ibody][2])) + + (force->ftm2v*torque[ibody][2] + torque_fluid[ibody][2])) + (3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* (force->ftm2v*torque[ibody][2] + torque_fluid[ibody][2]); } @@ -941,7 +941,7 @@ void FixLbRigidPCSphere::initial_integrate(int vflag) if (vflag) v_setup(vflag); else evflag = 0; - set_xv(); + set_xv(); } @@ -961,7 +961,7 @@ void FixLbRigidPCSphere::final_integrate() double *mass = atom->mass; int *type = atom->type; int nlocal = atom->nlocal; - + double unwrap[3]; double dx,dy,dz; @@ -969,7 +969,7 @@ void FixLbRigidPCSphere::final_integrate() for (ibody = 0; ibody < nbody; ibody++) for (i = 0; i < 6; i++) sum[ibody][i] = 0.0; - + for (i = 0; i < nlocal; i++) { if (body[i] < 0) continue; ibody = body[i]; @@ -977,13 +977,13 @@ void FixLbRigidPCSphere::final_integrate() sum[ibody][0] += f[i][0]; sum[ibody][1] += f[i][1]; sum[ibody][2] += f[i][2]; - + domain->unmap(x[i],image[i],unwrap); - + dx = unwrap[0] - xcm[ibody][0]; dy = unwrap[1] - xcm[ibody][1]; dz = unwrap[2] - xcm[ibody][2]; - + sum[ibody][3] += dy*f[i][2] - dz*f[i][1]; sum[ibody][4] += dz*f[i][0] - dx*f[i][2]; sum[ibody][5] += dx*f[i][1] - dy*f[i][0]; @@ -991,7 +991,7 @@ void FixLbRigidPCSphere::final_integrate() MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); - //Compute the correction to the velocity and angular momentum due to the non-fluid forces: + //Compute the correction to the velocity and angular momentum due to the non-fluid forces: for (ibody = 0; ibody < nbody; ibody++) { fcm[ibody][0] = all[ibody][0]; fcm[ibody][1] = all[ibody][1]; @@ -1002,11 +1002,11 @@ void FixLbRigidPCSphere::final_integrate() expminusdttimesgamma = exp(-dtv*Gamma_MD[ibody]*nrigid_shell[ibody]/masstotal[ibody]); DMDcoeff= (dtv - (masstotal[ibody]/nrigid_shell[ibody])*(1.0-expminusdttimesgamma)/Gamma_MD[ibody]); - + vcm[ibody][0] += fflag[ibody][0]*DMDcoeff*force->ftm2v*(fcm[ibody][0]-fcm_old[ibody][0])/Gamma_MD[ibody]/dtv/nrigid_shell[ibody]; vcm[ibody][1] += fflag[ibody][1]*DMDcoeff*force->ftm2v*(fcm[ibody][1]-fcm_old[ibody][1])/Gamma_MD[ibody]/dtv/nrigid_shell[ibody]; vcm[ibody][2] += fflag[ibody][2]*DMDcoeff*force->ftm2v*(fcm[ibody][2]-fcm_old[ibody][2])/Gamma_MD[ibody]/dtv/nrigid_shell[ibody]; - + torque_factor = 5.0*Gamma_MD[ibody]*nrigid_shell[ibody]/(3.0*masstotal[ibody]); expminusdttimesgamma = exp(-dtv*torque_factor); DMDcoeff = (dtv - (1.0-expminusdttimesgamma)/torque_factor); @@ -1035,34 +1035,34 @@ void FixLbRigidPCSphere::final_integrate() else massone = mass[type[i]]; domain->unmap(x[i],image[i],unwrap); - + dx = unwrap[0] - xcm[ibody][0]; dy = unwrap[1] - xcm[ibody][1]; - dz = unwrap[2] - xcm[ibody][2]; + dz = unwrap[2] - xcm[ibody][2]; if(inner_nodes == 1){ if(!(mask[i] & group->bitmask[igroupinner])){ sum[ibody][0] += up[i][0]*massone; sum[ibody][1] += up[i][1]*massone; - sum[ibody][2] += up[i][2]*massone; - sum[ibody][3] += Gamma_MD[ibody]*(dy * ((up[i][2]-vcm[ibody][2])) - + sum[ibody][2] += up[i][2]*massone; + sum[ibody][3] += Gamma_MD[ibody]*(dy * ((up[i][2]-vcm[ibody][2])) - dz * ((up[i][1]-vcm[ibody][1]))); - sum[ibody][4] += Gamma_MD[ibody]*(dz * ((up[i][0]-vcm[ibody][0])) - + sum[ibody][4] += Gamma_MD[ibody]*(dz * ((up[i][0]-vcm[ibody][0])) - dx * ((up[i][2]-vcm[ibody][2]))); - sum[ibody][5] += Gamma_MD[ibody]*(dx * ((up[i][1]-vcm[ibody][1])) - - dy * ((up[i][0]-vcm[ibody][0]))); + sum[ibody][5] += Gamma_MD[ibody]*(dx * ((up[i][1]-vcm[ibody][1])) - + dy * ((up[i][0]-vcm[ibody][0]))); } }else{ sum[ibody][0] += up[i][0]*massone; sum[ibody][1] += up[i][1]*massone; sum[ibody][2] += up[i][2]*massone; - sum[ibody][3] += Gamma_MD[ibody]*(dy * ((up[i][2]-vcm[ibody][2])) - + sum[ibody][3] += Gamma_MD[ibody]*(dy * ((up[i][2]-vcm[ibody][2])) - dz * ((up[i][1]-vcm[ibody][1]))); - sum[ibody][4] += Gamma_MD[ibody]*(dz * ((up[i][0]-vcm[ibody][0])) - + sum[ibody][4] += Gamma_MD[ibody]*(dz * ((up[i][0]-vcm[ibody][0])) - dx * ((up[i][2]-vcm[ibody][2]))); - sum[ibody][5] += Gamma_MD[ibody]*(dx * ((up[i][1]-vcm[ibody][1])) - + sum[ibody][5] += Gamma_MD[ibody]*(dx * ((up[i][1]-vcm[ibody][1])) - dy * ((up[i][0]-vcm[ibody][0]))); - } + } } MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world); @@ -1080,7 +1080,7 @@ void FixLbRigidPCSphere::final_integrate() expminusdttimesgamma = exp(-dtv*Gamma_MD[ibody]*nrigid_shell[ibody]/masstotal[ibody]); DMDcoeff= (dtv - (masstotal[ibody]/nrigid_shell[ibody])*(1.0-expminusdttimesgamma)/Gamma_MD[ibody]); - + vcm[ibody][0] += DMDcoeff*fflag[ibody][0]*(ucm[ibody][0]-ucm_old[ibody][0])/dtv; vcm[ibody][1] += DMDcoeff*fflag[ibody][1]*(ucm[ibody][1]-ucm_old[ibody][1])/dtv; vcm[ibody][2] += DMDcoeff*fflag[ibody][2]*(ucm[ibody][2]-ucm_old[ibody][2])/dtv; @@ -1094,7 +1094,7 @@ void FixLbRigidPCSphere::final_integrate() omega[ibody][1] += tflag[ibody][1]*(3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* DMDcoeff*(torque_fluid[ibody][1] - torque_fluid_old[ibody][1])/dtv; omega[ibody][2] += tflag[ibody][2]*(3.0/(2.0*nrigid_shell[ibody]*sphereradius[ibody]*sphereradius[ibody]*Gamma_MD[ibody]))* - DMDcoeff*(torque_fluid[ibody][2] - torque_fluid_old[ibody][2])/dtv; + DMDcoeff*(torque_fluid[ibody][2] - torque_fluid_old[ibody][2])/dtv; } set_v(); @@ -1119,7 +1119,7 @@ void FixLbRigidPCSphere::set_v() double **v = atom->v; double **f = atom->f; double *rmass = atom->rmass; - double *mass = atom->mass; + double *mass = atom->mass; int *type = atom->type; imageint *image = atom->image; int nlocal = atom->nlocal; @@ -1142,7 +1142,7 @@ void FixLbRigidPCSphere::set_v() xunwrap = x[i][0] + xbox*xprd; yunwrap = x[i][1] + ybox*yprd; zunwrap = x[i][2] + zbox*zprd; - + dx = xunwrap - xcm[ibody][0]; dy = yunwrap - xcm[ibody][1]; dz = zunwrap - xcm[ibody][2]; @@ -1169,7 +1169,7 @@ void FixLbRigidPCSphere::set_v() else massone = mass[type[i]]; fc0 = massone*(v[i][0] - v0)/dtf - f[i][0] + Gamma_MD[ibody]*(v0-up[i][0]); fc1 = massone*(v[i][1] - v1)/dtf - f[i][1] + Gamma_MD[ibody]*(v1-up[i][1]); - fc2 = massone*(v[i][2] - v2)/dtf - f[i][2] + Gamma_MD[ibody]*(v2-up[i][2]); + fc2 = massone*(v[i][2] - v2)/dtf - f[i][2] + Gamma_MD[ibody]*(v2-up[i][2]); xbox = (image[i] & IMGMASK) - IMGMAX; ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; @@ -1211,7 +1211,7 @@ void FixLbRigidPCSphere::set_xv() double **v = atom->v; double **f = atom->f; double *rmass = atom->rmass; - double *mass = atom->mass; + double *mass = atom->mass; int *type = atom->type; imageint *image = atom->image; int nlocal = atom->nlocal; @@ -1222,9 +1222,9 @@ void FixLbRigidPCSphere::set_xv() double xunwrap,yunwrap,zunwrap; double dx,dy,dz; - + // set x and v of each atom - + for (int i = 0; i < nlocal; i++) { if (body[i] < 0) continue; ibody = body[i]; @@ -1236,7 +1236,7 @@ void FixLbRigidPCSphere::set_xv() xunwrap = x[i][0] + xbox*xprd; yunwrap = x[i][1] + ybox*yprd; zunwrap = x[i][2] + zbox*zprd; - + dx = xunwrap - xcm_old[ibody][0]; dy = yunwrap - xcm_old[ibody][1]; dz = zunwrap - xcm_old[ibody][2]; @@ -1299,7 +1299,7 @@ void FixLbRigidPCSphere::set_xv() else massone = mass[type[i]]; fc0 = massone*(v[i][0] - v0)/dtf - f[i][0] + Gamma_MD[ibody]*(v0-up[i][0]); fc1 = massone*(v[i][1] - v1)/dtf - f[i][1] + Gamma_MD[ibody]*(v1-up[i][1]); - fc2 = massone*(v[i][2] - v2)/dtf - f[i][2] + Gamma_MD[ibody]*(v2-up[i][2]); + fc2 = massone*(v[i][2] - v2)/dtf - f[i][2] + Gamma_MD[ibody]*(v2-up[i][2]); vr[0] = 0.5*x0*fc0; vr[1] = 0.5*x1*fc1; @@ -1323,7 +1323,7 @@ void FixLbRigidPCSphere::set_xv() due to 1st definition of rigid body or due to box flip if don't do this, then atoms of a body which drifts far away from a triclinic box will be remapped back into box - with huge displacements when the box tilt changes via set_x() + with huge displacements when the box tilt changes via set_x() ------------------------------------------------------------------------- */ void FixLbRigidPCSphere::pre_neighbor() @@ -1333,7 +1333,7 @@ void FixLbRigidPCSphere::pre_neighbor() for (int ibody = 0; ibody < nbody; ibody++) { original = imagebody[ibody]; domain->remap(xcm[ibody],imagebody[ibody]); - + if (original == imagebody[ibody]) remapflag[ibody][3] = 0; else { oldimage = original & IMGMASK; @@ -1386,7 +1386,7 @@ void FixLbRigidPCSphere::pre_neighbor() } } /* ---------------------------------------------------------------------- - count # of degrees-of-freedom removed by fix_rigid for atoms in igroup + count # of degrees-of-freedom removed by fix_rigid for atoms in igroup ------------------------------------------------------------------------- */ int FixLbRigidPCSphere::dof(int igroup) @@ -1423,7 +1423,7 @@ int FixLbRigidPCSphere::dof(int igroup) } /* ---------------------------------------------------------------------- - memory usage of local atom-based arrays + memory usage of local atom-based arrays ------------------------------------------------------------------------- */ double FixLbRigidPCSphere::memory_usage() @@ -1434,10 +1434,10 @@ double FixLbRigidPCSphere::memory_usage() bytes += maxvatom*6 * sizeof(double); return bytes; -} +} /* ---------------------------------------------------------------------- - allocate local atom-based arrays + allocate local atom-based arrays ------------------------------------------------------------------------- */ void FixLbRigidPCSphere::grow_arrays(int nmax) @@ -1449,7 +1449,7 @@ void FixLbRigidPCSphere::grow_arrays(int nmax) } /* ---------------------------------------------------------------------- - copy values within local atom-based arrays + copy values within local atom-based arrays ------------------------------------------------------------------------- */ void FixLbRigidPCSphere::copy_arrays(int i, int j, int delflag) @@ -1474,7 +1474,7 @@ void FixLbRigidPCSphere::set_arrays(int i) } /* ---------------------------------------------------------------------- - pack values in local atom-based arrays for exchange with another proc + pack values in local atom-based arrays for exchange with another proc ------------------------------------------------------------------------- */ int FixLbRigidPCSphere::pack_exchange(int i, double *buf) @@ -1488,7 +1488,7 @@ int FixLbRigidPCSphere::pack_exchange(int i, double *buf) } /* ---------------------------------------------------------------------- - unpack values in local atom-based arrays from exchange with another proc + unpack values in local atom-based arrays from exchange with another proc ------------------------------------------------------------------------- */ int FixLbRigidPCSphere::unpack_exchange(int nlocal, double *buf) @@ -1520,16 +1520,16 @@ double FixLbRigidPCSphere::compute_scalar() double t = 0.0; for (int i = 0; i < nbody; i++) { - t += masstotal[i] * (fflag[i][0]*vcm[i][0]*vcm[i][0] + + t += masstotal[i] * (fflag[i][0]*vcm[i][0]*vcm[i][0] + fflag[i][1]*vcm[i][1]*vcm[i][1] + \ fflag[i][2]*vcm[i][2]*vcm[i][2]); - + // wbody = angular velocity in body frame - + inertia = 2.0*masstotal[i]*sphereradius[i]*sphereradius[i]/5.0; - + t += tflag[i][0]*inertia*omega[i][0]*omega[i][0] + - tflag[i][1]*inertia*omega[i][1]*omega[i][1] + + tflag[i][1]*inertia*omega[i][1]*omega[i][1] + tflag[i][2]*inertia*omega[i][2]*omega[i][2]; } @@ -1582,22 +1582,22 @@ double FixLbRigidPCSphere::compute_array(int i, int j) //Calculate nearest leftmost grid point. //Since array indices from 1 to subNb-2 correspond to the - // local subprocessor domain (not indices from 0), use the + // local subprocessor domain (not indices from 0), use the // ceiling value. ix = (int)ceil((x[i][0]-domain->sublo[0])/dx_lb); iy = (int)ceil((x[i][1]-domain->sublo[1])/dx_lb); iz = (int)ceil((x[i][2]-domain->sublo[2])/dx_lb); - + //Calculate distances to the nearest points. dx1 = x[i][0] - (domain->sublo[0] + (ix-1)*dx_lb); dy1 = x[i][1] - (domain->sublo[1] + (iy-1)*dx_lb); dz1 = x[i][2] - (domain->sublo[2] + (iz-1)*dx_lb); - + // Need to convert these to lattice units: dx1 = dx1/dx_lb; dy1 = dy1/dx_lb; dz1 = dz1/dx_lb; - + up[i][0]=0.0; up[i][1]=0.0; up[i][2]=0.0; @@ -1605,7 +1605,7 @@ double FixLbRigidPCSphere::compute_array(int i, int j) isten=0; for(ii=-1; ii<3; ii++){ rsq=(-dx1+ii)*(-dx1+ii); - + if(rsq>=4) weightx=0.0; else{ @@ -1648,7 +1648,7 @@ double FixLbRigidPCSphere::compute_array(int i, int j) if(ixp==-1) ixp=subNbx+2; if(iyp==-1) iyp=subNby+2; if(izp==-1) izp=subNbz+2; - + FfP[isten] = weightx*weighty*weightz; // interpolated velocity based on delta function. for(k=0; k<3; k++){ @@ -1666,11 +1666,11 @@ double FixLbRigidPCSphere::compute_array(int i, int j) FfP[5] = dx1*(1.-dy1)*dz1; FfP[6] = dx1*dy1*(1.-dz1); FfP[7] = dx1*dy1*dz1; - + ixp = (ix+1); iyp = (iy+1); izp = (iz+1); - + for (k=0; k<3; k++) { // tri-linearly interpolated velocity at node up[i][k] = u_lb[ix][iy][iz][k]*FfP[0] + u_lb[ix][iy][izp][k]*FfP[1] @@ -1679,13 +1679,13 @@ double FixLbRigidPCSphere::compute_array(int i, int j) + u_lb[ixp][iy][iz][k]*FfP[4] + u_lb[ixp][iy][izp][k]*FfP[5] + u_lb[ixp][iyp][iz][k]*FfP[6] - + u_lb[ixp][iyp][izp][k]*FfP[7]; + + u_lb[ixp][iyp][izp][k]*FfP[7]; } - } + } for(k=0; k<3; k++) up[i][k] = up[i][k]*dx_lb/dt_lb; } } - + } diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.h b/src/USER-LB/fix_lb_rigid_pc_sphere.h index 0ce7e9b8339d5a2135557cb98f98ae5cc1e4724f..be7e9ee25313a234ebae89cf0fe72615cd8e5045 100755 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.h +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -90,7 +90,7 @@ class FixLbRigidPCSphere : public Fix { double tfactor; // scale factor on temperature of rigid bodies int inner_nodes; // ==1 if certain particle are inside the rigid - // body and should not interact with the fluid. + // body and should not interact with the fluid. // ==0 otherwise. int igroupinner; // specifies the particles which are inside the // spherical rigid body, and do not interact with @@ -98,7 +98,7 @@ class FixLbRigidPCSphere : public Fix { void set_xv(); void set_v(); - + void compute_up(); class FixLbFluid *fix_lb_fluid; diff --git a/src/USER-LB/fix_lb_viscous.cpp b/src/USER-LB/fix_lb_viscous.cpp index 03beb57f3d6597b2a2631f1a059093ea9db748fd..d0157272a8a245d360caa86f92b94ffd180035ed 100755 --- a/src/USER-LB/fix_lb_viscous.cpp +++ b/src/USER-LB/fix_lb_viscous.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -15,9 +15,9 @@ Contributing authors: Frances Mackay, Santtu Ollila, Colin Denniston (UWO) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_lb_viscous.h" #include "atom.h" #include "update.h" @@ -38,7 +38,7 @@ FixLbViscous::FixLbViscous(LAMMPS *lmp, int narg, char **arg) : if (narg < 3) error->all(FLERR,"Illegal fix lb/viscous command"); int groupbit_lb_fluid = 0; - + for(int ifix=0; ifix<modify->nfix; ifix++) if(strcmp(modify->fix[ifix]->style,"lb/fluid")==0){ fix_lb_fluid = (FixLbFluid *)modify->fix[ifix]; @@ -52,9 +52,9 @@ FixLbViscous::FixLbViscous(LAMMPS *lmp, int narg, char **arg) : int nlocal = atom->nlocal; for(int j=0; j<nlocal; j++){ if((mask[j] & groupbit) && !(mask[j] & groupbit_lb_fluid)) - error->one(FLERR,"to apply a fluid force onto an atom, the lb/fluid fix must be used for that atom."); + error->one(FLERR,"to apply a fluid force onto an atom, the lb/fluid fix must be used for that atom."); } - + } diff --git a/src/USER-LB/fix_lb_viscous.h b/src/USER-LB/fix_lb_viscous.h index 3a6569fac748b7a3be6d65ef1c634c4e35cdbd55..51cecc293bb5d0c4ec98cb5aa49b6130f0e25cda 100755 --- a/src/USER-LB/fix_lb_viscous.h +++ b/src/USER-LB/fix_lb_viscous.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -40,7 +40,7 @@ class FixLbViscous : public Fix { int nlevels_respa; private: - class FixLbFluid *fix_lb_fluid; + class FixLbFluid *fix_lb_fluid; }; } diff --git a/src/USER-MGPT/mgpt_linalg.cpp b/src/USER-MGPT/mgpt_linalg.cpp index 185b61e1c7aeb7f5c36e5c666282a190424424aa..94a4e21ea6a3cb185a556459e30dd98b3cbab0e4 100644 --- a/src/USER-MGPT/mgpt_linalg.cpp +++ b/src/USER-MGPT/mgpt_linalg.cpp @@ -94,7 +94,7 @@ static void transprod_generic(const double * restrict A, C[i*lda+(j+1)] = s; } } - + static void transtrace3_generic(const double * restrict A, const double * restrict B0,double * restrict tout0, const double * restrict B1,double * restrict tout1, @@ -146,7 +146,7 @@ mgpt_linalg::mgpt_linalg() { tr_trace = transtrace3_error; single = 0; } - + mgpt_linalg::mgpt_linalg(int n,int single_precision) { mgpt_linalg::matrix_size = n; diff --git a/src/USER-MGPT/mgpt_readpot.cpp b/src/USER-MGPT/mgpt_readpot.cpp index bfbb15ddcbc781c6f34343794165d3f477553076..144c661b050e12c202c1bb8f1a786908046ead82 100644 --- a/src/USER-MGPT/mgpt_readpot.cpp +++ b/src/USER-MGPT/mgpt_readpot.cpp @@ -39,7 +39,7 @@ static double fl(double r,int mode,double rp,double p1,double al,double r0,doubl term = pow(rp/r, p1); else term = exp(-p1*(pow(r/rp, pn) - 1.0)/pn); - + if (r <= r0) return term; double quan = al*(r/r0 - 1.0)*(r/r0 - 1.0); if(mode <= 2) @@ -102,7 +102,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub __FILE__,__LINE__, metal,ipot,mode, metalx,ipotx,modex); - exit(1); + exit(1); } } @@ -129,7 +129,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub __FILE__,__LINE__,potin_file); exit(1); } - + if(0) { printf("Before sort:\n"); for(int i = 0; i<n; i++) @@ -196,7 +196,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl if(0) { printf("getparmindata() ==> nvol = %d, vol0 = %.6f, x0= %.6f, x1 = %.6f, dx = %.6f\n", nvol,vol0,x0,x1,dx); - } + } } else { /* Two-line version, reparse this line, and read second line */ sscanf(line,"%lf %lf %lf %lf",&x0,&x1,&dx,&vol0); @@ -375,7 +375,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl double alp = al,alm = al; if(mode == 2 || mode == 4 || mode == 6) alm = 125.0; al = alp; - + double r = r0 + j*(r1-r0)/(nr-1); double rrws = r/rws; @@ -386,7 +386,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl double v2a = vatab[i]*fl2*fl2; double v2b = vbtab[i]*fl2; double fscr = 1.0; - + if(bscreen == 1 && rrws >= r0rws) { double arg = rrws/r0rwstab[i]; double arg1 = arg - 1.0; @@ -402,7 +402,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl dp=2.0*al*al*arg*arg13/(1.+al*arg12); } fscr = f*f; - } + } double vpair_tmp = vpairtab[i*nr+j]; vpairtab[i*nr+j] = vpairtab[i*nr+j]*fscr + v2a - v2b; @@ -421,7 +421,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl } - + } } fclose(in); @@ -488,10 +488,10 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl if(1) { printf("%% READPOT PARAMETERS:\n"); - + printf("%% ddl = %15.5e %15.5e %15.5e %15.5e\n",ddl[1],ddl[2],ddl[3],ddl[4]); printf("%% anorm3 = %15.5e anorm4 = %15.5e\n",anorm3,anorm4); - + printf("%% x = %15.5e pn = %15.5e\n",x,pn); printf("%% va = %15.5e dva = %15.5e\n",va,dva); printf("%% vb = %15.5e dvb = %15.5e\n",vb,dvb); diff --git a/src/USER-MGPT/mgpt_readpot.h b/src/USER-MGPT/mgpt_readpot.h index c8a7a806d1bdaf694917bfe7406cc40407655c6a..c19ea40774c7cb80ff893e510cd2689dfd809ab0 100644 --- a/src/USER-MGPT/mgpt_readpot.h +++ b/src/USER-MGPT/mgpt_readpot.h @@ -30,7 +30,7 @@ struct potdata { double (*vpair_spline)[4],(*dvpair_spline)[4]; double r0,r1; int nr; - + double mass,rcrit,rmax; int lang,lmax; @@ -64,7 +64,7 @@ struct potdata2 { double (*vpair)[4][4],(*dvpair)[4][4]; double r0,r1,T0,T1; int nr,nt; - + potdata *potlist; double mass,rcrit,rmax; diff --git a/src/USER-MGPT/mgpt_splinetab.cpp b/src/USER-MGPT/mgpt_splinetab.cpp index 22df495f9e4154dec153de84fbb16ff8085c6be1..7cff0e6e2b3bfe565b20a250ccece4b9dbcbaefa 100644 --- a/src/USER-MGPT/mgpt_splinetab.cpp +++ b/src/USER-MGPT/mgpt_splinetab.cpp @@ -40,7 +40,7 @@ void makespline(int ntab,int stride,double tab[],double C[][4]) { double h_left,h_right,d; int i,j; - + /* Second order second derivative approximation at end points. */ h_left = @@ -58,7 +58,7 @@ void makespline(int ntab,int stride,double tab[],double C[][4]) { A[j+2][0] = 1.0; A[j+2][1] = 2.0; A[j+2][2] = -1.0; y[j+2] = -d; A[j+3][0] = 2.0; A[j+3][1] = 2.0; A[j+3][2] = -2.0; y[j+3] = 2.0*d; } - + j = 3*(ntab-2); d = tab[stride*(ntab-1)] - tab[stride*(ntab-2)]; A[j+1][0] = 1.0; A[j+1][1] = 1.0; A[j+1][2] = 1.0; y[j+1] = d; @@ -82,9 +82,9 @@ void evalcubic(double p[4],double x,double *y,double *dy,double *d2y) { t1 = p[2] + x*p[3]; t2 = p[1] + x*t1; - + t3 = t1 + x*p[3]; - + *y = p[0] + x*t2; *dy = (t2 + x*t3); *d2y = 2.0*(t3 + x*p[3]); @@ -115,9 +115,9 @@ void evalspline(int n,double x0,double x1,double C[][4], } else { t1 = p[2] + xhat*p[3]; t2 = p[1] + xhat*t1; - + t3 = t1 + xhat*p[3]; - + *y = p[0] + xhat*t2; *dy = (t2 + xhat*t3)*dxinv; *d2y = 2.0*(t3 + xhat*p[3])*(dxinv*dxinv); diff --git a/src/USER-MGPT/mgpt_splinetab.h b/src/USER-MGPT/mgpt_splinetab.h index e719f34218aac6f3316e8858b0fe24bed41d1652..05c9dbcafb244754dc823f133c472a446d6b96de 100644 --- a/src/USER-MGPT/mgpt_splinetab.h +++ b/src/USER-MGPT/mgpt_splinetab.h @@ -24,11 +24,11 @@ Given a table of ntab data points tab, assumed to be sampled on an equidistant grid, compute coefficients of interpolating cubic polynimials, one per interval (i.e. ntab-1 polynomials). - + Input point i is located at tab[i*stride]. - + Coefficients of output polynomial j are at C[j][0..3]; - + The piecewise polynimials form a C^2 function which approximates the input function to fourth order. diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index 596e66f48868791e451272d83600829c419082a1..83524107c8d07cc688245306bd47d055851b7556 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: Tomas Oppelstrup, LLNL (oppelstrup2@llnl.gov) + Contributing authors: Tomas Oppelstrup, LLNL (oppelstrup2@llnl.gov) and John Moriarty, LLNL (moriarty2@llnl.gov) Fast MGPT algorithm developed by Tomas Oppelstrup (2015) based on the @@ -62,7 +62,7 @@ static double gettime(int x = 0) { const double x = 1.0 / CLOCKS_PER_SEC; return clock() * x; */ - + //const double invfreq = 1.0 / 2394.108e6; /* const double invfreq = 1.0 / 700e6; @@ -147,12 +147,12 @@ void PairMGPT::make_bond(const double xx[][3],int i,int j,bond_data *bptr) { hamltn_5_raw(rrij[0],rrij[1],rrij[2], bptr->H.m ,bptr->Hx.m, bptr->Hy.m,bptr->Hz.m,&bptr->fl_deriv_sum); - } else { + } else { hamltn_7_raw(rrij[0],rrij[1],rrij[2], bptr->H.m ,bptr->Hx.m, bptr->Hy.m,bptr->Hz.m,&bptr->fl_deriv_sum); } - + t1 = gettime(); t_make_b2 += t1-t0; n_make_b2++; @@ -274,10 +274,10 @@ PairMGPT::triplet_data *PairMGPT::get_triplet(const double xx[][3],int i,int j,i } -double PairMGPT::numderiv3t(double xx[][3],int i,int j,int k,int p) { +double PairMGPT::numderiv3t(double xx[][3],int i,int j,int k,int p) { static bond_data Bij,Bjk,Bki; const double delta = 1e-5; - + const double xsave = xx[i][p]; double e1,e2; @@ -301,10 +301,10 @@ double PairMGPT::numderiv3t(double xx[][3],int i,int j,int k,int p) { return (e1 - e2)/(2.0*delta); } -double PairMGPT::numderiv3v(double xx[][3],int i,int j,int k,int p,int ipert) { +double PairMGPT::numderiv3v(double xx[][3],int i,int j,int k,int p,int ipert) { static bond_data Bij,Bik; const double delta = 1e-5; - + const double xsave = xx[ipert][p]; double e1,e2; @@ -325,10 +325,10 @@ double PairMGPT::numderiv3v(double xx[][3],int i,int j,int k,int p,int ipert) { } -double PairMGPT::numderiv4(double xx[][3],int i,int j,int k,int m,int p) { +double PairMGPT::numderiv4(double xx[][3],int i,int j,int k,int m,int p) { static bond_data Bij,Bjk,Bkm,Bmi; const double delta = 1e-5; - + const double xsave = xx[i][p]; double e1,e2; @@ -365,14 +365,14 @@ void PairMGPT::force_debug_3t(double xx[][3], dfi[0] = dfix; dfi[1] = dfiy; dfi[2] = dfiz; dfj[0] = dfjx; dfj[1] = dfjy; dfj[2] = dfjz; dfk[0] = dfkx; dfk[1] = dfky; dfk[2] = dfkz; - + for(int p = 0; p<3; p++) { /* Compute numerical derivatives by displacing atoms i,j,k */ double ndfi,ndfj,ndfk; ndfi = -numderiv3t(xx,i,j,k,p); ndfj = -numderiv3t(xx,j,k,i,p); ndfk = -numderiv3t(xx,k,i,j,p); - + if((fabs(dfi[p] - ndfi) > dtol && fabs(dfi[p] - ndfi) > dtol*fabs(ndfi)) || (fabs(dfj[p] - ndfj) > dtol && @@ -382,7 +382,7 @@ void PairMGPT::force_debug_3t(double xx[][3], printf("Force error in T12 & T23 & T31 :: i,j,k = %d,%d,%d\n",i0,j0,k0); printf(" dE/d%c[i] = %20.10e %20.10e\n", 'x'+p,ndfi, dfi[p]); printf(" dE/d%c[j] = %20.10e %20.10e\n", 'x'+p,ndfj, dfj[p]); - printf(" dE/d%c[k] = %20.10e %20.10e\n", 'x'+p,ndfk, dfk[p]); + printf(" dE/d%c[k] = %20.10e %20.10e\n", 'x'+p,ndfk, dfk[p]); printf("\n"); } } @@ -398,14 +398,14 @@ void PairMGPT::force_debug_3v(double xx[][3], dfi[0] = dfix; dfi[1] = dfiy; dfi[2] = dfiz; dfj[0] = dfjx; dfj[1] = dfjy; dfj[2] = dfjz; dfk[0] = dfkx; dfk[1] = dfky; dfk[2] = dfkz; - + for(int p = 0; p<3; p++) { /* Compute numerical derivatives by displacing atoms i,j,k */ double ndfi,ndfj,ndfk; ndfi = -numderiv3v(xx,i,j,k,p,i0); ndfj = -numderiv3v(xx,i,j,k,p,j0); ndfk = -numderiv3v(xx,i,j,k,p,k0); - + if((fabs(dfi[p] - ndfi) > dtol && fabs(dfi[p] - ndfi) > dtol*fabs(ndfi)) || (fabs(dfj[p] - ndfj) > dtol && @@ -415,7 +415,7 @@ void PairMGPT::force_debug_3v(double xx[][3], printf("Force error in T12 :: i,j,k = %d,%d,%d\n",i0,j0,k0); printf(" dE/d%c[i] = %20.10e %20.10e\n", 'x'+p,ndfi, dfi[p]); printf(" dE/d%c[j] = %20.10e %20.10e\n", 'x'+p,ndfj, dfj[p]); - printf(" dE/d%c[k] = %20.10e %20.10e\n", 'x'+p,ndfk, dfk[p]); + printf(" dE/d%c[k] = %20.10e %20.10e\n", 'x'+p,ndfk, dfk[p]); printf("\n"); } } @@ -434,7 +434,7 @@ void PairMGPT::force_debug_4(double xx[][3], dfj[0] = dfjx; dfj[1] = dfjy; dfj[2] = dfjz; dfk[0] = dfkx; dfk[1] = dfky; dfk[2] = dfkz; dfm[0] = dfmx; dfm[1] = dfmy; dfm[2] = dfmz; - + const int ii0[] = {i0,j0,k0,m0},ii[] = {i,j,k,m,i,j,k}; for(int p = 0; p<3; p++) { @@ -466,7 +466,7 @@ void PairMGPT::force_debug_4(double xx[][3], printf("Force error in T31 & T64 :: i,j,k,m = %d,%d,%d,%d\n",i0,j0,k0,m0); printf(" dE/d%c[i] = %20.10e %20.10e\n", 'x'+p,ndfi, dfi[p]); printf(" dE/d%c[j] = %20.10e %20.10e\n", 'x'+p,ndfj, dfj[p]); - printf(" dE/d%c[k] = %20.10e %20.10e\n", 'x'+p,ndfk, dfk[p]); + printf(" dE/d%c[k] = %20.10e %20.10e\n", 'x'+p,ndfk, dfk[p]); printf(" dE/d%c[m] = %20.10e %20.10e\n", 'x'+p,ndfm, dfm[p]); printf("\n"); } @@ -519,7 +519,7 @@ void PairMGPT::force_debug_4(double xx[][3], dfj##coord = ( ( sij)*trd1##coord + (-sjk)*trd2##coord ) * (ve / anorm4); \ dfk##coord = ( ( sjk)*trd2##coord + (-skm)*trd4##coord ) * (ve / anorm4); \ dfm##coord = ( ( sim)*trd3##coord + ( skm)*trd4##coord ) * (ve / anorm4); \ - } while(0) + } while(0) #define dfix_update_4b(coord) \ @@ -592,7 +592,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, int evflag,int newton_pair) { Hash<bond_data,Doublet> bond_hash(100000); int i,j,k,m,ix,jx,kx,mx,itag,jtag,p; - + double e_single,e_pair,e_triplet,e_triplet_c,e_quad; double volvir2; @@ -709,7 +709,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, if(triclinic) { double E[3][3],EX[3][3]; int cyc[] = {0,1,2,0,1}; - + ss = (double (*)[3]) memory->smalloc(sizeof(double [3]) * ntot, "mgpt: local reduced coordinate vector."); @@ -739,7 +739,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } } else ss = xx; - + nneitot = 0; for(ix = 0; ix<ntot; ix++) { for(p = 0; p<3; p++) { @@ -773,7 +773,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, printf("Can not handle triclinic box yet\n"); error->all(__FILE__,__LINE__,"Can not handle triclinic cell with mgpt yet."); } - + /* for(i = 0; i<nloc; i++) { printf("Atom %3d:: %10.3f %10.3f %10.3f\n", @@ -788,13 +788,13 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, first[i+1] = first[i]; const int c1 = c1_outside(ss[i],triclinic,alpha); - + tx0 = gettime(); for(jx = 0; jx<nnei[i]; jx++) { fjx = fjy = fjz = 0.0; j = NIDX( nlist[i][jx] ); - + rij2 = 0.0; for(p = 0; p<3; p++) { double t = xx[i][p] - xx[j][p]; @@ -813,14 +813,14 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, splinepot.eval_pot(rij,&de_pair,&df); de_pair = de_pair * e_scale * w2; df = df / rij * w2; - + if(pair_energies == 0) de_pair = 0.0; e_pair = e_pair + de_pair; c_p++; - + if(pair_forces == 0) df = 0.0; - + if(volpres_flag && pair_energies) { double dvir; splinepot.eval_vir(rij,&dvir); @@ -834,40 +834,40 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, vatom[j][pp] -= 0.5 * rhoinv*e_scale*dvir*w2; } } - + double drijx = xx[j][0] - xx[i][0]; double drijy = xx[j][1] - xx[i][1]; double drijz = xx[j][2] - xx[i][2]; - + fix = fix + df*drijx; fjx = fjx - df*drijx; - + fiy = fiy + df*drijy; fjy = fjy - df*drijy; - + fiz = fiz + df*drijz; fjz = fjz - df*drijz; - + if(evflag) { //ev_tally(i,j,nloc,newton_pair,de_pair,0.0,df,-drijx,-drijy,-drijz); /* To fix stress-per-atom scaling, and sign */ ev_tally(i,j,nloc,newton_pair,de_pair,0.0,-df * e_scale,-drijx,-drijy,-drijz); } - + ff[j][0] += fjx * e_scale; ff[j][1] += fjy * e_scale; ff[j][2] += fjz * e_scale; - + } } } - + if(rij2 < rcut2_bond && c2_outside(ss[i],ss[j],triclinic,alpha) == 0) { /* Add j to short neighbor list for i. - Insert j to keep list sorted. + Insert j to keep list sorted. */ - + p = first[i+1]-1; while(p >= first[i] && nlist_short[p] > j) { nlist_short[p+1] = nlist_short[p]; @@ -880,13 +880,13 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, nneitot,i); error->one(__FILE__,__LINE__,"Shit! Short list full\n"); } - + } } ff[i][0] += fix * e_scale; ff[i][1] += fiy * e_scale; - ff[i][2] += fiz * e_scale; + ff[i][2] += fiz * e_scale; tx1 = gettime(); tpair += tx1-tx0; @@ -916,27 +916,27 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, fjx = fjy = fjz = 0.0; j = nlist_short[jx]; - + for(kx = first[i]; kx<jx; kx++) { fkx = fky = fkz = 0.0; k = nlist_short[kx]; - + /* Search lists of j and k, and see if 1) j is in k-list (closed triplet) 2) j and k have a common neighbor (closed quadruplet) */ - + c_ij = c_ki = 1; - + const int sij = (i < j) ? 1 : -1; const int sjk = (j < k) ? 1 : -1; const int ski = (k < i) ? 1 : -1; - - + + T12 = T23 = T31 = 0; - + mj = first[j]; /* Since i is in the j-list, and i > k and the list @@ -946,7 +946,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, if(mj < first[j+1] && nlist_short[mj] == k) { /* Closed triplet */ c_jk = 1; - + if(j > i) continue; /* Require k<j<i for closed triplets */ } else { /* Open triplet */ @@ -954,13 +954,13 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } tx0 = gettime(); - + w3 = get_weight(triclinic,ss[i],ss[j],ss[k]); int triplet_defer; if(w3 > 0.0) { triplet_defer = 0; - + dvir_ij = dvir_jk = dvir_ki = 0.0; if(c_ij && c_jk) T12 = get_triplet(xx,j,i,k,&bond_hash,&T12work,&dvir_ij,&dvir_jk); @@ -968,7 +968,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, T23 = get_triplet(xx,k,i,j,&bond_hash,&T23work,&dvir_ki,&dvir_jk); if(c_ij && c_ki) T31 = get_triplet(xx,i,j,k,&bond_hash,&T31work,&dvir_ij,&dvir_ki); - + if(evflag) { fsave[0][0] = fix; fsave[0][1] = fiy; fsave[0][2] = fiz; fsave[1][0] = fjx; fsave[1][1] = fjy; fsave[1][2] = fjz; @@ -977,14 +977,14 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, fjx = fjy = fjz = 0.0; fkx = fky = fkz = 0.0; } - - tr0 = tr1 = tr2 = tr3 = 0.0; + + tr0 = tr1 = tr2 = tr3 = 0.0; double xvir3t,xvir3v; xvir3t = xvir3v = 0.0; if(T12 && T23) { bond_data *bki = bond_hash.Lookup(Doublet(k,i)); - + if(three_body_energies && evflag) { tr0 = transtrace(T12->H1H2,bki->H); double dvir = ((dvir_ij + dvir_jk + bki->fl_deriv_sum)*splinepot.vc + @@ -993,7 +993,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, xvir3t = xvir3t + dvir; } mcount2++; - + { const double vc = splinepot.vc; tr_trace3(&(bki->H.m[1][0]), @@ -1009,7 +1009,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, tr_trace3(&(T12->H1H2.m[1][0]), &(bki->Hx.m[1][0]),&utr3x.d, &(bki->Hy.m[1][0]),&utr3y.d, - &(bki->Hz.m[1][0]),&utr3z.d); + &(bki->Hz.m[1][0]),&utr3z.d); if(linalg.single) { trd1x = utr1x.f; trd2x = utr2x.f; trd3x = utr3x.f; @@ -1018,17 +1018,17 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } else { trd1x = utr1x.d; trd2x = utr2x.d; trd3x = utr3x.d; trd1y = utr1y.d; trd2y = utr2y.d; trd3y = utr3y.d; - trd1z = utr1z.d; trd2z = utr2z.d; trd3z = utr3z.d; + trd1z = utr1z.d; trd2z = utr2z.d; trd3z = utr3z.d; } dfix = ( (-sij)*trd1x + ( ski)*trd3x ) * (vc / anorm3); dfjx = ( ( sij)*trd1x + (-sjk)*trd2x ) * (vc / anorm3); dfkx = ( ( sjk)*trd2x + (-ski)*trd3x ) * (vc / anorm3); - + dfiy = ( (-sij)*trd1y + ( ski)*trd3y ) * (vc / anorm3); dfjy = ( ( sij)*trd1y + (-sjk)*trd2y ) * (vc / anorm3); dfky = ( ( sjk)*trd2y + (-ski)*trd3y ) * (vc / anorm3); - + dfiz = ( (-sij)*trd1z + ( ski)*trd3z ) * (vc / anorm3); dfjz = ( ( sij)*trd1z + (-sjk)*trd2z ) * (vc / anorm3); dfkz = ( ( sjk)*trd2z + (-ski)*trd3z ) * (vc / anorm3); @@ -1039,11 +1039,11 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfix,dfiy,dfiz, dfjx,dfjy,dfjz, dfkx,dfky,dfkz); - + if(three_body_forces) accumulate_forces_3(w3); } - + if(T12 != 0) { //printf("T12 i,j,k = %d,%d,%d\n",i,j,k); mcount++; @@ -1054,7 +1054,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, vir3v = vir3v + dvir; xvir3v = xvir3v + dvir; } - + { const double vd = splinepot.vd; @@ -1079,23 +1079,23 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfix = 2.0*(-sij)*trd1x * (vd / anorm4); dfkx = 2.0*( sjk)*trd2x * (vd / anorm4); dfjx = -(dfix + dfkx); - + dfiy = 2.0*(-sij)*trd1y * (vd / anorm4); dfky = 2.0*( sjk)*trd2y * (vd / anorm4); dfjy = -(dfiy + dfky); - + dfiz = 2.0*(-sij)*trd1z * (vd / anorm4); dfkz = 2.0*( sjk)*trd2z * (vd / anorm4); dfjz = -(dfiz + dfkz); } - + if(triplet_debug) /* Compare forces to numerical derivatives */ force_debug_3v(xx,i,j,k, j,i,k, dfix,dfiy,dfiz, dfjx,dfjy,dfjz, dfkx,dfky,dfkz); - - + + if(three_body_forces) accumulate_forces_3(w3); } @@ -1110,10 +1110,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, vir3v = vir3v + dvir; xvir3v = xvir3v + dvir; } - + { const double vd = splinepot.vd; - + tr_trace3(&(T23->H1H2.m[1][0]), &(T23->H1xH2.m[1][0]),&utr1x.d, &(T23->H1yH2.m[1][0]),&utr1y.d, @@ -1135,11 +1135,11 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfix = 2.0*( ski)*trd1x * (vd / anorm4); dfjx = 2.0*(-sjk)*trd2x * (vd / anorm4); dfkx = -(dfix + dfjx); - + dfiy = 2.0*( ski)*trd1y * (vd / anorm4); dfjy = 2.0*(-sjk)*trd2y * (vd / anorm4); dfky = -(dfiy + dfjy); - + dfiz = 2.0*( ski)*trd1z * (vd / anorm4); dfjz = 2.0*(-sjk)*trd2z * (vd / anorm4); dfkz = -(dfiz + dfjz); @@ -1150,10 +1150,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfix,dfiy,dfiz, dfjx,dfjy,dfjz, dfkx,dfky,dfkz); - + if(three_body_forces) accumulate_forces_3(w3); - + } if(T31 != 0) { @@ -1166,10 +1166,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, vir3v = vir3v + dvir; xvir3v = xvir3v + dvir; } - + { const double vd = splinepot.vd; - + tr_trace3(&(T31->H1H2.m[1][0]), &(T31->H1xH2.m[1][0]),&utr1x.d, &(T31->H1yH2.m[1][0]),&utr1y.d, @@ -1191,36 +1191,36 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfjx = 2.0*( sij)*trd1x * (vd / anorm4); dfkx = 2.0*(-ski)*trd2x * (vd / anorm4); dfix = -(dfjx + dfkx); - + dfjy = 2.0*( sij)*trd1y * (vd / anorm4); dfky = 2.0*(-ski)*trd2y * (vd / anorm4); dfiy = -(dfjy + dfky); - + dfjz = 2.0*( sij)*trd1z * (vd / anorm4); dfkz = 2.0*(-ski)*trd2z * (vd / anorm4); dfiz = -(dfjz + dfkz); - + } - + if(triplet_debug) /* Compare forces to numerical derivatives */ force_debug_3v(xx,i,j,k, i,j,k, dfix,dfiy,dfiz, dfjx,dfjy,dfjz, dfkx,dfky,dfkz); - + if(three_body_forces) accumulate_forces_3(w3); } - + v33 = tr0 / anorm3; v43 = (tr1 + tr2 + tr3) / anorm4; double de_triplet = (splinepot.vc*v33 + splinepot.vd*v43) * e_scale * w3; e_triplet = e_triplet + de_triplet; e_triplet_c = e_triplet_c + splinepot.vc*v33 * e_scale * w3; c_t++; - + //printf("xxxx %6d %6d %6d :: %20.10e\n",1,2,3,de_triplet); - + if(evflag) { double drji[3],drki[3]; double fj[3] = {fjx,fjy,fjz},fk[3] = {fkx,fky,fkz}; @@ -1231,7 +1231,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, fj[p] *= e_scale; fk[p] *= e_scale; } - + ev_tally3(i,j,k,de_triplet,0.0,fj,fk,drji,drki); if(volpres_flag && vflag_atom) { @@ -1243,23 +1243,23 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, vatom[k][pp] += dvir; } } - + fix = fix+fsave[0][0]; fiy = fiy+fsave[0][1]; fiz = fiz+fsave[0][2]; fjx = fjx+fsave[1][0]; fjy = fjy+fsave[1][1]; fjz = fjz+fsave[1][2]; fkx = fkx+fsave[2][0]; fky = fky+fsave[2][1]; fkz = fkz+fsave[2][2]; - } - + } + tx1 = gettime(); ttriplet += tx1 - tx0; nttriplet++; } else { triplet_defer = 1; } - + if(four_body_energies || four_body_forces) if(j < i) { /* Search for quadruplet */ tx0 = gettime(); - + mj = first[j]; mk = first[k]; /* @@ -1267,7 +1267,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, and lists are sorted, so the loop terminates. */ while(nlist_short[mj] < i && nlist_short[mk] < i) { - + if(mj >= first[j+1] || mk >= first[k+1]) { printf("Illegal quad...\n" " j=%d first[j]=%d first[j+1]=%d mj=%d\n" @@ -1276,20 +1276,20 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, k,first[k],first[k+1],mk); error->one(__FILE__,__LINE__,"Shit, brkoen quad loop"); } - + if(nlist_short[mj] == nlist_short[mk]) { /* Closed quadruplet */ m = nlist_short[mj]; c_jm = c_km = 1; - + const int sim = (i < m) ? 1 : -1; const int sjm = (j < m) ? 1 : -1; const int skm = (k < m) ? 1 : -1; - + w4 = get_weight(triclinic,ss[i],ss[j],ss[k],ss[m]); - + if(w4 > 0.0) { - + /* Alrady know ij,jk,ki,jm,km bonds. Look for im bond. */ mi = first[i]; while(mi < first[i+1] && nlist_short[mi] < m) mi = mi + 1; @@ -1297,9 +1297,9 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, c_im = 1; else c_im = 0; - + if(c_im == 0 || c_jk == 0 || (c_jk && c_im && m < k)) { - + if(triplet_defer) { dvir_ij = dvir_jk = dvir_ki = 0.0; if(c_ij && c_jk) @@ -1310,8 +1310,8 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, T31 = get_triplet(xx,i,j,k,&bond_hash,&T31work,&dvir_ij,&dvir_ki); triplet_defer = 0; } - - + + fmx = fmy = fmz = 0.0; double xvir4 = 0.0; @@ -1325,10 +1325,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, fkx = fky = fkz = 0.0; fmx = fmy = fmz = 0.0; } - + tr1 = tr2 = tr3 = 0.0; - - dvir_im = dvir_jm = dvir_km = 0.0; + + dvir_im = dvir_jm = dvir_km = 0.0; T45 = T56 = T64 = 0; if(T12 != 0 && c_km && c_im) T45 = get_triplet(xx,m,i,k,&bond_hash,&T45work,&dvir_im,&dvir_km); @@ -1336,7 +1336,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, T56 = get_triplet(xx,m,i,j,&bond_hash,&T56work,&dvir_im,&dvir_jm); if(T31 != 0 && c_jm && c_km) T64 = get_triplet(xx,m,j,k,&bond_hash,&T64work,&dvir_jm,&dvir_km); - + if(T12 != 0 && T45 != 0) { if(four_body_energies && evflag) { tr1 = transtrace(T12->H1H2,T45->H1H2); @@ -1346,26 +1346,26 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, xvir4 = xvir4 + dvir; } qcount++; - + { const double ve = splinepot.ve; - + trd_update_4(T12,T45); dfix_update_4a(x); dfix_update_4a(y); dfix_update_4a(z); } - + if(quad_debug) /* Compare forces to numerical derivatives */ force_debug_4(xx,i,j,k,m, i,j,k,m, dfix,dfiy,dfiz , dfjx,dfjy,dfjz, dfkx,dfky,dfkz , dfmx,dfmy,dfmz); - + if(four_body_forces) accumulate_forces_4(w4); } - + if(T23 != 0 && T56 != 0) { if(four_body_energies && evflag) { tr2 = transtrace(T23->H1H2,T56->H1H2); @@ -1375,25 +1375,25 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, xvir4 = xvir4 + dvir; } qcount++; - + { const double ve = splinepot.ve; - + trd_update_4(T23,T56); dfix_update_4b(x); dfix_update_4b(y); dfix_update_4b(z); } - + if(quad_debug) /* Compare forces to numerical derivatives */ force_debug_4(xx,i,j,k,m, i,m,j,k, dfix,dfiy,dfiz , dfjx,dfjy,dfjz, dfkx,dfky,dfkz , dfmx,dfmy,dfmz); - + if(four_body_forces) accumulate_forces_4(w4); - + } if(T31 != 0 && T64 != 0) { @@ -1405,10 +1405,10 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, xvir4 = xvir4 + dvir; } qcount++; - + { const double ve = splinepot.ve; - + /* X */ trd_update_4(T31,T64); @@ -1416,16 +1416,16 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, dfix_update_4c(y); dfix_update_4c(z); } - + if(quad_debug) /* Compare forces to numerical derivatives */ force_debug_4(xx,i,j,k,m, i,j,m,k, dfix,dfiy,dfiz , dfjx,dfjy,dfjz, dfkx,dfky,dfkz , dfmx,dfmy,dfmz); - + if(four_body_forces) accumulate_forces_4(w4); } - + double de_quad = splinepot.ve*(tr1 + tr2 + tr3)/anorm4 * e_scale * w4; e_quad = e_quad + de_quad; if((T12 && T45) || @@ -1447,9 +1447,9 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, fj[p] *= e_scale; fk[p] *= e_scale; } - + ev_tally4(i,j,k,m,de_quad,fi,fj,fk,drim,drjm,drkm); - + if(volpres_flag && vflag_atom) { //virial[i] = virial[i] - vir4 * rhoinv*e_scale; double dvir = -xvir4 * rhoinv*e_scale * (1.0/4.0); @@ -1465,12 +1465,12 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, fjx = fjx+fsave[1][0]; fjy = fjy+fsave[1][1]; fjz = fjz+fsave[1][2]; fkx = fkx+fsave[2][0]; fky = fky+fsave[2][1]; fkz = fkz+fsave[2][2]; fmx = fmx+fsave[3][0]; fmy = fmy+fsave[3][1]; fmz = fmz+fsave[3][2]; - } - + } + ff[m][0] += fmx * e_scale; ff[m][1] += fmy * e_scale; ff[m][2] += fmz * e_scale; - + } } mj = mj + 1; @@ -1480,32 +1480,32 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } else { mk = mk + 1; } - + } tx1 = gettime(); tquad += tx1 - tx0; ntquad++; ntquaditer++; } - - + + ff[k][0] += fkx * e_scale; ff[k][1] += fky * e_scale; ff[k][2] += fkz * e_scale; - + } #undef transtrace - + ff[j][0] += fjx * e_scale; ff[j][1] += fjy * e_scale; ff[j][2] += fjz * e_scale; - + } - + ff[i][0] += fix * e_scale; ff[i][1] += fiy * e_scale; ff[i][2] += fiz * e_scale; - + if(single_energies == 1 && i < nloc) { const double evol0 = splinepot.evol0; if(eflag_global) { @@ -1519,14 +1519,14 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, } } - + } - + tx0 = gettime(); for(i = 0; i<ntot; i++) for(p = 0; p<3; p++) atom->f[i][p] = atom->f[i][p] + ff[i][p]; - + memory->sfree(nlist_short); memory->sfree(first); if(ss != xx) memory->sfree(ss); @@ -1535,7 +1535,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, tx1 = gettime(); tmem += tx1-tx0; ntmem++; - + t1 = gettime(1); //printf("compute_x: c_p = %d c_t = %d c_q = %d\n",c_p,c_t,c_q); @@ -1565,7 +1565,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, make_t_adj = t_make_t - adj*n_make, make_b2_adj = t_make_b2 - adj*n_make_b2, trace_adj = t_trace - adj*n_trace; - + printf("mgpt engy = %10.3fms\n",(t1-t0)*1e3); printf(" mem = %10.3fms n = %8.0f adj = %10.3fms one = %10.3fns\n", tmem*1e3,ntmem,memadj*1e3,memadj/ntmem*1e9); @@ -1592,7 +1592,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, printf("mcount (transpose + trace for triplet) = %.0f , %.0f qcount = %.0f lmax = %d\n", mcount,mcount2,qcount,lmax); - + printf("nbc=%.0f tbl=%.3fms tbm=%.3fms one tbl=%.3fns one tbm=%.3fns\n", nbc,(tbl-adj*nbc)*1e3,(tbm-adj*nbc)*1e3,(tbl/nbc-adj)*1e9, (tbm/nbc-adj)*1e9); @@ -1605,9 +1605,9 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, printf("Bonds : nsearch=%d maxlen=%d avg.len=%.3f\n", bond_hash.NSearch(),bond_hash.MaxLength(), bond_hash.NStep()/(double) bond_hash.NSearch()); - + printf("compute_x: c_p = %d c_t = %d c_q = %d\n",c_p,c_t,c_q); - + printf("@@ Total number of trace3 calls is %d, total number of make_triplet is %.1f\n", ntr_calls,n_make); @@ -1650,21 +1650,21 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist, if(pair_energies) // Virial correction for pair energy for(i = 0; i<3; i++) virial[i] = virial[i] + rhoinv*e_scale*volvir2; - + if(three_body_energies) // Virial correction for three body enegries for(i = 0; i<3; i++) { //virial[i] = virial[i] - pot_input_vol*(e_triplet_c*pc + (e_triplet-e_triplet_c)*pd); virial[i] = virial[i] - (vir3v + vir3t) * rhoinv*e_scale; } - + if(four_body_energies) // Virial correction for four body enegries for(i = 0; i<3; i++) { //virial[i] = virial[i] - pot_input_vol*e_quad*pe; virial[i] = virial[i] - vir4 * rhoinv*e_scale; } - + } - + *e_s = e_single; *e_p = e_pair; *e_t = e_triplet; @@ -1675,7 +1675,7 @@ void PairMGPT::compute(int eflag, int vflag) { if(eflag || vflag) ev_setup(eflag, vflag); else evflag = vflag_fdotr = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; - + int newton_pair = force->newton_pair; double e_s,e_p,e_t,e_q; @@ -1690,7 +1690,7 @@ void PairMGPT::compute(int eflag, int vflag) printf("This is a problem. MGPT requires tag_enable flag to be on. Exiting...\n"); exit(1); } - + compute_x(listfull->numneigh,listfull->firstneigh,&e_s,&e_p,&e_t,&e_q,evflag,newton_pair); if(0) { // Stupid force calculation / verification @@ -1727,11 +1727,11 @@ void PairMGPT::compute(int eflag, int vflag) double **atom_f_save = atom->f; atom->f = ffptr; - + for(int p = 0; p<3; p++) { double xsave = atom->x[i][p]; const double delta = 1e-3; - + atom->x[i][p] = xsave + delta; for(int jj = 0; jj<3*nmax; jj++) ffwork[jj] = 0.0; compute_x(listfull->numneigh, @@ -1747,7 +1747,7 @@ void PairMGPT::compute(int eflag, int vflag) double e2 = e_s + e_p + e_t + e_q; ffloc[3*ii+p] = -(e1-e2)/(2*delta); - + atom->x[i][p] = xsave; } @@ -1762,7 +1762,7 @@ void PairMGPT::compute(int eflag, int vflag) printf(" Boundary %20.10e %20.10e %20.10e\n", ffloc2[3*ii+0],ffloc2[3*ii+1],ffloc2[3*ii+2]); } - + delete[] ffloc2; delete[] ffloc; @@ -1781,7 +1781,7 @@ void PairMGPT::compute(int eflag, int vflag) } printf("\n\n"); } - + if(vflag_fdotr) { //printf("##### Using virial_compute!!!\n"); virial_fdotr_compute(); @@ -1803,7 +1803,7 @@ void PairMGPT::allocate() } /* ---------------------------------------------------------------------- - global settings + global settings ------------------------------------------------------------------------- */ void PairMGPT::settings(int narg, char **arg) { @@ -1821,27 +1821,27 @@ void PairMGPT::coeff(int narg, char **arg) if(narg < 5) error->all(__FILE__,__LINE__, "Not enough arguments for mgpt (MGPT) pair coefficients."); - + if(!allocated) allocate(); - + // Make sure I,J args are * * if(strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(__FILE__,__LINE__,"Incorrect args for pair coefficients"); - + double vol; if(sscanf(arg[4], "%lg", &vol) != 1 || vol <= 0.0) error->all(__FILE__,__LINE__,"Invalid volume in mgpt (MGPT) pair coefficients."); - + volpres_flag = 1; single_precision = 0; - + /* Parse arguments */ { int volpres_tag = 0,precision_tag = 0,nbody_tag = 0; int iarg = 5; while (iarg < narg) { if(strcmp(arg[iarg],"volpress") == 0) { /* Volumetric pressure flag */ - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Incorrect args for pair coefficients"); if(strcmp(arg[iarg+1],"yes") == 0) volpres_flag = 1; else if(strcmp(arg[iarg+1],"no") == 0) volpres_flag = 0; @@ -1856,7 +1856,7 @@ void PairMGPT::coeff(int narg, char **arg) iarg += 2; if(comm->me == 0) printf("* volpress: volpres_flag = %d [%s %s]\n",volpres_flag,arg[iarg-2],arg[iarg-1]); } else if(strcmp(arg[iarg],"nbody") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Incorrect args for pair coefficients"); if(strspn(arg[iarg+1],"1234") == strlen(arg[iarg+1])) { nbody_flag = 0; @@ -1877,7 +1877,7 @@ void PairMGPT::coeff(int narg, char **arg) nbody_tag = 1; iarg += 2; } else if(strcmp(arg[iarg],"precision") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Incorrect args for pair coefficients"); if(strcmp(arg[iarg+1],"single") == 0) single_precision = 1; else if(strcmp(arg[iarg+1],"double") == 0) single_precision = 0; @@ -1898,13 +1898,13 @@ void PairMGPT::coeff(int narg, char **arg) " precision {single|double} , default = double\n" " nbody {[1234,]*} , default = whichever terms potential require\n" "The invalid argument is \"%s\".\n",__FILE__,__LINE__,arg[iarg]); - error->all(__FILE__,__LINE__,line); + error->all(__FILE__,__LINE__,line); } } - + if(comm->me == 0) printf("Volumetric pressure is %s.\n",volpres_flag ? "on" : "off"); - + if(comm->me == 0) { FILE *parmin_fp = force->open_potential(arg[2]); FILE *potin_fp = force->open_potential(arg[3]); @@ -1926,7 +1926,7 @@ void PairMGPT::coeff(int narg, char **arg) nbody_default -= (1<<2); // No 3-body contributions if(splinepot.ve == 0.0 && splinepot.dve == 0.0) nbody_default -= (1<<3); // No 4-body contributions - + if(nbody_tag == 0) nbody_flag = nbody_default; if(nbody_flag != nbody_default) { @@ -1936,9 +1936,9 @@ void PairMGPT::coeff(int narg, char **arg) } } } - + MPI_Bcast(&nbody_flag,sizeof(nbody_flag),MPI_BYTE,0,world); - + /* Broadcast structure to all processes. In receiving processes, pointes will be screwed up. We allocate @@ -1963,15 +1963,15 @@ void PairMGPT::coeff(int narg, char **arg) del0.m[i+1][j+1] = 0.0; del0.m[i+1][i+1] = 1.0; } - + /* Set matrix param, cutoff, LAMMPS param */ Matrix::sz = lmax; - + rcrit = splinepot.rcrit; rmax = splinepot.rmax; cutoff = rmax; if(rcrit > rmax) cutoff = rcrit; - + // Set LAMMPS pair interaction flags. for(int i = 1; i <= atom->ntypes; i++) { for(int j = 1; j <= atom->ntypes; j++) { @@ -1980,11 +1980,11 @@ void PairMGPT::coeff(int narg, char **arg) cutghost[i][j] = cutoff; } } - + // Set atomic mass. for(int i = 1; i <= atom->ntypes; i++) atom->set_mass(i, splinepot.mass); - + // Initialize linear algebra routines. linalg = mgpt_linalg(lmax,single_precision); if(comm->me == 0) @@ -2006,14 +2006,14 @@ void PairMGPT::init_style() neighbor->requests[irequest_full]->half = 0; neighbor->requests[irequest_full]->full = 1; neighbor->requests[irequest_full]->ghost = 1; - + // Also need half neighbor list. int irequest_half = neighbor->request(this); neighbor->requests[irequest_half]->id = 2; neighbor->requests[irequest_half]->half = 0; neighbor->requests[irequest_half]->half_from_full = 1; neighbor->requests[irequest_half]->otherlist = irequest_full; - + } /* ---------------------------------------------------------------------- @@ -2089,7 +2089,7 @@ void PairMGPT::fl_deriv_new(double r,double ri,double xhat,double yhat,double zh fl_rp = t_rp_ti; fl_p1 = t_p1_ti; - + if (r <= r0) { fl_0 = t; fl_x = tx; @@ -2186,7 +2186,7 @@ void PairMGPT::hamltn_5_raw(const double xin,const double yin,const double zin, double M [8][8],double Mx[8][8], double My[8][8],double Mz[8][8], double *fl_deriv_sum_p) { - + const double r = sqrt(xin*xin + yin*yin + zin*zin),ri = 1.0/r; const double x = xin*ri,y = yin*ri,z = zin*ri; @@ -2194,7 +2194,7 @@ void PairMGPT::hamltn_5_raw(const double xin,const double yin,const double zin, // call delndd(x,y,z) const double x2 = x*x,y2 = y*y,z2 = z*z; const double xy = x*y,xz = x*z,yz = y*z; - + const double sr3 = sqrt(3.0),sr3i = 1.0/sr3; const double frac_1_3 = 1.0/3.0,frac_2_3 = 2.0/3.0,frac_4_3 = 4.0/3.0; @@ -2203,7 +2203,7 @@ void PairMGPT::hamltn_5_raw(const double xin,const double yin,const double zin, const double w2 = ddl_2 - ddl_3; const double w0 = ddl_2; - + //del4 double gsl_1 ,gsl_2 ,gsl_3 ,gsl_4 ,gsl_5; double gsl_1x,gsl_2x,gsl_3x,gsl_4x,gsl_5x; @@ -2239,7 +2239,7 @@ void PairMGPT::hamltn_5_raw(const double xin,const double yin,const double zin, gsl_5x = sr3*y; gsl_5y = sr3*x; gsl_5z = 0.0; - + // Compute bond length potential fl_deriv_new(r,ri,x,y,z,fl,fl_x,fl_y,fl_z , fl_rp,fl_p1,fl_r0,fl_al); fl_ri = fl*ri; @@ -2249,7 +2249,7 @@ void PairMGPT::hamltn_5_raw(const double xin,const double yin,const double zin, fl_r0*splinepot.dr00 + fl_al*splinepot.dal; // del2 - + //del2.m[1][1] = z2 - 2.0/3.0; dl2 = z2 - frac_2_3; dl2x = 0.0; @@ -2361,7 +2361,7 @@ void PairMGPT::hamltn_7_raw(const double xin,const double yin,const double zin, double M [8][8],double Mx[8][8], double My[8][8],double Mz[8][8], double *fl_deriv_sum_p) { - + const double r = sqrt(xin*xin + yin*yin + zin*zin),ri = 1.0/r; const double x = xin*ri,y = yin*ri,z = zin*ri; @@ -2370,7 +2370,7 @@ void PairMGPT::hamltn_7_raw(const double xin,const double yin,const double zin, const double x2 = x*x,y2 = y*y,z2 = z*z; const double xy = x*y,xz = x*z,yz = y*z; const double x4 = x2*x2,y4 = y2*y2; - + //const double sr3 = sqrt(3.0);//,sr3i = 1.0/sr3; //const double frac_1_3 = 1.0/3.0,frac_2_3 = 2.0/3.0,frac_4_3 = 4.0/3.0; @@ -2396,7 +2396,7 @@ void PairMGPT::hamltn_7_raw(const double xin,const double yin,const double zin, const double w2 = 0.625*(ddl_2 - ddl_4); const double w0 = 0.625*ddl_2 + 0.375*ddl_4; - + //del6 double gsl_1 ,gsl_2 ,gsl_3 ,gsl_4 ,gsl_5 ,gsl_6, gsl_7; double gsl_1x,gsl_2x,gsl_3x,gsl_4x,gsl_5x,gsl_6x,gsl_7x; @@ -2452,11 +2452,11 @@ void PairMGPT::hamltn_7_raw(const double xin,const double yin,const double zin, gsl_7y = 3.0*sr0625*(x2 - y2); gsl_7z = 0.0; - + // Compute bond length potential fl_deriv_new(r,ri,x,y,z,fl,fl_x,fl_y,fl_z , fl_rp,fl_p1,fl_r0,fl_al); fl_ri = fl*ri; - + *fl_deriv_sum_p = fl_rp*splinepot.drp + fl_p1*splinepot.dp1 + fl_r0*splinepot.dr00 + fl_al*splinepot.dal; @@ -2734,7 +2734,7 @@ void PairMGPT::hamltn_7_raw(const double xin,const double yin,const double zin, //del2f.m[4][4] = 0.0; - dl2 = 0.0; + dl2 = 0.0; dl2x = 0.0; dl2y = 0.0; dl2z = 0.0; @@ -2804,7 +2804,7 @@ void PairMGPT::hamltn_7_raw(const double xin,const double yin,const double zin, dl4x = 8.0*x*y2; dl4y = 8.0*x2*y; dl4z = -8.0*t1*z; - + MAKE_ELEMENT_7(5,5); @@ -2885,7 +2885,7 @@ void PairMGPT::hamltn_7_raw(const double xin,const double yin,const double zin, /************************************************************************/ /* ---------------------------------------------------------------------- - * Fast Model Generalized Pseudopotential Theory (MGPT) interatomic + * Fast Model Generalized Pseudopotential Theory (MGPT) interatomic * potential routine. * * Copyright (2015) Lawrence Livermore National Security, LLC. @@ -2894,8 +2894,8 @@ void PairMGPT::hamltn_7_raw(const double xin,const double yin,const double zin, * (moriarty2@llnl.gov) * LLNL-CODE-674031 All rights reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License (as published by the + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License (as published by the * Free Software Foundation) version 2, dated June 1991. * * This program is distributed in the hope that it will be useful, but diff --git a/src/USER-MGPT/pair_mgpt.h b/src/USER-MGPT/pair_mgpt.h index 5e5740f391efb8d5ccf4c76101ea0d5c1ce68a1a..94c66fb6038f8d7fcc2cca4711230abe65df56ce 100644 --- a/src/USER-MGPT/pair_mgpt.h +++ b/src/USER-MGPT/pair_mgpt.h @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: Tomas Oppelstrup, LLNL (oppelstrup2@llnl.gov) + Contributing authors: Tomas Oppelstrup, LLNL (oppelstrup2@llnl.gov) and John Moriarty, LLNL (moriarty2@llnl.gov) Fast MGPT algorithm developed by Tomas Oppelstrup (2015) based on the @@ -55,7 +55,7 @@ public: public: Doublet(const Doublet &t) : i(t.i),j(t.j) {} Doublet(int ii,int jj) : i(ii < jj ? ii:jj),j(ii < jj ? jj : ii) {} - + Doublet operator=(const Doublet &t) { i = t.i; j = t.j; @@ -66,9 +66,9 @@ public: } int hash() const { return i*333331 + j*331; } }; - + template<typename T,typename K> class Hash { - + class Link { public: T data; @@ -90,7 +90,7 @@ public: ::operator delete(((void **) ptr)[-1]); } }; - + int isprime(int x) { if(x%2 == 0) return 0; @@ -103,13 +103,13 @@ public: return 1; } } - + int size,used; Link **table; - + int maxlength,nstep,nsearch; public: - + class Iterator { Hash &H; int idx; @@ -131,7 +131,7 @@ public: K *key() { return &p->key; } T *data() { return &p->data; } Link *link() { return p; } - + int operator==(const Iterator &a) { return idx==a.idx && p==a.p; } @@ -139,23 +139,23 @@ public: return !(*this == a); } }; - + Hash(int sz) { while(!isprime(sz)) sz = sz + 1; size = sz; used = 0; - - + + table = new Link *[size]; for(int i = 0; i<size; i++) table[i] = 0; - + /* Counters for statistics */ maxlength = 0; nstep = 0; nsearch = 0; } - + ~Hash() { for(int i = 0; i<size; i++) { Link *p = table[i]; @@ -170,7 +170,7 @@ public: Iterator begin() { return Iterator(*this); } Iterator end() { return Iterator(*this,size,0); } - + int Size() { return size; } int Used() { return used; } int NSearch() { return nsearch; } @@ -183,7 +183,7 @@ public: printf("(1) Damn... key = %d, idx = %d, size = %d\n",key.hash(),idx,size); exit(1); } - + used = used + 1; if(1) { table[idx] = new Link(key,table[idx]); @@ -191,7 +191,7 @@ public: } else { /* This is for threading... and incomplete */ typedef Link *LinkPtr; LinkPtr ptr = table[idx],last = 0,dataptr = new Link(key,0); - + while(ptr != 0) { last = ptr; ptr = ptr->next; @@ -225,7 +225,7 @@ public: last->next = p->next; delete p; } - + if(count > maxlength) maxlength = count; nsearch = nsearch + 1; @@ -240,25 +240,25 @@ public: printf("(3) Damn... key = %d, idx = %d, size = %d\n",key.hash(),idx,size); exit(1); } - - + + p = table[idx]; while(p != 0 && !(p->key == key)) { p = p->next; count = count + 1; } - + if(count > maxlength) maxlength = count; nsearch = nsearch + 1; nstep = nstep + count; - + if(p != 0) p->hits++; - + return (p == 0) ? 0 : &p->data; } }; - + public: PairMGPT(class LAMMPS *); ~PairMGPT(); @@ -268,17 +268,17 @@ public: void init_style(); void init_list(int, class NeighList *); double init_one(int, int); - + private: - + void read_files(const char* parminFile, const char* potinFile, double vol); void allocate(); - + struct Matrix { static int sz; - + double m[8][8]; - + int align_check() { return ((((unsigned long long int) m) & 31) > 0); } @@ -323,7 +323,7 @@ public: Matrix P; for(int i = 1; i<=sz; i++) for(int j = 0; j<=sz; j++) - P.m[i][j] = m[i][j] * x; + P.m[i][j] = m[i][j] * x; return P; } Matrix operator/(double x) const { @@ -399,7 +399,7 @@ public: triplet_data *get_triplet(const double xx[][3],int i,int j,int k, Hash<bond_data,Doublet> *bhash,triplet_data *twork, double *dvir_ij_p,double *dvir_ik_p); - + int c1_outside(const double a[3], int triclinic,const double alpha[3]) { const double stol = 1e-5; @@ -410,16 +410,16 @@ public: if(cog < domain->sublo_lamda[p]-0.5*rmax*alpha[p]-stol) return 1; if(cog > domain->subhi_lamda[p]+0.5*rmax*alpha[p]+stol) return 1; } - + } else { double rout = 0.0; - - + + for(int p = 0; p<3; p++) { double cog = a[p]; if(cog < domain->sublo[p]-0.5*rmax-stol) return 1; if(cog > domain->subhi[p]+0.5*rmax+stol) return 1; - + if(cog < domain->sublo[p]-stol) { double t = cog - (domain->sublo[p]-stol); rout = rout + t*t; @@ -427,9 +427,9 @@ public: double t = cog - (domain->subhi[p]+stol); rout = rout + t*t; } - + } - + if(rout > 0.25*rmax*rmax) return 1; } @@ -439,7 +439,7 @@ public: int c2_outside(const double a[3],const double b[3], int triclinic,const double alpha[3]) { const double stol = 1e-5; - + if(triclinic) { for(int p = 0; p<3; p++) { double cog = 0.5*(a[p] + b[p]); @@ -453,7 +453,7 @@ public: double cog = 0.5*(a[p] + b[p]); if(cog < domain->sublo[p]-0.5*rcrit-stol) return 1; if(cog > domain->subhi[p]+0.5*rcrit+stol) return 1; - + if(cog < domain->sublo[p]-stol) { double t = cog - (domain->sublo[p]-stol); rout = rout + t*t; @@ -461,9 +461,9 @@ public: double t = cog - (domain->subhi[p]+stol); rout = rout + t*t; } - + } - + if(rout > 0.25*rcrit*rcrit) return 1; } @@ -478,7 +478,7 @@ public: *s1 = triclinic ? domain->subhi_lamda : domain->subhi; double weight = 1.0; const double stol = 1e-5; - + for(int p = 0; p<3; p++) { double cog = 0.0,q,w,n = 0.0; if(a != 0) { cog = cog + a[p]; n = n + 1; } @@ -486,10 +486,10 @@ public: if(c != 0) { cog = cog + c[p]; n = n + 1; } if(d != 0) { cog = cog + d[p]; n = n + 1; } cog = cog * (1.0/n); - + if(cog < 0.5*(s0[p]+s1[p])) q = cog - s0[p]; else q = s1[p] - cog; - + w = q*(0.5/stol) + 0.5; if(w > 1.0) w = 1.0; if(w < 0.0) w = 0.0; @@ -497,21 +497,21 @@ public: } return weight; } - + void force_debug_3t(double xx[][3], int i0,int j0,int k0, int i ,int j ,int k , double dfix,double dfiy,double dfiz, double dfjx,double dfjy,double dfjz, double dfkx,double dfky,double dfkz); - + void force_debug_3v(double xx[][3], int i0,int j0,int k0, int i ,int j ,int k , double dfix,double dfiy,double dfiz, double dfjx,double dfjy,double dfjz, double dfkx,double dfky,double dfkz); - + void force_debug_4(double xx[][3], int i0,int j0,int k0,int m0, int i ,int j ,int k ,int m , @@ -519,14 +519,14 @@ public: double dfjx,double dfjy,double dfjz, double dfkx,double dfky,double dfkz, double dfmx,double dfmy,double dfmz); - + double numderiv3t(double xx[][3],int i,int j,int k,int p); double numderiv3v(double xx[][3],int i,int j,int k,int p,int ipert); double numderiv4(double xx[][3],int i,int j,int k,int m,int p); void compute_x(const int *nnei,const int * const *nlist, double *e_s,double *e_p,double *e_t,double *e_q, int evflag,int newton_pair); - + /* Reimplementation of bond matrix computation */ void fl_deriv_new(double r,double ri,double xhat,double yhat,double zhat, double &fl_0,double &fl_x,double &fl_y,double &fl_z, @@ -554,7 +554,7 @@ public: } return h; } - + /// This function calculates the trace of the matrix product of ha and hb. inline double trace(const Matrix& ha, const Matrix& hb) const { double zquan = 0.0; @@ -571,7 +571,7 @@ public: inline void transprod(const Matrix& a,const Matrix& b,Matrix &c) const { int i,j,k; - + if(lmax == 5) { const int n = 5; for(i = 1; i<=n; i++) @@ -616,12 +616,12 @@ public: { int i,k; double s = 0.0; - + if(linalg.single) return transtrace_s((const float (*)[8]) &a.m[1][0],(const float (*)[8]) &b.m[1][0]); //printf("Calling transtrace... That is shit\n"); - + if(lmax == 5) { const int n = 5; for(i = 1; i<=n; i++) @@ -640,7 +640,7 @@ public: } return s; } - + double cutoff; //double vpair[601]; //double ktan[601]; @@ -651,32 +651,32 @@ public: double rcrit; //double evol0, pvol0, pot_input_vol; //double epsr, epsa; - + int thrion; int fourion; - + //int mode; double ddl[5]; int lmax, lang; Matrix del0; double anorm3, anorm4; - + // Flag indicating whether volumetric pressure should be used. // Volumetric pressure means that terms emanating from the // derivative of the energy with respect to the potential atomic // volume parameter is included. int volpres_flag,nbody_flag; - + potdata splinepot; }; - + } #endif #endif /* ---------------------------------------------------------------------- - * Fast Model Generalized Pseudopotential Theory (MGPT) interatomic + * Fast Model Generalized Pseudopotential Theory (MGPT) interatomic * potential routine. * * Copyright (2015) Lawrence Livermore National Security, LLC. diff --git a/src/USER-MISC/angle_cosine_shift.cpp b/src/USER-MISC/angle_cosine_shift.cpp index a144118cb2c4884f31ead67264852d45ff346200..8e7c67fd70b1dd9e20ef74873c062c7581bd4ce5 100644 --- a/src/USER-MISC/angle_cosine_shift.cpp +++ b/src/USER-MISC/angle_cosine_shift.cpp @@ -15,8 +15,8 @@ Contributing author: Carsten Svaneborg, science@zqex.dk ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_cosine_shift.h" #include "atom.h" #include "neighbor.h" diff --git a/src/USER-MISC/angle_cosine_shift.h b/src/USER-MISC/angle_cosine_shift.h index 03002fbfe2da2b24ead59c10a322e7641d6e0b9c..b8ab74ee43d886a452ce542ba77c07244b4e529e 100644 --- a/src/USER-MISC/angle_cosine_shift.h +++ b/src/USER-MISC/angle_cosine_shift.h @@ -20,7 +20,7 @@ AngleStyle(cosine/shift,AngleCosineShift) #ifndef LMP_ANGLE_COSINE_SHIFT_H #define LMP_ANGLE_COSINE_SHIFT_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index 2941293be78caf18c44b778d2c8700dddf8f2d09..e19b9e20efaf5ed67c8d68dcb90a3221122b77c6 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -15,8 +15,8 @@ Contributing author: Carsten Svaneborg, science@zqex.dk ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_cosine_shift_exp.h" #include "atom.h" #include "neighbor.h" diff --git a/src/USER-MISC/angle_cosine_shift_exp.h b/src/USER-MISC/angle_cosine_shift_exp.h index b37d292a7009ef14dfdfa56ff20a5ab61f7b7474..4db9e1f6960067df88249bc1ea5539594cf30f73 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.h +++ b/src/USER-MISC/angle_cosine_shift_exp.h @@ -18,7 +18,7 @@ AngleStyle(cosine/shift/exp,AngleCosineShiftExp) #ifndef LMP_ANGLE_COSINE_SHIFT_EXP_H #define LMP_ANGLE_COSINE_SHIFT_EXP_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/angle_dipole.cpp b/src/USER-MISC/angle_dipole.cpp index 2d1b7eb3ef94ab2579a6053b6fb0c35c2cbc7cac..25d5f6187b12e2c1e84452deae75a20ac7d69bb1 100644 --- a/src/USER-MISC/angle_dipole.cpp +++ b/src/USER-MISC/angle_dipole.cpp @@ -15,8 +15,8 @@ Contributing author: Mario Orsi (U Southampton), orsimario@gmail.com ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_dipole.h" #include "atom.h" #include "neighbor.h" diff --git a/src/USER-MISC/angle_dipole.h b/src/USER-MISC/angle_dipole.h index f4ea4a88bf33bb9a5cd8387cdc7f2e2f9b8c3a32..347eecfca4a098477bf9a419a8fd6285fe51cdda 100644 --- a/src/USER-MISC/angle_dipole.h +++ b/src/USER-MISC/angle_dipole.h @@ -20,7 +20,7 @@ AngleStyle(dipole,AngleDipole) #ifndef LMP_ANGLE_DIPOLE_H #define LMP_ANGLE_DIPOLE_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/angle_fourier.cpp b/src/USER-MISC/angle_fourier.cpp index f067141b9a5c1ff1c119f77e9cdd03485587e04e..dee6ed1301be486e968a85ef3851ded0410a0ebf 100644 --- a/src/USER-MISC/angle_fourier.cpp +++ b/src/USER-MISC/angle_fourier.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,8 +16,8 @@ [ based on angle_cosine_squared.cpp Naveen Michaud-Agrawal (Johns Hopkins U)] ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_fourier.h" #include "atom.h" #include "neighbor.h" @@ -218,7 +218,7 @@ void AngleFourier::write_restart(FILE *fp) } /* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them + proc 0 reads coeffs from restart file, bcasts them ------------------------------------------------------------------------- */ void AngleFourier::read_restart(FILE *fp) @@ -272,7 +272,7 @@ double AngleFourier::single(int type, int i1, int i2, int i3) if (c > 1.0) c = 1.0; if (c < -1.0) c = -1.0; double c2 = 2.0*c*c-1.0; - + double eng = k[type]*(C0[type]+C1[type]*c+C2[type]*c2); return eng; } diff --git a/src/USER-MISC/angle_fourier.h b/src/USER-MISC/angle_fourier.h index 43291777a9add137f8cf004f9c2cfaea74b2bfcb..da5c96479f2febf30a9ca0f9f945980c216f69e6 100644 --- a/src/USER-MISC/angle_fourier.h +++ b/src/USER-MISC/angle_fourier.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -20,7 +20,7 @@ AngleStyle(fourier,AngleFourier) #ifndef ANGLE_FOURIER_H #define ANGLE_FOURIER_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/angle_fourier_simple.cpp b/src/USER-MISC/angle_fourier_simple.cpp index cfe56813146c8abbd1a86e631697cd6c8ed9b3ba..63991f320e1e6cb675dd61d4df93b2a4420218e4 100644 --- a/src/USER-MISC/angle_fourier_simple.cpp +++ b/src/USER-MISC/angle_fourier_simple.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,8 +16,8 @@ [ based on angle_cosine_squared.cpp Naveen Michaud-Agrawal (Johns Hopkins U)] ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_fourier_simple.h" #include "atom.h" #include "neighbor.h" @@ -225,7 +225,7 @@ void AngleFourierSimple::write_restart(FILE *fp) } /* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them + proc 0 reads coeffs from restart file, bcasts them ------------------------------------------------------------------------- */ void AngleFourierSimple::read_restart(FILE *fp) diff --git a/src/USER-MISC/angle_fourier_simple.h b/src/USER-MISC/angle_fourier_simple.h index 2222d5e4196f2b78cf786eeda8ff46b80aabc55e..ca160f185da7f393f9926a6f84a2e1aca232d6a5 100644 --- a/src/USER-MISC/angle_fourier_simple.h +++ b/src/USER-MISC/angle_fourier_simple.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -20,7 +20,7 @@ AngleStyle(fourier/simple,AngleFourierSimple) #ifndef ANGLE_FOURIER_SIMPLE_H #define ANGLE_FOURIER_SIMPLE_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/angle_quartic.cpp b/src/USER-MISC/angle_quartic.cpp index cb0072373eabd88582fda081e212fb77259dabf8..a1a3e4cf3f4d0871a3b5afd6501373e9c48fe905 100644 --- a/src/USER-MISC/angle_quartic.cpp +++ b/src/USER-MISC/angle_quartic.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,8 +16,8 @@ [ based on angle_harmonic.cpp] ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "angle_quartic.h" #include "atom.h" #include "neighbor.h" @@ -112,7 +112,7 @@ void AngleQuartic::compute(int eflag, int vflag) dtheta = acos(c) - theta0[type]; dtheta2 = dtheta * dtheta; dtheta3 = dtheta2 * dtheta; - tk = 2.0 * k2[type] * dtheta + 3.0 * k3[type] * dtheta2 + + tk = 2.0 * k2[type] * dtheta + 3.0 * k3[type] * dtheta2 + 4.0 * k4[type] * dtheta3; if (eflag) { @@ -225,7 +225,7 @@ void AngleQuartic::write_restart(FILE *fp) } /* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them + proc 0 reads coeffs from restart file, bcasts them ------------------------------------------------------------------------- */ void AngleQuartic::read_restart(FILE *fp) diff --git a/src/USER-MISC/angle_quartic.h b/src/USER-MISC/angle_quartic.h index b98443cf78c05929074da7a0534a238edc30c530..8844ad111de54d44d8f1c59828fc9cc9b056bfaa 100644 --- a/src/USER-MISC/angle_quartic.h +++ b/src/USER-MISC/angle_quartic.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -20,7 +20,7 @@ AngleStyle(quartic,AngleQuartic) #ifndef LMP_ANGLE_QUARTIC_H #define LMP_ANGLE_QUARTIC_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/bond_harmonic_shift.cpp b/src/USER-MISC/bond_harmonic_shift.cpp index d9a5bbc4f992403e033d25453ad773e8b49c5e3b..6f1b67e2459ae226ef252b20514f6e007506feab 100644 --- a/src/USER-MISC/bond_harmonic_shift.cpp +++ b/src/USER-MISC/bond_harmonic_shift.cpp @@ -15,8 +15,8 @@ Contributing author: Carsten Svaneborg, science@zqex.dk ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_harmonic_shift.h" #include "atom.h" #include "neighbor.h" diff --git a/src/USER-MISC/bond_harmonic_shift.h b/src/USER-MISC/bond_harmonic_shift.h index a9aabf96ec3b8e7464c7dd1e81d6edddca228e80..95dc091a62926894c99417895050c7743a2c2b6f 100644 --- a/src/USER-MISC/bond_harmonic_shift.h +++ b/src/USER-MISC/bond_harmonic_shift.h @@ -20,7 +20,7 @@ BondStyle(harmonic/shift,BondHarmonicShift) #ifndef LMP_BOND_HARMONIC_SHIFT_H #define LMP_BOND_HARMONIC_SHIFT_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/bond_harmonic_shift_cut.cpp b/src/USER-MISC/bond_harmonic_shift_cut.cpp index 07bea4a8616d46848a46efc4e206673ff600823e..1a1be169990a42f697d27722d296532d5a276a55 100644 --- a/src/USER-MISC/bond_harmonic_shift_cut.cpp +++ b/src/USER-MISC/bond_harmonic_shift_cut.cpp @@ -15,8 +15,8 @@ Contributing author: Carsten Svaneborg, science@zqex.dk ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "bond_harmonic_shift_cut.h" #include "atom.h" #include "neighbor.h" diff --git a/src/USER-MISC/bond_harmonic_shift_cut.h b/src/USER-MISC/bond_harmonic_shift_cut.h index e7436416015ec1a4c4826f2737e8e07993736ff3..9b2587936ec7012dfef6af00b715cc1a459bb4a2 100644 --- a/src/USER-MISC/bond_harmonic_shift_cut.h +++ b/src/USER-MISC/bond_harmonic_shift_cut.h @@ -20,7 +20,7 @@ BondStyle(harmonic/shift/cut,BondHarmonicShiftCut) #ifndef LMP_BOND_HARMONIC_SHIFT_CUT_H #define LMP_BOND_HARMONIC_SHIFT_CUT_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/compute_ackland_atom.cpp b/src/USER-MISC/compute_ackland_atom.cpp index 064e14ef933188832a6c17c7f30d38a32aa1706c..7a60117bb84f653130043c7a2c863dd27707c4e7 100644 --- a/src/USER-MISC/compute_ackland_atom.cpp +++ b/src/USER-MISC/compute_ackland_atom.cpp @@ -16,7 +16,7 @@ Copyright (C) 2007 ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_ackland_atom.h" #include "atom.h" #include "update.h" @@ -246,7 +246,7 @@ void ComputeAcklandAtom::compute_peratom() double delta_bcc = delta_cp + 1.0; int chi56m4 = chi[5]+chi[6]-chi[4]; - // note that chi[7] presumed zero + // note that chi[7] presumed zero if (chi56m4 != 0) delta_bcc = 0.35*chi[4]/(double)chi56m4; double delta_fcc = 0.61*(fabs((double)(chi[0]+chi[1]-6)) @@ -258,7 +258,7 @@ void ComputeAcklandAtom::compute_peratom() // Identification of the local structure according to the reference - if (delta_bcc >= 0.1 && delta_cp >= 0.1 && delta_fcc >= 0.1 + if (delta_bcc >= 0.1 && delta_cp >= 0.1 && delta_fcc >= 0.1 && delta_hcp >= 0.1) structure[i] = UNKNOWN; // not part of Ackland-Jones 2006; included for backward compatibility diff --git a/src/USER-MISC/compute_basal_atom.cpp b/src/USER-MISC/compute_basal_atom.cpp index cf90b50d8a39140796768d4bd8be4c4734b8485a..d323e20a1081df13f42e3d6f067c34645aad5bc3 100644 --- a/src/USER-MISC/compute_basal_atom.cpp +++ b/src/USER-MISC/compute_basal_atom.cpp @@ -16,7 +16,7 @@ Copyright (C) 2013 ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_basal_atom.h" #include "atom.h" #include "update.h" @@ -164,7 +164,7 @@ void ComputeBasalAtom::compute_peratom() for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; - + delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; @@ -172,7 +172,7 @@ void ComputeBasalAtom::compute_peratom() if (rsq < cutsq) { distsq[n] = rsq; nearest[n++] = j; - } + } } // Select 6 nearest neighbors @@ -220,7 +220,7 @@ void ComputeBasalAtom::compute_peratom() if (norm_k <= 0.) {continue;} bond_angle = (x_ij*x_ik + y_ij*y_ik + z_ij*z_ik) / (norm_j*norm_k); //find all bond angles that are about 180 degrees - if (-1. <= bond_angle && bond_angle < -0.945) { + if (-1. <= bond_angle && bond_angle < -0.945) { x3[chi[0]] = x_ik - x_ij; y3[chi[0]] = y_ik - y_ij; z3[chi[0]] = z_ik - z_ij; @@ -416,7 +416,7 @@ void ComputeBasalAtom::compute_peratom() else BPV[i][0] = BPV[i][1] = BPV[i][2] = 0.0; //normalize BPV: - double Mag = sqrt(BPV[i][0]*BPV[i][0] + + double Mag = sqrt(BPV[i][0]*BPV[i][0] + BPV[i][1]*BPV[i][1] + BPV[i][2]*BPV[i][2]); if (Mag > 0){ BPV[i][0] = BPV[i][0]/Mag; diff --git a/src/USER-MISC/compute_temp_rotate.cpp b/src/USER-MISC/compute_temp_rotate.cpp index 02cc87c4b959b8c483d02a7e909b8b93d2c949dd..574db8757c808b767ac3de50cf3e4f1cb990c5af 100644 --- a/src/USER-MISC/compute_temp_rotate.cpp +++ b/src/USER-MISC/compute_temp_rotate.cpp @@ -15,9 +15,9 @@ Contributing author: Laurent Joly (U Lyon, France), ljoly.ulyon@gmail.com ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "compute_temp_rotate.h" #include "atom.h" #include "update.h" @@ -142,7 +142,7 @@ double ComputeTempRotate::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.cpp b/src/USER-MISC/dihedral_cosine_shift_exp.cpp index 8ce119d40ae307b208259988c5d8cb5475324df9..8706b5fb1a18670a68e915240789329b43c524ca 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.cpp +++ b/src/USER-MISC/dihedral_cosine_shift_exp.cpp @@ -15,9 +15,9 @@ Contributing author: Carsten Svaneborg, science@zqex.dk ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "dihedral_cosine_shift_exp.h" #include "atom.h" #include "comm.h" @@ -136,8 +136,8 @@ void DihedralCosineShiftExp::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.h b/src/USER-MISC/dihedral_cosine_shift_exp.h index ff0843ab186d046c0581a5d1baec9ef062d6657a..819fd769cb13cb3fad446b9e4fd9faa9f79b93af 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.h +++ b/src/USER-MISC/dihedral_cosine_shift_exp.h @@ -20,7 +20,7 @@ DihedralStyle(cosine/shift/exp,DihedralCosineShiftExp) #ifndef LMP_DIHEDRAL_COSINE_SHIFT_EXP_H #define LMP_DIHEDRAL_COSINE_SHIFT_EXP_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index 3656a43e261703d10077fa2f7535b1862223a76a..93e818183da81490c1829c2497d99d03f6a81c10 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,9 +16,9 @@ [ based on dihedral_charmm.cpp Paul Crozier (SNL) ] ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "dihedral_fourier.h" #include "atom.h" #include "comm.h" @@ -73,7 +73,7 @@ void DihedralFourier::compute(int eflag, int vflag) double edihedral,f1[3],f2[3],f3[3],f4[3]; double ax,ay,az,bx,by,bz,rasq,rbsq,rgsq,rg,rginv,ra2inv,rb2inv,rabinv; double df,df1_,ddf1_,fg,hg,fga,hgb,gaa,gbb; - double dtfx,dtfy,dtfz,dtgx,dtgy,dtgz,dthx,dthy,dthz; + double dtfx,dtfy,dtfz,dtgx,dtgy,dtgz,dthx,dthy,dthz; double c,s,p_,sx2,sy2,sz2; if (eflag || vflag) ev_setup(eflag,vflag); @@ -143,8 +143,8 @@ void DihedralFourier::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); @@ -173,7 +173,7 @@ void DihedralFourier::compute(int eflag, int vflag) m = multiplicity[type][j]; p_ = 1.0; ddf1_ = df1_ = 0.0; - + for (i = 0; i < m; i++) { ddf1_ = p_*c - df1_*s; df1_ = p_*s + df1_*c; @@ -184,13 +184,13 @@ void DihedralFourier::compute(int eflag, int vflag) df1_ = df1_*cos_shift[type][j] - ddf1_*sin_shift[type][j]; df1_ *= -m; p_ += 1.0; - + if (m == 0) { p_ = 1.0 + cos_shift[type][j]; df1_ = 0.0; } - if (eflag) edihedral += k[type][j] * p_; + if (eflag) edihedral += k[type][j] * p_; df += (-k[type][j] * df1_); } @@ -282,7 +282,7 @@ void DihedralFourier::allocate() k[i] = shift[i] = cos_shift[i] = sin_shift[i] = 0; multiplicity[i] = 0; } - + memory->create(setflag,n+1,"dihedral:setflag"); for (int i = 1; i <= n; i++) setflag[i] = 0; } @@ -320,8 +320,8 @@ void DihedralFourier::coeff(int narg, char **arg) k[i] = new double [nterms_one]; multiplicity[i] = new int [nterms_one]; shift[i] = new double [nterms_one]; - cos_shift[i] = new double [nterms_one]; - sin_shift[i] = new double [nterms_one]; + cos_shift[i] = new double [nterms_one]; + sin_shift[i] = new double [nterms_one]; for (int j = 0; j<nterms_one; j++) { int offset = 1+3*j; k_one = force->numeric(FLERR,arg[offset+1]); @@ -341,7 +341,7 @@ void DihedralFourier::coeff(int narg, char **arg) } /* ---------------------------------------------------------------------- - proc 0 writes out coeffs to restart file + proc 0 writes out coeffs to restart file ------------------------------------------------------------------------- */ void DihedralFourier::write_restart(FILE *fp) @@ -357,7 +357,7 @@ void DihedralFourier::write_restart(FILE *fp) } /* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them + proc 0 reads coeffs from restart file, bcasts them ------------------------------------------------------------------------- */ void DihedralFourier::read_restart(FILE *fp) @@ -369,7 +369,7 @@ void DihedralFourier::read_restart(FILE *fp) MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); - // allocate + // allocate for (int i=1; i<=atom->ndihedraltypes; i++) { k[i] = new double [nterms[i]]; multiplicity[i] = new int [nterms[i]]; diff --git a/src/USER-MISC/dihedral_fourier.h b/src/USER-MISC/dihedral_fourier.h index 734812c8b495d34bb4ec808d22fe7c791f0ba7fc..4229f494c269ac8cef6c2044bd4e19bb6795e5f1 100644 --- a/src/USER-MISC/dihedral_fourier.h +++ b/src/USER-MISC/dihedral_fourier.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -20,7 +20,7 @@ DihedralStyle(fourier,DihedralFourier) #ifndef LMP_DIHEDRAL_FOURIER_H #define LMP_DIHEDRAL_FOURIER_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index 5789f88402cea6b3b6a9325b26730a1f5967cb2e..67b363f5526528940074d3b868230a19d16b34c7 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,8 +16,8 @@ [ based on dihedral_multi_harmonic.cpp Mathias Puetz (SNL) and friends ] ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "dihedral_nharmonic.h" #include "atom.h" #include "neighbor.h" @@ -155,8 +155,8 @@ void DihedralNHarmonic::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); @@ -296,7 +296,7 @@ void DihedralNHarmonic::coeff(int narg, char **arg) } /* ---------------------------------------------------------------------- - proc 0 writes out coeffs to restart file + proc 0 writes out coeffs to restart file ------------------------------------------------------------------------- */ void DihedralNHarmonic::write_restart(FILE *fp) @@ -307,22 +307,22 @@ void DihedralNHarmonic::write_restart(FILE *fp) } /* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them + proc 0 reads coeffs from restart file, bcasts them ------------------------------------------------------------------------- */ void DihedralNHarmonic::read_restart(FILE *fp) { allocate(); - if (comm->me == 0) + if (comm->me == 0) fread(&nterms[1],sizeof(int),atom->ndihedraltypes,fp); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); - // allocate + // allocate for(int i = 1; i <= atom->ndihedraltypes; i++) a[i] = new double [nterms[i]]; - + if (comm->me == 0) { for(int i = 1; i <= atom->ndihedraltypes; i++) fread(a[i],sizeof(double),nterms[i],fp); diff --git a/src/USER-MISC/dihedral_nharmonic.h b/src/USER-MISC/dihedral_nharmonic.h index a705c0ff4553bf194c867c86ea5fab2062fd2a68..c347f37cbd04c894c4775f3dc0dc76117024515e 100644 --- a/src/USER-MISC/dihedral_nharmonic.h +++ b/src/USER-MISC/dihedral_nharmonic.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -20,7 +20,7 @@ DihedralStyle(nharmonic,DihedralNHarmonic) #ifndef DIHEDRAL_NHARMONIC_H #define DIHEDRAL_NHARMONIC_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/dihedral_quadratic.cpp b/src/USER-MISC/dihedral_quadratic.cpp index 40e1d7f3c3d5838e6264ec82e4a9dd6200ee5606..3a5eac6fa0b549f66138e5c68fbbb62d068be494 100644 --- a/src/USER-MISC/dihedral_quadratic.cpp +++ b/src/USER-MISC/dihedral_quadratic.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,8 +16,8 @@ [ based on dihedral_helix.cpp Paul Crozier (SNL) ] ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "dihedral_quadratic.h" #include "atom.h" #include "neighbor.h" @@ -162,8 +162,8 @@ void DihedralQuadratic::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Dihedral problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); @@ -197,7 +197,7 @@ void DihedralQuadratic::compute(int eflag, int vflag) pd = - 2.0 * p * siinv; p = p * dphi; - if (eflag) edihedral = p; + if (eflag) edihedral = p; a = pd; c = c * a; @@ -293,7 +293,7 @@ void DihedralQuadratic::coeff(int narg, char **arg) // require k >= 0 if (k_one < 0.0) error->all(FLERR,"Incorrect coefficient arg for dihedral coefficients"); - + int count = 0; for (int i = ilo; i <= ihi; i++) { k[i] = k_one; @@ -306,7 +306,7 @@ void DihedralQuadratic::coeff(int narg, char **arg) } /* ---------------------------------------------------------------------- - proc 0 writes out coeffs to restart file + proc 0 writes out coeffs to restart file ------------------------------------------------------------------------- */ void DihedralQuadratic::write_restart(FILE *fp) @@ -316,7 +316,7 @@ void DihedralQuadratic::write_restart(FILE *fp) } /* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them + proc 0 reads coeffs from restart file, bcasts them ------------------------------------------------------------------------- */ void DihedralQuadratic::read_restart(FILE *fp) @@ -329,7 +329,7 @@ void DihedralQuadratic::read_restart(FILE *fp) } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&phi0[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); - + for (int i = 1; i <= atom->ndihedraltypes; i++) setflag[i] = 1; } diff --git a/src/USER-MISC/dihedral_quadratic.h b/src/USER-MISC/dihedral_quadratic.h index bc4e032c005a6e42f52788160e3f40f85fe345f4..638efac6687dc7f83754384d41c4cff0208a14b7 100644 --- a/src/USER-MISC/dihedral_quadratic.h +++ b/src/USER-MISC/dihedral_quadratic.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -20,7 +20,7 @@ DihedralStyle(quadratic,DihedralQuadratic) #ifndef LMP_DIHEDRAL_QUADRATIC_H #define LMP_DIHEDRAL_QUADRATIC_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index befaffc3634f9c5ac56936dfcbdc75a6e9b5e743..4e3b05bc4b4a751f10978a1b6c2051ea158761e3 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -1300,7 +1300,7 @@ void DihedralTable::compute_table(Table *tb) tb->e[i]= cyc_lin(tb->phifile,tb->efile,tb->ninput,MY_2PI,phi); } // In the linear case, if the user did not specify the forces, then we - // must generate the "f" array. Do this using linear interpolation + // must generate the "f" array. Do this using linear interpolation // of the e array (which itself was generated above) for (int i = 0; i < tablength; i++) { int im1 = i-1; if (im1 < 0) im1 += tablength; diff --git a/src/USER-MISC/fix_addtorque.cpp b/src/USER-MISC/fix_addtorque.cpp index db90b7b21c78f41c38f4a0e22b8c2a24574df6e3..0e1ffaf0e1d7cd5400de486d931cad65193d2b64 100644 --- a/src/USER-MISC/fix_addtorque.cpp +++ b/src/USER-MISC/fix_addtorque.cpp @@ -15,8 +15,8 @@ Contributing author: Laurent Joly (U Lyon, France), ljoly.ulyon@gmail.com ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_addtorque.h" #include "atom.h" #include "update.h" @@ -109,21 +109,21 @@ void FixAddTorque::init() if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) + if (xvar < 0) error->all(FLERR,"Variable name for fix addtorque does not exist"); if (input->variable->equalstyle(xvar)) xstyle = EQUAL; else error->all(FLERR,"Variable for fix addtorque is invalid style"); } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) + if (yvar < 0) error->all(FLERR,"Variable name for fix addtorque does not exist"); if (input->variable->equalstyle(yvar)) ystyle = EQUAL; else error->all(FLERR,"Variable for fix addtorque is invalid style"); } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) + if (zvar < 0) error->all(FLERR,"Variable name for fix addtorque does not exist"); if (input->variable->equalstyle(zvar)) zstyle = EQUAL; else error->all(FLERR,"Variable for fix addtorque is invalid style"); diff --git a/src/USER-MISC/fix_ave_correlate_long.cpp b/src/USER-MISC/fix_ave_correlate_long.cpp index 03fdd1367520a68561255ddc4c2eea20d1859c14..3811eabcf301fedc8c1655c9d1fcfea1a2d0f751 100644 --- a/src/USER-MISC/fix_ave_correlate_long.cpp +++ b/src/USER-MISC/fix_ave_correlate_long.cpp @@ -21,10 +21,10 @@ see J. Chem. Phys. 133, 154103 (2010) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" -#include "unistd.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "fix_ave_correlate_long.h" #include "update.h" #include "modify.h" @@ -114,7 +114,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): while (iarg < narg) { if (strcmp(arg[iarg],"type") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); if (strcmp(arg[iarg+1],"auto") == 0) type = AUTO; else if (strcmp(arg[iarg+1],"upper") == 0) type = UPPER; @@ -125,27 +125,27 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): else error->all(FLERR,"Illegal fix ave/correlate/long command"); iarg += 2; } else if (strcmp(arg[iarg],"start") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); startstep = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"ncorr") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); numcorrelators = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"nlen") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); p = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"ncount") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); m = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"file") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); @@ -160,7 +160,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): overwrite = 1; iarg += 1; } else if (strcmp(arg[iarg],"title1") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); delete [] title1; int n = strlen(arg[iarg+1]) + 1; @@ -168,7 +168,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): strcpy(title1,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"title2") == 0) { - if (iarg+2 > narg) + if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); delete [] title2; int n = strlen(arg[iarg+1]) + 1; @@ -309,7 +309,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): } for (int i=0;i<length;i++) t[i]=0.0; - for (int i=0;i<npair;i++) + for (int i=0;i<npair;i++) for (int j=0;j<length;j++) f[i][j]=0.0; @@ -336,11 +336,11 @@ FixAveCorrelateLong::~FixAveCorrelateLong() memory->destroy(values); memory->destroy(shift); memory->destroy(shift2); - memory->destroy(correlation); - memory->destroy(accumulator); - memory->destroy(accumulator2); - memory->destroy(ncorrelation); - memory->destroy(naccumulator); + memory->destroy(correlation); + memory->destroy(accumulator); + memory->destroy(accumulator2); + memory->destroy(ncorrelation); + memory->destroy(naccumulator); memory->destroy(insertindex); memory->destroy(t); memory->destroy(f); @@ -412,7 +412,7 @@ void FixAveCorrelateLong::end_of_step() // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; - if (ntimestep < nvalid_last || ntimestep > nvalid) + if (ntimestep < nvalid_last || ntimestep > nvalid) error->all(FLERR,"Invalid timestep reset for fix ave/correlate/long"); if (ntimestep != nvalid) return; nvalid_last = nvalid; @@ -622,7 +622,7 @@ void FixAveCorrelateLong::add(const int i, const double w, const unsigned int k) /* ---------------------------------------------------------------------- Add 2 scalar values to the cross-correlator k of pair i ------------------------------------------------------------------------- */ -void FixAveCorrelateLong::add(const int i, const double wA, const double wB, +void FixAveCorrelateLong::add(const int i, const double wA, const double wB, const unsigned int k) { if (k == numcorrelators) return; if (k > kmax) kmax=k; @@ -687,7 +687,7 @@ bigint FixAveCorrelateLong::nextvalid() /* ---------------------------------------------------------------------- - memory_usage + memory_usage ------------------------------------------------------------------------- */ double FixAveCorrelateLong::memory_usage() { // shift: npair x numcorrelators x p @@ -698,11 +698,11 @@ double FixAveCorrelateLong::memory_usage() { // ncorrelation: numcorrelators x p // naccumulator: numcorrelators // insertindex: numcorrelators - // t: numcorrelators x p + // t: numcorrelators x p // f: npair x numcorrelators x p double bytes = (4*npair*numcorrelators*p + 2*npair*numcorrelators + numcorrelators*p)*sizeof(double) - + numcorrelators*p*sizeof(unsigned long int) + + numcorrelators*p*sizeof(unsigned long int) + 2*numcorrelators*sizeof(unsigned int); return bytes; } @@ -720,7 +720,7 @@ void FixAveCorrelateLong::write_restart(FILE *fp) { memory->create(list,nsize,"correlator:list"); list[n++]=npair; list[n++]=numcorrelators; - list[n++]=p; + list[n++]=p; list[n++]=m; list[n++]=nvalid; list[n++]=nvalid_last; @@ -740,7 +740,7 @@ void FixAveCorrelateLong::write_restart(FILE *fp) { list[n++]=insertindex[i]; } - int size = n*sizeof(double); + int size = n*sizeof(double); fwrite(&size,sizeof(int),1,fp); fwrite(list,sizeof(double),n,fp); memory->destroy(list); @@ -754,17 +754,17 @@ void FixAveCorrelateLong::write_restart(FILE *fp) { void FixAveCorrelateLong::restart(char *buf) { int n = 0; - double *list = (double *) buf; + double *list = (double *) buf; int npairin = static_cast<int> (list[n++]); - int numcorrelatorsin = static_cast<int> (list[n++]); - int pin = static_cast<int> (list[n++]); - int min = static_cast<int> (list[n++]); - nvalid = static_cast<int> (list[n++]); - nvalid_last = static_cast<int> (list[n++]); + int numcorrelatorsin = static_cast<int> (list[n++]); + int pin = static_cast<int> (list[n++]); + int min = static_cast<int> (list[n++]); + nvalid = static_cast<int> (list[n++]); + nvalid_last = static_cast<int> (list[n++]); if ((npairin!=npair) || (numcorrelatorsin!=numcorrelators) || (pin!=p) || (min!=m)) - error->all(FLERR,"Fix ave/correlate/long: restart and input data are different"); + error->all(FLERR,"Fix ave/correlate/long: restart and input data are different"); for (int i=0;i<npair;i++) for (int j=0;j<numcorrelators;j++) { @@ -777,7 +777,7 @@ void FixAveCorrelateLong::restart(char *buf) accumulator2[i][j] = list[n++]; } for (int i=0;i<numcorrelators;i++) { - for (int j=0;j<p;j++) + for (int j=0;j<p;j++) ncorrelation[i][j] = static_cast<unsigned long int>(list[n++]); naccumulator[i] = static_cast<unsigned int> (list[n++]); insertindex[i] = static_cast<unsigned int> (list[n++]); diff --git a/src/USER-MISC/fix_ave_correlate_long.h b/src/USER-MISC/fix_ave_correlate_long.h index 49e840e890207b43162d889e49de34ee33163873..d5354ebf5ee231518aa793ff7f02d5563326cc81 100644 --- a/src/USER-MISC/fix_ave_correlate_long.h +++ b/src/USER-MISC/fix_ave_correlate_long.h @@ -20,7 +20,7 @@ FixStyle(ave/correlate/long,FixAveCorrelateLong) #ifndef LMP_FIX_AVE_CORRELATE_LONG_H #define LMP_FIX_AVE_CORRELATE_LONG_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { @@ -37,19 +37,19 @@ class FixAveCorrelateLong : public Fix { void write_restart(FILE *); void restart(char *); double memory_usage(); - + double *t; // Time steps for result arrays double **f; // Result arrays unsigned int npcorr; private: // NOT OPTIMAL: shift2 and accumulator2 only needed in cross-correlations - double ***shift, *** shift2; + double ***shift, *** shift2; double ***correlation; double **accumulator, **accumulator2; - unsigned long int **ncorrelation; - unsigned int *naccumulator; - unsigned int *insertindex; + unsigned long int **ncorrelation; + unsigned int *naccumulator; + unsigned int *insertindex; unsigned int numcorrelators; // Recommended 20 unsigned int p; // Points per correlator (recommended 16) @@ -75,7 +75,7 @@ class FixAveCorrelateLong : public Fix { void accumulate(); void evaluate(); bigint nextvalid(); - + void add(const int i, const double w, const unsigned int k = 0); void add(const int i, const double wA, const double wB, const unsigned int k = 0); diff --git a/src/USER-MISC/fix_ave_spatial_sphere.cpp b/src/USER-MISC/fix_ave_spatial_sphere.cpp index bf82173be2813a0b215cae822e704c3f3ea753f9..d26908bc382e6c3f2118481b757b43ef2696ecea 100644 --- a/src/USER-MISC/fix_ave_spatial_sphere.cpp +++ b/src/USER-MISC/fix_ave_spatial_sphere.cpp @@ -15,9 +15,9 @@ Adapted from fix ave/spatial by Niall Jackson <niall.jackson@gmail.com> ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "unistd.h" +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "fix_ave_spatial_sphere.h" #include "atom.h" #include "update.h" @@ -55,17 +55,17 @@ enum{ONE,RUNNING,WINDOW}; FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : Fix(lmp, narg, arg) { - + if (narg < 12) error->all(FLERR, "Illegal fix ave/spatial/sphere command"); - + MPI_Comm_rank(world, &me); - + nevery= force->inumeric(FLERR, arg[3]); nrepeat= force->inumeric(FLERR, arg[4]); nfreq= force->inumeric(FLERR, arg[5]); - + global_freq= nfreq; - + for (int iarg = 6; iarg < 9; ++iarg) { int dim= iarg-6; origin_ids[dim]= NULL; @@ -104,11 +104,11 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : if(origin_type[dim] == COMPUTE) { int icompute= modify->find_compute(origin_ids[dim]); - if(icompute < 0) + if(icompute < 0) error->all(FLERR, "Compute ID for fix ave/spatial/sphere does not exist"); - if(origin_index[dim] == 0 && + if(origin_index[dim] == 0 && modify->compute[icompute]->scalar_flag != 0) error->all(FLERR,"Compute for fix ave/spatial/sphere does not calculate a scalar"); else if(origin_index[dim] && modify->compute[icompute]->vector_flag == 0) @@ -127,14 +127,14 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : origin[dim]= force->numeric(FLERR, arg[iarg]); } } - + //the extrema of the radius r_min= force->numeric(FLERR, arg[9]); r_max= force->numeric(FLERR, arg[10]); - + //and finally, the number of spherical bins nbins= force->inumeric(FLERR, arg[11]); - + if (r_min >= r_max) { error->all(FLERR, "r_min must be less than r_max in fix ave/spatial/sphere"); } @@ -142,17 +142,17 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : if (nbins <= 0) { error->all(FLERR, "nbins must be positive in fix ave/spatial/sphere"); } - + int iarg= 12; which= new int[narg-12]; argindex= new int[narg-12]; ids= new char*[narg-12]; value2index= new int[narg-12]; nvalues= 0; - + while(iarg < narg) { ids[nvalues]= NULL; - + if(strcmp(arg[iarg], "vx") == 0) { which[nvalues] = V; argindex[nvalues++]= 0; @@ -183,12 +183,12 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : if(arg[iarg][0] == 'c') which[nvalues] = COMPUTE; else if(arg[iarg][0] == 'f') which[nvalues] = FIX; else if(arg[iarg][0] == 'v') which[nvalues] = VARIABLE; - + //strip the v_/c_/f_ off the front of the variable name int n= strlen(arg[iarg]); char *suffix= new char[n]; strcpy(suffix, &arg[iarg][2]); - + //does the variable name contain a [? //(in other words, is this an array element?) char *ptr= strchr(suffix, '['); @@ -203,7 +203,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : } else { argindex[nvalues]= 0; } - + //store the name of the variable n= strlen(suffix)+1; ids[nvalues]= new char[n]; @@ -212,10 +212,10 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : //tidy up the array we allocated earlier delete[] suffix; } else break; - + iarg++; } - + //process the optional arguments normflag= ALL; //normalise the average right at the end scaleflag= LATTICE; // lattice units are the default @@ -228,7 +228,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : char *title1= NULL; char *title2= NULL; char *title3= NULL; - + while (iarg < narg) { if (strcmp(arg[iarg],"norm") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial/sphere command"); @@ -303,7 +303,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : iarg += 2; } else error->all(FLERR,"Illegal fix ave/spatial/sphere command"); } - + //setup and error checking if (nevery <= 0 || nrepeat <= 0 || nfreq <= 0) error->all(FLERR,"Illegal fix ave/spatial/sphere command"); @@ -311,7 +311,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : error->all(FLERR,"Illegal fix ave/spatial/sphere command"); if (ave != RUNNING && overwrite) error->all(FLERR,"Illegal fix ave/spatial/sphere command"); - + //setup the variables that we need to average for (int i = 0; i < nvalues; i++) { if (which[i] == COMPUTE) { @@ -367,7 +367,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : no_change_box= 1; } } - + if(scaleflag == LATTICE) { scale= domain->lattice->xlattice; if(domain->lattice->xlattice != domain->lattice->ylattice @@ -379,7 +379,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : } else { scale= 1.0; } - + //apply the scaling factors origin[0]*= scale; origin[1]*= scale; @@ -390,7 +390,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : r_maxsq= r_max*r_max; deltar= (r_max-r_min)/nbins; inv_deltar= 1.0/deltar; - + //print file comment lines if (fp && me == 0) { if (title1) { @@ -401,7 +401,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : for (int i= 0; i < 3; ++i) { if(origin_type[i] == CONSTANT) fprintf(fp,"%g",origin[i]); else fprintf(fp,"%s",arg[i+6]); - + if(i != 2) fprintf(fp, ", "); else fprintf(fp, ")"); } @@ -424,13 +424,13 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : delete [] title1; delete [] title2; delete [] title3; - + //this fix produces a global array array_flag= 1; size_array_rows= BIG; size_array_cols= 1 + 1 + nvalues; extarray= 0; //intensive value (don't divide by N when we output this) - + //initialization of remaining variables irepeat= 0; iwindow= window_limit= 0; @@ -446,7 +446,7 @@ FixAveSpatialSphere::FixAveSpatialSphere(LAMMPS* lmp, int narg, char** arg) : count_list= NULL; values_one= values_many= values_sum= values_total= NULL; values_list= NULL; - + //nvalid = next step on which end_of_step does something nvalid= nextvalid(); //make every compute update itself on step nvalid @@ -505,11 +505,11 @@ void FixAveSpatialSphere::init() //set up the region and check it's valid if(regionflag) { int iregion= domain->find_region(idregion); - if(iregion == -1) + if(iregion == -1) error->all(FLERR,"Region ID for fix ave/spatial/sphere does not exist"); region = domain->regions[iregion]; } - + // set indices and check validity of all computes,fixes,variables // check that fix frequency is acceptable @@ -552,8 +552,8 @@ void FixAveSpatialSphere::init() } else value2index[m] = -1; } - - + + // need to reset nvalid if nvalid < ntimestep b/c minimize was performed if (nvalid < update->ntimestep) { irepeat = 0; @@ -583,7 +583,7 @@ void FixAveSpatialSphere::end_of_step() //update region if necessary if (regionflag) region->prematch(); - + //zero out arrays that accumulate over many samples if(irepeat == 0) { for(int m= 0; m < nbins; m++) { @@ -594,23 +594,23 @@ void FixAveSpatialSphere::end_of_step() //if in reduced units, we need to update the bin volumes if (scaleflag == REDUCED && domain->box_change) set_bin_volumes(); - + //zero out arrays for one sample for(int m= 0; m < nbins; m++) { count_one[m]= 0.0; for (int i= 0; i < nvalues; i++) values_one[m][i]= 0.0; } - + //bin each atom int *mask= atom->mask; int nlocal= atom->nlocal; - + if (nlocal > maxatom) { maxatom= atom->nmax; memory->destroy(bin); memory->create(bin,maxatom,"ave/spatial/sphere:bin"); } - + // perform the computation for one sample // accumulate results of attributes,computes,fixes,variables to local copy // sum within each bin, only include atoms in fix group @@ -621,11 +621,11 @@ void FixAveSpatialSphere::end_of_step() //each atom gets either the number of the bin into which //it fits, or -1 bin_atoms(); - + for(int m= 0; m < nvalues; m++) { int n= value2index[m]; int j= argindex[m]; - + if(which[m] == V || which[m] == F) { double **attribute; if(which[m] == V) attribute= atom->v; @@ -696,7 +696,7 @@ void FixAveSpatialSphere::end_of_step() values_one[bin[i]][m] += varatom[i]; } } - + // process a single sample // if normflag = ALL, accumulate values,count separately to many // if normflag = SAMPLE, one = value/count, accumulate one to many @@ -720,7 +720,7 @@ void FixAveSpatialSphere::end_of_step() count_sum[m] += count_many[m]; } } - + // done if irepeat < nrepeat // else reset irepeat and nvalid irepeat++; @@ -729,14 +729,14 @@ void FixAveSpatialSphere::end_of_step() modify->addstep_compute(nvalid); return; } - + irepeat++; if (irepeat < nrepeat) { nvalid += nevery; modify->addstep_compute(nvalid); return; } - + irepeat = 0; nvalid = ntimestep+nfreq - (nrepeat-1)*nevery; modify->addstep_compute(nvalid); @@ -745,7 +745,7 @@ void FixAveSpatialSphere::end_of_step() // if normflag = ALL, final is total value / total count // if normflag = SAMPLE, final is sum of ave / repeat // exception is densities: normalized by repeat, not total count - + double repeat = nrepeat; double mv2d = force->mv2d; if (normflag == ALL) { @@ -810,7 +810,7 @@ void FixAveSpatialSphere::end_of_step() if (window_limit) norm = nwindow; else norm = iwindow; } - + // output result to file if (fp && me == 0) { @@ -852,21 +852,21 @@ void FixAveSpatialSphere::setup_bins() memory->grow(values_many,nbins,nvalues,"ave/spatial/sphere:values_many"); memory->grow(values_sum,nbins,nvalues,"ave/spatial/sphere:values_sum"); memory->grow(values_total,nbins,nvalues,"ave/spatial/sphere:values_total"); - + //the count and value lists are only relevant for windowed averaging if(ave == WINDOW) { memory->create(count_list,nwindow,nbins,"ave/spatial/sphere:count_list"); memory->create(values_list,nwindow,nbins,nvalues, "ave/spatial/sphere:values_list"); } - + //reinitialize the regrown count and values for(int m= 0; m < nbins; m++) { for(int i= 0; i < nvalues; i++) values_total[m][i]= 0.0; count_total[m]= 0.0; } } - + //set the bin coordinates for(int i= 0; i < nbins; i++) coord[i]= r_min + (i+0.5)*deltar; @@ -904,7 +904,7 @@ void FixAveSpatialSphere::set_bin_volumes() assign atoms to bins ------------------------------------------------------------------------- */ -void FixAveSpatialSphere::bin_atoms() +void FixAveSpatialSphere::bin_atoms() { //update the origin coordinates if necessary //unscale the existing coordinates @@ -938,7 +938,7 @@ void FixAveSpatialSphere::bin_atoms() double **x= atom->x; int *mask = atom->mask; int nlocal = atom->nlocal; - + double *prd,*prd_half; //deal with the periodic boundary conditions if(domain->periodicity[0] || domain->periodicity[1] || domain->periodicity[2]) { @@ -950,16 +950,16 @@ void FixAveSpatialSphere::bin_atoms() prd_half= domain->prd_half; } } - + double rsq, tmp; - + if(!regionflag) { if(scaleflag == REDUCED) { //convert the atomic coordinates into reduced coordinates domain->x2lamda(nlocal); } for(int i= 0; i < nlocal; i++) { - if(mask[i] & groupbit) { + if(mask[i] & groupbit) { rsq= 0.0; for(int dim= 0; dim < 3; dim++) { tmp= x[i][dim] - origin[dim]; diff --git a/src/USER-MISC/fix_ave_spatial_sphere.h b/src/USER-MISC/fix_ave_spatial_sphere.h index ea752f2e3e2eefccae487e16c7be134da7fd559d..1ac550c5e0ec995d298c7e70e58366c8b1124681 100644 --- a/src/USER-MISC/fix_ave_spatial_sphere.h +++ b/src/USER-MISC/fix_ave_spatial_sphere.h @@ -22,7 +22,7 @@ FixStyle(ave/spatial/sphere,FixAveSpatialSphere) #ifndef LMP_FIX_AVE_SPATIAL_SPHERE_H #define LMP_FIX_AVE_SPATIAL_SPHERE_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { @@ -37,13 +37,13 @@ class FixAveSpatialSphere : public Fix { void end_of_step(); double memory_usage(); double compute_array(int,int); - + private: int me; //rank of the MPI Process int nfreq; //fix nfreq parameter int nrepeat; //fix nrepeat parameter bigint nvalid; //the next timestep on which I'll be invoked - + //controls for various optional behaviours int normflag; //what type of normalisation to do int norm; @@ -57,9 +57,9 @@ class FixAveSpatialSphere : public Fix { int ave; //averaging mode int nwindow; //number of averaging windows int iwindow; //current window - int window_limit; + int window_limit; int overwrite; //continuously overwrite the output (requires ave running) - + //used to keep track of which per-atom values we deal with int nvalues; //number of variables to average int *argindex; //if the variable is an array, this is the offset in that array @@ -68,7 +68,7 @@ class FixAveSpatialSphere : public Fix { char **ids; //names of the variables int maxvar; //current size of the varatom array double* varatom; //contains the peratom values of a variable - + //details of the sphere and the bins int maxbin; //current number of bins in memory (relevant if box changes) int nbins; //number of spherical bins @@ -86,17 +86,17 @@ class FixAveSpatialSphere : public Fix { double r_min, r_minsq; //minimum radius, and its square double r_max, r_maxsq; //maximum radius, and its square double deltar, inv_deltar; //radial width of a bin, and its inverse (and their squares) - + void setup_bins(); //create the bin arrays void set_bin_volumes(); //calculate the volume of each bin void bin_atoms(); //put the atom into bins based on their coordinates bigint nextvalid(); //return the next timestep on which this is invoked - + //NEED TO BE CATEGORISED int irepeat; double **count_list; double ***values_list; - + }; } diff --git a/src/USER-MISC/fix_gle.cpp b/src/USER-MISC/fix_gle.cpp index 95f868f95f1f4eaf7f5e1eaf8f5698bb9266dbe5..40d1047648ce1fe8d3d16870a8ec73af0138f38f 100644 --- a/src/USER-MISC/fix_gle.cpp +++ b/src/USER-MISC/fix_gle.cpp @@ -16,10 +16,10 @@ Axel Kohylmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_gle.h" #include "math_extra.h" #include "atom.h" @@ -82,11 +82,11 @@ void StabCholesky(int n, const double* MMt, double* M) for (k=0; k<i; ++k) D[i]-=L[midx(n,i,k)]*L[midx(n,i,k)]*D[k]; } - for(i=0; i<n; ++i) + for(i=0; i<n; ++i) { -#ifdef GLE_DEBUG - if (D[i]<0) fprintf(stderr,"GLE Cholesky: Negative diagonal term %le, has been set to zero.\n", D[i]); -#endif +#ifdef GLE_DEBUG + if (D[i]<0) fprintf(stderr,"GLE Cholesky: Negative diagonal term %le, has been set to zero.\n", D[i]); +#endif D[i]=(D[i]>0.?sqrt(D[i]):0.); } diff --git a/src/USER-MISC/fix_ipi.cpp b/src/USER-MISC/fix_ipi.cpp index 07dbeb2500cff75e4c92f8382111ebbbb0a1a322..f9b0b519acb8273e216013a572a2ce3f155ddd83 100644 --- a/src/USER-MISC/fix_ipi.cpp +++ b/src/USER-MISC/fix_ipi.cpp @@ -15,10 +15,10 @@ Contributing author: Michele Ceriotti (EPFL), Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdio.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> #include "fix_ipi.h" #include "atom.h" #include "force.h" @@ -32,7 +32,7 @@ #include "neighbor.h" #include "domain.h" #include "compute_pressure.h" -#include "errno.h" +#include <errno.h> using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-MISC/fix_pimd.cpp b/src/USER-MISC/fix_pimd.cpp index 75662a82076a635705188ba5781527ae2fc0e464..bba6b2e2bead54515e9c9d62817e0da7bd1c64dc 100644 --- a/src/USER-MISC/fix_pimd.cpp +++ b/src/USER-MISC/fix_pimd.cpp @@ -16,14 +16,14 @@ Purpose Quantum Path Integral Algorithm for Quantum Chemistry Copyright Voth Group @ University of Chicago Authors Chris Knight & Yuxing Peng (yuxing at uchicago.edu) - + Updated Oct-01-2011 Version 1.0 ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_pimd.h" #include "universe.h" #include "comm.h" @@ -42,7 +42,7 @@ enum{PIMD,NMPIMD,CMD}; /* ---------------------------------------------------------------------- */ FixPIMD::FixPIMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) -{ +{ method = PIMD; fmass = 1.0; nhc_temp = 298.15; @@ -80,57 +80,57 @@ FixPIMD::FixPIMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) } else error->universe_all(arg[i],i+1,"Unkown keyword for fix pimd"); } - + /* Initiation */ - + max_nsend = 0; tag_send = NULL; buf_send = NULL; - + max_nlocal = 0; buf_recv = NULL; buf_beads = NULL; - + size_plan = 0; plan_send = plan_recv = NULL; - + M_x2xp = M_xp2x = M_f2fp = M_fp2f = NULL; lam = NULL; mode_index = NULL; mass = NULL; - + array_atom = NULL; nhc_eta = NULL; nhc_eta_dot = NULL; nhc_eta_dotdot = NULL; nhc_eta_mass = NULL; - + size_peratom_cols = 12 * nhc_nchain + 3; - + nhc_offset_one_1 = 3 * nhc_nchain; nhc_offset_one_2 = 3 * nhc_nchain +3; nhc_size_one_1 = sizeof(double) * nhc_offset_one_1; nhc_size_one_2 = sizeof(double) * nhc_offset_one_2; - + restart_peratom = 1; peratom_flag = 1; peratom_freq = 1; - + global_freq = 1; thermo_energy = 1; vector_flag = 1; size_vector = 2; extvector = 1; comm_forward = 3; - + atom->add_callback(0); // Call LAMMPS to allocate memory for per-atom array atom->add_callback(1); // Call LAMMPS to re-assign restart-data for per-atom array - + grow_arrays(atom->nmax); - + // some initilizations - + nhc_ready = false; } @@ -153,53 +153,53 @@ void FixPIMD::init() error->all(FLERR,"Fix pimd requires an atom map, see atom_modify"); if(universe->me==0 && screen) fprintf(screen,"Fix pimd initializing Path-Integral ...\n"); - + // prepare the constants - + np = universe->nworlds; inverse_np = 1.0 / np; - - /* The first solution for the force constant, using SI units - + + /* The first solution for the force constant, using SI units + const double Boltzmann = 1.3806488E-23; // SI unit: J/K const double Plank = 6.6260755E-34; // SI unit: m^2 kg / s - + double hbar = Plank / ( 2.0 * M_PI ) * sp; double beta = 1.0 / ( Boltzmann * input.nh_temp); - + // - P / ( beta^2 * hbar^2) SI unit: s^-2 double _fbond = -1.0 / (beta*beta*hbar*hbar) * input.nbeads; - + // convert the units: s^-2 -> (kcal/mol) / (g/mol) / (A^2) fbond = _fbond * 4.184E+26; - + */ - + /* The current solution, using LAMMPS internal real units */ - - const double Boltzmann = force->boltz; - const double Plank = force->hplanck; - + + const double Boltzmann = force->boltz; + const double Plank = force->hplanck; + double hbar = Plank / ( 2.0 * M_PI ); - double beta = 1.0 / (Boltzmann * nhc_temp); + double beta = 1.0 / (Boltzmann * nhc_temp); double _fbond = 1.0 * np / (beta*beta*hbar*hbar) ; - + omega_np = sqrt(np) / (hbar * beta) * sqrt(force->mvv2e); fbond = - _fbond * force->mvv2e; - + if(universe->me==0) printf("Fix pimd -P/(beta^2 * hbar^2) = %20.7lE (kcal/mol/A^2)\n\n", fbond); - + dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; - + comm_init(); - + mass = new double [atom->ntypes+1]; - + if(method==CMD || method==NMPIMD) nmpimd_init(); else for(int i=1; i<=atom->ntypes; i++) mass[i] = atom->mass[i] / np * fmass; - + if(!nhc_ready) nhc_init(); } @@ -208,7 +208,7 @@ void FixPIMD::init() void FixPIMD::setup(int vflag) { if(universe->me==0 && screen) fprintf(screen,"Setting up Path-Integral ...\n"); - + post_force(vflag); } @@ -232,22 +232,22 @@ void FixPIMD::final_integrate() void FixPIMD::post_force(int flag) { for(int i=0; i<atom->nlocal; i++) for(int j=0; j<3; j++) atom->f[i][j] /= np; - + comm_exec(atom->x); spring_force(); - + if(method==CMD || method==NMPIMD) { /* forward comm for the force on ghost atoms */ - - nmpimd_fill(atom->f); - + + nmpimd_fill(atom->f); + /* inter-partition comm */ - + comm_exec(atom->f); - + /* normal-mode transform */ - + nmpimd_transform(buf_beads, atom->f, M_f2fp[universe->iworld]); } } @@ -263,50 +263,50 @@ void FixPIMD::nhc_init() double mass0 = KT * tau * tau; int max = 3 * atom->nlocal; - - for(int i=0; i<max; i++) + + for(int i=0; i<max; i++) { - for(int ichain=0; ichain<nhc_nchain; ichain++) + for(int ichain=0; ichain<nhc_nchain; ichain++) { nhc_eta[i][ichain] = 0.0; nhc_eta_dot[i][ichain] = 0.0; nhc_eta_dot[i][ichain] = 0.0; nhc_eta_dotdot[i][ichain] = 0.0; nhc_eta_mass[i][ichain] = mass0; - if((method==CMD || method==NMPIMD) && universe->iworld==0) ; else nhc_eta_mass[i][ichain] *= fmass; + if((method==CMD || method==NMPIMD) && universe->iworld==0) ; else nhc_eta_mass[i][ichain] *= fmass; } - + nhc_eta_dot[i][nhc_nchain] = 0.0; - + for(int ichain=1; ichain<nhc_nchain; ichain++) - nhc_eta_dotdot[i][ichain] = (nhc_eta_mass[i][ichain-1] * nhc_eta_dot[i][ichain-1] + nhc_eta_dotdot[i][ichain] = (nhc_eta_mass[i][ichain-1] * nhc_eta_dot[i][ichain-1] * nhc_eta_dot[i][ichain-1] * force->mvv2e - KT) / nhc_eta_mass[i][ichain]; } // Zero NH acceleration for CMD - - if(method==CMD && universe->iworld==0) for(int i=0; i<max; i++) + + if(method==CMD && universe->iworld==0) for(int i=0; i<max; i++) for(int ichain=0; ichain<nhc_nchain; ichain++) nhc_eta_dotdot[i][ichain] = 0.0; - + nhc_ready = true; } /* ---------------------------------------------------------------------- */ void FixPIMD::nhc_update_x() -{ +{ int n = atom->nlocal; double **x = atom->x; double **v = atom->v; - + if(method==CMD || method==NMPIMD) { - nmpimd_fill(atom->v); + nmpimd_fill(atom->v); comm_exec(atom->v); - + /* borrow the space of atom->f to store v in cartisian */ - - v = atom->f; + + v = atom->f; nmpimd_transform(buf_beads, v, M_xp2x[universe->iworld]); } @@ -326,7 +326,7 @@ void FixPIMD::nhc_update_v() int *type = atom->type; double **v = atom->v; double **f = atom->f; - + for(int i=0; i<n; i++) { double dtfm = dtf / mass[type[i]]; @@ -334,36 +334,36 @@ void FixPIMD::nhc_update_v() v[i][1] += dtfm * f[i][1]; v[i][2] += dtfm * f[i][2]; } - + t_sys = 0.0; if(method==CMD && universe->iworld==0) return; - + double expfac; int nmax = 3 * atom->nlocal; double KT = force->boltz * nhc_temp; double kecurrent, t_current; - + double dthalf = 0.5 * update->dt; double dt4 = 0.25 * update->dt; double dt8 = 0.125 * update->dt; - - for(int i=0; i<nmax; i++) + + for(int i=0; i<nmax; i++) { int iatm = i/3; int idim = i%3; - - double *vv = v[iatm]; - + + double *vv = v[iatm]; + kecurrent = mass[type[iatm]] * vv[idim]* vv[idim] * force->mvv2e; t_current = kecurrent / force->boltz; - + double *eta = nhc_eta[i]; double *eta_dot = nhc_eta_dot[i]; double *eta_dotdot = nhc_eta_dotdot[i]; - + eta_dotdot[0] = (kecurrent - KT) / nhc_eta_mass[i][0]; - for(int ichain=nhc_nchain-1; ichain>0; ichain--) + for(int ichain=nhc_nchain-1; ichain>0; ichain--) { expfac = exp(-dt8 * eta_dot[ichain+1]); eta_dot[ichain] *= expfac; @@ -377,7 +377,7 @@ void FixPIMD::nhc_update_v() eta_dot[0] *= expfac; // Update particle velocities half-step - + double factor_eta = exp(-dthalf * eta_dot[0]); vv[idim] *= factor_eta; @@ -385,14 +385,14 @@ void FixPIMD::nhc_update_v() kecurrent = force->boltz * t_current; eta_dotdot[0] = (kecurrent - KT) / nhc_eta_mass[i][0]; - for(int ichain=0; ichain<nhc_nchain; ichain++) + for(int ichain=0; ichain<nhc_nchain; ichain++) eta[ichain] += dthalf * eta_dot[ichain]; eta_dot[0] *= expfac; eta_dot[0] += eta_dotdot[0] * dt4; eta_dot[0] *= expfac; - for(int ichain=1; ichain<nhc_nchain; ichain++) + for(int ichain=1; ichain<nhc_nchain; ichain++) { expfac = exp(-dt8 * eta_dot[ichain+1]); eta_dot[ichain] *= expfac; @@ -401,10 +401,10 @@ void FixPIMD::nhc_update_v() eta_dot[ichain] += eta_dotdot[ichain] * dt4; eta_dot[ichain] *= expfac; } - - t_sys += t_current; + + t_sys += t_current; } - + t_sys /= nmax; } @@ -418,54 +418,54 @@ void FixPIMD::nmpimd_init() memory->create(M_xp2x, np, np, "fix_feynman:M_xp2x"); memory->create(M_f2fp, np, np, "fix_feynman:M_f2fp"); memory->create(M_fp2f, np, np, "fix_feynman:M_fp2f"); - + lam = (double*) memory->smalloc(sizeof(double)*np, "FixPIMD::lam"); // Set up eigenvalues - + lam[0] = 0.0; if(np%2==0) lam[np-1] = 4.0 * np; - + for(int i=2; i<=np/2; i++) { lam[2*i-3] = lam[2*i-2] = 2.0 * np * (1.0 - 1.0 *cos(2.0*M_PI*(i-1)/np)); } - + // Set up eigenvectors for non-degenerated modes - + for(int i=0; i<np; i++) { M_x2xp[0][i] = 1.0 / np; if(np%2==0) M_x2xp[np-1][i] = 1.0 / np * pow(-1.0, i); } - + // Set up eigenvectors for degenerated modes - + for(int i=0; i<(np-1)/2; i++) for(int j=0; j<np; j++) { M_x2xp[2*i+1][j] = sqrt(2.0) * cos ( 2.0 * M_PI * (i+1) * j / np) / np; M_x2xp[2*i+2][j] = - sqrt(2.0) * sin ( 2.0 * M_PI * (i+1) * j / np) / np; } - + // Set up Ut - - for(int i=0; i<np; i++) + + for(int i=0; i<np; i++) for(int j=0; j<np; j++) { - M_xp2x[i][j] = M_x2xp[j][i] * np; + M_xp2x[i][j] = M_x2xp[j][i] * np; M_f2fp[i][j] = M_x2xp[i][j] * np; M_fp2f[i][j] = M_xp2x[i][j]; } - + // Set up masses - + int iworld = universe->iworld; - + for(int i=1; i<=atom->ntypes; i++) { mass[i] = atom->mass[i]; - if(iworld) + if(iworld) { mass[i] *= lam[iworld]; mass[i] *= fmass; @@ -487,10 +487,10 @@ void FixPIMD::nmpimd_transform(double** src, double** des, double *vector) { int n = atom->nlocal; int m = 0; - + for(int i=0; i<n; i++) for(int d=0; d<3; d++) { - des[i][d] = 0.0; + des[i][d] = 0.0; for(int j=0; j<np; j++) { des[i][d] += (src[j][m] * vector[j]); } m++; } @@ -508,9 +508,9 @@ void FixPIMD::spring_force() int* type = atom->type; int nlocal = atom->nlocal; - double* xlast = buf_beads[x_last]; + double* xlast = buf_beads[x_last]; double* xnext = buf_beads[x_next]; - + for(int i=0; i<nlocal; i++) { double delx1 = xlast[0] - x[i][0]; @@ -524,17 +524,17 @@ void FixPIMD::spring_force() double delz2 = xnext[2] - x[i][2]; xnext += 3; domain->minimum_image(delx2, dely2, delz2); - + double ff = fbond * _mass[type[i]]; - + double dx = delx1+delx2; double dy = dely1+dely2; double dz = delz1+delz2; - + f[i][0] -= (dx) * ff; f[i][1] -= (dy) * ff; f[i][2] -= (dz) * ff; - + spring_energy += (dx*dx+dy*dy+dz*dz); } } @@ -550,26 +550,26 @@ void FixPIMD::comm_init() delete [] plan_send; delete [] plan_recv; } - - if(method == PIMD) + + if(method == PIMD) { size_plan = 2; plan_send = new int [2]; plan_recv = new int [2]; mode_index = new int [2]; - + int rank_last = universe->me - comm->nprocs; - int rank_next = universe->me + comm->nprocs; + int rank_next = universe->me + comm->nprocs; if(rank_last<0) rank_last += universe->nprocs; if(rank_next>=universe->nprocs) rank_next -= universe->nprocs; - + plan_send[0] = rank_next; plan_send[1] = rank_last; plan_recv[0] = rank_last; plan_recv[1] = rank_next; - + mode_index[0] = 0; mode_index[1] = 1; x_last = 1; x_next = 0; } - else + else { size_plan = np - 1; plan_send = new int [size_plan]; @@ -580,23 +580,23 @@ void FixPIMD::comm_init() { plan_send[i] = universe->me + comm->nprocs * (i+1); if(plan_send[i]>=universe->nprocs) plan_send[i] -= universe->nprocs; - + plan_recv[i] = universe->me - comm->nprocs * (i+1); if(plan_recv[i]<0) plan_recv[i] += universe->nprocs; mode_index[i]=(universe->iworld+i+1)%(universe->nworlds); } - + x_next = (universe->iworld+1+universe->nworlds)%(universe->nworlds); x_last = (universe->iworld-1+universe->nworlds)%(universe->nworlds); } - + if(buf_beads) { for(int i=0; i<np; i++) if(buf_beads[i]) delete [] buf_beads[i]; delete [] buf_beads; } - + buf_beads = new double* [np]; for(int i=0; i<np; i++) buf_beads[i] = NULL; } @@ -606,51 +606,51 @@ void FixPIMD::comm_init() void FixPIMD::comm_exec(double **ptr) { int nlocal = atom->nlocal; - + if(nlocal > max_nlocal) { max_nlocal = nlocal+200; int size = sizeof(double) * max_nlocal * 3; buf_recv = (double*) memory->srealloc(buf_recv, size, "FixPIMD:x_recv"); - - for(int i=0; i<np; i++) + + for(int i=0; i<np; i++) buf_beads[i] = (double*) memory->srealloc(buf_beads[i], size, "FixPIMD:x_beads[i]"); } - + // copy local positions - + memcpy(buf_beads[universe->iworld], &(ptr[0][0]), sizeof(double)*nlocal*3); - + // go over comm plans - + for(int iplan = 0; iplan<size_plan; iplan++) - { + { // sendrecv nlocal - + int nsend; - - MPI_Sendrecv( &(nlocal), 1, MPI_INT, plan_send[iplan], 0, + + MPI_Sendrecv( &(nlocal), 1, MPI_INT, plan_send[iplan], 0, &(nsend), 1, MPI_INT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE); - + // allocate arrays - + if(nsend > max_nsend) { max_nsend = nsend+200; tag_send = (int*) memory->srealloc(tag_send, sizeof(int)*max_nsend, "FixPIMD:tag_send"); buf_send = (double*) memory->srealloc(buf_send, sizeof(double)*max_nsend*3, "FixPIMD:x_send"); } - - // send tags - - MPI_Sendrecv( atom->tag, nlocal, MPI_INT, plan_send[iplan], 0, + + // send tags + + MPI_Sendrecv( atom->tag, nlocal, MPI_INT, plan_send[iplan], 0, tag_send, nsend, MPI_INT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE); // wrap positions - + double *wrap_ptr = buf_send; int ncpy = sizeof(double)*3; - + for(int i=0; i<nsend; i++) { int index = atom->map(tag_send[i]); @@ -658,27 +658,27 @@ void FixPIMD::comm_exec(double **ptr) if(index<0) { char error_line[256]; - + sprintf(error_line, "Atom " TAGINT_FORMAT " is missing at world [%d] " "rank [%d] required by rank [%d] (" TAGINT_FORMAT ", " TAGINT_FORMAT ", " TAGINT_FORMAT ").\n",tag_send[i], universe->iworld, comm->me, plan_recv[iplan], atom->tag[0], atom->tag[1], atom->tag[2]); - + error->universe_one(FLERR,error_line); } - + memcpy(wrap_ptr, ptr[index], ncpy); wrap_ptr += 3; } - - // sendrecv x - - MPI_Sendrecv( buf_send, nsend*3, MPI_DOUBLE, plan_recv[iplan], 0, + + // sendrecv x + + MPI_Sendrecv( buf_send, nsend*3, MPI_DOUBLE, plan_recv[iplan], 0, buf_recv, nlocal*3, MPI_DOUBLE, plan_send[iplan], 0, universe->uworld, MPI_STATUS_IGNORE); - + // copy x - + memcpy(buf_beads[mode_index[iplan]], buf_recv, sizeof(double)*nlocal*3); } } @@ -691,14 +691,14 @@ int FixPIMD::pack_forward_comm(int n, int *list, double *buf, int i,j,m; m = 0; - + for (i = 0; i < n; i++) { j = list[i]; buf[m++] = comm_ptr[j][0]; buf[m++] = comm_ptr[j][1]; buf[m++] = comm_ptr[j][2]; } - + return m; } @@ -736,10 +736,10 @@ void FixPIMD::grow_arrays(int nmax) int count = nmax*3; memory->grow(array_atom, nmax, size_peratom_cols, "FixPIMD::array_atom"); - memory->grow(nhc_eta, count, nhc_nchain, "FixPIMD::nh_eta"); - memory->grow(nhc_eta_dot, count, nhc_nchain+1, "FixPIMD::nh_eta_dot"); + memory->grow(nhc_eta, count, nhc_nchain, "FixPIMD::nh_eta"); + memory->grow(nhc_eta_dot, count, nhc_nchain+1, "FixPIMD::nh_eta_dot"); memory->grow(nhc_eta_dotdot, count, nhc_nchain, "FixPIMD::nh_eta_dotdot"); - memory->grow(nhc_eta_mass, count, nhc_nchain, "FixPIMD::nh_eta_mass"); + memory->grow(nhc_eta_mass, count, nhc_nchain, "FixPIMD::nh_eta_mass"); } /* ---------------------------------------------------------------------- */ @@ -748,7 +748,7 @@ void FixPIMD::copy_arrays(int i, int j, int delflag) { int i_pos = i*3; int j_pos = j*3; - + memcpy(nhc_eta [j_pos], nhc_eta [i_pos], nhc_size_one_1); memcpy(nhc_eta_dot [j_pos], nhc_eta_dot [i_pos], nhc_size_one_2); memcpy(nhc_eta_dotdot[j_pos], nhc_eta_dotdot[i_pos], nhc_size_one_1); @@ -759,14 +759,14 @@ void FixPIMD::copy_arrays(int i, int j, int delflag) int FixPIMD::pack_exchange(int i, double *buf) { - int offset=0; + int offset=0; int pos = i * 3; - + memcpy(buf+offset, nhc_eta[pos], nhc_size_one_1); offset += nhc_offset_one_1; memcpy(buf+offset, nhc_eta_dot[pos], nhc_size_one_2); offset += nhc_offset_one_2; memcpy(buf+offset, nhc_eta_dotdot[pos], nhc_size_one_1); offset += nhc_offset_one_1; memcpy(buf+offset, nhc_eta_mass[pos], nhc_size_one_1); offset += nhc_offset_one_1; - + return size_peratom_cols; } @@ -776,12 +776,12 @@ int FixPIMD::unpack_exchange(int nlocal, double *buf) { int offset=0; int pos = nlocal*3; - + memcpy(nhc_eta[pos], buf+offset, nhc_size_one_1); offset += nhc_offset_one_1; memcpy(nhc_eta_dot[pos], buf+offset, nhc_size_one_2); offset += nhc_offset_one_2; memcpy(nhc_eta_dotdot[pos], buf+offset, nhc_size_one_1); offset += nhc_offset_one_1; memcpy(nhc_eta_mass[pos], buf+offset, nhc_size_one_1); offset += nhc_offset_one_1; - + return size_peratom_cols; } @@ -797,8 +797,8 @@ int FixPIMD::pack_restart(int i, double *buf) memcpy(buf+offset, nhc_eta_dot[pos], nhc_size_one_2); offset += nhc_offset_one_2; memcpy(buf+offset, nhc_eta_dotdot[pos], nhc_size_one_1); offset += nhc_offset_one_1; memcpy(buf+offset, nhc_eta_mass[pos], nhc_size_one_1); offset += nhc_offset_one_1; - - return size_peratom_cols+1; + + return size_peratom_cols+1; } /* ---------------------------------------------------------------------- */ @@ -808,18 +808,18 @@ void FixPIMD::unpack_restart(int nlocal, int nth) double **extra = atom->extra; // skip to Nth set of extra values - + int m = 0; for (int i=0; i<nth; i++) m += static_cast<int> (extra[nlocal][m]); m++; - + int pos = nlocal * 3; - + memcpy(nhc_eta[pos], extra[nlocal]+m, nhc_size_one_1); m += nhc_offset_one_1; memcpy(nhc_eta_dot[pos], extra[nlocal]+m, nhc_size_one_2); m += nhc_offset_one_2; memcpy(nhc_eta_dotdot[pos], extra[nlocal]+m, nhc_size_one_1); m += nhc_offset_one_1; memcpy(nhc_eta_mass[pos], extra[nlocal]+m, nhc_size_one_1); m += nhc_offset_one_1; - + nhc_ready = true; } @@ -840,7 +840,7 @@ int FixPIMD::size_restart(int nlocal) /* ---------------------------------------------------------------------- */ double FixPIMD::compute_vector(int n) -{ +{ if(n==0) { return spring_energy; } if(n==1) { return t_sys; } return 0.0; diff --git a/src/USER-MISC/fix_pimd.h b/src/USER-MISC/fix_pimd.h index 37ea652dfe4c5ba9c5046e0091ab98967009254c..411fa42c817a741e93e08f25d0f2b428dac1636d 100644 --- a/src/USER-MISC/fix_pimd.h +++ b/src/USER-MISC/fix_pimd.h @@ -27,15 +27,15 @@ namespace LAMMPS_NS { class FixPIMD : public Fix { public: FixPIMD(class LAMMPS *, int, char **); - + int setmask(); - + void init(); void setup(int); void post_force(int); void initial_integrate(int); void final_integrate(); - + double memory_usage(); void grow_arrays(int); void copy_arrays(int,int,int); @@ -46,63 +46,63 @@ class FixPIMD : public Fix { int maxsize_restart(); int size_restart(int); double compute_vector(int); - + int pack_forward_comm(int, int*, double *, int, int*); void unpack_forward_comm(int, int, double *); - + int method; int np; double inverse_np; - + /* ring-polymer model */ - + double omega_np, fbond, spring_energy, sp; int x_last, x_next; - + void spring_force(); - + /* fictious mass */ - + double fmass, *mass; - + /* inter-partition communication */ - + int max_nsend; int* tag_send; double *buf_send; - + int max_nlocal; double *buf_recv, **buf_beads; - + int size_plan; int *plan_send, *plan_recv; double **comm_ptr; - + void comm_init(); void comm_exec(double **); - + /* normal-mode operations */ - + double *lam, **M_x2xp, **M_xp2x, **M_f2fp, **M_fp2f; int *mode_index; void nmpimd_init(); void nmpimd_fill(double**); void nmpimd_transform(double**, double**, double*); - + /* Nose-hoover chain integration */ - + int nhc_offset_one_1, nhc_offset_one_2; int nhc_size_one_1, nhc_size_one_2; int nhc_nchain; bool nhc_ready; double nhc_temp, dtv, dtf, t_sys; - + double **nhc_eta; /* coordinates of NH chains for ring-polymer beads */ double **nhc_eta_dot; /* velocities of NH chains */ double **nhc_eta_dotdot; /* acceleration of NH chains */ double **nhc_eta_mass; /* mass of NH chains */ - + void nhc_init(); void nhc_update_v(); void nhc_update_x(); diff --git a/src/USER-MISC/fix_smd.cpp b/src/USER-MISC/fix_smd.cpp index d8b4f1b9fb3cbc09a2ab5fc7874d3666043a9c71..3f6ca3f58a053d1c6830231459ba7f1b7c57bb1c 100644 --- a/src/USER-MISC/fix_smd.cpp +++ b/src/USER-MISC/fix_smd.cpp @@ -16,9 +16,9 @@ based on fix spring by: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_smd.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp index 08224d29508510cbfe79c871b0c0fcccca3ff771..fb4bd4e5ab4bd6e98e4fd838d0c9db6dafa3a2fc 100644 --- a/src/USER-MISC/fix_srp.cpp +++ b/src/USER-MISC/fix_srp.cpp @@ -15,8 +15,8 @@ Contributing authors: Timothy Sirk (ARL), Pieter in't Veld (BASF) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_srp.h" #include "atom.h" #include "force.h" @@ -49,22 +49,22 @@ FixSRP::FixSRP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // per-atom array width 2 peratom_flag = 1; - size_peratom_cols = 2; + size_peratom_cols = 2; - // initial allocation of atom-based array + // initial allocation of atom-based array // register with Atom class array = NULL; - grow_arrays(atom->nmax); + grow_arrays(atom->nmax); - // extends pack_exchange() + // extends pack_exchange() atom->add_callback(0); atom->add_callback(1); // restart - atom->add_callback(2); + atom->add_callback(2); - // zero - for (int i = 0; i < atom->nmax; i++) - for (int m = 0; m < 3; m++) - array[i][m] = 0.0; + // zero + for (int i = 0; i < atom->nmax; i++) + for (int m = 0; m < 3; m++) + array[i][m] = 0.0; // assume setup of fix is needed to insert particles // is true if reading from datafile @@ -72,7 +72,7 @@ FixSRP::FixSRP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // might be true if reading from restart // a restart file written during the run has bond particles as per atom data // a restart file written after the run does not have bond particles - setup = 1; + setup = 1; } /* ---------------------------------------------------------------------- */ @@ -106,7 +106,7 @@ void FixSRP::init() error->all(FLERR,"Cannot use pair srp without pair_style hybrid"); // the highest numbered atom type should be reserved for bond particles (bptype) - // set bptype, unless it will be read from restart + // set bptype, unless it will be read from restart if(!restart_reset) bptype = atom->ntypes; // check if bptype is already in use @@ -118,24 +118,24 @@ void FixSRP::init() if(!restart_reset) error->all(FLERR,"Fix SRP requires an extra atom type"); else - setup = 0; + setup = 0; } - + // setup neigh exclusions for diff atom types // bond particles do not interact with other types // type bptype only interacts with itself char* arg1[4]; - arg1[0] = (char *) "exclude"; - arg1[1] = (char *) "type"; + arg1[0] = (char *) "exclude"; + arg1[1] = (char *) "type"; char c0[20]; char c1[20]; for(int z = 1; z < bptype; z++) { sprintf(c0, "%d", z); - arg1[2] = c0; + arg1[2] = c0; sprintf(c1, "%d", bptype); - arg1[3] = c1; + arg1[3] = c1; neighbor->modify_params(4, arg1); } } @@ -192,19 +192,19 @@ void FixSRP::setup_pre_force(int zz) xone[1] = (xold[i][1] + xold[j][1])*0.5; xone[2] = (xold[i][2] + xold[j][2])*0.5; - // record longest bond + // record longest bond // this used to set ghost cutoff delx = xold[j][0] - xold[i][0]; dely = xold[j][1] - xold[i][1]; delz = xold[j][2] - xold[i][2]; rsq = delx*delx + dely*dely + delz*delz; - if(rsq > rsqold) rsqold = rsq; + if(rsq > rsqold) rsqold = rsq; // make one particle for each bond // i is local // if newton bond, always make particle // if j is local, always make particle - // if j is ghost, decide from tag + // if j is ghost, decide from tag if( force->newton_bond || j < nlocal || tagold[i] > tagold[j] ){ atom->natoms += 1; @@ -246,7 +246,7 @@ void FixSRP::setup_pre_force(int zz) // ghost atoms must be present for bonds on edge of neighbor cutoff // extend cutghost slightly more than half of the longest bond MPI_Allreduce(&rsqold,&rsqmax,1,MPI_DOUBLE,MPI_MAX,world); - rmax = sqrt(rsqmax); + rmax = sqrt(rsqmax); double cutneighmax_srp = neighbor->cutneighmax + 0.51*rmax; // find smallest cutghost @@ -262,7 +262,7 @@ void FixSRP::setup_pre_force(int zz) sprintf(str, "Extending ghost comm cutoff. New %f, old %f.", cutneighmax_srp, cutghostmin); error->message(FLERR,str); } - // cutghost updated by comm->setup + // cutghost updated by comm->setup comm->cutghostuser = cutneighmax_srp; } @@ -270,7 +270,7 @@ void FixSRP::setup_pre_force(int zz) // move owned to new procs // get ghosts // build neigh lists again - + // if triclinic, lambda coords needed for pbc, exchange, borders if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->pbc(); @@ -290,7 +290,7 @@ void FixSRP::setup_pre_force(int zz) // new atom counts nlocal = atom->nlocal; nall = atom->nlocal + atom->nghost; - // zero all forces + // zero all forces for(int i = 0; i < nall; i++) for(int n = 0; n < 3; n++) atom->f[i][n] = 0.0; @@ -308,7 +308,7 @@ void FixSRP::setup_pre_force(int zz) void FixSRP::pre_exchange() { - // update ghosts + // update ghosts comm->forward_comm(); // reassign bond particle coordinates to midpoint of bonds @@ -328,7 +328,7 @@ void FixSRP::pre_exchange() if(j < 0) error->all(FLERR,"Fix SRP failed to map atom"); j = domain->closest_image(ii,j); - // position of bond particle ii + // position of bond particle ii atom->x[ii][0] = (x[i][0] + x[j][0])*0.5; atom->x[ii][1] = (x[i][1] + x[j][1])*0.5; atom->x[ii][2] = (x[i][2] + x[j][2])*0.5; @@ -374,7 +374,7 @@ void FixSRP::copy_arrays(int i, int j, int delflag) void FixSRP::set_arrays(int i) { array[i][0] = -1; - array[i][1] = -1; + array[i][1] = -1; } /* ---------------------------------------------------------------------- @@ -438,9 +438,9 @@ int FixSRP::unpack_border(int n, int first, double *buf) void FixSRP::post_run() { // all bond particles are removed after each run - // useful for write_data and write_restart commands + // useful for write_data and write_restart commands // since those commands occur between runs - + bigint natoms_previous = atom->natoms; int nlocal = atom->nlocal; int* dlist; @@ -508,7 +508,7 @@ void FixSRP::post_run() comm->borders(); // change back to box coordinates if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); -} +} /* ---------------------------------------------------------------------- pack values in local atom-based arrays for restart file @@ -518,7 +518,7 @@ int FixSRP::pack_restart(int i, double *buf) { int m = 0; buf[m++] = 3; - buf[m++] = array[i][0]; + buf[m++] = array[i][0]; buf[m++] = array[i][1]; return m; } @@ -527,17 +527,17 @@ int FixSRP::pack_restart(int i, double *buf) unpack values from atom->extra array to restart the fix ------------------------------------------------------------------------- */ -void FixSRP::unpack_restart(int nlocal, int nth) +void FixSRP::unpack_restart(int nlocal, int nth) { double **extra = atom->extra; // skip to Nth set of extra values - int m = 0; + int m = 0; for (int i = 0; i < nth; i++){ m += static_cast<int> (extra[nlocal][m]); } - m++; + m++; array[nlocal][0] = extra[nlocal][m++]; array[nlocal][1] = extra[nlocal][m++]; @@ -561,7 +561,7 @@ int FixSRP::size_restart(int nlocal) } /* ---------------------------------------------------------------------- - pack global state of Fix + pack global state of Fix ------------------------------------------------------------------------- */ void FixSRP::write_restart(FILE *fp) diff --git a/src/USER-MISC/fix_srp.h b/src/USER-MISC/fix_srp.h index 859b0020b06f75597ee4f29636ed34061c9c0aad..5315d506d7d446c5d53daec2240f8976d2ab3a08 100644 --- a/src/USER-MISC/fix_srp.h +++ b/src/USER-MISC/fix_srp.h @@ -20,7 +20,7 @@ FixStyle(SRP,FixSRP) #ifndef LMP_FIX_SRP_H #define LMP_FIX_SRP_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { @@ -43,7 +43,7 @@ class FixSRP : public Fix { int unpack_exchange(int, double *); int pack_border(int, int *, double *); int unpack_border(int, int, double *); - void post_run(); + void post_run(); int pack_restart(int, double*); void unpack_restart(int, int); diff --git a/src/USER-MISC/fix_ti_rs.cpp b/src/USER-MISC/fix_ti_rs.cpp index d5036eb52029acef055bb3ae14988c0a77d0bdc1..1090fc02d05bf894a5ef12eb0dc40f2f537ed0d1 100755 --- a/src/USER-MISC/fix_ti_rs.cpp +++ b/src/USER-MISC/fix_ti_rs.cpp @@ -12,14 +12,14 @@ ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- - Contributing authors: + Contributing authors: Rodrigo Freitas (Unicamp/Brazil) - rodrigohb@gmail.com Maurice de Koning (Unicamp/Brazil) - dekoning@ifi.unicamp.br ------------------------------------------------------------------------- */ - -#include "stdlib.h" -#include "string.h" -#include "math.h" + +#include <stdlib.h> +#include <string.h> +#include <math.h> #include "fix_ti_rs.h" #include "atom.h" #include "update.h" @@ -34,7 +34,7 @@ using namespace FixConst; // Class constructor initialize all variables. -FixTIRS::FixTIRS(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) +FixTIRS::FixTIRS(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { // Checking the input information. if (narg < 7 || narg > 9) error->all(FLERR,"Illegal fix ti/rs command"); @@ -48,10 +48,10 @@ FixTIRS::FixTIRS(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // Time variables. t_switch = force->bnumeric(FLERR,arg[5]); t_equil = force->bnumeric(FLERR,arg[6]); - t0 = update->ntimestep; + t0 = update->ntimestep; if (t_switch <= 0) error->all(FLERR,"Illegal fix ti/rs command"); if (t_equil <= 0) error->all(FLERR,"Illegal fix ti/rs command"); - + // Coupling parameter limits and initialization. l_initial = force->numeric(FLERR,arg[3]); l_final = force->numeric(FLERR,arg[4]); @@ -68,7 +68,7 @@ FixTIRS::FixTIRS(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) /* ---------------------------------------------------------------------- */ -FixTIRS::~FixTIRS() +FixTIRS::~FixTIRS() { // unregister callbacks to this fix from Atom class atom->delete_callback(id,0); @@ -77,7 +77,7 @@ FixTIRS::~FixTIRS() /* ---------------------------------------------------------------------- */ -int FixTIRS::setmask() +int FixTIRS::setmask() { int mask = 0; mask |= INITIAL_INTEGRATE; @@ -95,7 +95,7 @@ void FixTIRS::init() /* ---------------------------------------------------------------------- */ -void FixTIRS::setup(int vflag) +void FixTIRS::setup(int vflag) { if (strstr(update->integrate_style,"verlet")) post_force(vflag); @@ -116,7 +116,7 @@ void FixTIRS::min_setup(int vflag) /* ---------------------------------------------------------------------- */ -void FixTIRS::post_force(int vflag) +void FixTIRS::post_force(int vflag) { int *mask = atom->mask; @@ -126,7 +126,7 @@ void FixTIRS::post_force(int vflag) // Scaling forces. for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - f[i][0] = lambda * f[i][0]; + f[i][0] = lambda * f[i][0]; f[i][1] = lambda * f[i][1]; f[i][2] = lambda * f[i][2]; } @@ -149,7 +149,7 @@ void FixTIRS::min_post_force(int vflag) /* ---------------------------------------------------------------------- */ -void FixTIRS::initial_integrate(int vflag) +void FixTIRS::initial_integrate(int vflag) { // Update the coupling parameter value. const bigint t = update->ntimestep - (t0+t_equil); @@ -181,7 +181,7 @@ double FixTIRS::switch_func(double t) { if (sf == 2) return l_initial / (1 + t * (l_initial/l_final - 1)); if (sf == 3) return l_initial / (1 + log2(1+t) * (l_initial/l_final - 1)); - + // Default option is sf = 1. return l_initial + (l_final - l_initial) * t; } diff --git a/src/USER-MISC/fix_ti_rs.h b/src/USER-MISC/fix_ti_rs.h index 6b5124f711dfb6b0851e3f9f530a4fda851e64f9..0aee21a872d974772071d3dde0acfb98dc2ed1e9 100755 --- a/src/USER-MISC/fix_ti_rs.h +++ b/src/USER-MISC/fix_ti_rs.h @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: + Contributing authors: Rodrigo Freitas (Unicamp/Brazil) - rodrigohb@gmail.com Maurice de Koning (Unicamp/Brazil) - dekoning@ifi.unicamp.br ------------------------------------------------------------------------- */ diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index 3d10312720cea39b75e9c9d69bc1e66a41857b51..edb6a7b2caedf80fa156e712dc5d1cca007d193f 100755 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -12,13 +12,13 @@ ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- - Contributing authors: + Contributing authors: Rodrigo Freitas (Unicamp/Brazil) - rodrigohb@gmail.com Maurice de Koning (Unicamp/Brazil) - dekoning@ifi.unicamp.br ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_ti_spring.h" #include "atom.h" #include "update.h" @@ -28,13 +28,13 @@ #include "error.h" #include "force.h" -using namespace LAMMPS_NS; -using namespace FixConst; +using namespace LAMMPS_NS; +using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) +FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) { if (narg < 6 || narg > 8) error->all(FLERR,"Illegal fix ti/spring command"); @@ -84,11 +84,11 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : if (narg > 6) { if (strcmp(arg[6], "function") == 0) sf = force->inumeric(FLERR,arg[7]); else error->all(FLERR,"Illegal fix ti/spring switching function"); - if ((sf!=1) && (sf!=2)) + if ((sf!=1) && (sf!=2)) error->all(FLERR,"Illegal fix ti/spring switching function"); } - lambda = switch_func(0); - dlambda = dswitch_func(0); + lambda = switch_func(0); + dlambda = dswitch_func(0); espring = 0.0; } @@ -196,8 +196,8 @@ void FixTISpring::min_post_force(int vflag) /* ---------------------------------------------------------------------- */ -void FixTISpring::initial_integrate(int vflag) -{ +void FixTISpring::initial_integrate(int vflag) +{ // Update the coupling parameter value. const bigint t = update->ntimestep - (t0+t_equil); const double r_switch = 1.0/t_switch; @@ -211,7 +211,7 @@ void FixTISpring::initial_integrate(int vflag) lambda = switch_func(1.0 - (t - t_switch - t_equil)*r_switch); dlambda = - dswitch_func(1.0 - (t - t_switch - t_equil)*r_switch); } -} +} /* ---------------------------------------------------------------------- energy of stretched springs @@ -311,11 +311,11 @@ void FixTISpring::unpack_restart(int nlocal, int nth) double **extra = atom->extra; // skip to Nth set of extra values - + int m = 0; for (int i = 0; i < nth; i++) m += static_cast<int> (extra[nlocal][m]); m++; - + xoriginal[nlocal][0] = extra[nlocal][m++]; xoriginal[nlocal][1] = extra[nlocal][m++]; xoriginal[nlocal][2] = extra[nlocal][m++]; @@ -343,7 +343,7 @@ int FixTISpring::size_restart(int nlocal) Switching function. ------------------------------------------------------------------------- */ -double FixTISpring::switch_func(double t) +double FixTISpring::switch_func(double t) { if (sf == 1) return t; @@ -356,7 +356,7 @@ double FixTISpring::switch_func(double t) Switching function derivative. ------------------------------------------------------------------------- */ -double FixTISpring::dswitch_func(double t) +double FixTISpring::dswitch_func(double t) { if(sf == 1) return 1.0/t_switch; diff --git a/src/USER-MISC/fix_ti_spring.h b/src/USER-MISC/fix_ti_spring.h index a5ff1fb677f43b39f34777d983751c129005fdbc..bce3421627f5af0276edc9b762953c90a5f0fc97 100755 --- a/src/USER-MISC/fix_ti_spring.h +++ b/src/USER-MISC/fix_ti_spring.h @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: + Contributing authors: Rodrigo Freitas (Unicamp/Brazil) - rodrigohb@gmail.com Maurice de Koning (Unicamp/Brazil) - dekoning@ifi.unicamp.br ------------------------------------------------------------------------- */ @@ -44,7 +44,7 @@ class FixTISpring : public Fix { void initial_integrate(int); double compute_scalar(); double compute_vector(int); - + double memory_usage(); void grow_arrays(int); void copy_arrays(int, int, int); diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp index 3a6aafe700bffa9478c85a525525a586c7444613..f54c21532ba7b041bd9721d79c2a0a6e422b8b74 100644 --- a/src/USER-MISC/fix_ttm_mod.cpp +++ b/src/USER-MISC/fix_ttm_mod.cpp @@ -18,10 +18,10 @@ ------------------------------------------------------------------------- */ #include "lmptype.h" -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_ttm_mod.h" #include "atom.h" #include "force.h" @@ -69,7 +69,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (lmp->citeme) lmp->citeme->add(cite_fix_ttm_mod); - + if (narg < 9) error->all(FLERR,"Illegal fix ttm/mod command"); vector_flag = 1; size_vector = 2; @@ -611,7 +611,7 @@ void FixTTMMod::end_of_step() int num_inner_timesteps = 1; double inner_dt = update->dt; double stability_criterion = 0.0; - + for (int ixnode = 0; ixnode < nxnodes; ixnode++) for (int iynode = 0; iynode < nynodes; iynode++) for (int iznode = 0; iznode < nznodes; iznode++) @@ -623,7 +623,7 @@ void FixTTMMod::end_of_step() for (int iznode = 0; iznode < nznodes; iznode++) T_electron[ixnode][iynode][iznode] = T_electron_first[ixnode][iynode][iznode]; - + stability_criterion = 1.0 - 2.0*inner_dt/el_specific_heat * (el_thermal_conductivity*(1.0/dx/dx + 1.0/dy/dy + 1.0/dz/dz)); @@ -705,7 +705,7 @@ void FixTTMMod::end_of_step() T_electron_old[ixnode][iynode][iznode]; if ((T_electron[ixnode][iynode][iznode] > 0.0) && (T_electron[ixnode][iynode][iznode] < electron_temperature_min)) T_electron[ixnode][iynode][iznode] = T_electron[ixnode][iynode][iznode] + 0.5*(electron_temperature_min - T_electron[ixnode][iynode][iznode]); - + if (el_properties(T_electron[ixnode][iynode][iznode]).el_thermal_conductivity > el_thermal_conductivity) el_thermal_conductivity = el_properties(T_electron[ixnode][iynode][iznode]).el_thermal_conductivity; if ((T_electron[ixnode][iynode][iznode] > 0.0) && (el_properties(T_electron[ixnode][iynode][iznode]).el_heat_capacity < el_specific_heat)) @@ -715,7 +715,7 @@ void FixTTMMod::end_of_step() stability_criterion = 1.0 - 2.0*inner_dt/el_specific_heat * (el_thermal_conductivity*(1.0/dx/dx + 1.0/dy/dy + 1.0/dz/dz)); - + } while (stability_criterion < 0.0); // output nodal temperatures for current timestep if ((nfileevery) && !(update->ntimestep % nfileevery)) { diff --git a/src/USER-MISC/improper_cossq.cpp b/src/USER-MISC/improper_cossq.cpp index 8eabd57d61c4fb1eb17646a30a5de3c226359060..77033381e98a3ab39bfbfb7fb5ea0a52b8728507 100644 --- a/src/USER-MISC/improper_cossq.cpp +++ b/src/USER-MISC/improper_cossq.cpp @@ -16,9 +16,9 @@ gvog@chemeng.ntua.gr ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "improper_cossq.h" #include "atom.h" #include "comm.h" @@ -109,8 +109,8 @@ void ImproperCossq::compute(int eflag, int vflag) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/USER-MISC/improper_cossq.h b/src/USER-MISC/improper_cossq.h index 3eca800dbe4d9bfaaecbbd75e3269480a0d618eb..266e31797781ab10cc4cd4ba0f28f3dc7f25fab2 100644 --- a/src/USER-MISC/improper_cossq.h +++ b/src/USER-MISC/improper_cossq.h @@ -20,7 +20,7 @@ ImproperStyle(cossq,ImproperCossq) #ifndef LMP_IMPROPER_COSSQ_H #define LMP_IMPROPER_COSSQ_H -#include "stdio.h" +#include <stdio.h> #include "improper.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/improper_fourier.cpp b/src/USER-MISC/improper_fourier.cpp index f3fe065d6ed6d81f3e2d91b003de1b2865046016..ea5f78662e56d5cd5725899470545c64fb87222e 100644 --- a/src/USER-MISC/improper_fourier.cpp +++ b/src/USER-MISC/improper_fourier.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ [ based on improper_umbrella.cpp Tod A Pascal (Caltech) ] ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "improper_fourier.h" #include "atom.h" #include "comm.h" @@ -92,18 +92,18 @@ void ImproperFourier::compute(int eflag, int vflag) vb3z = x[i4][2] - x[i1][2]; addone(i1,i2,i3,i4, type,evflag,eflag, - vb1x, vb1y, vb1z, - vb2x, vb2y, vb2z, + vb1x, vb1y, vb1z, + vb2x, vb2y, vb2z, vb3x, vb3y, vb3z); if ( all[type] ) { addone(i1,i4,i2,i3, type,evflag,eflag, vb3x, vb3y, vb3z, - vb1x, vb1y, vb1z, - vb2x, vb2y, vb2z); + vb1x, vb1y, vb1z, + vb2x, vb2y, vb2z); addone(i1,i3,i4,i2, type,evflag,eflag, - vb2x, vb2y, vb2z, + vb2x, vb2y, vb2z, vb3x, vb3y, vb3z, - vb1x, vb1y, vb1z); + vb1x, vb1y, vb1z); } } } @@ -156,8 +156,8 @@ void ImproperFourier::addone(const int &i1,const int &i2,const int &i3,const int MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Improper problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); @@ -308,7 +308,7 @@ void ImproperFourier::coeff(int narg, char **arg) } /* ---------------------------------------------------------------------- - proc 0 writes out coeffs to restart file + proc 0 writes out coeffs to restart file ------------------------------------------------------------------------- */ void ImproperFourier::write_restart(FILE *fp) @@ -321,7 +321,7 @@ void ImproperFourier::write_restart(FILE *fp) } /* ---------------------------------------------------------------------- - proc 0 reads coeffs from restart file, bcasts them + proc 0 reads coeffs from restart file, bcasts them ------------------------------------------------------------------------- */ void ImproperFourier::read_restart(FILE *fp) diff --git a/src/USER-MISC/improper_fourier.h b/src/USER-MISC/improper_fourier.h index 0d2a798c1f2d06fc9cfe9f3c5805d4377d58c1f4..903b9a12b652f50d0a3163c02934bb3982ae044e 100644 --- a/src/USER-MISC/improper_fourier.h +++ b/src/USER-MISC/improper_fourier.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -20,7 +20,7 @@ ImproperStyle(fourier,ImproperFourier) #ifndef LMP_IMPROPER_FOURIER_H #define LMP_IMPROPER_FOURIER_H -#include "stdio.h" +#include <stdio.h> #include "improper.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/improper_ring.cpp b/src/USER-MISC/improper_ring.cpp index 2d6f510446a3e6d62a4d6aa73c055ee0b2b78a90..4134b4b172449da5e49edee4c9d2e930daf83fa0 100644 --- a/src/USER-MISC/improper_ring.cpp +++ b/src/USER-MISC/improper_ring.cpp @@ -36,9 +36,9 @@ of j. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "improper_ring.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-MISC/improper_ring.h b/src/USER-MISC/improper_ring.h index a578e4d17e69f77c9304000b15d99b1fd4d3accd..cdb2907c6578de27620e41a4d7107c8a709b0fb2 100644 --- a/src/USER-MISC/improper_ring.h +++ b/src/USER-MISC/improper_ring.h @@ -20,7 +20,7 @@ ImproperStyle(ring,ImproperRing) #ifndef LMP_IMPROPER_RING_H #define LMP_IMPROPER_RING_H -#include "stdio.h" +#include <stdio.h> #include "improper.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/pair_cdeam.cpp b/src/USER-MISC/pair_cdeam.cpp index 672391190069a46f0c3af23503578cf8b140b3fc..91ef598de833bcadffdf60cc3dd490b2b0f6fbf1 100644 --- a/src/USER-MISC/pair_cdeam.cpp +++ b/src/USER-MISC/pair_cdeam.cpp @@ -17,10 +17,10 @@ Germany Department of Materials Science ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_cdeam.h" #include "atom.h" #include "force.h" @@ -494,7 +494,7 @@ void PairCDEAM::read_h_coeff(char *filename) /* ---------------------------------------------------------------------- */ -int PairCDEAM::pack_forward_comm(int n, int *list, double *buf, +int PairCDEAM::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/USER-MISC/pair_coul_diel.cpp b/src/USER-MISC/pair_coul_diel.cpp index a846aa53c647d38204c9d7fe750194334f190beb..1913e48b67d705c2eba026725e7637aa41b6039e 100644 --- a/src/USER-MISC/pair_coul_diel.cpp +++ b/src/USER-MISC/pair_coul_diel.cpp @@ -14,10 +14,10 @@ Contributiong authors: Arben Jusufi, Axel Kohlmeyer (Temple U.) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_diel.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index c6eceb0caca7b9947206d2c29df8f45db3bb9448..2994da26831557073a9a80a4ac45e43fc5dcc890 100755 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -21,11 +21,11 @@ Phys. Rev. B 58, 2539 (1998) ------------------------------------------------------------------------- */ -#include "math.h" -#include "float.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <float.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_edip.h" #include "atom.h" #include "neighbor.h" diff --git a/src/USER-MISC/pair_gauss_cut.cpp b/src/USER-MISC/pair_gauss_cut.cpp index e277f9865d704e25a799b58a59e1f8066344db4e..0df6734849cb8349f8b74bf45f3187ba199301e6 100644 --- a/src/USER-MISC/pair_gauss_cut.cpp +++ b/src/USER-MISC/pair_gauss_cut.cpp @@ -15,10 +15,10 @@ Contributing authors: Arben Jusufi, Axel Kohlmeyer (Temple U.) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_gauss_cut.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-MISC/pair_list.cpp b/src/USER-MISC/pair_list.cpp index 2895b8216b17fd8b1aa3d0ce740cae9251ada644..5f053926318d771715730ca0a6a5962ed6aa17f8 100644 --- a/src/USER-MISC/pair_list.cpp +++ b/src/USER-MISC/pair_list.cpp @@ -80,7 +80,7 @@ PairList::~PairList() void PairList::compute(int eflag, int vflag) { if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = vflag_fdotr = eflag_global = + else evflag = vflag_fdotr = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; const int nlocal = atom->nlocal; @@ -138,7 +138,7 @@ void PairList::compute(int eflag, int vflag) const double r = sqrt(rsq); const double dr = par.parm.morse.r0 - r; const double dexp = exp(par.parm.morse.alpha * dr); - fpair = 2.0*par.parm.morse.d0*par.parm.morse.alpha + fpair = 2.0*par.parm.morse.d0*par.parm.morse.alpha * (dexp*dexp - dexp) / r; if (eflag_either) @@ -148,11 +148,11 @@ void PairList::compute(int eflag, int vflag) const double r6inv = r2inv*r2inv*r2inv; const double sig6 = mypow(par.parm.lj126.sigma,6); - fpair = 24.0*par.parm.lj126.epsilon*r6inv + fpair = 24.0*par.parm.lj126.epsilon*r6inv * (2.0*sig6*sig6*r6inv - sig6) * r2inv; if (eflag_either) - epair = 4.0*par.parm.lj126.epsilon*r6inv + epair = 4.0*par.parm.lj126.epsilon*r6inv * (sig6*sig6*r6inv - sig6) - par.offset; } @@ -169,7 +169,7 @@ void PairList::compute(int eflag, int vflag) } if (evflag) ev_tally(i,j,nlocal,newton_pair,epair,0.0,fpair,dx,dy,dz); - } + } } if (vflag_fdotr) virial_fdotr_compute(); @@ -236,7 +236,7 @@ void PairList::settings(int narg, char **arg) // skip empty lines if (!ptr) continue; - + // skip comment lines starting with # if (*ptr == '#') continue; diff --git a/src/USER-MISC/pair_list.h b/src/USER-MISC/pair_list.h index 4059b0ef29e895d9bab9fb8ab70d4f66bf2f1ec0..4802194158f54f5b3225b3ff678bd43bf578ed3f 100644 --- a/src/USER-MISC/pair_list.h +++ b/src/USER-MISC/pair_list.h @@ -46,7 +46,7 @@ class PairList : public Pair { struct morse_p { double d0, alpha, r0; }; struct lj126_p { double epsilon, sigma; }; - union parm_u { + union parm_u { struct harm_p harm; struct morse_p morse; struct lj126_p lj126; @@ -57,7 +57,7 @@ class PairList : public Pair { double cutsq; // cutoff**2 for this pair double offset; // energy offset union parm_u parm; // parameters for style - } list_parm_t; + } list_parm_t; protected: double cut_global; // global cutoff distance @@ -77,7 +77,7 @@ class PairList : public Pair { E: Not all pairs processed in pair_style list Not all interacting pairs for which coefficients were found. This can be intentional -and then you need to set the 'nocheck' option. If not, it usually means that the +and then you need to set the 'nocheck' option. If not, it usually means that the communication cutoff is too small. This can be ameliorated by either increasing the cutoff in the pair_style command or the communication cutoff. diff --git a/src/USER-MISC/pair_lj_sf.cpp b/src/USER-MISC/pair_lj_sf.cpp index 6138d0b84739749560c0c5d6f62156401a329b3e..69a7efcfde4d49bee3241e2b0dda5c91b4ea2537 100644 --- a/src/USER-MISC/pair_lj_sf.cpp +++ b/src/USER-MISC/pair_lj_sf.cpp @@ -15,9 +15,9 @@ Contributing author: Laurent Joly (U Lyon), ljoly.ulyon@gmail.com ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_sf.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp index 58d7f4d61d2530d766fba4dbdf9e0c6d215b2c0a..48e23d583364e43570a5e6a8449684750ff81c2e 100755 --- a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp +++ b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp @@ -15,8 +15,8 @@ Contributing author: Mario Orsi (U Southampton), orsimario@gmail.com ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_lj_sf_dipole_sf.h" #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "memory.h" #include "error.h" #include "update.h" -#include "string.h" +#include <string.h> using namespace LAMMPS_NS; diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 26cd70509df1c3d51fd1339b283d0b8d4ff63e09..cb6ddbd2aef59e27f1a89778e248063d0ec48ef5 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -25,10 +25,10 @@ * 24-Sep-11 - AS: Adapted code to new interface of Error::one() function. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_meam_spline.h" #include "atom.h" #include "force.h" @@ -526,7 +526,7 @@ double PairMEAMSpline::init_one(int i, int j) /* ---------------------------------------------------------------------- */ -int PairMEAMSpline::pack_forward_comm(int n, int *list, double *buf, +int PairMEAMSpline::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int* list_iter = list; diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 30613afab623cf98c9f851d1e0b8ff1db14a018c..8ae9a3b7d937669adfdb14f50d2456ac7341620d 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -23,10 +23,10 @@ * 01-Aug-12 - RER: First code version. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_meam_sw_spline.h" #include "atom.h" #include "force.h" @@ -562,7 +562,7 @@ double PairMEAMSWSpline::init_one(int i, int j) /* ---------------------------------------------------------------------- */ -int PairMEAMSWSpline::pack_forward_comm(int n, int *list, double *buf, +int PairMEAMSWSpline::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int* list_iter = list; @@ -735,16 +735,16 @@ void PairMEAMSWSpline::SplineFunction::writeGnuplot(const char* filename, const } /* ---------------------------------------------------------------------- - * Spline-based Modified Embedded Atom Method plus + * Spline-based Modified Embedded Atom Method plus * Stillinger-Weber (MEAM+SW) potential routine. * * Copyright (2012) Lawrence Livermore National Security, LLC. * Produced at the Lawrence Livermore National Laboratory. * Written by Robert E. Rudd (<robert.rudd@llnl.gov>). - * Based on the spline-based MEAM routine written by + * Based on the spline-based MEAM routine written by * Alexander Stukowski (<alex@stukowski.com>). * LLNL-CODE-588032 All rights reserved. - * + * * The spline-based MEAM+SW format was first devised and used to develop * potentials for bcc transition metals by Jeremy Nicklas, Michael Fellinger, * and Hyoungki Park at The Ohio State University. @@ -800,7 +800,7 @@ void PairMEAMSWSpline::SplineFunction::writeGnuplot(const char* filename, const * the Program is not restricted, and the output from the Program is covered * only if its contents constitute a work based on the Program (independent of * having been made by running the Program). Whether that is true depends on - * what the Program does. + * what the Program does. * * 1. You may copy and distribute verbatim copies of the Program's source * code as you receive it, in any medium, provided that you conspicuously and @@ -916,10 +916,10 @@ void PairMEAMSWSpline::SplineFunction::writeGnuplot(const char* filename, const * for enforcing compliance by third parties to this License. * * 7. If, as a consequence of a court judgment or allegation of patent - * infringement or for any other reason (not limited to patent - * issues), conditions are imposed on you (whether by court - * order, agreement or otherwise) that contradict the conditions - * of this License, they do not excuse you from the conditions + * infringement or for any other reason (not limited to patent + * issues), conditions are imposed on you (whether by court + * order, agreement or otherwise) that contradict the conditions + * of this License, they do not excuse you from the conditions * of this License. If you cannot distribute so as to satisfy * simultaneously your obligations under this License and any other pertinent * obligations, then as a consequence you may not distribute the Program at @@ -996,5 +996,5 @@ void PairMEAMSWSpline::SplineFunction::writeGnuplot(const char* filename, const * PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * END OF TERMS AND CONDITIONS + * END OF TERMS AND CONDITIONS ------------------------------------------------------------------------- */ diff --git a/src/USER-MISC/pair_meam_sw_spline.h b/src/USER-MISC/pair_meam_sw_spline.h index 383104df4b1eab17f66f615f9c3e6de04d8284fb..9398619b638eb542160cd97f16f273fa0aba610d 100644 --- a/src/USER-MISC/pair_meam_sw_spline.h +++ b/src/USER-MISC/pair_meam_sw_spline.h @@ -245,13 +245,13 @@ protected: #endif /* ---------------------------------------------------------------------- - * Spline-based Modified Embedded Atom Method plus + * Spline-based Modified Embedded Atom Method plus * Stillinger-Weber (MEAM+SW) potential routine. * * Copyright (2012) Lawrence Livermore National Security, LLC. * Produced at the Lawrence Livermore National Laboratory. * Written by Robert E. Rudd (<robert.rudd@llnl.gov>). - * Based on the spline MEAM routine written by Alexander Stukowski + * Based on the spline MEAM routine written by Alexander Stukowski * (<alex@stukowski.com>). * LLNL-CODE-588032 All rights reserved. * @@ -310,7 +310,7 @@ protected: * the Program is not restricted, and the output from the Program is covered * only if its contents constitute a work based on the Program (independent of * having been made by running the Program). Whether that is true depends on - * what the Program does. + * what the Program does. * * 1. You may copy and distribute verbatim copies of the Program's source * code as you receive it, in any medium, provided that you conspicuously and @@ -426,10 +426,10 @@ protected: * for enforcing compliance by third parties to this License. * * 7. If, as a consequence of a court judgment or allegation of patent - * infringement or for any other reason (not limited to patent - * issues), conditions are imposed on you (whether by court - * order, agreement or otherwise) that contradict the conditions - * of this License, they do not excuse you from the conditions + * infringement or for any other reason (not limited to patent + * issues), conditions are imposed on you (whether by court + * order, agreement or otherwise) that contradict the conditions + * of this License, they do not excuse you from the conditions * of this License. If you cannot distribute so as to satisfy * simultaneously your obligations under this License and any other pertinent * obligations, then as a consequence you may not distribute the Program at @@ -506,5 +506,5 @@ protected: * PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * END OF TERMS AND CONDITIONS + * END OF TERMS AND CONDITIONS ------------------------------------------------------------------------- */ diff --git a/src/USER-MISC/pair_srp.cpp b/src/USER-MISC/pair_srp.cpp index c79ef490d53b757f48d9a8623cec8b25fce65df3..e607c8e86f0143b437a03e9a6456436f3f913e62 100644 --- a/src/USER-MISC/pair_srp.cpp +++ b/src/USER-MISC/pair_srp.cpp @@ -10,7 +10,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ - + /* ---------------------------------------------------------------------- Contributing authors: Timothy Sirk (ARL), Pieter in't Veld (BASF) @@ -25,26 +25,26 @@ There is an example script for this package in examples/USER/srp. Please contact Timothy Sirk for questions (tim.sirk@us.army.mil). ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "pair_srp.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" -#include "domain.h" +#include <stdlib.h> +#include "pair_srp.h" +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "memory.h" +#include "error.h" +#include "domain.h" #include "modify.h" #include "fix.h" #include "fix_srp.h" #include "thermo.h" #include "output.h" -#include "string.h" +#include <string.h> #include "citeme.h" - -using namespace LAMMPS_NS; - + +using namespace LAMMPS_NS; + #define SMALL 1.0e-10 #define BIG 1e10 #define ONETWOBIT 0x40000000 @@ -65,10 +65,10 @@ static int srp_instance = 0; set size of pair comms in constructor ---------------------------------------------------------------------- */ -PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp) +PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp) { - writedata = 1; - + writedata = 1; + if (lmp->citeme) lmp->citeme->add(cite_srp); nextra = 1; @@ -77,8 +77,8 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp) fix_id[0] = '0' + srp_instance / 10; fix_id[1] = '0' + srp_instance % 10; ++srp_instance; -} - +} + /* ---------------------------------------------------------------------- allocate all arrays ------------------------------------------------------------------------- */ @@ -102,19 +102,19 @@ void PairSRP::allocate() maxcount = 0; } -/* ---------------------------------------------------------------------- - free - ------------------------------------------------------------------------- */ - -PairSRP::~PairSRP() -{ - if (allocated) - { - memory->destroy(setflag); - memory->destroy(cutsq); - memory->destroy(cut); - memory->destroy(a0); - memory->destroy(segment); +/* ---------------------------------------------------------------------- + free + ------------------------------------------------------------------------- */ + +PairSRP::~PairSRP() +{ + if (allocated) + { + memory->destroy(setflag); + memory->destroy(cutsq); + memory->destroy(cut); + memory->destroy(a0); + memory->destroy(segment); } // check nfix in case all fixes have already been deleted @@ -122,24 +122,24 @@ PairSRP::~PairSRP() free(fix_id); } -/* ---------------------------------------------------------------------- - compute bond-bond repulsions - ------------------------------------------------------------------------- */ - -void PairSRP::compute(int eflag, int vflag) +/* ---------------------------------------------------------------------- + compute bond-bond repulsions + ------------------------------------------------------------------------- */ + +void PairSRP::compute(int eflag, int vflag) { - // setup energy and virial - if (eflag || vflag) - ev_setup(eflag, vflag); - else - evflag = vflag_fdotr = 0; - - double **x = atom->x; - double **f = atom->f; - int nlocal = atom->nlocal; - int nall = nlocal + atom->nghost; - int i0, i1, j0, j1; + // setup energy and virial + if (eflag || vflag) + ev_setup(eflag, vflag); + else + evflag = vflag_fdotr = 0; + + double **x = atom->x; + double **f = atom->f; + int nlocal = atom->nlocal; + int nall = nlocal + atom->nghost; + int i0, i1, j0, j1; int i,j,ii,jj,inum,jnum; double dijsq, dij; @@ -155,8 +155,8 @@ void PairSRP::compute(int eflag, int vflag) double fx, fy, fz; evdwl = 0.0; - // mapping global to local for atoms inside bond particles - // exclude 1-2 neighs if requested + // mapping global to local for atoms inside bond particles + // exclude 1-2 neighs if requested if (neighbor->ago == 0){ remapBonds(nall); if(exclude) onetwoexclude(ilist, inum, jlist, numneigh, firstneigh); @@ -164,9 +164,9 @@ void PairSRP::compute(int eflag, int vflag) // this pair style only used with hybrid // due to exclusions - // each atom i is type bptype - // each neigh j is type bptype - + // each atom i is type bptype + // each neigh j is type bptype + // using midpoint distance option if(midpoint){ @@ -194,18 +194,18 @@ void PairSRP::compute(int eflag, int vflag) // midpt dist bond 0 and 1 dx = 0.5*(x[i0][0] - x[i1][0] + x[j0][0] - x[j1][0]); - dy = 0.5*(x[i0][1] - x[i1][1] + x[j0][1] - x[j1][1]); - dz = 0.5*(x[i0][2] - x[i1][2] + x[j0][2] - x[j1][2]); + dy = 0.5*(x[i0][1] - x[i1][1] + x[j0][1] - x[j1][1]); + dz = 0.5*(x[i0][2] - x[i1][2] + x[j0][2] - x[j1][2]); dijsq = dx*dx + dy*dy + dz*dz; if (dijsq < cutsq[bptype][bptype]){ dij = sqrt(dijsq); - if (dij < SMALL) + if (dij < SMALL) continue; // dij can be 0.0 with soft potentials wd = 1.0 - dij / cut[bptype][bptype]; - fpair = 0.5 * a0[bptype][bptype] * wd / dij; // 0.5 factor for lever rule + fpair = 0.5 * a0[bptype][bptype] * wd / dij; // 0.5 factor for lever rule // force for bond 0, beads 0,1 //force between bonds @@ -245,10 +245,10 @@ void PairSRP::compute(int eflag, int vflag) } } } - } + } else{ // using min distance option - + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; @@ -275,13 +275,13 @@ void PairSRP::compute(int eflag, int vflag) if (dijsq < cutsq[bptype][bptype]){ - dij = sqrt(dijsq); + dij = sqrt(dijsq); if (dij < SMALL) continue; // dij can be 0.0 with soft potentials wd = 1.0 - dij / cut[bptype][bptype]; - fpair = a0[bptype][bptype] * wd / dij; + fpair = a0[bptype][bptype] * wd / dij; // force for bond 0, beads 0,1 lever0 = 0.5 + ti; // assign force according to lever rule @@ -365,7 +365,7 @@ void PairSRP::settings(int narg, char **arg) int iarg = 3; // default exclude 1-2 // scaling for 1-2, etc not supported - exclude = 1; + exclude = 1; while (iarg < narg) { if (strcmp(arg[iarg],"exclude") == 0) { @@ -393,7 +393,7 @@ void PairSRP::settings(int narg, char **arg) } /* ---------------------------------------------------------------------- - set coeffs + set coeffs ------------------------------------------------------------------------- */ void PairSRP::coeff(int narg, char **arg) @@ -460,7 +460,7 @@ void PairSRP::init_style() // bond particles do not contribute to energy or virial // bond particles do not belong to group all - // but thermo normalization is by nall + // but thermo normalization is by nall // therefore should turn off normalization int me; MPI_Comm_rank(world,&me); @@ -468,7 +468,7 @@ void PairSRP::init_style() arg1[0] = (char *) "norm"; arg1[1] = (char *) "no"; output->thermo->modify_params(2, arg1); - if (me == 0) + if (me == 0) error->message(FLERR,"Thermo normalization turned off by pair srp"); neighbor->request(this,instance_me); @@ -488,13 +488,13 @@ double PairSRP::init_one(int i, int j) return cut[i][j]; } - -/* ---------------------------------------------------------------------- + +/* ---------------------------------------------------------------------- find min distance for bonds i0/j0 and i1/j1 - ------------------------------------------------------------------------- */ + ------------------------------------------------------------------------- */ inline void PairSRP::getMinDist(double** &x, double &dx, double &dy, double &dz, double &ti, double &tj, int &i0, int &j0, int &i1, int &j1) -{ - // move these outside the loop +{ + // move these outside the loop double diffx0, diffy0, diffz0, diffx1, diffy1, diffz1, dPx, dPy, dPz, RiRi, RiRj, RjRj; double denom, termx0, termy0, termz0, num0, termx1, termy1, termz1, num1; @@ -504,7 +504,7 @@ inline void PairSRP::getMinDist(double** &x, double &dx, double &dy, double &dz, diffz0 = x[j0][2] - x[i0][2]; // compute midpt dist from 1st atom, 2nd bond - diffx1 = x[j1][0] - x[i1][0]; + diffx1 = x[j1][0] - x[i1][0]; diffy1 = x[j1][1] - x[i1][1]; diffz1 = x[j1][2] - x[i1][2]; @@ -520,22 +520,22 @@ inline void PairSRP::getMinDist(double** &x, double &dx, double &dy, double &dz, denom = RiRj*RiRj - RiRi*RjRj; // handle case of parallel lines - // reduce to midpt distance - if (fabs(denom) < SMALL){ + // reduce to midpt distance + if (fabs(denom) < SMALL){ if(denom < 0) denom = -BIG; else denom = BIG; - } + } - // calc ti + // calc ti termx0 = RiRj*diffx1 - RjRj*diffx0; termy0 = RiRj*diffy1 - RjRj*diffy0; termz0 = RiRj*diffz1 - RjRj*diffz0; num0 = dPx*termx0 + dPy*termy0 + dPz*termz0; ti = num0 / denom; - if (ti > 0.5) ti = 0.5; - if (ti < -0.5) ti = -0.5; - - // calc tj + if (ti > 0.5) ti = 0.5; + if (ti < -0.5) ti = -0.5; + + // calc tj termx1 = RiRj*diffx0 - RiRi*diffx1; termy1 = RiRj*diffy0 - RiRi*diffy1; termz1 = RiRj*diffz0 - RiRi*diffz1; @@ -543,28 +543,28 @@ inline void PairSRP::getMinDist(double** &x, double &dx, double &dy, double &dz, tj = -num1/ denom; if (tj > 0.5) tj = 0.5; if (tj < -0.5) tj = -0.5; - - // min dist + + // min dist dx = dPx - ti*diffx0 + tj*diffx1; dy = dPy - ti*diffy0 + tj*diffy1; dz = dPz - ti*diffz0 + tj*diffz1; -} +} -/* -------------------------------------------------------- +/* -------------------------------------------------------- map global id of atoms in stored by each bond particle - ------------------------------------------------------- */ + ------------------------------------------------------- */ inline void PairSRP::remapBonds(int &nall) { if(nall > maxcount){ - memory->grow(segment, nall, 2, "pair:segment"); + memory->grow(segment, nall, 2, "pair:segment"); maxcount = nall; } // loop over all bond particles // each bond paricle holds two bond atoms // map global ids of bond atoms to local ids - // might not be able to map both bond atoms of j, if j is outside neighcut - // these are not on neighlist, so are not used + // might not be able to map both bond atoms of j, if j is outside neighcut + // these are not on neighlist, so are not used int tmp; srp = f_srp->array_atom; @@ -581,18 +581,18 @@ inline void PairSRP::remapBonds(int &nall) } } -/* -------------------------------------------------------- +/* -------------------------------------------------------- add exclusions for 1-2 neighs, if requested -more complex exclusions or scaling probably not needed - ------------------------------------------------------- */ +more complex exclusions or scaling probably not needed + ------------------------------------------------------- */ inline void PairSRP::onetwoexclude(int* &ilist, int &inum, int* &jlist, int* &numneigh, int** &firstneigh) { int i0, i1, j0, j1; int i,j,ii,jj,jnum; // encode neighs with exclusions - // only need 1-2 info for normal uses of srp - // add 1-3, etc later if ever needed + // only need 1-2 info for normal uses of srp + // add 1-3, etc later if ever needed for (ii = 0; ii < inum; ii++) { @@ -611,7 +611,7 @@ inline void PairSRP::onetwoexclude(int* &ilist, int &inum, int* &jlist, int* &nu i1 = segment[j][0]; j1 = segment[j][1]; - // check for a 1-2 neigh + // check for a 1-2 neigh if(i0 == i1 || i0 == j1 || i1 == j0 || j0 == j1){ j |= ONETWOBIT; jlist[jj] = j; @@ -640,7 +640,7 @@ void PairSRP::write_data_all(FILE *fp) for (int j = i; j <= atom->ntypes; j++) fprintf(fp,"%d %d %g %g\n",i,j,a0[i][j],cut[i][j]); } - + /* ---------------------------------------------------------------------- proc 0 writes to restart file ------------------------------------------------------------------------- */ diff --git a/src/USER-MISC/pair_srp.h b/src/USER-MISC/pair_srp.h index ecd352cdeb89f0d4416f7874c61f5d69334ff933..95cc5a5c94a1caed607cb52b58d804433eb2d590 100644 --- a/src/USER-MISC/pair_srp.h +++ b/src/USER-MISC/pair_srp.h @@ -44,9 +44,9 @@ class PairSRP : public Pair { inline void onetwoexclude(int* &, int &, int* &, int* &, int** &); inline void remapBonds(int &); void allocate(); - void getMinDist(double** &, double &, double &, double &, double &, + void getMinDist(double** &, double &, double &, double &, double &, double &, int &, int &, int &, int &); - bool min, midpoint; + bool min, midpoint; double **cut; double **a0; double **srp; diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index c5865c0a995a48469587e79e4e69be4f4e7e3ff9..59c19d9a1162828c7df22baa1b856ff8aa95fe7a 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -20,10 +20,10 @@ 1) Tersoff, Phys. Rev. B 39, 5566 (1988) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_table.h" #include "atom.h" #include "neighbor.h" diff --git a/src/USER-MOLFILE/reader_molfile.cpp b/src/USER-MOLFILE/reader_molfile.cpp index 2e3aa895069dbbec0c773dc3acd6c1b63d0df550..15735ab92a25bc47937a3b1de64089364b525fb0 100644 --- a/src/USER-MOLFILE/reader_molfile.cpp +++ b/src/USER-MOLFILE/reader_molfile.cpp @@ -15,9 +15,9 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "reader_molfile.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_charmm_omp.cpp b/src/USER-OMP/dihedral_charmm_omp.cpp index 311ef73e3bb94b6f8ea6740abb984f0c18787117..95cab754c3b7465671f1c9e77d71ad6b0d99e2e6 100644 --- a/src/USER-OMP/dihedral_charmm_omp.cpp +++ b/src/USER-OMP/dihedral_charmm_omp.cpp @@ -15,8 +15,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" +#include <mpi.h> +#include <math.h> #include "dihedral_charmm_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_class2_omp.cpp b/src/USER-OMP/dihedral_class2_omp.cpp index b4d1080cea23c6c6d19bcd76fda9b6db7dbf67ed..edf3e972d296c546bb808a2beb9b93911eae8d14 100644 --- a/src/USER-OMP/dihedral_class2_omp.cpp +++ b/src/USER-OMP/dihedral_class2_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_class2_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp index 57a4561629ebd5349efb8366d6d813c37ece6569..fe99d52cb7e7d274873b85584443d2658231d03f 100644 --- a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_cosine_shift_exp_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_fourier_omp.cpp b/src/USER-OMP/dihedral_fourier_omp.cpp index 29d18c9fcac3b2cfc0d368e7f4f9728d9598851f..9c93f2ad30651b4d498df9bf53e8a52b11eb0a6f 100644 --- a/src/USER-OMP/dihedral_fourier_omp.cpp +++ b/src/USER-OMP/dihedral_fourier_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_fourier_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_harmonic_omp.cpp b/src/USER-OMP/dihedral_harmonic_omp.cpp index 79daf186cbf5e93ac120ed4d9987d7053a30c794..2e0a1cf5545694f24de16699e82fc5ee6f68d5cd 100644 --- a/src/USER-OMP/dihedral_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_harmonic_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_harmonic_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_helix_omp.cpp b/src/USER-OMP/dihedral_helix_omp.cpp index 316fbfcb3f3e9529b005c2e934a19d81c0ba8ccd..7dd1e8f8a4c59d5266a50fef0ac7757723254ca5 100644 --- a/src/USER-OMP/dihedral_helix_omp.cpp +++ b/src/USER-OMP/dihedral_helix_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_helix_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp index e43c75d53946da3f835dd828d8ba7d3757ba365c..06565e7b502a09217381e0b4e690ea685d30e765 100644 --- a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_multi_harmonic_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_nharmonic_omp.cpp b/src/USER-OMP/dihedral_nharmonic_omp.cpp index 3cf0630736bfaeadc7b0db2c1df2a4e442853360..c698f7c109d1d9e88b1aa6c15f9e27bdf19a661a 100644 --- a/src/USER-OMP/dihedral_nharmonic_omp.cpp +++ b/src/USER-OMP/dihedral_nharmonic_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_nharmonic_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_opls_omp.cpp b/src/USER-OMP/dihedral_opls_omp.cpp index 187bdae3a6b9a0523002280c94c3f2aecfcc5526..069d6d2dd203482adb62e7f6002d68c6fabeb128 100644 --- a/src/USER-OMP/dihedral_opls_omp.cpp +++ b/src/USER-OMP/dihedral_opls_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_opls_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/dihedral_quadratic_omp.cpp b/src/USER-OMP/dihedral_quadratic_omp.cpp index 3157e3b40a78f28a49b0726fb3c0f8e02190a9e2..3fa580defc20cd1027833d63f0655738f790b7d3 100644 --- a/src/USER-OMP/dihedral_quadratic_omp.cpp +++ b/src/USER-OMP/dihedral_quadratic_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral_quadratic_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/ewald_omp.cpp b/src/USER-OMP/ewald_omp.cpp index 6625a1dcb896c9c40e897a156e1dca0ca339adb7..7ab903aab15fcebc018792db0d74828c18f246df 100644 --- a/src/USER-OMP/ewald_omp.cpp +++ b/src/USER-OMP/ewald_omp.cpp @@ -15,7 +15,7 @@ Contributing authors: Roy Pollock (LLNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "ewald_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/fix_gravity_omp.cpp b/src/USER-OMP/fix_gravity_omp.cpp index fd32a00e5849e2c2d4480f0b0e996de6d24ad977..b853d844f0994c25c1969febe515478edd6e7b4b 100644 --- a/src/USER-OMP/fix_gravity_omp.cpp +++ b/src/USER-OMP/fix_gravity_omp.cpp @@ -15,10 +15,10 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_gravity_omp.h" #include "atom.h" #include "update.h" diff --git a/src/USER-OMP/fix_nh_asphere_omp.cpp b/src/USER-OMP/fix_nh_asphere_omp.cpp index 4286140a430663876648767e460fe26f55e29e78..d90e907d0e66e28409d3d1ae439210b78bf8c35a 100644 --- a/src/USER-OMP/fix_nh_asphere_omp.cpp +++ b/src/USER-OMP/fix_nh_asphere_omp.cpp @@ -15,9 +15,9 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "math_extra.h" #include "fix_nh_asphere_omp.h" #include "atom.h" @@ -79,7 +79,7 @@ void FixNHAsphereOMP::nve_v() const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; - // standard nve_v velocity update. for efficiency the loop is + // standard nve_v velocity update. for efficiency the loop is // merged with FixNHOMP instead of calling it for the COM update. #if defined(_OPENMP) @@ -122,7 +122,7 @@ void FixNHAsphereOMP::nve_x() // update quaternion a full step via Richardson iteration // returns new normalized quaternion // principal moments of inertia - + #if defined(_OPENMP) #pragma omp parallel for default(none) private(i) schedule(static) #endif diff --git a/src/USER-OMP/fix_nh_sphere_omp.cpp b/src/USER-OMP/fix_nh_sphere_omp.cpp index 79d98a6cca907ff9cb8c7cafe72534f9bb592c76..71c5e4b985dd9e0535e5fb5b4ad795efad5a8cbf 100644 --- a/src/USER-OMP/fix_nh_sphere_omp.cpp +++ b/src/USER-OMP/fix_nh_sphere_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_nh_sphere_omp.h" #include "atom.h" #include "atom_vec.h" @@ -81,7 +81,7 @@ void FixNHSphereOMP::nve_v() const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; int i; - // standard nve_v velocity update. for efficiency the loop is + // standard nve_v velocity update. for efficiency the loop is // merged with FixNHOMP instead of calling it for the COM update. // update omega for all particles diff --git a/src/USER-OMP/fix_nph_asphere_omp.cpp b/src/USER-OMP/fix_nph_asphere_omp.cpp index d9343b3337549240beb1c5086206bf9282060903..3e0a6c9df01f2011bf00a9985a549fe4002458e4 100644 --- a/src/USER-OMP/fix_nph_asphere_omp.cpp +++ b/src/USER-OMP/fix_nph_asphere_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nph_asphere_omp.h" #include "modify.h" #include "error.h" diff --git a/src/USER-OMP/fix_nph_omp.cpp b/src/USER-OMP/fix_nph_omp.cpp index 6d3e33453d69a3acc283f2e4660dc22878c44a7c..be21da2eedaa2cad626fdd294d0c3cc46ad48f1c 100644 --- a/src/USER-OMP/fix_nph_omp.cpp +++ b/src/USER-OMP/fix_nph_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nph_omp.h" #include "modify.h" #include "error.h" diff --git a/src/USER-OMP/fix_nph_sphere_omp.cpp b/src/USER-OMP/fix_nph_sphere_omp.cpp index d39bf0958283279f4960caa6396bba9609d96b9e..a5626f9d1c39d88219af127b92d22804aae5bb15 100644 --- a/src/USER-OMP/fix_nph_sphere_omp.cpp +++ b/src/USER-OMP/fix_nph_sphere_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nph_sphere_omp.h" #include "modify.h" #include "error.h" diff --git a/src/USER-OMP/fix_nphug_omp.cpp b/src/USER-OMP/fix_nphug_omp.cpp index 57bc1fc2a16d410c198617de2d458ef2d67b93ee..7721781769369629daa40328352ff286be46f56d 100644 --- a/src/USER-OMP/fix_nphug_omp.cpp +++ b/src/USER-OMP/fix_nphug_omp.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_nphug_omp.h" #include "modify.h" #include "error.h" @@ -21,10 +21,10 @@ #include "force.h" #include "domain.h" #include "group.h" -#include "math.h" +#include <math.h> #include "memory.h" #include "comm.h" -#include "math.h" +#include <math.h> using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-OMP/fix_npt_asphere_omp.cpp b/src/USER-OMP/fix_npt_asphere_omp.cpp index 05bc61f45e75214eaea2168f55955e2ea24baa3e..00bafe661a715cac978c8bc67c9e9b0c685ddb60 100644 --- a/src/USER-OMP/fix_npt_asphere_omp.cpp +++ b/src/USER-OMP/fix_npt_asphere_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_npt_asphere_omp.h" #include "modify.h" #include "error.h" diff --git a/src/USER-OMP/fix_npt_omp.cpp b/src/USER-OMP/fix_npt_omp.cpp index 2f2d90a2d11f060ac1007467d22c255eb2079093..c4af48542aea66cd2e98d01904c960ffb3d04937 100644 --- a/src/USER-OMP/fix_npt_omp.cpp +++ b/src/USER-OMP/fix_npt_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_npt_omp.h" #include "modify.h" #include "error.h" diff --git a/src/USER-OMP/fix_npt_sphere_omp.cpp b/src/USER-OMP/fix_npt_sphere_omp.cpp index f1959bc29ee1377a95ef3b465769766f91913bbe..6baee93cb4df1691f41afc745bfe520beb13b6ef 100644 --- a/src/USER-OMP/fix_npt_sphere_omp.cpp +++ b/src/USER-OMP/fix_npt_sphere_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_npt_sphere_omp.h" #include "modify.h" #include "error.h" diff --git a/src/USER-OMP/fix_nve_sphere_omp.cpp b/src/USER-OMP/fix_nve_sphere_omp.cpp index bbe009ecc9e0b49265b21a545d8f575d109ebb64..ee58c88cb8e6a8b24d25daee5773652683ce450f 100644 --- a/src/USER-OMP/fix_nve_sphere_omp.cpp +++ b/src/USER-OMP/fix_nve_sphere_omp.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_nve_sphere_omp.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/USER-OMP/fix_nvt_asphere_omp.cpp b/src/USER-OMP/fix_nvt_asphere_omp.cpp index 68cd4f0df66fe93895791a525e9fc88c10cb4006..23cc2e95815601d22fb82cb547513315e27949e3 100644 --- a/src/USER-OMP/fix_nvt_asphere_omp.cpp +++ b/src/USER-OMP/fix_nvt_asphere_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nvt_asphere_omp.h" #include "group.h" #include "modify.h" diff --git a/src/USER-OMP/fix_nvt_omp.cpp b/src/USER-OMP/fix_nvt_omp.cpp index 8f096cd7d372952143b3ab15d391fbc629500615..18d02bff4dcd19584da984ea61f4c38b749f196e 100644 --- a/src/USER-OMP/fix_nvt_omp.cpp +++ b/src/USER-OMP/fix_nvt_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nvt_omp.h" #include "group.h" #include "modify.h" diff --git a/src/USER-OMP/fix_nvt_sllod_omp.cpp b/src/USER-OMP/fix_nvt_sllod_omp.cpp index 0ce946e76964f1afa1f9091b23c97f6f56e3a374..8105e831f7c2f65c5fe829d4b363a10aad686f27 100644 --- a/src/USER-OMP/fix_nvt_sllod_omp.cpp +++ b/src/USER-OMP/fix_nvt_sllod_omp.cpp @@ -15,8 +15,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "fix_nvt_sllod_omp.h" #include "math_extra.h" #include "atom.h" diff --git a/src/USER-OMP/fix_nvt_sphere_omp.cpp b/src/USER-OMP/fix_nvt_sphere_omp.cpp index e34b3da5a4d6b3ef8f809e28607d4d48b3926124..6db9ad849a4faae5711a12467a7137c32a3a5e41 100644 --- a/src/USER-OMP/fix_nvt_sphere_omp.cpp +++ b/src/USER-OMP/fix_nvt_sphere_omp.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nvt_sphere_omp.h" #include "group.h" #include "modify.h" diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index 7b2be715d3c2d6231d57422623445bfb2b4c2c90..f8de18498da9649be8c712c1bdc6edee93c5053b 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -15,8 +15,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" +#include <mpi.h> +#include <math.h> #include "fix_qeq_comb_omp.h" #include "fix_omp.h" #include "atom.h" @@ -59,7 +59,7 @@ void FixQEQCombOMP::init() comb = (PairComb *) force->pair_match("comb/omp",1); if (comb == NULL) comb = (PairComb *) force->pair_match("comb",1); - if (comb == NULL) + if (comb == NULL) error->all(FLERR,"Must use pair_style comb or " "comb/omp with fix qeq/comb/omp"); diff --git a/src/USER-OMP/fix_rigid_nh_omp.cpp b/src/USER-OMP/fix_rigid_nh_omp.cpp index 0e347eb128a3eaed4f78a52e2bd8abfb356b10bd..f2d6d8513b23b77f9adf8d215b676a1bff735872 100644 --- a/src/USER-OMP/fix_rigid_nh_omp.cpp +++ b/src/USER-OMP/fix_rigid_nh_omp.cpp @@ -57,7 +57,7 @@ typedef struct { double x,y,z; } dbl3_t; void FixRigidNHOMP::initial_integrate(int vflag) { double scale_r,scale_t[3],scale_v[3]; - + // compute scale variables scale_t[0] = scale_t[1] = scale_t[2] = 1.0; @@ -70,7 +70,7 @@ void FixRigidNHOMP::initial_integrate(int vflag) scale_t[0] = scale_t[1] = scale_t[2] = tmp; tmp = exp(-dtq * eta_dot_r[0]); scale_r = tmp; - } + } if (pstat_flag) { akin_t = akin_r = 0.0; @@ -86,7 +86,7 @@ void FixRigidNHOMP::initial_integrate(int vflag) tmp = dtq * epsilon_dot[2]; scale_v[2] = dtv * exp(tmp) * maclaurin_series(tmp); } - + // update xcm, vcm, quat, conjqm and angmom double akt=0.0, akr=0.0; int ibody; @@ -97,24 +97,24 @@ void FixRigidNHOMP::initial_integrate(int vflag) for (ibody = 0; ibody < nbody; ibody++) { double mbody[3],tbody[3],fquat[4]; const double dtf2 = dtf * 2.0; - + // step 1.1 - update vcm by 1/2 step - + const double dtfm = dtf / masstotal[ibody]; vcm[ibody][0] += dtfm * fcm[ibody][0] * fflag[ibody][0]; vcm[ibody][1] += dtfm * fcm[ibody][1] * fflag[ibody][1]; vcm[ibody][2] += dtfm * fcm[ibody][2] * fflag[ibody][2]; - + if (tstat_flag || pstat_flag) { vcm[ibody][0] *= scale_t[0]; vcm[ibody][1] *= scale_t[1]; vcm[ibody][2] *= scale_t[2]; - + double tmp = vcm[ibody][0]*vcm[ibody][0] + vcm[ibody][1]*vcm[ibody][1] + vcm[ibody][2]*vcm[ibody][2]; akt += masstotal[ibody]*tmp; } - + // step 1.2 - update xcm by full step if (!pstat_flag) { @@ -126,56 +126,56 @@ void FixRigidNHOMP::initial_integrate(int vflag) xcm[ibody][1] += scale_v[1] * vcm[ibody][1]; xcm[ibody][2] += scale_v[2] * vcm[ibody][2]; } - + // step 1.3 - apply torque (body coords) to quaternion momentum - + torque[ibody][0] *= tflag[ibody][0]; torque[ibody][1] *= tflag[ibody][1]; torque[ibody][2] *= tflag[ibody][2]; - + MathExtra::transpose_matvec(ex_space[ibody],ey_space[ibody],ez_space[ibody], torque[ibody],tbody); MathExtra::quatvec(quat[ibody],tbody,fquat); - + conjqm[ibody][0] += dtf2 * fquat[0]; conjqm[ibody][1] += dtf2 * fquat[1]; conjqm[ibody][2] += dtf2 * fquat[2]; conjqm[ibody][3] += dtf2 * fquat[3]; - + if (tstat_flag || pstat_flag) { conjqm[ibody][0] *= scale_r; conjqm[ibody][1] *= scale_r; conjqm[ibody][2] *= scale_r; conjqm[ibody][3] *= scale_r; } - + // step 1.4 to 1.13 - use no_squish rotate to update p and q - + MathExtra::no_squish_rotate(3,conjqm[ibody],quat[ibody],inertia[ibody],dtq); MathExtra::no_squish_rotate(2,conjqm[ibody],quat[ibody],inertia[ibody],dtq); MathExtra::no_squish_rotate(1,conjqm[ibody],quat[ibody],inertia[ibody],dtv); MathExtra::no_squish_rotate(2,conjqm[ibody],quat[ibody],inertia[ibody],dtq); MathExtra::no_squish_rotate(3,conjqm[ibody],quat[ibody],inertia[ibody],dtq); - + // update exyz_space // transform p back to angmom // update angular velocity - + MathExtra::q_to_exyz(quat[ibody],ex_space[ibody],ey_space[ibody], ez_space[ibody]); MathExtra::invquatvec(quat[ibody],conjqm[ibody],mbody); MathExtra::matvec(ex_space[ibody],ey_space[ibody],ez_space[ibody], mbody,angmom[ibody]); - + angmom[ibody][0] *= 0.5; angmom[ibody][1] *= 0.5; angmom[ibody][2] *= 0.5; - + MathExtra::angmom_to_omega(angmom[ibody],ex_space[ibody],ey_space[ibody], ez_space[ibody],inertia[ibody],omega[ibody]); - + if (tstat_flag || pstat_flag) { - akr += angmom[ibody][0]*omega[ibody][0] + + akr += angmom[ibody][0]*omega[ibody][0] + angmom[ibody][1]*omega[ibody][1] + angmom[ibody][2]*omega[ibody][2]; } } // end of parallel for @@ -193,7 +193,7 @@ void FixRigidNHOMP::initial_integrate(int vflag) compute_temp_target(); nhc_temp_integrate(); } - + // update thermostat chains coupled with barostat // refer to update_nhcb() in Kamberaj et al. @@ -205,14 +205,14 @@ void FixRigidNHOMP::initial_integrate(int vflag) if (vflag) v_setup(vflag); else evflag = 0; - + // remap simulation box by 1/2 step if (pstat_flag) remap(); - + // set coords/orient and velocity/rotation of atoms in rigid bodies // from quarternion and omega - + if (triclinic) if (evflag) set_xv_thr<1,1>(); @@ -230,7 +230,7 @@ void FixRigidNHOMP::initial_integrate(int vflag) if (pstat_flag) { remap(); if (kspace_flag) force->kspace->setup(); - } + } } /* ---------------------------------------------------------------------- */ @@ -240,7 +240,7 @@ void FixRigidNHOMP::final_integrate() double scale_t[3],scale_r; // compute scale variables - + scale_t[0] = scale_t[1] = scale_t[2] = 1.0; scale_r = 1.0; @@ -248,17 +248,17 @@ void FixRigidNHOMP::final_integrate() double tmp = exp(-1.0 * dtq * eta_dot_t[0]); scale_t[0] = scale_t[1] = scale_t[2] = tmp; scale_r = exp(-1.0 * dtq * eta_dot_r[0]); - } - + } + if (pstat_flag) { scale_t[0] *= exp(-dtq * (epsilon_dot[0] + mtk_term2)); scale_t[1] *= exp(-dtq * (epsilon_dot[1] + mtk_term2)); scale_t[2] *= exp(-dtq * (epsilon_dot[2] + mtk_term2)); scale_r *= exp(-dtq * (pdim * mtk_term2)); - + akin_t = akin_r = 0.0; } - + double * const * _noalias const x = atom->x; const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; const double * const * const torque_one = atom->torque; @@ -306,7 +306,7 @@ void FixRigidNHOMP::final_integrate() // we likely have only a rather number of groups so we loops // over bodies and thread over all atoms for each of them. - + for (int ib = 0; ib < nbody; ++ib) { double s0=0.0,s1=0.0,s2=0.0,s3=0.0,s4=0.0,s5=0.0; int i; @@ -361,7 +361,7 @@ void FixRigidNHOMP::final_integrate() #else const int tid = 0; #endif - + for (int i = 0; i < nlocal; i++) { const int ibody = body[i]; if ((ibody < 0) || (ibody % nthreads != tid)) continue; @@ -423,28 +423,28 @@ void FixRigidNHOMP::final_integrate() vcm[ibody][1] *= scale_t[1]; vcm[ibody][2] *= scale_t[2]; } - + vcm[ibody][0] += dtfm * fcm[ibody][0] * fflag[ibody][0]; vcm[ibody][1] += dtfm * fcm[ibody][1] * fflag[ibody][1]; vcm[ibody][2] += dtfm * fcm[ibody][2] * fflag[ibody][2]; - + if (pstat_flag) { double tmp = vcm[ibody][0]*vcm[ibody][0] + vcm[ibody][1]*vcm[ibody][1] + vcm[ibody][2]*vcm[ibody][2]; akt += masstotal[ibody]*tmp; } - + // update conjqm, then transform to angmom, set velocity again // virial is already setup from initial_integrate - + torque[ibody][0] *= tflag[ibody][0]; torque[ibody][1] *= tflag[ibody][1]; torque[ibody][2] *= tflag[ibody][2]; - + MathExtra::transpose_matvec(ex_space[ibody],ey_space[ibody], ez_space[ibody],torque[ibody],tbody); MathExtra::quatvec(quat[ibody],tbody,fquat); - + if (tstat_flag || pstat_flag) { conjqm[ibody][0] = scale_r * conjqm[ibody][0] + dtf2 * fquat[0]; conjqm[ibody][1] = scale_r * conjqm[ibody][1] + dtf2 * fquat[1]; @@ -460,17 +460,17 @@ void FixRigidNHOMP::final_integrate() MathExtra::invquatvec(quat[ibody],conjqm[ibody],mbody); MathExtra::matvec(ex_space[ibody],ey_space[ibody],ez_space[ibody], mbody,angmom[ibody]); - + angmom[ibody][0] *= 0.5; angmom[ibody][1] *= 0.5; - angmom[ibody][2] *= 0.5; - + angmom[ibody][2] *= 0.5; + MathExtra::angmom_to_omega(angmom[ibody],ex_space[ibody],ey_space[ibody], ez_space[ibody],inertia[ibody],omega[ibody]); - + if (pstat_flag) { - akr += angmom[ibody][0]*omega[ibody][0] + - angmom[ibody][1]*omega[ibody][1] + + akr += angmom[ibody][0]*omega[ibody][0] + + angmom[ibody][1]*omega[ibody][1] + angmom[ibody][2]*omega[ibody][2]; } } // end of parallel for @@ -490,13 +490,13 @@ void FixRigidNHOMP::final_integrate() set_v_thr<0,1>(); else set_v_thr<0,0>(); - + // compute current temperature if (tcomputeflag) t_current = temperature->compute_scalar(); // compute current and target pressures // update epsilon dot using akin_t and akin_r - + if (pstat_flag) { if (pstyle == ISO) { temperature->compute_scalar(); @@ -523,11 +523,11 @@ void FixRigidNHOMP::remap() const int nlocal = atom->nlocal; // epsilon is not used, except for book-keeping - + for (int i = 0; i < 3; i++) epsilon[i] += dtq * epsilon_dot[i]; - + // convert pertinent atoms and rigid bodies to lamda coords - + if (allremap) domain->x2lamda(nlocal); else { int i; @@ -538,13 +538,13 @@ void FixRigidNHOMP::remap() if (mask[i] & dilate_group_bit) domain->x2lamda(x[i],x[i]); } - + if (nrigid) for (int i = 0; i < nrigidfix; i++) modify->fix[rfix[i]]->deform(0); - + // reset global and local box to new size/shape - + for (int i = 0; i < 3; i++) { if (p_flag[i]) { const double oldlo = domain->boxlo[i]; @@ -558,9 +558,9 @@ void FixRigidNHOMP::remap() domain->set_global_box(); domain->set_local_box(); - + // convert pertinent atoms and rigid bodies back to box coords - + if (allremap) domain->lamda2x(nlocal); else { int i; @@ -901,7 +901,7 @@ void FixRigidNHOMP::set_v_thr() } } - // set omega, angmom of each extended particle + // set omega, angmom of each extended particle // XXX: extended particle info not yet multi-threaded if (extended) { diff --git a/src/USER-OMP/fix_rigid_nh_omp.h b/src/USER-OMP/fix_rigid_nh_omp.h index f2902ca3336b88d3161ebe1d984e737d36e0b4d7..9210d7e5dc88f1a412f047f3d3eab5d19dc90c47 100644 --- a/src/USER-OMP/fix_rigid_nh_omp.h +++ b/src/USER-OMP/fix_rigid_nh_omp.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -26,7 +26,7 @@ class FixRigidNHOMP : public FixRigidNH { virtual void initial_integrate(int); virtual void final_integrate(); - virtual void remap(); + virtual void remap(); private: // copied from FixRigidOMP template <int, int> void set_xv_thr(); diff --git a/src/USER-OMP/fix_rigid_nph_omp.cpp b/src/USER-OMP/fix_rigid_nph_omp.cpp index bd2ba5f6fb105534b1f9f6ccd572547e0be688cd..6aca84c30973566ef1b58e7954d667144277d7ef 100644 --- a/src/USER-OMP/fix_rigid_nph_omp.cpp +++ b/src/USER-OMP/fix_rigid_nph_omp.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,7 +17,7 @@ Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_rigid_nph_omp.h" #include "domain.h" #include "modify.h" @@ -29,24 +29,24 @@ using namespace LAMMPS_NS; FixRigidNPHOMP::FixRigidNPHOMP(LAMMPS *lmp, int narg, char **arg) : FixRigidNHOMP(lmp, narg, arg) -{ +{ // other setting are made by parent scalar_flag = 1; restart_global = 1; box_change_size = 1; extscalar = 1; - + // error checks if (pstat_flag == 0) error->all(FLERR,"Pressure control must be used with fix nph/omp"); if (tstat_flag == 1) error->all(FLERR,"Temperature control must not be used with fix nph/omp"); - if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 || + if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 || p_stop[0] < 0.0 || p_stop[1] < 0.0 || p_stop[2] < 0.0) error->all(FLERR,"Target pressure for fix rigid/nph/omp cannot be 0.0"); - + // convert input periods to frequency p_freq[0] = p_freq[1] = p_freq[2] = 0.0; @@ -67,15 +67,15 @@ FixRigidNPHOMP::FixRigidNPHOMP(LAMMPS *lmp, int narg, char **arg) : char **newarg = new char*[3]; newarg[0] = id_temp; newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; + newarg[2] = (char *) "temp"; modify->add_compute(3,newarg); delete [] newarg; tcomputeflag = 1; - + // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - + n = strlen(id) + 7; id_press = new char[n]; strcpy(id_press,id); diff --git a/src/USER-OMP/fix_rigid_nph_omp.h b/src/USER-OMP/fix_rigid_nph_omp.h index 31b95fa02fc6b9337e756ef5a3e24dce13e8e0b6..f64a743feacc9046fb9929bd04f12ed9fed2b248 100644 --- a/src/USER-OMP/fix_rigid_nph_omp.h +++ b/src/USER-OMP/fix_rigid_nph_omp.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-OMP/fix_rigid_npt_omp.cpp b/src/USER-OMP/fix_rigid_npt_omp.cpp index 5d41d5f29693dc13182a5f84199a9bbf065e68e1..23f16c61556034bd208dda6d20f941ba87045d23 100644 --- a/src/USER-OMP/fix_rigid_npt_omp.cpp +++ b/src/USER-OMP/fix_rigid_npt_omp.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -17,7 +17,7 @@ Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_rigid_npt_omp.h" #include "domain.h" #include "modify.h" @@ -29,21 +29,21 @@ using namespace LAMMPS_NS; FixRigidNPTOMP::FixRigidNPTOMP(LAMMPS *lmp, int narg, char **arg) : FixRigidNHOMP(lmp, narg, arg) -{ +{ // other setting are made by parent scalar_flag = 1; restart_global = 1; box_change_size = 1; extscalar = 1; - + // error checks if (tstat_flag == 0 || pstat_flag == 0) error->all(FLERR,"Did not set temp or press for fix rigid/npt/omp"); if (t_start <= 0.0 || t_stop <= 0.0) error->all(FLERR,"Target temperature for fix rigid/npt/omp cannot be 0.0"); - if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 || + if (p_start[0] < 0.0 || p_start[1] < 0.0 || p_start[2] < 0.0 || p_stop[0] < 0.0 || p_stop[1] < 0.0 || p_stop[2] < 0.0) error->all(FLERR,"Target pressure for fix rigid/npt/omp cannot be 0.0"); @@ -53,7 +53,7 @@ FixRigidNPTOMP::FixRigidNPTOMP(LAMMPS *lmp, int narg, char **arg) : if (t_chain < 1) error->all(FLERR,"Illegal fix_modify command"); if (t_iter < 1) error->all(FLERR,"Illegal fix_modify command"); - if (t_order != 3 && t_order != 5) + if (t_order != 3 && t_order != 5) error->all(FLERR,"Fix_modify order must be 3 or 5"); // convert input periods to frequency @@ -79,15 +79,15 @@ FixRigidNPTOMP::FixRigidNPTOMP(LAMMPS *lmp, int narg, char **arg) : char **newarg = new char*[3]; newarg[0] = id_temp; newarg[1] = (char *) "all"; - newarg[2] = (char *) "temp"; + newarg[2] = (char *) "temp"; modify->add_compute(3,newarg); delete [] newarg; tcomputeflag = 1; - + // create a new compute pressure style // id = fix-ID + press, compute group = all // pass id_temp as 4th arg to pressure constructor - + n = strlen(id) + 7; id_press = new char[n]; strcpy(id_press,id); diff --git a/src/USER-OMP/fix_rigid_npt_omp.h b/src/USER-OMP/fix_rigid_npt_omp.h index 4f17d0ba5527acbe7d0008b18d94e3a4ed640bdb..627b5a8c29300c3aad1681adb5b32c8338a80123 100644 --- a/src/USER-OMP/fix_rigid_npt_omp.h +++ b/src/USER-OMP/fix_rigid_npt_omp.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-OMP/fix_rigid_nve_omp.cpp b/src/USER-OMP/fix_rigid_nve_omp.cpp index 1da3c29fa7116ab1dbc249970b2d628ccbedd1ac..51ed34fae879d99bf145959857e1471917e98e2b 100644 --- a/src/USER-OMP/fix_rigid_nve_omp.cpp +++ b/src/USER-OMP/fix_rigid_nve_omp.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-OMP/fix_rigid_nve_omp.h b/src/USER-OMP/fix_rigid_nve_omp.h index 464dde528b1df4ebe34252396bf63456ad400aef..eea45ee358c55e7f529ac73cf0ba1d037f6157a2 100644 --- a/src/USER-OMP/fix_rigid_nve_omp.h +++ b/src/USER-OMP/fix_rigid_nve_omp.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-OMP/fix_rigid_nvt_omp.cpp b/src/USER-OMP/fix_rigid_nvt_omp.cpp index 5e367899d9bbac186e3d598f171f333958868b10..758dcce9bf7ec540653701ff9b93d2414f59ff53 100644 --- a/src/USER-OMP/fix_rigid_nvt_omp.cpp +++ b/src/USER-OMP/fix_rigid_nvt_omp.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -26,13 +26,13 @@ using namespace LAMMPS_NS; FixRigidNVTOMP::FixRigidNVTOMP(LAMMPS *lmp, int narg, char **arg) : FixRigidNHOMP(lmp, narg, arg) -{ +{ // other settings are made by parent scalar_flag = 1; restart_global = 1; extscalar = 1; - + // error checking // convert input period to frequency @@ -46,6 +46,6 @@ FixRigidNVTOMP::FixRigidNVTOMP(LAMMPS *lmp, int narg, char **arg) : if (t_chain < 1) error->all(FLERR,"Illegal fix_modify command"); if (t_iter < 1) error->all(FLERR,"Illegal fix_modify command"); - if (t_order != 3 && t_order != 5) - error->all(FLERR,"Fix_modify order must be 3 or 5"); + if (t_order != 3 && t_order != 5) + error->all(FLERR,"Fix_modify order must be 3 or 5"); } diff --git a/src/USER-OMP/fix_rigid_nvt_omp.h b/src/USER-OMP/fix_rigid_nvt_omp.h index d083834d8224490033165a935def9b85642ada79..e1583aa4dfe8c7f6cbc2f389e2e1bbaabbd58dd1 100644 --- a/src/USER-OMP/fix_rigid_nvt_omp.h +++ b/src/USER-OMP/fix_rigid_nvt_omp.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-OMP/fix_rigid_omp.cpp b/src/USER-OMP/fix_rigid_omp.cpp index 8e069abfbf99f883c3030c25949b2e08cbea8a8d..d5bacc0320ec7fe485453da9ea5aa9a7dacb3be5 100644 --- a/src/USER-OMP/fix_rigid_omp.cpp +++ b/src/USER-OMP/fix_rigid_omp.cpp @@ -157,7 +157,7 @@ void FixRigidOMP::final_integrate() // we likely have only a rather number of groups so we loops // over bodies and thread over all atoms for each of them. - + for (int ib = 0; ib < nbody; ++ib) { double s0=0.0,s1=0.0,s2=0.0,s3=0.0,s4=0.0,s5=0.0; int i; @@ -212,7 +212,7 @@ void FixRigidOMP::final_integrate() #else const int tid = 0; #endif - + for (int i = 0; i < nlocal; i++) { const int ibody = body[i]; if ((ibody < 0) || (ibody % nthreads != tid)) continue; @@ -616,7 +616,7 @@ void FixRigidOMP::set_v_thr() } } - // set omega, angmom of each extended particle + // set omega, angmom of each extended particle // XXX: extended particle info not yet multi-threaded if (extended) { diff --git a/src/USER-OMP/fix_rigid_small_omp.cpp b/src/USER-OMP/fix_rigid_small_omp.cpp index e419bc5227dbda937746b78979e2d63599f8953e..a260899aefef848033574327a802b2b4f8cd823e 100644 --- a/src/USER-OMP/fix_rigid_small_omp.cpp +++ b/src/USER-OMP/fix_rigid_small_omp.cpp @@ -120,7 +120,7 @@ void FixRigidSmallOMP::final_integrate() const int nlocal = atom->nlocal; const int nthreads=comm->nthreads; int i, ibody; - + #if defined(_OPENMP) #pragma omp parallel for default(none) private(ibody) schedule(static) #endif @@ -139,7 +139,7 @@ void FixRigidSmallOMP::final_integrate() #if defined(_OPENMP) #pragma omp parallel default(none) private(i,ibody) #endif - { + { #if defined(_OPENMP) const int tid = omp_get_thread_num(); #else @@ -149,7 +149,7 @@ void FixRigidSmallOMP::final_integrate() for (i = 0; i < nlocal; i++) { ibody = atom2body[i]; if ((ibody < 0) || (ibody % nthreads != tid)) continue; - + Body &b = body[ibody]; double unwrap[3]; @@ -203,7 +203,7 @@ void FixRigidSmallOMP::final_integrate() } // update vcm and angmom, recompute omega - + #if defined(_OPENMP) #pragma omp parallel for default(none) private(ibody) schedule(static) #endif @@ -562,7 +562,7 @@ void FixRigidSmallOMP::set_v_thr() } } - // set omega, angmom of each extended particle + // set omega, angmom of each extended particle // XXX: extended particle info not yet multi-threaded if (extended) { diff --git a/src/USER-OMP/fix_shear_history_omp.cpp b/src/USER-OMP/fix_shear_history_omp.cpp index 16f5212acf69725640fa2cc07dff733eb9a37126..a91a129fee0b13cd274dbf1073135adeca8d75bf 100644 --- a/src/USER-OMP/fix_shear_history_omp.cpp +++ b/src/USER-OMP/fix_shear_history_omp.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdio.h" +#include <string.h> +#include <stdio.h> #include "fix_shear_history_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/fix_wall_gran_omp.cpp b/src/USER-OMP/fix_wall_gran_omp.cpp index e131acc0fa39cd2374bc7ca2bdf2fb2a7036d0ce..11cc3079045a1f4f83d4ddf4ad0e2f3804bfe29b 100644 --- a/src/USER-OMP/fix_wall_gran_omp.cpp +++ b/src/USER-OMP/fix_wall_gran_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_wall_gran_omp.h" #include "atom.h" #include "update.h" diff --git a/src/USER-OMP/improper_class2_omp.cpp b/src/USER-OMP/improper_class2_omp.cpp index 2cf71f675ca65600a8d6ee8f00e99fb3a88faf06..5e32795371429647bd7bd53327a11041f672fad0 100644 --- a/src/USER-OMP/improper_class2_omp.cpp +++ b/src/USER-OMP/improper_class2_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "improper_class2_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/improper_cossq_omp.cpp b/src/USER-OMP/improper_cossq_omp.cpp index 745591a3384608191fa1bf57897cae10605261a1..f34941d6245b28f94d34d151225115c6b37976ad 100644 --- a/src/USER-OMP/improper_cossq_omp.cpp +++ b/src/USER-OMP/improper_cossq_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "improper_cossq_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/improper_cvff_omp.cpp b/src/USER-OMP/improper_cvff_omp.cpp index 1d252fee5b8506876d62daa9b21864fe267d01fd..cba14226ac870029c3e6971155b5a6250eef3ba7 100644 --- a/src/USER-OMP/improper_cvff_omp.cpp +++ b/src/USER-OMP/improper_cvff_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "improper_cvff_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/improper_fourier_omp.cpp b/src/USER-OMP/improper_fourier_omp.cpp index 6c32c8e538b3edd7b62847bf2175f1e279f7bb3c..9e7912e33559fac1d3c1dc1a14eafd25a506a14a 100644 --- a/src/USER-OMP/improper_fourier_omp.cpp +++ b/src/USER-OMP/improper_fourier_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "improper_fourier_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/improper_harmonic_omp.cpp b/src/USER-OMP/improper_harmonic_omp.cpp index e323b75e3f4bbfa29875e8f6deefd8b4b7ef2cf8..8c1f91ecabb6213fe884cccfb7ecde71bedd9ada 100644 --- a/src/USER-OMP/improper_harmonic_omp.cpp +++ b/src/USER-OMP/improper_harmonic_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "improper_harmonic_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/improper_ring_omp.cpp b/src/USER-OMP/improper_ring_omp.cpp index c1737a4f2160c1bb573dd2b613b0456940811e04..bd7593c51ab2311e22d29d6114ef67fdbaa44f09 100644 --- a/src/USER-OMP/improper_ring_omp.cpp +++ b/src/USER-OMP/improper_ring_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "improper_ring_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/improper_umbrella_omp.cpp b/src/USER-OMP/improper_umbrella_omp.cpp index f100d3a0a9fcad9290ac82af43deda5d4985e5cf..9d28e25053120c4a37235c9ac7914647eb8ac8d4 100644 --- a/src/USER-OMP/improper_umbrella_omp.cpp +++ b/src/USER-OMP/improper_umbrella_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "improper_umbrella_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index 26926ab775ccd78ab8ee7f781e4788021c7e74f5..93379c8d3bd9956c5ab6a0c4b7fffb3534c364a8 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -16,11 +16,11 @@ Original MSM class by: Paul Crozier, Stan Moore, Stephen Bond, (all SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "atom.h" #include "gridcomm.h" diff --git a/src/USER-OMP/pair_adp_omp.cpp b/src/USER-OMP/pair_adp_omp.cpp index ec63dead89edf6476bab822ada447194fd8496ab..658ef365a37c7948d36f8aea27feaa3b1f1b680a 100644 --- a/src/USER-OMP/pair_adp_omp.cpp +++ b/src/USER-OMP/pair_adp_omp.cpp @@ -12,8 +12,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "pair_adp_omp.h" #include "atom.h" diff --git a/src/USER-OMP/pair_airebo_omp.cpp b/src/USER-OMP/pair_airebo_omp.cpp index f2149088c171a6b98c5f87a7ed3a3f85203229f8..8215e9967dd8c155a5a671daf7fb2150eb814b93 100644 --- a/src/USER-OMP/pair_airebo_omp.cpp +++ b/src/USER-OMP/pair_airebo_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_airebo_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_beck_omp.cpp b/src/USER-OMP/pair_beck_omp.cpp index 3e261aa2fd9374e2ad307a11a679fd36355611b4..e56a0dc7faf1ac4b3ae8fa5442142b56d998b336 100644 --- a/src/USER-OMP/pair_beck_omp.cpp +++ b/src/USER-OMP/pair_beck_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_beck_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_born_coul_long_omp.cpp b/src/USER-OMP/pair_born_coul_long_omp.cpp index 06e6da9d2c80ef3641a8ddac507839aee9e492b5..cbb71dfeb54e65c728d6f22b2f493c3186c03247 100644 --- a/src/USER-OMP/pair_born_coul_long_omp.cpp +++ b/src/USER-OMP/pair_born_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_born_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_born_coul_msm_omp.cpp b/src/USER-OMP/pair_born_coul_msm_omp.cpp index bd282cfaa9d7bf5dca3bdeb28032525b5b182925..8ce564ccfabd10c2f8c3be2748822f430728327f 100755 --- a/src/USER-OMP/pair_born_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_born_coul_msm_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_born_coul_msm_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_born_coul_wolf_omp.cpp b/src/USER-OMP/pair_born_coul_wolf_omp.cpp index 90913320801740c3c08ecd30ae51dc82c8d160d9..bd3e539dd65dd030858b590754eed655fd3c6165 100644 --- a/src/USER-OMP/pair_born_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_born_coul_wolf_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_born_coul_wolf_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_born_omp.cpp b/src/USER-OMP/pair_born_omp.cpp index 01fdc1d0123e849604a072aabe89119259289aa0..35669cb53955f3f9aca601efbafcda37b501998a 100644 --- a/src/USER-OMP/pair_born_omp.cpp +++ b/src/USER-OMP/pair_born_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_born_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp index 8412644ff3ccda8939b8c64aa637ef2a7239f1a6..9ea6a9187b75c0422043e7161a5c8d909618d32a 100644 --- a/src/USER-OMP/pair_brownian_omp.cpp +++ b/src/USER-OMP/pair_brownian_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_brownian_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp index e0124204de7bbed26dcb9ab30cfe46ae37686cab..d8cb3bf06e158454212026bd6d980cbae1dadcdf 100644 --- a/src/USER-OMP/pair_brownian_poly_omp.cpp +++ b/src/USER-OMP/pair_brownian_poly_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_brownian_poly_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_buck_coul_cut_omp.cpp b/src/USER-OMP/pair_buck_coul_cut_omp.cpp index 054493cc01d1efefcdaccbe4396339390bf6d9bc..ead60d70acc76e2fb650aa840a4550a716d93ded 100644 --- a/src/USER-OMP/pair_buck_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_buck_coul_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_buck_coul_long_omp.cpp b/src/USER-OMP/pair_buck_coul_long_omp.cpp index 6ab1a851b76cf1351f789dc2988df852a4dcc570..48750f83181049664dd52618bf4ebb8aff3a0393 100644 --- a/src/USER-OMP/pair_buck_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_buck_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_buck_coul_msm_omp.cpp b/src/USER-OMP/pair_buck_coul_msm_omp.cpp index bd59dccf7d071dbba20481e9af57d78170f0aebb..df94efc81232cc9547d01f9fabadfb30d6fda81e 100755 --- a/src/USER-OMP/pair_buck_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_msm_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_buck_coul_msm_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp index 2443b0a61ddda087adc9249daa1e40bc1389030f..87f9e2e3216596e59fa753db42b51520c677c1e5 100644 --- a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "math_vector.h" #include "pair_buck_long_coul_long_omp.h" #include "atom.h" diff --git a/src/USER-OMP/pair_buck_omp.cpp b/src/USER-OMP/pair_buck_omp.cpp index 0b8dbc7f685ff7fbfedab6bde8636d9df25325fd..826fd78deb3368a0745b3f6ee2717c10e1376c58 100644 --- a/src/USER-OMP/pair_buck_omp.cpp +++ b/src/USER-OMP/pair_buck_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_buck_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_cdeam_omp.cpp b/src/USER-OMP/pair_cdeam_omp.cpp index cb1f201a9e85b13b330a68b99a4d96ada6bff7f8..3bfe74e129d391af143d3301a06f1b1e6f91326c 100644 --- a/src/USER-OMP/pair_cdeam_omp.cpp +++ b/src/USER-OMP/pair_cdeam_omp.cpp @@ -12,8 +12,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "pair_cdeam_omp.h" #include "atom.h" diff --git a/src/USER-OMP/pair_colloid_omp.cpp b/src/USER-OMP/pair_colloid_omp.cpp index e3b6472c2a703d77a41c4e19f820806e1d84c369..4c6411f1509f86973731a699d241836571a14ea7 100644 --- a/src/USER-OMP/pair_colloid_omp.cpp +++ b/src/USER-OMP/pair_colloid_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_colloid_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index a075ee1f6a1d0b39bba02f4b6a856fa50ab08118..c776ff3026d49a75aacaa5c5784e59c76e8c5395 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_comb_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_cut_omp.cpp b/src/USER-OMP/pair_coul_cut_omp.cpp index 14786186825c7e3242fd260a2dae634830344000..381e7f83c208c97980f11c0fec8be31d2b7b5782 100644 --- a/src/USER-OMP/pair_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_coul_cut_soft_omp.cpp index da6760902ef65b429520b85f47e11b407cc251ca..af9c9472fa788b827ac0eaf18f09d2db782e3d90 100644 --- a/src/USER-OMP/pair_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_cut_soft_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_debye_omp.cpp b/src/USER-OMP/pair_coul_debye_omp.cpp index 47d3dab99e1793b356b9e56a47fb073d2b0830f6..0d9b1179674495710e42c4a8a578d71f8c0b44ea 100644 --- a/src/USER-OMP/pair_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_coul_debye_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_debye_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_diel_omp.cpp b/src/USER-OMP/pair_coul_diel_omp.cpp index b100c5053b58c478de1adacd2f2fd59b51aeb0f0..577ba6bf65a9b49e0a22e1dcd04257cc0bde947b 100644 --- a/src/USER-OMP/pair_coul_diel_omp.cpp +++ b/src/USER-OMP/pair_coul_diel_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_diel_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_dsf_omp.cpp b/src/USER-OMP/pair_coul_dsf_omp.cpp index c85ede20ee14d4002d02bdb81b4735574c918c42..4707fad733520cca8fca7e02f87753e543f085c0 100644 --- a/src/USER-OMP/pair_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_coul_dsf_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_dsf_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_long_omp.cpp b/src/USER-OMP/pair_coul_long_omp.cpp index d77a88198bb8fe244f340575629758e81cc87d72..dc619913d6ef82c9c2e141ac5128617b7c25744c 100644 --- a/src/USER-OMP/pair_coul_long_omp.cpp +++ b/src/USER-OMP/pair_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_long_soft_omp.cpp b/src/USER-OMP/pair_coul_long_soft_omp.cpp index 1246bb10ae7a6c90b00ea54e65f5419d490fa9b4..f44f95717d10e5fcef2f12dd32a94f6e492d17f2 100644 --- a/src/USER-OMP/pair_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_long_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_long_soft_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_msm_omp.cpp b/src/USER-OMP/pair_coul_msm_omp.cpp index 870afb780661beb025820300130388e1a8388541..baf9ceefb5b4957e83d7408243c791d0ff67b3cd 100755 --- a/src/USER-OMP/pair_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_coul_msm_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_msm_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_coul_wolf_omp.cpp b/src/USER-OMP/pair_coul_wolf_omp.cpp index bcc19af0fe4fce99bc32c2f519304a63add62353..c5080bc7de2185f860530235e48f496da1a8dd34 100644 --- a/src/USER-OMP/pair_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_coul_wolf_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_coul_wolf_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_dpd_omp.cpp b/src/USER-OMP/pair_dpd_omp.cpp index 625d5bc19fb96cb6398c960ce8761f015f372652..98e5af0d814cdeb429057ae23dc8837a6efec27b 100644 --- a/src/USER-OMP/pair_dpd_omp.cpp +++ b/src/USER-OMP/pair_dpd_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_dpd_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_dpd_tstat_omp.cpp b/src/USER-OMP/pair_dpd_tstat_omp.cpp index 37b2994e3d747d076df2e90c5f517502d3056e96..ee697a2e96f687b404091b5055a3de4bc4e4d791 100644 --- a/src/USER-OMP/pair_dpd_tstat_omp.cpp +++ b/src/USER-OMP/pair_dpd_tstat_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_dpd_tstat_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_eam_alloy_omp.cpp b/src/USER-OMP/pair_eam_alloy_omp.cpp index 40a93c143eeeb9626497187e0b253a342891c520..f0c0b5272b00173c74403f54a2e24aa295222148 100644 --- a/src/USER-OMP/pair_eam_alloy_omp.cpp +++ b/src/USER-OMP/pair_eam_alloy_omp.cpp @@ -15,9 +15,9 @@ Contributing authors: Stephen Foiles (SNL), Murray Daw (SNL) ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eam_alloy_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_eam_fs_omp.cpp b/src/USER-OMP/pair_eam_fs_omp.cpp index ec12bcefad9bd1e3e97bd5def4b8ca2457240255..5a104fde6d6e72cfab50f26aa853a291d7b29fc2 100644 --- a/src/USER-OMP/pair_eam_fs_omp.cpp +++ b/src/USER-OMP/pair_eam_fs_omp.cpp @@ -15,9 +15,9 @@ Contributing authors: Tim Lau (MIT) ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_eam_fs_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_eam_omp.cpp b/src/USER-OMP/pair_eam_omp.cpp index cff4daf5eaf8fb5f33675499878d73aa783e006f..6b4ac4363eb3fd5dff8eb471f4d5627c31b19552 100644 --- a/src/USER-OMP/pair_eam_omp.cpp +++ b/src/USER-OMP/pair_eam_omp.cpp @@ -12,8 +12,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "pair_eam_omp.h" #include "atom.h" diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index f86d8ebcbc907570a636b4f47aae692fab2dd342..7c503ea8aa13057c9149a3116c92336c0b7aa0a0 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_edip_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_eim_omp.cpp b/src/USER-OMP/pair_eim_omp.cpp index 501c282f79bb524aa05b942f21b79ed0481dfcd1..e98c035860c74289548fbc2ee17333875093c5ad 100644 --- a/src/USER-OMP/pair_eim_omp.cpp +++ b/src/USER-OMP/pair_eim_omp.cpp @@ -12,8 +12,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "pair_eim_omp.h" #include "atom.h" diff --git a/src/USER-OMP/pair_gauss_cut_omp.cpp b/src/USER-OMP/pair_gauss_cut_omp.cpp index e80768d5afb13bebda7412a83d39f2a8d2e7e533..ad0eb77963448d92a2a7e3c9c9b491c99b7c638c 100644 --- a/src/USER-OMP/pair_gauss_cut_omp.cpp +++ b/src/USER-OMP/pair_gauss_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_gauss_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_gauss_omp.cpp b/src/USER-OMP/pair_gauss_omp.cpp index 4d8b477465400cff371339f836c14d854316cb2d..062da924e32b2f3b4f63560b093db792dac99caf 100644 --- a/src/USER-OMP/pair_gauss_omp.cpp +++ b/src/USER-OMP/pair_gauss_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_gauss_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_gayberne_omp.cpp b/src/USER-OMP/pair_gayberne_omp.cpp index 031b1d4dddffa67e323edf8847e694986f5744f7..54e4496f22efcb5954fdee9c83c91024e1d48a01 100644 --- a/src/USER-OMP/pair_gayberne_omp.cpp +++ b/src/USER-OMP/pair_gayberne_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_gayberne_omp.h" #include "math_extra.h" #include "atom.h" diff --git a/src/USER-OMP/pair_gran_hertz_history_omp.cpp b/src/USER-OMP/pair_gran_hertz_history_omp.cpp index d684fde19d35350637758669eaaa5a8e6a86a0f2..36873a485201e3a52dc2959368f300810926abbc 100644 --- a/src/USER-OMP/pair_gran_hertz_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hertz_history_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_gran_hertz_history_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_gran_hooke_history_omp.cpp b/src/USER-OMP/pair_gran_hooke_history_omp.cpp index 3da16dea166de60a6f49e1c540e495d69408f6c8..545d93cccba2365a3e9ad2d6454b58f2b952ca84 100644 --- a/src/USER-OMP/pair_gran_hooke_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_history_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_gran_hooke_history_omp.h" #include "atom.h" #include "comm.h" @@ -23,7 +23,7 @@ #include "neigh_list.h" #include "update.h" -#include "string.h" +#include <string.h> #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_gran_hooke_omp.cpp b/src/USER-OMP/pair_gran_hooke_omp.cpp index c4e792708f71d52c8bb9f38c466247d58667efbf..3197b7076e8c09740ea75d1bd84950b4d8a67777 100644 --- a/src/USER-OMP/pair_gran_hooke_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_gran_hooke_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp index 26c456c17009b04e0a7e204c6a95e0c72122ee88..c22efffb5a8edca99cdfb486de5cfaab76dbcd26 100644 --- a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_hbond_dreiding_lj_omp.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp index 557852fb2d4c4ccacc860636ea0ad8af6b089ad2..7debe5a68a6f41ecbce2680e9c6671178af43288 100644 --- a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_hbond_dreiding_morse_omp.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/USER-OMP/pair_line_lj_omp.cpp b/src/USER-OMP/pair_line_lj_omp.cpp index 8a9cf0b0d2069fc254e4ce8ba77b09a9f29e0271..144a9f04f26c67fb9730d57acb1b6df5492654eb 100644 --- a/src/USER-OMP/pair_line_lj_omp.cpp +++ b/src/USER-OMP/pair_line_lj_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_line_lj_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj96_cut_omp.cpp b/src/USER-OMP/pair_lj96_cut_omp.cpp index 451d876a48b81f04d8342f04a8bbebaa25668d19..e502a93acfb1d711426b0660c401cdd16413eeb3 100644 --- a/src/USER-OMP/pair_lj96_cut_omp.cpp +++ b/src/USER-OMP/pair_lj96_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj96_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index b8f9d68807ba2d8068ebc129cac740fe9b45098a..1333ae27613e15beead53eac127fed836b52e28e 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_charmm_coul_charmm_implicit_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp index 35f3867c9d7185d5e3361aa7ea458489de5da884..880fa4006849c9e67cd5d4f337c1f1c54440e957 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_charmm_coul_charmm_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp index caaeb8f916a3464b204773592bef169a3e18a023..acbf61d9fd717dfc403c219e180ca01fe88983b2 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_charmm_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp index a1ccbffab462521d6fe6a878a564e07f43e5e123..4953c89a4d55142adade87e72685e5380f2085a4 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_charmm_coul_long_soft_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp index 2fcfe213a42d6d8d276f66e98e272dd82c1963ca..c603f0dd3a01aa78d2c8b9d5cb29e0d8f1393f6c 100755 --- a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_charmm_coul_msm_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp index 1ba825ab8e19f256d3952302a1941a107a9d515d..98c2b0d578eaf153ee44d271b4db4cd1c82e03a0 100644 --- a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_class2_coul_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp index 6b535a59a55640020212f816830d1c2c769b7878..3038332c905e7e69b4730816b1457519e632d19d 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_class2_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_class2_omp.cpp b/src/USER-OMP/pair_lj_class2_omp.cpp index 8c920ab9a88b71ba4a17779246e2e7b024600b6a..ffb0ceaa0a0f762ee63d8384b015bd2c4a1400fc 100644 --- a/src/USER-OMP/pair_lj_class2_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_class2_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index 2caf4620a3fec781588494e45674a06b22c8b1ed..1cea0f454a7199fbe54e6193b4ed75285b7cc1b5 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cubic_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp index 49c7ba128b21328d118d79a74a6d36dd9844ccc0..1f48b4245ec7f53b73807fe5f9ad5481e15674fa 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp index f6db06a51ca124cc6d6c6adb600fbbd86fc4ddfd..f6ba7236a03f1700836098f2fd7dd5c19155f903 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_cut_soft_omp.h" #include "atom.h" #include "comm.h" @@ -136,7 +136,7 @@ void PairLJCutCoulCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; @@ -156,7 +156,7 @@ void PairLJCutCoulCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = factor_coul * qqrd2e * lj1[itype][jtype] * qtmp*q[j] / denc; else ecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; diff --git a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp index 405755ecbbc2419dcd8c494986abac63b1bf1c70..9fc64cf38cdd6ea40564e09779f2958118d92f68 100644 --- a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_debye_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp index f33ea97e9c0e660558840304416fb2a97fbe1faa..d0b6c1b2dc3d108d24de94d2a0ebc9680baed248 100644 --- a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_dsf_omp.h" #include "atom.h" #include "comm.h" @@ -155,7 +155,7 @@ void PairLJCutCoulDSFOMP::eval(int iifrom, int iito, ThrData * const thr) erfcd = exp(-alpha*alpha*r*r); t = 1.0 / (1.0 + EWALD_P*alpha*r); erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } else forcecoul = 0.0; diff --git a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp index 842b84270c28c1c24cd238d617ed2a5749cfd976..6746cf97015500e894a6c0bbf7f5a362a0856452 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp index cdfd4a4c2d03274ea632c0fdaba08609504ad045..5f0a3d57c4cd940d3bd3db8a408942e633a8d4c0 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_long_soft_omp.h" #include "atom.h" #include "comm.h" @@ -144,10 +144,10 @@ void PairLJCutCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) expm2 = exp(-grij*grij); t = 1.0 / (1.0 + EWALD_P*grij); erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; - + denc = sqrt(lj4[itype][jtype] + rsq); prefactor = qqrd2e * lj1[itype][jtype] * qtmp*q[j] / (denc*denc*denc); - + forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } else forcecoul = 0.0; @@ -155,7 +155,7 @@ void PairLJCutCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) if (rsq < cut_ljsq[itype][jtype]) { r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); } else forcelj = 0.0; @@ -178,7 +178,7 @@ void PairLJCutCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) } else ecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; diff --git a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp index 4b53b7784b2d09d7af7b7a9646b594d3fc1351bf..fba8f552db565aa9df09c1e9eb176f31111ea5c1 100755 --- a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_coul_msm_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp index 8c22961c1e3ac3598d3e87764746fb40a39b5468..d9fd7ac72e1473389642ae650a77a480d794e1a9 100755 --- a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_dipole_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_omp.cpp index 5804e411191d5567a95fc285cd435e74353d9f40..34754975fb53f14de1997ebabfe165c05f86425c 100644 --- a/src/USER-OMP/pair_lj_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_soft_omp.cpp index 92f0cc339f226be0b45a2e525cb55d3565fbc793..9147b9aa1c9e811d7fae59dc6bcdd3af1d1950be 100644 --- a/src/USER-OMP/pair_lj_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_soft_omp.h" #include "atom.h" #include "comm.h" @@ -126,7 +126,7 @@ void PairLJCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) r4sig6 = rsq*rsq / lj2i[jtype]; denlj = lj3i[jtype] + rsq*r4sig6; - forcelj = lj1i[jtype] * epsi[jtype] * + forcelj = lj1i[jtype] * epsi[jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); fpair = factor_lj*forcelj; @@ -141,7 +141,7 @@ void PairLJCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) } if (EFLAG) { - evdwl = lj1i[jtype] * 4.0 * epsi[jtype] * + evdwl = lj1i[jtype] * 4.0 * epsi[jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offseti[jtype]; evdwl *= factor_lj; } diff --git a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp index 5bc0165120e9db9b6b1f6e7ce007000553fb5a06..3b028fb67b76ecacee98621cbf97e23ab83fe90e 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_tip4p_cut_omp.h" #include "atom.h" #include "domain.h" diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp index 3646c0a2e827925a7da32c6f43b1f387c9336049..70be3e5228ace5d60ef650ab3925f4948119aa2d 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_tip4p_long_omp.h" #include "atom.h" #include "domain.h" diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp index 047b42775dae0202e31454c73f6761e62479b844..2d4be0d884d6b5a36d9b377de6b74e0809d0f244 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_cut_tip4p_long_soft_omp.h" #include "atom.h" #include "domain.h" @@ -218,7 +218,7 @@ void PairLJCutTIP4PLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) r4sig6 = rsq*rsq / lj2[itype][jtype]; denlj = lj3[itype][jtype] + rsq*r4sig6; - forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * + forcelj = lj1[itype][jtype] * epsilon[itype][jtype] * (48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj)); forcelj *= factor_lj; @@ -231,7 +231,7 @@ void PairLJCutTIP4PLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) f[j].z -= delz*forcelj; if (EFLAG) { - evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * + evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] * (1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype]; evdwl *= factor_lj; } else evdwl = 0.0; diff --git a/src/USER-OMP/pair_lj_expand_omp.cpp b/src/USER-OMP/pair_lj_expand_omp.cpp index 187cc5f78dc43f97ba2afbfe16147098a3d40ed0..e0f64e471e46285511b3ac403a64ec02c12a0b36 100644 --- a/src/USER-OMP/pair_lj_expand_omp.cpp +++ b/src/USER-OMP/pair_lj_expand_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_expand_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp index 3e3fbbc9ddedd41403ffc4a6fc84c61e5074f39d..954fbe7cce751ce4036b022ae18c9b2c35994077 100644 --- a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_gromacs_coul_gromacs_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_omp.cpp index 618e20ab663d4d282d5d67be6b9b9e59ffa9499b..84c46886e10ec43c4dba2e3ed10508dca5c1cdfc 100644 --- a/src/USER-OMP/pair_lj_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_gromacs_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp index 23a2bc3cc45c4a3190ee41af49cd80b9ee7e34b7..28d4f229c8c25b0ced8b4d4578fd0468b2c7442f 100644 --- a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_long_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp index 4c86ce7d33a098022a3e807d17442b6bf7c10578..f04e6380c82135bb00928de48238d8e1b3fa0466 100644 --- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_long_tip4p_long_omp.h" #include "atom.h" #include "comm.h" @@ -1158,7 +1158,7 @@ void PairLJLongTIP4PLongOMP::eval_inner(int iifrom, int iito, ThrData * const th jtype = type[j]; if (rsq < cut_ljsq[itype][jtype] && rsq < cut_out_off_sq ) { // lj - r2inv = 1.0/rsq; + r2inv = 1.0/rsq; register double rn = r2inv*r2inv*r2inv; if (ni == 0) forcelj = rn*(rn*lj1i[jtype]-lj2i[jtype]); else { // special case @@ -1397,7 +1397,7 @@ void PairLJLongTIP4PLongOMP::eval_middle(int iifrom, int iito, ThrData * const t jtype = type[j]; if (rsq < cut_ljsq[itype][jtype] && rsq >= cut_in_off_sq && rsq <= cut_out_off_sq ) { // lj - r2inv = 1.0/rsq; + r2inv = 1.0/rsq; register double rn = r2inv*r2inv*r2inv; if (ni == 0) forcelj = rn*(rn*lj1i[jtype]-lj2i[jtype]); else { // special case diff --git a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp index c86a1f6c0e31224840a656ae15661eb8e83f4a20..f388009bd808d12d6c6243bd6862fa38f1ec2328 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_sdk_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp index 95013932e8e19050a35a21ec1d78e4f4ef727559..9d991d5812ea7a1f88d929be5d2ac3b03c9dbf64 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp @@ -13,7 +13,7 @@ This style is a simplified re-implementation of the CG/CMM pair style ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_sdk_coul_msm_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_sdk_omp.cpp b/src/USER-OMP/pair_lj_sdk_omp.cpp index ca32528ee0cedacff316f5ff71bc080cf7ca2ca5..36e170046dbe45512fc843b4ec0ae69b802391a2 100644 --- a/src/USER-OMP/pair_lj_sdk_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_omp.cpp @@ -13,7 +13,7 @@ This style is a simplified re-implementation of the CG/CMM pair style ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_sdk_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp index 572c775467b8ee6b372dcabc5bdae0a35873268a..67afbbeefece7e5dc3f98683868f278f8fe1b7bc 100755 --- a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_sf_dipole_sf_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_omp.cpp index c1bdbcc93ee3a256cf2bd39f951e67331287e1af..bd9d5220b8f26cb21b3da11d7e835965b2d84d61 100644 --- a/src/USER-OMP/pair_lj_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_sf_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp index 6ad61b0dbf439ffd61405c8f4ec01f3cecaf1d13..9017ac740fb8d6ac6070b6295089898643bf31ca 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_smooth_linear_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lj_smooth_omp.cpp b/src/USER-OMP/pair_lj_smooth_omp.cpp index d2eee111026329efad81a5c2b8d257264e6ab396..9bf15035bdce3604c09739d3cd0a4c43de434cf9 100644 --- a/src/USER-OMP/pair_lj_smooth_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lj_smooth_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp index 3da80c8c5afaffa310e7f70caceaa67981a28e0e..1c622f5641035b743b3be6c08f6b7cebf13ea160 100644 --- a/src/USER-OMP/pair_lubricate_omp.cpp +++ b/src/USER-OMP/pair_lubricate_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lubricate_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp index abe27b7434d96007ecc9164eba42b2c4cb0d4633..f2e873ea45fea7fabb1be81d0e9c2af74ae78439 100644 --- a/src/USER-OMP/pair_lubricate_poly_omp.cpp +++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_lubricate_poly_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_meam_spline_omp.cpp b/src/USER-OMP/pair_meam_spline_omp.cpp index ebe576e59b6898e3524ad61e1070ec2106d7155c..98e15413190486d460653f589e6bafea230ab28e 100644 --- a/src/USER-OMP/pair_meam_spline_omp.cpp +++ b/src/USER-OMP/pair_meam_spline_omp.cpp @@ -12,8 +12,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "pair_meam_spline_omp.h" #include "atom.h" diff --git a/src/USER-OMP/pair_morse_omp.cpp b/src/USER-OMP/pair_morse_omp.cpp index b27829d8974f7d5a427adaaf1ee526f2a212410d..8aca4ef98f6c1ba0f939e54e198ad66134523fa3 100644 --- a/src/USER-OMP/pair_morse_omp.cpp +++ b/src/USER-OMP/pair_morse_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_morse_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_nb3b_harmonic_omp.cpp b/src/USER-OMP/pair_nb3b_harmonic_omp.cpp index d86d1eadf5a5a86d47ec7926def5670aacb982d1..199cbc93371b464c80626eef1b3b9d1438ff9ffa 100644 --- a/src/USER-OMP/pair_nb3b_harmonic_omp.cpp +++ b/src/USER-OMP/pair_nb3b_harmonic_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_nb3b_harmonic_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp index f4fa780c60246167cfec4d3a2f6ad9780bcfb187..38af84d1f73775b6de427ee960f7d7097c653632 100644 --- a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_nm_cut_coul_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp index c5e7ebd621a6a1fbb170ee08a3a5b19c683238ca..bbcdfb26c3c20c377002ae553a1eae47ec8d43c3 100644 --- a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_nm_cut_coul_long_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_nm_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_omp.cpp index a988633acf809f678368d079cdcf240a4c46df2d..ea2d0fa7f5c7a368f3c117d1dfe91037e77b0ade 100644 --- a/src/USER-OMP/pair_nm_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_nm_cut_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_peri_lps_omp.cpp b/src/USER-OMP/pair_peri_lps_omp.cpp index 92b70371270e54edcf64fff90d2e06337c956960..4876e6b15f0f67c7fde3228c06745b626f5ac6c5 100644 --- a/src/USER-OMP/pair_peri_lps_omp.cpp +++ b/src/USER-OMP/pair_peri_lps_omp.cpp @@ -12,8 +12,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "float.h" +#include <math.h> +#include <float.h> #include "pair_peri_lps_omp.h" #include "fix.h" #include "fix_peri_neigh.h" diff --git a/src/USER-OMP/pair_peri_pmb_omp.cpp b/src/USER-OMP/pair_peri_pmb_omp.cpp index 8895b3ba6c87c05bd14cd271d4a827e5796a0e0b..1c14ff753cf8e57820f04642bb0659b9798a960b 100644 --- a/src/USER-OMP/pair_peri_pmb_omp.cpp +++ b/src/USER-OMP/pair_peri_pmb_omp.cpp @@ -12,8 +12,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "float.h" +#include <math.h> +#include <float.h> #include "pair_peri_pmb_omp.h" #include "fix.h" #include "fix_peri_neigh.h" diff --git a/src/USER-OMP/pair_resquared_omp.cpp b/src/USER-OMP/pair_resquared_omp.cpp index c38070304dca3b37a16e9b209740b74db4f14468..a1364133d005b1ac51368a0ee4726c12e6c39e58 100644 --- a/src/USER-OMP/pair_resquared_omp.cpp +++ b/src/USER-OMP/pair_resquared_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_resquared_omp.h" #include "math_extra.h" #include "atom.h" diff --git a/src/USER-OMP/pair_soft_omp.cpp b/src/USER-OMP/pair_soft_omp.cpp index 51cac9106bf81198f53350a08a34231b3fd9ef42..9a926652a853d12a0e2fef51ddfb03c19b889359 100644 --- a/src/USER-OMP/pair_soft_omp.cpp +++ b/src/USER-OMP/pair_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_soft_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index d9547d0bd7d092e24be3e6626215ce46e0b19ac1..ba7eeacae1df8be1c050834610e83e4c05a10b5a 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_sw_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_table_omp.cpp b/src/USER-OMP/pair_table_omp.cpp index f8c6a9f186160bd0d9b49db9a6775d7f8a88e091..d584061648a2188530003bac065c27a06886c8b9 100644 --- a/src/USER-OMP/pair_table_omp.cpp +++ b/src/USER-OMP/pair_table_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_table_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_tersoff_mod_omp.cpp b/src/USER-OMP/pair_tersoff_mod_omp.cpp index 907bb9e0782ed3fc50bf22cd3e6fd0c460452b49..403a61147beab5136ca5ff773061cb5948aeefcf 100644 --- a/src/USER-OMP/pair_tersoff_mod_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_tersoff_mod_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index ff0f41b282f0f1024b82f98d5f78f276e9a9ed9b..71d00108dfdec0d0d0750f27538c68f90bf728fa 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_tersoff_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index ece331abd90bbed308f7c4c8bf6ea006030f4370..9de9ee57086c03d411c83c5be8ec684b6c6f1375 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_tersoff_table_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_tersoff_zbl_omp.cpp b/src/USER-OMP/pair_tersoff_zbl_omp.cpp index b92378d50d09184cee4df6fd9cc9be30378dd5b7..f5c08741ce44ba59dab6b9dbfe6c20ab938f64c4 100644 --- a/src/USER-OMP/pair_tersoff_zbl_omp.cpp +++ b/src/USER-OMP/pair_tersoff_zbl_omp.cpp @@ -16,10 +16,10 @@ David Farrell (NWU) - ZBL addition ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_tersoff_zbl_omp.h" #include "atom.h" #include "update.h" diff --git a/src/USER-OMP/pair_tip4p_cut_omp.cpp b/src/USER-OMP/pair_tip4p_cut_omp.cpp index 72c582acb8f1b4c9e0c20f8f1bafbd9e91644cbc..2b125fde7fafd4bfac9a9a504b1d1aa880f52a0a 100644 --- a/src/USER-OMP/pair_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_tip4p_cut_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_tip4p_cut_omp.h" #include "atom.h" #include "domain.h" diff --git a/src/USER-OMP/pair_tip4p_long_omp.cpp b/src/USER-OMP/pair_tip4p_long_omp.cpp index 3476ed5928d22eaad8e29250d47eb88025c2f427..96ebc64a90f40629d02001927137eb5bf6aa23e4 100644 --- a/src/USER-OMP/pair_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_tip4p_long_omp.h" #include "atom.h" #include "domain.h" diff --git a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp index f693e0a06a102bca0d5b08142134b071fc0825df..ac3bcfc3939010d31e6d03b9f461eb0e91f3c9a2 100644 --- a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_tip4p_long_soft_omp.h" #include "atom.h" #include "domain.h" @@ -260,7 +260,7 @@ void PairTIP4PLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; denc = sqrt(lam2[itype][jtype] + rsq); - prefactor = qqrd2e * lam1[itype][jtype] + prefactor = qqrd2e * lam1[itype][jtype] * qtmp*q[j] / (denc*denc*denc); forcecoul = prefactor * (erfc + EWALD_F*grij*expm2); diff --git a/src/USER-OMP/pair_tri_lj_omp.cpp b/src/USER-OMP/pair_tri_lj_omp.cpp index 3e1e1fe93f47d53faab8979bce52a2621dc62641..94b84316bd9a8abce135b732d1207993f875de07 100644 --- a/src/USER-OMP/pair_tri_lj_omp.cpp +++ b/src/USER-OMP/pair_tri_lj_omp.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_tri_lj_omp.h" #include "math_extra.h" #include "atom.h" diff --git a/src/USER-OMP/pair_vashishta_omp.cpp b/src/USER-OMP/pair_vashishta_omp.cpp index f89b2ad184c08abb69913aedbe04857e0566b339..679eceab503669113a532401e355702968ad7bb3 100644 --- a/src/USER-OMP/pair_vashishta_omp.cpp +++ b/src/USER-OMP/pair_vashishta_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_vashishta_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_yukawa_colloid_omp.cpp b/src/USER-OMP/pair_yukawa_colloid_omp.cpp index c3c73fab58aa2f9ed45446e4589c416a8d063e78..cc05fc91559893e02418f4e902317ebba82117c5 100644 --- a/src/USER-OMP/pair_yukawa_colloid_omp.cpp +++ b/src/USER-OMP/pair_yukawa_colloid_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_yukawa_colloid_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_yukawa_omp.cpp b/src/USER-OMP/pair_yukawa_omp.cpp index 9bb0dea9c37a5afbba1c512c9c9d51e35fe01329..c705446f052710f3468139c9c7dba5fac709e10a 100644 --- a/src/USER-OMP/pair_yukawa_omp.cpp +++ b/src/USER-OMP/pair_yukawa_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_yukawa_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/pair_zbl_omp.cpp b/src/USER-OMP/pair_zbl_omp.cpp index 281ee52acb4acaba89e3706cbdc84ba602b16bba..1d69487eb2d65639993ea0005764e6cc0e3393cd 100644 --- a/src/USER-OMP/pair_zbl_omp.cpp +++ b/src/USER-OMP/pair_zbl_omp.cpp @@ -12,7 +12,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_zbl_omp.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-OMP/respa_omp.cpp b/src/USER-OMP/respa_omp.cpp index e3e425a77f084379d3cac4837cb801cce2b05f05..d925088edaa9afc1200c3c7e2764d28cc49188c9 100644 --- a/src/USER-OMP/respa_omp.cpp +++ b/src/USER-OMP/respa_omp.cpp @@ -15,8 +15,8 @@ Contributing authors: Mark Stevens (SNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "respa_omp.h" #include "neighbor.h" #include "domain.h" diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index b0d09c146f78bc075c1501ffb705c533025ba5b5..db20eab300f476f3102a30c9cfb30346f286fdad 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -23,7 +23,7 @@ konglt@sjtu.edu.cn; konglt@gmail.com ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_phonon.h" #include "atom.h" #include "compute.h" @@ -64,7 +64,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - + if (narg < 8) error->all(FLERR,"Illegal fix phonon command: number of arguments < 8"); nevery = force->inumeric(FLERR, arg[3]); // Calculate this fix every n steps! @@ -85,7 +85,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) strcpy(prefix, arg[7]); logfile = new char[n+4]; sprintf(logfile,"%s.log",prefix); - + int sdim = sysdim = domain->dimension; int iarg = 8; nasr = 20; @@ -165,10 +165,10 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) memory->create(RIloc,ngroup,(sysdim+1),"fix_phonon:RIloc"); memory->create(RIall,ngroup,(sysdim+1),"fix_phonon:RIall"); memory->create(Rsort,ngroup, sysdim, "fix_phonon:Rsort"); - + memory->create(Rnow, MAX(1,mynpt),fft_dim,"fix_phonon:Rnow"); memory->create(Rsum, MAX(1,mynpt),fft_dim,"fix_phonon:Rsum"); - + memory->create(basis,nucell, sysdim, "fix_phonon:basis"); // because of hermit, only nearly half of q points are stored @@ -216,7 +216,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) fflush(flog); } surf2tag.clear(); - + // default temperature is from thermo TempSum = new double[sysdim]; id_temp = new char[12]; @@ -268,7 +268,7 @@ FixPhonon::~FixPhonon() // destroy FFT delete fft; memory->sfree(fft_data); - + // clear map info tag2surf.clear(); surf2tag.clear(); @@ -346,7 +346,7 @@ void FixPhonon::end_of_step() idx = tag2surf[itag]; domain->unmap(x[i], image[i], xcur); - + for (idim = 0; idim < sysdim; ++idim) RIloc[nfind][idim] = xcur[idim]; RIloc[nfind++][sysdim] = double(idx); } @@ -540,13 +540,13 @@ void FixPhonon::readmap() for (int i = 0; i < atom->nlocal; ++i){ if (atom->mask[i] & groupbit) tag_loc[nfind++] = atom->tag[i]; } - + // gather IDs on local proc displs[0] = 0; for (int i = 0; i < nprocs; ++i) recvcnts[i] = 0; MPI_Allgather(&nfind,1,MPI_INT,recvcnts,1,MPI_INT,world); for (int i = 1; i < nprocs; ++i) displs[i] = displs[i-1] + recvcnts[i-1]; - + MPI_Allgatherv(tag_loc,nfind,MPI_LMP_TAGINT,tag_all,recvcnts,displs,MPI_INT,world); for (int i = 0; i < ngroup; ++i){ itag = tag_all[i]; @@ -567,24 +567,24 @@ void FixPhonon::readmap() error->all(FLERR,line); } - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == NULL) error->all(FLERR,"Error while reading header of mapping file!"); nx = force->inumeric(FLERR, strtok(line, " \n\t\r\f")); ny = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); nz = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); nucell = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); ntotal = nx*ny*nz; - if (ntotal*nucell != ngroup) + if (ntotal*nucell != ngroup) error->all(FLERR,"FFT mesh and number of atoms in group mismatch!"); - + // second line of mapfile is comment - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == NULL) error->all(FLERR,"Error while reading comment of mapping file!"); int ix, iy, iz, iu; // the remaining lines carry the mapping info for (int i = 0; i < ngroup; ++i){ - if (fgets(line,MAXLINE,fp) == NULL) {info = 1; break;} + if (fgets(line,MAXLINE,fp) == NULL) {info = 1; break;} ix = force->inumeric(FLERR, strtok(line, " \n\t\r\f")); iy = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); iz = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); @@ -592,7 +592,7 @@ void FixPhonon::readmap() itag = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); // check if index is in correct range - if (ix < 0 || ix >= nx || iy < 0 || iy >= ny || + if (ix < 0 || ix >= nx || iy < 0 || iy >= ny || iz < 0 || iz >= nz || iu < 0 || iu >= nucell) {info = 2; break;} // 1 <= itag <= natoms if (itag < 1 || itag > static_cast<int>(atom->natoms)) {info = 3; break;} @@ -602,11 +602,11 @@ void FixPhonon::readmap() } fclose(fp); - if (tag2surf.size() != surf2tag.size() || + if (tag2surf.size() != surf2tag.size() || tag2surf.size() != static_cast<std::size_t>(ngroup) ) error->all(FLERR,"The mapping is incomplete!"); if (info) error->all(FLERR,"Error while reading mapping file!"); - + // check the correctness of mapping int *mask = atom->mask; tagint *tag = atom->tag; @@ -616,7 +616,7 @@ void FixPhonon::readmap() if (mask[i] & groupbit){ itag = tag[i]; idx = tag2surf[itag]; - if (itag != surf2tag[idx]) + if (itag != surf2tag[idx]) error->one(FLERR,"The mapping info read is incorrect!"); } } @@ -675,7 +675,7 @@ void FixPhonon::postprocess( ) TempAve += TempSum[idim]*TempFac; } TempAve /= sysdim*boltz; - + for (idq = 0; idq < mynq; ++idq){ GaussJordan(fft_dim, Phi_q[idq]); ndim =0; @@ -688,7 +688,7 @@ void FixPhonon::postprocess( ) for (int i = 0; i < nprocs; ++i) recvcnts[i] = fft_cnts[i]*fft_dim*2; for (int i = 1; i < nprocs; ++i) displs[i] = displs[i-1] + recvcnts[i-1]; MPI_Gatherv(Phi_q[0],mynq*fft_dim2*2,MPI_DOUBLE,Phi_all[0],recvcnts,displs,MPI_DOUBLE,0,world); - + // to collect all basis info and averaged it on root double basis_root[fft_dim]; if (fft_dim > sysdim) MPI_Reduce(&basis[1][0], &basis_root[sysdim], fft_dim-sysdim, MPI_DOUBLE, MPI_SUM, 0, world); @@ -707,7 +707,7 @@ void FixPhonon::postprocess( ) basevec[7] = hsum[3] * inv_neval / double(nz); basevec[6] = hsum[4] * inv_neval / double(nz); basevec[3] = hsum[5] * inv_neval / double(ny); - + // write binary file, in fact, it is the force constants matrix that is written // Enforcement of ASR and the conversion of dynamical matrix is done in the postprocessing code char fname[MAXLINE]; @@ -822,7 +822,7 @@ void FixPhonon::GaussJordan(int n, std::complex<double> *Mat) indxc[i] = icol; idr = icol*n+icol; if (Mat[idr] == std::complex<double>(0.,0.)) error->one(FLERR,"Singular matrix in complex GaussJordan!"); - + pivinv = 1./ Mat[idr]; Mat[idr] = std::complex<double>(1.,0.); idr = icol*n; @@ -881,7 +881,7 @@ void FixPhonon::EnforceASR() } } } - + // symmetrize for (int k = 0; k < nucell; ++k) for (int kp = k; kp < nucell; ++kp){ diff --git a/src/USER-PHONON/fix_phonon.h b/src/USER-PHONON/fix_phonon.h index f1a8af48126886f1c1437b6cdea584fff57b01c8..432276eb8a3be063d772bdfa0f7c40bfd52ea691 100644 --- a/src/USER-PHONON/fix_phonon.h +++ b/src/USER-PHONON/fix_phonon.h @@ -32,7 +32,7 @@ FixStyle(phonon,FixPhonon) #define FIX_PHONON_H #include "lmptype.h" -#include "mpi.h" +#include <mpi.h> #ifdef FFT_SINGLE typedef float FFT_SCALAR; @@ -45,9 +45,9 @@ typedef double FFT_SCALAR; #include <complex> #include "fix.h" #include <map> -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> namespace LAMMPS_NS { @@ -75,7 +75,7 @@ class FixPhonon : public Fix { int ngroup, nfind; // total number of atoms in group; total number of atoms on this proc char *prefix, *logfile; // prefix of output file names FILE *flog; - + double *M_inv_sqrt; class FFT3d *fft; // to do fft via the fft3d wraper @@ -84,7 +84,7 @@ class FixPhonon : public Fix { int *fft_cnts, *fft_disp; int fft_dim, fft_dim2; FFT_SCALAR *fft_data; - + tagint itag; // index variables int idx, idq; // more index variables std::map<tagint,int> tag2surf; // Mapping info diff --git a/src/USER-QMMM/fix_qmmm.cpp b/src/USER-QMMM/fix_qmmm.cpp index 910481a75838d7eebdd4291841e4aa6fe8889b77..08a7ded1532e839d475d6a09b02fb1888e73f067 100644 --- a/src/USER-QMMM/fix_qmmm.cpp +++ b/src/USER-QMMM/fix_qmmm.cpp @@ -403,7 +403,7 @@ void FixQMMM::exchange_positions() maxbuf = atom->nmax*size_one; comm_buf = memory->smalloc(maxbuf,"qmmm:comm_buf"); } - struct commdata *buf = static_cast<struct commdata *>(comm_buf); + struct commdata *buf = static_cast<struct commdata *>(comm_buf); if (comm->me == 0) { MPI_Status status; @@ -498,7 +498,7 @@ void FixQMMM::exchange_forces() if (qmmm_role == QMMM_ROLE_MASTER) { MPI_Request req[2]; - struct commdata *buf = static_cast<struct commdata *>(comm_buf); + struct commdata *buf = static_cast<struct commdata *>(comm_buf); if (comm->me == 0) { // receive QM forces from QE @@ -605,7 +605,7 @@ void FixQMMM::init() memory->create(qm_force,3*num_qm,"qmmm:qm_force"); const char fmt[] = "Initializing QM/MM master with %d QM atoms\n"; - + if (screen) fprintf(screen,fmt,num_qm); if (logfile) fprintf(logfile,fmt,num_qm); @@ -613,7 +613,7 @@ void FixQMMM::init() const char fm2[] = "Electrostatic coupling with %d atoms\n"; if (screen) fprintf(screen,fm2,num_mm); if (logfile) fprintf(logfile,fm2,num_mm); - } + } } else if (qmmm_role == QMMM_ROLE_SLAVE) { @@ -627,7 +627,7 @@ void FixQMMM::init() memory->create(qm_force,3*num_qm,"qmmm:qm_force"); const char fmt[] = "Initializing QM/MM slave with %d QM atoms\n"; - + if (screen) fprintf(screen,fmt,num_qm); if (logfile) fprintf(logfile,fmt,num_qm); @@ -684,7 +684,7 @@ void FixQMMM::init() qm_remap=taginthash_keys(qm_hash); if (verbose > 1) { - const char fmt[] = "qm_remap[%d]=" TAGINT_FORMAT + const char fmt[] = "qm_remap[%d]=" TAGINT_FORMAT " qm_hash[" TAGINT_FORMAT "]=" TAGINT_FORMAT "\n"; // print hashtable and reverse mapping for (i=0; i < num_qm; ++i) { @@ -740,7 +740,7 @@ void FixQMMM::post_force(int vflag) double FixQMMM::memory_usage(void) { double bytes; - + bytes = sizeof(FixQMMM); bytes += maxbuf; bytes += 6*num_qm*sizeof(double); diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index 1e592d9c99b42972211f831357b78e9f93f4e54a..417e7ac87d4649cf956a2533d8a415af5250a5b8 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ Implementation of the Multi-Scale Shock Method with quantum nuclear effects ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_qbmsst.h" #include "math_extra.h" #include "atom.h" @@ -52,7 +52,7 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 5) error->all(FLERR,"Illegal fix qbmsst command"); - + if ( strcmp(arg[3],"x") == 0 ) direction = 0; else if ( strcmp(arg[3],"y") == 0 ) @@ -62,10 +62,10 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : else { error->all(FLERR,"Illegal fix qbmsst command"); } - velocity = atof(arg[4]); + velocity = atof(arg[4]); if ( velocity < 0 ) error->all(FLERR,"Illegal fix qbmsst command"); - + // default parameters global_freq = 1; extscalar = 1; @@ -86,7 +86,7 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : p0_set = 0; v0_set = 0; e0_set = 0; - tscale = 0.01; + tscale = 0.01; t_period = 1.0; fric_coef = 1/t_period; seed = 880302; @@ -160,7 +160,7 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : // check for periodicity in controlled dimensions if (domain->nonperiodic) error->all(FLERR,"Fix qbmsst requires a periodic box"); - + // comments if (comm->me == 0) { if (screen) { @@ -168,18 +168,18 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : if (direction == 0) fprintf(screen," Shock in x direction\n"); else if (direction == 1) fprintf(screen," Shock in y direction\n"); else if (direction == 2) fprintf(screen," Shock in z direction\n"); - + fprintf(screen," Cell mass-like parameter qmass (units of mass^2/length^4) = %12.5e\n", qmass); fprintf(screen," Shock velocity = %12.5e\n", velocity); fprintf(screen," Artificial viscosity (units of mass/length/time) = %12.5e\n", mu); - + if (p0_set) fprintf(screen," Initial pressure specified to be %12.5e\n", p0); else fprintf(screen," Initial pressure calculated on first step\n"); if (v0_set) fprintf(screen," Initial volume specified to be %12.5e\n", v0); else fprintf(screen," Initial volume calculated on first step\n"); - if (e0_set) + if (e0_set) fprintf(screen," Initial energy specified to be %12.5e\n", e0); else fprintf(screen," Initial energy calculated on first step\n"); } @@ -188,18 +188,18 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : if (direction == 0) fprintf(logfile," Shock in x direction\n"); else if (direction == 1) fprintf(logfile," Shock in y direction\n"); else if (direction == 2) fprintf(logfile," Shock in z direction\n"); - + fprintf(logfile," Cell mass-like parameter qmass (units of mass^2/length^4) = %12.5e\n", qmass); fprintf(logfile," Shock velocity = %12.5e\n", velocity); fprintf(logfile," Artificial viscosity (units of mass/length/time) = %12.5e\n", mu); - - if (p0_set) + + if (p0_set) fprintf(logfile," Initial pressure specified to be %12.5e\n", p0); else fprintf(logfile," Initial pressure calculated on first step\n"); - if (v0_set) + if (v0_set) fprintf(logfile," Initial volume specified to be %12.5e\n", v0); else fprintf(logfile," Initial volume calculated on first step\n"); - if (e0_set) + if (e0_set) fprintf(logfile," Initial energy specified to be %12.5e\n", e0); else fprintf(logfile," Initial energy calculated on first step\n"); } @@ -249,7 +249,7 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : modify->add_compute(3,newarg); delete [] newarg; peflag = 1; - + // allocate qbmsst temperature = NULL; pressure = NULL; @@ -264,7 +264,7 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : random_array_1 = NULL; random_array_2 = NULL; fran = NULL; - + // initialize Marsagxlia RNG with processor-unique seed random = new RanMars(lmp,seed + comm->me); @@ -358,13 +358,13 @@ void FixQBMSST::init() // initiate the counter l and \mu counter_l=0; counter_mu=0; - + // initiate qtb temperature if (!qtb_set) { t_current = t_init; qtb_set=1; } old_eavg = e0; - + //set up the h time step for updating the random force \delta{}h=\frac{\pi}{\Omega_{max}} if (int(1.0/(2*f_max*dtv)) == 0) { if (comm->me == 0) printf ("Warning: Either f_max is too high or the time step is too big, setting f_max to be 1/timestep!\n"); @@ -383,8 +383,8 @@ void FixQBMSST::init() // generate random number array with zero mean and variance equal 1/12. int nlocal = atom->nlocal; - for (int i = 0; i < nlocal; i++) { - for (int m = 0; m < 2*N_f; m++) { + for (int i = 0; i < nlocal; i++) { + for (int m = 0; m < 2*N_f; m++) { random_array_0[i][m] = random->uniform()-0.5; random_array_1[i][m] = random->uniform()-0.5; random_array_2[i][m] = random->uniform()-0.5; @@ -422,7 +422,7 @@ void FixQBMSST::init() } /* ---------------------------------------------------------------------- - compute T,P before integrator starts + compute T,P before integrator starts ------------------------------------------------------------------------- */ void FixQBMSST::setup(int vflag) { @@ -440,7 +440,7 @@ void FixQBMSST::setup(int vflag) if ( screen ) fprintf(screen,"Fix QBMSST v0 = %12.5e\n", v0); if ( logfile ) fprintf(logfile,"Fix QBMSST v0 = %12.5e\n", v0); } - } + } if ( p0_set == 0 ) { p0 = p_current[direction]; @@ -467,10 +467,10 @@ void FixQBMSST::setup(int vflag) temperature->compute_vector(); double *ke_tensor = temperature->vector; double ke_temp = ke_tensor[0]+ke_tensor[1]+ke_tensor[2]; - if (ke_temp > 0.0 && tscale > 0.0 ) { + if (ke_temp > 0.0 && tscale > 0.0 ) { // transfer energy from atom velocities to cell volume motion - // to bias initial compression + // to bias initial compression double **v = atom->v; int *mask = atom->mask; double sqrt_initial_temperature_scaling = sqrt(1.0-tscale); @@ -497,7 +497,7 @@ void FixQBMSST::setup(int vflag) } } } - } + } // trigger virial computation on next timestep pressure->addstep(update->ntimestep+1); @@ -505,7 +505,7 @@ void FixQBMSST::setup(int vflag) } /* ---------------------------------------------------------------------- - 1st half of Verlet update + 1st half of Verlet update ------------------------------------------------------------------------- */ void FixQBMSST::initial_integrate(int vflag) { @@ -513,7 +513,7 @@ void FixQBMSST::initial_integrate(int vflag) sd = direction; double p_qbmsst;// QBMSST driving pressure. int i, k; - double vol; + double vol; int nlocal = atom->nlocal; int *mask = atom->mask; double **v = atom->v; @@ -537,10 +537,10 @@ void FixQBMSST::initial_integrate(int vflag) t_current -= dtv*fric_coef*eta*beta*(old_eavg-e0)/(3*ntotal*boltz); old_eavg = 0;//clear old energy average if (t_current < 0.0) t_current=0; - + // load omega_H with calculated spectrum at a specific temperature (corrected spectrum), omega_H is the Fourier transformation of time_H for (int k = 0; k < 2*N_f; k++) { - double f_k=(k-N_f)/(2*N_f*h_timestep); //\omega_k=\frac{2\pi}{\delta{}h}\frac{k}{2N_f} for k from -N_f to N_f-1 + double f_k=(k-N_f)/(2*N_f*h_timestep); //\omega_k=\frac{2\pi}{\delta{}h}\frac{k}{2N_f} for k from -N_f to N_f-1 if(k == N_f) { omega_H[k]=sqrt(force->boltz * t_current); } else { @@ -551,7 +551,7 @@ void FixQBMSST::initial_integrate(int vflag) } // construct the signal filter H, filter has the unit of of sqrt(energy) \sqrt{2N_f}^{-1}H\left(t_n\right) - for (int n = 0; n < 2*N_f; n++) { + for (int n = 0; n < 2*N_f; n++) { time_H[n] = 0; double t_n=(n-N_f); for (int k = 0; k < 2*N_f; k++) { @@ -561,22 +561,22 @@ void FixQBMSST::initial_integrate(int vflag) time_H[n]/=(2.0*N_f); } } - + //update the colored random force every alpha MD steps if (counter_mu == 0) { //propagate h_timestep ahead for (int j = 0; j < nlocal; j++) { - + //update random array - for (int m = 0; m < 2*N_f-1; m++) { + for (int m = 0; m < 2*N_f-1; m++) { random_array_0[j][m] = random_array_0[j][m+1]; - random_array_1[j][m] = random_array_1[j][m+1]; - random_array_2[j][m] = random_array_2[j][m+1]; + random_array_1[j][m] = random_array_1[j][m+1]; + random_array_2[j][m] = random_array_2[j][m+1]; } - random_array_0[j][2*N_f-1] = random->uniform()-0.5; + random_array_0[j][2*N_f-1] = random->uniform()-0.5; random_array_1[j][2*N_f-1] = random->uniform()-0.5; random_array_2[j][2*N_f-1] = random->uniform()-0.5; - + //reset random force fran[j][0] = 0.0; fran[j][1] = 0.0; @@ -584,9 +584,9 @@ void FixQBMSST::initial_integrate(int vflag) if (mask[j] & groupbit) { double gamma3 = gfactor[type[j]]; - for (int m = 0; m < 2*N_f; m++) { + for (int m = 0; m < 2*N_f; m++) { fran[j][0] += time_H[m] * random_array_0[j][2*N_f-m-1]; - fran[j][1] += time_H[m] * random_array_1[j][2*N_f-m-1]; + fran[j][1] += time_H[m] * random_array_1[j][2*N_f-m-1]; fran[j][2] += time_H[m] * random_array_2[j][2*N_f-m-1]; } fran[j][0] = fran[j][0]*gamma3; @@ -601,11 +601,11 @@ void FixQBMSST::initial_integrate(int vflag) counter_l = (counter_l + 1) % beta; counter_mu = (counter_mu + 1) % alpha; - // propagate the time derivative of + // propagate the time derivative of // the volume 1/2 step at fixed vol, r, rdot. p_qbmsst = nktv2p * mvv2e * velocity * velocity * total_mass * ( v0 - vol)/( v0 * v0); - double A = total_mass * ( p_current[sd] - p0 - p_qbmsst ) / + double A = total_mass * ( p_current[sd] - p0 - p_qbmsst ) / (qmass * nktv2p * mvv2e); double B = total_mass * mu / ( qmass * vol ); @@ -616,21 +616,21 @@ void FixQBMSST::initial_integrate(int vflag) // use taylor expansion to avoid singularity at B == 0. if ( B * dthalf > 1.0e-06 ) { - omega[sd] = ( omega[sd] + A * ( exp(B * dthalf) - 1.0 ) / B ) + omega[sd] = ( omega[sd] + A * ( exp(B * dthalf) - 1.0 ) / B ) * exp(-B * dthalf); } else { omega[sd] = omega[sd] + (A - B * omega[sd]) * dthalf + 0.5 * (B * B * omega[sd] - A * B ) * dthalf * dthalf; } - // propagate velocity sum 1/2 step by + // propagate velocity sum 1/2 step by // temporarily propagating the velocities. velocity_sum = compute_vsum(); for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { for ( k = 0; k < 3; k++ ) { double C = (f[i][k] + fran[i][k])* force->ftm2v / mass[type[i]];// this term now has a random force part - double D = mu * omega[sd] * omega[sd] / + double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ) - fric_coef; old_velocity[i][k] = v[i][k]; if ( k == direction ) { @@ -663,7 +663,7 @@ void FixQBMSST::initial_integrate(int vflag) if (mask[i] & groupbit) { for ( k = 0; k < 3; k++ ) { double C = (f[i][k] + fran[i][k])* force->ftm2v / mass[type[i]];// this term now has a random force part - double D = mu * omega[sd] * omega[sd] / + double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ) - fric_coef; if ( k == direction ) { @@ -695,7 +695,7 @@ void FixQBMSST::initial_integrate(int vflag) x[i][2] += dtv * v[i][2]; } } - + // propagate the volume 1/2 step. double vol2 = vol1 + omega[sd] * dthalf; @@ -707,7 +707,7 @@ void FixQBMSST::initial_integrate(int vflag) } /* ---------------------------------------------------------------------- - 2nd half of Verlet update + 2nd half of Verlet update ------------------------------------------------------------------------- */ void FixQBMSST::final_integrate() { @@ -729,9 +729,9 @@ void FixQBMSST::final_integrate() for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - for ( int k = 0; k < 3; k++ ) { + for ( int k = 0; k < 3; k++ ) { double C = (f[i][k] + fran[i][k]) * force->ftm2v / mass[type[i]];// this term now has a random force part - double D = mu * omega[sd] * omega[sd] / + double D = mu * omega[sd] * omega[sd] / (velocity_sum * mass[type[i]] * vol ) - fric_coef; if ( k == direction ) { @@ -761,7 +761,7 @@ void FixQBMSST::final_integrate() p_qbmsst = nktv2p * mvv2e * velocity * velocity * total_mass * ( v0 - vol )/( v0 * v0 ); - double A = total_mass * ( p_current[sd] - p0 - p_qbmsst ) / + double A = total_mass * ( p_current[sd] - p0 - p_qbmsst ) / ( qmass * nktv2p * mvv2e ); double B = total_mass * mu / ( qmass * vol ); @@ -774,12 +774,12 @@ void FixQBMSST::final_integrate() // use taylor expansion to avoid singularity at B == 0. if ( B * dthalf > 1.0e-06 ) { - omega[sd] = ( omega[sd] + A * + omega[sd] = ( omega[sd] + A * ( exp(B * dthalf) - 1.0 ) / B ) * exp(-B * dthalf); } else { omega[sd] = omega[sd] + (A - B * omega[sd]) * dthalf + 0.5 * (B * B * omega[sd] - A * B ) * dthalf * dthalf; - } + } // calculate Lagrangian position of computational cell @@ -849,13 +849,13 @@ void FixQBMSST::remap(int flag) modify->fix[rfix[i]]->deform(1); for (i = 0; i < n; i++) { - v[i][direction] = v[i][direction] * + v[i][direction] = v[i][direction] * dilation[direction]; } } /* ---------------------------------------------------------------------- - pack entire state of Fix into one write + pack entire state of Fix into one write ------------------------------------------------------------------------- */ void FixQBMSST::write_restart(FILE *fp) { @@ -874,7 +874,7 @@ void FixQBMSST::write_restart(FILE *fp) } /* ---------------------------------------------------------------------- - use state info from restart file to restart the Fix + use state info from restart file to restart the Fix ------------------------------------------------------------------------- */ void FixQBMSST::restart(char *buf) { @@ -958,7 +958,7 @@ double FixQBMSST::compute_scalar() i = direction; energy = qmass * omega[i] * omega[i] / (2.0 * total_mass) * mvv2e; - energy -= 0.5 * total_mass * velocity * velocity * + energy -= 0.5 * total_mass * velocity * velocity * (1.0 - volume/ v0) * (1.0 - volume/ v0) * mvv2e; energy -= p0 * ( v0 - volume ) / nktv2p; @@ -967,7 +967,7 @@ double FixQBMSST::compute_scalar() } /* ---------------------------------------------------------------------- - return a single element from the following vector, + return a single element from the following vector, [dhug,dray,lgr_vel,lgr_pos,T_qm] ------------------------------------------------------------------------- */ double FixQBMSST::compute_vector(int n) @@ -987,31 +987,31 @@ double FixQBMSST::compute_vector(int n) } /* ---------------------------------------------------------------------- - Computes the deviation of the current point + Computes the deviation of the current point from the Hugoniot in Kelvin for the QBMSST. ------------------------------------------------------------------------- */ double FixQBMSST::compute_hugoniot() { double v, e, p; double dhugo; - + e = compute_etotal(); - + temperature->compute_vector(); pressure->compute_vector(); p = pressure->vector[direction]; - + v = compute_vol(); - - dhugo = (0.5 * (p + p0 ) * ( v0 - v)) / + + dhugo = (0.5 * (p + p0 ) * ( v0 - v)) / force->nktv2p + e0 - e; dhugo /= temperature->dof * force->boltz; - + return dhugo; } /* ---------------------------------------------------------------------- - Computes the deviation of the current point from the Rayleigh + Computes the deviation of the current point from the Rayleigh in pressure units for the QBMSST. ------------------------------------------------------------------------- */ double FixQBMSST::compute_rayleigh() @@ -1033,7 +1033,7 @@ double FixQBMSST::compute_rayleigh() } /* ---------------------------------------------------------------------- - Computes the speed of the QBMSST computational cell in the + Computes the speed of the QBMSST computational cell in the unshocked material rest-frame ------------------------------------------------------------------------- */ double FixQBMSST::compute_lagrangian_speed() @@ -1043,7 +1043,7 @@ double FixQBMSST::compute_lagrangian_speed() } /* ---------------------------------------------------------------------- - Computes the distance behind the + Computes the distance behind the shock front of the QBMSST computational cell. ------------------------------------------------------------------------- */ double FixQBMSST::compute_lagrangian_position() @@ -1052,14 +1052,14 @@ double FixQBMSST::compute_lagrangian_position() } /* ---------------------------------------------------------------------- - Computes the atomic kinetic + atomic potential energy. This excludes the QBMSST - external potential terms in the QBMSST Lagrangian. + Computes the atomic kinetic + atomic potential energy. This excludes the QBMSST + external potential terms in the QBMSST Lagrangian. ------------------------------------------------------------------------- */ double FixQBMSST::compute_etotal() { double epot,ekin,etot; epot = pe->compute_scalar(); - if (thermo_energy) epot -= compute_scalar(); + if (thermo_energy) epot -= compute_scalar(); ekin = temperature->compute_scalar(); ekin *= 0.5 * temperature->dof * force->boltz; etot = epot+ekin; @@ -1067,13 +1067,13 @@ double FixQBMSST::compute_etotal() } /* ---------------------------------------------------------------------- - Computes the atomic kinetic + atomic potential energy + QBMSST external potential. + Computes the atomic kinetic + atomic potential energy + QBMSST external potential. ------------------------------------------------------------------------- */ double FixQBMSST::compute_egrand() { double epot,ekin,etot; epot = pe->compute_scalar(); - if (!thermo_energy) epot += compute_scalar(); + if (!thermo_energy) epot += compute_scalar(); ekin = temperature->compute_scalar(); ekin *= 0.5 * temperature->dof * force->boltz; etot = epot+ekin; @@ -1081,8 +1081,8 @@ double FixQBMSST::compute_egrand() } /* ---------------------------------------------------------------------- - Computes the atomic kinetic + atomic potential energy. This excludes the QBMSST - external potential terms in the QBMSST Lagrangian. + Computes the atomic kinetic + atomic potential energy. This excludes the QBMSST + external potential terms in the QBMSST Lagrangian. ------------------------------------------------------------------------- */ double FixQBMSST::compute_vol() { @@ -1106,8 +1106,8 @@ void FixQBMSST::check_alloc(int n) } /* ---------------------------------------------------------------------- - Computes the atomic kinetic + atomic potential energy. This excludes the QBMSST - external potential terms in the QBMSST Lagrangian. + Computes the atomic kinetic + atomic potential energy. This excludes the QBMSST + external potential terms in the QBMSST Lagrangian. ------------------------------------------------------------------------- */ double FixQBMSST::compute_vsum() { @@ -1164,7 +1164,7 @@ void FixQBMSST::copy_arrays(int i, int j, int delflag) random_array_1[j][m] = random_array_1[i][m]; random_array_2[j][m] = random_array_2[i][m]; } - + for (int m = 0; m < 3; m++) fran[j][m] = fran[i][m]; } diff --git a/src/USER-QTB/fix_qbmsst.h b/src/USER-QTB/fix_qbmsst.h index a170ae96afb675f498fa1374fc4b8181be7cc32b..0ed210c9951fc3e4d8376b6be5391022e09dbbfa 100644 --- a/src/USER-QTB/fix_qbmsst.h +++ b/src/USER-QTB/fix_qbmsst.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -69,7 +69,7 @@ class FixQBMSST : public Fix { double dthalf; // half step size bigint ntotal; // atom->natoms double boltz,nktv2p, mvv2e; // Boltzmann factor and unit conversions - class Compute *temperature; // Computes created to evaluate + class Compute *temperature; // Computes created to evaluate class Compute *pressure; // thermodynamic quantities. class Compute *pe; double **old_velocity; // Saved velocities. @@ -81,7 +81,7 @@ class FixQBMSST : public Fix { int nrigid; // number of rigid fixes int *rfix; // indices of rigid fixes double p_current[3]; // pressure - double velocity_sum; // Sum of the velocities squared. + double velocity_sum; // Sum of the velocities squared. double lagrangian_position; // Lagrangian location of computational cell // qbmsst parameters @@ -104,7 +104,7 @@ class FixQBMSST : public Fix { double **fran; // random forces double old_eavg; // average previous energies - // functions + // functions void couple(); void remap(int); void check_alloc(int n); diff --git a/src/USER-QTB/fix_qtb.cpp b/src/USER-QTB/fix_qtb.cpp index 0962bece18b9796c5af0e57fe867f806edc43ea4..ed9bc7557429bff6d804a6a02ecce20f586c7203 100644 --- a/src/USER-QTB/fix_qtb.cpp +++ b/src/USER-QTB/fix_qtb.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ Implementation of the colored thermostat for quantum nuclear effects ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_qtb.h" #include "math_extra.h" #include "atom.h" @@ -54,7 +54,7 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extscalar = 1; nevery = 1; - + t_target = 300.0; t_period = 1.0; fric_coef = 1/t_period; @@ -86,7 +86,7 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) : N_f = atof(arg[iarg+1]); if (N_f <= 0) error->all(FLERR,"Illegal fix qtb command"); iarg += 2; } else error->all(FLERR,"Illegal fix qtb command"); - } + } // allocate qtb gfactor1 = NULL; @@ -99,7 +99,7 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) : fran = NULL; id_temp = NULL; temperature = NULL; - + // initialize Marsaglia RNG with processor-unique seed random = new RanMars(lmp,seed + comm->me); @@ -162,7 +162,7 @@ void FixQTB::init() //initiate the counter \mu counter_mu=0; - + //set up the h time step for updating the random force \delta{}h=\frac{\pi}{\Omega_{max}} if (int(1.0/(2*f_max*dtv)) == 0) { if (comm->me == 0) printf ("Warning: Either f_max is too high or the time step is too big, setting f_max to be 1/timestep!\n"); @@ -186,8 +186,8 @@ void FixQTB::init() // generate random number array with zero mean and variance equal 1/12. int nlocal = atom->nlocal; - for (int i = 0; i < nlocal; i++) { - for (int m = 0; m < 2*N_f; m++) { + for (int i = 0; i < nlocal; i++) { + for (int m = 0; m < 2*N_f; m++) { random_array_0[i][m] = random->uniform()-0.5; random_array_1[i][m] = random->uniform()-0.5; random_array_2[i][m] = random->uniform()-0.5; @@ -196,7 +196,7 @@ void FixQTB::init() // load omega_H with calculated spectrum at a specific temperature (corrected spectrum), omega_H is the Fourier transformation of time_H for (int k = 0; k < 2*N_f; k++) { - double f_k=(k-N_f)/(2*N_f*h_timestep); //\omega_k=\frac{2\pi}{\delta{}h}\frac{k}{2N_f} for k from -N_f to N_f-1 + double f_k=(k-N_f)/(2*N_f*h_timestep); //\omega_k=\frac{2\pi}{\delta{}h}\frac{k}{2N_f} for k from -N_f to N_f-1 if(k == N_f) { omega_H[k]=sqrt(force->boltz * t_target); } else { @@ -207,7 +207,7 @@ void FixQTB::init() } // construct the signal filter H, filter has the unit of of sqrt(energy) \sqrt{2N_f}^{-1}H\left(t_n\right) - for (int n = 0; n < 2*N_f; n++) { + for (int n = 0; n < 2*N_f; n++) { time_H[n] = 0; double t_n=(n-N_f); for (int k = 0; k < 2*N_f; k++) { @@ -254,14 +254,14 @@ void FixQTB::post_force(int vflag) if (counter_mu == alpha) { //propagate h_timestep ahead for (int j = 0; j < nlocal; j++) { - + //update random array - for (int m = 0; m < 2*N_f-1; m++) { + for (int m = 0; m < 2*N_f-1; m++) { random_array_0[j][m] = random_array_0[j][m+1]; - random_array_1[j][m] = random_array_1[j][m+1]; - random_array_2[j][m] = random_array_2[j][m+1]; + random_array_1[j][m] = random_array_1[j][m+1]; + random_array_2[j][m] = random_array_2[j][m+1]; } - random_array_0[j][2*N_f-1] = random->uniform()-0.5; + random_array_0[j][2*N_f-1] = random->uniform()-0.5; random_array_1[j][2*N_f-1] = random->uniform()-0.5; random_array_2[j][2*N_f-1] = random->uniform()-0.5; } @@ -280,9 +280,9 @@ void FixQTB::post_force(int vflag) if (mask[j] & groupbit) { gamma3 = gfactor3[type[j]]; - for (int m = 0; m < 2*N_f; m++) { + for (int m = 0; m < 2*N_f; m++) { fran[j][0] += time_H[m] * random_array_0[j][2*N_f-m-1]; - fran[j][1] += time_H[m] * random_array_1[j][2*N_f-m-1]; + fran[j][1] += time_H[m] * random_array_1[j][2*N_f-m-1]; fran[j][2] += time_H[m] * random_array_2[j][2*N_f-m-1]; } fran[j][0] = fran[j][0]*gamma3; @@ -297,27 +297,27 @@ void FixQTB::post_force(int vflag) fsum[1]=0.0; fsumall[1]=0.0; fsum[2]=0.0; fsumall[2]=0.0; - for (int j = 0; j < nlocal; j++) { + for (int j = 0; j < nlocal; j++) { //sum over each atom if (mask[j] & groupbit) { gamma1 = gfactor1[type[j]]; - + fsum[0]+=fran[j][0]-gamma1*v[j][0]; fsum[1]+=fran[j][1]-gamma1*v[j][1]; fsum[2]+=fran[j][2]-gamma1*v[j][2]; - } + } } - + //compute force sums MPI_Allreduce(fsum,fsumall,3,MPI_DOUBLE,MPI_SUM,world); - + //implement random forces for (int j = 0; j < nlocal; j++) { //make sure there is no net force on the system f[j][0] -= fsumall[0]/ntotal; f[j][1] -= fsumall[1]/ntotal; f[j][2] -= fsumall[2]/ntotal; - + if (mask[j] & groupbit) { gamma1 = gfactor1[type[j]]; @@ -399,7 +399,7 @@ void FixQTB::copy_arrays(int i, int j, int delflag) random_array_1[j][m] = random_array_1[i][m]; random_array_2[j][m] = random_array_2[i][m]; } - + for (int m = 0; m < 3; m++) fran[j][m] = fran[i][m]; } diff --git a/src/USER-QTB/fix_qtb.h b/src/USER-QTB/fix_qtb.h index 40fda85f2c0014539b8b98b056bff31fd38d3726..e2b76345373c39e7e311b36eddf53703ae3f7418 100644 --- a/src/USER-QTB/fix_qtb.h +++ b/src/USER-QTB/fix_qtb.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index d70c3d470864dac7a15deb02410176ba68b14a05..e8b23c761fd1fe5b306a8a418e855d4f84d2c1d8 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,11 +16,11 @@ Aidan Thompson (Sandia, athomps@sandia.gov) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_quip.h" #include "atom.h" #include "update.h" @@ -79,7 +79,7 @@ void PairQUIP::compute(int eflag, int vflag) ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - + sum_num_neigh = 0; quip_num_neigh = new int [inum]; @@ -149,8 +149,8 @@ void PairQUIP::compute(int eflag, int vflag) if (vflag_global) { virial[0] = quip_virial[0]; - virial[1] = quip_virial[4]; - virial[2] = quip_virial[8]; + virial[1] = quip_virial[4]; + virial[2] = quip_virial[8]; virial[3] = (quip_virial[3] + quip_virial[1])*0.5; virial[4] = (quip_virial[2] + quip_virial[6])*0.5; virial[5] = (quip_virial[5] + quip_virial[7])*0.5; @@ -184,7 +184,7 @@ void PairQUIP::compute(int eflag, int vflag) } /* ---------------------------------------------------------------------- - global settings + global settings ------------------------------------------------------------------------- */ void PairQUIP::settings(int narg, char **arg) @@ -218,13 +218,13 @@ void PairQUIP::coeff(int narg, char **arg) setflag[i][j] = 1; } } - + if( narg != (4+n) ) { char str[1024]; sprintf(str,"Number of arguments %d is not correct, it should be %d", narg, 4+n); error->all(FLERR,str); } - + if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); @@ -244,7 +244,7 @@ void PairQUIP::coeff(int narg, char **arg) error->all(FLERR,str); } } - + // Initialise potential // First call initialises potential via the fortran code in memory, and returns the necessary size // of quip_potential. This behaviour is invoked by setting n_potential_quip to 0. diff --git a/src/USER-QUIP/pair_quip.h b/src/USER-QUIP/pair_quip.h index e7a8c0c0a41f49bcd26455e10fb7c73fcde0251c..15e143aee75c7ddb9f75d31800b5fb649fe332ca 100644 --- a/src/USER-QUIP/pair_quip.h +++ b/src/USER-QUIP/pair_quip.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -24,9 +24,9 @@ PairStyle(quip,PairQUIP) extern "C" { - void quip_lammps_wrapper(int*, int*, int*, - int*, int*, int*, - int*, int*, double*, + void quip_lammps_wrapper(int*, int*, int*, + int*, int*, int*, + int*, int*, double*, int*, int*, double*, double*, double*, double*, double*, double*); void quip_lammps_potential_initialise(int*, int*, double*, char*, int*, char*, int*); diff --git a/src/USER-REAXC/compute_spec_atom.cpp b/src/USER-REAXC/compute_spec_atom.cpp index 0e7cf1ff8debcf10538fc67171868767324b2580..c719011746e1d60630f7175e22a321f889ff6607 100644 --- a/src/USER-REAXC/compute_spec_atom.cpp +++ b/src/USER-REAXC/compute_spec_atom.cpp @@ -5,14 +5,14 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_spec_atom.h" #include "math_extra.h" #include "atom.h" @@ -196,7 +196,7 @@ void ComputeSpecAtom::pack_q(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = q[i]; @@ -213,7 +213,7 @@ void ComputeSpecAtom::pack_x(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = x[i][0]; @@ -230,7 +230,7 @@ void ComputeSpecAtom::pack_y(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = x[i][1]; @@ -247,7 +247,7 @@ void ComputeSpecAtom::pack_z(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = x[i][2]; @@ -264,7 +264,7 @@ void ComputeSpecAtom::pack_vx(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = v[i][0]; @@ -281,7 +281,7 @@ void ComputeSpecAtom::pack_vy(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = v[i][1]; @@ -298,7 +298,7 @@ void ComputeSpecAtom::pack_vz(int n) int *mask = atom->mask; int nlocal = atom->nlocal; - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = v[i][2]; diff --git a/src/USER-REAXC/compute_spec_atom.h b/src/USER-REAXC/compute_spec_atom.h index 908ae3077c8ba1335e79c83ab3cc0e2d8de70a3e..107a2bd39fcae41ca57cb9e2c11ba071976a3cf8 100644 --- a/src/USER-REAXC/compute_spec_atom.h +++ b/src/USER-REAXC/compute_spec_atom.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -39,10 +39,10 @@ class ComputeSpecAtom : public Compute { double *vector; double **array; double *buf; - double *vbuf; + double *vbuf; typedef void (ComputeSpecAtom::*FnPtrPack)(int); - FnPtrPack *pack_choice; + FnPtrPack *pack_choice; void pack_q(int); void pack_x(int); diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index dfcd16316e5989cb973d26d30368858992ff9171..794c23da3a54154a31ba7b40f489e6767f138bce 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -18,10 +18,10 @@ Hybrid and sub-group capabilities: Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_qeq_reax.h" #include "pair_reax_c.h" #include "atom.h" @@ -442,7 +442,7 @@ void FixQEqReax::init_storage() { int NN; - if (reaxc) + if (reaxc) NN = reaxc->list->inum + reaxc->list->gnum; else NN = list->inum + list->gnum; @@ -522,7 +522,7 @@ void FixQEqReax::init_matvec() for( ii = 0; ii < nn; ++ii ) { i = ilist[ii]; if (atom->mask[i] & groupbit) { - + /* init pre-conditioner for H and init solution vectors */ Hdia_inv[i] = 1. / eta[ atom->type[i] ]; b_s[i] = -chi[ atom->type[i] ]; @@ -573,7 +573,7 @@ void FixQEqReax::compute_H() numneigh = list->numneigh; firstneigh = list->firstneigh; } - + // fill in the H matrix m_fill = 0; r_sqr = 0; @@ -964,7 +964,7 @@ double FixQEqReax::parallel_dot( double *v1, double *v2, int n) if (atom->mask[i] & groupbit) my_dot += v1[i] * v2[i]; } - + MPI_Allreduce( &my_dot, &res, 1, MPI_DOUBLE, MPI_SUM, world ); return res; diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index ca0219cdf696c8086cc0ee34dad4d8fee45cb866..0ac32e8fb6b00abd4288bc244ce46e6bf944b8f8 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -15,8 +15,8 @@ Contributing author: Ray Shan (Sandia, tnshan@sandia.gov) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_ave_atom.h" #include "fix_reaxc_bonds.h" #include "atom.h" @@ -243,7 +243,7 @@ void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) /* ---------------------------------------------------------------------- */ -void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, +void FixReaxCBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, int natoms, int maxnum) { int i, j, k, itype; diff --git a/src/USER-REAXC/fix_reaxc_bonds.h b/src/USER-REAXC/fix_reaxc_bonds.h index a5f4a6304edf2e6d54d5f0da06d6e194e760287d..b91085163b51c1f0eb73811c447668e3dd52175c 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.h +++ b/src/USER-REAXC/fix_reaxc_bonds.h @@ -20,7 +20,7 @@ FixStyle(reax/c/bonds,FixReaxCBonds) #ifndef LMP_FIX_REAXC_BONDS_H #define LMP_FIX_REAXC_BONDS_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" #include "pointers.h" diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index c223859b255ea5a3ae5c8ad3b15075e7cb14a035..c2a0e2fbb6b3426c03fc16837718a4ee0e4e99e7 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ Oleg Sergeev (VNIIA, sergeev@vniia.ru) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "math.h" +#include <stdlib.h> +#include <math.h> #include "atom.h" -#include "string.h" +#include <string.h> #include "fix_ave_atom.h" #include "fix_reaxc_species.h" #include "domain.h" @@ -67,15 +67,15 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : global_freq = nfreq = atoi(arg[5]); comm_forward = 5; - + if (nevery <= 0 || nrepeat <= 0 || nfreq <= 0) error->all(FLERR,"Illegal fix reax/c/species command"); if (nfreq % nevery || (nrepeat-1)*nevery >= nfreq) error->all(FLERR,"Illegal fix reax/c/species command"); - - // Neighbor lists must stay unchanged during averaging of bonds, + + // Neighbor lists must stay unchanged during averaging of bonds, // but may be updated when no averaging is performed. - + int rene_flag = 0; if (nevery * nrepeat != 1 && (nfreq % neighbor->every != 0 || neighbor->every < nevery * nrepeat)) { int newneighborevery = nevery * nrepeat; @@ -165,14 +165,14 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : itype = atoi(arg[iarg+1]); jtype = atoi(arg[iarg+2]); bo_cut = atof(arg[iarg+3]); - if (itype > ntypes || jtype > ntypes) + if (itype > ntypes || jtype > ntypes) error->all(FLERR,"Illegal fix reax/c/species command"); - if (itype <= 0 || jtype <= 0) + if (itype <= 0 || jtype <= 0) error->all(FLERR,"Illegal fix reax/c/species command"); if (bo_cut > 1.0 || bo_cut < 0.0) error->all(FLERR,"Illegal fix reax/c/species command"); - BOCut[itype][jtype] = bo_cut; + BOCut[itype][jtype] = bo_cut; BOCut[jtype][itype] = bo_cut; iarg += 4; @@ -377,27 +377,27 @@ void FixReaxCSpecies::create_fix() args[11] = (char *) "c_SPECATOM[6]"; // vy, 5 args[12] = (char *) "c_SPECATOM[7]"; // vz, 6 args[13] = (char *) "c_SPECATOM[8]"; // abo01, 7 - args[14] = (char *) "c_SPECATOM[9]"; - args[15] = (char *) "c_SPECATOM[10]"; - args[16] = (char *) "c_SPECATOM[11]"; + args[14] = (char *) "c_SPECATOM[9]"; + args[15] = (char *) "c_SPECATOM[10]"; + args[16] = (char *) "c_SPECATOM[11]"; args[17] = (char *) "c_SPECATOM[12]"; args[18] = (char *) "c_SPECATOM[13]"; - args[19] = (char *) "c_SPECATOM[14]"; + args[19] = (char *) "c_SPECATOM[14]"; args[20] = (char *) "c_SPECATOM[15]"; args[21] = (char *) "c_SPECATOM[16]"; args[22] = (char *) "c_SPECATOM[17]"; args[23] = (char *) "c_SPECATOM[18]"; args[24] = (char *) "c_SPECATOM[19]"; // abo12, 18 - args[25] = (char *) "c_SPECATOM[20]"; - args[26] = (char *) "c_SPECATOM[21]"; + args[25] = (char *) "c_SPECATOM[20]"; + args[26] = (char *) "c_SPECATOM[21]"; args[27] = (char *) "c_SPECATOM[22]"; args[28] = (char *) "c_SPECATOM[23]"; - args[29] = (char *) "c_SPECATOM[24]"; + args[29] = (char *) "c_SPECATOM[24]"; args[30] = (char *) "c_SPECATOM[25]"; args[31] = (char *) "c_SPECATOM[26]"; args[32] = (char *) "c_SPECATOM[27]"; args[33] = (char *) "c_SPECATOM[28]"; - args[34] = (char *) "c_SPECATOM[29]"; + args[34] = (char *) "c_SPECATOM[29]"; args[35] = (char *) "c_SPECATOM[30]"; args[36] = (char *) "c_SPECATOM[31]"; modify->add_fix(narg,args); @@ -477,7 +477,7 @@ void FixReaxCSpecies::Output_ReaxC_Bonds(bigint ntimestep, FILE *fp) AtomCoord chAnchor(AtomCoord in1, AtomCoord in2) { - if (in1.x < in2.x) + if (in1.x < in2.x) return in1; return in2; } @@ -528,7 +528,7 @@ void FixReaxCSpecies::FindMolecule () if (j < i) continue; if (!(mask[j] & groupbit)) continue; - if (clusterID[i] == clusterID[j] && PBCconnected[i] == PBCconnected[j] + if (clusterID[i] == clusterID[j] && PBCconnected[i] == PBCconnected[j] && x0[i].x == x0[j].x && x0[i].y == x0[j].y && x0[i].z == x0[j].z) continue; jtype = atom->type[j]; @@ -540,7 +540,7 @@ void FixReaxCSpecies::FindMolecule () PBCconnected[i] = PBCconnected[j] = MAX(PBCconnected[i], PBCconnected[j]); x0[i] = x0[j] = chAnchor(x0[i], x0[j]); if ((fabs(spec_atom[i][1] - spec_atom[j][1]) > reaxc->control->bond_cut) - || (fabs(spec_atom[i][2] - spec_atom[j][2]) > reaxc->control->bond_cut) + || (fabs(spec_atom[i][2] - spec_atom[j][2]) > reaxc->control->bond_cut) || (fabs(spec_atom[i][3] - spec_atom[j][3]) > reaxc->control->bond_cut)) PBCconnected[i] = PBCconnected[j] = 1; done = 0; @@ -579,7 +579,7 @@ void FixReaxCSpecies::SortMolecule(int &Nmole) } int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall && me == 0) + if (flagall && me == 0) error->warning(FLERR,"Atom with cluster ID = 0 included in " "fix reax/c/species group"); MPI_Allreduce(&lo,&idlo,1,MPI_INT,MPI_MIN,world); @@ -661,7 +661,7 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) if (cid == m) { itype = atom->type[n]-1; Name[itype] ++; - flag_mol = 1; + flag_mol = 1; } } MPI_Allreduce(&flag_mol,&flag_tmp,1,MPI_INT,MPI_MAX,world); @@ -674,15 +674,15 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) flag_identity = 1; for (k = 0; k < Nspec; k ++) { flag_spec=0; - for (l = 0; l < ntypes; l ++) + for (l = 0; l < ntypes; l ++) if (MolName[ntypes*k+l] != Name[l]) flag_spec = 1; - if (flag_spec == 0) NMol[k] ++; - flag_identity *= flag_spec; + if (flag_spec == 0) NMol[k] ++; + flag_identity *= flag_spec; } if (Nspec == 0 || flag_identity == 1) { for (l = 0; l < ntypes; l ++) MolName[ntypes*Nspec+l] = Name[l]; - Nspec ++; + Nspec ++; } } } @@ -710,7 +710,7 @@ int FixReaxCSpecies::CheckExistence(int id, int ntypes) molid = MolType[ntypes * i + j]; if (molid != MolName[ntypes * id + j]) flag = 1; } - if (flag == 0) return i; + if (flag == 0) return i; } for (i = 0; i < ntypes; i ++) MolType[ntypes * Nmoltype + i] = MolName[ntypes *id + i]; @@ -729,7 +729,7 @@ void FixReaxCSpecies::WriteFormulas(int Nmole, int Nspec) fprintf(fp,"# Timestep No_Moles No_Specs "); Nmoltype = 0; - + for (i = 0; i < Nspec; i ++) nd[i] = CheckExistence(i, ntypes); @@ -765,7 +765,7 @@ void FixReaxCSpecies::OpenPos() filecurrent = (char*) malloc((strlen(filepos)+16)*sizeof(char)); char *ptr = strchr(filepos,'*'); *ptr = '\0'; - if (padflag == 0) + if (padflag == 0) sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", filepos,ntimestep,ptr+1); else { @@ -797,7 +797,7 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) double **spec_atom = f_SPECBOND->array_atom; if (multipos) OpenPos(); - + box[0] = domain->boxhi[0] - domain->boxlo[0]; box[1] = domain->boxhi[1] - domain->boxlo[1]; box[2] = domain->boxhi[2] - domain->boxlo[2]; @@ -823,9 +823,9 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) count = 0; avq = 0.0; - for (n = 0; n < 3; n++) + for (n = 0; n < 3; n++) avx[n] = 0.0; - for (n = 0; n < ntypes; n ++) + for (n = 0; n < ntypes; n ++) Name[n] = 0; for (i = 0; i < nlocal; i ++) { @@ -858,7 +858,7 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) avq_tmp = 0.0; MPI_Allreduce(&avq,&avq_tmp,1,MPI_DOUBLE,MPI_SUM,world); avq = avq_tmp; - + for (n = 0; n < 3; n++) { avx_tmp = 0.0; MPI_Reduce(&avx[n],&avx_tmp,1,MPI_DOUBLE,MPI_SUM,0,world); @@ -871,9 +871,9 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) MPI_Reduce(Name,Nameall,ntypes,MPI_INT,MPI_SUM,0,world); for (n = 0; n < ntypes; n++) Name[n] = Nameall[n]; - if (me == 0) { + if (me == 0) { fprintf(pos,"%d\t%d\t",m,count); - for (n = 0; n < ntypes; n++) { + for (n = 0; n < ntypes; n++) { if (Name[n] != 0) { if (eletype) fprintf(pos,"%s",eletype[n]); else fprintf(pos,"%c",ele[n]); @@ -882,7 +882,7 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) } if (count > 0) { avq /= count; - for (k = 0; k < 3; k++) { + for (k = 0; k < 3; k++) { avx[k] /= count; if (avx[k] >= domain->boxhi[k]) avx[k] -= box[k]; @@ -906,9 +906,9 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) double FixReaxCSpecies::compute_vector(int n) { - if (n == 0) + if (n == 0) return vector_nmole; - if (n == 1) + if (n == 1) return vector_nspec; return 0.0; @@ -926,7 +926,7 @@ int FixReaxCSpecies::nint(const double &r) /* ---------------------------------------------------------------------- */ -int FixReaxCSpecies::pack_forward_comm(int n, int *list, double *buf, +int FixReaxCSpecies::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/USER-REAXC/fix_reaxc_species.h b/src/USER-REAXC/fix_reaxc_species.h index 43d59a0f88af9ed35883fe6a09de37fb83275172..a3a47b29ddfa6b7b42d7377372eb8f1cd2db2354 100644 --- a/src/USER-REAXC/fix_reaxc_species.h +++ b/src/USER-REAXC/fix_reaxc_species.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-REAXC/pair_reax_c.cpp b/src/USER-REAXC/pair_reax_c.cpp index 0aca805f7db65b596c626cfcf43b6e14547339c3..dc977249fc62d8129462728d6b9695da552a8f31 100644 --- a/src/USER-REAXC/pair_reax_c.cpp +++ b/src/USER-REAXC/pair_reax_c.cpp @@ -15,7 +15,7 @@ Contributing author: Hasan Metin Aktulga, Purdue University (now at Lawrence Berkeley National Laboratory, hmaktulga@lbl.gov) Per-atom energy/virial added by Ray Shan (Sandia) - Fix reax/c/bonds and fix reax/c/species for pair_style reax/c added by + Fix reax/c/bonds and fix reax/c/species for pair_style reax/c added by Ray Shan (Sandia) Hybrid and hybrid/overlay compatibility added by Ray Shan (Sandia) ------------------------------------------------------------------------- */ @@ -245,14 +245,14 @@ void PairReaxC::settings(int narg, char **arg) } else if (strcmp(arg[iarg],"safezone") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); system->safezone = force->numeric(FLERR,arg[iarg+1]); - if (system->safezone < 0.0) + if (system->safezone < 0.0) error->all(FLERR,"Illegal pair_style reax/c safezone command"); system->saferzone = system->safezone + 0.2; iarg += 2; } else if (strcmp(arg[iarg],"mincap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); system->mincap = force->inumeric(FLERR,arg[iarg+1]); - if (system->mincap < 0) + if (system->mincap < 0) error->all(FLERR,"Illegal pair_style reax/c mincap command"); iarg += 2; } else error->all(FLERR,"Illegal pair_style reax/c command"); @@ -282,7 +282,7 @@ void PairReaxC::coeff( int nargs, char **args ) char *file = args[2]; FILE *fp; fp = force->open_potential(file); - if (fp != NULL) + if (fp != NULL) Read_Force_Field(fp, &(system->reax_param), control); else if (comm->me == 0) { char str[128]; @@ -314,7 +314,7 @@ void PairReaxC::coeff( int nargs, char **args ) } // error check - if (itmp != n) + if (itmp != n) error->all(FLERR,"Non-existent ReaxFF type"); for (int i = 1; i <= n; i++) @@ -573,7 +573,7 @@ void PairReaxC::compute(int eflag, int vflag) memory->create(tmpid,nmax,MAXSPECBOND,"pair:tmpid"); memory->create(tmpbo,nmax,MAXSPECBOND,"pair:tmpbo"); } - + for (i = 0; i < system->N; i ++) for (j = 0; j < MAXSPECBOND; j ++) { tmpbo[i][j] = 0.0; @@ -770,7 +770,7 @@ void *PairReaxC::extract(const char *str, int &dim) double PairReaxC::memory_usage() { double bytes = 0.0; - + // From pair_reax_c bytes += 1.0 * system->N * sizeof(int); bytes += 1.0 * system->N * sizeof(double); diff --git a/src/USER-REAXC/pair_reax_c.h b/src/USER-REAXC/pair_reax_c.h index 1f7a5c9f00a8ece971cf8564e3ba6c1e222fefa8..679adc34d671a3dd1c73e08ef6401a02f75aa4b9 100644 --- a/src/USER-REAXC/pair_reax_c.h +++ b/src/USER-REAXC/pair_reax_c.h @@ -95,8 +95,8 @@ class PairReaxC : public Pair { E: Too many ghost atoms -Number of ghost atoms has increased too much during simulation and has exceeded -the size of reax/c arrays. Increase safe_zone and min_cap in pair_style reax/c +Number of ghost atoms has increased too much during simulation and has exceeded +the size of reax/c arrays. Increase safe_zone and min_cap in pair_style reax/c command */ diff --git a/src/USER-REAXC/reaxc_bonds.cpp b/src/USER-REAXC/reaxc_bonds.cpp index 6e3fa75978189ee4418bef713cb3f7f8a5bdb2b7..e0ef38ba0f2788fa739b1ed53e701f234721ac2d 100644 --- a/src/USER-REAXC/reaxc_bonds.cpp +++ b/src/USER-REAXC/reaxc_bonds.cpp @@ -66,10 +66,10 @@ void Bonds( reax_system *system, control_params *control, continue; if( system->my_atoms[i].orig_id == system->my_atoms[j].orig_id ) { if (system->my_atoms[j].x[2] < system->my_atoms[i].x[2]) continue; - if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && + if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && system->my_atoms[j].x[1] < system->my_atoms[i].x[1]) continue; - if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && - system->my_atoms[j].x[1] == system->my_atoms[i].x[1] && + if (system->my_atoms[j].x[2] == system->my_atoms[i].x[2] && + system->my_atoms[j].x[1] == system->my_atoms[i].x[1] && system->my_atoms[j].x[0] < system->my_atoms[i].x[0]) continue; } @@ -80,28 +80,28 @@ void Bonds( reax_system *system, control_params *control, sbp_j = &( system->reax_param.sbp[type_j] ); twbp = &( system->reax_param.tbp[type_i][type_j] ); bo_ij = &( bonds->select.bond_list[pj].bo_data ); - + /* calculate the constants */ pow_BOs_be2 = pow( bo_ij->BO_s, twbp->p_be2 ); exp_be12 = exp( twbp->p_be1 * ( 1.0 - pow_BOs_be2 ) ); CEbo = -twbp->De_s * exp_be12 * ( 1.0 - twbp->p_be1 * twbp->p_be2 * pow_BOs_be2 ); - + /* calculate the Bond Energy */ data->my_en.e_bond += ebond = -twbp->De_s * bo_ij->BO_s * exp_be12 -twbp->De_p * bo_ij->BO_pi -twbp->De_pp * bo_ij->BO_pi2; - + /* tally into per-atom energy */ if( system->pair_ptr->evflag) system->pair_ptr->ev_tally(i,j,natoms,1,ebond,0.0,0.0,0.0,0.0,0.0); - + /* calculate derivatives of Bond Orders */ bo_ij->Cdbo += CEbo; bo_ij->Cdbopi -= (CEbo + twbp->De_p); bo_ij->Cdbopi2 -= (CEbo + twbp->De_pp); - + /* Stabilisation terminal triple bond */ if( bo_ij->BO >= 1.00 ) { if( gp37 == 2 || @@ -112,21 +112,21 @@ void Bonds( reax_system *system, control_params *control, exphub1 = exp(-gp3 * (workspace->total_bond_order[j]-bo_ij->BO)); exphuov = exp(gp4 * (workspace->Delta[i] + workspace->Delta[j])); hulpov = 1.0 / (1.0 + 25.0 * exphuov); - + estriph = gp10 * exphu * hulpov * (exphua1 + exphub1); data->my_en.e_bond += estriph; - + decobdbo = gp10 * exphu * hulpov * (exphua1 + exphub1) * ( gp3 - 2.0 * gp7 * (bo_ij->BO-2.50) ); decobdboua = -gp10 * exphu * hulpov * (gp3*exphua1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); decobdboub = -gp10 * exphu * hulpov * (gp3*exphub1 + 25.0*gp4*exphuov*hulpov*(exphua1+exphub1)); - + /* tally into per-atom energy */ if( system->pair_ptr->evflag) system->pair_ptr->ev_tally(i,j,natoms,1,estriph,0.0,0.0,0.0,0.0,0.0); - + bo_ij->Cdbo += decobdbo; workspace->CdDelta[i] += decobdboua; workspace->CdDelta[j] += decobdboub; diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 6007cb7344148ccf8c9e04b76fd4ea2381b27a8d..912a49daa2eaae429b30b21698f75ef0c6ff2c97 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -443,7 +443,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, reax->tbp[i][j].lgcij = reax->tbp[j][i].lgcij = sqrt( reax->sbp[i].lgcij * reax->sbp[j].lgcij ); - reax->tbp[i][j].lgre = reax->tbp[j][i].lgre = 2.0 * reax->gp.l[35] * + reax->tbp[i][j].lgre = reax->tbp[j][i].lgre = 2.0 * reax->gp.l[35] * sqrt( reax->sbp[i].lgre*reax->sbp[j].lgre ); } diff --git a/src/USER-REAXC/reaxc_torsion_angles.cpp b/src/USER-REAXC/reaxc_torsion_angles.cpp index bf73fc6ae89821ad6c0cc7124cf9869afb103faf..2cfe3297657a7e48f920fac2c014cafdaaca8cad 100644 --- a/src/USER-REAXC/reaxc_torsion_angles.cpp +++ b/src/USER-REAXC/reaxc_torsion_angles.cpp @@ -185,10 +185,10 @@ void Torsion_Angles( reax_system *system, control_params *control, continue; if( system->my_atoms[j].orig_id == system->my_atoms[k].orig_id ) { if (system->my_atoms[k].x[2] < system->my_atoms[j].x[2]) continue; - if (system->my_atoms[k].x[2] == system->my_atoms[j].x[2] && + if (system->my_atoms[k].x[2] == system->my_atoms[j].x[2] && system->my_atoms[k].x[1] < system->my_atoms[j].x[1]) continue; - if (system->my_atoms[k].x[2] == system->my_atoms[j].x[2] && - system->my_atoms[k].x[1] == system->my_atoms[j].x[1] && + if (system->my_atoms[k].x[2] == system->my_atoms[j].x[2] && + system->my_atoms[k].x[1] == system->my_atoms[j].x[1] && system->my_atoms[k].x[0] < system->my_atoms[j].x[0]) continue; } diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index 5d6d5d8024f056dcaea2220aff4f55f4d1e4fd9c..0779acaf39bd658996c6f9b3397195bc23b30095 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -29,14 +29,14 @@ #include "lmptype.h" -#include "ctype.h" -#include "math.h" -#include "mpi.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <ctype.h> +#include <math.h> +#include <mpi.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "sys/time.h" -#include "time.h" +#include <time.h> /************* SOME DEFS - crucial for reax_types.h *********/ diff --git a/src/USER-SMD/atom_vec_smd.cpp b/src/USER-SMD/atom_vec_smd.cpp index 6b61b5c1ef380262ee3e7da84134100156dcd5ae..2a0d65b6422a3165169e8bb653d94a731012ac7f 100644 --- a/src/USER-SMD/atom_vec_smd.cpp +++ b/src/USER-SMD/atom_vec_smd.cpp @@ -22,9 +22,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom_vec_smd.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-SMD/compute_smd_contact_radius.cpp b/src/USER-SMD/compute_smd_contact_radius.cpp index 865031addb4b9c81531df26303e0200c063373fd..e641aea5a253721723eda1dc761b71a52b78589b 100644 --- a/src/USER-SMD/compute_smd_contact_radius.cpp +++ b/src/USER-SMD/compute_smd_contact_radius.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_contact_radius.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_damage.cpp b/src/USER-SMD/compute_smd_damage.cpp index 95d7bee3be42725f20389033c8c7e09600ace1af..6630a937352bd96a4cf4691a7268c613ddcd7ac3 100644 --- a/src/USER-SMD/compute_smd_damage.cpp +++ b/src/USER-SMD/compute_smd_damage.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_damage.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_hourglass_error.cpp b/src/USER-SMD/compute_smd_hourglass_error.cpp index ae6ffee0e19a569d099b7eefd6d49accbdbf3422..99998ed7ee6487731181ba0fac9a6f57a28ee2bb 100644 --- a/src/USER-SMD/compute_smd_hourglass_error.cpp +++ b/src/USER-SMD/compute_smd_hourglass_error.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_hourglass_error.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_internal_energy.cpp b/src/USER-SMD/compute_smd_internal_energy.cpp index 9116df70118b59cbbfe7c9f3b1c7b47a909c47c7..fc869f9f93fc58b68904bd5f8bcc613af451c8c6 100644 --- a/src/USER-SMD/compute_smd_internal_energy.cpp +++ b/src/USER-SMD/compute_smd_internal_energy.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_internal_energy.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_plastic_strain.cpp b/src/USER-SMD/compute_smd_plastic_strain.cpp index 734f40e267f89921f62bcd59b57632cff08be84a..7c0977beb09585774232d70e699f50e18898d857 100644 --- a/src/USER-SMD/compute_smd_plastic_strain.cpp +++ b/src/USER-SMD/compute_smd_plastic_strain.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_plastic_strain.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_plastic_strain_rate.cpp b/src/USER-SMD/compute_smd_plastic_strain_rate.cpp index 44a890bf825daa3cef5a86de5d425cc7d98a199b..7df08bd4aca20011d191d43b700fa3731bafdc6f 100644 --- a/src/USER-SMD/compute_smd_plastic_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_plastic_strain_rate.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_plastic_strain_rate.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_rho.cpp b/src/USER-SMD/compute_smd_rho.cpp index 0e9ee9bb272029cec0901ae5a93292725fb0b85f..231165dc0cec74e94d5f17e6de5ed50f6eda8e02 100644 --- a/src/USER-SMD/compute_smd_rho.cpp +++ b/src/USER-SMD/compute_smd_rho.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_rho.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp index 7dcd7faca0cc8a2d49f62f7674cffa4f342cccec..50f849b7f1f2376f4058dee5dca4524bf8caff2a 100644 --- a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp +++ b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_tlsph_defgrad.h" #include "atom.h" #include "update.h" @@ -34,8 +34,8 @@ #include "pair.h" #include <iostream> #include <stdio.h> -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include <Eigen/Eigen> using namespace Eigen; using namespace std; diff --git a/src/USER-SMD/compute_smd_tlsph_defgrad.h b/src/USER-SMD/compute_smd_tlsph_defgrad.h index c58fc5148dec9734c0aca3ff0528df806d3af256..211b906485c289a409e8b03672e07b8f17b8830e 100644 --- a/src/USER-SMD/compute_smd_tlsph_defgrad.h +++ b/src/USER-SMD/compute_smd_tlsph_defgrad.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_tlsph_dt.cpp b/src/USER-SMD/compute_smd_tlsph_dt.cpp index fdb3c4feeb7c600f53090d1174ad1f16c048d50a..d2bcbf246f74255503a3dcf4d82b71f16aa6d5b5 100644 --- a/src/USER-SMD/compute_smd_tlsph_dt.cpp +++ b/src/USER-SMD/compute_smd_tlsph_dt.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_tlsph_dt.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp b/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp index 7b7b2ce07c9af88f9f71fb4d9bed1078c9fe2389..53e7a5c116091b44349d98b52160800148d2eafa 100644 --- a/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp +++ b/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_tlsph_num_neighs.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_tlsph_shape.cpp b/src/USER-SMD/compute_smd_tlsph_shape.cpp index d4e8c14b378b27329b008b6a7d07d17deea9d158..005fe6e39dd1f57ed778f4b679da68f9de516f0a 100644 --- a/src/USER-SMD/compute_smd_tlsph_shape.cpp +++ b/src/USER-SMD/compute_smd_tlsph_shape.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_tlsph_shape.h" #include "atom.h" #include "update.h" @@ -34,8 +34,8 @@ #include "pair.h" #include <iostream> #include <stdio.h> -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include <Eigen/Eigen> #include <Eigen/Geometry> using namespace Eigen; diff --git a/src/USER-SMD/compute_smd_tlsph_shape.h b/src/USER-SMD/compute_smd_tlsph_shape.h index 673080e2324fd385bcc1f64f48e0745dbff686fc..dc5a98618b1e87842b03ed92a1cf314182468745 100644 --- a/src/USER-SMD/compute_smd_tlsph_shape.h +++ b/src/USER-SMD/compute_smd_tlsph_shape.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_tlsph_strain.cpp b/src/USER-SMD/compute_smd_tlsph_strain.cpp index f191afeb2c8fa8b88044b160a49761e78a5c44bd..6b1b9c723154a7675c09869224f00af35e5a9c71 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_tlsph_strain.h" #include "atom.h" #include "update.h" @@ -35,8 +35,8 @@ #include "pair.h" #include <iostream> #include <stdio.h> -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include <Eigen/Eigen> using namespace Eigen; using namespace std; diff --git a/src/USER-SMD/compute_smd_tlsph_strain.h b/src/USER-SMD/compute_smd_tlsph_strain.h index a42fcddde22ddd9cc6dd69a2b72cebb96a1194fc..0dcd53b9a292dd9306c55fdca203868ddb93379e 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain.h +++ b/src/USER-SMD/compute_smd_tlsph_strain.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp index 4298793aef29e2afdc65036abc971acad868ac06..8ae776da39aa1750cc865a8a17af10c2c933fbdf 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_tlsph_strain_rate.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_tlsph_strain_rate.h b/src/USER-SMD/compute_smd_tlsph_strain_rate.h index 86da271b45da18a6ac68f4151c4a11f40e397a75..d3425e6fdcfebfb200a95289d8be77c76edb584f 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain_rate.h +++ b/src/USER-SMD/compute_smd_tlsph_strain_rate.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_tlsph_stress.cpp b/src/USER-SMD/compute_smd_tlsph_stress.cpp index e5eccd9aeb63202bdb6138fb4899e340f36b171e..541cc39eff002b70dd81b93a1e0dfc0efea024d1 100644 --- a/src/USER-SMD/compute_smd_tlsph_stress.cpp +++ b/src/USER-SMD/compute_smd_tlsph_stress.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_tlsph_stress.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_tlsph_stress.h b/src/USER-SMD/compute_smd_tlsph_stress.h index ed3ce7e7a958868fb8a18bd7e0921c4254aec763..027bfea98a25c66e2109cc4f6d2865881c0d1b29 100644 --- a/src/USER-SMD/compute_smd_tlsph_stress.h +++ b/src/USER-SMD/compute_smd_tlsph_stress.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_triangle_mesh_vertices.cpp b/src/USER-SMD/compute_smd_triangle_mesh_vertices.cpp index 6e7bac76bc6ab72500181e74e01c64f0414fe2b1..3e66e346114dcfcaa15337460dc268f968dfdf57 100644 --- a/src/USER-SMD/compute_smd_triangle_mesh_vertices.cpp +++ b/src/USER-SMD/compute_smd_triangle_mesh_vertices.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_triangle_mesh_vertices.h" #include "atom.h" #include "update.h" @@ -35,8 +35,8 @@ #include "pair.h" #include <iostream> #include <stdio.h> -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include <Eigen/Eigen> using namespace Eigen; using namespace std; diff --git a/src/USER-SMD/compute_smd_triangle_mesh_vertices.h b/src/USER-SMD/compute_smd_triangle_mesh_vertices.h index 75146227147aa0aba5445764c800408edbdeb8c9..a99330b0eb9cf6f10f728594aa91c4a827f19ef7 100644 --- a/src/USER-SMD/compute_smd_triangle_mesh_vertices.h +++ b/src/USER-SMD/compute_smd_triangle_mesh_vertices.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_ulsph_effm.cpp b/src/USER-SMD/compute_smd_ulsph_effm.cpp index 313c259632fccfa2e5fd0a3ee6c50d815d195e6f..529ce5bcd6a7df21eeb696ed5e69c57304b01821 100644 --- a/src/USER-SMD/compute_smd_ulsph_effm.cpp +++ b/src/USER-SMD/compute_smd_ulsph_effm.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_ulsph_effm.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp b/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp index c50db61bb1e8f7e36306321d6b60a5a24ea9923a..169eaa7dfb93dbc16fb6b91e9398682a99a2072a 100644 --- a/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp +++ b/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_ulsph_num_neighs.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_ulsph_strain.cpp b/src/USER-SMD/compute_smd_ulsph_strain.cpp index 5cf4fa53faf13ba0d20716617825caa25de696ee..395221d683775a0aab34bc513fa448bbe1bd08dc 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain.cpp +++ b/src/USER-SMD/compute_smd_ulsph_strain.cpp @@ -23,7 +23,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_ulsph_strain.h" #include "atom.h" #include "update.h" @@ -35,8 +35,8 @@ #include "pair.h" #include <iostream> #include <stdio.h> -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include <Eigen/Eigen> using namespace Eigen; using namespace std; diff --git a/src/USER-SMD/compute_smd_ulsph_strain.h b/src/USER-SMD/compute_smd_ulsph_strain.h index 820b2450a8fc787f8a5f6d85bfa3148ddfa80d5e..43aaa173bf3aa3ad495b383fdbadb9ea8e37857c 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain.h +++ b/src/USER-SMD/compute_smd_ulsph_strain.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp b/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp index b341fdf31a39bb32e6a10fe47e06814d6bcdcab4..e35331c64e91c115cbd7c9303ee2b4450839391f 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_ulsph_strain_rate.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_ulsph_strain_rate.h b/src/USER-SMD/compute_smd_ulsph_strain_rate.h index b712ab3c3e89c9fe41eecefb80a95741276e581d..e80d508abd7368d3fd867abb8c532af0d5b687f7 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain_rate.h +++ b/src/USER-SMD/compute_smd_ulsph_strain_rate.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_ulsph_stress.cpp b/src/USER-SMD/compute_smd_ulsph_stress.cpp index dc723fc63940a415828e4f30d8f0b9acceffce5a..9be8646f132f31653bb6b9163c1cc414db3ddef5 100644 --- a/src/USER-SMD/compute_smd_ulsph_stress.cpp +++ b/src/USER-SMD/compute_smd_ulsph_stress.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_ulsph_stress.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/compute_smd_ulsph_stress.h b/src/USER-SMD/compute_smd_ulsph_stress.h index 4656076e485473ad9328852f8c6eafff8a89709c..04de0a7304705afcc57e509a4c68d0042753311a 100644 --- a/src/USER-SMD/compute_smd_ulsph_stress.h +++ b/src/USER-SMD/compute_smd_ulsph_stress.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/compute_smd_vol.cpp b/src/USER-SMD/compute_smd_vol.cpp index 1826e3d9765f833bec4d63f1e0d36f5cbe12e6ad..658ede643982345021e6aeeeaad6b82e9ab818ba 100644 --- a/src/USER-SMD/compute_smd_vol.cpp +++ b/src/USER-SMD/compute_smd_vol.cpp @@ -22,7 +22,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_smd_vol.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/fix_smd_adjust_dt.cpp b/src/USER-SMD/fix_smd_adjust_dt.cpp index 48d5835059a66e480b2afbfaca18367aa92a4bd9..4920160a3077ec18f384539c58f9a724df8389fe 100644 --- a/src/USER-SMD/fix_smd_adjust_dt.cpp +++ b/src/USER-SMD/fix_smd_adjust_dt.cpp @@ -22,9 +22,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_smd_adjust_dt.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/fix_smd_integrate_tlsph.cpp b/src/USER-SMD/fix_smd_integrate_tlsph.cpp index a26ffede0d2d2fb675ef1fbf4f7b50247855e3c1..b364c4813d7ae01d693a39df009f84172bc5586e 100644 --- a/src/USER-SMD/fix_smd_integrate_tlsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_tlsph.cpp @@ -22,9 +22,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_smd_integrate_tlsph.h" #include "atom.h" #include "force.h" @@ -37,7 +37,7 @@ #include "neighbor.h" #include "comm.h" #include "modify.h" -#include "stdio.h" +#include <stdio.h> #include <iostream> using namespace Eigen; diff --git a/src/USER-SMD/fix_smd_integrate_ulsph.cpp b/src/USER-SMD/fix_smd_integrate_ulsph.cpp index 91b974b40017a2d65644c2eb24c11c73b59dfc39..3dbf453349a539b8d3e50599c846a420e81f9932 100644 --- a/src/USER-SMD/fix_smd_integrate_ulsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_ulsph.cpp @@ -22,12 +22,12 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "fix_smd_integrate_ulsph.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom.h" #include "comm.h" #include "force.h" diff --git a/src/USER-SMD/fix_smd_move_triangulated_surface.cpp b/src/USER-SMD/fix_smd_move_triangulated_surface.cpp index ab81caeba3ca3b985b9d1917badc9f05979a199b..e452923bd41d32502b840b6d64bbb268bd655f4c 100644 --- a/src/USER-SMD/fix_smd_move_triangulated_surface.cpp +++ b/src/USER-SMD/fix_smd_move_triangulated_surface.cpp @@ -22,12 +22,12 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "fix_smd_move_triangulated_surface.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom.h" #include "comm.h" #include "force.h" diff --git a/src/USER-SMD/fix_smd_setvel.cpp b/src/USER-SMD/fix_smd_setvel.cpp index dbf21670f9073d50cf31b031b4f36677a48bd2ea..30ebbeb332123d2e7ada65b3093802be190b16c1 100644 --- a/src/USER-SMD/fix_smd_setvel.cpp +++ b/src/USER-SMD/fix_smd_setvel.cpp @@ -23,8 +23,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_smd_setvel.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp index 79c22e1056d3f2387f2cd2690a3ae31e99c1204b..76fd8021b6eb86388981cdf2feedbe972a432eea 100644 --- a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp +++ b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp @@ -25,9 +25,9 @@ ------------------------------------------------------------------------- */ #include "lattice.h" -#include "mpi.h" -#include "string.h" -#include "stdio.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> #include "fix_smd_tlsph_reference_configuration.h" #include "atom.h" #include "comm.h" diff --git a/src/USER-SMD/fix_smd_wall_surface.cpp b/src/USER-SMD/fix_smd_wall_surface.cpp index 41866b1d3eda44f42129bd08e762b37b88d92ff8..08272342653848501e7574a1fb2115211482b024 100644 --- a/src/USER-SMD/fix_smd_wall_surface.cpp +++ b/src/USER-SMD/fix_smd_wall_surface.cpp @@ -15,7 +15,7 @@ Contributing authors: Mike Parks (SNL), Ezwanur Rahman, J.T. Foster (UTSA) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_smd_wall_surface.h" #include "atom.h" #include "domain.h" diff --git a/src/USER-SMD/pair_smd_hertz.cpp b/src/USER-SMD/pair_smd_hertz.cpp index b39ea946c081eac2acc95f7a11fd943660a2f2df..0bcf2c8a3e5612dcd1fdcf76474ca816340dafd2 100644 --- a/src/USER-SMD/pair_smd_hertz.cpp +++ b/src/USER-SMD/pair_smd_hertz.cpp @@ -26,10 +26,10 @@ Contributing author: Mike Parks (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "float.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <string.h> #include "pair_smd_hertz.h" #include "atom.h" #include "domain.h" diff --git a/src/USER-SMD/pair_smd_hertz.h b/src/USER-SMD/pair_smd_hertz.h index 8a207709ad9c5ae044f8f4b52d066c0b494d75b5..6b40b6bb5cdd86f25fc532ca2a7edf11f7deed2c 100644 --- a/src/USER-SMD/pair_smd_hertz.h +++ b/src/USER-SMD/pair_smd_hertz.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index e31d5125c9a072bfbc4f5416d207cda3ae82b593..aee5eefcc24d05af354e2e66a50b55bf21dd28ad 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -23,10 +23,10 @@ ------------------------------------------------------------------------- */ #include "group.h" -#include "math.h" -#include "float.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <string.h> #include "pair_smd_tlsph.h" #include "fix_smd_tlsph_reference_configuration.h" #include "atom.h" diff --git a/src/USER-SMD/pair_smd_triangulated_surface.cpp b/src/USER-SMD/pair_smd_triangulated_surface.cpp index 6d2718726008f2f80046d3d21bbd370db865f018..f5db6acd8e97bb5bed5c333ab3304a12d53502d8 100644 --- a/src/USER-SMD/pair_smd_triangulated_surface.cpp +++ b/src/USER-SMD/pair_smd_triangulated_surface.cpp @@ -26,10 +26,10 @@ Contributing author: Mike Parks (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "float.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <string.h> #include "pair_smd_triangulated_surface.h" #include "atom.h" #include "domain.h" diff --git a/src/USER-SMD/pair_smd_triangulated_surface.h b/src/USER-SMD/pair_smd_triangulated_surface.h index 9f92e05ca4c55d9ff6f17a34d6d553047bdf0ce5..6332313646de03c772256e2077bf35406e677701 100644 --- a/src/USER-SMD/pair_smd_triangulated_surface.h +++ b/src/USER-SMD/pair_smd_triangulated_surface.h @@ -17,7 +17,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/USER-SMD/pair_smd_ulsph.cpp b/src/USER-SMD/pair_smd_ulsph.cpp index 37fb48b18c3ebe4e0eef7d48e76ff074d550b113..d048d0b8e7ec0240ce33f878e4fca3d5b56a69e0 100644 --- a/src/USER-SMD/pair_smd_ulsph.cpp +++ b/src/USER-SMD/pair_smd_ulsph.cpp @@ -22,10 +22,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "float.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <string.h> #include "pair_smd_ulsph.h" #include "atom.h" #include "domain.h" diff --git a/src/USER-SMD/smd_material_models.cpp b/src/USER-SMD/smd_material_models.cpp index 8660297170e4a9b7208c3ce7befe4c1a4d632a27..228d1c709a77870ecb752a31580cfa6c571d8ff2 100644 --- a/src/USER-SMD/smd_material_models.cpp +++ b/src/USER-SMD/smd_material_models.cpp @@ -23,7 +23,7 @@ ------------------------------------------------------------------------- */ #include <iostream> #include "math_special.h" -#include "stdio.h" +#include <stdio.h> #include <Eigen/Eigen> diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index 52b431a8c2a8d5cf183916d7f0c5eff3d47c8f2a..0955f7eee286936dc896555279f0efede170cbee 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -10,27 +10,27 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ - + /* ---------------------------------------------------------------------- The SMTBQ code has been developed with the financial support of CNRS and of the Regional Council of Burgundy (Convention n¡ 2010-9201AAO037S03129) - + Copyright (2015) Universite de Bourgogne : Nicolas SALLES, Olivier POLITANO Universite de Paris-Sud Orsay : R. Tetot Aalto University (Finland) : E. Maras - + Please cite the related publication: - N. Salles, O. Politano, E. Amzallag and R. Tetot, + N. Salles, O. Politano, E. Amzallag and R. Tetot, Comput. Mater. Sci., 111 (2016) 181-189 - + Contact : lammps@u-bourgogne.fr - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -38,10 +38,10 @@ <http://www.gnu.org/licenses/>. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_smtbq.h" #include "atom.h" #include "comm.h" @@ -57,7 +57,7 @@ #include "domain.h" #include <iostream> -#include <iomanip> +#include <iomanip> #include <string> #include <fstream> @@ -85,7 +85,7 @@ PairSMTBQ::PairSMTBQ(LAMMPS *lmp) : Pair(lmp) { MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nproc); - + single_enable = 0; restartinfo = 0; one_coeff = 1; @@ -114,13 +114,13 @@ PairSMTBQ::PairSMTBQ(LAMMPS *lmp) : Pair(lmp) tabsmr = NULL; dtabsmb = NULL; dtabsmr = NULL; - + sbcov = NULL; coord = NULL; sbmet = NULL; chimet = NULL; ecov = NULL; - + potmad = NULL; potself = NULL; potcov = NULL; @@ -137,12 +137,12 @@ PairSMTBQ::PairSMTBQ(LAMMPS *lmp) : Pair(lmp) nQEqall = NULL; nteam = 0; cluster = 0; - + Nevery = 0.0; Neverypot = 0.0; - + fct = NULL; - + maxpage = 0; @@ -183,7 +183,7 @@ PairSMTBQ::~PairSMTBQ() memory->destroy(dfafb); memory->destroy(potqn); memory->destroy(dpotqn); - + memory->destroy(ecov); memory->destroy(sbcov); memory->destroy(coord); @@ -192,7 +192,7 @@ PairSMTBQ::~PairSMTBQ() memory->destroy(tabsmr); memory->destroy(dtabsmb); memory->destroy(dtabsmr); - + memory->destroy(potmad); memory->destroy(potself); memory->destroy(potcov); @@ -205,7 +205,7 @@ PairSMTBQ::~PairSMTBQ() memory->destroy(nQEqall); memory->destroy(nQEqcall); memory->destroy(nQEqaall); - + memory->destroy(qf); memory->destroy(q1); memory->destroy(q2); @@ -217,7 +217,7 @@ PairSMTBQ::~PairSMTBQ() delete [] map; delete [] esm; } - + memory->destroy(fct); } @@ -301,16 +301,16 @@ void PairSMTBQ::coeff(int narg, char **arg) if (comm->me == 0 && screen) fprintf(screen,"Pair SMTBQ:\n"); if (comm->me == 0 && screen) - fprintf(screen," generating Coulomb integral lookup table ...\n"); - + fprintf(screen," generating Coulomb integral lookup table ...\n"); + tabqeq(); - + // ------------ if (comm->me == 0 && screen) fprintf(screen," generating Second Moment integral lookup table ...\n"); - + tabsm(); // ------------ @@ -320,7 +320,7 @@ void PairSMTBQ::coeff(int narg, char **arg) for (int i = 1; i <= n; i++) for (int j = i; j <= n; j++) setflag[i][j] = 0; - + // set setflag i,j for type pairs where both are mapped to elements @@ -330,7 +330,7 @@ void PairSMTBQ::coeff(int narg, char **arg) if (map[i] >= 0 && map[j] >= 0) { setflag[i][j] = 1; count++; - } + } if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } @@ -369,7 +369,7 @@ double PairSMTBQ::init_one(int i, int j) return cutmax; } -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- ---------------------------------------------------------------------- */ void PairSMTBQ::read_file(char *file) @@ -384,7 +384,7 @@ void PairSMTBQ::read_file(char *file) nparams = 0; maxparam = 0; maxintparam = 0; - + verbose = 1; verbose = 0; @@ -400,7 +400,7 @@ void PairSMTBQ::read_file(char *file) // store line of params if all 3 element tags are in element list char *ptr; - + ptr = (char*) malloc(sizeof(char)*MAXLINE); words = (char**) malloc(sizeof(char*)*MAXTOKENS); for (i=0; i < MAXTOKENS; i++) @@ -408,33 +408,33 @@ void PairSMTBQ::read_file(char *file) /* strip comment, skip line if blank */ - + if (verbose) printf ("\n"); fgets(ptr,MAXLINE,fp); while (strchr(ptr,'#')) { if (verbose) printf ("%s",ptr); fgets(ptr,MAXLINE,fp); - } - - + } + + // Nombre d'atome different dans la structure - // =============================================== + // =============================================== c = Tokenize( ptr, &words ); num_atom_types = atoi(words[1]); if (verbose) printf (" %s %d\n", words[0], num_atom_types); - + memory->create(intype,num_atom_types,num_atom_types,"pair:intype"); - - m = 0; + + m = 0; for (i = 0; i < num_atom_types; i++) { for (j = 0; j < num_atom_types; j++) { - if (j < i) { intype[i][j] = intype[j][i];} + if (j < i) { intype[i][j] = intype[j][i];} else { intype[i][j] = 0; - m = m + 1; } + m = m + 1; } if (verbose) printf ("i %d, j %d, intype %d - nb pair %d\n",i,j,intype[i][j],m); } - } - + } + // load up parameter settings and error check their values if (nparams == maxparam) { @@ -445,51 +445,51 @@ void PairSMTBQ::read_file(char *file) intparams = (Intparam *) memory->srealloc(intparams,(maxintparam+1)*sizeof(Intparam), "pair:intparams"); } - + for (i=0; i < num_atom_types; i++) params[i].nom = (char*) malloc(sizeof(char)*3); - + for (i=1; i <= maxintparam; i++) intparams[i].typepot = (char*) malloc(sizeof(char)*15); - + for (i=1; i <= maxintparam; i++) intparams[i].mode = (char*) malloc(sizeof(char)*6); - + QEqMode = (char*) malloc(sizeof(char)*18); Bavard = (char*) malloc(sizeof(char)*5); QInitMode = (char*) malloc(sizeof(char)*18); writepot = (char*) malloc(sizeof(char)*5); writeenerg = (char*) malloc(sizeof(char)*5); - - + + // Little loop for ion's parameters // ================================================ for (i=0; i<num_atom_types; i++) { - - fgets(ptr,MAXLINE,fp); if (verbose) printf ("%s",ptr); + + fgets(ptr,MAXLINE,fp); if (verbose) printf ("%s",ptr); // Line 2 - Al - + fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); strcpy(params[i].nom , words[1]); params[i].sto = atof(words[2]); if (verbose) printf (" %s %s %f\n", words[0],params[i].nom,params[i].sto); - + //Line 3 - Charges fgets( ptr, MAXLINE, fp); - c= Tokenize( ptr, &words ); - - params[i].qform = atof(words[1]); + c= Tokenize( ptr, &words ); + + params[i].qform = atof(words[1]); params[i].masse = atof(words[2]); if (verbose) printf (" %s %f %f \n", words[0],params[i].qform, params[i].masse); - + // Line 4 - Parametres QEq - + fgets( ptr, MAXLINE, fp); - c=Tokenize ( ptr, &words ); - params[i].ne = atof(words[1]) ; + c=Tokenize ( ptr, &words ); + params[i].ne = atof(words[1]) ; params[i].chi = atof(words[2]) ; params[i].dj = atof(words[3]) ; @@ -497,17 +497,17 @@ void PairSMTBQ::read_file(char *file) params[i].R = atof(words[4]) ; if (verbose) printf(" %s %f %f %f %f\n",words[0],params[i].ne,params[i].chi, params[i].dj,params[i].R); - } else { + } else { if (verbose) printf(" %s %f %f %f\n",words[0],params[i].ne,params[i].chi,params[i].dj); } - - // Line 4bis - Coordinance et rayon pour Ox + + // Line 4bis - Coordinance et rayon pour Ox if(strcmp(params[i].nom,"O")==0){ fgets( ptr, MAXLINE, fp); - c=Tokenize ( ptr, &words ); - + c=Tokenize ( ptr, &words ); + coordOxBB= atof(words[1]) ; coordOxBulk= atof(words[2]) ; coordOxSurf= atof(words[3]) ; @@ -516,186 +516,186 @@ void PairSMTBQ::read_file(char *file) ROxSurf = atof(words[6]) ; if (verbose) printf(" %s %f %f %f %f %f %f\n",words[0],coordOxBB,coordOxBulk,coordOxSurf,ROxBB,params[i].R,ROxSurf); } - + // Ligne 5 - Nombre d'etats partages - + fgets( ptr, MAXLINE, fp); c=Tokenize ( ptr, &words ); params[i].n0 = atof(words[1]); if (verbose) printf(" %s %f\n",words[0],params[i].n0); - + // Parametres de Slater params[i].dzeta = (2.0*params[i].ne + 1.0)/(4.0*params[i].R); if (verbose) printf (" Parametre dzeta (Slater) : %f\n",params[i].dzeta); - + } // Fin elements i - /* ===================================================================== + /* ===================================================================== reading the interaction's parameters - ===================================================================== */ - - m = 0; maxintsm = 0; // + ===================================================================== */ + + m = 0; maxintsm = 0; // for (k=0 ; k<=maxintparam ; k++){intparams[k].intsm = 0;} // --------------------------------- for (k = 0; k < maxintparam; k++) { - // --------------------------------- + // --------------------------------- m += 1; - - // Ligne 5 - parametre des potentiels + + // Ligne 5 - parametre des potentiels fgets(ptr,MAXLINE,fp); if (verbose) printf ("%s",ptr); - + // Lecture des protagonistes fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); - + test = 0; - for (i = 0; i <num_atom_types; i++) + for (i = 0; i <num_atom_types; i++) { if (strcmp(params[i].nom,words[1])==0) break; - if (i == num_atom_types - 1) test = 1; + if (i == num_atom_types - 1) test = 1; } // if (test == 0) printf (" on a %s -> %d = %s\n",words[1],i,params[i].nom); - - for (j = 0; j <num_atom_types; j++) + + for (j = 0; j <num_atom_types; j++) { if (strcmp(params[j].nom,words[2])==0) break; - if (j == num_atom_types - 1) test = 1; + if (j == num_atom_types - 1) test = 1; } // if (test == 0) printf (" on a %s -> %d = %s\n",words[2],j,params[j].nom); - - + + if ( test == 1 ) { if (verbose) printf ("========== fin des interaction ==========\n"); break ; } - - + + intype[i][j] = m; intype[j][i] = intype[i][j]; strcpy( intparams[m].typepot , words[3] ); intparams[m].intsm = 0; if (verbose) printf (" itype %d jtype %d - intype %d\n",i,j,intype[i][j]); - - if (strcmp(intparams[m].typepot,"second_moment") !=0 && - strcmp(intparams[m].typepot,"buck") != 0 && + + if (strcmp(intparams[m].typepot,"second_moment") !=0 && + strcmp(intparams[m].typepot,"buck") != 0 && strcmp(intparams[m].typepot,"buckPlusAttr") != 0) { - error->all(FLERR,"the potential other than second_moment or buckingham have not treated here\n");} - - + error->all(FLERR,"the potential other than second_moment or buckingham have not treated here\n");} + + // On detemrine le type d'interaction - // ----------------------------------- + // ----------------------------------- if (strcmp(intparams[m].typepot,"second_moment") == 0) { - maxintsm += 1; + maxintsm += 1; strcpy( intparams[m].mode , words[4] ); intparams[m].intsm = maxintsm; - - if (strcmp(intparams[m].mode,"oxide") != 0 && - strcmp(intparams[m].mode,"metal") != 0){ + + if (strcmp(intparams[m].mode,"oxide") != 0 && + strcmp(intparams[m].mode,"metal") != 0){ error->all(FLERR,"needs mode to second moment interaction : oxide or metal"); } // if (strcmp(intparams[m].mode,"oxide") == 0) // intparams[m].ncov = min((params[i].sto)*(params[i].n0),(params[j].sto)*(params[j].n0)); - + if (verbose) printf(" %s %s %s %s %s \n",words[0],words[1],words[2], - intparams[m].typepot,intparams[m].mode); + intparams[m].typepot,intparams[m].mode); fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); - - intparams[m].a = atof(words[1]) ; - intparams[m].p = atof(words[2]) ; - intparams[m].ksi = atof(words[3]) ; + + intparams[m].a = atof(words[1]) ; + intparams[m].p = atof(words[2]) ; + intparams[m].ksi = atof(words[3]) ; intparams[m].q = atof(words[4]) ; if (verbose) printf (" %s %f %f %f %f\n",words[0], intparams[m].a,intparams[m].p,intparams[m].ksi,intparams[m].q); - + // Ligne 6 - rayon de coupure potentiel SM - + fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); - + intparams[m].dc1 = atof(words[1]) ; intparams[m].dc2 = atof(words[2]) ; intparams[m].r0 = atof(words[3]) ; - + if (strcmp(intparams[m].mode,"metal") == 0) { if (verbose) printf (" %s %f %f %f\n",words[0], intparams[m].dc1,intparams[m].dc2,intparams[m].r0); - } else { + } else { if (verbose) printf (" %s %f %f %f\n",words[0], intparams[m].dc1,intparams[m].dc2,intparams[m].r0); } - - + + } else if (strcmp(intparams[m].typepot,"buck") == 0) { - + if (verbose) printf(" %s %s %s %s\n",words[0],words[1],words[2], - intparams[m].typepot); - + intparams[m].typepot); + fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); - + intparams[m].abuck = atof(words[1]) ; intparams[m].rhobuck = atof(words[2]) ; if (verbose) printf (" %s %f %f\n",words[0],intparams[m].abuck,intparams[m].rhobuck); - + } else if (strcmp(intparams[m].typepot,"buckPlusAttr") == 0) { - + if (verbose) printf(" %s %s %s %s\n",words[0],words[1],words[2], - intparams[m].typepot); - + intparams[m].typepot); + fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); - + intparams[m].abuck = atof(words[1]) ; intparams[m].rhobuck = atof(words[2]) ; if (verbose) printf (" %s %f %f\n",words[0],intparams[m].abuck,intparams[m].rhobuck); - + fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); - + intparams[m].aOO = atof(words[1]) ; intparams[m].bOO = atof(words[2]) ; intparams[m].r1OO = atof(words[3]) ;intparams[m].r2OO = atof(words[4]) ; if (verbose) printf (" %s %f %f %f %f \n",words[0],intparams[m].aOO, intparams[m].bOO,intparams[m].r1OO,intparams[m].r2OO); - + } if (verbose) printf (" intsm %d \n",intparams[m].intsm); - + } // for maxintparam - - + + /* ==================================================================== tables Parameters - ==================================================================== */ - + ==================================================================== */ + // Ligne 9 - rayon de coupure Electrostatique if (test == 0) { - fgets(ptr,MAXLINE,fp); + fgets(ptr,MAXLINE,fp); if (verbose) printf ("%s\n",ptr); - + fgets( ptr, MAXLINE, fp); } - c= Tokenize( ptr, &words ); + c= Tokenize( ptr, &words ); - for (i=0 ; i<num_atom_types; i++) { params[i].cutsq = atof(words[1]); } - cutmax = atof(words[1]); + for (i=0 ; i<num_atom_types; i++) { params[i].cutsq = atof(words[1]); } + cutmax = atof(words[1]); if (verbose) printf (" %s %f\n",words[0],params[0].cutsq); - + // Ligne 9 - parametre pour les tableaux - + fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); - + rmin = atof(words[1]) ; dr = atof(words[2]); if (verbose) printf (" %s %f %f\n",words[0],rmin,dr); - + kmax = int(cutmax*cutmax/(2.0*dr*rmin)); - ds = cutmax*cutmax/double(kmax) ; - if (verbose) printf (" kmax %d et ds %f\n",kmax,ds); + ds = cutmax*cutmax/double(kmax) ; + if (verbose) printf (" kmax %d et ds %f\n",kmax,ds); - /* ======================================================== */ + /* ======================================================== */ fgets( ptr, MAXLINE, fp); if (verbose) printf ("%s",ptr); @@ -710,8 +710,8 @@ void PairSMTBQ::read_file(char *file) precision = atof(words[2]); if (verbose) printf (" %s %d %f\n",words[0],loopmax,precision); - /* Param de coordination ============================================= */ - + /* Param de coordination ============================================= */ + fgets( ptr, MAXLINE, fp); if (verbose) printf ("%s",ptr); @@ -721,22 +721,22 @@ void PairSMTBQ::read_file(char *file) r2Coord = atof(words[2]); if (verbose) printf (" %s %f %f\n",words[0],r1Coord,r2Coord); - - /* Mode for QInit============================================= */ + + /* Mode for QInit============================================= */ fgets( ptr, MAXLINE, fp); if (verbose) printf ("%s",ptr); fgets( ptr, MAXLINE, fp); c= Tokenize( ptr, &words ); - strcpy( QInitMode , words[1] ); + strcpy( QInitMode , words[1] ); if (strcmp(QInitMode,"true") == 0) { QOxInit= atof(words[2]); } - else { QOxInit = 0.0; } + else { QOxInit = 0.0; } if (verbose) printf (" %s %s %f\n",words[0],QInitMode,QOxInit); - /* Mode for QEq============================================= */ - + /* Mode for QEq============================================= */ + fgets( ptr, MAXLINE, fp); if (verbose) printf ("%s",ptr); @@ -763,12 +763,12 @@ void PairSMTBQ::read_file(char *file) if (verbose) printf (" %s %f \n",words[0],zlim1QEq); } - else if (strcmp(QEqMode,"QEqAll") != 0 && + else if (strcmp(QEqMode,"QEqAll") != 0 && strcmp(QEqMode,"QEqAllParallel") != 0 && strcmp(QEqMode,"Surface") != 0 ) { error->all(FLERR,"The QEq Mode is not known. QEq mode should be :\n Possible QEq modes | parameters\n QEqAll | no parameters\n QEqAllParallel | no parameters\n Surface | zlim (QEq only for z>zlim)\n BulkFromSlab | zlim1 zlim2 (QEq only for zlim1<z<zlim2)\n"); } - /* Bavard============================================= */ + /* Bavard============================================= */ fgets( ptr, MAXLINE, fp); if (verbose) printf ("%s",ptr); @@ -777,7 +777,7 @@ void PairSMTBQ::read_file(char *file) c= Tokenize( ptr, &words ); strcpy( Bavard , words[1] ); if (verbose) printf (" %s %s\n",words[0],Bavard); - + // --------------------------------------- // Writing the energy component. @@ -786,7 +786,7 @@ void PairSMTBQ::read_file(char *file) strcpy( writeenerg, words[1] ); if (strcmp (writeenerg,"true") == 0) { Nevery = atof(words[2]); } else { Nevery = 0.0; } - if (verbose) printf (" %s %s %f\n",words[0],writeenerg,Nevery); + if (verbose) printf (" %s %s %f\n",words[0],writeenerg,Nevery); // --------------------------------------- // Writing the chimical electronic potential. @@ -798,8 +798,8 @@ void PairSMTBQ::read_file(char *file) else { Neverypot = 0.0; } if (verbose) printf (" %s %s %f\n",words[0],writepot,Neverypot); - - /* ======================================================== */ + + /* ======================================================== */ /* deallocate helper storage */ for( i = 0; i < MAXTOKENS ; i++ ) free( words[i] ); @@ -807,31 +807,31 @@ void PairSMTBQ::read_file(char *file) free( ptr ); fclose(fp); - + // === Rayon de coupure premier voisins : 1,2*r0 - for (i=0 ; i<num_atom_types ; i++) { + for (i=0 ; i<num_atom_types ; i++) { for (j=0 ; j<=i ; j++) { m = intype[i][j]; if (m == 0) continue; if (intparams[m].intsm == 0) continue; - + intparams[m].neig_cut = 1.2*intparams[m].r0; if (strcmp(intparams[m].typepot,"second_moment") == 0 ) - if (verbose) printf (" Rc 1er voisin, typepot %s -> %f Ang\n", + if (verbose) printf (" Rc 1er voisin, typepot %s -> %f Ang\n", intparams[m].typepot,intparams[m].neig_cut); } } - + //A adapter au STO ncov = min((params[0].sto)*(params[0].n0),(params[1].sto)*(params[1].n0)); - + if (verbose) printf (" Parametre ncov = %f\n",ncov); if (verbose) printf (" ********************************************* \n"); -} +} /* ---------------------------------------------------------------------- * COMPUTE @@ -842,17 +842,17 @@ void PairSMTBQ::compute(int eflag, int vflag) int i,j,ii,jj,inum,jnum,m,gp; int itag,jtag,itype,jtype; int *ilist,*jlist,*numneigh,**firstneigh; - + double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; double rsq,iq,jq,Eself,natom; double ecovtot,ErepOO,ErepMO,Eion,Ecoh; double **tmp,**tmpAll,*nmol; double dq,dqcov; - - + + int bavard; - - + + if (atom->nmax > nmax) { memory->destroy(ecov); memory->destroy(potmad); @@ -877,7 +877,7 @@ void PairSMTBQ::compute(int eflag, int vflag) memory->create(sbcov,nmax,"pair:sbcov"); memory->create(coord,nmax,"pair:coord"); memory->create(sbmet,nmax,"pair:sbmet"); - memory->create(chimet,nmax,"pair:chimet"); + memory->create(chimet,nmax,"pair:chimet"); memory->create(flag_QEq,nmax,"pair:flag_QEq"); memory->create(qf,nmax,"pair:qf"); memory->create(q1,nmax,"pair:q1"); @@ -888,7 +888,7 @@ void PairSMTBQ::compute(int eflag, int vflag) evdwl = ecoul = ecovtot = ErepOO = ErepMO = Eion = 0.0; Eself = 0.0; - + if (eflag || vflag) { ev_setup(eflag,vflag); } else { evflag = vflag_fdotr = vflag_atom = 0; } @@ -901,7 +901,7 @@ void PairSMTBQ::compute(int eflag, int vflag) int nlocal = atom->nlocal; int step = update->ntimestep; struct timeval start, end; - + inum = list->inum; ilist = list->ilist; @@ -911,11 +911,11 @@ void PairSMTBQ::compute(int eflag, int vflag) if (step == 0 || (Qstep !=0 && fmod(double(step), double(Qstep)) == 0.0 )) Charge(); // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // this is necessary to get sbcov or sbmet table in order to caclulate the covalent or metal bonding - if (Qstep == 0 || fmod(double(step), double(Qstep)) != 0.0 ) QForce_charge(0); + if (Qstep == 0 || fmod(double(step), double(Qstep)) != 0.0 ) QForce_charge(0); - // Charges Communication - // ---------------------- + // Charges Communication + // ---------------------- forward(q) ; reverse(q); memory->create(nmol,nteam+1,"pair:nmol"); @@ -934,21 +934,21 @@ void PairSMTBQ::compute(int eflag, int vflag) 0 -> ionic energy 1 -> coulombian energy 2 -> Electrosatic energy (ionic + Coulombian) - 3 -> Short int. Ox-Ox + 3 -> Short int. Ox-Ox 4 -> Short int. SMTB (repulsion) 5 -> Covalent energy SMTB 6 -> Somme des Q(i)² ------------------------------------------------------------------------- */ - - // ----------- + + // ----------- bavard = 0; // ----------- /* -------------- N-body forces Calcul --------------- */ - + for (ii = 0; ii < inum; ii++) { // =============================== - i = ilist[ii]; + i = ilist[ii]; itag = tag[i]; itype = map[type[i]]; iq = q[i]; @@ -971,23 +971,23 @@ void PairSMTBQ::compute(int eflag, int vflag) Eself = self(¶ms[itype],iq); tmp[gp][0] += Eself; tmp[gp][2] += Eself; - + if (evflag) ev_tally_full (i,0.0,2.0*Eself,0.0,0.0,0.0,0.0); // N-body energy of i // --------------------- dq = fabs(params[itype].qform) - fabs(iq); - dqcov = dq*(2.0*ncov/params[itype].sto - dq); + dqcov = dq*(2.0*ncov/params[itype].sto - dq); - ecov[i] = - sqrt(sbcov[i]*dqcov + sbmet[i]); - ecovtot += ecov[i]; + ecov[i] = - sqrt(sbcov[i]*dqcov + sbmet[i]); + ecovtot += ecov[i]; tmp[gp][5] += ecov[i]; - if (evflag) ev_tally_full(i,0.0,2.0*ecov[i],0.0,0.0,0.0,0.0); + if (evflag) ev_tally_full(i,0.0,2.0*ecov[i],0.0,0.0,0.0,0.0); -// Coulombian Interaction +// Coulombian Interaction // ----------------------- evdwl = 2.0*Vself*iq*iq ; tmp[gp][1] += Vself*iq*iq; @@ -996,7 +996,7 @@ void PairSMTBQ::compute(int eflag, int vflag) if (evflag) ev_tally_full (i,0.0,evdwl,0.0,0.0,0.0,0.0); evdwl = 0.0 ; - + jlist = firstneigh[i]; jnum = numneigh[i]; @@ -1019,12 +1019,12 @@ void PairSMTBQ::compute(int eflag, int vflag) } // ....................................................................... - + // # of interaction // ---------------- m = intype[itype][jtype]; - + delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; @@ -1032,41 +1032,41 @@ void PairSMTBQ::compute(int eflag, int vflag) // --------------------------------- - if (sqrt(rsq) > cutmax) continue; + if (sqrt(rsq) > cutmax) continue; // --------------------------------- - // Coulombian Energy + // Coulombian Energy // ------------------ evdwl = 0.0 ; fpair = 0.0; potqeq(i,j,iq,jq,rsq,fpair,eflag,evdwl); tmp[gp][1] += evdwl; tmp[gp][2] += evdwl; - - - // Coulombian Force + + + // Coulombian Force // ----------------- f[i][0] += delx*fpair; f[i][1] += dely*fpair; - f[i][2] += delz*fpair; + f[i][2] += delz*fpair; f[j][0] -= delx*fpair; f[j][1] -= dely*fpair; f[j][2] -= delz*fpair; - + if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); - evdwl = 0.0; fpair = 0.0 ; + evdwl = 0.0; fpair = 0.0 ; -// --------------------- +// --------------------- if (m == 0) continue; // --------------------- // ---------------------------------------------- - if ( strcmp(intparams[m].typepot,"buck") == 0 || + if ( strcmp(intparams[m].typepot,"buck") == 0 || strcmp(intparams[m].typepot,"buckPlusAttr") ==0 ) { // ---------------------------------------------- @@ -1075,7 +1075,7 @@ void PairSMTBQ::compute(int eflag, int vflag) ErepOO += evdwl ; tmp[gp][3] += evdwl; - + // repulsion is pure two-body, sums up pair repulsive forces f[i][0] += delx*fpair; f[i][1] += dely*fpair; @@ -1087,7 +1087,7 @@ void PairSMTBQ::compute(int eflag, int vflag) if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); - evdwl = 0.0; fpair = 0.0 ; + evdwl = 0.0; fpair = 0.0 ; } // ----------------------------------- Rep O-O @@ -1099,7 +1099,7 @@ void PairSMTBQ::compute(int eflag, int vflag) ErepOO += evdwl ; tmp[gp][3] += evdwl; - + // repulsion is pure two-body, sums up pair repulsive forces f[i][0] += delx*fpair; f[i][1] += dely*fpair; @@ -1111,7 +1111,7 @@ void PairSMTBQ::compute(int eflag, int vflag) if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); - evdwl = 0.0; fpair = 0.0 ; + evdwl = 0.0; fpair = 0.0 ; } // ----------------------------------- Attr O-O @@ -1120,7 +1120,7 @@ void PairSMTBQ::compute(int eflag, int vflag) if (strcmp(intparams[m].typepot,"second_moment") != 0 ) continue; // ----------------------------------------------------------------- - + if (sqrt(rsq) > intparams[m].dc2) continue; // ------------------------------------------- @@ -1130,7 +1130,7 @@ void PairSMTBQ::compute(int eflag, int vflag) repulsive(&intparams[m],rsq,i,j,fpair,eflag,evdwl); ErepMO += evdwl; tmp[gp][4] += 2.0*evdwl; - + f[i][0] += delx*fpair; f[i][1] += dely*fpair; f[i][2] += delz*fpair; @@ -1138,74 +1138,74 @@ void PairSMTBQ::compute(int eflag, int vflag) f[j][1] -= dely*fpair; f[j][2] -= delz*fpair; - + if (evflag) ev_tally(i,j,nlocal,newton_pair,2.0*evdwl,0.0,fpair,delx,dely,delz); - + evdwl = 0.0 ; fpair = 0.0; // ----- ----- ----- ----- ----- ----- // Attraction : force // ------------------ - fpair = 0.0; + fpair = 0.0; f_att(&intparams[m], i, j, rsq, fpair) ; - + f[i][0] += delx*fpair; f[i][1] += dely*fpair; f[i][2] += delz*fpair; f[j][0] -= delx*fpair; f[j][1] -= dely*fpair; f[j][2] -= delz*fpair; - + if (evflag) ev_tally(i,j,nlocal,newton_pair,0.0,0.0,fpair,delx,dely,delz); - - } // --------------------------------- End j - + + } // --------------------------------- End j + } // ---------------------------------- End i - if (vflag_fdotr) virial_fdotr_compute(); - - - for (i = 0; i < nteam+1; i++) { - MPI_Allreduce(tmp[i],tmpAll[i],7,MPI_DOUBLE,MPI_SUM,world); + if (vflag_fdotr) virial_fdotr_compute(); + + + for (i = 0; i < nteam+1; i++) { + MPI_Allreduce(tmp[i],tmpAll[i],7,MPI_DOUBLE,MPI_SUM,world); } - -// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: if (me == 0 && fmod(double(step), Nevery) == 0.0 && strcmp(writeenerg,"true") == 0) { - + ofstream fichierE; - - if (step == 0) { fichierE.open ("Energy_component.txt", ios::out | ios::trunc) ;} + + if (step == 0) { fichierE.open ("Energy_component.txt", ios::out | ios::trunc) ;} else { fichierE.open ("Energy_component.txt", ios::out | ios::app) ;} - + if (fichierE) fichierE<< setprecision(9) <<step; - + for (gp = 0; gp < nteam+1; gp++) { if (nmol[gp] == 0) continue; if (fichierE) fichierE<< setprecision(9) <<" "<<gp<<" "<<nmol[gp] <<" "<<tmpAll[gp][2]<<" "<<tmpAll[gp][3]<<" "<<tmpAll[gp][4]+tmpAll[gp][5]; - } + } if (fichierE) fichierE<<endl; - if (fichierE) fichierE.close(); - } -// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - + if (fichierE) fichierE.close(); + } +// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + if (me == 0&& strcmp(Bavard,"false") != 0) { printf ("A la fin de Compute\n"); - + printf ("Nemton_pair : %d, evflag %d, tail_flag %d,vflag_fdotr %d\n", newton_pair,evflag,force->pair->tail_flag,vflag_fdotr); - printf ("neighbor->includegroup %d\n",neighbor->includegroup); + printf ("neighbor->includegroup %d\n",neighbor->includegroup); for (gp=0; gp<nteam+1; gp++) { // -------------------------- Boucle sur les gp printf ("Energie de la team %d -- %d atome -------(nteam = %d) \n ",gp,int(nmol[gp]),nteam); - + if (nmol[gp] == 0) { printf (" ============================================ \n \n"); continue; @@ -1218,29 +1218,29 @@ void PairSMTBQ::compute(int eflag, int vflag) printf ("Energie cp pair ox : %f | %f par mol\n",tmpAll[gp][3],tmpAll[gp][3]/nmol[gp]); printf ("Energie cp pair sm : %f | %f par mol\n",tmpAll[gp][4],tmpAll[gp][4]/nmol[gp]); printf ("Energie cov sm : %f | %f par mol\n",tmpAll[gp][5],tmpAll[gp][5]/nmol[gp]); - + Ecoh = tmpAll[gp][2] + tmpAll[gp][3] + tmpAll[gp][4] + tmpAll[gp][5]; printf ("Energie totale : %f | %f par mol\n",Ecoh,Ecoh/nmol[gp]); printf ("================================================= \n"); printf (" \n"); - } // ----------------------------------------------------- Boucle sur les gp + } // ----------------------------------------------------- Boucle sur les gp } // ------------ Call me == 0 - memory->destroy(nmol); + memory->destroy(nmol); memory->destroy(tmp); - memory->destroy(tmpAll); + memory->destroy(tmpAll); } /* ---------------------------------------------------------------------- - Partie Electrostatique + Partie Electrostatique ----------------------------------------------------------------------*/ - + double PairSMTBQ::self(Param *param, double qi) { double self_tmp; @@ -1274,49 +1274,49 @@ void PairSMTBQ::tabqeq() int nntype; double rc,s,r; double alf; - + int ii; double za,zb,ra,rb,gam,dgam,dza,dzb, - d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2,na,nb; + d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2,na,nb; double aCoeff,bCoeff,rcoupe,nang; - + int n = atom->ntypes; int nlocal = atom->nlocal; int nghost = atom->nghost; nmax = atom->nmax; - + verbose = 1; verbose = 0; - + nntype = int((n+1)*n/2); - + rc = cutmax ; alf = 0.3 ; // alf = 0.2 ; - + if (verbose) printf ("kmax %d, ds %f, nmax %d\n",kmax,ds,nmax); if (verbose) printf ("nlocal = %d, nghost = %d\n",nlocal,nghost); if (verbose) printf ("nntypes %d, kmax %d, rc %f, n %d\n",nntype,kmax,rc,n); - + // allocate arrays - - memory->create(coultype,n,n,"pair:intype"); + + memory->create(coultype,n,n,"pair:intype"); memory->create(potqn,kmax+5,"pair:potqn"); memory->create(dpotqn,kmax+5,"pair:dpotqn"); - memory->create(fafb,kmax+5,nntype,"pair:fafb"); + memory->create(fafb,kmax+5,nntype,"pair:fafb"); memory->create(dfafb,kmax+5,nntype,"pair:dfafb"); - memory->create(fafbOxOxSurf,kmax+5,"pair:fafbOxOxSurf"); + memory->create(fafbOxOxSurf,kmax+5,"pair:fafbOxOxSurf"); memory->create(dfafbOxOxSurf,kmax+5,"pair:dfafbOxOxSurf"); - memory->create(fafbTiOxSurf,kmax+5,"pair:fafbTiOxSurf"); + memory->create(fafbTiOxSurf,kmax+5,"pair:fafbTiOxSurf"); memory->create(dfafbTiOxSurf,kmax+5,"pair:dfafbTiOxSurf"); - memory->create(fafbOxOxBB,kmax+5,"pair:fafbOxOxBB"); + memory->create(fafbOxOxBB,kmax+5,"pair:fafbOxOxBB"); memory->create(dfafbOxOxBB,kmax+5,"pair:dfafbOxOxBB"); - memory->create(fafbTiOxBB,kmax+5,"pair:fafbTiOxB"); + memory->create(fafbTiOxBB,kmax+5,"pair:fafbTiOxB"); memory->create(dfafbTiOxBB,kmax+5,"pair:dfafbTiOxBB"); - + memory->create(ecov,nmax,"pair:ecov"); memory->create(potmad,nmax,"pair:potmad"); memory->create(potself,nmax,"pair:potself"); @@ -1324,17 +1324,17 @@ void PairSMTBQ::tabqeq() memory->create(sbcov,nmax,"pair:sbcov"); memory->create(coord,nmax,"pair:coord"); memory->create(sbmet,nmax,"pair:sbmet"); - memory->create(chimet,nmax,"pair:chimet"); + memory->create(chimet,nmax,"pair:chimet"); // memory->create(nvsm,nmax,"pair:nvsm"); // memory->create(vsm,nmax,nmax,"pair:vsm"); - memory->create(flag_QEq,nmax,"pair:flag_QEq"); + memory->create(flag_QEq,nmax,"pair:flag_QEq"); memory->create(qf,nmax,"pair:qf"); memory->create(q1,nmax,"pair:q1"); memory->create(q2,nmax,"pair:q2"); memory->create(tab_comm,nmax,"pair:tab_comm"); - + memory->create(fct,31,"pair:fct"); // set interaction number: 0-0=0, 1-1=1, 0-1=1-0=2 @@ -1354,36 +1354,36 @@ void PairSMTBQ::tabqeq() if (verbose) printf ("i %d, j %d, coultype %d\n",i,j,coultype[i][j]); } } - + // -------- Tabqn -------- // ------------------- - // Ouverture du fichier + // Ouverture du fichier // ofstream fichier("tabqeq.txt", ios::out | ios::trunc) ; - // ------------------- + // ------------------- double pi,mu; pi = 4.0*atan(1.0); - - mu = erfc(alf*rc)/rc ; - + + mu = erfc(alf*rc)/rc ; + //if (fichier) fichier <<" r - potqn " <<endl ; - - //------------------------- - for (k=0; k < kmax+5; k++) + + //------------------------- + for (k=0; k < kmax+5; k++) //------------------------- { s = double(k)*ds ; r = sqrt(s); if (k==0) r=10e-30; potqn[k] = 14.4*(erfc(alf*r)/r - mu) ; - - // $$$ Here is (1/r)*dE/dr - dpotqn[k] = -14.4*( (erfc(alf*r)/(r*r) + 2.0*alf/sqrt(pi)/r*exp(-alf*alf*r*r))/r ) ; + + // $$$ Here is (1/r)*dE/dr + dpotqn[k] = -14.4*( (erfc(alf*r)/(r*r) + 2.0*alf/sqrt(pi)/r*exp(-alf*alf*r*r))/r ) ; } - + Vself = -14.4*(alf/sqrt(pi) + mu*0.5) ; - - // -------------------- + + // -------------------- // default arrays to zero for (i = 0; i < kmax+5; i ++) { @@ -1405,18 +1405,18 @@ void PairSMTBQ::tabqeq() // Set Tabqeq double dij,ddij; - + // ------------------- - // Ouverture du fichier + // Ouverture du fichier //ofstream fichier("dtabqeq.txt", ios::out | ios::trunc) ; - // ------------------- - + // ------------------- + //if (fichier) fichier <<" k , r , fafb , dfafb , dfafb2 , dgam , d(1/r) , dpotqn" <<endl ; - + rcoupe = cutmax ; double cang ; - + for (i = 0; i < n ; i++){ for (j = i; j < n ; j++){ @@ -1424,35 +1424,35 @@ void PairSMTBQ::tabqeq() m = coultype[i][j] ; na = params[i].ne ; nb = params[j].ne ; - za = params[i].dzeta ; + za = params[i].dzeta ; zb = params[j].dzeta ; ra = params[i].R; rb = params[j].R; - - ii = 0 ; nang =cang= 5.0 ; - // -------------------------- + + ii = 0 ; nang =cang= 5.0 ; + // -------------------------- for (k = 0; k < kmax+5; k++) - // -------------------------- + // -------------------------- { - gam = dgam = dza = dzb = d2zaa = d2zab = + gam = dgam = dza = dzb = d2zaa = d2zab = d2zbb = d2zra = d2zrb = d2gamr2 = 0.0 ; dij = 0.0 ; - + s = double(k)*ds ; r = sqrt(s) ; if (k==0) r=10e-30; - + gammas(na,nb,za,zb,r,gam,dgam,dza,dzb, d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2) ; - // --- Jij - + // --- Jij + dij = 14.4 * (1.0/r - double(gam)); ddij = 14.4 * (-1.0/(r*r) - double(dgam)) ; // Cutting Fonction - - - if (dij < 0.01 && ii==0) + + + if (dij < 0.01 && ii==0) { ii=2; if (ii==2) if (verbose) printf ("rc : %f\n",r); @@ -1464,48 +1464,48 @@ void PairSMTBQ::tabqeq() if (r > rc) {dij = aCoeff *pow((r- rc-nang),2) *exp(bCoeff*r); ddij = aCoeff*(r- rc-nang) *(2+bCoeff*(r-rc-nang))*exp(bCoeff*r); } - + if (r > (rc+nang)) {dij = 0.0 ; ddij = 0.0;} fafb[k][m] = potqn[k] - dij ; - if (k == 1) fafb[0][m] = fafb[k][m] ; - + if (k == 1) fafb[0][m] = fafb[k][m] ; + dfafb[k][m] = dpotqn[k] - ddij/r ; } // Make the table fafbOxOxSurf rc = cutmax; - if(strcmp(params[i].nom,"O")==0 || strcmp(params[j].nom,"O")==0){ + if(strcmp(params[i].nom,"O")==0 || strcmp(params[j].nom,"O")==0){ if(strcmp(params[i].nom,"O")==0) { - ra = ROxSurf; + ra = ROxSurf; za = (2.0*params[i].ne + 1.0)/(4.0*ra);} if(strcmp(params[j].nom,"O")==0) { - rb = ROxSurf; + rb = ROxSurf; zb = (2.0*params[j].ne + 1.0)/(4.0*rb); } - - + + ii = 0 ; nang =cang= 5.0 ; - // -------------------------- + // -------------------------- for (k = 0; k < kmax+5; k++) - // -------------------------- + // -------------------------- { - gam = dgam = dza = dzb = d2zaa = d2zab = + gam = dgam = dza = dzb = d2zaa = d2zab = d2zbb = d2zra = d2zrb = d2gamr2 = 0.0 ; dij = 0.0 ; - + s = double(k)*ds ; r = sqrt(s) ; if (k==0) r=10e-30; - + gammas(na,nb,za,zb,r,gam,dgam,dza,dzb, d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2) ; - // --- Jij - + // --- Jij + dij = 14.4 * (1.0/r - double(gam)); ddij = 14.4 * (-1.0/(r*r) - double(dgam)) ; - if (dij < 0.01 && ii==0) + if (dij < 0.01 && ii==0) { ii=2; if (ii==2) if (verbose) printf ("rc : %f\n",r); @@ -1519,53 +1519,53 @@ void PairSMTBQ::tabqeq() } - if (r > (rc+nang)) {dij = 0.0 ; ddij = 0.0;} - - if(strcmp(params[i].nom,"O")==0 && strcmp(params[j].nom,"O")==0){ + if (r > (rc+nang)) {dij = 0.0 ; ddij = 0.0;} + + if(strcmp(params[i].nom,"O")==0 && strcmp(params[j].nom,"O")==0){ fafbOxOxSurf[k] = potqn[k] - dij ; - if (k == 1) fafbOxOxSurf[0] = fafbOxOxSurf[k] ; - + if (k == 1) fafbOxOxSurf[0] = fafbOxOxSurf[k] ; + dfafbOxOxSurf[k] = dpotqn[k] - ddij/r ; } else { fafbTiOxSurf[k] = potqn[k] - dij ; - if (k == 1) fafbTiOxSurf[0] = fafbTiOxSurf[k] ; - + if (k == 1) fafbTiOxSurf[0] = fafbTiOxSurf[k] ; + dfafbTiOxSurf[k] = dpotqn[k] - ddij/r ;} - + } - + } //for k //end of make the table fafbOxOxSurf // Makes the table fafbOxOxBB rc = cutmax; - if(strcmp(params[i].nom,"O")==0 || strcmp(params[j].nom,"O")==0){ + if(strcmp(params[i].nom,"O")==0 || strcmp(params[j].nom,"O")==0){ if(strcmp(params[i].nom,"O")==0) { - ra = ROxBB; + ra = ROxBB; za = (2.0*params[i].ne + 1.0)/(4.0*ra);} if(strcmp(params[j].nom,"O")==0) { - rb = ROxBB; + rb = ROxBB; zb = (2.0*params[j].ne + 1.0)/(4.0*rb); } - - + + ii = 0 ; nang =cang= 5.0 ; - // -------------------------- + // -------------------------- for (k = 0; k < kmax+5; k++) - // -------------------------- + // -------------------------- { - gam = dgam = dza = dzb = d2zaa = d2zab = + gam = dgam = dza = dzb = d2zaa = d2zab = d2zbb = d2zra = d2zrb = d2gamr2 = 0.0 ; dij = 0.0 ; - + s = double(k)*ds ; r = sqrt(s) ; if (k==0) r=10e-30; - + gammas(na,nb,za,zb,r,gam,dgam,dza,dzb, d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2) ; - - // --- Jij - + + // --- Jij + dij = 14.4 * (1.0/r - double(gam)); ddij = 14.4 * (-1.0/(r*r) - double(dgam)) ; @@ -1583,68 +1583,68 @@ void PairSMTBQ::tabqeq() } - if (r > (rc+nang)) {dij = 0.0 ; ddij = 0.0;} - - if(strcmp(params[i].nom,"O")==0 && strcmp(params[j].nom,"O")==0){ + if (r > (rc+nang)) {dij = 0.0 ; ddij = 0.0;} + + if(strcmp(params[i].nom,"O")==0 && strcmp(params[j].nom,"O")==0){ fafbOxOxBB[k] = potqn[k] - dij ; - if (k == 1) fafbOxOxBB[0] = fafbOxOxBB[k] ; - dfafbOxOxBB[k] = dpotqn[k] - ddij/r ; } + if (k == 1) fafbOxOxBB[0] = fafbOxOxBB[k] ; + dfafbOxOxBB[k] = dpotqn[k] - ddij/r ; } else { fafbTiOxBB[k] = potqn[k] - dij ; - if (k == 1) fafbTiOxBB[0] = fafbTiOxBB[k] ; - dfafbTiOxBB[k] = dpotqn[k] - ddij/r ; + if (k == 1) fafbTiOxBB[0] = fafbTiOxBB[k] ; + dfafbTiOxBB[k] = dpotqn[k] - ddij/r ; } } - - + + } //for k - //end of make the table fafbOxOxBB - - - + //end of make the table fafbOxOxBB + + + } } //for i,j - + //if (fichier) fichier.close() ; } /* ---------------------------------------------------------------------*/ -void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, - double &fforce, int eflag, double &eng) +void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, + double &fforce, int eflag, double &eng) { /* =================================================================== Coulombian energy calcul between i and j atoms with fafb table make in sm_table(). fafb[i][j] : i is the table's step (r) - j is the interaction's # (in intype[itype][jtype]) + j is the interaction's # (in intype[itype][jtype]) dfafb is derivate energy (force) ==================================================================== */ - + int itype,jtype,l,m; double r,t1,t2,sds,xi,engBulk,engSurf,fforceBulk,fforceSurf,dcoordloc,dcoupureloc; double engBB,fforceBB, dIntfcoup2loc,iCoord,jCoord,iIntfCoup2,jIntfCoup2; - + int *type = atom->type; // int n = atom->ntypes; - + itype = map[type[i]]; jtype = map[type[j]]; m = coultype[itype][jtype]; - + r = rsq; sds = r/ds ; l = int(sds) ; xi = sds - double(l) ; - - + + iCoord=coord[i]; jCoord=coord[j]; iIntfCoup2= Intfcoup2(iCoord,coordOxBulk,0.15); jIntfCoup2= Intfcoup2(jCoord,coordOxBulk,0.15); - - // ---- Energies Interpolation + + // ---- Energies Interpolation t1 = fafb[l][m] + (fafb[l+1][m] - fafb[l][m])*xi; t2 = fafb[l+1][m] + (fafb[l+2][m] - fafb[l+1][m])*(xi-1.0); @@ -1652,19 +1652,19 @@ void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, engBulk = qi*qj*(t1 + (t2 - t1)*xi/2.0); eng=engBulk; - + // ---- Forces Interpolation t1 = dfafb[l][m] + (dfafb[l+1][m] - dfafb[l][m])*xi; t2 = dfafb[l+1][m] + (dfafb[l+2][m] - dfafb[l+1][m])*(xi-1); - - + + fforce = - qi*qj*(t1 + (t2 - t1)*xi/2.0) ; - if(strcmp(params[itype].nom,"O")==0 || strcmp(params[jtype].nom,"O")==0){ - - if(strcmp(params[itype].nom,"O")==0 && strcmp(params[jtype].nom,"O")==0){ + if(strcmp(params[itype].nom,"O")==0 || strcmp(params[jtype].nom,"O")==0){ + + if(strcmp(params[itype].nom,"O")==0 && strcmp(params[jtype].nom,"O")==0){ // between two oxygens t1 = fafbOxOxSurf[l] + (fafbOxOxSurf[l+1] - fafbOxOxSurf[l])*xi; @@ -1674,14 +1674,14 @@ void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, t1 = fafbOxOxBB[l] + (fafbOxOxBB[l+1] - fafbOxOxBB[l])*xi; t2 = fafbOxOxBB[l+1] + (fafbOxOxBB[l+2] - fafbOxOxBB[l+1])*(xi-1.0); engBB = qi*qj*(t1 + (t2 - t1)*xi/2.0); - + eng= engBulk + (iCoord+jCoord-2*coordOxBulk)/(2*(coordOxBB-coordOxBulk)) *(engBB-engBulk) + (iIntfCoup2+jIntfCoup2)*((engBulk-engSurf)/(2*(coordOxBulk-coordOxSurf)) - (engBB-engBulk)/(2*(coordOxBB-coordOxBulk))) ; // ---- Interpolation des forces - + fforceBulk=fforce; t1 = dfafbOxOxSurf[l] + (dfafbOxOxSurf[l+1] - dfafbOxOxSurf[l])*xi; t2 = dfafbOxOxSurf[l+1] + (dfafbOxOxSurf[l+2] - dfafbOxOxSurf[l+1])*(xi-1); @@ -1693,28 +1693,28 @@ void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, fforce= fforceBulk + (iCoord+jCoord-2*coordOxBulk)/(2*(coordOxBB-coordOxBulk))*(fforceBB-fforceBulk) + (iIntfCoup2+jIntfCoup2)*((fforceBulk-fforceSurf)/(2*(coordOxBulk-coordOxSurf)) - - (fforceBB-fforceBulk)/(2*(coordOxBB-coordOxBulk))) ; + - (fforceBB-fforceBulk)/(2*(coordOxBB-coordOxBulk))) ; } - else{ // between metal and oxygen - + else{ // between metal and oxygen + t1 = fafbTiOxSurf[l] + (fafbTiOxSurf[l+1] - fafbTiOxSurf[l])*xi; t2 = fafbTiOxSurf[l+1] + (fafbTiOxSurf[l+2] - fafbTiOxSurf[l+1])*(xi-1.0); engSurf = qi*qj*(t1 + (t2 - t1)*xi/2.0); t1 = fafbTiOxBB[l] + (fafbTiOxBB[l+1] - fafbTiOxBB[l])*xi; t2 = fafbTiOxBB[l+1] + (fafbTiOxBB[l+2] - fafbTiOxBB[l+1])*(xi-1.0); engBB = qi*qj*(t1 + (t2 - t1)*xi/2.0); - + if(strcmp(params[jtype].nom,"O")==0) //the atom j is an oxygen { iIntfCoup2=jIntfCoup2; iCoord=jCoord; } - + eng = engBulk + (engBulk-engSurf)/(coordOxBulk-coordOxSurf) * iIntfCoup2 + (engBB-engBulk)/(coordOxBB-coordOxBulk) * (iCoord-coordOxBulk-iIntfCoup2); - + // ---- Forces Interpolation - + fforceBulk=fforce; t1 = dfafbTiOxSurf[l] + (dfafbTiOxSurf[l+1] - dfafbTiOxSurf[l])*xi; t2 = dfafbTiOxSurf[l+1] + (dfafbTiOxSurf[l+2] - dfafbTiOxSurf[l+1])*(xi-1); @@ -1723,7 +1723,7 @@ void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, t1 = dfafbTiOxBB[l] + (dfafbTiOxBB[l+1] - dfafbTiOxBB[l])*xi; t2 = dfafbTiOxBB[l+1] + (dfafbTiOxBB[l+2] - dfafbTiOxBB[l+1])*(xi-1); fforceBB = - qi*qj*(t1 + (t2 - t1)*xi/2.0) ; - + dcoordloc = fcoupured(sqrt(r),r1Coord,r2Coord) ; @@ -1736,11 +1736,11 @@ void PairSMTBQ::potqeq(int i, int j, double qi, double qj, double rsq, } - + } - + } @@ -1753,31 +1753,31 @@ void PairSMTBQ::pot_ES (int i, int j, double rsq, double &eng) Coulombian potentiel energy calcul between i and j atoms with fafb table make in sm_table(). fafb[i][j] : i is the table's step (r) - j is the interaction's # (in intype[itype][jtype]) + j is the interaction's # (in intype[itype][jtype]) dfafb is derivate energy (force) ==================================================================== */ - + int itype,jtype,l,m; double r,t1,t2,sds,xi,engBulk,engSurf,dcoordloc,dcoupureloc; double engBB, dIntfcoup2loc,iCoord,jCoord,iIntfCoup2,jIntfCoup2; - + int *type = atom->type; // int n = atom->ntypes; - + itype = map[type[i]]; jtype = map[type[j]]; m = coultype[itype][jtype]; - + r = rsq; sds = r/ds ; l = int(sds) ; xi = sds - double(l) ; - + iCoord=coord[i]; jCoord=coord[j]; iIntfCoup2= Intfcoup2(iCoord,coordOxBulk,0.15); jIntfCoup2= Intfcoup2(jCoord,coordOxBulk,0.15); - + // ---- Energies Interpolation t1 = fafb[l][m] + (fafb[l+1][m] - fafb[l][m])*xi; @@ -1785,10 +1785,10 @@ void PairSMTBQ::pot_ES (int i, int j, double rsq, double &eng) eng = (t1 + (t2 - t1)*xi/2.0); - engBulk=eng; + engBulk=eng; - if(itype==0 || jtype==0){ + if(itype==0 || jtype==0){ if(itype==0 && jtype==0){ // between two oxygens @@ -1799,7 +1799,7 @@ void PairSMTBQ::pot_ES (int i, int j, double rsq, double &eng) t1 = fafbOxOxBB[l] + (fafbOxOxBB[l+1] - fafbOxOxBB[l])*xi; t2 = fafbOxOxBB[l+1] + (fafbOxOxBB[l+2] - fafbOxOxBB[l+1])*(xi-1.0); engBB = (t1 + (t2 - t1)*xi/2.0); - + eng= engBulk + (iCoord+jCoord-2*coordOxBulk)/(2*(coordOxBB-coordOxBulk))*(engBB-engBulk) + (iIntfCoup2+jIntfCoup2)*((engBulk-engSurf)/(2*(coordOxBulk-coordOxSurf)) - (engBB-engBulk)/(2*(coordOxBB-coordOxBulk))) ; @@ -1818,17 +1818,17 @@ void PairSMTBQ::pot_ES (int i, int j, double rsq, double &eng) iIntfCoup2=jIntfCoup2; iCoord=jCoord; } - - eng = engBulk + (engBulk-engSurf)/(coordOxBulk-coordOxSurf)*iIntfCoup2 + + eng = engBulk + (engBulk-engSurf)/(coordOxBulk-coordOxSurf)*iIntfCoup2 + (engBB-engBulk)/(coordOxBB-coordOxBulk) * (iCoord-coordOxBulk-iIntfCoup2); } - + } - + } @@ -1838,32 +1838,32 @@ void PairSMTBQ::pot_ES2 (int i, int j, double rsq, double &pot) { int l,m,itype,jtype; double sds,xi,t1,t2,r; - + int *type = atom->type; - - + + if (sqrt(rsq) > cutmax) return ; - + itype = map[type[i]]; jtype = map[type[j]]; m = coultype[itype][jtype]; - + r = rsq ; sds = r/ds ; l = int(sds) ; xi = sds - double(l) ; - - // ---- Energies Interpolation + + // ---- Energies Interpolation t1 = fafb[l][m] + (fafb[l+1][m] - fafb[l][m])*xi; t2 = fafb[l+1][m] + (fafb[l+2][m] - fafb[l+1][m])*(xi-1.0); - + pot = (t1 + (t2 - t1)*xi/2.0) ; - + } /* -------------------------------------------------------------------- - Oxygen-Oxygen Interaction - -------------------------------------------------------------------- */ + Oxygen-Oxygen Interaction + -------------------------------------------------------------------- */ void PairSMTBQ::rep_OO(Intparam *intparam, double rsq, double &fforce, int eflag, double &eng) @@ -1871,13 +1871,13 @@ void PairSMTBQ::rep_OO(Intparam *intparam, double rsq, double &fforce, double r,tmp_exp,tmp; double A = intparam->abuck ; double rho = intparam->rhobuck ; - + r = sqrt(rsq); tmp = - r/rho ; tmp_exp = exp( tmp ); - + eng = A * tmp_exp ; - + fforce = A/rho * tmp_exp / r ; //( - ) } @@ -1891,11 +1891,11 @@ void PairSMTBQ::Attr_OO(Intparam *intparam, double rsq, double &fforce, double bOO = intparam->bOO ; double r1OO = intparam->r1OO ; double r2OO = intparam->r2OO ; - + r = sqrt(rsq); tmp_exp= exp( bOO* r); - eng = aOO * tmp_exp* fcoupure(r,r1OO,r2OO); - + eng = aOO * tmp_exp* fcoupure(r,r1OO,r2OO); + fforce = - (aOO*bOO * tmp_exp * fcoupure(r,r1OO,r2OO)+ aOO*tmp_exp *fcoupured(r,r1OO,r2OO))/ r ; //( - ) } @@ -1910,17 +1910,17 @@ void PairSMTBQ::tabsm() { int k,m; double s,r,tmpb,tmpr,fcv,fcdv; - - memory->create(tabsmb,kmax,maxintsm+1,"pair:tabsmb"); + + memory->create(tabsmb,kmax,maxintsm+1,"pair:tabsmb"); memory->create(tabsmr,kmax,maxintsm+1,"pair:tabsmr"); - memory->create(dtabsmb,kmax,maxintsm+1,"pair:dtabsmb"); - memory->create(dtabsmr,kmax,maxintsm+1,"pair:dtabsmr"); - - + memory->create(dtabsmb,kmax,maxintsm+1,"pair:dtabsmb"); + memory->create(dtabsmr,kmax,maxintsm+1,"pair:dtabsmr"); + + for (m = 0; m <= maxintparam; m++) { - + if (intparams[m].intsm == 0) continue; - + double rc1 = intparams[m].dc1; double rc2 = intparams[m].dc2; double A = intparams[m].a; @@ -1928,76 +1928,76 @@ void PairSMTBQ::tabsm() double Ksi = intparams[m].ksi; double q = intparams[m].q; double rzero = intparams[m].r0; - int sm = intparams[m].intsm; - - - for (k=0; k < kmax; k++) - { - s = double(k)*ds ; r = sqrt(s); - if (k==0) r=10e-30; + int sm = intparams[m].intsm; + + + for (k=0; k < kmax; k++) + { + s = double(k)*ds ; r = sqrt(s); + if (k==0) r=10e-30; tmpb = exp( -2.0*q*(r/rzero - 1.0)); tmpr = exp( -p*(r/rzero - 1.0)); - + if (r <= rc1) { - - // -- Energy + + // -- Energy tabsmb[k][sm] = Ksi*Ksi * tmpb ; tabsmr[k][sm] = A * tmpr ; - + // -- Force - /* dtabsmb ne correspond pas vraiment a une force puisqu'il y a le /r - (on a donc une unite force/distance). Le programme multiplie ensuite - (dans le PairSMTBQ::compute ) dtabsmb par la projection du vecteur r - sur un axe x (ou y ou z) pour determiner la composante de la force selon - cette direction. Donc tout est ok au final. */ + /* dtabsmb ne correspond pas vraiment a une force puisqu'il y a le /r + (on a donc une unite force/distance). Le programme multiplie ensuite + (dans le PairSMTBQ::compute ) dtabsmb par la projection du vecteur r + sur un axe x (ou y ou z) pour determiner la composante de la force selon + cette direction. Donc tout est ok au final. */ - dtabsmb[k][sm] = - 2.0 *Ksi*Ksi* q/rzero * tmpb /r; - dtabsmr[k][sm] = - A * p/rzero * tmpr/r ; + dtabsmb[k][sm] = - 2.0 *Ksi*Ksi* q/rzero * tmpb /r; + dtabsmr[k][sm] = - A * p/rzero * tmpr/r ; } // if - + else if (r > rc1 && r <= rc2) { - - // -- Energie + + // -- Energie fcv = fcoupure(r,intparams[sm].dc1,intparams[sm].dc2); tabsmb[k][sm] = fcv* Ksi*Ksi * tmpb ; tabsmr[k][sm] = fcv* A * tmpr ; - + // -- Force - /* dtabsmb ne correspond pas vraiment a une force puisqu'il y a le /r - (on a donc une unite force/distance). Le programme multiplie ensuite - (dans le PairSMTBQ::compute ) d tabsmb par la projection du vecteur - r sur un axe x (ou y ou z) pour determiner la composante de la force + /* dtabsmb ne correspond pas vraiment a une force puisqu'il y a le /r + (on a donc une unite force/distance). Le programme multiplie ensuite + (dans le PairSMTBQ::compute ) d tabsmb par la projection du vecteur + r sur un axe x (ou y ou z) pour determiner la composante de la force selon cette direction. Donc tout est ok au final. */ - + fcdv = fcoupured(r,intparams[sm].dc1,intparams[sm].dc2); dtabsmb[k][sm] = (fcv*( - 2.0 *Ksi*Ksi* q/rzero * tmpb )+fcdv* Ksi*Ksi * tmpb )/r ; - dtabsmr[k][sm] = (fcv*( - A * p/rzero * tmpr )+fcdv*A * tmpr )/r ; + dtabsmr[k][sm] = (fcv*( - A * p/rzero * tmpr )+fcdv*A * tmpr )/r ; + + } - } - - else + else { - - // -- Energie + + // -- Energie tabsmb[k][sm] = 0.0; tabsmr[k][sm] = 0.0; - + // -- Force dtabsmb[k][sm] = 0.0; - dtabsmr[k][sm] = 0.0; + dtabsmr[k][sm] = 0.0; + + } + - } - - } // for kmax - - + + } // for maxintparam - + } @@ -2013,34 +2013,34 @@ void PairSMTBQ::repulsive(Intparam *intparam, double rsq, int i, int j, /* ================================================ rsq : square of ij distance fforce : repulsion force - eng : repulsion energy + eng : repulsion energy eflag : Si oui ou non on calcule l'energie =================================================*/ - int l; + int l; double r,sds,xi,t1,t2,dt1,dt2,sweet,iq,jq; double rrcs = intparam->dc2; int sm = intparam->intsm; - + // printf ("On rentre dans repulsive\n"); - + r = rsq; if (sqrt(r) > rrcs) return ; - + sds = r/ds ; l = int(sds) ; xi = sds - double(l) ; - + t1 = tabsmr[l][sm] + (tabsmr[l+1][sm] - tabsmr[l][sm])*xi ; t2 = tabsmr[l+1][sm] + (tabsmr[l+2][sm] - tabsmr[l+1][sm])*(xi-1.0) ; - + dt1 = dtabsmr[l][sm] + (dtabsmr[l+1][sm] - dtabsmr[l][sm])*xi ; dt2 = dtabsmr[l+1][sm] + (dtabsmr[l+2][sm] - dtabsmr[l+1][sm])*(xi-1.0) ; if (strcmp(intparam->mode,"oxide") == 0) { - fforce = - 2.0*(dt1 + (dt2 - dt1)*xi/2.0); + fforce = - 2.0*(dt1 + (dt2 - dt1)*xi/2.0); eng = (t1 + (t2 - t1)*xi/2.0) ; } else if (strcmp(intparam->mode,"metal") == 0) @@ -2049,11 +2049,11 @@ void PairSMTBQ::repulsive(Intparam *intparam, double rsq, int i, int j, fforce = - 2.0*(dt1 + (dt2 - dt1)*xi/2.0) * sweet ; eng = (t1 + (t2 - t1)*xi/2.0) * sweet ; } - + } -/* --------------------------------------------------------------------------------- */ +/* --------------------------------------------------------------------------------- */ void PairSMTBQ::attractive(Intparam *intparam, double rsq, @@ -2062,45 +2062,45 @@ void PairSMTBQ::attractive(Intparam *intparam, double rsq, int itype,l; double r,t1,t2,xi,sds; double dqcov,sweet,dq,mu; - + double rrcs = intparam->dc2; int *type = atom->type; int sm = intparam->intsm; - + itype = map[type[i]]; - + r = rsq; if (sqrt(r) > rrcs) return ; - - + + sds = r/ds ; l = int(sds) ; xi = sds - double(l) ; - + t1 = tabsmb[l][sm] + (tabsmb[l+1][sm] - tabsmb[l][sm])*xi ; t2 = tabsmb[l+1][sm] + (tabsmb[l+2][sm] - tabsmb[l+1][sm])*(xi-1.0) ; - - - + + + if (strcmp(intparam->mode,"oxide") == 0) { mu = 0.5*(sqrt(params[1].sto) + sqrt(params[0].sto)); - + // dq = fabs(params[itype].qform) - fabs(iq); -// dqcov = dq*(2.0*ncov/params[itype].sto - dq); - +// dqcov = dq*(2.0*ncov/params[itype].sto - dq); + sbcov[i] += (t1 + (t2 - t1)*xi/2.0) *params[itype].sto*mu*mu; // if (i < 10) printf ("i %d, iq %f sbcov %f \n",i,iq,sbcov[i]); - + if (sqrt(r)<r1Coord) { coord[i] += 1 ; } else if (sqrt(r)<r2Coord){ coord[i] += fcoupure(sqrt(r),r1Coord,r2Coord) ;} - } + } else if (strcmp(intparam->mode,"metal") == 0) { sweet = 1.0; sbmet[i] += (t1 + (t2 - t1)*xi/2.0) * sweet ; } - + } /* ---------------------------------------------------------------------- */ @@ -2109,50 +2109,50 @@ void PairSMTBQ::f_att(Intparam *intparam, int i, int j,double rsq, double &fforc { int itype,jtype,l; int *type = atom->type; - + double r,sds,xi,dt1,dt2,dq,dqcovi,dqcovj; double fcov_ij,fcov_ji,sweet,iq,jq,mu; - + int sm = intparam->intsm; double *q = atom->q; - + itype = map[type[i]]; jtype = map[type[j]]; iq = q[i] ; jq = q[j]; - + r = rsq; - + sds = r/ds ; l = int(sds) ; xi = sds - double(l) ; - + dt1 = dtabsmb[l][sm] + (dtabsmb[l+1][sm] - dtabsmb[l][sm])*xi ; dt2 = dtabsmb[l+1][sm] + (dtabsmb[l+2][sm] - dtabsmb[l+1][sm])*(xi-1.0) ; - + dq = fabs(params[itype].qform) - fabs(iq); dqcovi = dq*(2.0*ncov/params[itype].sto - dq); dq = fabs(params[jtype].qform) - fabs(jq); dqcovj = dq*(2.0*ncov/params[jtype].sto - dq); - + if (strcmp(intparam->mode,"oxide") == 0) { //------------------------------------------ - mu = 0.5*(sqrt(params[1].sto) + sqrt(params[0].sto)); + mu = 0.5*(sqrt(params[1].sto) + sqrt(params[0].sto)); fcov_ij = (dt1 + (dt2 - dt1)*xi/2.0) * dqcovi *params[itype].sto*mu*mu; - fcov_ji = (dt1 + (dt2 - dt1)*xi/2.0) * dqcovj *params[jtype].sto*mu*mu; - - fforce = 0.5 * ( fcov_ij/sqrt(sbcov[i]*dqcovi + sbmet[i]) + fcov_ji = (dt1 + (dt2 - dt1)*xi/2.0) * dqcovj *params[jtype].sto*mu*mu; + + fforce = 0.5 * ( fcov_ij/sqrt(sbcov[i]*dqcovi + sbmet[i]) + fcov_ji/sqrt(sbcov[j]*dqcovj + sbmet[j]) ) ; - } + } else if (strcmp(intparam->mode,"metal") == 0) { //----------------------------------------------- - sweet = 1.0; + sweet = 1.0; fcov_ij = (dt1 + (dt2 - dt1)*xi/2.0) * sweet ; - - fforce = 0.5 * fcov_ij*( 1.0/sqrt(sbcov[i]*dqcovi + sbmet[i]) - + 1.0/sqrt(sbcov[j]*dqcovj + sbmet[j]) ) ; - } - + + fforce = 0.5 * fcov_ij*( 1.0/sqrt(sbcov[i]*dqcovi + sbmet[i]) + + 1.0/sqrt(sbcov[j]*dqcovj + sbmet[j]) ) ; + } + } /* ---------------------------------------------------------------------- */ @@ -2164,16 +2164,16 @@ void PairSMTBQ::pot_COV(Param *param, int i, double &qforce) double *q = atom->q; double qform = param->qform; double sto = param->sto; - + sign = qform / fabs(qform); - iq = q[i]; - + iq = q[i]; + dq = fabs(qform) - fabs(iq); DQ = dq*(2.0*ncov/sto - dq); - - if (fabs(iq) < 1.0e-7 || fabs(sbcov[i]) < 1.0e-7) { + + if (fabs(iq) < 1.0e-7 || fabs(sbcov[i]) < 1.0e-7) { qforce = 0.0; } - else { + else { qforce = sign*sbcov[i]/sqrt(sbcov[i]*DQ + sbmet[i])*(ncov/sto - dq) ; } @@ -2187,34 +2187,34 @@ double PairSMTBQ::potmet(Intparam *intparam, double rsq, int l,itype,jtype; int *type = atom->type; double chi,sds,xi,t1,t2,r,dsweet,dq,dqcovi,dqcovj; - + int sm = intparam->intsm; itype = map[type[i]]; jtype = map[type[j]]; - - r = rsq; + + r = rsq; sds = r/ds ; l = int(sds) ; xi = sds - double(l) ; - + t1 = tabsmb[l][sm] + (tabsmb[l+1][sm] - tabsmb[l][sm])*xi ; t2 = tabsmb[l+1][sm] + (tabsmb[l+2][sm] - tabsmb[l+1][sm])*(xi-1.0) ; - + dq = fabs(params[itype].qform) - fabs(iq); dqcovi = dq*(2.0*ncov/params[itype].sto - dq); dq = fabs(params[jtype].qform) - fabs(jq); dqcovj = dq*(2.0*ncov/params[jtype].sto - dq); - + dsweet = 0.0; - chi = (t1 + (t2 - t1)*xi/2.0) * dsweet *( 1.0/(2.0*sqrt(sbcov[i]*dqcovi+sbmet[i])) + chi = (t1 + (t2 - t1)*xi/2.0) * dsweet *( 1.0/(2.0*sqrt(sbcov[i]*dqcovi+sbmet[i])) + 1.0/(2.0*sqrt(sbcov[j]*dqcovj+sbmet[j])) ); return chi; -} +} /* ---------------------------------------------------------------------- - Cutting Function + Cutting Function ----------------------------------------------------------------------*/ @@ -2223,7 +2223,7 @@ double PairSMTBQ::potmet(Intparam *intparam, double rsq, double PairSMTBQ::fcoupure(double r, double rep_dc1, double rep_dc2) { double ddc,a3,a4,a5,x; - + if (r<rep_dc1) {return 1;} else if (r> rep_dc2) @@ -2237,7 +2237,7 @@ double PairSMTBQ::fcoupure(double r, double rep_dc1, double rep_dc2) a3 = -10/(ddc*ddc*ddc); a4 = -15/(ddc*ddc*ddc*ddc); a5 = -6/(ddc*ddc*ddc*ddc*ddc); - + return x*x*x*(a3 + x*(a4 + x*a5));} } @@ -2250,9 +2250,9 @@ double PairSMTBQ::fcoupure(double r, double rep_dc1, double rep_dc2) double PairSMTBQ::fcoupured(double r, double rep_dc1, double rep_dc2) { - + double ddc,a3,a4,a5,x; - + if ( r>rep_dc1 && r<rep_dc2) { ddc = rep_dc2 - rep_dc1; x = r - rep_dc2; @@ -2260,7 +2260,7 @@ double PairSMTBQ::fcoupured(double r, double rep_dc1, double rep_dc2) a3 = -10/(ddc*ddc*ddc); a4 = -15/(ddc*ddc*ddc*ddc); a5 = -6/(ddc*ddc*ddc*ddc*ddc); - + return x*x*(3*a3 + x*(4*a4 + 5*x*a5));} else {return 0;} } @@ -2278,7 +2278,7 @@ double PairSMTBQ::fcoupured(double r, double rep_dc1, double rep_dc2) double PairSMTBQ::fcoup2(double c, double x, double delta) { double dc; - + if (c<x-delta) {return 1;} else if (c> x+delta) @@ -2291,7 +2291,7 @@ double PairSMTBQ::fcoup2(double c, double x, double delta) } /* ---------------------------------------------------------------------- - Primitive of cutting function for derive (force) + Primitive of cutting function for derive (force) ----------------------------------------------------------------------*/ @@ -2299,8 +2299,8 @@ double PairSMTBQ::fcoup2(double c, double x, double delta) double PairSMTBQ::Primfcoup2(double c, double x, double delta) { - - return (c*(c*c*c - 4* c*c* x - 4* (x - 2 *delta) * (x+delta)*(x+delta) + + + return (c*(c*c*c - 4* c*c* x - 4* (x - 2 *delta) * (x+delta)*(x+delta) + 6* c *(x*x - delta*delta)))/(16* delta*delta*delta); } @@ -2315,7 +2315,7 @@ double PairSMTBQ::Primfcoup2(double c, double x, double delta) double PairSMTBQ::Intfcoup2(double c, double x, double delta) { - + if (c<x-delta) {return c - x + delta + Primfcoup2(x-delta,x,delta) - Primfcoup2(x,x,delta) ;} else if (c> x+delta) @@ -2326,8 +2326,8 @@ double PairSMTBQ::Intfcoup2(double c, double x, double delta) } -/* --------------------------------------------------------------------- - Energy derivation respect charge Q +/* --------------------------------------------------------------------- + Energy derivation respect charge Q --------------------------------------------------------------------- */ void PairSMTBQ::QForce_charge(int loop) @@ -2345,31 +2345,31 @@ void PairSMTBQ::QForce_charge(int loop) double *q = atom->q; int *type = atom->type; int step = update->ntimestep; - + int inum = list->inum; ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; int nlocal = atom->nlocal; - - + + // loop over full neighbor list of my atoms fqi = fqj = fqij = fqij2 = fqjj = 0.0; - + // ================== if (loop == 0) { // ================== - + for (ii = 0; ii < inum; ii ++) { //-------------------------------- i = ilist[ii]; itype = map[type[i]]; - + gp = flag_QEq[i]; sbcov[i] =coord[i]= sbmet[i] = 0.0; @@ -2379,9 +2379,9 @@ void PairSMTBQ::QForce_charge(int loop) ytmp = x[i][1]; ztmp = x[i][2]; iq = q[i]; - - - + + + // two-body interactions @@ -2406,28 +2406,28 @@ void PairSMTBQ::QForce_charge(int loop) rsq = vec3_dot(delr,delr); -// Covalente charge forces - sbcov initialization +// Covalente charge forces - sbcov initialization // ------------------------------------------------ if (sqrt(rsq) > intparams[m].dc2) continue; - + attractive (&intparams[m],rsq,eflag,i,iq,j,jq); } // ---------------------------------------------- for jj - - + + } // -------------------------------------------- ii // =============================================== - // Communicates the tables *sbcov and *sbmet + // Communicates the tables *sbcov and *sbmet // to calculate the N-body forces - // ================================================ - + // ================================================ + forward (sbcov) ; reverse (sbcov); forward (coord) ; reverse (coord); - forward (sbmet) ; reverse (sbmet); - - + forward (sbmet) ; reverse (sbmet); + + if (nteam == 0) return; //no oxide if (Qstep == 0 || fmod(double(step), double(Qstep)) != 0.0) return; @@ -2436,13 +2436,13 @@ void PairSMTBQ::QForce_charge(int loop) // ======================= - // =============================================== + // =============================================== - for (ii=0; ii<inum; ii++) - { + for (ii=0; ii<inum; ii++) + { i = ilist[ii]; itype = map[type[i]]; gp = flag_QEq[i]; iq = q[i]; - + potmad[i] = potself[i] = potcov[i] = 0.0 ; if (gp == 0) continue; @@ -2452,8 +2452,8 @@ void PairSMTBQ::QForce_charge(int loop) ztmp = x[i][2]; fqi = 0.0 ; - - // Madelung potential + + // Madelung potential // -------------------- potmad[i] += 2.0*Vself*iq ; @@ -2461,11 +2461,11 @@ void PairSMTBQ::QForce_charge(int loop) // ----------------------------- fqi = qfo_self(¶ms[itype],iq); potself[i] = fqi ; - + // Loop on Second moment neighbor - // ------------------------------- + // ------------------------------- jlist = firstneigh[i]; jnum = numneigh[i]; @@ -2477,9 +2477,9 @@ void PairSMTBQ::QForce_charge(int loop) m = intype[itype][jtype]; jq = q[j]; - + delr[0] = x[j][0] - xtmp; - delr[1] = x[j][1] - ytmp; + delr[1] = x[j][1] - ytmp; delr[2] = x[j][2] - ztmp; rsq = vec3_dot(delr,delr); @@ -2492,11 +2492,11 @@ void PairSMTBQ::QForce_charge(int loop) // pot_ES2 (i,j,rsq,fqij2); pot_ES (i,j,rsq,fqij); - potmad[i] += jq*fqij ; + potmad[i] += jq*fqij ; } // ------ jj - + fqi = 0.0; pot_COV (¶ms[itype],i,fqi) ; potcov[i] = fqi ; @@ -2515,14 +2515,14 @@ void PairSMTBQ::Charge() int *ilist; double heatpq,qmass,dtq,dtq2,qtot,qtotll; double t_init,t_end,dt; - + double *Transf,*TransfAll; double *q = atom->q; double **x = atom->x; int *type = atom->type; int step = update->ntimestep; - + int inum = list->inum; ilist = list->ilist; @@ -2533,16 +2533,16 @@ void PairSMTBQ::Charge() // --------------------------- // Mise en place des groupes // --------------------------- - - if (strcmp(QEqMode,"BulkFromSlab") == 0) + + if (strcmp(QEqMode,"BulkFromSlab") == 0) groupBulkFromSlab_QEq(); - else if (strcmp(QEqMode,"QEqAll") == 0) + else if (strcmp(QEqMode,"QEqAll") == 0) groupQEqAll_QEq(); - else if (strcmp(QEqMode,"QEqAllParallel") == 0) + else if (strcmp(QEqMode,"QEqAllParallel") == 0) groupQEqAllParallel_QEq(); - else if (strcmp(QEqMode,"Surface") == 0) + else if (strcmp(QEqMode,"Surface") == 0) groupSurface_QEq(); - + if (nteam+1 != cluster) { @@ -2579,24 +2579,24 @@ void PairSMTBQ::Charge() for (i=0; i<nteam+1; i++) { - nQEq[i] = nQEqa[i] = nQEqc[i] = 0; - nQEqall[i] = nQEqcall[i] = nQEqaall[i] = end[i]= 0; + nQEq[i] = nQEqa[i] = nQEqc[i] = 0; + nQEqall[i] = nQEqcall[i] = nQEqaall[i] = end[i]= 0; enegchk[i] = enegtot[i] = enegmax[i] = 0.0; qtota[i] = qtotc[i] = qtotall[i] = qtotcll[i] = 0.0; - sigmaall[i] = sigmacll[i] = 0.0; + sigmaall[i] = sigmacll[i] = 0.0; } qtot = qtotll = 0.0 ; - - for (ii = 0; ii < inum; ii++) { + + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; itype = map[type[i]]; gp = flag_QEq[i]; q1[i] = q2[i] = qf[i] = 0.0; - qtot += q[i] ; + qtot += q[i] ; nQEq[gp] += 1; if (itype != 0) { qtotc[gp] += q[i]; nQEqc[gp] += 1; } - if (itype == 0) { qtota[gp] += q[i]; nQEqa[gp] += 1; } + if (itype == 0) { qtota[gp] += q[i]; nQEqa[gp] += 1; } } MPI_Allreduce(nQEq,nQEqall,nteam+1,MPI_INT,MPI_SUM,world); @@ -2611,10 +2611,10 @@ void PairSMTBQ::Charge() // --------------------------------- // Init_charge(nQEq,nQEqa,nQEqc); // --------------------------------- - + if (update->ntimestep == 0 && (strcmp(QInitMode,"true") == 0) ) { //Carefull here it won't be fine if there are more than 2 species!!! - QOxInit=max(QOxInit, -0.98* params[1].qform *nQEqcall[gp]/nQEqaall[gp]) ; + QOxInit=max(QOxInit, -0.98* params[1].qform *nQEqcall[gp]/nQEqaall[gp]) ; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; itype = map[type[i]]; @@ -2623,8 +2623,8 @@ void PairSMTBQ::Charge() // if (gp == 0) continue; if (itype == 0) q[i] = QOxInit ; - if (itype > 0) q[i] = -QOxInit * nQEqaall[gp]/nQEqcall[gp]; - } + if (itype > 0) q[i] = -QOxInit * nQEqaall[gp]/nQEqcall[gp]; + } } if (nteam == 0 || Qstep == 0) return; @@ -2638,12 +2638,12 @@ void PairSMTBQ::Charge() if (me == 0 && strcmp(Bavard,"false") != 0) { for (gp = 0; gp < nteam+1; gp++) { - printf (" ++++ Groupe %d - Nox %d Ncat %d\n",gp,nQEqaall[gp],nQEqcall[gp]); + printf (" ++++ Groupe %d - Nox %d Ncat %d\n",gp,nQEqaall[gp],nQEqcall[gp]); if (nQEqcall[gp] !=0 && nQEqaall[gp] !=0 ) - printf (" neutralite des charges %f\n qtotc %f qtota %f\n", - qtotll,qtotcll[gp]/nQEqcall[gp],qtotall[gp]/nQEqaall[gp]); + printf (" neutralite des charges %f\n qtotc %f qtota %f\n", + qtotll,qtotcll[gp]/nQEqcall[gp],qtotall[gp]/nQEqaall[gp]); printf (" ---------------------------- \n");} - } + } // ======================= Tab transfert ================== // Transf[gp] = enegtot[gp] @@ -2651,7 +2651,7 @@ void PairSMTBQ::Charge() // Transf[gp+2cluster] = Qtota[gp] // Transf[3cluster] = Qtot // ------------------------------------------------------- - memory->create(Transf,3*cluster+1,"pair:Tranf"); + memory->create(Transf,3*cluster+1,"pair:Tranf"); memory->create(TransfAll,3*cluster+1,"pair:TranfAll"); // ======================================================== @@ -2664,11 +2664,11 @@ void PairSMTBQ::Charge() for (gp=0; gp<nteam+1; gp++) { Transf[gp] = Transf[gp+cluster] = Transf[gp+2*cluster] = 0.0; TransfAll[gp] = TransfAll[gp+cluster] = TransfAll[gp+2*cluster] = 0.0; - enegtot[gp] = enegtotall[gp] = enegchkall[gp] = enegmaxall[gp] = 0.0 ; + enegtot[gp] = enegtotall[gp] = enegchkall[gp] = enegmaxall[gp] = 0.0 ; } for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; + i = ilist[ii]; q1[i] += qf[i]*dtq2 - heatpq*q1[i]; q[i] += q1[i]; @@ -2678,24 +2678,24 @@ void PairSMTBQ::Charge() if (itype == 0) Transf[gp+2*cluster] += q[i]; if (itype != 0) Transf[gp+cluster] += q[i]; } - + // Communication des charges - // --------------------------- + // --------------------------- forward(q) ; reverse(q); // Calcul des potentiel // ---------------------- - QForce_charge(iloop); + QForce_charge(iloop); // exit(1); - for (ii = 0; ii < inum; ii++) + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; itype = map[type[i]]; gp = flag_QEq[i]; - qf[i] = 0.0; + qf[i] = 0.0; qf[i] = potself[i]+potmad[i]+potcov[i]+chimet[i] ; Transf[gp] += qf[i]; } @@ -2704,21 +2704,21 @@ void PairSMTBQ::Charge() for (i = 0; i < nteam+1; i++) { - if (nQEqall[i] !=0) TransfAll[i] /= double(nQEqall[i]); + if (nQEqall[i] !=0) TransfAll[i] /= double(nQEqall[i]); enegchk[i] = enegmax[i] = 0.0; } - + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; itype = map[type[i]]; gp = flag_QEq[i]; - + if (gp == 0) continue; - + q2[i] = TransfAll[gp] - qf[i]; enegmax[gp] = MAX(enegmax[gp],fabs(q2[i])); - enegchk[gp] += fabs(q2[i]); + enegchk[gp] += fabs(q2[i]); qf[i] = q2[i]; } // Boucle local @@ -2727,15 +2727,15 @@ void PairSMTBQ::Charge() MPI_Allreduce(enegmax,enegmaxall,nteam+1,MPI_DOUBLE,MPI_MAX,world); - for (gp = 0; gp < nteam+1; gp++) { - if(nQEqall[gp] !=0) { - enegchk[gp] = enegchkall[gp]/double(nQEqall[gp]); + for (gp = 0; gp < nteam+1; gp++) { + if(nQEqall[gp] !=0) { + enegchk[gp] = enegchkall[gp]/double(nQEqall[gp]); enegmax[gp] = enegmaxall[gp]; } - } + } // ----------------------------------------------------- - // Convergence Test + // Convergence Test // ----------------------------------------------------- m = 0; @@ -2744,62 +2744,62 @@ void PairSMTBQ::Charge() } for (gp = 1; gp < nteam+1; gp++) { m += end[gp] ; } - if (m == nteam) { break; } - // ----------------------------------------------------- + if (m == nteam) { break; } + // ----------------------------------------------------- // ----------------------------------------------------- - for (ii = 0; ii < inum; ii++) { + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; - q1[i] += qf[i]*dtq2 - heatpq*q1[i]; + q1[i] += qf[i]*dtq2 - heatpq*q1[i]; } // -------------------------------------------- } // -------------------------------- iloop // -------------------------------------------- - + // ======================================= // Charge Communication. - // ======================================= + // ======================================= forward(q); reverse(q); - + //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // ========================================== // Ecriture des potentiels dans un fichier // ========================================== - if (strcmp(writepot,"true") == 0 && fmod(double(step), Neverypot) == 0.0) { - + if (strcmp(writepot,"true") == 0 && fmod(double(step), Neverypot) == 0.0) { + ofstream fichierpot("Electroneg_component.txt", ios::out | ios::trunc) ; - + for (ii = 0; ii < inum; ii++) { - i = ilist[ii]; + i = ilist[ii]; itype = map[type[i]]; gp = flag_QEq[i]; - - + + if (fichierpot) fichierpot<< setprecision(9) <<i <<" "<<itype<<" "<<x[i][0]<<" "<<x[i][1] <<" "<<x[i][2]<<" "<<q[i]<<" "<<potself[i] + potmad[i]<<" "<<potcov[i] <<" "<<sbcov[i]<<" "<<TransfAll[gp]<<endl; - + } if (fichierpot) fichierpot.close() ; - } - + } + //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - + + // Statistique (ecart type) // ------------------------ for (i=0; i<nteam+1; i++) { if(nQEqcall[i] !=0) { TransfAll[i+cluster] /= double(nQEqcall[i]) ; TransfAll[i+2*cluster] /= double(nQEqaall[i]) ;} - sigmaa[i] = sigmac[i] = 0.0; + sigmaa[i] = sigmac[i] = 0.0; } - + qtot = 0.0 ; - for (ii = 0; ii < inum; ii++) + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; itype = map[type[i]]; @@ -2810,37 +2810,37 @@ void PairSMTBQ::Charge() if (itype == 0) sigmaa[gp] += (q[i]-TransfAll[gp+2*cluster])*(q[i]-TransfAll[gp+2*cluster]); if (itype == 1) sigmac[gp] += (q[i]-TransfAll[gp+cluster])*(q[i]-TransfAll[gp+cluster]); - } + } MPI_Allreduce(sigmaa,sigmaall,nteam+1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(sigmac,sigmacll,nteam+1,MPI_DOUBLE,MPI_SUM,world); for (gp = 1; gp < nteam+1; gp++) { sigmaall[gp] = sqrt(sigmaall[gp]/double(nQEqaall[gp])) ; - sigmacll[gp] = sqrt(sigmacll[gp]/double(nQEqcall[gp])) ; + sigmacll[gp] = sqrt(sigmacll[gp]/double(nQEqcall[gp])) ; } - - + + if (me == 0 && strcmp(Bavard,"false") != 0){ for (gp = 0; gp < nteam+1; gp++) { printf (" -------------- Groupe %d -----------------\n",gp); printf (" qtotc %f(+- %f) qtota %f(+- %f)\n", TransfAll[gp+cluster],sigmacll[gp],TransfAll[gp+2*cluster],sigmaall[gp]); printf (" Potentiel elec total : %f\n iloop %d, qtot %f\n",TransfAll[gp],iloop,TransfAll[3*cluster]); - printf (" convergence : %f - %f\n",enegchk[gp],enegmax[gp]); + printf (" convergence : %f - %f\n",enegchk[gp],enegmax[gp]); } - + t_end = MPI_Wtime(); dt = t_end - t_init; printf (" temps dans charges : %f seconde. \n",dt); printf (" ======================================================== \n"); - } + } // ============== Destroy Tab memory->destroy(Transf); memory->destroy(TransfAll); - + } /* ---------------------------------------------------------------------- */ @@ -2857,15 +2857,15 @@ void PairSMTBQ::groupBulkFromSlab_QEq() { i = ilist[ii]; ztmp = x[i][2]; - if (ztmp>zlim1QEq && ztmp< zlim2QEq) + if (ztmp>zlim1QEq && ztmp< zlim2QEq) flag_QEq[i]=1; else flag_QEq[i]=0; nteam=1; - + } - + } // ---------------------------------------------- @@ -2875,7 +2875,7 @@ void PairSMTBQ::groupQEqAll_QEq() int *ilist; int inum = list->inum; ilist = list->ilist; - + nteam=1; for (ii = 0; ii < inum; ii++) @@ -2883,7 +2883,7 @@ void PairSMTBQ::groupQEqAll_QEq() i= ilist[ii]; flag_QEq[i]=1; } - + } // ---------------------------------------------- @@ -2895,20 +2895,20 @@ void PairSMTBQ::groupSurface_QEq() double ztmp; int inum = list->inum; ilist = list->ilist; - + for (ii = 0; ii < inum; ii++) { i = ilist[ii]; ztmp = x[i][2]; - if (ztmp>zlim1QEq) + if (ztmp>zlim1QEq) flag_QEq[i]=1; else flag_QEq[i]=0; nteam=1; - + } - + } @@ -2920,7 +2920,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() double delr[3],xtmp,ytmp,ztmp,rsq; int **flag_gp, *nelt, **tab_gp; int QEq,QEqall[nproc]; - + double **x = atom->x; int *type = atom->type; int inum = list->inum; @@ -2937,7 +2937,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() nboite = nlocal + nghost; int **tabtemp,**Alltabtemp, *gptmp, *Allgptmp; - + memory->create(tabtemp,10*nproc+10,nproc,"pair:tabtemp"); memory->create(Alltabtemp,10*nproc+10,nproc,"pair:Alltabtemp"); memory->create(gptmp,10*nproc+10,"pair:gptmp"); @@ -2949,23 +2949,23 @@ void PairSMTBQ::groupQEqAllParallel_QEq() for (i = 0; i < nlocal+nghost ; i++) { flag_QEq[i] = 0; } - for (i = 0; i < 10*nproc; i++) { + for (i = 0; i < 10*nproc; i++) { gptmp[i] = 0; Allgptmp[i] = 0; - for (j=0;j<nproc;j++) { tabtemp[i][j] = 0; - Alltabtemp[i][j] = 0;} + for (j=0;j<nproc;j++) { tabtemp[i][j] = 0; + Alltabtemp[i][j] = 0;} } - for (i = 0; i < 10; i++) { - for (k = 0; k < nboite; k++) { tab_gp[i][k] = 0; - if (i == 0) nelt[k] = 0; + for (i = 0; i < 10; i++) { + for (k = 0; k < nboite; k++) { tab_gp[i][k] = 0; + if (i == 0) nelt[k] = 0; } for (j = 0; j < nproc; j++) { team_elt[i][j] = 0; - for (k = 0; k < 5; k++) { team_QEq[i][j][k] = 0; } - } + for (k = 0; k < 5; k++) { team_QEq[i][j][k] = 0; } + } } QEq = 0; - + // printf ("groupeQEq me %d - nloc %d nghost %d boite %d\n", // me,nlocal,nghost,nboite); @@ -2985,7 +2985,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() jlist = firstneigh[i]; jnum = numneigh[i]; - for (jj = 0; jj < jnum; jj++ ) + for (jj = 0; jj < jnum; jj++ ) { j = jlist[jj] ; jtype = map[type[j]]; if (jtype == itype) continue; @@ -2996,12 +2996,12 @@ void PairSMTBQ::groupQEqAllParallel_QEq() delr[2] = x[j][2] - ztmp; rsq = vec3_dot(delr,delr); - if (sqrt(rsq) <= intparams[m].dc2) { - flag_QEq[i] = 1; flag_QEq[j] = 1; + if (sqrt(rsq) <= intparams[m].dc2) { + flag_QEq[i] = 1; flag_QEq[j] = 1; } } if (flag_QEq[i] == 1) { - QEq = 1; + QEq = 1; } } @@ -3041,7 +3041,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() for (ii = 0; ii < inum; ii++) { i = ilist[ii] ; itype = map[type[i]]; - if (itype != 0 || flag_QEq[i] == 0) continue; + if (itype != 0 || flag_QEq[i] == 0) continue; m = 0; @@ -3049,7 +3049,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() // Grouping Initialisation - // ----------------------------- + // ----------------------------- if (flag_gp[me][i] == 0) { ngp += 1; nelt[ngp] = 0; tab_gp[ngp][nelt[ngp]] = i; @@ -3067,16 +3067,16 @@ void PairSMTBQ::groupQEqAllParallel_QEq() ktype = map[type[k]]; // printf ("[me %d] kk - gp %d elemt %d : atom %d(%d)\n",me,ngp,kk,k,ktype); if (k >= nlocal) continue; - + xtmp = x[k][0]; ytmp = x[k][1]; ztmp = x[k][2]; // Loop on the oxygen's neighbor of the group - // --------------------------------------------- + // --------------------------------------------- jlist = firstneigh[k]; jnum = numneigh[k]; - for (j = 0; j < nboite; j++ ) + for (j = 0; j < nboite; j++ ) { jtype = map[type[j]]; if (jtype == ktype) continue; @@ -3085,7 +3085,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() if (jtype == 0 && flag_QEq[j] == 0) continue; - if (flag_gp[me][j] == ngp) continue; + if (flag_gp[me][j] == ngp) continue; delr[0] = x[j][0] - xtmp; delr[1] = x[j][1] - ytmp; @@ -3101,7 +3101,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() if (flag_gp[me][j] != 0 && flag_gp[me][j] != ngp && nelt[flag_gp[me][j]] != 0) { printf("[me %d] (atom %d) %d [elt %d] rencontre un nouveau groupe %d [elt %d] (atom %d)\n", - me,k,ngp,nelt[ngp],flag_gp[me][j],nelt[flag_gp[me][j]],j); + me,k,ngp,nelt[ngp],flag_gp[me][j],nelt[flag_gp[me][j]],j); // On met a jours les tableaux // ----------------------------- @@ -3109,15 +3109,15 @@ void PairSMTBQ::groupQEqAllParallel_QEq() z = min(igp,ngp); if (z == igp) { igp = z; } - else if (z == ngp) { + else if (z == ngp) { ngp = igp ; igp = z; - flag_gp[me][j] = ngp; + flag_gp[me][j] = ngp; } for (zz = 0; zz < nelt[ngp]; zz++) { z = tab_gp[ngp][zz]; tab_gp[igp][nelt[igp]] = z; - nelt[igp] += 1; + nelt[igp] += 1; flag_gp[me][z] = igp; tab_gp[ngp][zz] = 0; } @@ -3127,38 +3127,38 @@ void PairSMTBQ::groupQEqAllParallel_QEq() if (flag_gp[me][z] == ngp) flag_gp[me][z] = igp; } - m = 1; kk = 0; + m = 1; kk = 0; ngp = igp; break; } // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - flag_gp[me][j] = ngp; - if (j < nlocal) + flag_gp[me][j] = ngp; + if (j < nlocal) { tab_gp[ngp][nelt[ngp]] = j; - nelt[ngp] += 1; - } - } - } // for j - } // for k + nelt[ngp] += 1; + } + } + } // for j + } // for k } // for ii // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO - // Groups communication + // Groups communication // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO for (i = 0; i < nproc; i++) { forward_int(flag_gp[i]); reverse_int(flag_gp[i]); } - // --- + // --- - // ======================================================= + // ======================================================= // Loop on the cation to make them joined in the oxygen's // group which it interacts // ======================================================= igp = 0; - for (ii = 0; ii < inum; ii++) + for (ii = 0; ii < inum; ii++) { i = ilist[ii] ; itype = map[type[i]]; if (itype == 0) continue; @@ -3169,16 +3169,16 @@ void PairSMTBQ::groupQEqAllParallel_QEq() jlist = firstneigh[i]; jnum = numneigh[i]; - for (jj = 0; jj < jnum; jj++ ) + for (jj = 0; jj < jnum; jj++ ) { j = jlist[jj] ; jtype = map[type[j]]; if (jtype != 0) continue; - m = 0; + m = 0; for (iproc = 0; iproc < nproc; iproc++) { - if (flag_gp[iproc][j] != 0) m = flag_gp[iproc][j]; + if (flag_gp[iproc][j] != 0) m = flag_gp[iproc][j]; } - if (m == 0) continue; + if (m == 0) continue; delr[0] = x[j][0] - xtmp; delr[1] = x[j][1] - ytmp; @@ -3190,7 +3190,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() // if (sqrt(rsq) <= intparams[m].dc2) { // ---------------------------------------- - flag_QEq[i] = 1; igp = flag_gp[me][j]; + flag_QEq[i] = 1; igp = flag_gp[me][j]; if (flag_gp[me][i] == 0) flag_gp[me][i] = igp; @@ -3201,11 +3201,11 @@ void PairSMTBQ::groupQEqAllParallel_QEq() igp = min(flag_gp[me][i],flag_gp[me][j]); if (igp == flag_gp[me][i]) { kgp = flag_gp[me][j]; } else { kgp = flag_gp[me][i]; } - + for (k = 0; k < nelt[kgp]; k++) { z = tab_gp[kgp][k]; tab_gp[igp][nelt[igp]] = z; - nelt[igp] += 1; + nelt[igp] += 1; flag_gp[me][z] = igp; tab_gp[kgp][k] = 0; } @@ -3242,17 +3242,17 @@ void PairSMTBQ::groupQEqAllParallel_QEq() // =============== End of COMM ================= - for (i = 0; i < nboite; i++) { + for (i = 0; i < nboite; i++) { m = 10*me + flag_gp[me][i]; if (m == 10*me) continue; // Pas de groupe zero gptmp[m] = 1; - for (k = 0; k < nproc; k++) { + for (k = 0; k < nproc; k++) { if (k == me) continue; if (tabtemp[m][k] != 0) continue; - if (flag_gp[k][i] != 0) { + if (flag_gp[k][i] != 0) { tabtemp[m][k] = 10*k + flag_gp[k][i]; } } @@ -3261,7 +3261,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() for (k = 0; k < 10*nproc; k++) { MPI_Allreduce(tabtemp[k],Alltabtemp[k],nproc,MPI_INT,MPI_SUM,world); } - MPI_Allreduce(gptmp,Allgptmp,10*nproc,MPI_INT,MPI_SUM,world); + MPI_Allreduce(gptmp,Allgptmp,10*nproc,MPI_INT,MPI_SUM,world); nteam = 0; iproc = 0; for (igp = 0; igp < 10*nproc; igp++) { @@ -3273,22 +3273,22 @@ void PairSMTBQ::groupQEqAllParallel_QEq() nteam += 1; team_elt[nteam][iproc] = 0; team_QEq[nteam][iproc][team_elt[nteam][iproc]] = ngp; - team_elt[nteam][iproc] += 1; - } else { + team_elt[nteam][iproc] += 1; + } else { m = 0; for (i = 1; i < nteam+1; i++) { for (k = 0; k < team_elt[i][iproc]; k++) { if (ngp == team_QEq[i][iproc][k]) m = 1; - } } - if (m == 1) continue; + } } + if (m == 1) continue; // create a new team!! // --------------------------- if (m == 0) { nteam += 1; team_elt[nteam][iproc] = 0; team_QEq[nteam][iproc][team_elt[nteam][iproc]] = ngp; - team_elt[nteam][iproc] += 1; - } + team_elt[nteam][iproc] += 1; + } } // ------- // On a mis une graine dans le groupe et nous allons @@ -3314,7 +3314,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() m = 0; for (j = 0; j < team_elt[nteam][i]; j++) { if (team_QEq[nteam][i][j] == ngp) m = 1; - } + } if (m == 0) { iproc = i; k = 0; @@ -3324,7 +3324,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() } // regard sur les autre proc } // On rempli de proche en proche - } // boucle kk sur les proc + } // boucle kk sur les proc } // Finalement on met le numero de la team en indice du flag_QEq, c mieu! @@ -3340,7 +3340,7 @@ void PairSMTBQ::groupQEqAllParallel_QEq() for (k = 0; k < team_elt[j][me]; k++) { if (gp == team_QEq[j][me][k]) { flag_QEq[i] = j; m = 1; - break; + break; } } if (m == 1) break; @@ -3377,8 +3377,8 @@ void PairSMTBQ::Init_charge(int *nQEq, int *nQEqa, int *nQEqc) test[gp] = 0; init[gp] = 0; } - - // On fait un test sur les charges pour voir sont + + // On fait un test sur les charges pour voir sont // elles sont dans le domaine delimiter par DeltaQ // ------------------------------------------------- for (ii = 0; ii < inum; ii++) { @@ -3392,7 +3392,7 @@ void PairSMTBQ::Init_charge(int *nQEq, int *nQEqa, int *nQEqc) } } - MPI_Allreduce(test,init,nteam+1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(test,init,nteam+1,MPI_INT,MPI_SUM,world); // On fait que sur les atomes hybrides!!! // ---------------------------------------- @@ -3402,7 +3402,7 @@ void PairSMTBQ::Init_charge(int *nQEq, int *nQEqa, int *nQEqc) i = ilist[ii]; itype = map[type[i]]; gp = flag_QEq[i]; - if (gp != 0 && init[gp] != 0) { + if (gp != 0 && init[gp] != 0) { if (itype == 0) q[i] = -1.96; if (itype != 0) q[i] = 1.96 * double(nQEqaall[gp]) / double(nQEqcall[gp]); } @@ -3477,15 +3477,15 @@ void PairSMTBQ::unpack_reverse_comm(int n, int *list, double *buf) void PairSMTBQ::forward(double *tab) { - int i; + int i; int nlocal = atom->nlocal; int nghost = atom->nghost; - + for (i=0; i<nlocal+nghost; i++) tab_comm[i] = tab[i]; - + comm->forward_comm_pair(this); - - for (i=0; i<nlocal+nghost; i++) tab[i] = tab_comm[i]; + + for (i=0; i<nlocal+nghost; i++) tab[i] = tab_comm[i]; } /* ---------------------------------------------------------------------- */ @@ -3497,24 +3497,24 @@ void PairSMTBQ::reverse(double *tab) int nghost = atom->nghost; for (i=0; i<nlocal+nghost; i++) tab_comm[i] = tab[i]; - + comm->reverse_comm_pair(this); - - for (i=0; i<nlocal+nghost; i++) tab[i] = tab_comm[i]; + + for (i=0; i<nlocal+nghost; i++) tab[i] = tab_comm[i]; } /* ---------------------------------------------------------------------- */ void PairSMTBQ::forward_int(int *tab) { - int i; + int i; int nlocal = atom->nlocal; int nghost = atom->nghost; - + for (i=0; i<nlocal+nghost; i++) { tab_comm[i] = double(tab[i]);} - + comm->forward_comm_pair(this); - + for (i=0; i<nlocal+nghost; i++) { if (fabs(tab_comm[i]) > 0.1) tab[i] = int(tab_comm[i]) ; } } @@ -3528,9 +3528,9 @@ void PairSMTBQ::reverse_int(int *tab) int nghost = atom->nghost; for (i=0; i<nlocal+nghost; i++) { tab_comm[i] = double(tab[i]);} - + comm->reverse_comm_pair(this); - + for (i=0; i<nlocal+nghost; i++) { if (fabs(tab_comm[i]) > 0.1) tab[i] = int(tab_comm[i]); } } @@ -3538,7 +3538,7 @@ void PairSMTBQ::reverse_int(int *tab) /* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */ -double PairSMTBQ::memory_usage() +double PairSMTBQ::memory_usage() { double bytes = maxeatom * sizeof(double); bytes += maxvatom*6 * sizeof(double); @@ -3570,7 +3570,7 @@ int PairSMTBQ::Tokenize( char* s, char*** tok ) char *mot; int count=0; mot = NULL; - + strncpy( test, s, MAXLINE ); @@ -3591,9 +3591,9 @@ void PairSMTBQ::CheckEnergyVSForce() int itype,jtype,l,m; double r,t1,t2,sds,xi,engSurf,fforceSurf; double eng,fforce,engBB,fforceBB; - + double za,zb,gam,dgam,dza,dzb, - d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2,na,nb; + d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2,na,nb; int *type = atom->type; char *NameFile; @@ -3603,7 +3603,7 @@ void PairSMTBQ::CheckEnergyVSForce() map[type[i]]=0; //ox itype=map[type[i]]; iq=-1; - + map[type[j]]=0; //ox jtype=map[type[j]]; @@ -3615,11 +3615,11 @@ void PairSMTBQ::CheckEnergyVSForce() na = params[itype].ne ; nb = params[jtype].ne ; - za = params[itype].dzeta ; + za = params[itype].dzeta ; zb = params[jtype].dzeta ; - - // Ouverture du fichier + + // Ouverture du fichier for (iCoord=1;iCoord<5; iCoord++) { @@ -3656,24 +3656,24 @@ void PairSMTBQ::CheckEnergyVSForce() evdwlCoul = 0.0 ; fpairCoul = 0.0; potqeq(i,j,iq,jq,rsq,fpairCoul,eflag,evdwlCoul); fpairCoul=fpairCoul*r; - + rep_OO (&intparams[m],rsq,fpair,eflag,evdwl); ErepR = evdwl; frepR= fpair*r; - gam = dgam = dza = dzb = d2zaa = d2zab = + gam = dgam = dza = dzb = d2zaa = d2zab = d2zbb = d2zra = d2zrb = d2gamr2 = 0.0 ; - + // gammas_(na,nb,za,zb,r,gam,dgam,dza,dzb, // d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2) ; gammas(na,nb,za,zb,r,gam,dgam,dza,dzb, d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2) ; - + sds = rsq/ds ; l = int(sds) ; xi = sds - double(l) ; - + t1 = fafb[l][m] + (fafb[l+1][m] - fafb[l][m])*xi; t2 = fafb[l+1][m] + (fafb[l+2][m] - fafb[l+1][m])*(xi-1.0); @@ -3701,7 +3701,7 @@ void PairSMTBQ::CheckEnergyVSForce() fforceBB = - iq*jq*(t1 + (t2 - t1)*xi/2.0)*r ; if (fichierOxOx) { fichierOxOx<< setprecision (9) <<r <<" "<<evdwlCoul <<" " <<fpairCoul <<" "<<eng <<" " <<fforce <<" "<<engSurf <<" " <<fforceSurf <<" "<<engBB <<" " <<fforceBB <<" "<<ErepR<<" "<<frepR<<" "<<gam<<" "<<dgam<<endl ;} - + } @@ -3720,11 +3720,11 @@ void PairSMTBQ::CheckEnergyVSForce() na = params[itype].ne ; nb = params[jtype].ne ; - za = params[itype].dzeta ; + za = params[itype].dzeta ; zb = params[jtype].dzeta ; - - // Ouverture du fichier + + // Ouverture du fichier for (iCoord=1;iCoord<4; iCoord++) { @@ -3756,15 +3756,15 @@ void PairSMTBQ::CheckEnergyVSForce() evdwlCoul = 0.0 ; fpairCoul = 0.0; potqeq(i,j,iq,jq,rsq,fpairCoul,eflag,evdwlCoul); fpairCoul=fpairCoul*r; - + rep_OO (&intparams[m],rsq,fpair,eflag,evdwl); ErepR = evdwl; frepR= fpair*r; - gam = dgam = dza = dzb = d2zaa = d2zab = + gam = dgam = dza = dzb = d2zaa = d2zab = d2zbb = d2zra = d2zrb = d2gamr2 = 0.0 ; - + // gammas_(na,nb,za,zb,r,gam,dgam,dza,dzb, // d2zaa,d2zab,d2zbb,d2zra,d2zrb,d2gamr2) ; gammas(na,nb,za,zb,r,gam,dgam,dza,dzb, @@ -3772,7 +3772,7 @@ void PairSMTBQ::CheckEnergyVSForce() if (fichierOxTi) { fichierOxTi<< setprecision (9) <<r <<" "<<evdwlCoul <<" " <<fpairCoul <<" "<<ErepR<<" "<<frepR<<" "<<gam<<" "<<dgam<<endl ;} - + } @@ -3785,11 +3785,11 @@ void PairSMTBQ::CheckEnergyVSForce() /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: GAMMAS FUNCTION (GALE) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */ - + void PairSMTBQ::gammas(double &na, double &nb, double &za, double &zb, double &r, double &gam, double &dgam, double &dza, double &dzb, double &d2zaa, double &d2zab, double &d2zbb, double &d2zra, double &d2zrb, double &d2gamr2) -{ +{ /* --------------------------------------------------------------- Subroutine calculates the integral over two s orbtials for Slater functions @@ -3817,7 +3817,7 @@ void PairSMTBQ::gammas(double &na, double &nb, double &za, double &zb, double &r Julian Gale, Imperial College, December 1997 ---------------------------------------------------------------- */ - + int i; double z2ra,z2rb,na2,nb2,halfr,d2rtm,drtrm,rtrm,ss,deriv, dzeta1,dzeta2,d2zeta11,d2zeta12,d2zeta22,d2zeta1r, @@ -3857,11 +3857,11 @@ void PairSMTBQ::gammas(double &na, double &nb, double &za, double &zb, double &r // First term - css(ss,na2-1,0,z2ra,0.0,r,deriv,dzeta1,dzeta2, - d2zeta11,d2zeta12,d2zeta22,d2zeta1r,d2zeta2r, + css(ss,na2-1,0,z2ra,0.0,r,deriv,dzeta1,dzeta2, + d2zeta11,d2zeta12,d2zeta22,d2zeta1r,d2zeta2r, deriv2) ; - gam=rtrm*ss; + gam=rtrm*ss; dgam=rtrm*deriv+float(na)*drtrm*ss; dza=rtrm*dzeta1; d2zaa=rtrm*d2zeta11; @@ -3873,19 +3873,19 @@ void PairSMTBQ::gammas(double &na, double &nb, double &za, double &zb, double &r rtrm=drtrm; drtrm=d2rtrm; ztrm=0.5/(zb*float(nb2)); - + for (i = nb2; i >= 1; i--) { rtrm=rtrm*halfr; drtrm=drtrm*halfr; ztrm=ztrm*2.0*zb; ctrm=ztrm/factorial(nb2-i); - - css(ss,na2-1,nb2-i,z2ra,z2rb,r,deriv,dzeta1,dzeta2, + + css(ss,na2-1,nb2-i,z2ra,z2rb,r,deriv,dzeta1,dzeta2, d2zeta11,d2zeta12,d2zeta22,d2zeta1r,d2zeta2r,deriv2); - + trm1=float(i)*ctrm; trm2=trm1*rtrm; - gam=gam-trm2*ss; + gam=gam-trm2*ss; trm3=trm1*float(na2+nb2-i)*drtrm; dgam=dgam-trm2*deriv-0.5*trm3*ss; d2gamr2=d2gamr2-trm2*deriv2-trm3*deriv-0.5*trm3*float(na2+nb2-i-1)*ss/r; @@ -3893,17 +3893,17 @@ void PairSMTBQ::gammas(double &na, double &nb, double &za, double &zb, double &r dzb=dzb-(trm2/zb)*((float(nb2-i))*ss+zb*dzeta2); d2zaa=d2zaa-trm2*d2zeta11; d2zab=d2zab-(trm2/zb)*((float(nb2-i))*dzeta1+zb*d2zeta12); - d2zbb=d2zbb-(trm2/zb)*(2.0*(float(nb2-i))*dzeta2+zb*d2zeta22 + + d2zbb=d2zbb-(trm2/zb)*(2.0*(float(nb2-i))*dzeta2+zb*d2zeta22 + (float((nb2-i-1)*(nb2-i))*ss/zb)); d2zra=d2zra-trm2*d2zeta1r-0.5*trm3*dzeta1; - d2zrb=d2zrb-(trm2/zb)*((float(nb2-i))*deriv+zb*d2zeta2r) - + d2zrb=d2zrb-(trm2/zb)*((float(nb2-i))*deriv+zb*d2zeta2r) - 0.5*(trm3/zb)*((float(nb2-i))*ss+zb*dzeta2); } // Multiply by coefficients trm3=pow(2.0*za,na2+1)/factorial(na2); - gam=gam*trm3; + gam=gam*trm3; dgam=dgam*trm3; rfct1=((float(na2+1))/za); rgam1=rfct1*gam; @@ -3927,7 +3927,7 @@ void PairSMTBQ::gammas(double &na, double &nb, double &za, double &zb, double &r void PairSMTBQ::css(double &s, double nn1, double nn2, double alpha, double beta, double r, double &deriv, double &dzeta1, double &dzeta2, double &d2zeta11, double &d2zeta12, double &d2zeta22, double &d2zeta1r, double &d2zeta2r, double &deriv2) -{ +{ // implicit real (a-h,o-z) // common /fctrl/ fct(30) // A RAJOUTER DANS Pair_SMTBQ.h /* ------------------------------------------------------------------ @@ -3954,7 +3954,7 @@ void PairSMTBQ::css(double &s, double nn1, double nn2, double alpha, double beta double *a,*b; memory->create(a,31,"pair:a"); memory->create(b,31,"pair:a"); - + // Set up factorials - stored as factorial(n) in location(n+1) @@ -4058,17 +4058,17 @@ void PairSMTBQ::css(double &s, double nn1, double nn2, double alpha, double beta x=x+coff*a[i1]*b[nni1]; dzeta1=dzeta1+coff*(da1[i1]*b[nni1]+a[i1]*db1[nni1]); dzeta2=dzeta2+coff*(da2[i1]*b[nni1]+a[i1]*db2[nni1]); - d2zeta11=d2zeta11+coff*(d2a11[i1]*b[nni1]+a[i1]*d2b11[nni1]+ + d2zeta11=d2zeta11+coff*(d2a11[i1]*b[nni1]+a[i1]*d2b11[nni1]+ 2.0*da1[i1]*db1[nni1]); - d2zeta12=d2zeta12+coff*(d2a12[i1]*b[nni1]+a[i1]*d2b12[nni1]+ + d2zeta12=d2zeta12+coff*(d2a12[i1]*b[nni1]+a[i1]*d2b12[nni1]+ da1[i1]*db2[nni1]+da2[i1]*db1[nni1]); - d2zeta22=d2zeta22+coff*(d2a22[i1]*b[nni1]+a[i1]*d2b22[nni1]+ + d2zeta22=d2zeta22+coff*(d2a22[i1]*b[nni1]+a[i1]*d2b22[nni1]+ 2.0*da2[i1]*db2[nni1]); - d2zeta1r=d2zeta1r+coff*(d2a1r[i1]*b[nni1]+dar[i1]*db1[nni1]+ + d2zeta1r=d2zeta1r+coff*(d2a1r[i1]*b[nni1]+dar[i1]*db1[nni1]+ da1[i1]*dbr[nni1]+a[i1]*d2b1r[nni1]); - d2zeta2r=d2zeta2r+coff*(d2a2r[i1]*b[nni1]+dar[i1]*db2[nni1]+ + d2zeta2r=d2zeta2r+coff*(d2a2r[i1]*b[nni1]+dar[i1]*db2[nni1]+ da2[i1]*dbr[nni1]+a[i1]*d2b2r[nni1]); - deriv2=deriv2+coff*(d2ar2[i1]*b[nni1]+a[i1]*d2br2[nni1]+ + deriv2=deriv2+coff*(d2ar2[i1]*b[nni1]+a[i1]*d2br2[nni1]+ 2.0*dar[i1]*dbr[nni1]); } s=x*0.5; @@ -4086,7 +4086,7 @@ void PairSMTBQ::css(double &s, double nn1, double nn2, double alpha, double beta memory->destroy(b); return; -} +} /* ------------------------------------------------------------------------------- coeffs ------------------------------------------------------------------------------- */ @@ -4094,10 +4094,10 @@ void PairSMTBQ::css(double &s, double nn1, double nn2, double alpha, double beta { // implicit real (a-h,o-z) // common /fctrl/ fct(30) - + int il,lie,je,ia,i,j,ie,l; double coeffs; - + // Statement function // binm(n,i)=fct(n+1)/(fct(n-i+1)*fct(i+1)); @@ -4113,13 +4113,13 @@ void PairSMTBQ::css(double &s, double nn1, double nn2, double alpha, double beta } return coeffs; } - -// ============================================ + +// ============================================ double PairSMTBQ::binm(int n, int i) { return fct[n+1]/(fct[n-i+1]*fct[i+1]); -} +} /* --------------------------------------------------------------------------------- Caintgs @@ -4138,9 +4138,9 @@ double PairSMTBQ::binm(int n, int i) a[i+1]=(a[i]*float(i)+cste)*rx; } return; - } + } /* ----------------------------------------------------------------------------------- - Cbintgs + Cbintgs ----------------------------------------------------------------------------------- */ void PairSMTBQ::cbintgs( double x, int k, double *b) { @@ -4192,7 +4192,7 @@ void PairSMTBQ::cbintgs( double x, int k, double *b) b[i+1]=(float(i)*b[i]+ pow(-1.0,i)*expx-expmx)*rx; } goto g190; -// +// // Series to calculate b(i) // g140: for (i = i0; i <= k ; i++) { @@ -4212,16 +4212,16 @@ void PairSMTBQ::cbintgs( double x, int k, double *b) } g190: return; - } + } /* ------------------------------------------------------------------------------------ - Factorial + Factorial ------------------------------------------------------------------------------------ */ -double PairSMTBQ::factorial(double n) +double PairSMTBQ::factorial(double n) { // implicit real(a-h,o-z) double rn,factorial; int i; - + // // Calculates the factorial of an integer n // diff --git a/src/USER-SPH/atom_vec_meso.cpp b/src/USER-SPH/atom_vec_meso.cpp index 947139e791b63cd2f20f419e0da16239b9cfaee3..daa7c10740d66c608e4d331f9fb11bd421eebc51 100644 --- a/src/USER-SPH/atom_vec_meso.cpp +++ b/src/USER-SPH/atom_vec_meso.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "atom_vec_meso.h" #include "atom.h" #include "comm.h" @@ -929,7 +929,7 @@ int AtomVecMeso::pack_data_hybrid(int i, double *buf) void AtomVecMeso::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e " "%d %d %d\n", (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, @@ -969,7 +969,7 @@ int AtomVecMeso::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecMeso::pack_property_atom(int index, double *buf, +void AtomVecMeso::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; diff --git a/src/USER-SPH/compute_meso_e_atom.cpp b/src/USER-SPH/compute_meso_e_atom.cpp index 0446d948c4b3f0483d622015f97b2508cb2acd12..5db9dbbedfdd6d553a88a083f33636869fb71a3d 100644 --- a/src/USER-SPH/compute_meso_e_atom.cpp +++ b/src/USER-SPH/compute_meso_e_atom.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_meso_e_atom.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SPH/compute_meso_rho_atom.cpp b/src/USER-SPH/compute_meso_rho_atom.cpp index e1db2185445e9859f5f421fce04c3282ea32ec33..fa286d7e05b369d51307d45851e50c7618df5b81 100644 --- a/src/USER-SPH/compute_meso_rho_atom.cpp +++ b/src/USER-SPH/compute_meso_rho_atom.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_meso_rho_atom.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SPH/compute_meso_t_atom.cpp b/src/USER-SPH/compute_meso_t_atom.cpp index 98b0c88f5579fcb791c3d7ade16950c09c44b7ef..ce594cdff2fce7bedb5abc649a2af26750b2ea4d 100644 --- a/src/USER-SPH/compute_meso_t_atom.cpp +++ b/src/USER-SPH/compute_meso_t_atom.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_meso_t_atom.h" #include "atom.h" #include "update.h" diff --git a/src/USER-SPH/fix_meso.cpp b/src/USER-SPH/fix_meso.cpp index 3e827ace81e9dfd59d228836bfb36c799bbd70a5..665c9e0f3f866413924e617ee6b45f988daf5b9f 100644 --- a/src/USER-SPH/fix_meso.cpp +++ b/src/USER-SPH/fix_meso.cpp @@ -11,12 +11,12 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "fix_meso.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom.h" #include "comm.h" #include "force.h" @@ -67,7 +67,7 @@ void FixMeso::init() { void FixMeso::setup_pre_force(int vflag) { - // set vest equal to v + // set vest equal to v double **v = atom->v; double **vest = atom->vest; int *mask = atom->mask; diff --git a/src/USER-SPH/fix_meso_stationary.cpp b/src/USER-SPH/fix_meso_stationary.cpp index d61edcfc205ad6e8ce5c579e4097a167944d3f8b..0607f2f3d0f51d9ff58548ca36dae65be937bd38 100644 --- a/src/USER-SPH/fix_meso_stationary.cpp +++ b/src/USER-SPH/fix_meso_stationary.cpp @@ -11,12 +11,12 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "fix_meso_stationary.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom.h" #include "comm.h" #include "force.h" diff --git a/src/USER-SPH/pair_sph_heatconduction.cpp b/src/USER-SPH/pair_sph_heatconduction.cpp index 6590a0afde6b5fdfd369703f5731f13e5767415a..0b3716658cdb46662fe0e42aa71bccd86928aac8 100644 --- a/src/USER-SPH/pair_sph_heatconduction.cpp +++ b/src/USER-SPH/pair_sph_heatconduction.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_sph_heatconduction.h" #include "atom.h" #include "force.h" diff --git a/src/USER-SPH/pair_sph_idealgas.cpp b/src/USER-SPH/pair_sph_idealgas.cpp index 0336aa802572ef89d666319c1d909be92b8da33b..caea8eb3e4bfe489dc1893070af15524ee985728 100644 --- a/src/USER-SPH/pair_sph_idealgas.cpp +++ b/src/USER-SPH/pair_sph_idealgas.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_sph_idealgas.h" #include "atom.h" #include "force.h" diff --git a/src/USER-SPH/pair_sph_lj.cpp b/src/USER-SPH/pair_sph_lj.cpp index c934f2b5dea7a48a52c2bac946ba4988e882f93f..f0f3e3df339c55f3fbd2eedc4566d93c19e59725 100644 --- a/src/USER-SPH/pair_sph_lj.cpp +++ b/src/USER-SPH/pair_sph_lj.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_sph_lj.h" #include "atom.h" #include "force.h" diff --git a/src/USER-SPH/pair_sph_rhosum.cpp b/src/USER-SPH/pair_sph_rhosum.cpp index db0749b2a2802b902c9b79cd1232bd595147d9d3..4b7b028ad272ab812a945f52529c938ecdc260ad 100644 --- a/src/USER-SPH/pair_sph_rhosum.cpp +++ b/src/USER-SPH/pair_sph_rhosum.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_sph_rhosum.h" #include "atom.h" #include "force.h" @@ -287,7 +287,7 @@ double PairSPHRhoSum::single(int i, int j, int itype, int jtype, double rsq, /* ---------------------------------------------------------------------- */ -int PairSPHRhoSum::pack_forward_comm(int n, int *list, double *buf, +int PairSPHRhoSum::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i, j, m; double *rho = atom->rho; diff --git a/src/USER-SPH/pair_sph_taitwater.cpp b/src/USER-SPH/pair_sph_taitwater.cpp index f9c9bbc2b0d58dd11ccd5afd7acbe96e7d6e87eb..846ec118936fee79dfb85cc3df9582fa2583b205 100644 --- a/src/USER-SPH/pair_sph_taitwater.cpp +++ b/src/USER-SPH/pair_sph_taitwater.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_sph_taitwater.h" #include "atom.h" #include "force.h" diff --git a/src/USER-SPH/pair_sph_taitwater_morris.cpp b/src/USER-SPH/pair_sph_taitwater_morris.cpp index a6b89893f3f1191eaf7619c78905dd1f964a558b..d6a94f51cd2c4da83d6141f46c2f90bd6b1c62c7 100644 --- a/src/USER-SPH/pair_sph_taitwater_morris.cpp +++ b/src/USER-SPH/pair_sph_taitwater_morris.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_sph_taitwater_morris.h" #include "atom.h" #include "force.h" diff --git a/src/USER-TALLY/compute_force_tally.cpp b/src/USER-TALLY/compute_force_tally.cpp index b9281a2d593650c2a8026541e446d9dcafc382fc..90464d79493c24bbff525475d8bc05c6eacad373 100644 --- a/src/USER-TALLY/compute_force_tally.cpp +++ b/src/USER-TALLY/compute_force_tally.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_force_tally.h" #include "atom.h" #include "group.h" @@ -91,7 +91,7 @@ void ComputeForceTally::pair_tally_callback(int i, int j, int nlocal, int newton if (did_compute != update->ntimestep) { did_compute = update->ntimestep; - + // grow local force array if necessary // needs to be atom->nmax in length diff --git a/src/USER-TALLY/compute_force_tally.h b/src/USER-TALLY/compute_force_tally.h index fce6b0fdd5006426680e6ec5750bcce229537356..0f7bc35a6d7ab774e3ef7574abb64bcf66fbdc6d 100644 --- a/src/USER-TALLY/compute_force_tally.h +++ b/src/USER-TALLY/compute_force_tally.h @@ -25,13 +25,13 @@ ComputeStyle(force/tally,ComputeForceTally) namespace LAMMPS_NS { class ComputeForceTally : public Compute { - + public: ComputeForceTally(class LAMMPS *, int, char **); virtual ~ComputeForceTally(); void init(); - + double compute_scalar(); void compute_peratom(); diff --git a/src/USER-TALLY/compute_heat_flux_tally.cpp b/src/USER-TALLY/compute_heat_flux_tally.cpp index 890a3ffd6d07f8b1cc3c23dca2d366890c8647a5..214311cb3df44414967a0045f73dfe1275e3bc6a 100644 --- a/src/USER-TALLY/compute_heat_flux_tally.cpp +++ b/src/USER-TALLY/compute_heat_flux_tally.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_heat_flux_tally.h" #include "atom.h" #include "group.h" @@ -91,7 +91,7 @@ void ComputeHeatFluxTally::pair_tally_callback(int i, int j, int nlocal, int new if (did_compute != update->ntimestep) { did_compute = update->ntimestep; - + // grow local stress and eatom arrays if necessary // needs to be atom->nmax in length @@ -233,7 +233,7 @@ void ComputeHeatFluxTally::compute_vector() // compute heat currents // heat flux vector = jc[3] + jv[3] // jc[3] = convective portion of heat flux = sum_i (ke_i + pe_i) v_i[3] - // jv[3] = virial portion of heat flux = sum_i (stress_tensor_i . v_i[3]) + // jv[3] = virial portion of heat flux = sum_i (stress_tensor_i . v_i[3]) // normalization by volume is not included // J = sum_i( (0.5*m*v_i^2 + 0.5*(evdwl_i+ecoul_i))*v_i + // + (F_ij . v_i)*dR_ij/2 ) diff --git a/src/USER-TALLY/compute_heat_flux_tally.h b/src/USER-TALLY/compute_heat_flux_tally.h index 7480052104b3e8966e9d985e2e543cd31c3f4d0a..8c6671cf1e59c04fa7ca25e765021233e41d135b 100644 --- a/src/USER-TALLY/compute_heat_flux_tally.h +++ b/src/USER-TALLY/compute_heat_flux_tally.h @@ -25,7 +25,7 @@ ComputeStyle(heat/flux/tally,ComputeHeatFluxTally) namespace LAMMPS_NS { class ComputeHeatFluxTally : public Compute { - + public: ComputeHeatFluxTally(class LAMMPS *, int, char **); virtual ~ComputeHeatFluxTally(); diff --git a/src/USER-TALLY/compute_pe_tally.cpp b/src/USER-TALLY/compute_pe_tally.cpp index da9549f70abbab46b9448e05e1d640d700015e2d..f18a58e44e261a59f79f07f36a6830d8fd066474 100644 --- a/src/USER-TALLY/compute_pe_tally.cpp +++ b/src/USER-TALLY/compute_pe_tally.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_pe_tally.h" #include "atom.h" #include "group.h" @@ -90,7 +90,7 @@ void ComputePETally::pair_tally_callback(int i, int j, int nlocal, int newton, if (did_compute != update->ntimestep) { did_compute = update->ntimestep; - + // grow local eatom array if necessary // needs to be atom->nmax in length @@ -189,7 +189,7 @@ void ComputePETally::compute_peratom() const int nall = atom->nlocal + atom->nghost; for (int i = atom->nlocal; i < nall; ++i) eatom[i][0] = eatom[i][1] = 0.0; - } + } } /* ---------------------------------------------------------------------- diff --git a/src/USER-TALLY/compute_pe_tally.h b/src/USER-TALLY/compute_pe_tally.h index d502570dbce1f5ebdf35db0c673d262c6ec44420..2335bbeceeac278d45e9f62bfe8868a868a8071d 100644 --- a/src/USER-TALLY/compute_pe_tally.h +++ b/src/USER-TALLY/compute_pe_tally.h @@ -25,7 +25,7 @@ ComputeStyle(pe/tally,ComputePETally) namespace LAMMPS_NS { class ComputePETally : public Compute { - + public: ComputePETally(class LAMMPS *, int, char **); virtual ~ComputePETally(); diff --git a/src/USER-TALLY/compute_stress_tally.cpp b/src/USER-TALLY/compute_stress_tally.cpp index 89bcb408eb22713a162def8bb51d3639b4c32720..2a5f5226361412817be38bc5a2ff30bd83ad1047 100644 --- a/src/USER-TALLY/compute_stress_tally.cpp +++ b/src/USER-TALLY/compute_stress_tally.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_stress_tally.h" #include "atom.h" #include "group.h" @@ -91,7 +91,7 @@ void ComputeStressTally::pair_tally_callback(int i, int j, int nlocal, int newto if (did_compute != update->ntimestep) { did_compute = update->ntimestep; - + // grow local stress array if necessary // needs to be atom->nmax in length @@ -128,7 +128,7 @@ void ComputeStressTally::pair_tally_callback(int i, int j, int nlocal, int newto const double v3 = dx*dy*fpair; const double v4 = dx*dz*fpair; const double v5 = dy*dz*fpair; - + if (newton || i < nlocal) { virial[0] += v0; stress[i][0] += v0; virial[1] += v1; stress[i][1] += v1; @@ -197,7 +197,7 @@ double ComputeStressTally::compute_scalar() MPI_Allreduce(virial,vector,size_peratom_cols,MPI_DOUBLE,MPI_SUM,world); - if (domain->dimension == 3) + if (domain->dimension == 3) scalar = (vector[0]+vector[1]+vector[2])/3.0; else scalar = (vector[0]+vector[1])/2.0; diff --git a/src/USER-TALLY/compute_stress_tally.h b/src/USER-TALLY/compute_stress_tally.h index 4ce2466bd34d3c038a4faee3457d85c9b24ed1c6..a677d2eef6b58909a104e272af70e9493df8e79c 100644 --- a/src/USER-TALLY/compute_stress_tally.h +++ b/src/USER-TALLY/compute_stress_tally.h @@ -25,7 +25,7 @@ ComputeStyle(stress/tally,ComputeStressTally) namespace LAMMPS_NS { class ComputeStressTally : public Compute { - + public: ComputeStressTally(class LAMMPS *, int, char **); virtual ~ComputeStressTally(); diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index adf7b7846e59efb4531681693512aa60bf202f3e..eccce4f5b130d3192b31538bda2861c7c0fdc83e 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -15,10 +15,10 @@ Contributing author: Daniel Schwen ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_voronoi_atom.h" #include "atom.h" #include "group.h" @@ -71,7 +71,7 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : iarg++; } else if (strcmp(arg[iarg], "radius") == 0) { - if (iarg + 2 > narg || strstr(arg[iarg+1],"v_") != arg[iarg+1] ) + if (iarg + 2 > narg || strstr(arg[iarg+1],"v_") != arg[iarg+1] ) error->all(FLERR,"Illegal compute voronoi/atom command"); int n = strlen(&arg[iarg+1][2]) + 1; radstr = new char[n]; diff --git a/src/XTC/dump_xtc.cpp b/src/XTC/dump_xtc.cpp index 7b8afbd3a9c76cdf11b6a794e9799bc6a38bdefd..e2eec30bd03180364d6a4c29b4c059768c6ea112 100644 --- a/src/XTC/dump_xtc.cpp +++ b/src/XTC/dump_xtc.cpp @@ -22,11 +22,11 @@ support for groups ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "limits.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> #include "dump_xtc.h" #include "domain.h" #include "atom.h" @@ -86,7 +86,7 @@ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) // in reduced units we do not scale anything if (strcmp(update->unit_style,"lj") == 0) { sfactor = tfactor = 1.0; - if (comm->me == 0) + if (comm->me == 0) error->warning(FLERR,"No automatic unit conversion to XTC file " "format conventions possible for units lj"); } diff --git a/src/XTC/dump_xtc.h b/src/XTC/dump_xtc.h index 4112c65a418f3285552269e8e10c66880ef8a518..44c444d120fe7261929381ff25e914cd94206c82 100644 --- a/src/XTC/dump_xtc.h +++ b/src/XTC/dump_xtc.h @@ -42,7 +42,7 @@ class DumpXTC : public Dump { int unwrap_flag; // 1 if atom coords are unwrapped, 0 if no float precision; // user-adjustable precision setting float *coords; - double sfactor,tfactor; // scaling factors for positions and time unit + double sfactor,tfactor; // scaling factors for positions and time unit XDR xd; void init_style(); diff --git a/src/angle.cpp b/src/angle.cpp index 3913db685a2d9efaa3efa3c5d1db90e27371ce56..e8488b0b1aa88270f3e7d573392c1bce10803de6 100644 --- a/src/angle.cpp +++ b/src/angle.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "angle.h" #include "atom.h" #include "comm.h" @@ -66,7 +66,7 @@ Angle::~Angle() void Angle::init() { - if (!allocated && atom->nangletypes) + if (!allocated && atom->nangletypes) error->all(FLERR,"Angle coeffs are not set"); for (int i = 1; i <= atom->nangletypes; i++) if (setflag[i] == 0) error->all(FLERR,"All angle coeffs are not set"); diff --git a/src/angle.h b/src/angle.h index 535fe2b229a95e8dc5432aa7f58dbd754d3d21bf..31d73176ac6133ae4eee1d268415299e2b7941af 100644 --- a/src/angle.h +++ b/src/angle.h @@ -14,7 +14,7 @@ #ifndef LMP_ANGLE_H #define LMP_ANGLE_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 8b638286fa382dfae0df9193a50b5d46cdf08304..42b6860b6cc9d8f9fa5c58fb58391beb424b7ba1 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "ctype.h" +#include <math.h> +#include <string.h> +#include <ctype.h> #include "angle_hybrid.h" #include "atom.h" #include "neighbor.h" diff --git a/src/angle_hybrid.h b/src/angle_hybrid.h index 8cefe7d1bdbed50d1c3c4928cf3b6b6f007ab10a..4ae34c176f9574ca013b4f8075157c8e155e9fa5 100644 --- a/src/angle_hybrid.h +++ b/src/angle_hybrid.h @@ -20,7 +20,7 @@ AngleStyle(hybrid,AngleHybrid) #ifndef LMP_ANGLE_HYBRID_H #define LMP_ANGLE_HYBRID_H -#include "stdio.h" +#include <stdio.h> #include "angle.h" namespace LAMMPS_NS { diff --git a/src/atom.cpp b/src/atom.cpp index 6d7bb5b4edd032c989e2a78fa3609d4fa1e2e68c..5b091a26bd60d33bf5e2c39c719bab583f95728b 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -11,12 +11,12 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "limits.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> #include "atom.h" #include "style_atom.h" #include "atom_vec.h" @@ -611,11 +611,11 @@ void Atom::tag_check() if (minall < 0) error->all(FLERR,"One or more Atom IDs is negative"); if (maxall >= MAXTAGINT) error->all(FLERR,"One or more atom IDs is too big"); - if (maxall > 0 && minall == 0) + if (maxall > 0 && minall == 0) error->all(FLERR,"One or more atom IDs is zero"); if (maxall > 0 && tag_enable == 0) error->all(FLERR,"Non-zero atom IDs with atom_modify id = no"); - if (maxall == 0 && natoms && tag_enable) + if (maxall == 0 && natoms && tag_enable) error->all(FLERR,"All atom IDs = 0 but atom_modify id = yes"); if (tag_enable && maxall < natoms) error->all(FLERR,"Duplicate atom IDs exist"); @@ -735,23 +735,23 @@ void Atom::deallocate_topology() memory->destroy(atom->angle_atom3); atom->angle_type = NULL; atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL; - + memory->destroy(atom->dihedral_type); memory->destroy(atom->dihedral_atom1); memory->destroy(atom->dihedral_atom2); memory->destroy(atom->dihedral_atom3); memory->destroy(atom->dihedral_atom4); atom->dihedral_type = NULL; - atom->dihedral_atom1 = atom->dihedral_atom2 = + atom->dihedral_atom1 = atom->dihedral_atom2 = atom->dihedral_atom3 = atom->dihedral_atom4 = NULL; - + memory->destroy(atom->improper_type); memory->destroy(atom->improper_atom1); memory->destroy(atom->improper_atom2); memory->destroy(atom->improper_atom3); memory->destroy(atom->improper_atom4); atom->improper_type = NULL; - atom->improper_atom1 = atom->improper_atom2 = + atom->improper_atom1 = atom->improper_atom2 = atom->improper_atom3 = atom->improper_atom4 = NULL; } @@ -760,7 +760,7 @@ void Atom::deallocate_topology() call style-specific routine to parse line ------------------------------------------------------------------------- */ -void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset, +void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset, int shiftflag, double *shift) { int m,xptr,iptr; @@ -865,7 +865,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset, (((imageint) (atoi(values[iptr+2]) + IMGMAX) & IMGMASK) << IMG2BITS); else imagedata = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; - + xdata[0] = atof(values[xptr]); xdata[1] = atof(values[xptr+1]); xdata[2] = atof(values[xptr+2]); @@ -951,7 +951,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) ------------------------------------------------------------------------- */ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset, - int type_offset) + int type_offset) { int m,tmp,itype; tagint atom1,atom2; @@ -1004,7 +1004,7 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset, ------------------------------------------------------------------------- */ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset, - int type_offset) + int type_offset) { int m,tmp,itype; tagint atom1,atom2,atom3; @@ -1083,7 +1083,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset, for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); *next = '\0'; - sscanf(buf,"%d %d " + sscanf(buf,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, &tmp,&itype,&atom1,&atom2,&atom3,&atom4); if (id_offset) { @@ -1170,7 +1170,7 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset, for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); *next = '\0'; - sscanf(buf,"%d %d " + sscanf(buf,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, &tmp,&itype,&atom1,&atom2,&atom3,&atom4); if (id_offset) { @@ -1292,7 +1292,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset) call style-specific routine to parse line ------------------------------------------------------------------------- */ -void Atom::data_bodies(int n, char *buf, AtomVecBody *avec_body, +void Atom::data_bodies(int n, char *buf, AtomVecBody *avec_body, tagint id_offset) { int j,m,tagdata,ninteger,ndouble; @@ -1501,7 +1501,7 @@ void Atom::add_molecule(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal molecule command"); - if (find_molecule(arg[0]) >= 0) + if (find_molecule(arg[0]) >= 0) error->all(FLERR,"Reuse of molecule template ID"); // 1st molecule in set stores nset = # of mols, others store nset = 0 @@ -1548,7 +1548,7 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, if (onemol->qflag && q_flag) q[ilocal] = onemol->q[iatom]; if (onemol->radiusflag && radius_flag) radius[ilocal] = onemol->radius[iatom]; if (onemol->rmassflag && rmass_flag) rmass[ilocal] = onemol->rmass[iatom]; - else if (rmass_flag) + else if (rmass_flag) rmass[ilocal] = 4.0*MY_PI/3.0 * radius[ilocal]*radius[ilocal]*radius[ilocal]; @@ -2050,9 +2050,9 @@ void *Atom::extract(char *name) if (strcmp(name, "contact_radius") == 0) return (void *) contact_radius; if (strcmp(name, "smd_data_9") == 0) return (void *) smd_data_9; if (strcmp(name, "smd_stress") == 0) return (void *) smd_stress; - if (strcmp(name, "eff_plastic_strain") == 0) + if (strcmp(name, "eff_plastic_strain") == 0) return (void *) eff_plastic_strain; - if (strcmp(name, "eff_plastic_strain_rate") == 0) + if (strcmp(name, "eff_plastic_strain_rate") == 0) return (void *) eff_plastic_strain_rate; if (strcmp(name, "damage") == 0) return (void *) damage; diff --git a/src/atom.h b/src/atom.h index dd0d9821a1079d09ea35e018b8c67681a40fd064..96a42320e7c7510919862e203839200bfbcf64f8 100644 --- a/src/atom.h +++ b/src/atom.h @@ -245,7 +245,7 @@ class Atom : protected Pointers { int find_custom(char *, int &); int add_custom(char *, int); void remove_custom(int, int); - + virtual void sync_modify(ExecutionSpace, unsigned int, unsigned int) {} void *extract(char *); diff --git a/src/atom_map.cpp b/src/atom_map.cpp index 3613b59fca423437d864be6efcd464b112765adb..bbfe014dec3ae6032ffe973fbb0fd282ef4af1b8 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "atom.h" #include "comm.h" #include "memory.h" @@ -47,7 +47,7 @@ void Atom::map_init(int check) // if not recreating: // for array, initialize current map_tag_max values - // for hash, set all buckets to empty, put all entries in free list + // for hash, set all buckets to empty, put all entries in free list if (!recreate) { if (map_style == 1) { @@ -69,7 +69,7 @@ void Atom::map_init(int check) map_maxarray = map_tag_max; memory->create(map_array,map_maxarray+1,"atom:map_array"); for (int i = 0; i <= map_tag_max; i++) map_array[i] = -1; - + } else { // map_nhash = max # of atoms that can be hashed on this proc @@ -91,7 +91,7 @@ void Atom::map_init(int check) // set all buckets to empty // set hash to map_nhash in length // put all hash entries in free list and point them to each other - + map_bucket = new int[map_nbucket]; for (int i = 0; i < map_nbucket; i++) map_bucket[i] = -1; @@ -301,7 +301,7 @@ int Atom::map_style_set() // if user-selected, use that setting // else if map_tag_max > 1M, use hash // else use array - + int map_style_old = map_style; if (map_user) map_style = map_user; else if (map_tag_max > 1000000) map_style = 2; diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 157e9c096955983ad658eec8624b6134e52b544e..c6f54ec19e9931b00d35161eedcdcf5cfe76be1b 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "atom_vec.h" #include "atom.h" #include "force.h" @@ -265,7 +265,7 @@ int AtomVec::pack_angle(tagint **buf) void AtomVec::write_angle(FILE *fp, int n, tagint **buf, int index) { for (int i = 0; i < n; i++) { - fprintf(fp,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " + fprintf(fp,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT "\n", index,buf[i][0],buf[i][1],buf[i][2],buf[i][3]); index++; @@ -321,7 +321,7 @@ void AtomVec::pack_dihedral(tagint **buf) void AtomVec::write_dihedral(FILE *fp, int n, tagint **buf, int index) { for (int i = 0; i < n; i++) { - fprintf(fp,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " + fprintf(fp,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT "\n", index,buf[i][0],buf[i][1],buf[i][2],buf[i][3],buf[i][4]); index++; @@ -377,7 +377,7 @@ void AtomVec::pack_improper(tagint **buf) void AtomVec::write_improper(FILE *fp, int n, tagint **buf, int index) { for (int i = 0; i < n; i++) { - fprintf(fp,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " + fprintf(fp,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT "\n", index,buf[i][0],buf[i][1],buf[i][2],buf[i][3],buf[i][4]); index++; diff --git a/src/atom_vec.h b/src/atom_vec.h index baa27dfaa67d6b26b44d3f052ea297351273685e..66bfd14608a69a9de86bad743ea3000978041a3e 100644 --- a/src/atom_vec.h +++ b/src/atom_vec.h @@ -14,7 +14,7 @@ #ifndef LMP_ATOM_VEC_H #define LMP_ATOM_VEC_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { @@ -113,7 +113,7 @@ class AtomVec : protected Pointers { void write_dihedral(FILE *, int, tagint **, int); void pack_improper(tagint **); void write_improper(FILE *, int, tagint **, int); - + virtual int property_atom(char *) {return -1;} virtual void pack_property_atom(int, double *, int, int) {} diff --git a/src/atom_vec_atomic.cpp b/src/atom_vec_atomic.cpp index 24d6f3d92c8fdc0b346a59403515c62d8ae25e2f..c29e04ea878e7b3f0656c1ee12d6d39737dddc73 100644 --- a/src/atom_vec_atomic.cpp +++ b/src/atom_vec_atomic.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_atomic.h" #include "atom.h" #include "comm.h" diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index b4b1d3f210d790938d353484a06d680c4e24ac59..2f6c4e48b3142251f717342e0d7f36d23f45b879 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom_vec_body.h" #include "style_body.h" #include "body.h" @@ -1301,7 +1301,7 @@ int AtomVecBody::data_atom_hybrid(int nlocal, char **values) unpack one body from Bodies section of data file ------------------------------------------------------------------------- */ -void AtomVecBody::data_body(int m, int ninteger, int ndouble, +void AtomVecBody::data_body(int m, int ninteger, int ndouble, char **ivalues, char **dvalues) { if (body[m]) error->one(FLERR,"Assigning body parameters to non-body atom"); @@ -1466,7 +1466,7 @@ bigint AtomVecBody::memory_usage() if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax); if (atom->memcheck("angmom")) bytes += memory->usage(angmom,nmax,3); - if (atom->memcheck("torque")) bytes += + if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3); if (atom->memcheck("body")) bytes += memory->usage(body,nmax); @@ -1496,8 +1496,8 @@ void AtomVecBody::check(int flag) } } for (int i = atom->nlocal; i < atom->nlocal+atom->nghost; i++) { - if (atom->body[i] >= 0 && - (atom->body[i] < nlocal_bonus || + if (atom->body[i] >= 0 && + (atom->body[i] < nlocal_bonus || atom->body[i] >= nlocal_bonus+nghost_bonus)) { printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); errorx->one(FLERR,"BAD BBB"); @@ -1516,7 +1516,7 @@ void AtomVecBody::check(int flag) } } for (int i = nlocal_bonus; i < nlocal_bonus+nghost_bonus; i++) { - if (bonus[i].ilocal < atom->nlocal || + if (bonus[i].ilocal < atom->nlocal || bonus[i].ilocal >= atom->nlocal+atom->nghost) { printf("Proc %d, step %ld, flag %d\n",comm->me,update->ntimestep,flag); errorx->one(FLERR,"BAD EEE"); diff --git a/src/atom_vec_charge.cpp b/src/atom_vec_charge.cpp index 0cdea95e1ac32346982f17367147a6b7cb5ecaff..08c3186a45ff8258690a26cd2b0d286e512bd286 100644 --- a/src/atom_vec_charge.cpp +++ b/src/atom_vec_charge.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_charge.h" #include "atom.h" #include "comm.h" diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index 889636963a4f11c0038ddf48d0295ae1193ed5d3..4d1dc01c07fb8312512b2ed3c0eec35349cfcd0f 100755 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -15,7 +15,7 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "atom_vec_ellipsoid.h" #include "math_extra.h" #include "atom.h" @@ -1134,7 +1134,7 @@ void AtomVecEllipsoid::create_atom(int itype, double *coord) initialize other atom quantities ------------------------------------------------------------------------- */ -void AtomVecEllipsoid::data_atom(double *coord, imageint imagetmp, +void AtomVecEllipsoid::data_atom(double *coord, imageint imagetmp, char **values) { int nlocal = atom->nlocal; @@ -1301,7 +1301,7 @@ int AtomVecEllipsoid::pack_data_hybrid(int i, double *buf) void AtomVecEllipsoid::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %d %d %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, (int) ubuf(buf[i][2]).i, @@ -1357,7 +1357,7 @@ int AtomVecEllipsoid::pack_vel_hybrid(int i, double *buf) void AtomVecEllipsoid::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e\n", (tagint) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3], buf[i][4],buf[i][5],buf[i][6]); @@ -1391,7 +1391,7 @@ bigint AtomVecEllipsoid::memory_usage() if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax); if (atom->memcheck("angmom")) bytes += memory->usage(angmom,nmax,3); - if (atom->memcheck("torque")) + if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3); if (atom->memcheck("ellipsoid")) bytes += memory->usage(ellipsoid,nmax); diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index fb0dd9da7a71d56a39d171bb1b3910f28e49102f..7d34931b44911b7ee23970e075950829bec56a5e 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "atom_vec_hybrid.h" #include "atom.h" #include "domain.h" @@ -207,7 +207,7 @@ void AtomVecHybrid::clear_bonus() void AtomVecHybrid::force_clear(int n, size_t nbytes) { - for (int k = 0; k < nstyles; k++) + for (int k = 0; k < nstyles; k++) if (styles[k]->forceclearflag) styles[k]->force_clear(n,nbytes); } @@ -1024,7 +1024,7 @@ int AtomVecHybrid::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecHybrid::pack_property_atom(int multiindex, double *buf, +void AtomVecHybrid::pack_property_atom(int multiindex, double *buf, int nvalues, int groupbit) { int k = multiindex % nstyles; diff --git a/src/atom_vec_hybrid.h b/src/atom_vec_hybrid.h index 7524066c1b21992496ebeeaffe88d763aa78853b..fd8a3e433cc9bf594171149c5aa7f9b2ab35bc8f 100644 --- a/src/atom_vec_hybrid.h +++ b/src/atom_vec_hybrid.h @@ -20,7 +20,7 @@ AtomStyle(hybrid,AtomVecHybrid) #ifndef LMP_ATOM_VEC_HYBRID_H #define LMP_ATOM_VEC_HYBRID_H -#include "stdio.h" +#include <stdio.h> #include "atom_vec.h" namespace LAMMPS_NS { diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index ccbed481d0944ca8cf19fb524b5c2b320b0b3c30..3c2272cc6097a6cafe9800753017cc4e955568de 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom_vec_line.h" #include "atom.h" #include "comm.h" @@ -1221,7 +1221,7 @@ int AtomVecLine::pack_vel_hybrid(int i, double *buf) void AtomVecLine::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e\n", (tagint) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3], buf[i][4],buf[i][5],buf[i][6]); @@ -1256,7 +1256,7 @@ bigint AtomVecLine::memory_usage() if (atom->memcheck("molecule")) bytes += memory->usage(molecule,nmax); if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax); if (atom->memcheck("omega")) bytes += memory->usage(omega,nmax,3); - if (atom->memcheck("torque")) + if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3); if (atom->memcheck("line")) bytes += memory->usage(line,nmax); diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index f67435a10fa397380928eb2d5c472b2d37864d49..7bf4d408251a39b7da51c1cef2bd83f5e249e332 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom_vec_sphere.h" #include "atom.h" #include "comm.h" @@ -1060,7 +1060,7 @@ void AtomVecSphere::pack_data(double **buf) buf[i][1] = ubuf(type[i]).d; buf[i][2] = 2.0*radius[i]; if (radius[i] == 0.0) buf[i][3] = rmass[i]; - else + else buf[i][3] = rmass[i] / (4.0*MY_PI/3.0 * radius[i]*radius[i]*radius[i]); buf[i][4] = x[i][0]; buf[i][5] = x[i][1]; @@ -1090,7 +1090,7 @@ int AtomVecSphere::pack_data_hybrid(int i, double *buf) void AtomVecSphere::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, buf[i][2],buf[i][3], @@ -1146,7 +1146,7 @@ int AtomVecSphere::pack_vel_hybrid(int i, double *buf) void AtomVecSphere::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e\n", (tagint) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3], buf[i][4],buf[i][5],buf[i][6]); @@ -1181,7 +1181,7 @@ bigint AtomVecSphere::memory_usage() if (atom->memcheck("radius")) bytes += memory->usage(radius,nmax); if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax); if (atom->memcheck("omega")) bytes += memory->usage(omega,nmax,3); - if (atom->memcheck("torque")) + if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3); return bytes; diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 9a120522cb3cd33c647f02e77967a98ce427e85f..f95255ee3f1e1d0904efad4dfb31c46ef27ec6f2 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "atom_vec_tri.h" #include "math_extra.h" #include "atom.h" @@ -1669,7 +1669,7 @@ int AtomVecTri::pack_vel_hybrid(int i, double *buf) void AtomVecTri::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) - fprintf(fp,TAGINT_FORMAT + fprintf(fp,TAGINT_FORMAT " %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e\n", (tagint) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3], buf[i][4],buf[i][5],buf[i][6]); @@ -1704,7 +1704,7 @@ bigint AtomVecTri::memory_usage() if (atom->memcheck("molecule")) bytes += memory->usage(molecule,nmax); if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax); if (atom->memcheck("angmom")) bytes += memory->usage(angmom,nmax,3); - if (atom->memcheck("torque")) bytes += + if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3); if (atom->memcheck("tri")) bytes += memory->usage(tri,nmax); diff --git a/src/balance.cpp b/src/balance.cpp index 88ca0a62faf466179fd482c8b3c8ba2ce888d9da..c615db61129b35f223d47c541f10a2bee8a50cf6 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -13,10 +13,10 @@ //#define BALANCE_DEBUG 1 -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "balance.h" #include "atom.h" #include "comm.h" @@ -107,7 +107,7 @@ void Balance::command(int narg, char **arg) int iarg = 1; while (iarg < narg) { if (strcmp(arg[iarg],"x") == 0) { - if (style != -1 && style != XYZ) + if (style != -1 && style != XYZ) error->all(FLERR,"Illegal balance command"); style = XYZ; if (strcmp(arg[iarg+1],"uniform") == 0) { @@ -127,7 +127,7 @@ void Balance::command(int narg, char **arg) user_xsplit[procgrid[0]] = 1.0; } } else if (strcmp(arg[iarg],"y") == 0) { - if (style != -1 && style != XYZ) + if (style != -1 && style != XYZ) error->all(FLERR,"Illegal balance command"); style = XYZ; if (strcmp(arg[iarg+1],"uniform") == 0) { @@ -147,7 +147,7 @@ void Balance::command(int narg, char **arg) user_ysplit[procgrid[1]] = 1.0; } } else if (strcmp(arg[iarg],"z") == 0) { - if (style != -1 && style != XYZ) + if (style != -1 && style != XYZ) error->all(FLERR,"Illegal balance command"); style = XYZ; if (strcmp(arg[iarg+1],"uniform") == 0) { @@ -237,7 +237,7 @@ void Balance::command(int narg, char **arg) } } - if (style == BISECTION && comm->style == 0) + if (style == BISECTION && comm->style == 0) error->all(FLERR,"Balance rcb cannot be used with comm_style brick"); // insure atoms are in current box & update box via shrink-wrap @@ -510,14 +510,14 @@ int *Balance::bisection(int sortflag) double *shrinkhi = &shrinkall[3]; // invoke RCB - // then invert() to create list of proc assignements for my atoms + // then invert() to create list of proc assignements for my atoms //rcb->compute(dim,atom->nlocal,atom->x,NULL,boxlo,boxhi); rcb->compute(dim,atom->nlocal,atom->x,NULL,shrinklo,shrinkhi); rcb->invert(sortflag); // reset RCB lo/hi bounding box to full simulation box as needed - + double *lo = rcb->lo; double *hi = rcb->hi; @@ -529,7 +529,7 @@ int *Balance::bisection(int sortflag) if (hi[2] == shrinkhi[2]) hi[2] = boxhi[2]; // store RCB cut, dim, lo/hi box in CommTiled - // cut and lo/hi need to be in fractional form so can + // cut and lo/hi need to be in fractional form so can // OK if changes by epsilon from what RCB used since particles // will subsequently migrate to new owning procs by exchange() anyway // ditto for particles exactly on lo/hi RCB box boundaries due to ties @@ -546,11 +546,11 @@ int *Balance::bisection(int sortflag) mysplit[0][0] = (lo[0] - boxlo[0]) / prd[0]; if (hi[0] == boxhi[0]) mysplit[0][1] = 1.0; else mysplit[0][1] = (hi[0] - boxlo[0]) / prd[0]; - + mysplit[1][0] = (lo[1] - boxlo[1]) / prd[1]; if (hi[1] == boxhi[1]) mysplit[1][1] = 1.0; else mysplit[1][1] = (hi[1] - boxlo[1]) / prd[1]; - + mysplit[2][0] = (lo[2] - boxlo[2]) / prd[2]; if (hi[2] == boxhi[2]) mysplit[2][1] = 1.0; else mysplit[2][1] = (hi[2] - boxlo[2]) / prd[2]; @@ -941,7 +941,7 @@ void Balance::dumpout(bigint tstep, FILE *fp) double **boxall; memory->create(boxall,nprocs,6,"balance:dumpout"); MPI_Allgather(box,6,MPI_DOUBLE,&boxall[0][0],6,MPI_DOUBLE,world); - + if (me) { memory->destroy(boxall); return; @@ -949,7 +949,7 @@ void Balance::dumpout(bigint tstep, FILE *fp) // proc 0 writes out nodal coords // some will be duplicates - + double *boxlo = domain->boxlo; double *boxhi = domain->boxhi; @@ -1036,7 +1036,7 @@ void Balance::dumpout(bigint tstep, FILE *fp) fprintf(fp,"%d\n",nprocs); if (dimension == 2) fprintf(fp,"ITEM: SQUARES\n"); else fprintf(fp,"ITEM: CUBES\n"); - + if (dimension == 2) { int m = 0; for (int i = 0; i < nprocs; i++) { diff --git a/src/balance.h b/src/balance.h index f00566881a14b9295813dc443141ae1d968a2602..c4168cabbb9ef4c9cbc5404b355e93431d6833e2 100644 --- a/src/balance.h +++ b/src/balance.h @@ -20,7 +20,7 @@ CommandStyle(balance,Balance) #ifndef LMP_BALANCE_H #define LMP_BALANCE_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/body.cpp b/src/body.cpp index 20b44163766b30280e1eb84e0fdfb04fc4a750f1..144ee13c92bd9d7a516bd708053e1955080090ee 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "body.h" #include "error.h" diff --git a/src/body.h b/src/body.h index 8b4dce451730e8c5442218fc40a28f9fb4c7c9af..87e9f59be1e6e81eedd7dd75b726384c9e55213d 100644 --- a/src/body.h +++ b/src/body.h @@ -38,7 +38,7 @@ class Body : protected Pointers { virtual int pack_comm_body(struct AtomVecBody::Bonus *, double *) {return 0;} virtual int unpack_comm_body(struct AtomVecBody::Bonus *, double *) {return 0;} virtual int pack_border_body(struct AtomVecBody::Bonus *, double *) {return 0;} - virtual int unpack_border_body(struct AtomVecBody::Bonus *, + virtual int unpack_border_body(struct AtomVecBody::Bonus *, double *) {return 0;} virtual void data_body(int, int, int, char **, char **) = 0; diff --git a/src/bond.cpp b/src/bond.cpp index 3ce0e26f819df26a633e2360274441386fdf5976..443816418fac2e9fda86c7526e763a2f30c14118 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "bond.h" #include "atom.h" #include "comm.h" @@ -67,7 +67,7 @@ Bond::~Bond() void Bond::init() { - if (!allocated && atom->nbondtypes) + if (!allocated && atom->nbondtypes) error->all(FLERR,"Bond coeffs are not set"); for (int i = 1; i <= atom->nbondtypes; i++) if (setflag[i] == 0) error->all(FLERR,"All bond coeffs are not set"); diff --git a/src/bond.h b/src/bond.h index a38fc97f133bb84fc666ac9d0824065b77866936..6841e9362d4d6ffee3acf064724ffd7ded2d1b47 100644 --- a/src/bond.h +++ b/src/bond.h @@ -14,7 +14,7 @@ #ifndef LMP_BOND_H #define LMP_BOND_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 1137035ea825058d8d58ba9c1b0ccea86b01d68a..519a1a300825ef5f9d122c4892576cb4ce4648e5 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "ctype.h" +#include <math.h> +#include <string.h> +#include <ctype.h> #include "bond_hybrid.h" #include "atom.h" #include "neighbor.h" diff --git a/src/bond_hybrid.h b/src/bond_hybrid.h index a99fd790ccb0c6c554209d262ca6a453cee1d354..e1d567c886813755bc4fe42017ce8fbdd6ed8607 100644 --- a/src/bond_hybrid.h +++ b/src/bond_hybrid.h @@ -20,7 +20,7 @@ BondStyle(hybrid,BondHybrid) #ifndef LMP_BOND_HYBRID_H #define LMP_BOND_HYBRID_H -#include "stdio.h" +#include <stdio.h> #include "bond.h" namespace LAMMPS_NS { diff --git a/src/change_box.cpp b/src/change_box.cpp index a969bc7465a592ff51a3fb38759063811bca437e..add1fe1d0a49b57c128b945729c25cd8e03d8272 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "change_box.h" #include "atom.h" #include "modify.h" diff --git a/src/citeme.cpp b/src/citeme.cpp index 66c6eb9dc9de9f04dfe4ced22b3cf69d63e541ce..d0217226716b23dc5ba031626aefffba916f4012 100644 --- a/src/citeme.cpp +++ b/src/citeme.cpp @@ -18,7 +18,7 @@ using namespace LAMMPS_NS; -static const char cite_header[] = +static const char cite_header[] = "This LAMMPS simulation made specific use of work described in the\n" "following references. See http://lammps.sandia.gov/cite.html\n" "for details.\n\n"; @@ -34,7 +34,7 @@ CiteMe::CiteMe(LAMMPS *lmp) : Pointers(lmp) cs = new citeset(); } -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- write out nag-line at the end of the regular output and clean up ------------------------------------------------------------------------- */ diff --git a/src/citeme.h b/src/citeme.h index b8340153325ad7233cd4e028e197af23d8256719..80b642ab6d7a889b73443688950f280b1a2ae16d 100644 --- a/src/citeme.h +++ b/src/citeme.h @@ -15,7 +15,7 @@ #define LMP_CITEME_H #include "pointers.h" -#include "stdio.h" +#include <stdio.h> #include <set> namespace LAMMPS_NS { diff --git a/src/comm.cpp b/src/comm.cpp index dfeb7074900b5f2958af57f1972ed1267c8dd619..073166d2295811225a3720ec338115d9f724e72b 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "comm.h" #include "universe.h" #include "atom.h" @@ -33,7 +33,7 @@ #include "error.h" #ifdef _OPENMP -#include "omp.h" +#include <omp.h> #endif using namespace LAMMPS_NS; @@ -134,7 +134,7 @@ void Comm::copy_arrays(Comm *oldcomm) "comm:grid2proc"); memcpy(&grid2proc[0][0][0],&oldcomm->grid2proc[0][0][0], (procgrid[0]*procgrid[1]*procgrid[2])*sizeof(int)); - + memory->create(xsplit,procgrid[0]+1,"comm:xsplit"); memory->create(ysplit,procgrid[1]+1,"comm:ysplit"); memory->create(zsplit,procgrid[2]+1,"comm:zsplit"); @@ -195,14 +195,14 @@ void Comm::init() for (int i = 0; i < modify->nfix; i++) size_border += modify->fix[i]->comm_border; - + // per-atom limits for communication // maxexchange = max # of datums in exchange comm, set in exchange() // maxforward = # of datums in largest forward comm // maxreverse = # of datums in largest reverse comm // query pair,fix,compute,dump for their requirements // pair style can force reverse comm even if newton off - + maxforward = MAX(size_forward,size_border); maxreverse = size_reverse; diff --git a/src/comm.h b/src/comm.h index f3d941f96d352bf69df6296aa0c3b649c2396201..6861a034fcce4446f2d8881740227384de820717 100644 --- a/src/comm.h +++ b/src/comm.h @@ -89,7 +89,7 @@ class Comm : protected Pointers { // exchange of info on neigh stencil // set processor mapping options - virtual void forward_comm_array(int, double **) = 0; + virtual void forward_comm_array(int, double **) = 0; virtual int exchange_variable(int, double *, double *&) = 0; int binary(double, int, double *); @@ -106,8 +106,8 @@ class Comm : protected Pointers { void ring(int, int, void *, int, void (*)(int, char *), void *, int self = 1); - int read_lines_from_file(FILE *, int, int, char *); - int read_lines_from_file_universe(FILE *, int, int, char *); + int read_lines_from_file(FILE *, int, int, char *); + int read_lines_from_file_universe(FILE *, int, int, char *); protected: int bordergroup; // only communicate this group in borders @@ -121,7 +121,7 @@ class Comm : protected Pointers { int size_border; // # of datums in forward border comm int maxforward,maxreverse; // max # of datums in forward/reverse comm - int maxexchange; // max # of datums/atom in exchange comm + int maxexchange; // max # of datums/atom in exchange comm int gridflag; // option for creating 3d grid int mapflag; // option for mapping procs to 3d grid diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index 761dfcb37b1a23334b5a3d27e5388f4250c72931..4ccd936c3f4ad906c66b690c780e7c386bad9c2f 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -15,11 +15,11 @@ Contributing author (triclinic) : Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdio.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> #include "comm_brick.h" #include "comm_tiled.h" #include "universe.h" @@ -1027,7 +1027,7 @@ void CommBrick::reverse_comm_fix(Fix *fix, int size) if (sendnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); buf = buf_recv; } else buf = buf_send; - + // unpack buffer fix->unpack_reverse_comm(sendnum[iswap],sendlist[iswap],buf); @@ -1258,7 +1258,7 @@ int CommBrick::exchange_variable(int n, double *inbuf, double *&outbuf) // loop over dimensions for (int dim = 0; dim < 3; dim++) { - + // no exchange if only one proc in a dimension if (procgrid[dim] == 1) continue; @@ -1278,12 +1278,12 @@ int CommBrick::exchange_variable(int n, double *inbuf, double *&outbuf) } else nrecv2 = 0; if (nrecv > maxrecv) grow_recv(nrecv); - + MPI_Irecv(&buf_recv[nsend],nrecv1,MPI_DOUBLE,procneigh[dim][1],0, world,&request); MPI_Send(buf_recv,nsend,MPI_DOUBLE,procneigh[dim][0],0,world); MPI_Wait(&request,MPI_STATUS_IGNORE); - + if (procgrid[dim] > 2) { MPI_Irecv(&buf_recv[nsend+nrecv1],nrecv2,MPI_DOUBLE,procneigh[dim][0],0, world,&request); diff --git a/src/comm_brick.h b/src/comm_brick.h index e264408ab6af6f792c7133d9afa58d000292adbb..ddcf8e6fbd639e5a5ecfefcf53d51e60185bf18a 100644 --- a/src/comm_brick.h +++ b/src/comm_brick.h @@ -33,7 +33,7 @@ class CommBrick : public Comm { virtual void forward_comm_pair(class Pair *); // forward comm from a Pair virtual void reverse_comm_pair(class Pair *); // reverse comm from a Pair - virtual void forward_comm_fix(class Fix *, int size=0); + virtual void forward_comm_fix(class Fix *, int size=0); // forward comm from a Fix virtual void reverse_comm_fix(class Fix *, int size=0); // reverse comm from a Fix diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index a54a6b0c9e962f083491ea6909b63673e6f5c047..98f406b2938baaf227e5f019d90a804ea9941150 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "comm_tiled.h" #include "comm_brick.h" #include "atom.h" @@ -123,7 +123,7 @@ void CommTiled::init() // temporary restrictions - if (triclinic) + if (triclinic) error->all(FLERR,"Cannot yet use comm_style tiled with triclinic box"); if (mode == MULTI) error->all(FLERR,"Cannot yet use comm_style tiled with multi-mode comm"); @@ -222,7 +222,7 @@ void CommTiled::setup() lo1[idim] = subhi[idim]; hi1[idim] = subhi[idim] + cut; } - + two = 0; if (idir == 0 && periodicity[idim] && lo1[idim] < boxlo[idim]) two = 1; if (idir == 1 && periodicity[idim] && hi1[idim] > boxhi[idim]) two = 1; @@ -305,16 +305,16 @@ void CommTiled::setup() // = obox in other 2 dims // if sbox touches other proc's sub-box boundaries in lower dims, // extend sbox in those lower dims to include ghost atoms - + double oboxlo[3],oboxhi[3],sbox[6]; for (i = 0; i < noverlap; i++) { pbc_flag[iswap][i] = 0; pbc[iswap][i][0] = pbc[iswap][i][1] = pbc[iswap][i][2] = pbc[iswap][i][3] = pbc[iswap][i][4] = pbc[iswap][i][5] = 0; - + (this->*box_other)(idim,idir,overlap[i],oboxlo,oboxhi); - + if (i < noverlap1) { sbox[0] = MAX(oboxlo[0],lo1[0]); sbox[1] = MAX(oboxlo[1],lo1[1]); @@ -352,7 +352,7 @@ void CommTiled::setup() if (sbox[1] == oboxlo[1]) sbox[1] -= cut; if (sbox[4] == oboxhi[1]) sbox[4] += cut; } - + memcpy(sendbox[iswap][i],sbox,6*sizeof(double)); } @@ -412,7 +412,7 @@ void CommTiled::setup() MPI_Barrier(world); // reallocate exchproc and exchnum if needed based on noverlap - + if (noverlap > nexchprocmax[idim]) { while (nexchprocmax[idim] < noverlap) nexchprocmax[idim] += DELTA_PROCS; delete [] exchproc[idim]; @@ -429,7 +429,7 @@ void CommTiled::setup() if (cutzero) { for (i = 0; i < nswap; i++) { - nsendproc[i] = nrecvproc[i] = + nsendproc[i] = nrecvproc[i] = sendother[i] = recvother[i] = sendself[i] = 0; } } @@ -596,7 +596,7 @@ void CommTiled::reverse_comm() reverse_recv_offset[iswap][irecv]]); } } - + } else { if (sendother[iswap]) { for (i = 0; i < nsend; i++) @@ -709,7 +709,7 @@ void CommTiled::exchange() int flag = 0; for (int k = 0; k < nexchproc[dim]; k++) if (proc == exchproc[k]) flag = 1; - if (!flag) + if (!flag) printf("Losing exchange atom: dim %d me %d %proc %d: %g %g %g\n", dim,me,proc,x[i][0],x[i][1],x[i][2]); */ @@ -814,7 +814,7 @@ void CommTiled::borders() x = atom->x; if (iswap % 2 == 0) nlast = atom->nlocal + atom->nghost; - + ncountall = 0; for (m = 0; m < nsendproc[iswap]; m++) { bbox = sendbox[iswap][m]; @@ -879,7 +879,7 @@ void CommTiled::borders() for (m = 0; m < nsendproc[iswap]; m++) { size_reverse_recv[iswap][m] = sendnum[iswap][m]*size_reverse; if (m == 0) reverse_recv_offset[iswap][0] = 0; - else reverse_recv_offset[iswap][m] = + else reverse_recv_offset[iswap][m] = reverse_recv_offset[iswap][m-1] + sendnum[iswap][m-1]; } @@ -896,7 +896,7 @@ void CommTiled::borders() forward_recv_offset[iswap][0] = 0; } else { firstrecv[iswap][m] = firstrecv[iswap][m-1] + recvnum[iswap][m-1]; - forward_recv_offset[iswap][m] = + forward_recv_offset[iswap][m] = forward_recv_offset[iswap][m-1] + recvnum[iswap][m-1]; } } @@ -972,7 +972,7 @@ void CommTiled::borders() // increment ghost atoms n = nrecvproc[iswap]; - if (n) + if (n) atom->nghost += forward_recv_offset[iswap][n-1] + recvnum[iswap][n-1]; } @@ -1375,7 +1375,7 @@ void CommTiled::reverse_comm_dump(Dump *dump) ------------------------------------------------------------------------- */ void CommTiled::forward_comm_array(int nsize, double **array) -{ +{ int i,j,k,m,iatom,last,irecv,nsend,nrecv; // insure send/recv bufs are big enough for nsize @@ -1491,12 +1491,12 @@ void CommTiled::box_drop_brick(int idim, double *lo, double *hi, int &indexme) split = zsplit; } - if (index < 0 || index > procgrid[idim]) + if (index < 0 || index > procgrid[idim]) error->one(FLERR,"Comm tiled invalid index in box drop brick"); while (1) { lower = boxlo[idim] + prd[idim]*split[index]; - if (index < procgrid[idim]-1) + if (index < procgrid[idim]-1) upper = boxlo[idim] + prd[idim]*split[index+1]; else upper = boxhi[idim]; if (lower >= hi[idim] || upper <= lo[idim]) break; @@ -1529,7 +1529,7 @@ void CommTiled::box_drop_tiled(int idim, double *lo, double *hi, int &indexme) box_drop_tiled_recurse(lo,hi,0,nprocs-1,indexme); } -void CommTiled::box_drop_tiled_recurse(double *lo, double *hi, +void CommTiled::box_drop_tiled_recurse(double *lo, double *hi, int proclower, int procupper, int &indexme) { @@ -1557,8 +1557,8 @@ void CommTiled::box_drop_tiled_recurse(double *lo, double *hi, int procmid = proclower + (procupper - proclower) / 2 + 1; int idim = rcbinfo[procmid].dim; double cut = boxlo[idim] + prd[idim]*rcbinfo[procmid].cutfrac; - - if (lo[idim] < cut) + + if (lo[idim] < cut) box_drop_tiled_recurse(lo,hi,proclower,procmid-1,indexme); if (hi[idim] > cut) box_drop_tiled_recurse(lo,hi,procmid,procupper,indexme); @@ -1571,8 +1571,8 @@ void CommTiled::box_drop_tiled_recurse(double *lo, double *hi, void CommTiled::box_other_brick(int idim, int idir, int proc, double *lo, double *hi) { - lo[0] = sublo[0]; lo[1] = sublo[1]; lo[2] = sublo[2]; - hi[0] = subhi[0]; hi[1] = subhi[1]; hi[2] = subhi[2]; + lo[0] = sublo[0]; lo[1] = sublo[1]; lo[2] = sublo[2]; + hi[0] = subhi[0]; hi[1] = subhi[1]; hi[2] = subhi[2]; int other1,other2,oproc; double *split; @@ -1604,7 +1604,7 @@ void CommTiled::box_other_brick(int idim, int idir, if (proc == oproc) { lo[idim] = boxlo[idim] + prd[idim]*split[index]; - if (split[index+1] < 1.0) + if (split[index+1] < 1.0) hi[idim] = boxlo[idim] + prd[idim]*split[index+1]; else hi[idim] = boxhi[idim]; return; @@ -1657,7 +1657,7 @@ int CommTiled::box_touch_tiled(int proc, int idim, int idir) if (idir == 0) { if (rcbinfo[proc].mysplit[idim][1] == rcbinfo[me].mysplit[idim][0]) return 1; - else if (rcbinfo[proc].mysplit[idim][1] == 1.0 && + else if (rcbinfo[proc].mysplit[idim][1] == 1.0 && rcbinfo[me].mysplit[idim][0] == 0.0) return 1; @@ -1667,7 +1667,7 @@ int CommTiled::box_touch_tiled(int proc, int idim, int idir) } else { if (rcbinfo[proc].mysplit[idim][0] == rcbinfo[me].mysplit[idim][1]) return 1; - else if (rcbinfo[proc].mysplit[idim][0] == 0.0 && + else if (rcbinfo[proc].mysplit[idim][0] == 0.0 && rcbinfo[me].mysplit[idim][1] == 1.0) return 1; } @@ -1749,14 +1749,14 @@ int CommTiled::point_drop_tiled(int idim, double *x) recursive point drop thru RCB tree ------------------------------------------------------------------------- */ -int CommTiled::point_drop_tiled_recurse(double *x, +int CommTiled::point_drop_tiled_recurse(double *x, int proclower, int procupper) { // end recursion when partition is a single proc // return proc if (proclower == procupper) return proclower; - + // drop point on side of cut it is on // use < criterion so point is not on high edge of proc sub-domain // procmid = 1st processor in upper half of partition @@ -1800,8 +1800,8 @@ void CommTiled::coord2proc_setup() { if (!rcbnew) return; - if (!rcbinfo) - rcbinfo = (RCBinfo *) + if (!rcbinfo) + rcbinfo = (RCBinfo *) memory->smalloc(nprocs*sizeof(RCBinfo),"comm:rcbinfo"); rcbnew = 0; RCBinfo rcbone; @@ -1831,7 +1831,7 @@ int CommTiled::coord2proc(double *x, int &igx, int &igy, int &igz) if flag = 1, realloc if flag = 0, don't need to realloc with copy, just free/malloc ------------------------------------------------------------------------- */ - + void CommTiled::grow_send(int n, int flag) { maxsend = static_cast<int> (BUFFACTOR * n); diff --git a/src/comm_tiled.h b/src/comm_tiled.h index 7443e1019d9bf38d62652d5b873ea77b8e33fad6..dd86ecfdbabb8bc741c13fcc8d891986c483a14e 100644 --- a/src/comm_tiled.h +++ b/src/comm_tiled.h @@ -33,7 +33,7 @@ class CommTiled : public Comm { void forward_comm_pair(class Pair *); // forward comm from a Pair void reverse_comm_pair(class Pair *); // reverse comm from a Pair - virtual void forward_comm_fix(class Fix *, int size=0); + virtual void forward_comm_fix(class Fix *, int size=0); // forward comm from a Fix virtual void reverse_comm_fix(class Fix *, int size=0); // reverse comm from a Fix diff --git a/src/compute.cpp b/src/compute.cpp index 4c5da8bc946bf2618d036af3de5078cfa2a55b98..44eb8518872d47800cbe11f7d5dda0e1d3a83a2c 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" -#include "ctype.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> #include "compute.h" #include "atom.h" #include "domain.h" @@ -163,7 +163,7 @@ void Compute::adjust_dof_fix() fix_dof = 0; for (int i = 0; i < nfix; i++) - if (fix[i]->dof_flag) + if (fix[i]->dof_flag) fix_dof += fix[i]->dof(igroup); } diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index e1dad85769f9f215736190da50cf320e047b06fe..031d4856b58669d4095a54fce5801624f4fa6d18 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_angle_local.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/compute_angmom_chunk.cpp b/src/compute_angmom_chunk.cpp index 78c71908650d11d8b48d840eeaa1226f2b03db62..93a843ac31a2783d202ac095b7899d747a58eb23 100644 --- a/src/compute_angmom_chunk.cpp +++ b/src/compute_angmom_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_angmom_chunk.h" #include "atom.h" #include "update.h" @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -ComputeAngmomChunk::ComputeAngmomChunk(LAMMPS *lmp, int narg, char **arg) : +ComputeAngmomChunk::ComputeAngmomChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { if (narg != 4) error->all(FLERR,"Illegal compute angmom/chunk command"); diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index 152bfd5d78ef6a2ac6424a00aca6a5e510d447af..9cea55de585529a2f76fa607ac8d7e85a7ff8d9c 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_bond_local.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index 0676ad0a4a6d9d753c07e2039a37c9ab90230335..a6561f31368c5002a5f5eb6fd6a39839a9916af1 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -15,8 +15,8 @@ Contributing author: Michel Perez (U Lyon) for non-fcc lattices ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "compute_centro_atom.h" #include "atom.h" #include "update.h" diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index 487bd43de2682a429361162b7485a75c136433c4..ffd827608f196ff8bda5967d722b09756d0cb0ef 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "compute_chunk_atom.h" #include "atom.h" #include "update.h" @@ -99,8 +99,8 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : which = MOLECULE; iarg = 4; - } else if (strstr(arg[3],"c_") == arg[3] || - strstr(arg[3],"f_") == arg[3] || + } else if (strstr(arg[3],"c_") == arg[3] || + strstr(arg[3],"f_") == arg[3] || strstr(arg[3],"v_") == arg[3]) { if (arg[3][0] == 'c') which = COMPUTE; else if (arg[3][0] == 'f') which = FIX; @@ -118,7 +118,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : argindex = atoi(ptr+1); *ptr = '\0'; } else argindex = 0; - + n = strlen(suffix) + 1; cfvid = new char[n]; strcpy(cfvid,suffix); @@ -172,7 +172,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : if (limit && !compress) limitfirst = 1; iarg += 2; if (limit) { - if (iarg+1 > narg) + if (iarg+1 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); if (strcmp(arg[iarg+1],"max") == 0) limitstyle = LIMITMAX; else if (strcmp(arg[iarg+1],"exact") == 0) limitstyle = LIMITEXACT; @@ -209,11 +209,11 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal compute chunk/atom command"); if (strcmp(arg[iarg+2],"lower") == 0) minflag[idim] = LOWER; else minflag[idim] = COORD; - if (minflag[idim] == COORD) + if (minflag[idim] == COORD) minvalue[idim] = force->numeric(FLERR,arg[iarg+2]); if (strcmp(arg[iarg+3],"upper") == 0) maxflag[idim] = UPPER; else maxflag[idim] = COORD; - if (maxflag[idim] == COORD) + if (maxflag[idim] == COORD) maxvalue[idim] = force->numeric(FLERR,arg[iarg+3]); else error->all(FLERR,"Illegal compute chunk/atom command"); iarg += 4; @@ -251,17 +251,17 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // error checks - if (which == MOLECULE && !atom->molecule_flag) + if (which == MOLECULE && !atom->molecule_flag) error->all(FLERR,"Compute chunk/atom molecule for non-molecular system"); if (!binflag && discard == MIXED) error->all(FLERR,"Compute chunk/atom without bins " "cannot use discard mixed"); - if (which == BIN1D && delta[0] <= 0.0) + if (which == BIN1D && delta[0] <= 0.0) error->all(FLERR,"Illegal compute chunk/atom command"); if (which == BIN2D && (delta[0] <= 0.0 || delta[1] <= 0.0)) error->all(FLERR,"Illegal compute chunk/atom command"); - if (which == BIN3D && + if (which == BIN3D && (delta[0] <= 0.0 || delta[1] <= 0.0 || delta[2] <= 0.0)) error->all(FLERR,"Illegal compute chunk/atom command"); @@ -452,7 +452,7 @@ void ComputeChunkAtom::init() if (molecule[i] > maxone) maxone = molecule[i]; tagint maxall; MPI_Allreduce(&maxone,&maxall,1,MPI_LMP_TAGINT,MPI_MAX,world); - if (maxall > MAXSMALLINT) + if (maxall > MAXSMALLINT) error->all(FLERR,"Molecule IDs too large for compute chunk/atom"); } @@ -486,7 +486,7 @@ void ComputeChunkAtom::init() id_fix = new char[n]; strcpy(id_fix,id); strcat(id_fix,"_COMPUTE_STORE"); - + char **newarg = new char*[5]; newarg[0] = id_fix; newarg[1] = group->names[igroup]; @@ -535,7 +535,7 @@ void ComputeChunkAtom::compute_peratom() memory->create(chunk,nmax,"chunk/atom:chunk"); vector_atom = chunk; } - + setup_chunks(); compute_ichunk(); @@ -672,13 +672,13 @@ void ComputeChunkAtom::compute_ichunk() // if newly calculated IDs need to persist, store them in fixstore // yes if idsflag = ONCE or idsflag = NFREQ and lock is in place - if (idsflag == ONCE || (idsflag == NFREQ && lockfix)) { + if (idsflag == ONCE || (idsflag == NFREQ && lockfix)) { double *vstore = fixstore->vstore; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) vstore[i] = ichunk[i]; } - // one-time check if which = MOLECULE and + // one-time check if which = MOLECULE and // any chunks do not contain all atoms in the molecule if (molcheck) { @@ -740,14 +740,14 @@ int ComputeChunkAtom::setup_chunks() if (which == TYPE) nchunk = atom->ntypes; else if (!binflag) { - + int nlocal = atom->nlocal; int hi = -1; for (int i = 0; i < nlocal; i++) { if (exclude[i]) continue; if (ichunk[i] > hi) hi = ichunk[i]; } - + MPI_Allreduce(&hi,&nchunk,1,MPI_INT,MPI_MAX,world); if (nchunk <= 0) nchunk = 1; } @@ -810,7 +810,7 @@ void ComputeChunkAtom::assign_chunk_ids() if (regionflag) { for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit && + if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) exclude[i] = 0; else exclude[i] = 1; } @@ -932,7 +932,7 @@ void ComputeChunkAtom::compress_chunk_ids() bigint nbone = n; bigint nball; MPI_Allreduce(&nbone,&nball,1,MPI_LMP_BIGINT,MPI_SUM,world); - + // create my list of populated IDs int *list = NULL; @@ -963,9 +963,9 @@ void ComputeChunkAtom::compress_chunk_ids() displs[0] = 0; for (int iproc = 1; iproc < nprocs; iproc++) displs[iproc] = displs[iproc-1] + recvcounts[iproc-1]; - + // allgatherv acquires list of populated IDs from all procs - + MPI_Allgatherv(list,n,MPI_INT,listall,recvcounts,displs,MPI_INT,world); // add all unique IDs in listall to my hash @@ -1039,7 +1039,7 @@ void ComputeChunkAtom::check_molecules() if (!compress) { for (int i = 0; i < nlocal; i++) { - if (molecule[i] > 0 && molecule[i] <= nchunk && + if (molecule[i] > 0 && molecule[i] <= nchunk && ichunk[i] == 0) flag = 1; } } else { @@ -1049,7 +1049,7 @@ void ComputeChunkAtom::check_molecules() if (hash->find(molid) != hash->end() && ichunk[i] == 0) flag = 1; } } - + int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); if (flagall && comm->me == 0) @@ -1238,10 +1238,10 @@ void ComputeChunkAtom::atom2bin1d() if (xremap < boxlo[idim]) xremap += prd[idim]; if (xremap >= boxhi[idim]) xremap -= prd[idim]; } - + ibin = static_cast<int> ((xremap - offset[0]) * invdelta[0]); if (xremap < offset[0]) ibin--; - + if (discard == MIXED) { if (!minflag[idim]) ibin = MAX(ibin,0); else if (ibin < 0) { @@ -1260,7 +1260,7 @@ void ComputeChunkAtom::atom2bin1d() exclude[i] = 1; continue; } - + ichunk[i] = ibin+1; } @@ -1312,10 +1312,10 @@ void ComputeChunkAtom::atom2bin2d() if (xremap < boxlo[idim]) xremap += prd[idim]; if (xremap >= boxhi[idim]) xremap -= prd[idim]; } - + i1bin = static_cast<int> ((xremap - offset[0]) * invdelta[0]); if (xremap < offset[0]) i1bin--; - + if (discard == MIXED) { if (!minflag[idim]) i1bin = MAX(i1bin,0); else if (i1bin < 0) { @@ -1420,7 +1420,7 @@ void ComputeChunkAtom::atom2bin3d() i1bin = static_cast<int> ((xremap - offset[0]) * invdelta[0]); if (xremap < offset[0]) i1bin--; - + if (discard == MIXED) { if (!minflag[idim]) i1bin = MAX(i1bin,0); else if (i1bin < 0) { @@ -1439,7 +1439,7 @@ void ComputeChunkAtom::atom2bin3d() exclude[i] = 1; continue; } - + yremap = x[i][jdim]; if (periodicity[jdim]) { if (yremap < boxlo[jdim]) yremap += prd[jdim]; @@ -1495,7 +1495,7 @@ void ComputeChunkAtom::atom2bin3d() exclude[i] = 1; continue; } - + ibin = i1bin*nlayers[1]*nlayers[2] + i2bin*nlayers[2] + i3bin; ichunk[i] = ibin+1; } @@ -1521,9 +1521,9 @@ void ComputeChunkAtom::readdim(int narg, char **arg, int iarg, int idim) else if (strcmp(arg[iarg+1],"center") == 0) originflag[idim] = CENTER; else if (strcmp(arg[iarg+1],"upper") == 0) originflag[idim] = UPPER; else originflag[idim] = COORD; - if (originflag[idim] == COORD) + if (originflag[idim] == COORD) origin[idim] = force->numeric(FLERR,arg[iarg+1]); - + delta[idim] = force->numeric(FLERR,arg[iarg+2]); } diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 343a0dd1bd4a56d474bbd609aacbe66fa5e358fd..ade4ce5d87ef5e84fecf86cef11ae5744ea06e2d 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_cluster_atom.h" #include "atom.h" #include "update.h" diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index 69425457e8f3b87be44fac4c16b0c3101d355040..4e0d7e907bdb9cbc951d0f6451be6f368fba6be2 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -15,8 +15,8 @@ Contributing author: Wan Liang (Chinese Academy of Sciences) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "compute_cna_atom.h" #include "atom.h" #include "update.h" @@ -29,7 +29,7 @@ #include "comm.h" #include "memory.h" #include "error.h" -#include "math.h" +#include <math.h> using namespace LAMMPS_NS; diff --git a/src/compute_com_chunk.cpp b/src/compute_com_chunk.cpp index 0af54d9b7742c8b05a70171081f8a117867b3763..ebf2b30f6e14036315fe11e7bbfe741f9059e083 100644 --- a/src/compute_com_chunk.cpp +++ b/src/compute_com_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_com_chunk.h" #include "atom.h" #include "update.h" diff --git a/src/compute_contact_atom.cpp b/src/compute_contact_atom.cpp index 8db5c3e4bd1f603368a8d808d1ea14132cfa3ce6..99c4766b6bbc0d8f50d56b199dd5bf4fa9df420a 100644 --- a/src/compute_contact_atom.cpp +++ b/src/compute_contact_atom.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_contact_atom.h" #include "atom.h" #include "update.h" diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index beb03812b08f5adb0f0f175122405d5b70c809ca..2769edc12dc5b6ab76ef086be94bf60ba2932d21 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_coord_atom.h" #include "atom.h" #include "update.h" @@ -169,7 +169,7 @@ void ComputeCoordAtom::compute_peratom() for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; - + jtype = type[j]; delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; @@ -177,7 +177,7 @@ void ComputeCoordAtom::compute_peratom() rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutsq && jtype >= typelo[0] && jtype <= typehi[0]) n++; } - + cvec[i] = n; } else cvec[i] = 0.0; } @@ -199,7 +199,7 @@ void ComputeCoordAtom::compute_peratom() for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; - + jtype = type[j]; delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index 8316df01b01a64dd0399ee54c0e2a0c73ed269e4..66523d00a18be8405ac0bc4364b56d82ab1747e6 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_dihedral_local.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/compute_displace_atom.cpp b/src/compute_displace_atom.cpp index df3bde77c6ba3d1de43bf932773fd3411cec3517..a95a645632f8511b5aef32e5b164eaefaf248e53 100644 --- a/src/compute_displace_atom.cpp +++ b/src/compute_displace_atom.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_displace_atom.h" #include "atom.h" #include "update.h" diff --git a/src/compute_erotate_sphere.cpp b/src/compute_erotate_sphere.cpp index 0ae3cfd60495992bb511c28945836bef52eed9c7..31ed0aaba5b4f194fe366e2267daa0fc03f12a1c 100644 --- a/src/compute_erotate_sphere.cpp +++ b/src/compute_erotate_sphere.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "compute_erotate_sphere.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/compute_erotate_sphere_atom.cpp b/src/compute_erotate_sphere_atom.cpp index c058a5eb58be8569e56339fad760f8da36797cc7..9c2d4d9caf1fed7c5fb4af4ed0ce9ac7fb4db3c4 100644 --- a/src/compute_erotate_sphere_atom.cpp +++ b/src/compute_erotate_sphere_atom.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_erotate_sphere_atom.h" #include "atom.h" #include "update.h" @@ -31,7 +31,7 @@ ComputeErotateSphereAtom:: ComputeErotateSphereAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { - if (narg != 3) + if (narg != 3) error->all(FLERR,"Illegal compute erotate/sphere//atom command"); peratom_flag = 1; diff --git a/src/compute_group_group.cpp b/src/compute_group_group.cpp index 900af68528cd0639618c398fdfa021501a7b905d..741d4a667beeea7432d029e24894e2d6a11c67ae 100644 --- a/src/compute_group_group.cpp +++ b/src/compute_group_group.cpp @@ -16,8 +16,8 @@ K-space terms added by Stan Moore (BYU) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_group_group.h" #include "atom.h" #include "update.h" @@ -29,7 +29,7 @@ #include "group.h" #include "kspace.h" #include "error.h" -#include "math.h" +#include <math.h> #include "comm.h" #include "domain.h" #include "math_const.h" @@ -227,7 +227,7 @@ void ComputeGroupGroup::pair_contribution() for (ii = 0; ii < inum; ii++) { i = ilist[ii]; // skip if atom I is not in either group - if (!(mask[i] & groupbit || mask[i] & jgroupbit)) continue; + if (!(mask[i] & groupbit || mask[i] & jgroupbit)) continue; xtmp = x[i][0]; ytmp = x[i][1]; diff --git a/src/compute_gyration.cpp b/src/compute_gyration.cpp index 1025b8fc2a696fc74f43d367d7a376fcf13c00e3..fab413e670a3409bd6ca8b59497f5c1236d927c2 100644 --- a/src/compute_gyration.cpp +++ b/src/compute_gyration.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "compute_gyration.h" #include "update.h" #include "atom.h" diff --git a/src/compute_gyration_chunk.cpp b/src/compute_gyration_chunk.cpp index a14fb6f2051024c642c86ca60306f190bf272e08..e006a82299d5a44f934756adaf6c6fe2d0357da3 100644 --- a/src/compute_gyration_chunk.cpp +++ b/src/compute_gyration_chunk.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_gyration_chunk.h" #include "atom.h" #include "update.h" diff --git a/src/compute_heat_flux.cpp b/src/compute_heat_flux.cpp index 335304ef9d50d648e144d211c5009781dd7d9420..33e7f7a4498daa8bfdf41f7bb10bfae8fb7dde8d 100644 --- a/src/compute_heat_flux.cpp +++ b/src/compute_heat_flux.cpp @@ -16,8 +16,8 @@ Mario Pinto (Computational Research Lab, Pune, India) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_heat_flux.h" #include "atom.h" #include "update.h" diff --git a/src/compute_improper_local.cpp b/src/compute_improper_local.cpp index 439a2bd3b2a690f91cf9b7cebc057f46e5dce51b..3c0af24a106cd9c158404a705c67e550a2a48dd9 100644 --- a/src/compute_improper_local.cpp +++ b/src/compute_improper_local.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_improper_local.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/compute_inertia_chunk.cpp b/src/compute_inertia_chunk.cpp index 5d47fee5831915254b683c09c1cf0ffeeafa55de..33660b839f5bc48639d7fa3d2c1d9e1cc055840e 100644 --- a/src/compute_inertia_chunk.cpp +++ b/src/compute_inertia_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_inertia_chunk.h" #include "atom.h" #include "update.h" @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -ComputeInertiaChunk::ComputeInertiaChunk(LAMMPS *lmp, int narg, char **arg) : +ComputeInertiaChunk::ComputeInertiaChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { if (narg != 4) error->all(FLERR,"Illegal compute inertia/chunk command"); @@ -136,7 +136,7 @@ void ComputeInertiaChunk::compute_array() MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world); for (int i = 0; i < nchunk; i++) { - comall[i][0] /= masstotal[i]; + comall[i][0] /= masstotal[i]; comall[i][1] /= masstotal[i]; comall[i][2] /= masstotal[i]; } diff --git a/src/compute_ke.cpp b/src/compute_ke.cpp index 3efd6983250a3ca922921928e77f5fe8c89ac082..fb3c5a96959525b2e6db63e5bda4fc7f715ac026 100644 --- a/src/compute_ke.cpp +++ b/src/compute_ke.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "compute_ke.h" #include "atom.h" #include "update.h" diff --git a/src/compute_ke_atom.cpp b/src/compute_ke_atom.cpp index 5709c428374be4f9e0468207a804878ddfe767ed..5cc6f7a9395d5e6339ffd2b17146fea00edacf9f 100644 --- a/src/compute_ke_atom.cpp +++ b/src/compute_ke_atom.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_ke_atom.h" #include "atom.h" #include "update.h" diff --git a/src/compute_msd.cpp b/src/compute_msd.cpp index 91e758ef6d3f6d04ea28e1254b145f0dcb857640..0d35a886202e3b3281cf814e096410e1576de1d3 100644 --- a/src/compute_msd.cpp +++ b/src/compute_msd.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_msd.h" #include "atom.h" #include "update.h" @@ -85,7 +85,7 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) : else xoriginal[i][0] = xoriginal[i][1] = xoriginal[i][2] = 0.0; // adjust for COM if requested - + if (comflag) { double cm[3]; masstotal = group->mass(igroup); diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index 317b601bc32ca0a2c17f2d3fa90dfb4e133114ef..81603f2e445122d610ff92fd2464c26fbda03e0c 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_msd_chunk.h" #include "atom.h" #include "update.h" @@ -120,7 +120,7 @@ void ComputeMSDChunk::compute_array() nchunk = n; allocate(); size_array_rows = nchunk; - } else if (n != nchunk) + } else if (n != nchunk) error->all(FLERR,"Compute msd/chunk nchunk is not static"); // zero local per-chunk values diff --git a/src/compute_omega_chunk.cpp b/src/compute_omega_chunk.cpp index 4e3f08d7749b8b05cc5e8039641b0baf48d78c6b..c437dd66b32623f50aa377fad1b23191ed00d975 100644 --- a/src/compute_omega_chunk.cpp +++ b/src/compute_omega_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_omega_chunk.h" #include "atom.h" #include "update.h" @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -ComputeOmegaChunk::ComputeOmegaChunk(LAMMPS *lmp, int narg, char **arg) : +ComputeOmegaChunk::ComputeOmegaChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { if (narg != 4) error->all(FLERR,"Illegal compute omega/chunk command"); @@ -219,12 +219,12 @@ void ComputeOmegaChunk::compute_array() ione[0][1]*ione[1][2]*ione[2][0] + ione[0][2]*ione[1][0]*ione[2][1] - ione[0][0]*ione[1][2]*ione[2][1] - ione[0][1]*ione[1][0]*ione[2][2] - ione[2][0]*ione[1][1]*ione[0][2]; - + if (determinant > 0.0) for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) inverse[i][j] /= determinant; - + omega[i][0] = inverse[0][0]*angmom[i][0] + inverse[0][1]*angmom[i][1] + inverse[0][2]*angmom[i][2]; omega[i][1] = inverse[1][0]*angmom[i][0] + inverse[1][1]*angmom[i][1] + diff --git a/src/compute_pair.cpp b/src/compute_pair.cpp index 8c7fa0cef3660e5210088fff03c5d1afb67c86d1..b411794f61dcd0a498ebfa364ed3170fbe217910 100644 --- a/src/compute_pair.cpp +++ b/src/compute_pair.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_pair.h" #include "update.h" #include "force.h" diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index 1cbd72dc585d92af372a7844cabc94dc9d5c7ea7..ad404b3f5ede91e4ae2c3e95e93fa83a568e5125 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "compute_pair_local.h" #include "atom.h" #include "update.h" diff --git a/src/compute_pe.cpp b/src/compute_pe.cpp index aaa87d820424376a74a7a8e3bd9dbe4f5ac6b3fe..1055ab4eb100d551d31586da0907a91082cb0127 100644 --- a/src/compute_pe.cpp +++ b/src/compute_pe.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_pe.h" #include "atom.h" #include "update.h" diff --git a/src/compute_pe_atom.cpp b/src/compute_pe_atom.cpp index b1892e42f4bd5f02ffcd78b3d39b17ac82154055..e157bf29fdc238ed084149f7dfe3c745bda22b40 100755 --- a/src/compute_pe_atom.cpp +++ b/src/compute_pe_atom.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_pe_atom.h" #include "atom.h" #include "update.h" diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index d4a3109ea96fc78c0d4fd137fd16159cfe095289..ca493e46fd5ec2891f9dac637dc57e807e7ead13 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "compute_pressure.h" #include "atom.h" #include "update.h" @@ -96,7 +96,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // error check - if (keflag && id_temp == NULL) + if (keflag && id_temp == NULL) error->all(FLERR,"Compute pressure requires temperature ID " "to include kinetic energy"); diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index 336fbed5b06ab2f7ea62b541dafc34a9c18918ca..54fcb9d722dc367e9485b76693d2b369e88bb2e0 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "compute_property_atom.h" #include "math_extra.h" #include "atom.h" @@ -201,28 +201,28 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"quatw") == 0) { avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); avec_body = (AtomVecBody *) atom->style_match("body"); - if (!avec_ellipsoid && !avec_body) + if (!avec_ellipsoid && !avec_body) error->all(FLERR,"Compute property/atom for " "atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_quatw; } else if (strcmp(arg[iarg],"quati") == 0) { avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); avec_body = (AtomVecBody *) atom->style_match("body"); - if (!avec_ellipsoid && !avec_body) + if (!avec_ellipsoid && !avec_body) error->all(FLERR,"Compute property/atom for " "atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_quati; } else if (strcmp(arg[iarg],"quatj") == 0) { avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); avec_body = (AtomVecBody *) atom->style_match("body"); - if (!avec_ellipsoid && !avec_body) + if (!avec_ellipsoid && !avec_body) error->all(FLERR,"Compute property/atom for " "atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_quatj; } else if (strcmp(arg[iarg],"quatk") == 0) { avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); avec_body = (AtomVecBody *) atom->style_match("body"); - if (!avec_ellipsoid && !avec_body) + if (!avec_ellipsoid && !avec_body) error->all(FLERR,"Compute property/atom for " "atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_quatk; diff --git a/src/compute_property_chunk.cpp b/src/compute_property_chunk.cpp index 0fc67118f188759373ba3d2e0fc067dd654397bf..95677489189e061ca9e3d44e4a6ca9ec13c5b65e 100644 --- a/src/compute_property_chunk.cpp +++ b/src/compute_property_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_property_chunk.h" #include "atom.h" #include "update.h" @@ -51,7 +51,7 @@ ComputePropertyChunk::ComputePropertyChunk(LAMMPS *lmp, int narg, char **arg) : pack_choice[i] = &ComputePropertyChunk::pack_count; countflag = 1; } else if (strcmp(arg[iarg],"id") == 0) { - if (!cchunk->compress) + if (!cchunk->compress) error->all(FLERR,"Compute chunk/atom stores no IDs for " "compute property/chunk"); pack_choice[i] = &ComputePropertyChunk::pack_id; diff --git a/src/compute_property_local.cpp b/src/compute_property_local.cpp index c08d723cb28d2303954bd9d6ddf5e7820eca3017..864efa46467fb8d6412d8c7ea882ed0ce366422f 100644 --- a/src/compute_property_local.cpp +++ b/src/compute_property_local.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_property_local.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index 65bd4eabe26ac80aa3290a2d3619d005f68b54df..14a12bb5c6d647cb0588f864c58d96d5648fd501 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -15,9 +15,9 @@ Contributing authors: Paul Crozier (SNL), Jeff Greathouse (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> #include "compute_rdf.h" #include "atom.h" #include "update.h" diff --git a/src/compute_rdf.h b/src/compute_rdf.h index 9d0956212bd18659a6a0e3a96f4eeb0e3088a0d1..3f9fde7cad63fe64ced94399461c21c8840b9cbc 100644 --- a/src/compute_rdf.h +++ b/src/compute_rdf.h @@ -20,7 +20,7 @@ ComputeStyle(rdf,ComputeRDF) #ifndef LMP_COMPUTE_RDF_H #define LMP_COMPUTE_RDF_H -#include "stdio.h" +#include <stdio.h> #include "compute.h" namespace LAMMPS_NS { diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index 6f77436522b6c9eb5a84eb0b8a7a3b7a87128da8..f6305f480685896ffe0142280793f8bb73f6f2f7 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "compute_reduce.h" #include "atom.h" #include "update.h" diff --git a/src/compute_reduce_region.cpp b/src/compute_reduce_region.cpp index fe33fc3c793c41f31a77fa32e2a543e95e728ad2..420a85c91f7e6da90b3be2f530672f0eefd9632e 100644 --- a/src/compute_reduce_region.cpp +++ b/src/compute_reduce_region.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "compute_reduce_region.h" #include "atom.h" #include "update.h" diff --git a/src/compute_slice.cpp b/src/compute_slice.cpp index e28e9d5bce3f82beb3e8814472161b73d705a7a0..700b2545c9655fad475e46b1b11ee06606735672 100644 --- a/src/compute_slice.cpp +++ b/src/compute_slice.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "compute_slice.h" #include "update.h" #include "modify.h" diff --git a/src/compute_stress_atom.cpp b/src/compute_stress_atom.cpp index 45d8e20d9c81fd943f841499ac9696b94e9f84e4..3455d9eb0865879ded3ea864714dbc3f8546d8dc 100644 --- a/src/compute_stress_atom.cpp +++ b/src/compute_stress_atom.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "compute_stress_atom.h" #include "atom.h" #include "update.h" @@ -308,7 +308,7 @@ void ComputeStressAtom::compute_peratom() stress[i][5] += onemass*v[i][1]*v[i][2]; temperature->restore_bias(i,v[i]); } - + } else { for (i = 0; i < nlocal; i++) if (mask[i] & groupbit) { diff --git a/src/compute_temp.cpp b/src/compute_temp.cpp index 6748bea4ef2eea22763d30aed625850a88d24e1d..1fbab924b83ddc63930f70f4da031fd27b7151cd 100644 --- a/src/compute_temp.cpp +++ b/src/compute_temp.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_temp.h" #include "atom.h" #include "update.h" @@ -97,7 +97,7 @@ double ComputeTemp::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/compute_temp_chunk.cpp b/src/compute_temp_chunk.cpp index 3c0cdff80daae7f5187e43ecd75b72d531361280..5a5853514f70edab78236fe55b9a8ddf96a300ee 100644 --- a/src/compute_temp_chunk.cpp +++ b/src/compute_temp_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_temp_chunk.h" #include "atom.h" #include "update.h" @@ -236,7 +236,7 @@ double ComputeTempChunk::compute_scalar() if (mask[i] & groupbit) { index = ichunk[i]-1; if (index < 0) continue; - t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * + t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * rmass[i]; mycount++; } @@ -509,7 +509,7 @@ void ComputeTempChunk::temperature(int icol) if (mask[i] & groupbit) { index = ichunk[i]-1; if (index < 0) continue; - sum[index] += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * + sum[index] += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * rmass[i]; count[index]++; } diff --git a/src/compute_temp_com.cpp b/src/compute_temp_com.cpp index 9e734299af3fd141411450847c55a3299ba276b0..7e05dcb7762951cac4fe20edd73a72e447328215 100644 --- a/src/compute_temp_com.cpp +++ b/src/compute_temp_com.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "compute_temp_com.h" #include "atom.h" #include "update.h" @@ -111,7 +111,7 @@ double ComputeTempCOM::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/compute_temp_deform.cpp b/src/compute_temp_deform.cpp index 0035cbf4dfc815b9c6b55de8f8d79cc68ef45d0c..8c1d2d85fcb81b06bdb4d948882169c2172fef63 100644 --- a/src/compute_temp_deform.cpp +++ b/src/compute_temp_deform.cpp @@ -15,8 +15,8 @@ Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_temp_deform.h" #include "domain.h" #include "atom.h" @@ -148,7 +148,7 @@ double ComputeTempDeform::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index f00a44f9427027d50a2915dbd8e4740ca3eef362..c4e8e7cd88514e14cba8c7a9edc7432bb6261bb8 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" +#include <mpi.h> +#include <stdlib.h> #include "compute_temp_partial.h" #include "atom.h" #include "update.h" @@ -119,7 +119,7 @@ double ComputeTempPartial::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index 4cc9a3e896ede2c114f5c36f0088706d68f84ae5..b800047175554afe15963a217ad199d559f60ebb 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "compute_temp_profile.h" #include "atom.h" #include "update.h" @@ -102,7 +102,7 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : // optional keywords outflag = TENSOR; - + while (iarg < narg) { if (strcmp(arg[iarg],"out") == 0) { if (iarg+2 > narg) @@ -244,7 +244,7 @@ double ComputeTempProfile::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/compute_temp_ramp.cpp b/src/compute_temp_ramp.cpp index a922cded8c1fd780ade4896fdbb40ebe036d6e52..ba5ed8ca68df9caa3d1cfc47f83c7e7e36cb850d 100644 --- a/src/compute_temp_ramp.cpp +++ b/src/compute_temp_ramp.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "compute_temp_ramp.h" #include "atom.h" #include "update.h" @@ -170,7 +170,7 @@ double ComputeTempRamp::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/compute_temp_region.cpp b/src/compute_temp_region.cpp index e746ea1fc124ffbfc1219e251ac3444df9569f83..158c93b2fbc5ae705ea4e3811ab7ad961f66d08c 100644 --- a/src/compute_temp_region.cpp +++ b/src/compute_temp_region.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_temp_region.h" #include "atom.h" #include "update.h" @@ -136,7 +136,7 @@ double ComputeTempRegion::compute_scalar() tarray[1] = t; MPI_Allreduce(tarray,tarray_all,2,MPI_DOUBLE,MPI_SUM,world); dof = domain->dimension * tarray_all[0] - extra_dof; - if (dof < 0.0 && tarray_all[0] > 0.0) + if (dof < 0.0 && tarray_all[0] > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); if (dof > 0) scalar = force->mvv2e * tarray_all[1] / (dof * force->boltz); else scalar = 0.0; diff --git a/src/compute_temp_sphere.cpp b/src/compute_temp_sphere.cpp index 001a7c2de4f564722f0dbeac27d6add030c98d7e..64b23308e2253bafcf9e5f10a8f679825d972612 100644 --- a/src/compute_temp_sphere.cpp +++ b/src/compute_temp_sphere.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "compute_temp_sphere.h" #include "atom.h" #include "atom_vec.h" @@ -250,7 +250,7 @@ double ComputeTempSphere::compute_scalar() MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world); if (dynamic || tempbias == 2) dof_compute(); - if (dof < 0.0 && natoms_temp > 0.0) + if (dof < 0.0 && natoms_temp > 0.0) error->all(FLERR,"Temperature compute degrees of freedom < 0"); scalar *= tfactor; return scalar; diff --git a/src/compute_torque_chunk.cpp b/src/compute_torque_chunk.cpp index 0cd69721a4672b7c3cd46271dea4788266513944..41ae0c628c298ac675beb21df348c123a47eea52 100644 --- a/src/compute_torque_chunk.cpp +++ b/src/compute_torque_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_torque_chunk.h" #include "atom.h" #include "update.h" @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -ComputeTorqueChunk::ComputeTorqueChunk(LAMMPS *lmp, int narg, char **arg) : +ComputeTorqueChunk::ComputeTorqueChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg) { if (narg != 4) error->all(FLERR,"Illegal compute torque/chunk command"); diff --git a/src/compute_vacf.cpp b/src/compute_vacf.cpp index bbfd2651e984fa89fd8ae62711cf2d16dab1c3ea..bc3ffbd21aa09306ae16092f842e0d3724421971 100755 --- a/src/compute_vacf.cpp +++ b/src/compute_vacf.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_vacf.h" #include "atom.h" #include "update.h" diff --git a/src/compute_vcm_chunk.cpp b/src/compute_vcm_chunk.cpp index dd2c075653778845ae2fa8f5883fdfced65ad422..a3751fa13a0841f1a226b57a59ee67a8092b92fd 100644 --- a/src/compute_vcm_chunk.cpp +++ b/src/compute_vcm_chunk.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "compute_vcm_chunk.h" #include "atom.h" #include "update.h" @@ -117,7 +117,7 @@ void ComputeVCMChunk::compute_array() for (int i = 0; i < nchunk; i++) vcm[i][0] = vcm[i][1] = vcm[i][2] = 0.0; - if (massneed) + if (massneed) for (int i = 0; i < nchunk; i++) massproc[i] = 0.0; // compute VCM for each chunk @@ -142,7 +142,7 @@ void ComputeVCMChunk::compute_array() } MPI_Allreduce(&vcm[0][0],&vcmall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world); - if (massneed) + if (massneed) MPI_Allreduce(massproc,masstotal,nchunk,MPI_DOUBLE,MPI_SUM,world); for (int i = 0; i < nchunk; i++) { diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index a192dbb6f4751359d9535cc64361059cf1c0c121..22d58bdc64ca5b26a981733dd40242595da999d3 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "create_atoms.h" #include "atom.h" #include "atom_vec.h" @@ -225,7 +225,7 @@ void CreateAtoms::command(int narg, char **arg) onemol->compute_center(); // molecule random number generator, different for each proc - + ranmol = new RanMars(lmp,molseed+comm->me); } @@ -422,8 +422,8 @@ void CreateAtoms::command(int narg, char **arg) int molcreate = (atom->nlocal - nlocal_previous) / onemol->natoms; - // increment total bonds,angles,etc - + // increment total bonds,angles,etc + bigint nmolme = molcreate; bigint nmoltotal; MPI_Allreduce(&nmolme,&nmoltotal,1,MPI_LMP_BIGINT,MPI_SUM,world); @@ -509,7 +509,7 @@ void CreateAtoms::command(int narg, char **arg) improper_atom4[ilocal][j] += offset; } if (onemol->specialflag) - for (int j = 0; j < nspecial[ilocal][2]; j++) + for (int j = 0; j < nspecial[ilocal][2]; j++) special[ilocal][j] += offset; } ilocal++; diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index a471285724c5486a59553ac9523ce8f6db996127..309faa716704781efa09a15535453150338fa9cc 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "create_bonds.h" #include "atom.h" #include "domain.h" @@ -39,7 +39,7 @@ void CreateBonds::command(int narg, char **arg) error->all(FLERR,"Create_bonds command before simulation box is defined"); if (atom->tag_enable == 0) error->all(FLERR,"Cannot use create_bonds unless atoms have IDs"); - if (atom->molecular != 1) + if (atom->molecular != 1) error->all(FLERR,"Cannot use create_bonds with non-molecular system"); if (narg != 5) error->all(FLERR,"Illegal create_bonds command"); @@ -57,7 +57,7 @@ void CreateBonds::command(int narg, char **arg) double rmin = force->numeric(FLERR,arg[3]); double rmax = force->numeric(FLERR,arg[4]); - if (btype <= 0 || btype > atom->nbondtypes) + if (btype <= 0 || btype > atom->nbondtypes) error->all(FLERR,"Invalid bond type in create_bonds command"); if (rmin > rmax) error->all(FLERR,"Illegal create_bonds command"); @@ -136,7 +136,7 @@ void CreateBonds::command(int narg, char **arg) tagint **bond_atom = atom->bond_atom; double newton_bond = force->newton_bond; int nlocal = atom->nlocal; - + int i,j,ii,jj,inum,jnum,flag; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *ilist,*jlist,*numneigh,**firstneigh; @@ -161,7 +161,7 @@ void CreateBonds::command(int narg, char **arg) // only consider bond creation if I,J distance between 2 cutoffs // compute rsq identically on both I,J loop iterations // if I,J tags equal, do not bond atom to itself - + if (tag[i] < tag[j]) { delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; diff --git a/src/create_box.cpp b/src/create_box.cpp index 21e20aab56ce9a6fb007efef3af0258f71df2303..94a11c1af8f93c969e39c4dce5563e4db2945cfb 100644 --- a/src/create_box.cpp +++ b/src/create_box.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "create_box.h" #include "atom.h" #include "atom_vec.h" @@ -110,49 +110,49 @@ void CreateBox::command(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"bond/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - if (!atom->avec->bonds_allow) + if (!atom->avec->bonds_allow) error->all(FLERR,"No bonds allowed with this atom style"); atom->nbondtypes = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"angle/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - if (!atom->avec->angles_allow) + if (!atom->avec->angles_allow) error->all(FLERR,"No angles allowed with this atom style"); atom->nangletypes = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"dihedral/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - if (!atom->avec->dihedrals_allow) + if (!atom->avec->dihedrals_allow) error->all(FLERR,"No dihedrals allowed with this atom style"); atom->ndihedraltypes = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"improper/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - if (!atom->avec->impropers_allow) + if (!atom->avec->impropers_allow) error->all(FLERR,"No impropers allowed with this atom style"); atom->nimpropertypes = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"extra/bond/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - if (!atom->avec->bonds_allow) + if (!atom->avec->bonds_allow) error->all(FLERR,"No bonds allowed with this atom style"); atom->bond_per_atom = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"extra/angle/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - if (!atom->avec->angles_allow) + if (!atom->avec->angles_allow) error->all(FLERR,"No angles allowed with this atom style"); atom->angle_per_atom = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"extra/dihedral/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - if (!atom->avec->dihedrals_allow) + if (!atom->avec->dihedrals_allow) error->all(FLERR,"No dihedrals allowed with this atom style"); atom->dihedral_per_atom = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"extra/improper/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - if (!atom->avec->impropers_allow) + if (!atom->avec->impropers_allow) error->all(FLERR,"No impropers allowed with this atom style"); atom->improper_per_atom = force->inumeric(FLERR,arg[iarg+1]); iarg += 2; diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index eca1cbd752e7fc77dcbb37c8c53e0cf54d6084ba..5777ed19fb31d3d4b0e5679dca465d389bda9f95 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "delete_atoms.h" #include "atom.h" #include "atom_vec.h" @@ -128,19 +128,19 @@ void DeleteAtoms::command(int narg, char **arg) " atoms, new total = " BIGINT_FORMAT "\n", ndelete,atom->natoms); if (bond_flag || mol_flag) { - if (nbonds_previous) + if (nbonds_previous) fprintf(screen,"Deleted " BIGINT_FORMAT " bonds, new total = " BIGINT_FORMAT "\n", ndelete_bonds,atom->nbonds); - if (nangles_previous) + if (nangles_previous) fprintf(screen,"Deleted " BIGINT_FORMAT " angles, new total = " BIGINT_FORMAT "\n", ndelete_angles,atom->nangles); - if (ndihedrals_previous) + if (ndihedrals_previous) fprintf(screen,"Deleted " BIGINT_FORMAT " dihedrals, new total = " BIGINT_FORMAT "\n", ndelete_dihedrals,atom->ndihedrals); - if (nimpropers_previous) + if (nimpropers_previous) fprintf(screen,"Deleted " BIGINT_FORMAT " impropers, new total = " BIGINT_FORMAT "\n", ndelete_impropers,atom->nimpropers); @@ -152,19 +152,19 @@ void DeleteAtoms::command(int narg, char **arg) " atoms, new total = " BIGINT_FORMAT "\n", ndelete,atom->natoms); if (bond_flag || mol_flag) { - if (nbonds_previous) + if (nbonds_previous) fprintf(logfile,"Deleted " BIGINT_FORMAT " bonds, new total = " BIGINT_FORMAT "\n", ndelete_bonds,atom->nbonds); - if (nangles_previous) + if (nangles_previous) fprintf(logfile,"Deleted " BIGINT_FORMAT " angles, new total = " BIGINT_FORMAT "\n", ndelete_angles,atom->nangles); - if (ndihedrals_previous) + if (ndihedrals_previous) fprintf(logfile,"Deleted " BIGINT_FORMAT " dihedrals, new total = " BIGINT_FORMAT "\n", ndelete_dihedrals,atom->ndihedrals); - if (nimpropers_previous) + if (nimpropers_previous) fprintf(logfile,"Deleted " BIGINT_FORMAT " impropers, new total = " BIGINT_FORMAT "\n", ndelete_impropers,atom->nimpropers); @@ -712,10 +712,10 @@ void DeleteAtoms::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"bond") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command"); - if (atom->molecular == 0) + if (atom->molecular == 0) error->all(FLERR,"Cannot delete_atoms bond yes for " "non-molecular systems"); - if (atom->molecular == 2) + if (atom->molecular == 2) error->all(FLERR,"Cannot use delete_atoms bond yes with " "atom_style template"); if (strcmp(arg[iarg+1],"yes") == 0) bond_flag = 1; @@ -724,7 +724,7 @@ void DeleteAtoms::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"mol") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal delete_atoms command"); - if (atom->molecule_flag == 0) + if (atom->molecule_flag == 0) error->all(FLERR,"Delete_atoms mol yes requires " "atom attribute molecule"); if (strcmp(arg[iarg+1],"yes") == 0) mol_flag = 1; diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index c4823cc01b84878e8a917e7cd6ca554d2f91b388..3871641e0ec3ebc452f62e246007a7704d73ecb6 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "delete_bonds.h" #include "atom.h" #include "atom_vec.h" @@ -146,7 +146,7 @@ void DeleteBonds::command(int narg, char **arg) int i,m,n,consider,flag,itype; int atom1,atom2,atom3,atom4; - if (atom->avec->bonds_allow && + if (atom->avec->bonds_allow && (style == BOND || style == MULTI || style == ATOM)) { int *num_bond = atom->num_bond; int **bond_type = atom->bond_type; @@ -299,7 +299,7 @@ void DeleteBonds::command(int narg, char **arg) } delete [] tlist; - + // induce turn off of angles, dihedral, impropers due to turned off bonds // induce turn off of dihedrals due to turned off angles // all atoms or any atom in interaction must be in group, based on any_flag diff --git a/src/dihedral.cpp b/src/dihedral.cpp index 8cd66bee1fe41809fd76cca2f33831fd59d0597a..3cd4a33ce99b90d9ce66acffbbe1c1c0b400a4e8 100644 --- a/src/dihedral.cpp +++ b/src/dihedral.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "dihedral.h" #include "atom.h" #include "comm.h" @@ -67,7 +67,7 @@ Dihedral::~Dihedral() void Dihedral::init() { - if (!allocated && atom->ndihedraltypes) + if (!allocated && atom->ndihedraltypes) error->all(FLERR,"Dihedral coeffs are not set"); for (int i = 1; i <= atom->ndihedraltypes; i++) if (setflag[i] == 0) error->all(FLERR,"All dihedral coeffs are not set"); diff --git a/src/dihedral.h b/src/dihedral.h index e16c26a629287d2e388ff57a248dd11e2a9002d7..3e3ec0a4f25f1dc88948625c329273855cc85205 100644 --- a/src/dihedral.h +++ b/src/dihedral.h @@ -14,7 +14,7 @@ #ifndef LMP_DIHEDRAL_H #define LMP_DIHEDRAL_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index 72c0c0510ab2707a4dd5834d1a8891e311e49b9a..ed73351b3aef365bacb5de8246f778394dedd553 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "ctype.h" +#include <math.h> +#include <string.h> +#include <ctype.h> #include "dihedral_hybrid.h" #include "atom.h" #include "neighbor.h" diff --git a/src/dihedral_hybrid.h b/src/dihedral_hybrid.h index bb6bf5621150aa9c5d9f9bfed1fc5a4a597ed677..6e30d3d693373ca6859a52ac2a9f9acdab07c93b 100644 --- a/src/dihedral_hybrid.h +++ b/src/dihedral_hybrid.h @@ -20,7 +20,7 @@ DihedralStyle(hybrid,DihedralHybrid) #ifndef LMP_DIHEDRAL_HYBRID_H #define LMP_DIHEDRAL_HYBRID_H -#include "stdio.h" +#include <stdio.h> #include "dihedral.h" namespace LAMMPS_NS { diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 2a72958bc9f8ab2b7685f4446606ddbc7f7cc293..32cfc74cc84466f624a264e359dcd10636d4ec52 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "displace_atoms.h" #include "atom.h" #include "modify.h" @@ -44,7 +44,7 @@ DisplaceAtoms::DisplaceAtoms(LAMMPS *lmp) : Pointers(lmp) /* ---------------------------------------------------------------------- */ -DisplaceAtoms::~DisplaceAtoms() +DisplaceAtoms::~DisplaceAtoms() { memory->destroy(mvec); } @@ -190,7 +190,7 @@ void DisplaceAtoms::command(int narg, char **arg) delete random; } - + // rotate atoms by right-hand rule by theta around R // P = point = vector = point of rotation // R = vector = axis of rotation @@ -205,7 +205,7 @@ void DisplaceAtoms::command(int narg, char **arg) if (style == ROTATE) { double axis[3],point[3]; double a[3],b[3],c[3],d[3],disp[3],runit[3]; - + int dim = domain->dimension; point[0] = xscale*force->numeric(FLERR,arg[2]); point[1] = yscale*force->numeric(FLERR,arg[3]); diff --git a/src/domain.cpp b/src/domain.cpp index b19a7c5084f0b3151af51cdfe354b8cd28e5d37f..5bf75bc8cb19666c89f859bdd845998a60d9c8ce 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -15,11 +15,11 @@ Contributing author (triclinic) : Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" -#include "stdio.h" -#include "math.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <math.h> #include "domain.h" #include "style_region.h" #include "atom.h" @@ -176,7 +176,7 @@ void Domain::set_initial_box(int expandflag) // error check or warning on triclinic tilt factors if (triclinic) { - if ((fabs(xy/(boxhi[0]-boxlo[0])) > 0.5 && xperiodic) || + if ((fabs(xy/(boxhi[0]-boxlo[0])) > 0.5 && xperiodic) || (fabs(xz/(boxhi[0]-boxlo[0])) > 0.5 && xperiodic) || (fabs(yz/(boxhi[1]-boxlo[1])) > 0.5 && yperiodic)) { if (tiltsmall) @@ -300,7 +300,7 @@ void Domain::set_lamda_box() void Domain::set_local_box() { if (triclinic) return; - + if (comm->layout != LAYOUT_TILED) { int *myloc = comm->myloc; int *procgrid = comm->procgrid; @@ -461,7 +461,7 @@ void Domain::reset_box() // if shrink-wrapped & kspace is defined (i.e. using MSM), call setup() // also call init() (to test for compatibility) ? - + if (nonperiodic == 2 && force->kspace) { //force->kspace->init(); force->kspace->setup(); @@ -634,7 +634,7 @@ int Domain::inside_nonperiodic(double* x) double delta[3]; if (xperiodic && yperiodic && zperiodic) return 1; - + if (triclinic == 0) { lo = boxlo; hi = boxhi; @@ -719,7 +719,7 @@ void Domain::image_check() iatom = molatom[i]; n = onemols[imol]->num_bond[iatom]; } - + for (j = 0; j < n; j++) { if (molecular == 1) { if (bond_type[i][j] <= 0) continue; @@ -740,7 +740,7 @@ void Domain::image_check() delx = unwrap[i][0] - unwrap[k][0]; dely = unwrap[i][1] - unwrap[k][1]; delz = unwrap[i][2] - unwrap[k][2]; - + if (xperiodic && delx > xprd_half) flag = 1; if (xperiodic && dely > yprd_half) flag = 1; if (dimension == 3 && zperiodic && delz > zprd_half) flag = 1; @@ -752,13 +752,13 @@ void Domain::image_check() int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_MAX,world); - if (flagall && comm->me == 0) + if (flagall && comm->me == 0) error->warning(FLERR,"Inconsistent image flags"); if (lostbond == WARN) { int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all && comm->me == 0) + if (all && comm->me == 0) error->warning(FLERR,"Bond atom missing in image check"); } @@ -848,7 +848,7 @@ void Domain::box_too_small_check() if (lostbond == WARN) { int all; MPI_Allreduce(&nmissing,&all,1,MPI_INT,MPI_SUM,world); - if (all && comm->me == 0) + if (all && comm->me == 0) error->warning(FLERR,"Bond atom missing in box size check"); } @@ -903,7 +903,7 @@ void Domain::subbox_too_small_check(double thresh) int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall && comm->me == 0) + if (flagall && comm->me == 0) error->warning(FLERR,"Proc sub-domain size < neighbor skin, " "could lead to lost atoms"); } @@ -1461,8 +1461,8 @@ void Domain::image_flip(int m, int n, int p) ybox -= p*zbox; xbox -= m*ybox + n*zbox; - image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | - (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | + (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } } diff --git a/src/domain.h b/src/domain.h index 65681a51334800a09d4bbaa232c3ab8d16e2d9a2..8654b59168655849a1ed8a81209a5c006aa213bb 100644 --- a/src/domain.h +++ b/src/domain.h @@ -14,7 +14,7 @@ #ifndef LMP_DOMAIN_H #define LMP_DOMAIN_H -#include "math.h" +#include <math.h> #include "pointers.h" namespace LAMMPS_NS { @@ -138,10 +138,10 @@ class Domain : protected Pointers { // minimum image convention check // return 1 if any distance > 1/2 of box size - // indicates a special neighbor is actually not in a bond, + // indicates a special neighbor is actually not in a bond, // but is a far-away image that should be treated as an unbonded neighbor // inline since called from neighbor build inner loop - // + // inline int minimum_image_check(double dx, double dy, double dz) { if (xperiodic && fabs(dx) > xprd_half) return 1; if (yperiodic && fabs(dy) > yprd_half) return 1; diff --git a/src/dump.cpp b/src/dump.cpp index 73c805df5e52b2d1bfccfb093fbb40807f26e55d..622badb236b3f43e498681a3aecd64bc37f37ffa 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" -#include "stdio.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> #include "dump.h" #include "atom.h" #include "irregular.h" @@ -186,7 +186,7 @@ void Dump::init() } if (sort_flag) { - if (multiproc > 1) + if (multiproc > 1) error->all(FLERR, "Cannot dump sort when multiple dump files are written"); if (sortcol == 0 && atom->tag_enable == 0) @@ -339,7 +339,7 @@ void Dump::write() if (sort_flag && sortcol == 0) pack(ids); else pack(NULL); if (sort_flag) sort(); - + // if buffering, convert doubles into strings // insure sbuf is sized for communicating // cannot buffer if output is to binary file @@ -349,7 +349,7 @@ void Dump::write() int nsmin,nsmax; MPI_Allreduce(&nsme,&nsmin,1,MPI_INT,MPI_MIN,world); if (nsmin < 0) error->all(FLERR,"Too much buffered per-proc info for dump"); - if (multiproc != nprocs) + if (multiproc != nprocs) MPI_Allreduce(&nsme,&nsmax,1,MPI_INT,MPI_MAX,world); else nsmax = nsme; if (nsmax > maxsbuf) { @@ -378,11 +378,11 @@ void Dump::write() MPI_Get_count(&status,MPI_DOUBLE,&nlines); nlines /= size_one; } else nlines = nme; - + write_data(nlines,buf); } if (flush_flag && fp) fflush(fp); - + } else { MPI_Recv(&tmp,0,MPI_INT,fileproc,0,world,MPI_STATUS_IGNORE); MPI_Rsend(buf,nme*size_one,MPI_DOUBLE,fileproc,0,world); @@ -399,11 +399,11 @@ void Dump::write() MPI_Wait(&request,&status); MPI_Get_count(&status,MPI_CHAR,&nchars); } else nchars = nsme; - + write_data(nchars,(double *) sbuf); } if (flush_flag && fp) fflush(fp); - + } else { MPI_Recv(&tmp,0,MPI_INT,fileproc,0,world,MPI_STATUS_IGNORE); MPI_Rsend(sbuf,nsme,MPI_CHAR,fileproc,0,world); @@ -760,7 +760,7 @@ void Dump::modify_params(int narg, char **arg) "without % in dump file name"); int nper = force->inumeric(FLERR,arg[iarg+1]); if (nper <= 0) error->all(FLERR,"Illegal dump_modify command"); - + multiproc = nprocs/nper; if (nprocs % nper) multiproc++; fileproc = me/nper * nper; @@ -820,7 +820,7 @@ void Dump::modify_params(int narg, char **arg) fileproc = static_cast<int> ((bigint) icluster * nprocs/nfile); int fcluster = static_cast<int> ((bigint) fileproc * nfile/nprocs); if (fcluster < icluster) fileproc++; - int fileprocnext = + int fileprocnext = static_cast<int> ((bigint) (icluster+1) * nprocs/nfile); fcluster = static_cast<int> ((bigint) fileprocnext * nfile/nprocs); if (fcluster < icluster+1) fileprocnext++; diff --git a/src/dump.h b/src/dump.h index 3a035672cc4e758facb869e6db35bac42be11456..940dc828f4828c8dfce24534b144a1891d6d67a5 100644 --- a/src/dump.h +++ b/src/dump.h @@ -14,8 +14,8 @@ #ifndef LMP_DUMP_H #define LMP_DUMP_H -#include "mpi.h" -#include "stdio.h" +#include <mpi.h> +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index 068c4e3dff4fbe0931845859443eeb0faa181a15..8b90cf76d794dcc71adc6e2cdeab191d86ad5e19 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "dump_atom.h" #include "domain.h" #include "atom.h" @@ -422,9 +422,9 @@ int DumpAtom::convert_image(int n, double *mybuf) } offset += sprintf(&sbuf[offset],format, - static_cast<tagint> (mybuf[m]), + static_cast<tagint> (mybuf[m]), static_cast<int> (mybuf[m+1]), - mybuf[m+2],mybuf[m+3],mybuf[m+4], + mybuf[m+2],mybuf[m+3],mybuf[m+4], static_cast<int> (mybuf[m+5]), static_cast<int> (mybuf[m+6]), static_cast<int> (mybuf[m+7])); diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index b1acae791b60a10dd23a7d03781282c3748b2f7d..9005c3924a14499bd35d85c371d78a4c07cad306 100755 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -16,9 +16,9 @@ Memory efficiency improved by Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "dump_cfg.h" #include "atom.h" #include "domain.h" @@ -188,16 +188,16 @@ int DumpCFG::convert_string(int n, double *mybuf) } else if (j == 1) { offset += sprintf(&sbuf[offset],"%s \n",typenames[(int) mybuf[m]]); } else if (j >= 2) { - if (vtype[j] == INT) - offset += + if (vtype[j] == INT) + offset += sprintf(&sbuf[offset],vformat[j],static_cast<int> (mybuf[m])); - else if (vtype[j] == DOUBLE) + else if (vtype[j] == DOUBLE) offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); - else if (vtype[j] == STRING) - offset += + else if (vtype[j] == STRING) + offset += sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); - else if (vtype[j] == BIGINT) - offset += + else if (vtype[j] == BIGINT) + offset += sprintf(&sbuf[offset],vformat[j],static_cast<bigint> (mybuf[m])); } m++; @@ -223,16 +223,16 @@ int DumpCFG::convert_string(int n, double *mybuf) unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; offset += sprintf(&sbuf[offset],vformat[j],unwrap_coord); } else if (j >= 5 ) { - if (vtype[j] == INT) - offset += + if (vtype[j] == INT) + offset += sprintf(&sbuf[offset],vformat[j],static_cast<int> (mybuf[m])); - else if (vtype[j] == DOUBLE) + else if (vtype[j] == DOUBLE) offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); - else if (vtype[j] == STRING) - offset += + else if (vtype[j] == STRING) + offset += sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); - else if (vtype[j] == BIGINT) - offset += + else if (vtype[j] == BIGINT) + offset += sprintf(&sbuf[offset],vformat[j],static_cast<bigint> (mybuf[m])); } m++; @@ -273,13 +273,13 @@ void DumpCFG::write_lines(int n, double *mybuf) } else if (j == 1) { fprintf(fp,"%s \n",typenames[(int) mybuf[m]]); } else if (j >= 2) { - if (vtype[j] == INT) + if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (mybuf[m])); - else if (vtype[j] == DOUBLE) + else if (vtype[j] == DOUBLE) fprintf(fp,vformat[j],mybuf[m]); - else if (vtype[j] == STRING) + else if (vtype[j] == STRING) fprintf(fp,vformat[j],typenames[(int) mybuf[m]]); - else if (vtype[j] == BIGINT) + else if (vtype[j] == BIGINT) fprintf(fp,vformat[j],static_cast<bigint> (mybuf[m])); } m++; @@ -299,13 +299,13 @@ void DumpCFG::write_lines(int n, double *mybuf) unwrap_coord = (mybuf[m] - 0.5)/UNWRAPEXPAND + 0.5; fprintf(fp,vformat[j],unwrap_coord); } else if (j >= 5 ) { - if (vtype[j] == INT) + if (vtype[j] == INT) fprintf(fp,vformat[j],static_cast<int> (mybuf[m])); - else if (vtype[j] == DOUBLE) + else if (vtype[j] == DOUBLE) fprintf(fp,vformat[j],mybuf[m]); - else if (vtype[j] == STRING) + else if (vtype[j] == STRING) fprintf(fp,vformat[j],typenames[(int) mybuf[m]]); - else if (vtype[j] == BIGINT) + else if (vtype[j] == BIGINT) fprintf(fp,vformat[j],static_cast<bigint> (mybuf[m])); } m++; diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 725f7ec8a1d995e66b0e0862b140fea5fe97d80b..dbb1c3cd9e8b87c7e484a8704d7fc0049512a511 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "dump_custom.h" #include "atom.h" #include "force.h" @@ -104,7 +104,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : ioptional = parse_fields(narg,arg); - if (ioptional < narg && + if (ioptional < narg && strcmp(style,"image") != 0 && strcmp(style,"movie") != 0) error->all(FLERR,"Invalid attribute in dump custom command"); size_one = nfield = ioptional - 5; @@ -581,7 +581,7 @@ int DumpCustom::count() imageint *image = atom->image; double yprd = domain->yprd; for (i = 0; i < nlocal; i++) - dchoose[i] = x[i][1] + + dchoose[i] = x[i][1] + ((image[i] >> IMGBITS & IMGMASK) - IMGMAX) * yprd; ptr = dchoose; nstride = 1; @@ -637,7 +637,7 @@ int DumpCustom::count() double boxxlo = domain->boxlo[0]; double invxprd = 1.0/domain->xprd; for (i = 0; i < nlocal; i++) - dchoose[i] = (x[i][0] - boxxlo) * invxprd + + dchoose[i] = (x[i][0] - boxxlo) * invxprd + (image[i] & IMGMASK) - IMGMAX; ptr = dchoose; nstride = 1; @@ -649,7 +649,7 @@ int DumpCustom::count() double invyprd = 1.0/domain->yprd; for (i = 0; i < nlocal; i++) dchoose[i] = - (x[i][1] - boxylo) * invyprd + + (x[i][1] - boxylo) * invyprd + (image[i] >> IMGBITS & IMGMASK) - IMGMAX; ptr = dchoose; nstride = 1; @@ -660,7 +660,7 @@ int DumpCustom::count() double boxzlo = domain->boxlo[2]; double invzprd = 1.0/domain->zprd; for (i = 0; i < nlocal; i++) - dchoose[i] = (x[i][2] - boxzlo) * invzprd + + dchoose[i] = (x[i][2] - boxzlo) * invzprd + (image[i] >> IMG2BITS) - IMGMAX; ptr = dchoose; nstride = 1; @@ -949,13 +949,13 @@ int DumpCustom::convert_string(int n, double *mybuf) } for (j = 0; j < size_one; j++) { - if (vtype[j] == INT) + if (vtype[j] == INT) offset += sprintf(&sbuf[offset],vformat[j],static_cast<int> (mybuf[m])); - else if (vtype[j] == DOUBLE) + else if (vtype[j] == DOUBLE) offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); else if (vtype[j] == STRING) offset += sprintf(&sbuf[offset],vformat[j],typenames[(int) mybuf[m]]); - else if (vtype[j] == BIGINT) + else if (vtype[j] == BIGINT) offset += sprintf(&sbuf[offset],vformat[j], static_cast<bigint> (mybuf[m])); m++; @@ -1002,7 +1002,7 @@ void DumpCustom::write_lines(int n, double *mybuf) else if (vtype[j] == DOUBLE) fprintf(fp,vformat[j],mybuf[m]); else if (vtype[j] == STRING) fprintf(fp,vformat[j],typenames[(int) mybuf[m]]); - else if (vtype[j] == BIGINT) + else if (vtype[j] == BIGINT) fprintf(fp,vformat[j],static_cast<bigint> (mybuf[m])); m++; } @@ -1306,7 +1306,7 @@ int DumpCustom::parse_fields(int narg, char **arg) n = atom->find_custom(suffix,tmp); if (n < 0) error->all(FLERR,"Could not find custom per-atom property ID"); - + if (tmp != 1) error->all(FLERR,"Custom per-atom property ID is not floating point"); @@ -1328,7 +1328,7 @@ int DumpCustom::parse_fields(int narg, char **arg) n = atom->find_custom(suffix,tmp); if (n < 0) error->all(FLERR,"Could not find custom per-atom property ID"); - + if (tmp != 0) error->all(FLERR,"Custom per-atom property ID is not integer"); @@ -1438,7 +1438,7 @@ int DumpCustom::add_custom(char *id, int flag) memory->srealloc(id_custom,(ncustom+1)*sizeof(char *),"dump:id_custom"); flag_custom = (int *) memory->srealloc(flag_custom,(ncustom+1)*sizeof(int),"dump:flag_custom"); - + int n = strlen(id) + 1; id_custom[ncustom] = new char[n]; strcpy(id_custom[ncustom],id); @@ -1703,7 +1703,7 @@ int DumpCustom::modify_param(int narg, char **arg) int tmp = -1; n = atom->find_custom(suffix,tmp); - if ((n < 0) || (tmp != 1)) + if ((n < 0) || (tmp != 1)) error->all(FLERR,"Could not find dump modify " "custom atom floating point property ID"); @@ -1724,7 +1724,7 @@ int DumpCustom::modify_param(int narg, char **arg) int tmp = -1; n = atom->find_custom(suffix,tmp); - if ((n < 0) || (tmp != 0)) + if ((n < 0) || (tmp != 0)) error->all(FLERR,"Could not find dump modify " "custom atom integer property ID"); @@ -1830,7 +1830,7 @@ void DumpCustom::pack_variable(int n) void DumpCustom::pack_custom(int n) { - + int index = field2index[n]; if (flag_custom[index] == 0) { // integer diff --git a/src/dump_dcd.cpp b/src/dump_dcd.cpp index c679df62b9ecf77b712d2c53b03ae13fe868e4c9..7414d7cc2b6965bfb624f8f592ca178cfe6ca942 100644 --- a/src/dump_dcd.cpp +++ b/src/dump_dcd.cpp @@ -16,11 +16,11 @@ Axel Kohlmeyer (Temple U), support for groups ------------------------------------------------------------------------- */ -#include "math.h" -#include "inttypes.h" -#include "stdio.h" -#include "time.h" -#include "string.h" +#include <math.h> +#include <inttypes.h> +#include <stdio.h> +#include <time.h> +#include <string.h> #include "dump_dcd.h" #include "domain.h" #include "atom.h" diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 05074e609c1915c6cf7cfedc7aa1562a7c76eacf..3d36f1a797c16039b9c4c84a2b0499506d309b9e 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "ctype.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> #include "dump_image.h" #include "image.h" #include "atom.h" @@ -952,7 +952,7 @@ void DumpImage::create_image() /* ---------------------------------------------------------------------- */ -int DumpImage::pack_forward_comm(int n, int *list, double *buf, +int DumpImage::pack_forward_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { int i,j,m; diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 53094dd5e48f665aa3fd4a58b6f456bd52c8248e..eb08a912fc5349d95bfc32afdd4731b310c7e10d 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "dump_local.h" #include "atom.h" #include "modify.h" @@ -298,9 +298,9 @@ int DumpLocal::convert_string(int n, double *mybuf) } for (j = 0; j < size_one; j++) { - if (vtype[j] == INT) + if (vtype[j] == INT) offset += sprintf(&sbuf[offset],vformat[j],static_cast<int> (mybuf[m])); - else + else offset += sprintf(&sbuf[offset],vformat[j],mybuf[m]); m++; } diff --git a/src/dump_movie.cpp b/src/dump_movie.cpp index 6e08b5474eafa5df3b61bf8ef062a15727c6f9d7..cb8982cabe38c400198d5427eda89b9677bccda3 100644 --- a/src/dump_movie.cpp +++ b/src/dump_movie.cpp @@ -15,9 +15,9 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "dump_movie.h" #include "comm.h" #include "force.h" diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 273ec06e443ef43f97e527c76ec16e9996cf91f5..4153c8224c780a6f1852d75fd76d24aefead76cd 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "dump_xyz.h" #include "atom.h" #include "group.h" diff --git a/src/error.cpp b/src/error.cpp index 46f098328f2a1ef638fa3dd111bca984940473ef..6989e00034cc9b96af9aefe872484483d19c04f9 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" +#include <mpi.h> +#include <stdlib.h> #include "error.h" #include "universe.h" #include "output.h" diff --git a/src/finish.cpp b/src/finish.cpp index b2ca44945a2cfca81aa6b7fe969fe86977a183ea..d622dedb1acb3b739872d53ad38dde6767662844 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdio.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdio.h> #include "finish.h" #include "timer.h" #include "universe.h" @@ -105,7 +105,7 @@ void Finish::end(int flag) // loop stats if (timer->has_loop()) { - + // overall loop time time_loop = timer->get_wall(Timer::TOTAL); @@ -115,7 +115,7 @@ void Finish::end(int flag) MPI_Allreduce(&cpu_loop,&tmp,1,MPI_DOUBLE,MPI_SUM,world); cpu_loop = tmp/nprocs; if (time_loop > 0.0) cpu_loop = cpu_loop/time_loop*100.0; - + if (me == 0) { int ntasks = nprocs * nthreads; const char fmt1[] = "Loop time of %g on %d procs " @@ -147,7 +147,7 @@ void Finish::end(int flag) } else { double hrs_ns = t_step / update->dt * 1000000.0 * one_fs / 3600.0; double ns_day = 24.0*3600.0 / t_step * update->dt / one_fs/1000000.0; - const char perf[] = + const char perf[] = "Performance: %.3f ns/day, %.3f hours/ns, %.3f timesteps/s\n"; if (screen) fprintf(screen,perf,ns_day,hrs_ns,step_t); if (logfile) fprintf(logfile,perf,ns_day,hrs_ns,step_t); @@ -157,7 +157,7 @@ void Finish::end(int flag) // CPU use on MPI tasks and OpenMP threads #ifdef LMP_USER_OMP - const char fmt2[] = + const char fmt2[] = "%.1f%% CPU use with %d MPI tasks x %d OpenMP threads\n"; if (screen) fprintf(screen,fmt2,cpu_loop,nprocs,nthreads); if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs,nthreads); @@ -180,7 +180,7 @@ void Finish::end(int flag) if (timer->has_normal()) time_other = timer->get_wall(Timer::TOTAL) - timer->get_wall(Timer::ALL); - + // minimization stats if (minflag) { @@ -430,7 +430,7 @@ void Finish::end(int flag) if (atom->molecular) mpi_timings("Bond",timer,Timer::BOND,world,nprocs, nthreads,me,time_loop,screen,logfile); - + if (force->kspace) mpi_timings("Kspace",timer,Timer::KSPACE,world,nprocs, nthreads,me,time_loop,screen,logfile); @@ -464,7 +464,7 @@ void Finish::end(int flag) } #ifdef LMP_USER_OMP - const char thr_hdr_fmt[] = + const char thr_hdr_fmt[] = "\nThread timing breakdown (MPI rank %d):\nTotal threaded time %.4g / %.1f%%\n"; const char thr_header[] = "Section | min time | avg time | max time |%varavg| %total\n" @@ -540,7 +540,7 @@ void Finish::end(int flag) nsample *= 2; nfft = force->kspace->timing_1d(nsample,time1d); } - + time1d = nsteps * time1d / nsample; MPI_Allreduce(&time1d,&tmp,1,MPI_DOUBLE,MPI_SUM,world); time1d = tmp/nprocs; @@ -833,7 +833,7 @@ void mpi_timings(const char *label, Timer *t, enum Timer::ttype tt, { double tmp, time_max, time_min, time_sq; double time = t->get_wall(tt); - + double time_cpu = t->get_cpu(tt); if (time/time_loop < 0.001) // insufficient timer resolution! time_cpu = 1.0; diff --git a/src/fix.cpp b/src/fix.cpp index ac7e01439380d6e51f2b1bd8a3246ec1eda56245..ccb59964562cbf064f87709cc7a0e3d2e59e4dcf 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "ctype.h" +#include <string.h> +#include <ctype.h> #include "fix.h" #include "atom.h" #include "group.h" diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index d5ae80c07047c4ab800b6c2fad4e5bdcfd65bc60..1d6e89061360f753eb28f8548143ade5a6515c75 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_adapt.h" #include "atom.h" #include "update.h" @@ -118,8 +118,8 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) adapt[nadapt].aparam = DIAMETER; diamflag = 1; } else if (strcmp(arg[iarg+1],"charge") == 0) { - adapt[nadapt].aparam = CHARGE; - chgflag = 1; + adapt[nadapt].aparam = CHARGE; + chgflag = 1; } else error->all(FLERR,"Illegal fix adapt command"); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; @@ -275,9 +275,9 @@ void FixAdapt::init() if (group->dynamic[igroup]) for (int i = 0; i < nadapt; i++) - if (adapt[i].which == ATOM) + if (adapt[i].which == ATOM) error->all(FLERR,"Cannot use dynamic group with fix adapt atom"); - + // setup and error checks anypair = 0; @@ -322,7 +322,7 @@ void FixAdapt::init() if (pair == NULL) pair = force->pair_match(pstyle,1,nsub); if (pair == NULL) error->all(FLERR,"Fix adapt pair style does not exist"); void *ptr = pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) + if (ptr == NULL) error->all(FLERR,"Fix adapt pair style param not supported"); ad->pdim = 2; @@ -372,7 +372,7 @@ void FixAdapt::init() } // fixes that store initial per-atom values - + if (id_fix_diam) { int ifix = modify->find_fix(id_fix_diam); if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID"); @@ -498,13 +498,13 @@ void FixAdapt::change_settings() } } } else if (ad->aparam == CHARGE) { - double *q = atom->q; + double *q = atom->q; int *mask = atom->mask; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; for (i = 0; i < nall; i++) - if (mask[i] & groupbit) q[i] = value; + if (mask[i] & groupbit) q[i] = value; } } } diff --git a/src/fix_adapt.h b/src/fix_adapt.h index bb465daad7714416ba1d8d1afae476e97cba1629..7ae659df453d2ff55598c4ab0fe5f5a631ca90b4 100644 --- a/src/fix_adapt.h +++ b/src/fix_adapt.h @@ -27,7 +27,7 @@ namespace LAMMPS_NS { class FixAdapt : public Fix { public: int diamflag; // 1 if atom diameters will vary, for AtomVecGranular - int chgflag; + int chgflag; FixAdapt(class LAMMPS *, int, char **); ~FixAdapt(); diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 0f658732653b4aeb382112f0f0c7eebb5101c58e..0ffa7751cd4f14d3fe8dbe4bcef496b7f71a3b9c 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_addforce.h" #include "atom.h" #include "atom_masks.h" diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index 68e370d60b7295f7b9d97ac56c8ca2033dd072e8..b43c505b51eb61dffcbf77bb9b8be4defcc6e95a 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_ave_atom.h" #include "atom.h" #include "domain.h" @@ -283,7 +283,7 @@ void FixAveAtom::end_of_step() // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; - if (ntimestep < nvalid_last || ntimestep > nvalid) + if (ntimestep < nvalid_last || ntimestep > nvalid) error->all(FLERR,"Invalid timestep reset for fix ave/atom"); if (ntimestep != nvalid) return; nvalid_last = nvalid; diff --git a/src/fix_ave_atom.h b/src/fix_ave_atom.h index c8a0b8e139414c8e0b84c0f671d449e1499ec737..c2f5067309559903ede2270a424531224a23329e 100644 --- a/src/fix_ave_atom.h +++ b/src/fix_ave_atom.h @@ -20,7 +20,7 @@ FixStyle(ave/atom,FixAveAtom) #ifndef LMP_FIX_AVE_ATOM_H #define LMP_FIX_AVE_ATOM_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 07e858e5929f8e91fa2b3c6b4afe2119deb298c3..b210fc40b4492c69351c18597474dd196d10a877 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "unistd.h" +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "fix_ave_chunk.h" #include "atom.h" #include "update.h" @@ -310,7 +310,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : // increment lock counter in compute chunk/atom // only if nrepeat > 1 or ave = RUNNING/WINDOW, - // so that locking spans multiple timesteps + // so that locking spans multiple timesteps int icompute = modify->find_compute(idchunk); if (icompute < 0) @@ -339,13 +339,13 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : if (ncoord == 0) fprintf(fp,"# Chunk Ncount"); else if (ncoord == 1) fprintf(fp,"# Chunk Coord1 Ncount"); else if (ncoord == 2) fprintf(fp,"# Chunk Coord1 Coord2 Ncount"); - else if (ncoord == 3) + else if (ncoord == 3) fprintf(fp,"# Chunk Coord1 Coord2 Coord3 Ncount"); } else { if (ncoord == 0) fprintf(fp,"# Chunk OrigID Ncount"); else if (ncoord == 1) fprintf(fp,"# Chunk OrigID Coord1 Ncount"); else if (ncoord == 2) fprintf(fp,"# Chunk OrigID Coord1 Coord2 Ncount"); - else if (ncoord == 3) + else if (ncoord == 3) fprintf(fp,"# Chunk OrigID Coord1 Coord2 Coord3 Ncount"); } for (int i = 0; i < nvalues; i++) fprintf(fp," %s",arg[7+i]); @@ -526,7 +526,7 @@ void FixAveChunk::end_of_step() // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; - if (ntimestep < nvalid_last || ntimestep > nvalid) + if (ntimestep < nvalid_last || ntimestep > nvalid) error->all(FLERR,"Invalid timestep reset for fix ave/chunk"); if (ntimestep != nvalid) return; nvalid_last = nvalid; @@ -541,8 +541,8 @@ void FixAveChunk::end_of_step() // if ave = RUNNING/WINDOW and not yet locked: // set forever, will be unlocked in fix destructor // wrap setup_chunks in clearstep/addstep b/c it may invoke computes - // both nevery and nfreq are future steps, - // since call below to cchunk->ichunk() + // both nevery and nfreq are future steps, + // since call below to cchunk->ichunk() // does not re-invoke internal cchunk compute on this same step if (irepeat == 0) { @@ -666,15 +666,15 @@ void FixAveChunk::end_of_step() for (i = 0; i < nlocal; i++) if (mask[i] & groupbit && ichunk[i] > 0) { index = ichunk[i]-1; - values_one[index][m] += + values_one[index][m] += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * rmass[i]; } } else { for (i = 0; i < nlocal; i++) if (mask[i] & groupbit && ichunk[i] > 0) { index = ichunk[i]-1; - values_one[index][m] += - (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * + values_one[index][m] += + (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * mass[type[i]]; } } @@ -760,7 +760,7 @@ void FixAveChunk::end_of_step() if (count_many[m] > 0.0) for (j = 0; j < nvalues; j++) { if (which[j] == TEMPERATURE) - values_many[m][j] += mvv2e*values_one[m][j] / + values_many[m][j] += mvv2e*values_one[m][j] / ((cdof + adof*count_many[m]) * boltz); else if (which[j] == DENSITY_NUMBER || which[j] == DENSITY_MASS || scaleflag == NOSCALE) diff --git a/src/fix_ave_chunk.h b/src/fix_ave_chunk.h index a7aa9c2c9c29d90be42e41764747776087891665..1a6771fc67b7f328289399debd8cd887f3bbd180 100644 --- a/src/fix_ave_chunk.h +++ b/src/fix_ave_chunk.h @@ -20,7 +20,7 @@ FixStyle(ave/chunk,FixAveChunk) #ifndef LMP_FIX_AVE_CHUNK_H #define LMP_FIX_AVE_CHUNK_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index a3e20cb2dbef73e8f812e83618ae7749daf9ba90..336723943cc6a6384f95e617f663edde29c7e3a7 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -17,9 +17,9 @@ Reese Jones (Sandia) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "unistd.h" +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "fix_ave_correlate.h" #include "update.h" #include "modify.h" @@ -398,7 +398,7 @@ void FixAveCorrelate::end_of_step() // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; - if (ntimestep < nvalid_last || ntimestep > nvalid) + if (ntimestep < nvalid_last || ntimestep > nvalid) error->all(FLERR,"Invalid timestep reset for fix ave/correlate"); if (ntimestep != nvalid) return; nvalid_last = nvalid; diff --git a/src/fix_ave_correlate.h b/src/fix_ave_correlate.h index cf0bad68b7165b7f3585bdcc5b6c9dcfd6a56a88..7647492ba371e2e2c88d6b46e39b533d5498c7bf 100644 --- a/src/fix_ave_correlate.h +++ b/src/fix_ave_correlate.h @@ -20,7 +20,7 @@ FixStyle(ave/correlate,FixAveCorrelate) #ifndef LMP_FIX_AVE_CORRELATE_H #define LMP_FIX_AVE_CORRELATE_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 921d6aacf80fdc7c24fdbb84e0b0cd16e214d840..db0eb205f4b52e160fbee89780a786c4688932fb 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "unistd.h" +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "fix_ave_histo.h" #include "atom.h" #include "update.h" @@ -597,7 +597,7 @@ void FixAveHisto::end_of_step() // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; - if (ntimestep < nvalid_last || ntimestep > nvalid) + if (ntimestep < nvalid_last || ntimestep > nvalid) error->all(FLERR,"Invalid timestep reset for fix ave/histo"); if (ntimestep != nvalid) return; nvalid_last = nvalid; diff --git a/src/fix_ave_histo.h b/src/fix_ave_histo.h index 89a214efa6ff89429d3396b7287a36789e48f20c..dc095cd42d8b564c5877c1fbe92e489d350bc4c0 100644 --- a/src/fix_ave_histo.h +++ b/src/fix_ave_histo.h @@ -20,7 +20,7 @@ FixStyle(ave/histo,FixAveHisto) #ifndef LMP_FIX_AVE_HISTO_H #define LMP_FIX_AVE_HISTO_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 55a55fd5f9376c9afd0dce031d0b761e09d22d72..47901a516404dca2afb541d50928fb9a2f4ba385 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -15,9 +15,9 @@ Contributing author: Shawn Coleman (ARL) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "unistd.h" +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "fix_ave_histo_weight.h" #include "atom.h" #include "update.h" @@ -61,7 +61,7 @@ FixAveHistoWeight::FixAveHistoWeight(LAMMPS *lmp, int narg, char **arg) : int size[2]; - for (int i = 0; i < nvalues; i++) { + for (int i = 0; i < nvalues; i++) { if (which[i] == X || which[i] == V || which[i] == F) { size[i] = atom->nlocal; } else if (which[i] == COMPUTE && kind == GLOBAL && mode == SCALAR) { @@ -73,13 +73,13 @@ FixAveHistoWeight::FixAveHistoWeight(LAMMPS *lmp, int narg, char **arg) : } else if (which[i] == COMPUTE && kind == PERATOM) { size[i] = atom->nlocal; } else if (which[i] == COMPUTE && kind == LOCAL) { - int icompute = modify->find_compute(ids[i]); + int icompute = modify->find_compute(ids[i]); size[i] = modify->compute[icompute]->size_local_rows; } else if (which[i] == FIX && kind == GLOBAL && mode == SCALAR) { - int ifix = modify->find_fix(ids[i]); + int ifix = modify->find_fix(ids[i]); size[i] = modify->fix[ifix]->size_vector; } else if (which[i] == FIX && kind == GLOBAL && mode == VECTOR) { - int ifix = modify->find_fix(ids[i]); + int ifix = modify->find_fix(ids[i]); size[i]= modify->fix[ifix]->size_array_rows; } else if (which[i] == FIX && kind == PERATOM) { size[i] = atom->nlocal; @@ -89,9 +89,9 @@ FixAveHistoWeight::FixAveHistoWeight(LAMMPS *lmp, int narg, char **arg) : } else if (which[i] == VARIABLE && kind == PERATOM) { size[i] = atom->nlocal; } - } - - if (size[0] != size[1]) + } + + if (size[0] != size[1]) error->all(FLERR,"Fix ave/histo/weight value and weight vector " "lengths do not match"); } @@ -106,7 +106,7 @@ void FixAveHistoWeight::end_of_step() // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; - if (ntimestep < nvalid_last || ntimestep > nvalid) + if (ntimestep < nvalid_last || ntimestep > nvalid) error->all(FLERR,"Invalid timestep reset for fix ave/histo"); if (ntimestep != nvalid) return; nvalid_last = nvalid; @@ -127,7 +127,7 @@ void FixAveHistoWeight::end_of_step() modify->clearstep_compute(); // calcualte weight factors which are 2nd value (i = 1) - + double weight = 0.0; double *weights = NULL; int stride = 0; @@ -137,7 +137,7 @@ void FixAveHistoWeight::end_of_step() j = argindex[i]; // atom attributes - + if (which[i] == X) { weights = &atom->x[0][j]; stride = 3; @@ -151,7 +151,7 @@ void FixAveHistoWeight::end_of_step() } // invoke compute if not previously invoked - + if (which[i] == COMPUTE) { Compute *compute = modify->compute[m]; if (kind == GLOBAL && mode == SCALAR) { @@ -194,7 +194,7 @@ void FixAveHistoWeight::end_of_step() stride = 1; } else if (compute->array_atom) { weights = &compute->array_atom[0][j-1]; - stride = compute->size_peratom_cols; + stride = compute->size_peratom_cols; } } else if (kind == LOCAL) { if (!(compute->invoked_flag & INVOKED_LOCAL)) { @@ -213,17 +213,17 @@ void FixAveHistoWeight::end_of_step() // access fix fields, guaranteed to be ready } else if (which[i] == FIX) { - + Fix *fix = modify->fix[m]; - + if (kind == GLOBAL && mode == SCALAR) { if (j == 0) weight = fix->compute_scalar(); else weight = fix->compute_vector(j-1); - + } else if (kind == GLOBAL && mode == VECTOR) { - + error->all(FLERR,"Illegal fix ave/spatial command"); - + if (j == 0) { int n = fix->size_vector; for (i = 0; i < n; i++) weights[n] = fix->compute_vector(i); @@ -231,7 +231,7 @@ void FixAveHistoWeight::end_of_step() int n = fix->size_vector; for (i = 0; i < n; i++) weights[n] = fix->compute_array(i,j-1); } - + } else if (kind == PERATOM) { if (j == 0) { weights = fix->vector_atom; @@ -247,14 +247,14 @@ void FixAveHistoWeight::end_of_step() } else if (fix->array_local) { weights = &fix->array_local[0][j-1]; stride = fix->size_local_cols; - } + } } // evaluate equal-style variable - + } else if (which[i] == VARIABLE && kind == GLOBAL) { weight = input->variable->compute_equal(m); - + } else if (which[i] == VARIABLE && kind == PERATOM) { if (atom->nlocal > maxatom) { memory->destroy(vector); @@ -265,10 +265,10 @@ void FixAveHistoWeight::end_of_step() weights = vector; stride = 1; } - + // bin values using weights, values are 1st value (i = 0) - - i = 0; + + i = 0; m = value2index[i]; j = argindex[i]; @@ -280,9 +280,9 @@ void FixAveHistoWeight::end_of_step() bin_atoms_weights(&atom->v[0][j],3,weights,stride); else if (which[i] == F && weights != NULL) bin_atoms_weights(&atom->f[0][j],3,weights,stride); - + // invoke compute if not previously invoked - + if (which[i] == COMPUTE) { Compute *compute = modify->compute[m]; if (kind == GLOBAL && mode == SCALAR) { @@ -316,18 +316,18 @@ void FixAveHistoWeight::end_of_step() bin_vector_weights(compute->size_array_rows,&compute->array[0][j-1], compute->size_array_cols,weights,stride); } - + } else if (kind == PERATOM) { if (!(compute->invoked_flag & INVOKED_PERATOM)) { compute->compute_peratom(); compute->invoked_flag |= INVOKED_PERATOM; } - if (j == 0) + if (j == 0) bin_atoms_weights(compute->vector_atom,1,weights, stride); else if (compute->array_atom) bin_atoms_weights(&compute->array_atom[0][j-1], compute->size_peratom_cols,weights,stride); - + } else if (kind == LOCAL) { if (!(compute->invoked_flag & INVOKED_LOCAL)) { compute->compute_local(); @@ -341,36 +341,36 @@ void FixAveHistoWeight::end_of_step() &compute->array_local[0][j-1], compute->size_local_cols,weights,stride); } - + // access fix fields, guaranteed to be ready - + } else if (which[i] == FIX) { - + Fix *fix = modify->fix[m]; - + if (kind == GLOBAL && mode == SCALAR) { if (j == 0) bin_one_weights(fix->compute_scalar(),weight); else bin_one_weights(fix->compute_vector(j-1),weight); - + } else if (kind == GLOBAL && mode == VECTOR) { if (j == 0) { int n = fix->size_vector; - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) bin_one_weights(fix->compute_vector(i),weights[i*stride]); } else { int n = fix->size_vector; - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) bin_one_weights(fix->compute_array(i,j-1),weights[i*stride]); } - + } else if (kind == PERATOM) { - if (j == 0) + if (j == 0) bin_atoms_weights(fix->vector_atom,1,weights,stride); else if (fix->array_atom) bin_atoms_weights(fix->array_atom[j-1],fix->size_peratom_cols, weights,stride); - - + + } else if (kind == LOCAL) { if (j == 0) bin_vector_weights(fix->size_local_rows,fix->vector_local,1, weights,stride); @@ -378,12 +378,12 @@ void FixAveHistoWeight::end_of_step() bin_vector_weights(fix->size_local_rows,&fix->array_local[0][j-1], fix->size_local_cols,weights,stride); } - + // evaluate equal-style variable - + } else if (which[i] == VARIABLE && kind == GLOBAL) { bin_one_weights(input->variable->compute_equal(m),weight); - + } else if (which[i] == VARIABLE && kind == PERATOM) { if (atom->nlocal > maxatom) { memory->destroy(vector); @@ -392,7 +392,7 @@ void FixAveHistoWeight::end_of_step() } input->variable->compute_atom(m,igroup,vector,1,0); bin_atoms_weights(vector,1,weights,stride); - } + } // code beyond this point is identical to FixAveHisto @@ -536,8 +536,8 @@ void FixAveHistoWeight::bin_one_weights(double value, double weight) values and weights each have a stride ------------------------------------------------------------------------- */ -void FixAveHistoWeight::bin_vector_weights(int n, double *values, - int stride, double *weights, +void FixAveHistoWeight::bin_vector_weights(int n, double *values, + int stride, double *weights, int stridewt) { int m = 0; diff --git a/src/fix_ave_histo_weight.h b/src/fix_ave_histo_weight.h index 99db7333d801f6151bb745e47c5c1e94571495f3..e29f199710abfad9badfe44a8c02ce764b5717d6 100644 --- a/src/fix_ave_histo_weight.h +++ b/src/fix_ave_histo_weight.h @@ -20,7 +20,7 @@ FixStyle(ave/histo/weight,FixAveHistoWeight) #ifndef LMP_FIX_AVE_HISTO_WEIGHT_H #define LMP_FIX_AVE_HISTO_WEIGHT_H -#include "stdio.h" +#include <stdio.h> #include "fix_ave_histo.h" namespace LAMMPS_NS { @@ -34,7 +34,7 @@ class FixAveHistoWeight : public FixAveHisto { private: void bin_one_weights(double, double); void bin_vector_weights(int, double *, int, double *, int); - void bin_atoms_weights(double *, int, double *, int); + void bin_atoms_weights(double *, int, double *, int); }; } diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp index 62b7f057afc51752e49f50763f29d77dfe8eae7d..866b76f878bac9fc75fd9ea97ecf1c02e4ee1997 100644 --- a/src/fix_ave_spatial.cpp +++ b/src/fix_ave_spatial.cpp @@ -15,9 +15,9 @@ Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "unistd.h" +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "fix_ave_spatial.h" #include "atom.h" #include "update.h" @@ -83,7 +83,7 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"center") == 0) originflag[ndim] = CENTER; else if (strcmp(arg[iarg+1],"upper") == 0) originflag[ndim] = UPPER; else originflag[ndim] = COORD; - if (originflag[ndim] == COORD) + if (originflag[ndim] == COORD) origin[ndim] = force->numeric(FLERR,arg[iarg+1]); delta[ndim] = force->numeric(FLERR,arg[iarg+2]); @@ -208,11 +208,11 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal fix ave/spatial command"); if (strcmp(arg[iarg+2],"lower") == 0) minflag[idim] = LOWER; else minflag[idim] = COORD; - if (minflag[idim] == COORD) + if (minflag[idim] == COORD) minvalue[idim] = force->numeric(FLERR,arg[iarg+2]); if (strcmp(arg[iarg+3],"upper") == 0) maxflag[idim] = UPPER; else maxflag[idim] = COORD; - if (maxflag[idim] == COORD) + if (maxflag[idim] == COORD) maxvalue[idim] = force->numeric(FLERR,arg[iarg+3]); else error->all(FLERR,"Illegal fix ave/spatial command"); iarg += 4; @@ -552,7 +552,7 @@ void FixAveSpatial::end_of_step() // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; - if (ntimestep < nvalid_last || ntimestep > nvalid) + if (ntimestep < nvalid_last || ntimestep > nvalid) error->all(FLERR,"Invalid timestep reset for fix ave/spatial"); if (ntimestep != nvalid) return; nvalid_last = nvalid; @@ -619,7 +619,7 @@ void FixAveSpatial::end_of_step() values_one[bin[i]][m] += attribute[i][j]; } else { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && + if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && bin[i] >= 0) values_one[bin[i]][m] += attribute[i][j]; } @@ -634,7 +634,7 @@ void FixAveSpatial::end_of_step() values_one[bin[i]][m] += 1.0; } else { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && + if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && bin[i] >= 0) values_one[bin[i]][m] += 1.0; } @@ -654,7 +654,7 @@ void FixAveSpatial::end_of_step() } } else { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && + if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && bin[i] >= 0) { if (rmass) values_one[bin[i]][m] += rmass[i]; else values_one[bin[i]][m] += mass[type[i]]; @@ -682,7 +682,7 @@ void FixAveSpatial::end_of_step() } } else { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && + if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && bin[i] >= 0) { if (j == 0) values_one[bin[i]][m] += vector[i]; else values_one[bin[i]][m] += array[i][jm1]; @@ -705,7 +705,7 @@ void FixAveSpatial::end_of_step() } } else { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && + if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && bin[i] >= 0) { if (j == 0) values_one[bin[i]][m] += vector[i]; else values_one[bin[i]][m] += array[i][jm1]; @@ -730,7 +730,7 @@ void FixAveSpatial::end_of_step() values_one[bin[i]][m] += varatom[i]; } else { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && + if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2]) && bin[i] >= 0) values_one[bin[i]][m] += varatom[i]; } diff --git a/src/fix_ave_spatial.h b/src/fix_ave_spatial.h index 7d6a9f031aee76e36ba8c809c6a3f39014f92ee2..1df4c363b21abc2257761e9066785189dfd40d84 100644 --- a/src/fix_ave_spatial.h +++ b/src/fix_ave_spatial.h @@ -20,7 +20,7 @@ FixStyle(ave/spatial,FixAveSpatial) #ifndef LMP_FIX_AVE_SPATIAL_H #define LMP_FIX_AVE_SPATIAL_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index d502f6a9637759b403ae3d6881ff77565301ad67..2db0fbec64896702a16a6b40d53b80f37c98475f 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -15,9 +15,9 @@ Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "unistd.h" +#include <stdlib.h> +#include <string.h> +#include <unistd.h> #include "fix_ave_time.h" #include "update.h" #include "force.h" @@ -192,7 +192,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : modify->compute[icompute]->size_vector_variable == 0) error->all(FLERR, "Fix ave/time compute vector is accessed out-of-range"); - if (argindex[i] && modify->compute[icompute]->size_vector_variable) + if (argindex[i] && modify->compute[icompute]->size_vector_variable) varlen[i] = 1; } else if (which[i] == COMPUTE && mode == VECTOR) { @@ -235,7 +235,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix ave/time fix does not calculate a vector"); if (argindex[i] && modify->fix[ifix]->array_flag == 0) error->all(FLERR,"Fix ave/time fix does not calculate an array"); - if (argindex[i] && modify->fix[ifix]->size_array_rows_variable) + if (argindex[i] && modify->fix[ifix]->size_array_rows_variable) error->all(FLERR,"Fix ave/time fix array cannot be variable length"); if (argindex[i] && argindex[i] > modify->fix[ifix]->size_array_cols) error->all(FLERR,"Fix ave/time fix array is accessed out-of-range"); @@ -274,12 +274,12 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : else nrows = 1; memory->create(column,nrows,"ave/time:column"); } - + // enable locking of row count by this fix for computes of variable length // only if nrepeat > 1 or ave = RUNNING/WINDOW, - // so that locking spans multiple timesteps + // so that locking spans multiple timesteps - if (any_variable_length && + if (any_variable_length && (nrepeat > 1 || ave == RUNNING || ave == WINDOW)) { for (int i = 0; i < nvalues; i++) if (varlen[i]) { @@ -288,7 +288,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : } lockforever = 0; } - + // print file comment lines // for mode = VECTOR, cannot use arg to print // since array args may have been expanded to multiple vectors @@ -461,13 +461,13 @@ FixAveTime::~FixAveTime() { // decrement lock counter in compute chunk/atom, it if still exists - if (any_variable_length && + if (any_variable_length && (nrepeat > 1 || ave == RUNNING || ave == WINDOW)) { for (int i = 0; i < nvalues; i++) if (varlen[i]) { int icompute = modify->find_compute(ids[i]); if (icompute >= 0) { - if (ave == RUNNING || ave == WINDOW) + if (ave == RUNNING || ave == WINDOW) modify->compute[icompute]->unlock(this); modify->compute[icompute]->lock_disable(); } @@ -559,7 +559,7 @@ void FixAveTime::end_of_step() // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; - if (ntimestep < nvalid_last || ntimestep > nvalid) + if (ntimestep < nvalid_last || ntimestep > nvalid) error->all(FLERR,"Invalid timestep reset for fix ave/time"); if (ntimestep != nvalid) return; nvalid_last = nvalid; @@ -729,8 +729,8 @@ void FixAveTime::invoke_vector(bigint ntimestep) // if ave = RUNNING/WINDOW and not yet locked: // set forever, will be unlocked in fix destructor // wrap setup_chunks in clearstep/addstep b/c it may invoke computes - // both nevery and nfreq are future steps, - // since call below to cchunk->ichunk() + // both nevery and nfreq are future steps, + // since call below to cchunk->ichunk() // does not re-invoke internal cchunk compute on this same step if (irepeat == 0) { @@ -786,7 +786,7 @@ void FixAveTime::invoke_vector(bigint ntimestep) compute->invoked_flag |= INVOKED_VECTOR; } double *cvector = compute->vector; - for (i = 0; i < nrows; i++) + for (i = 0; i < nrows; i++) column[i] = cvector[i]; } else { @@ -928,7 +928,7 @@ int FixAveTime::column_length(int dynamic) if (varlen[i]) continue; if (which[i] == COMPUTE) { int icompute = modify->find_compute(ids[i]); - if (argindex[i] == 0) + if (argindex[i] == 0) lengthone = modify->compute[icompute]->size_vector; else lengthone = modify->compute[icompute]->size_array_rows; } else if (which[i] == FIX) { @@ -960,7 +960,7 @@ int FixAveTime::column_length(int dynamic) else if (lengthone != length) error->all(FLERR,"Fix ave/time columns are inconsistent lengths"); } else { - if (lengthone != nrows) + if (lengthone != nrows) error->all(FLERR,"Fix ave/time columns are inconsistent lengths"); } } diff --git a/src/fix_ave_time.h b/src/fix_ave_time.h index 98e9ad5e4756b6e4551f1e41d4b42306fb77e47d..8671e28219c7e3dd4028614b762cd0c463ea858c 100644 --- a/src/fix_ave_time.h +++ b/src/fix_ave_time.h @@ -20,7 +20,7 @@ FixStyle(ave/time,FixAveTime) #ifndef LMP_FIX_AVE_TIME_H #define LMP_FIX_AVE_TIME_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_aveforce.cpp b/src/fix_aveforce.cpp index 9b9380130e6f28a985f473e4ea345dc771ed2dd6..443ae6ea57110d47a7425d703ce2670524d37813 100644 --- a/src/fix_aveforce.cpp +++ b/src/fix_aveforce.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "fix_aveforce.h" #include "atom.h" #include "update.h" diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index 5eb4fde54bd8d1a24e383cf44c9f697781cd9ef3..b27fc136323544473a1b2398745f3b865a46391c 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_balance.h" #include "balance.h" #include "update.h" @@ -103,7 +103,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : } } - if (lbstyle == BISECTION && comm->style == 0) + if (lbstyle == BISECTION && comm->style == 0) error->all(FLERR,"Fix balance rcb cannot be used with comm_style brick"); // create instance of Balance class diff --git a/src/fix_balance.h b/src/fix_balance.h index 9ea1fe45baeca195c553edb31145604584a454a1..3b4299a39e20c96f6e4db52f72106ba4976d8752 100644 --- a/src/fix_balance.h +++ b/src/fix_balance.h @@ -20,7 +20,7 @@ FixStyle(balance,FixBalance) #ifndef LMP_FIX_BALANCE_H #define LMP_FIX_BALANCE_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index 0842ea01dedaef6371ebf22623663145c8813c4b..8dd0b3344d421dcb0099a334aac14b833151f62c 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -15,9 +15,9 @@ Contributing author: Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_box_relax.h" #include "atom.h" #include "domain.h" diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 3d350c569a374ff29dc19aae6bee39d0bd385c31..7003b4d3961fe85127256f767340ff703b4afe30 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -15,9 +15,9 @@ Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_deform.h" #include "atom.h" #include "update.h" diff --git a/src/fix_drag.cpp b/src/fix_drag.cpp index 1771be42c8b94193122ef1d3c12e5253260e2125..6a28e89806955e7d16df3da567eb8c223e7dbe04 100644 --- a/src/fix_drag.cpp +++ b/src/fix_drag.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_drag.h" #include "atom.h" #include "update.h" diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp index 5e0338ed0e6eee0bc3aff3b585c3da9ce2179da2..0a8ecd762657356140d2383c8b31c2a5a3e7fe7d 100644 --- a/src/fix_dt_reset.cpp +++ b/src/fix_dt_reset.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_dt_reset.h" #include "atom.h" #include "update.h" diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index ed169d36e57f2d1e7c3df98ffe980f0605ecb32a..66c9c4c292dcdc37d3089b7b8fe644514819b8dc 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_enforce2d.h" #include "atom.h" #include "update.h" diff --git a/src/fix_external.cpp b/src/fix_external.cpp index a09dd62ffdb4e069bd46569d212a33d45aca0230..16494662f7f42142fe5e75e94550579b8f7a8e4c 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" -#include "stdlib.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> #include "fix_external.h" #include "atom.h" #include "update.h" @@ -42,7 +42,7 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : mode = PF_CALLBACK; ncall = force->inumeric(FLERR,arg[4]); napply = force->inumeric(FLERR,arg[5]); - if (ncall <= 0 || napply <= 0) + if (ncall <= 0 || napply <= 0) error->all(FLERR,"Illegal fix external command"); } else if (strcmp(arg[3],"pf/array") == 0) { if (narg != 5) error->all(FLERR,"Illegal fix external command"); diff --git a/src/fix_gravity.cpp b/src/fix_gravity.cpp index 2e9d6e40f4fd19d5eeb68d44b3ce6d395b5340b4..a08213e3d027dc7c7d0905195239d2f618090297 100644 --- a/src/fix_gravity.cpp +++ b/src/fix_gravity.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_gravity.h" #include "atom.h" #include "update.h" diff --git a/src/fix_group.cpp b/src/fix_group.cpp index 690d42c150fa93d1094b484c5ddc6db404f5b8c0..ac4a84d63fc26b628ed6800c82cc4ffc4e3a2b39 100644 --- a/src/fix_group.cpp +++ b/src/fix_group.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_group.h" #include "group.h" #include "update.h" @@ -50,7 +50,7 @@ FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) varflag = 0; idvar = NULL; nevery = 1; - + int iarg = 3; while (iarg < narg) { if (strcmp(arg[iarg],"region") == 0) { @@ -145,7 +145,7 @@ void FixGroup::init() } } - if (warn && comm->me == 0) + if (warn && comm->me == 0) error->warning(FLERR,"One or more dynamic groups may not be " "updated at correct point in timestep"); } @@ -184,7 +184,7 @@ void FixGroup::set_group() input->variable->compute_atom(ivar,igroup,var,1,0); modify->addstep_compute(update->ntimestep + nevery); } - + // update region in case it has a variable dependence or is dynamic if (regionflag) region->prematch(); diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index de23927fe95cd3d8c8a4d3a367d0b97f47513a98..65dc960f424d7faf9f4d41683e80391ea45c753f 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -15,9 +15,9 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_heat.h" #include "atom.h" #include "domain.h" @@ -121,7 +121,7 @@ void FixHeat::init() if (hstr) { hvar = input->variable->find(hstr); - if (hvar < 0) + if (hvar < 0) error->all(FLERR,"Variable name for fix heat does not exist"); if (input->variable->equalstyle(hvar)) hstyle = EQUAL; else if (input->variable->atomstyle(hvar)) hstyle = ATOM; @@ -196,7 +196,7 @@ void FixHeat::end_of_step() if (hstyle != ATOM) { heat = heat_input*nevery*update->dt*force->ftm2v; - double escale = + double escale = (ke + heat - 0.5*vcmsq*masstotal)/(ke - 0.5*vcmsq*masstotal); if (escale < 0.0) error->all(FLERR,"Fix heat kinetic energy went negative"); scale = sqrt(escale); @@ -231,9 +231,9 @@ void FixHeat::end_of_step() for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { heat = vheat[i]*nevery*update->dt*force->ftm2v; - vscale[i] = + vscale[i] = (ke + heat - 0.5*vcmsq*masstotal)/(ke - 0.5*vcmsq*masstotal); - if (vscale[i] < 0.0) + if (vscale[i] < 0.0) error->all(FLERR, "Fix heat kinetic energy of an atom went negative"); scale = sqrt(vscale[i]); @@ -261,9 +261,9 @@ void FixHeat::end_of_step() for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { heat = vheat[i]*nevery*update->dt*force->ftm2v; - vscale[i] = + vscale[i] = (ke + heat - 0.5*vcmsq*masstotal)/(ke - 0.5*vcmsq*masstotal); - if (vscale[i] < 0.0) + if (vscale[i] < 0.0) error->all(FLERR, "Fix heat kinetic energy of an atom went negative"); scale = sqrt(vscale[i]); @@ -295,7 +295,7 @@ void FixHeat::end_of_step() double FixHeat::compute_scalar() { double average_scale = scale; - if (hstyle == ATOM) { + if (hstyle == ATOM) { double scale_sum = 0.0; int ncount = 0; int *mask = atom->mask; diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 9e214de7631948f8bc94287f0d6eacbd0573f344..4b85dd2788fd302e35ffa39bc364ad2788035226 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -15,9 +15,9 @@ Contributing author: Ravi Agrawal (Northwestern U) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_indent.h" #include "atom.h" #include "input.h" diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index e8f3290be9583dfe61bcc325ec19e5e0ebdeba21..c71ffbc3fd3cdfd01b6110fa78bc088a76b89e88 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -16,10 +16,10 @@ Aidan Thompson (SNL) GJF formulation ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_langevin.h" #include "math_extra.h" #include "atom.h" @@ -300,7 +300,7 @@ void FixLangevin::post_force(int vflag) double *rmass = atom->rmass; // enumerate all 2^6 possibilities for template parameters - // this avoids testing them inside inner loop: + // this avoids testing them inside inner loop: // TSTYLEATOM, GJF, TALLY, BIAS, RMASS, ZERO #ifdef TEMPLATED_FIX_LANGEVIN @@ -431,7 +431,7 @@ void FixLangevin::post_force(int vflag) if (zeroflag) post_force_templated<0,0,0,0,0,1>(); else post_force_templated<0,0,0,0,0,0>(); #else - post_force_untemplated(int(tstyle==ATOM), gjfflag, tallyflag, + post_force_untemplated(int(tstyle==ATOM), gjfflag, tallyflag, int(tbiasflag==BIAS), int(rmass!=NULL), zeroflag); #endif } @@ -448,12 +448,12 @@ void FixLangevin::post_force_respa(int vflag, int ilevel, int iloop) ------------------------------------------------------------------------- */ #ifdef TEMPLATED_FIX_LANGEVIN -template < int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY, +template < int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY, int Tp_BIAS, int Tp_RMASS, int Tp_ZERO > void FixLangevin::post_force_templated() #else void FixLangevin::post_force_untemplated - (int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY, + (int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY, int Tp_BIAS, int Tp_RMASS, int Tp_ZERO) #endif { @@ -681,7 +681,7 @@ void FixLangevin::omega_thermostat() double tendivthree = 10.0/3.0; double tran[3]; double inertiaone; - + for (int i = 0; i < nlocal; i++) { if ((mask[i] & groupbit) && (radius[i] > 0.0)) { inertiaone = SINERTIA*radius[i]*radius[i]*rmass[i]; @@ -880,7 +880,7 @@ double FixLangevin::memory_usage() } /* ---------------------------------------------------------------------- - allocate atom-based array for franprev + allocate atom-based array for franprev ------------------------------------------------------------------------- */ void FixLangevin::grow_arrays(int nmax) diff --git a/src/fix_langevin.h b/src/fix_langevin.h index b7360001076cf8653c6f50ec26d17a3c0ba27289..1e084c9e9867f88c3f0c113787596a31e7f1b8f5 100644 --- a/src/fix_langevin.h +++ b/src/fix_langevin.h @@ -74,11 +74,11 @@ class FixLangevin : public Fix { // comment next line to turn off templating #define TEMPLATED_FIX_LANGEVIN #ifdef TEMPLATED_FIX_LANGEVIN - template < int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY, - int Tp_BIAS, int Tp_RMASS, int Tp_ZERO > + template < int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY, + int Tp_BIAS, int Tp_RMASS, int Tp_ZERO > void post_force_templated(); #else - void post_force_untemplated(int, int, int, + void post_force_untemplated(int, int, int, int, int, int); #endif void omega_thermostat(); diff --git a/src/fix_lineforce.cpp b/src/fix_lineforce.cpp index 7128d245728989236373e5653208b14aa3be69da..f82ed957f73bbfd2f2fe54b9b41746af161564ca 100644 --- a/src/fix_lineforce.cpp +++ b/src/fix_lineforce.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_lineforce.h" #include "atom.h" #include "update.h" diff --git a/src/fix_minimize.cpp b/src/fix_minimize.cpp index 3b63cc948a3451df8b058fb1f9c276dfdeb1b46a..1cd8456f573a8eee12f0507e1bbe70b1a232c9eb 100644 --- a/src/fix_minimize.cpp +++ b/src/fix_minimize.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "fix_minimize.h" #include "atom.h" #include "domain.h" diff --git a/src/fix_momentum.cpp b/src/fix_momentum.cpp index abdeca249577297c92c2ca17ed47ce732a151544..b8ca3c2c018ce58d8776aa6c21da6763a6ca931d 100644 --- a/src/fix_momentum.cpp +++ b/src/fix_momentum.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_momentum.h" #include "atom.h" #include "domain.h" @@ -61,7 +61,7 @@ FixMomentum::FixMomentum(LAMMPS *lmp, int narg, char **arg) : if (linear) if (xflag < 0 || xflag > 1 || yflag < 0 || yflag > 1 || - zflag < 0 || zflag > 1) + zflag < 0 || zflag > 1) error->all(FLERR,"Illegal fix momentum command"); // cannot have 0 atoms in group diff --git a/src/fix_move.cpp b/src/fix_move.cpp index c2e71313959bb0bd6766a56fc306d8fcf6589ded..e1f522177bdf93b900ffc1f619b9bb2102507d82 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_move.h" #include "atom.h" #include "group.h" diff --git a/src/fix_move.h b/src/fix_move.h index 9a40a9a52f96413ae1882e51568fdf77707c7009..bcd877570827e153e1c9ee7f8e5f012c8de6c038 100644 --- a/src/fix_move.h +++ b/src/fix_move.h @@ -20,7 +20,7 @@ FixStyle(move,FixMove) #ifndef LMP_FIX_MOVE_H #define LMP_FIX_MOVE_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 92da3e33cdbda59df05277f9fed0d1d614076e0c..ec18dffb91aef7e16bc82f84bdebc98fab2f6a2f 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -15,9 +15,9 @@ Contributing authors: Mark Stevens (SNL), Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_nh.h" #include "math_extra.h" #include "atom.h" @@ -131,7 +131,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) pcouple = XYZ; p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { @@ -144,7 +144,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) pcouple = NONE; p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { @@ -158,12 +158,12 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) scalexy = scalexz = scaleyz = 0; p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = + p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); p_flag[0] = p_flag[1] = p_flag[2] = 1; p_start[3] = p_start[4] = p_start[5] = 0.0; p_stop[3] = p_stop[4] = p_stop[5] = 0.0; - p_period[3] = p_period[4] = p_period[5] = + p_period[3] = p_period[4] = p_period[5] = force->numeric(FLERR,arg[iarg+3]); p_flag[3] = p_flag[4] = p_flag[5] = 1; if (dimension == 2) { @@ -844,11 +844,11 @@ void FixNH::final_integrate() // re-compute temp before nh_v_press() // only needed for temperature computes with BIAS on reneighboring steps: - // b/c some biases store per-atom values (e.g. temp/profile) + // b/c some biases store per-atom values (e.g. temp/profile) // per-atom values are invalid if reneigh/comm occurred // since temp->compute() in initial_integrate() - if (which == BIAS && neighbor->ago == 0) + if (which == BIAS && neighbor->ago == 0) t_current = temperature->compute_scalar(); if (pstat_flag) nh_v_press(); diff --git a/src/fix_nh_sphere.cpp b/src/fix_nh_sphere.cpp index c6a09f29546382576b5a14b9359a02daff2bea57..9db1e34e39ff9ab9584e29ef65f1bb2890fe31e7 100644 --- a/src/fix_nh_sphere.cpp +++ b/src/fix_nh_sphere.cpp @@ -15,7 +15,7 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_nh_sphere.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/fix_nph.cpp b/src/fix_nph.cpp index 419a6980a02e5d8fda090cb54f329970cdb68a54..6f3678ed3a7ed020bfbbfbc274e0daf4e2c12095 100644 --- a/src/fix_nph.cpp +++ b/src/fix_nph.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nph.h" #include "modify.h" #include "error.h" diff --git a/src/fix_nph_sphere.cpp b/src/fix_nph_sphere.cpp index 2c87e6b34f33559f689505a0db7db2a2fe55327c..93d9bf8af21e2cd29debf253154f4044d40862ab 100644 --- a/src/fix_nph_sphere.cpp +++ b/src/fix_nph_sphere.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nph_sphere.h" #include "modify.h" #include "error.h" diff --git a/src/fix_npt.cpp b/src/fix_npt.cpp index cf83ded491fa2a1f2ebe00bf406c3fe457a9d8c5..0326c06c779818f4951fabeafdd5d80a6a83d0dc 100644 --- a/src/fix_npt.cpp +++ b/src/fix_npt.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_npt.h" #include "modify.h" #include "error.h" diff --git a/src/fix_npt_sphere.cpp b/src/fix_npt_sphere.cpp index 81c0e3c799b524625ff7be7bbe1299a407bfee17..6e7c074d5e2bcd45fef5ef88a6a1aa391706508e 100644 --- a/src/fix_npt_sphere.cpp +++ b/src/fix_npt_sphere.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_npt_sphere.h" #include "modify.h" #include "error.h" diff --git a/src/fix_nve.cpp b/src/fix_nve.cpp index 8914a18f4c6cc6e39b06ccf4b78d87cd5536b5a8..64ec3373f12c81137a7884c25f358bcc2e609174 100644 --- a/src/fix_nve.cpp +++ b/src/fix_nve.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "fix_nve.h" #include "atom.h" #include "force.h" diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index 42ea5a676f01f3d5a3f9bcb3d0adb474742edda0..966fcfbb09ca0530b5893d7e160a519fc86d9384 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "fix_nve_limit.h" #include "atom.h" #include "force.h" diff --git a/src/fix_nve_noforce.cpp b/src/fix_nve_noforce.cpp index e373e00b197997aeacb10a30252737da10a5d46c..aa24c26e03ff9bc7462da80aafb913dcc2258938 100644 --- a/src/fix_nve_noforce.cpp +++ b/src/fix_nve_noforce.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "fix_nve_noforce.h" #include "atom.h" #include "update.h" diff --git a/src/fix_nve_sphere.cpp b/src/fix_nve_sphere.cpp index 0ad787a27f6d7c451a1103a51d819af3f6adc604..c72797b8ce756a128d28d1f3aa24abeb12597368 100644 --- a/src/fix_nve_sphere.cpp +++ b/src/fix_nve_sphere.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "fix_nve_sphere.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/fix_nvt.cpp b/src/fix_nvt.cpp index 839b7ce0a3b3d0651239db49a68361eb90a4dcca..a86f46c3b534f944bed78795c193e713bfa0325a 100644 --- a/src/fix_nvt.cpp +++ b/src/fix_nvt.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nvt.h" #include "group.h" #include "modify.h" diff --git a/src/fix_nvt_sllod.cpp b/src/fix_nvt_sllod.cpp index 460ba7a39399a59c1e9f2ffd4b0dbc96015bbbef..8257afae05aa542d73662e0d884f8edf758833e4 100644 --- a/src/fix_nvt_sllod.cpp +++ b/src/fix_nvt_sllod.cpp @@ -15,8 +15,8 @@ Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "fix_nvt_sllod.h" #include "math_extra.h" #include "atom.h" diff --git a/src/fix_nvt_sphere.cpp b/src/fix_nvt_sphere.cpp index 58dbbb782c6f953a717a12683e397c9e494b468e..c886935f120087b03a7a1244f3de045291f60f2c 100644 --- a/src/fix_nvt_sphere.cpp +++ b/src/fix_nvt_sphere.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_nvt_sphere.h" #include "group.h" #include "modify.h" diff --git a/src/fix_planeforce.cpp b/src/fix_planeforce.cpp index 217aec9c3676393c1679851cee492ac30665247c..872bd9871610786074b8dd23bb3d18a7a42547e0 100644 --- a/src/fix_planeforce.cpp +++ b/src/fix_planeforce.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_planeforce.h" #include "atom.h" #include "update.h" diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index 25e0f9a44c1f27e0e1d3f9791b09bef5c6d4ae85..58dd0dae923e19048232995f6066e42079d2724d 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_press_berendsen.h" #include "atom.h" #include "force.h" diff --git a/src/fix_print.cpp b/src/fix_print.cpp index f93356c0433a06b86cea7e3f2fdf0b3f0b5a116d..3c54772a739776362b5dc1527af72e71b6952f1d 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_print.h" #include "update.h" #include "input.h" diff --git a/src/fix_print.h b/src/fix_print.h index b6eb05dc4329f5ce183551aa84dec1474b96dc2e..c3897b815f5fd8a7783a7aabc8f3cbda7f0d8181 100644 --- a/src/fix_print.h +++ b/src/fix_print.h @@ -20,7 +20,7 @@ FixStyle(print,FixPrint) #ifndef LMP_FIX_PRINT_H #define LMP_FIX_PRINT_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 05e9c11dde958bbcd41b0b71192253ffbe3232ab..10f73aa53bebf086799785f37cfbb4a15484396f 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_property_atom.h" #include "atom.h" #include "comm.h" @@ -50,7 +50,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (atom->molecule_flag) error->all(FLERR,"Fix property/atom mol when atom_style " "already has molecule attribute"); - if (molecule_flag) + if (molecule_flag) error->all(FLERR,"Fix property/atom cannot specify mol twice"); style[nvalue] = MOLECULE; atom->molecule_flag = molecule_flag = 1; @@ -59,7 +59,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (atom->q_flag) error->all(FLERR,"Fix property/atom q when atom_style " "already has charge attribute"); - if (q_flag) + if (q_flag) error->all(FLERR,"Fix property/atom cannot specify q twice"); style[nvalue] = CHARGE; atom->q_flag = q_flag = 1; @@ -68,7 +68,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : style[nvalue] = INTEGER; int tmp; index[nvalue] = atom->find_custom(&arg[iarg][2],tmp); - if (index[nvalue] >= 0) + if (index[nvalue] >= 0) error->all(FLERR,"Fix property/atom vector name already exists"); index[nvalue] = atom->add_custom(&arg[iarg][2],0); nvalue++; @@ -76,7 +76,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : style[nvalue] = DOUBLE; int tmp; index[nvalue] = atom->find_custom(&arg[iarg][2],tmp); - if (index[nvalue] >= 0) + if (index[nvalue] >= 0) error->all(FLERR,"Fix property/atom vector name already exists"); index[nvalue] = atom->add_custom(&arg[iarg][2],1); nvalue++; @@ -106,7 +106,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : int flag = 0; for (int i = 0; i < nvalue; i++) if (style[i] == MOLECULE || style[i] == CHARGE) flag = 1; - if (flag && comm->me == 0) + if (flag && comm->me == 0) error->warning(FLERR,"Fix property/atom mol or charge w/out " "ghost communication"); } @@ -240,7 +240,7 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, else if (style[j] == CHARGE) atom->q[m] = atof(values[j+1]); else if (style[j] == INTEGER) atom->ivector[index[j]][m] = atoi(values[j+1]); - else if (style[j] == DOUBLE) + else if (style[j] == DOUBLE) atom->dvector[index[j]][m] = atof(values[j+1]); } } @@ -333,7 +333,7 @@ void FixPropertyAtom::write_data_section_keyword(int mth, FILE *fp) only called by proc 0 ------------------------------------------------------------------------- */ -void FixPropertyAtom::write_data_section(int mth, FILE *fp, +void FixPropertyAtom::write_data_section(int mth, FILE *fp, int n, double **buf, int index) { int m; @@ -370,7 +370,7 @@ double FixPropertyAtom::memory_usage() /* ---------------------------------------------------------------------- allocate atom-based arrays initialize new values to 0, - since AtomVec class won't do it as atoms are added, + since AtomVec class won't do it as atoms are added, e.g. in create_atom() or data_atom() ------------------------------------------------------------------------- */ @@ -515,11 +515,11 @@ int FixPropertyAtom::pack_exchange(int i, double *buf) int FixPropertyAtom::unpack_exchange(int nlocal, double *buf) { for (int m = 0; m < nvalue; m++) { - if (style[m] == MOLECULE) + if (style[m] == MOLECULE) atom->molecule[nlocal] = (tagint) ubuf(buf[m]).i; else if (style[m] == CHARGE) atom->q[nlocal] = buf[m]; - else if (style[m] == INTEGER) + else if (style[m] == INTEGER) atom->ivector[index[m]][nlocal] = (int) ubuf(buf[m]).i; else if (style[m] == DOUBLE) atom->dvector[index[m]][nlocal] = buf[m]; @@ -561,11 +561,11 @@ void FixPropertyAtom::unpack_restart(int nlocal, int nth) m++; for (int i = 0; i < nvalue; i++) { - if (style[i] == MOLECULE) + if (style[i] == MOLECULE) atom->molecule[nlocal] = (tagint) ubuf(extra[nlocal][m++]).i; else if (style[i] == CHARGE) atom->q[nlocal] = extra[nlocal][m++]; - else if (style[i] == INTEGER) + else if (style[i] == INTEGER) atom->ivector[index[i]][nlocal] = (int) ubuf(extra[nlocal][m++]).i; else if (style[i] == DOUBLE) atom->dvector[index[i]][nlocal] = extra[nlocal][m++]; diff --git a/src/fix_read_restart.cpp b/src/fix_read_restart.cpp index a1d1b7c6555653db7872380236f514786e894d57..3d49db7196ede3762a9bb552b309595ba3d0f60a 100644 --- a/src/fix_read_restart.cpp +++ b/src/fix_read_restart.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "fix_read_restart.h" #include "atom.h" #include "memory.h" diff --git a/src/fix_recenter.cpp b/src/fix_recenter.cpp index 4cbf0248caf7582de046923c85c227aedf846afc..7d30c2f865e55023a5903b1f3a2569f4c8d13bc3 100644 --- a/src/fix_recenter.cpp +++ b/src/fix_recenter.cpp @@ -15,8 +15,8 @@ Contributing author: Naveen Michaud-Agrawal (Johns Hopkins U) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_recenter.h" #include "atom.h" #include "group.h" diff --git a/src/fix_respa.cpp b/src/fix_respa.cpp index 6d3a948a957cd545e090506c3e1e9751b3c3a364..2902ae8a119ae275f33b723adb4c0d31bbfd4750 100644 --- a/src/fix_respa.cpp +++ b/src/fix_respa.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_respa.h" #include "atom.h" #include "force.h" diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 70b0d72d0220a05cee33e731a943764478ec57b9..97e898494eab6be77b373d9b1433d4576c405687 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -16,9 +16,9 @@ support for bond and angle restraints by Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "fix_restrain.h" #include "atom.h" #include "force.h" @@ -512,8 +512,8 @@ void FixRestrain::restrain_dihedral(int m) MPI_Comm_rank(world,&me); if (screen) { char str[128]; - sprintf(str,"Restrain problem: %d " BIGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT " " + sprintf(str,"Restrain problem: %d " BIGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, me,update->ntimestep, atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4]); diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 6ba34ce822db4ba0dc6fb1fa572ad5fb23e74be3..0fe56e7548e0add25b1cd2cc142a649fcc56f813 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "fix_setforce.h" #include "atom.h" #include "update.h" diff --git a/src/fix_shear_history.cpp b/src/fix_shear_history.cpp index ddfe2224d970359854aa16e4686b64e375f0ba88..da69a95603df809f1610142349a1aa704a3f8cbd 100644 --- a/src/fix_shear_history.cpp +++ b/src/fix_shear_history.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdio.h" +#include <mpi.h> +#include <string.h> +#include <stdio.h> #include "fix_shear_history.h" #include "atom.h" #include "comm.h" @@ -293,7 +293,7 @@ void FixShearHistory::grow_arrays(int nmax) partner = (tagint **) memory->srealloc(partner,nmax*sizeof(tagint *), "shear_history:partner"); typedef double (*sptype)[3]; - shearpartner = (sptype *) + shearpartner = (sptype *) memory->srealloc(shearpartner,nmax*sizeof(sptype), "shear_history:shearpartner"); } diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index d80d2cb170eeaec7ff709ea3f34df2a00b3e999a..ddc161e50dd2ec5a583811936a1d60f819ca0cfb 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -15,9 +15,9 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_spring.h" #include "atom.h" #include "update.h" diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index 765edac8b974e1b2339bc8f7d1eb2dafb9b33138..5e267340c1c35e676b1744b75982e151ea241179 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -16,9 +16,9 @@ Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_spring_rg.h" #include "atom.h" #include "update.h" diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index c14a4b573131170fdcfba84324371c1938df2546..830af421621100bc451c926837901cdfcd9cc76c 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -15,8 +15,8 @@ Contributing author: Naveen Michaud-Agrawal (Johns Hopkins University) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_spring_self.h" #include "atom.h" #include "update.h" diff --git a/src/fix_store.cpp b/src/fix_store.cpp index 45eeaaa502fd461f747d281bc08ee2a59deecf32..4e3d612ccee3378e0c9d4a66c0ab8a86757123f4 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_store.h" #include "atom.h" #include "memory.h" @@ -53,7 +53,7 @@ FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (vecflag) for (int i = 0; i < nlocal; i++) vstore[i] = 0.0; - else + else for (int i = 0; i < nlocal; i++) for (int j = 0; j < nvalues; j++) astore[i][j] = 0.0; @@ -132,7 +132,7 @@ int FixStore::pack_exchange(int i, double *buf) int FixStore::unpack_exchange(int nlocal, double *buf) { if (vecflag) vstore[nlocal] = buf[0]; - else + else for (int m = 0; m < nvalues; m++) astore[nlocal][m] = buf[m]; return nvalues; @@ -168,7 +168,7 @@ void FixStore::unpack_restart(int nlocal, int nth) if (vecflag) vstore[nlocal] = extra[nlocal][m]; else - for (int i = 0; i < nvalues; i++) + for (int i = 0; i < nvalues; i++) astore[nlocal][i] = extra[nlocal][m++]; } diff --git a/src/fix_store_force.cpp b/src/fix_store_force.cpp index 3f132be8f2b67d55bff4bedaf25fa8f9c77e614d..521e4568912ae6db3cfef5e950959422c3e6429d 100644 --- a/src/fix_store_force.cpp +++ b/src/fix_store_force.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_store_force.h" #include "atom.h" #include "update.h" diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index 4a567cbcab430888d44ccda720d0e7a7614e7004..efcc73f03250615724b01f9c6fdab2b9e8ff465b 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_store_state.h" #include "atom.h" #include "domain.h" diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index e4b245245583c3ab58faba4cd41e4f2d9e8762b0..bb86eb486606d5e438bba2482352175abecd0310 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_temp_berendsen.h" #include "atom.h" #include "force.h" diff --git a/src/fix_temp_csld.cpp b/src/fix_temp_csld.cpp index 28235b00fcb336f9bae999372917dc822d09555a..e89f26ec693174bb850f795c5cbaf319e81a8c12 100644 --- a/src/fix_temp_csld.cpp +++ b/src/fix_temp_csld.cpp @@ -15,9 +15,9 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_temp_csld.h" #include "atom.h" #include "force.h" @@ -138,7 +138,7 @@ void FixTempCSLD::init() if (has_shake > 0) error->all(FLERR,"Fix temp/csld is not compatible with fix rattle or fix shake"); - + // check variable if (tstr) { @@ -222,7 +222,7 @@ void FixTempCSLD::end_of_step() v[i][2] = vz; } } - + // mixing factors const double c1 = exp(-update->dt/t_period); const double c2 = sqrt((1.0-c1*c1)*t_target/temperature->compute_scalar()); diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index 6171e688c042c33471a5fae3e7456bab29a98350..81f87d4caa4c7a01a03a16748738fe3069385dfa 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -16,9 +16,9 @@ Based on code by Paolo Raiteri (Curtin U) and Giovanni Bussi (SISSA) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_temp_csvr.h" #include "atom.h" #include "force.h" diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index b84bab20c7113e9dc5fae83d6378761b2005be00..5e6036214baa5deacaca40b8eca163ab8abbca4d 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" -#include "math.h" +#include <string.h> +#include <stdlib.h> +#include <math.h> #include "fix_temp_rescale.h" #include "atom.h" #include "force.h" diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 5820ffb5edbe724dfece0f59121ad969119d1bee..4be97a816ececd9e0831b969b3230dcd317fcdb1 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -16,10 +16,10 @@ Christian Burisch (Bochum Univeristy, Germany) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_tmd.h" #include "atom.h" #include "update.h" diff --git a/src/fix_tmd.h b/src/fix_tmd.h index d00bb303ec30448e2f54a8540426b55d6f48e2a8..dc994936dff99317ba5eab46a17f54e5bd9ff79a 100644 --- a/src/fix_tmd.h +++ b/src/fix_tmd.h @@ -20,7 +20,7 @@ FixStyle(tmd,FixTMD) #ifndef LMP_FIX_TMD_H #define LMP_FIX_TMD_H -#include "stdio.h" +#include <stdio.h> #include "fix.h" namespace LAMMPS_NS { diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index 8cdf58564cd9d154303d111fb6cfcad432309570..7abb2f6454aa8dfd9704cb0c6009f04c02ab1a74 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "fix_vector.h" #include "update.h" #include "force.h" @@ -68,7 +68,7 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : argindex[nvalues] = atoi(ptr+1); *ptr = '\0'; } else argindex[nvalues] = 0; - + n = strlen(suffix) + 1; ids[nvalues] = new char[n]; strcpy(ids[nvalues],suffix); @@ -223,7 +223,7 @@ void FixVector::init() // reallocate vector or array for accumulated size at end of run // use endstep to allow for subsequent runs with "pre no" - // nsize = # of entries from initialstep to finalstep + // nsize = # of entries from initialstep to finalstep bigint finalstep = update->endstep/nevery * nevery; if (finalstep > update->endstep) finalstep -= nevery; @@ -248,7 +248,7 @@ void FixVector::end_of_step() // skip if not step which requires doing something if (update->ntimestep != nextstep) return; - if (ncount == ncountmax) + if (ncount == ncountmax) error->all(FLERR,"Overflow of allocated fix vector storage"); // accumulate results of computes,fixes,variables to local copy @@ -259,7 +259,7 @@ void FixVector::end_of_step() else result = array[ncount]; modify->clearstep_compute(); - + for (int i = 0; i < nvalues; i++) { int m = value2index[i]; diff --git a/src/fix_viscous.cpp b/src/fix_viscous.cpp index f1ad471404a6b2e465bc52be5782803ae4d04dac..bc5059ae69aed2397416b87794ca1e7e6814d5fd 100644 --- a/src/fix_viscous.cpp +++ b/src/fix_viscous.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_viscous.h" #include "atom.h" #include "update.h" diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index d3c88d75335bbce1f13bb771a9d2352e05fcd315..fcebd77a9a08695b260c2dfec1c65a3114bb96e2 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_wall.h" #include "atom.h" #include "input.h" @@ -319,7 +319,7 @@ void FixWall::post_force(int vflag) } if (sstyle[m] == VARIABLE) { sigma[m] = input->variable->compute_equal(sindex[m]); - if (sigma[m] < 0.0) + if (sigma[m] < 0.0) error->all(FLERR,"Variable evaluation in fix wall gave bad value"); } precompute(m); diff --git a/src/fix_wall_harmonic.cpp b/src/fix_wall_harmonic.cpp index 1766fa63c9b26ffdc248858231897d54c62af434..41d630b7fef5d481d8ea314d98b96398f076c781 100644 --- a/src/fix_wall_harmonic.cpp +++ b/src/fix_wall_harmonic.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_wall_harmonic.h" #include "atom.h" #include "error.h" diff --git a/src/fix_wall_lj1043.cpp b/src/fix_wall_lj1043.cpp index 0ef78ec0cdd29928d4577cdaea710bdb96b85af6..72d71fbb3cc5a8ae52adc18b9533a8b7b807abbe 100644 --- a/src/fix_wall_lj1043.cpp +++ b/src/fix_wall_lj1043.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -15,7 +15,7 @@ Contributing author: Jonathan Lee (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_wall_lj1043.h" #include "atom.h" #include "math_const.h" @@ -25,7 +25,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -FixWallLJ1043::FixWallLJ1043(LAMMPS *lmp, int narg, char **arg) : +FixWallLJ1043::FixWallLJ1043(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp, narg, arg) {} /* ---------------------------------------------------------------------- */ @@ -43,7 +43,7 @@ void FixWallLJ1043::precompute(int m) double rinv = 1.0/cutoff[m]; double r2inv = rinv*rinv; double r4inv = r2inv*r2inv; - offset[m] = coeff1[m]*r4inv*r4inv*r2inv - coeff2[m]*r4inv - + offset[m] = coeff1[m]*r4inv*r4inv*r2inv - coeff2[m]*r4inv - coeff3[m]*pow(cutoff[m]+coeff4[m],-3.0); } @@ -73,10 +73,10 @@ void FixWallLJ1043::wall_particle(int m, int which, double coord) r4inv = r2inv*r2inv; r10inv = r4inv*r4inv*r2inv; - fwall = side * (coeff5[m]*r10inv*rinv - coeff6[m]*r4inv*rinv - + fwall = side * (coeff5[m]*r10inv*rinv - coeff6[m]*r4inv*rinv - coeff7[m]*pow(delta+coeff4[m],-4.0)); f[i][dim] -= fwall; - ewall[0] += coeff1[m]*r10inv - coeff2[m]*r4inv - + ewall[0] += coeff1[m]*r10inv - coeff2[m]*r4inv - coeff3[m]*pow(delta+coeff4[m],-3.0) - offset[m]; ewall[m+1] += fwall; } diff --git a/src/fix_wall_lj1043.h b/src/fix_wall_lj1043.h index 8b9ad178f853d3636acf0096d8332d82ecceb2f7..a7fdf5ae186594c98013211e0d39daccac6af3c3 100644 --- a/src/fix_wall_lj1043.h +++ b/src/fix_wall_lj1043.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/fix_wall_lj126.cpp b/src/fix_wall_lj126.cpp index c942a34acd052e6e3b58c877caf4e0b4a0cb516f..f6d8654eea916d18556e206766da419b19584118 100644 --- a/src/fix_wall_lj126.cpp +++ b/src/fix_wall_lj126.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_wall_lj126.h" #include "atom.h" #include "error.h" diff --git a/src/fix_wall_lj93.cpp b/src/fix_wall_lj93.cpp index a4cd6b65164560969b4024143249c2c2c8ce469e..f7a3aaf14cd4fdcd6cbcc90334595c77e94a8c5d 100644 --- a/src/fix_wall_lj93.cpp +++ b/src/fix_wall_lj93.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "fix_wall_lj93.h" #include "atom.h" #include "error.h" diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index 5f14fa23c650a6e2ec9345c651be05c4be75e8c5..b5c70037b2f67dbe5fa7b267a00ce044941c579c 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "fix_wall_reflect.h" #include "atom.h" #include "comm.h" diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index 08aa7c9f939e49baa29dc23498d68900014917c3..ca17304f3633663c711f2dc8f510953f9554d58d 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "fix_wall_region.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/force.cpp b/src/force.cpp index f51b0c181814d1fcb69c30ff370ec898be85adf8..b31b8eda4e6299a971b1b2ee509bdf0f223de659 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "ctype.h" +#include <stdlib.h> +#include <string.h> +#include <ctype.h> #include "force.h" #include "style_bond.h" #include "style_angle.h" @@ -262,7 +262,7 @@ Bond *Force::new_bond(const char *style, int trysuffix, int &sflag) sflag = 1; char estyle[256]; sprintf(estyle,"%s/%s",style,lmp->suffix); - + if (0) return NULL; #define BOND_CLASS @@ -277,7 +277,7 @@ Bond *Force::new_bond(const char *style, int trysuffix, int &sflag) sflag = 2; char estyle[256]; sprintf(estyle,"%s/%s",style,lmp->suffix2); - + if (0) return NULL; #define BOND_CLASS @@ -342,7 +342,7 @@ Angle *Force::new_angle(const char *style, int trysuffix, int &sflag) sflag = 1; char estyle[256]; sprintf(estyle,"%s/%s",style,lmp->suffix); - + if (0) return NULL; #define ANGLE_CLASS @@ -357,7 +357,7 @@ Angle *Force::new_angle(const char *style, int trysuffix, int &sflag) sflag = 2; char estyle[256]; sprintf(estyle,"%s/%s",style,lmp->suffix); - + if (0) return NULL; #define ANGLE_CLASS @@ -759,7 +759,7 @@ void Force::bounds(char *str, int nmax, int &nlo, int &nhi, int nmin) nhi = atoi(ptr+1); } - if (nlo < nmin || nhi > nmax || nlo > nhi) + if (nlo < nmin || nhi > nmax || nlo > nhi) error->all(FLERR,"Numeric index is out of bounds"); } @@ -772,7 +772,7 @@ void Force::bounds(char *str, int nmax, int &nlo, int &nhi, int nmin) return nlo,nhi ------------------------------------------------------------------------- */ -void Force::boundsbig(char *str, bigint nmax, bigint &nlo, bigint &nhi, +void Force::boundsbig(char *str, bigint nmax, bigint &nlo, bigint &nhi, bigint nmin) { char *ptr = strchr(str,'*'); @@ -793,7 +793,7 @@ void Force::boundsbig(char *str, bigint nmax, bigint &nlo, bigint &nhi, nhi = ATOBIGINT(ptr+1); } - if (nlo < nmin || nhi > nmax || nlo > nhi) + if (nlo < nmin || nhi > nmax || nlo > nhi) error->all(FLERR,"Numeric index is out of bounds"); } @@ -832,11 +832,11 @@ double Force::numeric(const char *file, int line, char *str) int Force::inumeric(const char *file, int line, char *str) { - if (!str) + if (!str) error->all(file,line, "Expected integer parameter in input script or data file"); int n = strlen(str); - if (n == 0) + if (n == 0) error->all(file,line, "Expected integer parameter in input script or data file"); @@ -857,11 +857,11 @@ int Force::inumeric(const char *file, int line, char *str) bigint Force::bnumeric(const char *file, int line, char *str) { - if (!str) + if (!str) error->all(file,line, "Expected integer parameter in input script or data file"); int n = strlen(str); - if (n == 0) + if (n == 0) error->all(file,line, "Expected integer parameter in input script or data file"); @@ -882,11 +882,11 @@ bigint Force::bnumeric(const char *file, int line, char *str) tagint Force::tnumeric(const char *file, int line, char *str) { - if (!str) + if (!str) error->all(file,line, "Expected integer parameter in input script or data file"); int n = strlen(str); - if (n == 0) + if (n == 0) error->all(file,line, "Expected integer parameter in input script or data file"); @@ -964,7 +964,7 @@ const char *Force::potential_name(const char *path) #if defined(_WIN32) // skip over the disk drive part of windows pathnames - if (isalpha(path[0]) && path[1] == ':') + if (isalpha(path[0]) && path[1] == ':') path += 2; #endif diff --git a/src/force.h b/src/force.h index 54b6612689993f7359176644b240497ad43344c8..7ff668f81a6616979f88626907755de324dfba38 100644 --- a/src/force.h +++ b/src/force.h @@ -15,7 +15,7 @@ #define LMP_FORCE_H #include "pointers.h" -#include "stdio.h" +#include <stdio.h> #include <map> #include <string> diff --git a/src/group.cpp b/src/group.cpp index 0b5d6974ea7ac5154c7c6c6acbb42f0bd2944da1..5b572b20706bb4f2af9f9226a37e25172b31ca79 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -11,11 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> #include "group.h" #include "domain.h" #include "atom.h" @@ -204,7 +204,7 @@ void Group::assign(int narg, char **arg) else if (strcmp(arg[1],"id") == 0) category = ID; // args = logical condition - + if (narg > 3 && (strcmp(arg[2],"<") == 0 || strcmp(arg[2],">") == 0 || strcmp(arg[2],"<=") == 0 || strcmp(arg[2],">=") == 0 || @@ -220,7 +220,7 @@ void Group::assign(int narg, char **arg) else if (strcmp(arg[2],"!=") == 0) condition = NEQ; else if (strcmp(arg[2],"<>") == 0) condition = BETWEEN; else error->all(FLERR,"Illegal group command"); - + tagint bound1,bound2; bound1 = force->tnumeric(FLERR,arg[3]); bound2 = -1; @@ -240,22 +240,22 @@ void Group::assign(int narg, char **arg) if (attribute) { if (condition == LT) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (attribute[i] < bound1) mask[i] |= bit; } else if (condition == LE) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (attribute[i] <= bound1) mask[i] |= bit; } else if (condition == GT) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (attribute[i] > bound1) mask[i] |= bit; } else if (condition == GE) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (attribute[i] >= bound1) mask[i] |= bit; } else if (condition == EQ) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (attribute[i] == bound1) mask[i] |= bit; } else if (condition == NEQ) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (attribute[i] != bound1) mask[i] |= bit; } else if (condition == BETWEEN) { for (i = 0; i < nlocal; i++) @@ -264,22 +264,22 @@ void Group::assign(int narg, char **arg) } } else { if (condition == LT) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (tattribute[i] < bound1) mask[i] |= bit; } else if (condition == LE) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (tattribute[i] <= bound1) mask[i] |= bit; } else if (condition == GT) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (tattribute[i] > bound1) mask[i] |= bit; } else if (condition == GE) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (tattribute[i] >= bound1) mask[i] |= bit; } else if (condition == EQ) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (tattribute[i] == bound1) mask[i] |= bit; } else if (condition == NEQ) { - for (i = 0; i < nlocal; i++) + for (i = 0; i < nlocal; i++) if (tattribute[i] != bound1) mask[i] |= bit; } else if (condition == BETWEEN) { for (i = 0; i < nlocal; i++) @@ -289,24 +289,24 @@ void Group::assign(int narg, char **arg) } // args = list of values - + } else { int *attribute = NULL; tagint *tattribute = NULL; if (category == TYPE) attribute = atom->type; else if (category == MOLECULE) tattribute = atom->molecule; else if (category == ID) tattribute = atom->tag; - + char *ptr; tagint start,stop,delta; for (int iarg = 2; iarg < narg; iarg++) { delta = 1; if (strchr(arg[iarg],':')) { - ptr = strtok(arg[iarg],":"); - start = force->tnumeric(FLERR,ptr); - ptr = strtok(NULL,":"); - stop = force->tnumeric(FLERR,ptr); + ptr = strtok(arg[iarg],":"); + start = force->tnumeric(FLERR,ptr); + ptr = strtok(NULL,":"); + stop = force->tnumeric(FLERR,ptr); ptr = strtok(NULL,":"); if (ptr) delta = force->tnumeric(FLERR,ptr); } else { @@ -316,7 +316,7 @@ void Group::assign(int narg, char **arg) error->all(FLERR,"Illegal range increment value"); // add to group if attribute matches value or sequence - + if (attribute) { for (i = 0; i < nlocal; i++) if (attribute[i] >= start && attribute[i] <= stop && @@ -340,7 +340,7 @@ void Group::assign(int narg, char **arg) error->all(FLERR,"Variable for group is invalid style"); double *aflag; - + // aflag = evaluation of per-atom variable memory->create(aflag,nlocal,"group:aflag"); @@ -358,7 +358,7 @@ void Group::assign(int narg, char **arg) } else if (strcmp(arg[1],"include") == 0) { if (narg != 3) error->all(FLERR,"Illegal group command"); - if (strcmp(arg[2],"molecule") != 0) + if (strcmp(arg[2],"molecule") != 0) error->all(FLERR,"Illegal group command"); add_molecules(igroup,bit); @@ -376,7 +376,7 @@ void Group::assign(int narg, char **arg) for (int iarg = 2; iarg < narg; iarg++) { jgroup = find(arg[iarg]); if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); - if (dynamic[jgroup]) + if (dynamic[jgroup]) error->all(FLERR,"Cannot subtract groups using a dynamic group"); list[iarg-2] = jgroup; } @@ -414,7 +414,7 @@ void Group::assign(int narg, char **arg) for (int iarg = 2; iarg < narg; iarg++) { jgroup = find(arg[iarg]); if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); - if (dynamic[jgroup]) + if (dynamic[jgroup]) error->all(FLERR,"Cannot union groups using a dynamic group"); list[iarg-2] = jgroup; } @@ -444,7 +444,7 @@ void Group::assign(int narg, char **arg) for (int iarg = 2; iarg < narg; iarg++) { jgroup = find(arg[iarg]); if (jgroup == -1) error->all(FLERR,"Group ID does not exist"); - if (dynamic[jgroup]) + if (dynamic[jgroup]) error->all(FLERR,"Cannot intersect groups using a dynamic group"); list[iarg-2] = jgroup; } @@ -470,9 +470,9 @@ void Group::assign(int narg, char **arg) } else if (strcmp(arg[1],"dynamic") == 0) { if (narg < 4) error->all(FLERR,"Illegal group command"); - if (strcmp(arg[0],arg[2]) == 0) + if (strcmp(arg[0],arg[2]) == 0) error->all(FLERR,"Group dynamic cannot reference itself"); - if (find(arg[2]) < 0) + if (find(arg[2]) < 0) error->all(FLERR,"Group dynamic parent group does not exist"); if (igroup == 0) error->all(FLERR,"Group all cannot be made dynamic"); @@ -537,7 +537,7 @@ void Group::assign(int narg, char **arg) if (screen) fprintf(screen,"dynamic group %s defined\n",names[igroup]); if (logfile) fprintf(logfile,"dynamic group %s defined\n",names[igroup]); } else { - if (screen) + if (screen) fprintf(screen,"%.15g atoms in group %s\n",all,names[igroup]); if (logfile) fprintf(logfile,"%.15g atoms in group %s\n",all,names[igroup]); diff --git a/src/group.h b/src/group.h index cef184102ea48fb6dbbee705704ff93b35995cbd..4fbdb0cc6e27d148f632f7dd4612f0f7f65e6d01 100644 --- a/src/group.h +++ b/src/group.h @@ -14,7 +14,7 @@ #ifndef LMP_GROUP_H #define LMP_GROUP_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" #include <map> diff --git a/src/image.cpp b/src/image.cpp index ab6824d7fb4d3bb7c18919185afdfdde5a5d64a6..033bcfb669d633dbb566b0ce5bc5cb42ad18157b 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -15,11 +15,11 @@ Contributing author: Nathan Fabian (Sandia) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "ctype.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> #include "image.h" #include "math_extra.h" #include "random_mars.h" @@ -1816,7 +1816,7 @@ int ColorMap::reset(int narg, char **arg) } /* ---------------------------------------------------------------------- - set explicit values for all min/max settings in color map + set explicit values for all min/max settings in color map from min/max dynamic values set lo/hi current and lvalue/hvalue entries that are MIN/MAX VALUE called only once if mlo/mhi != MIN/MAX VALUE, else called repeatedly @@ -1838,7 +1838,7 @@ int ColorMap::minmax(double mindynamic, double maxdynamic) if (mrange == ABSOLUTE) mentry[nentry-1].svalue = hicurrent; else mentry[nentry-1].svalue = 1.0; - // error in ABSOLUTE mode if new lo/hi current cause + // error in ABSOLUTE mode if new lo/hi current cause // first/last entry to become lo > hi with adjacent entry if (mrange == ABSOLUTE) { diff --git a/src/image.h b/src/image.h index 6895750ea79065ada0dd854eecdf5b9f6ba46495..58050ada3278f8b8f4d140b2a43883c450ef049c 100644 --- a/src/image.h +++ b/src/image.h @@ -14,8 +14,8 @@ #ifndef LMP_IMAGE_H #define LMP_IMAGE_H -#include "math.h" -#include "stdio.h" +#include <math.h> +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/improper.cpp b/src/improper.cpp index 643e7a63ff8e409a68444e1a43c4b8fe90e3b243..3b5453de59e100e136ee52f96f2386d20e0a5c7e 100644 --- a/src/improper.cpp +++ b/src/improper.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "improper.h" #include "atom.h" #include "comm.h" @@ -51,7 +51,7 @@ Improper::Improper(LAMMPS *lmp) : Pointers(lmp) /* ---------------------------------------------------------------------- */ Improper::~Improper() -{ +{ if (copymode) return; memory->destroy(eatom); @@ -64,7 +64,7 @@ Improper::~Improper() void Improper::init() { - if (!allocated && atom->nimpropertypes) + if (!allocated && atom->nimpropertypes) error->all(FLERR,"Improper coeffs are not set"); for (int i = 1; i <= atom->nimpropertypes; i++) if (setflag[i] == 0) error->all(FLERR,"All improper coeffs are not set"); diff --git a/src/improper.h b/src/improper.h index 039da0ab84099a74d4b5698b887012f78be5b851..5e0b525b6d7c8445b230b671ea5e0fcacc2fc7b1 100644 --- a/src/improper.h +++ b/src/improper.h @@ -14,7 +14,7 @@ #ifndef LMP_IMPROPER_H #define LMP_IMPROPER_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 140bd2e9dccda1d80420ee255f792ece5bd3be44..1a2a0bdc5095870c9dc5ffcac81807af85babb59 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "ctype.h" +#include <math.h> +#include <string.h> +#include <ctype.h> #include "improper_hybrid.h" #include "atom.h" #include "neighbor.h" diff --git a/src/improper_hybrid.h b/src/improper_hybrid.h index 4429ce9c6ef8443a98368f694b5e87399c5ecdd7..cab5184891af7aece62a4e86039af15a9c91d554 100644 --- a/src/improper_hybrid.h +++ b/src/improper_hybrid.h @@ -20,7 +20,7 @@ ImproperStyle(hybrid,ImproperHybrid) #ifndef LMP_IMPROPER_HYBRID_H #define LMP_IMPROPER_HYBRID_H -#include "stdio.h" +#include <stdio.h> #include "improper.h" namespace LAMMPS_NS { diff --git a/src/info.cpp b/src/info.cpp index 1eba5a8b92832989be86d036c858b62d335d198d..e2f3eab9925272ac0787221a396d9c1df79053b6 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "info.h" #include "accelerator_cuda.h" #include "accelerator_kokkos.h" @@ -243,7 +243,7 @@ void Info::command(int narg, char **arg) fprintf(out,"\nCommunication information:\n"); fprintf(out,"MPI library level: MPI v%d.%d\n",major,minor); fprintf(out,"Comm style = %s, Comm layout = %s\n", - commstyles[comm->style], commlayout[comm->layout]); + commstyles[comm->style], commlayout[comm->layout]); fprintf(out,"Communicate velocities for ghost atoms = %s\n", comm->ghost_velocity ? "yes" : "no"); diff --git a/src/input.cpp b/src/input.cpp index b048389c3ce77837c9da4505de9e15bfbc3ff130..a38e91b2d47d36a5693f61c3b65b9dfaf27aacbb 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -11,13 +11,13 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" -#include "errno.h" -#include "ctype.h" -#include "unistd.h" +#include <mpi.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <ctype.h> +#include <unistd.h> #include "sys/stat.h" #include "input.h" #include "style_command.h" @@ -52,7 +52,7 @@ #include "memory.h" #ifdef _OPENMP -#include "omp.h" +#include <omp.h> #endif #ifdef _WIN32 @@ -151,13 +151,13 @@ Input::~Input() void Input::file() { int m,n; - + while (1) { - + // read a line from input script // n = length of line including str terminator, 0 if end of file // if line ends in continuation char '&', concatenate next line - + if (me == 0) { m = 0; while (1) { @@ -165,7 +165,7 @@ void Input::file() // end of file reached, so break // n == 0 if nothing read, else n = line with str terminator - + if (fgets(&line[m],maxline-m,infile) == NULL) { if (m) n = strlen(line) + 1; else n = 0; @@ -195,13 +195,13 @@ void Input::file() } } } - + // bcast the line // if n = 0, end-of-file // error if label_active is set, since label wasn't encountered // if original input file, code is done // else go back to previous input file - + MPI_Bcast(&n,1,MPI_INT,0,world); if (n == 0) { if (label_active) error->all(FLERR,"Label wasn't found in input script"); @@ -217,29 +217,29 @@ void Input::file() if (me == 0) infile = infiles[nfile-1]; continue; } - + if (n > maxline) reallocate(line,maxline,n); MPI_Bcast(line,n,MPI_CHAR,0,world); - + // echo the command unless scanning for label - + if (me == 0 && label_active == 0) { if (echo_screen && screen) fprintf(screen,"%s\n",line); if (echo_log && logfile) fprintf(logfile,"%s\n",line); } - + // parse the line // if no command, skip to next line in input script - + parse(); if (command == NULL) continue; - + // if scanning for label, skip command unless it's a label command - + if (label_active && strcmp(command,"label") != 0) continue; - + // execute the command - + if (execute_command()) { char *str = new char[maxline+32]; sprintf(str,"Unknown command: %s",line); @@ -263,7 +263,7 @@ void Input::file(const char *filename) if (nfile > 1) error->one(FLERR,"Invalid use of library file() function"); - if (infile && infile != stdin) fclose(infile); + if (infile && infile != stdin) fclose(infile); infile = fopen(filename,"r"); if (infile == NULL) { char str[128]; @@ -273,7 +273,7 @@ void Input::file(const char *filename) infiles[0] = infile; nfile = 1; } - + file(); } @@ -287,32 +287,32 @@ char *Input::one(const char *single) int n = strlen(single) + 1; if (n > maxline) reallocate(line,maxline,n); strcpy(line,single); - + // echo the command unless scanning for label - + if (me == 0 && label_active == 0) { if (echo_screen && screen) fprintf(screen,"%s\n",line); if (echo_log && logfile) fprintf(logfile,"%s\n",line); } - + // parse the line // if no command, just return NULL - + parse(); if (command == NULL) return NULL; - + // if scanning for label, skip command unless it's a label command - + if (label_active && strcmp(command,"label") != 0) return NULL; - + // execute the command and return its name - + if (execute_command()) { char *str = new char[maxline+32]; sprintf(str,"Unknown command: %s",line); error->all(FLERR,str); } - + return command; } @@ -329,11 +329,11 @@ char *Input::one(const char *single) void Input::parse() { // duplicate line into copy string to break into words - + int n = strlen(line) + 1; if (n > maxcopy) reallocate(copy,maxcopy,n); strcpy(copy,line); - + // strip any # comment by replacing it with 0 // do not strip from a # inside single/double/triple quotes // quoteflag = 1,2,3 when encounter first single/double,triple quote @@ -363,22 +363,22 @@ void Input::parse() } ptr++; } - + // perform $ variable substitution (print changes) // except if searching for a label since earlier variable may not be defined - + if (!label_active) substitute(copy,work,maxcopy,maxwork,1); - + // command = 1st arg in copy string - + char *next; command = nextword(copy,&next); if (command == NULL) return; - + // point arg[] at each subsequent arg in copy string // nextword() inserts string terminators into copy string to delimit args // nextword() treats text between single/double/triple quotes as one arg - + narg = 0; ptr = next; while (ptr) { @@ -407,12 +407,12 @@ void Input::parse() char *Input::nextword(char *str, char **next) { char *start,*stop; - + // start = first non-whitespace char start = &str[strspn(str," \t\n\v\f\r")]; if (*start == '\0') return NULL; - + // if start is single/double/triple quote: // start = first char beyond quote // stop = first char of matching quote @@ -464,45 +464,45 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // if $ is followed by '{', trailing '}' becomes NULL // else $x becomes x followed by NULL // beyond = points to text following variable - + int i,n,paren_count; char immediate[256]; char *var,*value,*beyond; int quoteflag = 0; char *ptr = str; - + n = strlen(str) + 1; if (n > max2) reallocate(str2,max2,n); *str2 = '\0'; char *ptr2 = str2; - + while (*ptr) { // variable substitution - + if (*ptr == '$' && !quoteflag) { // value = ptr to expanded variable // variable name between curly braces, e.g. ${a} - + if (*(ptr+1) == '{') { var = ptr+2; i = 0; - + while (var[i] != '\0' && var[i] != '}') i++; - + if (var[i] == '\0') error->one(FLERR,"Invalid variable name"); var[i] = '\0'; beyond = ptr + strlen(var) + 3; value = variable->retrieve(var); - + // immediate variable between parenthesis, e.g. $(1/2) - + } else if (*(ptr+1) == '(') { var = ptr+2; paren_count = 0; i = 0; - + while (var[i] != '\0' && !(var[i] == ')' && paren_count == 0)) { switch (var[i]) { case '(': paren_count++; break; @@ -511,15 +511,15 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) } i++; } - + if (var[i] == '\0') error->one(FLERR,"Invalid immediate variable"); var[i] = '\0'; beyond = ptr + strlen(var) + 3; sprintf(immediate,"%.20g",variable->compute_equal(var)); value = immediate; - + // single character variable name, e.g. $a - + } else { var = ptr; var[0] = var[1]; @@ -527,25 +527,25 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) beyond = ptr + 2; value = variable->retrieve(var); } - + if (value == NULL) error->one(FLERR,"Substitution for illegal variable"); - + // check if storage in str2 needs to be expanded // re-initialize ptr and ptr2 to the point beyond the variable. - + n = strlen(str2) + strlen(value) + strlen(beyond) + 1; if (n > max2) reallocate(str2,max2,n); strcat(str2,value); ptr2 = str2 + strlen(str2); ptr = beyond; - + // output substitution progress if requested - + if (flag && me == 0 && label_active == 0) { if (echo_screen && screen) fprintf(screen,"%s%s\n",str2,beyond); if (echo_log && logfile) fprintf(logfile,"%s%s\n",str2,beyond); } - + continue; } @@ -558,7 +558,7 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) quoteflag = 3; *ptr2++ = *ptr++; *ptr2++ = *ptr++; - } + } else if (*ptr == '"') quoteflag = 2; else if (*ptr == '\'') quoteflag = 1; } else { @@ -572,14 +572,14 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) } // copy current character into str2 - + *ptr2++ = *ptr++; *ptr2 = '\0'; } - + // set length of input str to length of work str2 // copy work string back to input str - + if (max2 > max) reallocate(str,max,max2); strcpy(str,str2); } @@ -610,7 +610,7 @@ void Input::reallocate(char *&str, int &max, int n) if (n) { while (n > max) max += DELTALINE; } else max += DELTALINE; - + str = (char *) memory->srealloc(str,max*sizeof(char),"input:str"); } @@ -622,7 +622,7 @@ void Input::reallocate(char *&str, int &max, int n) int Input::execute_command() { int flag = 1; - + if (!strcmp(command,"clear")) clear(); else if (!strcmp(command,"echo")) echo(); else if (!strcmp(command,"if")) ifthenelse(); @@ -637,7 +637,7 @@ int Input::execute_command() else if (!strcmp(command,"quit")) quit(); else if (!strcmp(command,"shell")) shell(); else if (!strcmp(command,"variable")) variable_command(); - + else if (!strcmp(command,"angle_coeff")) angle_coeff(); else if (!strcmp(command,"angle_style")) angle_style(); else if (!strcmp(command,"atom_modify")) atom_modify(); @@ -692,23 +692,23 @@ int Input::execute_command() else if (!strcmp(command,"undump")) undump(); else if (!strcmp(command,"unfix")) unfix(); else if (!strcmp(command,"units")) units(); - + else flag = 0; - + // return if command was listed above - + if (flag) return 0; - + // invoke commands added via style_command.h - + if (command_map->find(command) != command_map->end()) { CommandCreator command_creator = (*command_map)[command]; command_creator(lmp,narg,arg); return 0; } - + // unrecognized command - + return -1; } @@ -885,7 +885,7 @@ void Input::include() // NOTE: this check will fail if a 2nd if command was inside the if command // and came before the include - if (ifthenelse_flag) + if (ifthenelse_flag) error->all(FLERR,"Cannot use include command within an if command"); if (me == 0) { @@ -1165,7 +1165,7 @@ void Input::shell() for (int i = 1; i < narg; i++) { char *ptr = strdup(arg[i]); rv = 0; -#ifdef _WIN32 +#ifdef _WIN32 if (ptr != NULL) rv = _putenv(ptr); #else if (ptr != NULL) rv = putenv(ptr); diff --git a/src/input.h b/src/input.h index f03655657ccf3df5be0d36a5f1afd71227a6d20f..37a6cf240915ec11c4ac38e4bef27f18a5414769 100644 --- a/src/input.h +++ b/src/input.h @@ -14,7 +14,7 @@ #ifndef LMP_INPUT_H #define LMP_INPUT_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" #include <map> #include <string> @@ -33,7 +33,7 @@ class Input : protected Pointers { void file(); // process all input void file(const char *); // process an input script char *one(const char *); // process a single command - void substitute(char *&, char *&, int &, int &, int); + void substitute(char *&, char *&, int &, int &, int); // substitute for variables in a string private: diff --git a/src/integrate.cpp b/src/integrate.cpp index 429659b6e1f6774de0787abf35d01d1b1f359e4d..b825a197847bf52112f45076b6c5358f8265fae8 100644 --- a/src/integrate.cpp +++ b/src/integrate.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "integrate.h" #include "update.h" #include "force.h" diff --git a/src/irregular.cpp b/src/irregular.cpp index d90df8f122d4d7af99cc3b8fd0a5d9d08c15180e..3947001541f2fa629703768aa56fa0e305a13b77 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <stdlib.h> +#include <string.h> #include "irregular.h" #include "atom.h" #include "atom_vec.h" @@ -313,7 +313,7 @@ int Irregular::create_atom(int n, int *sizes, int *proclist, int sortflag) #ifdef LAMMPS_RS_ALLREDUCE_INPLACE MPI_Allreduce(MPI_IN_PLACE,work1,nprocs,MPI_INT,MPI_SUM,world); nrecv_proc = work1[me]; -#else +#else #ifdef LAMMPS_RS_ALLREDUCE MPI_Allreduce(work1,work2,nprocs,MPI_INT,MPI_SUM,world); nrecv_proc = work2[me]; @@ -559,7 +559,7 @@ int Irregular::create_data(int n, int *proclist, int sortflag) #ifdef LAMMPS_RS_ALLREDUCE_INPLACE MPI_Allreduce(MPI_IN_PLACE,work1,nprocs,MPI_INT,MPI_SUM,world); nrecv_proc = work1[me]; -#else +#else #ifdef LAMMPS_RS_ALLREDUCE MPI_Allreduce(work1,work2,nprocs,MPI_INT,MPI_SUM,world); nrecv_proc = work2[me]; diff --git a/src/irregular.h b/src/irregular.h index fe5b80a04b2fc09e96011bb3b4cb4b218d0a9abd..ea0fee2eb83c4c3d0002633a362292d36a92757e 100644 --- a/src/irregular.h +++ b/src/irregular.h @@ -72,7 +72,7 @@ class Irregular : protected Pointers { int *length_recv; // # of doubles to recv from each proc int *offset_send; // where each atom starts in send buffer - // extra plan params plan for irregular communication of datums + // extra plan params plan for irregular communication of datums // 2 self params refer to data copied to self int *num_recv; // # of datums to recv from each proc diff --git a/src/kspace.cpp b/src/kspace.cpp index 16ed8be14b8912a7f4b1bb33e61b1b9a6aeb93f2..8724ca255960f36f1ad0b2c017833db3020ddb1c 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "kspace.h" #include "atom.h" #include "comm.h" @@ -394,7 +394,7 @@ void KSpace::lamda2xvector(double *lamda, double *v) /* ---------------------------------------------------------------------- convert a sphere in box coords to an ellipsoid in lamda (0-1) - coords and return the tight (axis-aligned) bounding box, does not + coords and return the tight (axis-aligned) bounding box, does not preserve vector magnitude see http://www.loria.fr/~shornus/ellipsoid-bbox.html and http://yiningkarlli.blogspot.com/2013/02/ @@ -412,7 +412,7 @@ void KSpace::kspacebbox(double r, double *b) xz = h[4]; xy = h[5]; - b[0] = r*sqrt(ly*ly*lz*lz + ly*ly*xz*xz - 2.0*ly*xy*xz*yz + lz*lz*xy*xy + + b[0] = r*sqrt(ly*ly*lz*lz + ly*ly*xz*xz - 2.0*ly*xy*xz*yz + lz*lz*xy*xy + xy*xy*yz*yz)/(lx*ly*lz); b[1] = r*sqrt(lz*lz + yz*yz)/(ly*lz); b[2] = r/lz; @@ -551,7 +551,7 @@ void KSpace::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],"eigtol") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); splittol = atof(arg[iarg+1]); - if (splittol >= 1.0) + if (splittol >= 1.0) error->all(FLERR,"Kspace_modify eigtol must be smaller than one"); iarg += 2; } else if (strcmp(arg[iarg],"pressure/scalar") == 0) { diff --git a/src/kspace.h b/src/kspace.h index fe46ae2d4b9b3e46a9b3d4e37d6951f9fd448d7c..5519a8c56f86fe19c893c819de422de8144d648e 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -45,9 +45,9 @@ class KSpace : protected Pointers { int tip4pflag; // 1 if a TIP4P solver int dipoleflag; // 1 if a dipole solver int differentiation_flag; - int neighrequest_flag; // used to avoid obsolete construction + int neighrequest_flag; // used to avoid obsolete construction // of neighbor lists - int mixflag; // 1 if geometric mixing rules are enforced + int mixflag; // 1 if geometric mixing rules are enforced // for LJ coefficients int slabflag; int scalar_pressure_flag; // 1 if using MSM fast scalar pressure @@ -64,9 +64,9 @@ class KSpace : protected Pointers { double accuracy_absolute; // user-specifed accuracy in force units double accuracy_relative; // user-specified dimensionless accuracy // accurary = acc_rel * two_charge_force - double accuracy_real_6; // real space accuracy for + double accuracy_real_6; // real space accuracy for // dispersion solver (force units) - double accuracy_kspace_6; // reciprocal space accuracy for + double accuracy_kspace_6; // reciprocal space accuracy for // dispersion solver (force units) int auto_disp_flag; // use automatic paramter generation for pppm/disp double two_charge_force; // force in user units of two point @@ -134,7 +134,7 @@ class KSpace : protected Pointers { see Eq 4 from Parallel Computing 35 (2009) 164–177 ------------------------------------------------------------------------- */ - double gamma(const double &rho) const + double gamma(const double &rho) const { if (rho <= 1.0) { const int split_order = order/2; @@ -154,7 +154,7 @@ class KSpace : protected Pointers { see Eq 4 from Parallel Computing 35 (2009) 164-177 ------------------------------------------------------------------------- */ - double dgamma(const double &rho) const + double dgamma(const double &rho) const { if (rho <= 1.0) { const int split_order = order/2; @@ -168,7 +168,7 @@ class KSpace : protected Pointers { return dg; } else return (-1.0/rho/rho); } - + double **get_gcons() { return gcons; } double **get_dgcons() { return dgcons; } diff --git a/src/lammps.cpp b/src/lammps.cpp index 95d925b6cbd64cd41f0c9acc17e68abfe7d1f5ce..bb1f0e507cf3d79ac0eaadffca47a7e9a33c1f00 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "ctype.h" +#include <mpi.h> +#include <string.h> +#include <ctype.h> #include "lammps.h" #include "style_angle.h" #include "style_atom.h" @@ -455,24 +455,24 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) "lmptype.h are not compatible"); #ifdef LAMMPS_SMALLBIG - if (sizeof(smallint) != 4 || sizeof(imageint) != 4 || + if (sizeof(smallint) != 4 || sizeof(imageint) != 4 || sizeof(tagint) != 4 || sizeof(bigint) != 8) error->all(FLERR,"Small to big integers are not sized correctly"); #endif #ifdef LAMMPS_BIGBIG - if (sizeof(smallint) != 4 || sizeof(imageint) != 8 || + if (sizeof(smallint) != 4 || sizeof(imageint) != 8 || sizeof(tagint) != 8 || sizeof(bigint) != 8) error->all(FLERR,"Small to big integers are not sized correctly"); #endif #ifdef LAMMPS_SMALLSMALL - if (sizeof(smallint) != 4 || sizeof(imageint) != 4 || + if (sizeof(smallint) != 4 || sizeof(imageint) != 4 || sizeof(tagint) != 4 || sizeof(bigint) != 4) error->all(FLERR,"Small to big integers are not sized correctly"); #endif // error check on accelerator packages - if (cudaflag == 1 && kokkosflag == 1) + if (cudaflag == 1 && kokkosflag == 1) error->all(FLERR,"Cannot use -cuda on and -kokkos on together"); // create Cuda class if USER-CUDA installed, unless explicitly switched off @@ -696,7 +696,7 @@ void LAMMPS::post_create() error->all(FLERR,"Using suffix gpu without GPU package installed"); if (strcmp(suffix,"intel") == 0 && !modify->check_package("INTEL")) error->all(FLERR,"Using suffix intel without USER-INTEL package installed"); - if (strcmp(suffix,"kk") == 0 && + if (strcmp(suffix,"kk") == 0 && (kokkos == NULL || kokkos->kokkos_exists == 0)) error->all(FLERR,"Using suffix kk without KOKKOS package enabled"); if (strcmp(suffix,"omp") == 0 && !modify->check_package("OMP")) @@ -810,12 +810,12 @@ void LAMMPS::help() "-partition size1 size2 ... : assign partition sizes (-p)\n" "-plog basename : basename for partition logs (-pl)\n" "-pscreen basename : basename for partition screens (-ps)\n" - "-restart rfile dfile ... : convert restart to data file (-r)\n" + "-restart rfile dfile ... : convert restart to data file (-r)\n" "-reorder topology-specs : processor reordering (-r)\n" "-screen none/filename : where to send screen output (-sc)\n" "-suffix cuda/gpu/opt/omp : style suffix to apply (-sf)\n" "-var varname value : set index style variable (-v)\n\n"); - + fprintf(screen,"Style options compiled with this executable\n\n"); int pos = 80; @@ -941,7 +941,7 @@ void LAMMPS::print_style(const char *str, int &pos) if (isupper(str[0])) return; int len = strlen(str); - if (pos+len > 80) { + if (pos+len > 80) { fprintf(screen,"\n"); pos = 0; } diff --git a/src/lammps.h b/src/lammps.h index 53848b1010c58d8b5863a71f80e9ddf5b6ec114c..88449a4d88c49c325a905e0f3300d05e71411ab3 100644 --- a/src/lammps.h +++ b/src/lammps.h @@ -14,7 +14,7 @@ #ifndef LMP_LAMMPS_H #define LMP_LAMMPS_H -#include "stdio.h" +#include <stdio.h> namespace LAMMPS_NS { diff --git a/src/lattice.cpp b/src/lattice.cpp index e5081d75f7f0b1b1283c46ca4f197cbd31c895e6..e851760792fd13a12345dca74ec532739f6b1681 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" -#include "stdlib.h" +#include <math.h> +#include <string.h> +#include <stdlib.h> #include "lattice.h" #include "update.h" #include "domain.h" diff --git a/src/library.cpp b/src/library.cpp index ea3c66398a970b667f2abd6848c9c0adae1e74dc..f6d9b621d19477a332af7c69124b94cdcc2649aa 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -14,9 +14,9 @@ // C or Fortran style library interface to LAMMPS // customize by adding new LAMMPS-specific functions -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "library.h" #include "lammps.h" #include "universe.h" @@ -405,7 +405,7 @@ int lammps_get_natoms(void *ptr) data must be pre-allocated by caller to correct length ------------------------------------------------------------------------- */ -void lammps_gather_atoms(void *ptr, char *name, +void lammps_gather_atoms(void *ptr, char *name, int type, int count, void *data) { LAMMPS *lmp = (LAMMPS *) ptr; diff --git a/src/library.h b/src/library.h index a01d593b2119aba2b0ccba5cc7aa62341a26326c..3bdeddbac4997a93e329dee78e843221789ce01e 100644 --- a/src/library.h +++ b/src/library.h @@ -16,7 +16,7 @@ new LAMMPS-specific functions can be added */ -#include "mpi.h" +#include <mpi.h> /* ifdefs allow this file to be included in a C program */ diff --git a/src/lmptype.h b/src/lmptype.h index 87b7da51ed076cc0472c113c90d74bffdc976b95..7a63ee4e5352fd2b9c68f54772820e2e6eb34eb1 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -36,9 +36,9 @@ #define __STDC_FORMAT_MACROS #endif -#include "limits.h" -#include "stdint.h" -#include "inttypes.h" +#include <limits.h> +#include <stdint.h> +#include <inttypes.h> // grrr - IBM Power6 does not provide this def in their system header files diff --git a/src/lmpwindows.h b/src/lmpwindows.h index 419aa9aff5f040807af862b2a49bdcf9506c35c4..d20d0f87baa274d29a5be8610f4f34f15826d018 100644 --- a/src/lmpwindows.h +++ b/src/lmpwindows.h @@ -2,8 +2,8 @@ #if !defined(__MINGW32__) #include "erf.h" #endif -#include "direct.h" -#include "math.h" +#include <direct.h> +#include <math.h> // LAMMPS uses usleep with 100 ms arguments, no microsecond precision needed #if !defined(__MINGW32__) #include "sleep.h" diff --git a/src/main.cpp b/src/main.cpp index d85a79d83137b78818594ca6e34b0f26fc377305..fdf7a791d0c6229c8ffd33be31aea9d878941ff6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" +#include <mpi.h> #include "lammps.h" #include "input.h" -#include "stdio.h" +#include <stdio.h> using namespace LAMMPS_NS; diff --git a/src/math_extra.cpp b/src/math_extra.cpp index eb2afcea2c280f1fec4fd008c8b9ac154bee6a14..0b33fc59c129aea0525fa68d92a2ade8e91aaee4 100644 --- a/src/math_extra.cpp +++ b/src/math_extra.cpp @@ -15,8 +15,8 @@ Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "math_extra.h" #define MAXJACOBI 50 @@ -230,7 +230,7 @@ void richardson(double *q, double *m, double *w, double *moments, double dtq) apply evolution operators to quat, quat momentum Miller et al., J Chem Phys. 116, 8649-8659 (2002) ------------------------------------------------------------------------- */ -void no_squish_rotate(int k, double *p, double *q, double *inertia, +void no_squish_rotate(int k, double *p, double *q, double *inertia, double dt) { double phi,c_phi,s_phi,kp[4],kq[4]; diff --git a/src/math_extra.h b/src/math_extra.h index f676cee2ba8d6dc6503b6ec7d43b84c5b06c8dcb..f768715ca037527055055041d5882ca1f1a14bc5 100755 --- a/src/math_extra.h +++ b/src/math_extra.h @@ -18,9 +18,9 @@ #ifndef LMP_MATH_EXTRA_H #define LMP_MATH_EXTRA_H -#include "math.h" -#include "stdio.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <string.h> #include "error.h" namespace MathExtra { diff --git a/src/math_vector.h b/src/math_vector.h index 000c2fc07fd013d0ccd402601d3d9a8f722b6d80..9304cf0804d1133fcf33f7d61ce1941ba2cb802b 100644 --- a/src/math_vector.h +++ b/src/math_vector.h @@ -18,8 +18,8 @@ #ifndef LMP_MATH_VECTOR_H #define LMP_MATH_VECTOR_H -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #define VECTOR_NULL {0, 0, 0} #define SHAPE_NULL {0, 0, 0, 0, 0, 0} diff --git a/src/memory.cpp b/src/memory.cpp index b8f71016e037bf54bfdd7ec0b8e000935dac4d0a..c3ec21565bd65a46d416e4823469ad646bd2b2ca 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "memory.h" #include "error.h" diff --git a/src/memory.h b/src/memory.h index b5dcd610b001602bb6e11a5c0385d10b89251bd3..b83482e4c2b69c9d11259e7c5d1ea73ba7ba077b 100644 --- a/src/memory.h +++ b/src/memory.h @@ -44,7 +44,7 @@ class Memory : protected Pointers { /* ---------------------------------------------------------------------- create/grow/destroy vecs and multidim arrays with contiguous memory blocks only use with primitive data types, e.g. 1d vec of ints, 2d array of doubles - fail() prevents use with pointers, + fail() prevents use with pointers, e.g. 1d vec of int*, due to mismatched destroy avoid use with non-primitive data types to avoid code bloat for these other cases, use smalloc/srealloc/sfree directly @@ -63,7 +63,7 @@ class Memory : protected Pointers { } template <typename TYPE> - TYPE **create(TYPE **&array, int n, const char *name) + TYPE **create(TYPE **&array, int n, const char *name) {fail(name); return NULL;} /* ---------------------------------------------------------------------- @@ -134,7 +134,7 @@ class Memory : protected Pointers { TYPE *data = (TYPE *) smalloc(nbytes,name); nbytes = ((bigint) sizeof(TYPE *)) * n1; array = (TYPE **) smalloc(nbytes,name); - + bigint n = 0; for (int i = 0; i < n1; i++) { array[i] = &data[n]; @@ -156,12 +156,12 @@ class Memory : protected Pointers { TYPE **grow(TYPE **&array, int n1, int n2, const char *name) { if (array == NULL) return create(array,n1,n2,name); - + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2; TYPE *data = (TYPE *) srealloc(array[0],nbytes,name); nbytes = ((bigint) sizeof(TYPE *)) * n1; array = (TYPE **) srealloc(array,nbytes,name); - + bigint n = 0; for (int i = 0; i < n1; i++) { array[i] = &data[n]; @@ -169,11 +169,11 @@ class Memory : protected Pointers { } return array; } - + template <typename TYPE> TYPE ***grow(TYPE ***&array, int n1, int n2, const char *name) {fail(name); return NULL;} - + /* ---------------------------------------------------------------------- destroy a 2d array ------------------------------------------------------------------------- */ @@ -196,12 +196,12 @@ class Memory : protected Pointers { { bigint n2sum = 0; for (int i = 0; i < n1; i++) n2sum += n2[i]; - + bigint nbytes = ((bigint) sizeof(TYPE)) * n2sum; TYPE *data = (TYPE *) smalloc(nbytes,name); nbytes = ((bigint) sizeof(TYPE *)) * n1; array = (TYPE **) smalloc(nbytes,name); - + bigint n = 0; for (int i = 0; i < n1; i++) { array[i] = &data[n]; @@ -209,11 +209,11 @@ class Memory : protected Pointers { } return array; } - + template <typename TYPE> TYPE ***create_ragged(TYPE ***&array, int n1, int *n2, const char *name) {fail(name); return NULL;} - + /* ---------------------------------------------------------------------- create a 2d array with 2nd index from n2lo to n2hi inclusive cannot grow it @@ -228,15 +228,15 @@ class Memory : protected Pointers { for (int i = 0; i < n1; i++) array[i] -= n2lo; return array; } - + template <typename TYPE> TYPE ***create2d_offset(TYPE ***&array, int n1, int n2lo, int n2hi, const char *name) {fail(name); return NULL;} - + /* ---------------------------------------------------------------------- destroy a 2d array with 2nd index offset ------------------------------------------------------------------------- */ - + template <typename TYPE> void destroy2d_offset(TYPE **&array, int offset) { @@ -245,7 +245,7 @@ class Memory : protected Pointers { sfree(array); array = NULL; } - + /* ---------------------------------------------------------------------- create a 3d array ------------------------------------------------------------------------- */ @@ -259,7 +259,7 @@ class Memory : protected Pointers { TYPE **plane = (TYPE **) smalloc(nbytes,name); nbytes = ((bigint) sizeof(TYPE **)) * n1; array = (TYPE ***) smalloc(nbytes,name); - + int i,j; bigint m; bigint n = 0; @@ -287,14 +287,14 @@ class Memory : protected Pointers { TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name) { if (array == NULL) return create(array,n1,n2,n3,name); - + bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; TYPE *data = (TYPE *) srealloc(array[0][0],nbytes,name); nbytes = ((bigint) sizeof(TYPE *)) * n1*n2; TYPE **plane = (TYPE **) srealloc(array[0],nbytes,name); nbytes = ((bigint) sizeof(TYPE **)) * n1; array = (TYPE ***) srealloc(array,nbytes,name); - + int i,j; bigint m; bigint n = 0; @@ -308,7 +308,7 @@ class Memory : protected Pointers { } return array; } - + template <typename TYPE> TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, const char *name) {fail(name); return NULL;} @@ -341,7 +341,7 @@ class Memory : protected Pointers { array -= n1lo; return array; } - + template <typename TYPE> TYPE ****create3d_offset(TYPE ****&array, int n1lo, int n1hi, int n2, int n3, const char *name) @@ -378,14 +378,14 @@ class Memory : protected Pointers { int n2 = n2hi - n2lo + 1; int n3 = n3hi - n3lo + 1; create(array,n1,n2,n3,name); - + bigint m = ((bigint) n1) * n2; for (bigint i = 0; i < m; i++) array[0][i] -= n3lo; for (int i = 0; i < n1; i++) array[i] -= n2lo; array -= n1lo; return array; } - + template <typename TYPE> TYPE ****create3d_offset(TYPE ****&array, int n1lo, int n1hi, int n2lo, int n2hi, int n3lo, int n3hi, @@ -406,7 +406,7 @@ class Memory : protected Pointers { sfree(&array[n1_offset]); array = NULL; } - + /* ---------------------------------------------------------------------- create a 4d array ------------------------------------------------------------------------- */ @@ -443,7 +443,7 @@ class Memory : protected Pointers { } return array; } - + template <typename TYPE> TYPE *****create(TYPE *****&array, int n1, int n2, int n3, int n4, const char *name) @@ -481,7 +481,7 @@ class Memory : protected Pointers { int n3 = n3hi - n3lo + 1; int n4 = n4hi - n4lo + 1; create(array,n1,n2,n3,n4,name); - + bigint m = ((bigint) n1) * n2 * n3; for (bigint i = 0; i < m; i++) array[0][0][i] -= n4lo; m = ((bigint) n1) * n2; @@ -489,19 +489,19 @@ class Memory : protected Pointers { for (int i = 0; i < n1; i++) array[i] -= n2lo; return array; } - + template <typename TYPE> TYPE ****create4d_offset(TYPE *****&array, int n1, int n2lo, int n2hi, int n3lo, int n3hi, int n4lo, int n4hi, const char *name) {fail(name); return NULL;} - + /* ---------------------------------------------------------------------- free a 4d array with indices 2,3, and 4 offset ------------------------------------------------------------------------- */ template <typename TYPE> - void destroy4d_offset(TYPE ****&array, + void destroy4d_offset(TYPE ****&array, int n2_offset, int n3_offset, int n4_offset) { if (array == NULL) return; @@ -530,7 +530,7 @@ class Memory : protected Pointers { TYPE ****level2 = (TYPE ****) smalloc(nbytes,name); nbytes = ((bigint) sizeof(TYPE ****)) * n1; array = (TYPE *****) smalloc(nbytes,name); - + int i,j,k,l; bigint m1,m2; bigint n = 0; @@ -557,7 +557,7 @@ class Memory : protected Pointers { } return array; } - + template <typename TYPE> TYPE ******create(TYPE ******&array, int n1, int n2, int n3, int n4, int n5, const char *name) @@ -578,7 +578,7 @@ class Memory : protected Pointers { sfree(array); array = NULL; } - + /* ---------------------------------------------------------------------- memory usage of arrays, including pointers ------------------------------------------------------------------------- */ @@ -590,7 +590,7 @@ class Memory : protected Pointers { bigint bytes = ((bigint) sizeof(TYPE)) * n; return bytes; } - + template <typename TYPE> bigint usage(TYPE **array, int n1, int n2) { @@ -599,7 +599,7 @@ class Memory : protected Pointers { bytes += ((bigint) sizeof(TYPE *)) * n1; return bytes; } - + template <typename TYPE> bigint usage(TYPE ***array, int n1, int n2, int n3) { @@ -609,7 +609,7 @@ class Memory : protected Pointers { bytes += ((bigint) sizeof(TYPE **)) * n1; return bytes; } - + template <typename TYPE> bigint usage(TYPE ****array, int n1, int n2, int n3, int n4) { diff --git a/src/min.cpp b/src/min.cpp index 7588211a8c9f9b10bd736542c8ffc6ce861a8159..f447cf34295514caf8408a19d240611931155bd8 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -19,9 +19,9 @@ JR Shewchuk, http://www-2.cs.cmu.edu/~jrs/jrspapers.html#cg ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "min.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/min_cg.cpp b/src/min_cg.cpp index af3ef5b7a4ea5b24f7395c1e12a3462e3e4aaf3b..9bf41d16877dfe90e06c33247e7cd844825dbf40 100644 --- a/src/min_cg.cpp +++ b/src/min_cg.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <string.h> #include "min_cg.h" #include "atom.h" #include "update.h" diff --git a/src/min_fire.cpp b/src/min_fire.cpp index 115e91e63cb6dbe7fce14a0c750432425d91fe1f..186c8232a826e45bf707fa8706f213e202587b7e 100644 --- a/src/min_fire.cpp +++ b/src/min_fire.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "min_fire.h" #include "universe.h" #include "atom.h" diff --git a/src/min_hftn.cpp b/src/min_hftn.cpp index cdd9bcda3bbeb36d6184b1e0ebe11bf516c8acc9..78dbe2836b122b0c0b88f3b6ddba82d5b2b54396 100644 --- a/src/min_hftn.cpp +++ b/src/min_hftn.cpp @@ -17,8 +17,8 @@ "Parallel Unconstrained Min", Plantenga, SAND98-8201 ------------------------------------------------------------------------- */ -#include "math.h" -#include "string.h" +#include <math.h> +#include <string.h> #include "atom.h" #include "fix_minimize.h" #include "min_hftn.h" diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index 1becb224fed3359e0dda1a15e8cde455ddf90801..3b5566e8971d4732a2d90cf0b3784d1081fba292 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -21,7 +21,7 @@ JR Shewchuk, http://www-2.cs.cmu.edu/~jrs/jrspapers.html#cg ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "min_linesearch.h" #include "atom.h" #include "update.h" diff --git a/src/min_quickmin.cpp b/src/min_quickmin.cpp index 84abf5487f10d10b2a6d1920ad32f01362324ca4..48aee919e3a7031509ce6ef813008ad17ea06e5a 100644 --- a/src/min_quickmin.cpp +++ b/src/min_quickmin.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" +#include <mpi.h> +#include <math.h> #include "min_quickmin.h" #include "universe.h" #include "atom.h" diff --git a/src/min_sd.cpp b/src/min_sd.cpp index 1394f379fa42f50ced8abb6367dc15df217cb78a..5f97a117e3f14e54a7c6d9ac4dc44b6e0b2be670 100644 --- a/src/min_sd.cpp +++ b/src/min_sd.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "mpi.h" +#include <math.h> +#include <mpi.h> #include "min_sd.h" #include "atom.h" #include "update.h" diff --git a/src/minimize.cpp b/src/minimize.cpp index 6483e100bfc10faf4e9f3b897c6a2fcee7ae2031..d8ac95926c4f2c66d220b3a4c9d53d8c55adc435 100644 --- a/src/minimize.cpp +++ b/src/minimize.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" +#include <stdlib.h> #include "minimize.h" #include "domain.h" #include "update.h" diff --git a/src/modify.cpp b/src/modify.cpp index 9ca992738aae2ed2fea8cb7f398f3cc1d2f86b07..ab4275e17df538c65cfcffe598f383c517034cc5 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "modify.h" #include "style_compute.h" #include "style_fix.h" @@ -231,7 +231,7 @@ void Modify::init() } for (i = 0; i < ncompute; i++) - if (!compute[i]->dynamic_group_allow && + if (!compute[i]->dynamic_group_allow && group->dynamic[compute[i]->igroup]) { char str[128]; sprintf(str,"Compute %s does not allow use of dynamic group",fix[i]->id); @@ -696,7 +696,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // since some fixes access domain settings in their constructor // MUST change NEXCEPT above when add new fix to this list - const char *exceptions[NEXCEPT] = + const char *exceptions[NEXCEPT] = {"GPU","OMP","INTEL","property/atom","cmap"}; if (domain->box_exist == 0) { @@ -731,7 +731,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) if (ifix < nfix) { newflag = 0; - + int match = 0; if (strcmp(arg[2],fix[ifix]->style) == 0) match = 1; if (!match && trysuffix && lmp->suffix_enable) { @@ -955,7 +955,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) } } - if (compute[ncompute] == NULL && + if (compute[ncompute] == NULL && compute_map->find(arg[2]) != compute_map->end()) { ComputeCreator compute_creator = (*compute_map)[arg[2]]; compute[ncompute] = compute_creator(lmp,narg,arg); @@ -989,7 +989,7 @@ void Modify::modify_compute(int narg, char **arg) int icompute; for (icompute = 0; icompute < ncompute; icompute++) if (strcmp(arg[0],compute[icompute]->id) == 0) break; - if (icompute == ncompute) + if (icompute == ncompute) error->all(FLERR,"Could not find compute_modify ID"); compute[icompute]->modify_params(narg-1,&arg[1]); diff --git a/src/modify.h b/src/modify.h index 12a475cf0b177e7f7685a60a3db4f249affeb40b..036776103704fda2bbb018cd72c6d7032c07692f 100644 --- a/src/modify.h +++ b/src/modify.h @@ -14,7 +14,7 @@ #ifndef LMP_MODIFY_H #define LMP_MODIFY_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" #include <map> #include <string> diff --git a/src/molecule.cpp b/src/molecule.cpp index 83157200eba2e9f3939fae24efeb16c9ee2c06ad..36239352a38e05012b5263c93a3b2f37178fa9fe 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "molecule.h" #include "atom.h" #include "atom_vec.h" @@ -35,7 +35,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : +Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : Pointers(lmp) { me = comm->me; @@ -68,8 +68,8 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : aoffset = force->inumeric(FLERR,arg[iarg+3]); doffset = force->inumeric(FLERR,arg[iarg+4]); ioffset = force->inumeric(FLERR,arg[iarg+5]); - if (toffset < 0 || boffset < 0 || aoffset < 0 || - doffset < 0 || ioffset < 0) + if (toffset < 0 || boffset < 0 || aoffset < 0 || + doffset < 0 || ioffset < 0) error->all(FLERR,"Illegal molecule command"); iarg += 6; } else if (strcmp(arg[iarg],"toff") == 0) { @@ -129,7 +129,7 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : if (me == 0) fclose(fp); // stats - + if (me == 0) { if (screen) fprintf(screen,"Read molecule %s:\n" @@ -336,10 +336,10 @@ void Molecule::compute_inertia() tensor[1][2] = tensor[2][1] = itensor[3]; tensor[0][2] = tensor[2][0] = itensor[4]; tensor[0][1] = tensor[1][0] = itensor[5]; - + if (MathExtra::jacobi(tensor,inertia,evectors)) error->all(FLERR,"Insufficient Jacobi rotations for rigid molecule"); - + ex[0] = evectors[0][0]; ex[1] = evectors[1][0]; ex[2] = evectors[2][0]; @@ -351,23 +351,23 @@ void Molecule::compute_inertia() ez[2] = evectors[2][2]; // if any principal moment < scaled EPSILON, set to 0.0 - + double max; max = MAX(inertia[0],inertia[1]); max = MAX(max,inertia[2]); - + if (inertia[0] < EPSILON*max) inertia[0] = 0.0; if (inertia[1] < EPSILON*max) inertia[1] = 0.0; if (inertia[2] < EPSILON*max) inertia[2] = 0.0; - + // enforce 3 evectors as a right-handed coordinate system // flip 3rd vector if needed - + MathExtra::cross3(ex,ey,cross); if (MathExtra::dot3(cross,ez) < 0.0) MathExtra::negate3(ez); - + // create quaternion - + MathExtra::exyz_to_q(ex,ey,ez,quat); // compute displacements in body frame defined by quat @@ -454,16 +454,16 @@ void Molecule::read(int flag) if (natoms < 1) error->all(FLERR,"No or invalid atom count in molecule file"); if (nbonds < 0) error->all(FLERR,"Invalid bond count in molecule file"); if (nangles < 0) error->all(FLERR,"Invalid angle count in molecule file"); - if (ndihedrals < 0) + if (ndihedrals < 0) error->all(FLERR,"Invalid dihedral count in molecule file"); - if (nimpropers < 0) + if (nimpropers < 0) error->all(FLERR,"Invalid improper count in molecule file"); // count = vector for tallying bonds,angles,etc per atom if (flag == 0) memory->create(count,natoms,"molecule:count"); else count = NULL; - + // grab keyword and skip next line parse_keyword(0,line,keyword); @@ -499,7 +499,7 @@ void Molecule::read(int flag) bondflag = tag_require = 1; bonds(flag,line); } else if (strcmp(keyword,"Angles") == 0) { - if (nangles == 0) + if (nangles == 0) error->all(FLERR,"Molecule file has angles but no nangles setting"); angleflag = tag_require = 1; angles(flag,line); @@ -529,20 +529,20 @@ void Molecule::read(int flag) } else if (strcmp(keyword,"Shake Atoms") == 0) { shakeatomflag = tag_require = 1; if (shaketypeflag) shakeflag = 1; - if (!shakeflagflag) + if (!shakeflagflag) error->all(FLERR,"Molecule file shake flags not before shake atoms"); if (flag) shakeatom_read(line); else skip_lines(natoms,line); } else if (strcmp(keyword,"Shake Bond Types") == 0) { shaketypeflag = 1; if (shakeatomflag) shakeflag = 1; - if (!shakeflagflag) + if (!shakeflagflag) error->all(FLERR,"Molecule file shake flags not before shake bonds"); if (flag) shaketype_read(line); else skip_lines(natoms,line); } else error->one(FLERR,"Unknown section in molecule file"); - + parse_keyword(1,line,keyword); } @@ -555,7 +555,7 @@ void Molecule::read(int flag) if (flag == 0) { if ((nspecialflag && !specialflag) || (!nspecialflag && specialflag)) error->all(FLERR,"Molecule file needs both Special Bond sections"); - if (specialflag && !bondflag) + if (specialflag && !bondflag) error->all(FLERR,"Molecule file has special flags but no bonds"); if ((shakeflagflag || shakeatomflag || shaketypeflag) && !shakeflag) error->all(FLERR,"Molecule file shake info is incomplete"); @@ -582,7 +582,7 @@ void Molecule::coords(char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 4) + if (nwords != 4) error->all(FLERR,"Invalid Coords section in molecule file"); } sscanf(line,"%d %lg %lg %lg",&tmp,&x[i][0],&x[i][1],&x[i][2]); @@ -593,7 +593,7 @@ void Molecule::coords(char *line) if (domain->dimension == 2) { for (int i = 0; i < natoms; i++) - if (x[i][2] != 0.0) + if (x[i][2] != 0.0) error->all(FLERR,"Molecule file z coord must be 0.0 for 2d"); } } @@ -610,7 +610,7 @@ void Molecule::types(char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 2) + if (nwords != 2) error->all(FLERR,"Invalid Types section in molecule file"); } sscanf(line,"%d %d",&tmp,&type[i]); @@ -636,7 +636,7 @@ void Molecule::charges(char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 2) + if (nwords != 2) error->all(FLERR,"Invalid Charges section in molecule file"); } sscanf(line,"%d %lg",&tmp,&q[i]); @@ -655,7 +655,7 @@ void Molecule::diameters(char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 2) + if (nwords != 2) error->all(FLERR,"Invalid Diameters section in molecule file"); } sscanf(line,"%d %lg",&tmp,&radius[i]); @@ -665,7 +665,7 @@ void Molecule::diameters(char *line) } for (int i = 0; i < natoms; i++) - if (radius[i] < 0.0) + if (radius[i] < 0.0) error->all(FLERR,"Invalid atom diameter in molecule file"); } @@ -680,7 +680,7 @@ void Molecule::masses(char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 2) + if (nwords != 2) error->all(FLERR,"Invalid Masses section in molecule file"); } sscanf(line,"%d %lg",&tmp,&rmass[i]); @@ -714,7 +714,7 @@ void Molecule::bonds(int flag, char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 4) + if (nwords != 4) error->all(FLERR,"Invalid Bonds section in molecule file"); } sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT, @@ -776,7 +776,7 @@ void Molecule::angles(int flag, char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 5) + if (nwords != 5) error->all(FLERR,"Invalid Angles section in molecule file"); } sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, @@ -852,10 +852,10 @@ void Molecule::dihedrals(int flag, char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 6) + if (nwords != 6) error->all(FLERR,"Invalid Dihedrals section in molecule file"); } - sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " + sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " ", &tmp,&itype,&atom1,&atom2,&atom3,&atom4); itype += doffset; @@ -943,10 +943,10 @@ void Molecule::impropers(int flag, char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 6) + if (nwords != 6) error->all(FLERR,"Invalid Impropers section in molecule file"); } - sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " + sscanf(line,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " ", &tmp,&itype,&atom1,&atom2,&atom3,&atom4); itype += ioffset; @@ -1028,7 +1028,7 @@ void Molecule::nspecial_read(int flag, char *line) readline(line); if (i == 0) { int nwords = atom->count_words(line); - if (nwords != 4) + if (nwords != 4) error->all(FLERR,"Invalid Special Bond Counts section in " "molecule file"); } @@ -1094,8 +1094,8 @@ void Molecule::special_generate() error->one(FLERR,"Molecule auto special bond generation overflow"); special[i][count[i]++] = atom2 + 1; special[atom2][count[atom2]++] = i + 1; - } - } + } + } } else { for (int i = 0; i < natoms; i++) { nspecial[i][0] = num_bond[i]; @@ -1104,7 +1104,7 @@ void Molecule::special_generate() atom2 = bond_atom[i][j]; if (count[atom1] >= maxspecial) error->one(FLERR,""); - special[i][count[atom1]++] = atom2; + special[i][count[atom1]++] = atom2; } } } @@ -1129,15 +1129,15 @@ void Molecule::special_generate() error->one(FLERR,""); special[i][count[i]++] = special[special[i][m]-1][j]; nspecial[i][1]++; - } + } } - } + } } // 1-4 neighbors with no duplicates for (int i = 0; i < natoms; i++) nspecial[i][2] = nspecial[i][1]; - + for (int i = 0; i < natoms; i++) { for (int m = nspecial[i][0]; m < nspecial[i][1]; m++) { for (int j = 0; j < nspecial[special[i][m]-1][0]; j++) { @@ -1153,9 +1153,9 @@ void Molecule::special_generate() error->one(FLERR,""); special[i][count[i]++] = special[special[i][m]-1][j]; nspecial[i][2]++; - } + } } - } + } } } @@ -1172,7 +1172,7 @@ void Molecule::shakeflag_read(char *line) } for (int i = 0; i < natoms; i++) - if (shake_flag[i] < 0 || shake_flag[i] > 4) + if (shake_flag[i] < 0 || shake_flag[i] > 4) error->all(FLERR,"Invalid shake flag in molecule file"); } @@ -1195,7 +1195,7 @@ void Molecule::shakeatom_read(char *line) sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, &tmp,&shake_atom[i][0],&shake_atom[i][1],&shake_atom[i][2]); else if (shake_flag[i] == 4) - sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " + sscanf(line,"%d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT, &tmp,&shake_atom[i][0],&shake_atom[i][1], &shake_atom[i][2],&shake_atom[i][3]); @@ -1257,7 +1257,7 @@ void Molecule::check_attributes(int flag) for (int i = imol; i < imol+n; i++) { Molecule *onemol = atom->molecules[imol]; - + // check per-atom attributes of molecule // warn if not a match @@ -1266,7 +1266,7 @@ void Molecule::check_attributes(int flag) if (onemol->radiusflag && !atom->radius_flag) mismatch = 1; if (onemol->rmassflag && !atom->rmass_flag) mismatch = 1; - if (mismatch && me == 0) + if (mismatch && me == 0) error->warning(FLERR, "Molecule attributes do not match system attributes"); @@ -1278,7 +1278,7 @@ void Molecule::check_attributes(int flag) if (atom->ndihedraltypes < onemol->ndihedraltypes) mismatch = 1; if (atom->nimpropertypes < onemol->nimpropertypes) mismatch = 1; - if (mismatch) + if (mismatch) error->all(FLERR,"Molecule topology type exceeds system topology type"); // for molecular atom styles, check bond_per_atom,etc + maxspecial @@ -1295,13 +1295,13 @@ void Molecule::check_attributes(int flag) atom->improper_per_atom < onemol->improper_per_atom) mismatch = 1; if (atom->maxspecial < onemol->maxspecial) mismatch = 1; - if (mismatch) + if (mismatch) error->all(FLERR,"Molecule toplogy/atom exceeds system topology/atom"); } // warn if molecule topology defined but no special settings - if (onemol->bondflag && !onemol->specialflag) + if (onemol->bondflag && !onemol->specialflag) if (me == 0) error->warning(FLERR,"Molecule has bond topology " "but no special bond settings"); } @@ -1457,24 +1457,24 @@ void Molecule::deallocate() memory->destroy(q); memory->destroy(radius); memory->destroy(rmass); - + memory->destroy(num_bond); memory->destroy(bond_type); memory->destroy(bond_atom); - + memory->destroy(num_angle); memory->destroy(angle_type); memory->destroy(angle_atom1); memory->destroy(angle_atom2); memory->destroy(angle_atom3); - + memory->destroy(num_dihedral); memory->destroy(dihedral_type); memory->destroy(dihedral_atom1); memory->destroy(dihedral_atom2); memory->destroy(dihedral_atom3); memory->destroy(dihedral_atom4); - + memory->destroy(num_improper); memory->destroy(improper_type); memory->destroy(improper_atom1); @@ -1642,7 +1642,7 @@ void Molecule::print() for (int i = 0; i < natoms; i++) printf(" %d %g\n",i+1,rmass[i]); } - + if (bondflag) { printf( "Bonds:\n"); for (int i = 0; i < natoms; i++) { diff --git a/src/molecule.h b/src/molecule.h index 9ecb86b2029c737e47d3f43e2b5a90f47fce3c8c..35b25edf8861148342febc74da712a6206969c23 100644 --- a/src/molecule.h +++ b/src/molecule.h @@ -63,15 +63,15 @@ class Molecule : protected Pointers { int *num_bond; // bonds, angles, dihedrals, impropers for each atom int **bond_type; tagint **bond_atom; - + int *num_angle; int **angle_type; tagint **angle_atom1,**angle_atom2,**angle_atom3; - + int *num_dihedral; int **dihedral_type; tagint **dihedral_atom1,**dihedral_atom2,**dihedral_atom3,**dihedral_atom4; - + int *num_improper; int **improper_type; tagint **improper_atom1,**improper_atom2,**improper_atom3,**improper_atom4; @@ -93,7 +93,7 @@ class Molecule : protected Pointers { double maxradius; // max radius of any atom in molecule double molradius; // radius of molecule from geometric center - // including finite-size particle radii + // including finite-size particle radii int comatom; // index (1-Natom) of atom closest to COM double maxextent; // furthest any atom in molecule is from comatom diff --git a/src/my_page.h b/src/my_page.h index 8add279494a2b4009c845f1db9e76b0f5f4ded32..9df08dc31cf444e844a66b2659affc52d21aa3ba 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -48,7 +48,7 @@ methods: #ifndef LAMMPS_MY_PAGE_H #define LAMMPS_MY_PAGE_H -#include "stdlib.h" +#include <stdlib.h> namespace LAMMPS_NS { template<class T> @@ -67,7 +67,7 @@ class MyPage { // (re)initialize allocation params // also allocate first page(s) - int init(int user_maxchunk = 1, int user_pagesize = 1024, + int init(int user_maxchunk = 1, int user_pagesize = 1024, int user_pagedelta = 1) { maxchunk = user_maxchunk; pagesize = user_pagesize; @@ -146,7 +146,7 @@ class MyPage { // get ptr to location that can store maxchunk datums // will return same ptr as previous call if vgot() not called // return NULL if run out of memory - + T *vget() { if (index+maxchunk <= pagesize) return &page[index]; ipage++; @@ -196,7 +196,7 @@ class MyPage { int npage; // # of allocated pages int ipage; // index of current page int index; // current index on current page - + int maxchunk; // max # of datums in one requested chunk int pagesize; // # of datums in one page, default = 1024 int pagedelta; // # of pages to allocate at once, default = 1 diff --git a/src/my_pool_chunk.h b/src/my_pool_chunk.h index 9ae98cee3426f1ad56749f1ede8edfa38ebc7021..e3a1775c13073ed0bc3afab9bec2ddbc264d0c16 100644 --- a/src/my_pool_chunk.h +++ b/src/my_pool_chunk.h @@ -43,7 +43,7 @@ public varaibles: #ifndef LAMMPS_MY_POOL_CHUNK_H #define LAMMPS_MY_POOL_CHUNK_H -#include "stdlib.h" +#include <stdlib.h> namespace LAMMPS_NS { diff --git a/src/neigh_bond.cpp b/src/neigh_bond.cpp index b3dcc226653cc87a4ed5d47d9cf8a4095ecf76b7..c85407c45bbf15642cb2d85edadb0917fb7863eb 100644 --- a/src/neigh_bond.cpp +++ b/src/neigh_bond.cpp @@ -59,7 +59,7 @@ void Neighbor::bond_all() nmissing++; if (lostbond == ERROR) { char str[128]; - sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT + sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, tag[i],bond_atom[i][m],me,update->ntimestep); error->one(FLERR,str); @@ -131,7 +131,7 @@ void Neighbor::bond_template() nmissing++; if (lostbond == ERROR) { char str[128]; - sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT + sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, tag[i],bond_atom[iatom][m]+tagprev,me,update->ntimestep); error->one(FLERR,str); @@ -190,7 +190,7 @@ void Neighbor::bond_partial() nmissing++; if (lostbond == ERROR) { char str[128]; - sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT + sprintf(str,"Bond atoms " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, tag[i],bond_atom[i][m],me,update->ntimestep); error->one(FLERR,str); @@ -229,7 +229,7 @@ void Neighbor::bond_check() { int i,j; double dx,dy,dz,dxstart,dystart,dzstart; - + double **x = atom->x; int flag = 0; @@ -276,7 +276,7 @@ void Neighbor::angle_all() if (lostbond == ERROR) { char str[128]; sprintf(str,"Angle atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, angle_atom1[i][m],angle_atom2[i][m],angle_atom3[i][m], me,update->ntimestep); @@ -357,7 +357,7 @@ void Neighbor::angle_template() if (lostbond == ERROR) { char str[128]; sprintf(str,"Angle atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, angle_atom1[iatom][m]+tagprev,angle_atom2[iatom][m]+tagprev, angle_atom3[iatom][m]+tagprev, @@ -425,7 +425,7 @@ void Neighbor::angle_partial() if (lostbond == ERROR) { char str[128]; sprintf(str,"Angle atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, angle_atom1[i][m],angle_atom2[i][m],angle_atom3[i][m], me,update->ntimestep); @@ -468,7 +468,7 @@ void Neighbor::angle_check() { int i,j,k; double dx,dy,dz,dxstart,dystart,dzstart; - + double **x = atom->x; int flag = 0; @@ -531,8 +531,8 @@ void Neighbor::dihedral_all() if (lostbond == ERROR) { char str[128]; sprintf(str,"Dihedral atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, dihedral_atom1[i][m],dihedral_atom2[i][m], dihedral_atom3[i][m],dihedral_atom4[i][m], @@ -618,8 +618,8 @@ void Neighbor::dihedral_template() if (lostbond == ERROR) { char str[128]; sprintf(str,"Dihedral atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, dihedral_atom1[iatom][m]+tagprev, dihedral_atom2[iatom][m]+tagprev, @@ -694,8 +694,8 @@ void Neighbor::dihedral_partial() if (lostbond == ERROR) { char str[128]; sprintf(str,"Dihedral atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, dihedral_atom1[i][m],dihedral_atom2[i][m], dihedral_atom3[i][m],dihedral_atom4[i][m], @@ -742,7 +742,7 @@ void Neighbor::dihedral_check(int nlist, int **list) { int i,j,k,l; double dx,dy,dz,dxstart,dystart,dzstart; - + double **x = atom->x; int flag = 0; @@ -788,7 +788,7 @@ void Neighbor::dihedral_check(int nlist, int **list) int flag_all; MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_SUM,world); - if (flag_all) + if (flag_all) error->all(FLERR,"Dihedral/improper extent > half of periodic box length"); } @@ -822,8 +822,8 @@ void Neighbor::improper_all() if (lostbond == ERROR) { char str[128]; sprintf(str,"Improper atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, improper_atom1[i][m],improper_atom2[i][m], improper_atom3[i][m],improper_atom4[i][m], @@ -909,8 +909,8 @@ void Neighbor::improper_template() if (lostbond == ERROR) { char str[128]; sprintf(str,"Improper atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, improper_atom1[iatom][m]+tagprev, improper_atom2[iatom][m]+tagprev, @@ -985,8 +985,8 @@ void Neighbor::improper_partial() if (lostbond == ERROR) { char str[128]; sprintf(str,"Improper atoms " - TAGINT_FORMAT " " TAGINT_FORMAT " " - TAGINT_FORMAT " " TAGINT_FORMAT + TAGINT_FORMAT " " TAGINT_FORMAT " " + TAGINT_FORMAT " " TAGINT_FORMAT " missing on proc %d at step " BIGINT_FORMAT, improper_atom1[i][m],improper_atom2[i][m], improper_atom3[i][m],improper_atom4[i][m], diff --git a/src/neigh_list.cpp b/src/neigh_list.cpp index 56577ed63ced2215e3f5fff149e4a3cdca81a6e2..e4015e6bb19472193cf749399d55d70ede7210f8 100644 --- a/src/neigh_list.cpp +++ b/src/neigh_list.cpp @@ -103,7 +103,7 @@ NeighList::~NeighList() /* ---------------------------------------------------------------------- */ -void NeighList::setup_pages(int pgsize_caller, int oneatom_caller, +void NeighList::setup_pages(int pgsize_caller, int oneatom_caller, int dnum_caller) { pgsize = pgsize_caller; diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 5f47bf5da4b6ae3e1a659749994b4272503594a5..7c9cd448c70100a752d86d9773de6cfd074612de 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -104,7 +104,7 @@ int NeighRequest::identical(NeighRequest *other) // prevents an old fix from being unfix/refix in same memory location // and appearing to be old, when it is really new // only needed for classes with persistent neigh lists: Fix, Compute, Pair - + if (other->unprocessed) same = 0; if (requestor != other->requestor) same = 0; diff --git a/src/neigh_request.h b/src/neigh_request.h index 53ca2b797cf5da17f4345f33186da1ebbb668c42..e83523063825a62dabd6965a48d730d2d24e0a02 100644 --- a/src/neigh_request.h +++ b/src/neigh_request.h @@ -41,7 +41,7 @@ class NeighRequest : protected Pointers { int full; // 1 if full neigh list int full_cluster; // only used by Kokkos pair styles - int gran; // 1 if granular list + int gran; // 1 if granular list int granhistory; // 1 if granular history list int respainner; // 1 if a rRESPA inner list @@ -89,7 +89,7 @@ class NeighRequest : protected Pointers { int kokkos_host; int kokkos_device; - + // set by neighbor and pair_hybrid after all requests are made // these settings do not change kind value diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 4e93ae9cd94578aa06003f9e22a9a59bf3512fb7..9844226a52f99f59a53b08be60844ffb37659236 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -15,10 +15,10 @@ Contributing author (triclinic and multi-neigh) : Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" @@ -170,24 +170,24 @@ Neighbor::~Neighbor() delete [] cuttype; delete [] cuttypesq; delete [] fixchecklist; - + memory->destroy(xhold); - + memory->destroy(binhead); memory->destroy(bins); - + memory->destroy(ex1_type); memory->destroy(ex2_type); memory->destroy(ex_type); - + memory->destroy(ex1_group); memory->destroy(ex2_group); delete [] ex1_bit; delete [] ex2_bit; - + memory->destroy(ex_mol_group); delete [] ex_mol_bit; - + for (int i = 0; i < nlist; i++) delete lists[i]; delete [] lists; delete [] pair_build; @@ -195,12 +195,12 @@ Neighbor::~Neighbor() delete [] blist; delete [] glist; delete [] slist; - + for (int i = 0; i < nrequest; i++) delete requests[i]; memory->sfree(requests); for (int i = 0; i < old_nrequest; i++) delete old_requests[i]; memory->sfree(old_requests); - + memory->destroy(bondlist); memory->destroy(anglelist); memory->destroy(dihedrallist); @@ -449,7 +449,7 @@ void Neighbor::init() // no need to re-create if: // neigh style, triclinic, pgsize, oneatom have not changed // current requests = old requests - // first archive request params for current requests + // first archive request params for current requests // before Neighbor possibly changes them below for (i = 0; i < nrequest; i++) requests[i]->archive(); @@ -594,7 +594,7 @@ void Neighbor::init() requests[i]->half_from_full = 1; lists[i]->listfull = lists[j]; } - + // fix/compute requests: // whether request is occasional or not doesn't matter // if request = half and non-skip pair half/respaouter exists, @@ -792,7 +792,7 @@ void Neighbor::init() // output neighbor list info, only first time or when info changes - if (!same || every != old_every || delay != old_delay || + if (!same || every != old_every || delay != old_delay || old_check != dist_check || old_cutoff != cutneighmax) { if (me == 0) { const double cutghost = MAX(cutneighmax,comm->cutghostuser); @@ -817,7 +817,7 @@ void Neighbor::init() fprintf(logfile," ghost atom cutoff = %g\n",cutghost); if (style != NSQ) fprintf(logfile," binsize = %g -> bins = %g %g %g\n",binsize, - ceil(bbox[0]/binsize), ceil(bbox[1]/binsize), + ceil(bbox[0]/binsize), ceil(bbox[1]/binsize), ceil(bbox[2]/binsize)); } if (screen) { @@ -1069,7 +1069,7 @@ void Neighbor::choose_build(int index, NeighRequest *rq) else pb = &Neighbor::half_bin_no_newton_ghost; } else if (triclinic == 0) { pb = &Neighbor::half_bin_newton; - } else if (triclinic == 1) + } else if (triclinic == 1) pb = &Neighbor::half_bin_newton_tri; } else if (rq->newton == 1) { if (triclinic == 0) pb = &Neighbor::half_bin_newton; @@ -2140,7 +2140,7 @@ bigint Neighbor::memory_usage() bytes += memory->usage(binhead,maxhead); } - for (int i = 0; i < nrequest; i++) + for (int i = 0; i < nrequest; i++) if (lists[i]) bytes += lists[i]->memory_usage(); bytes += memory->usage(bondlist,maxbond,3); diff --git a/src/output.cpp b/src/output.cpp index 44892f5bd8eeb0df46e64b7f5101b8b0d73d6962..db667e8694baf06a1a61f067d81f2e2da0287a12 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "output.h" #include "style_dump.h" #include "atom.h" @@ -552,7 +552,7 @@ void Output::add_dump(int narg, char **arg) error->all(FLERR,"Reuse of dump ID"); int igroup = group->find(arg[1]); if (igroup == -1) error->all(FLERR,"Could not find dump group ID"); - if (force->inumeric(FLERR,arg[3]) <= 0) + if (force->inumeric(FLERR,arg[3]) <= 0) error->all(FLERR,"Invalid dump frequency"); // extend Dump list if necessary @@ -771,7 +771,7 @@ void Output::create_restart(int narg, char **arg) if (strchr(arg[1],'%')) multiproc = comm->nprocs; else multiproc = 0; if (nfile == 2) { - if (multiproc && !strchr(arg[2],'%')) + if (multiproc && !strchr(arg[2],'%')) error->all(FLERR,"Both restart files must use % or neither"); if (!multiproc && strchr(arg[2],'%')) error->all(FLERR,"Both restart files must use % or neither"); @@ -781,7 +781,7 @@ void Output::create_restart(int narg, char **arg) if (strstr(arg[1],".mpi")) mpiioflag = 1; else mpiioflag = 0; if (nfile == 2) { - if (mpiioflag && !strstr(arg[2],".mpi")) + if (mpiioflag && !strstr(arg[2],".mpi")) error->all(FLERR,"Both restart files must use MPI-IO or neither"); if (!mpiioflag && strstr(arg[2],".mpi")) error->all(FLERR,"Both restart files must use MPI-IO or neither"); diff --git a/src/pair.cpp b/src/pair.cpp index 665615edd0c5e3fd07c54a5eebdd99676d9b80fc..ffeabde41657e6730d490998a20631543751b7a8 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -15,14 +15,14 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "ctype.h" -#include "float.h" -#include "limits.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <ctype.h> +#include <float.h> +#include <limits.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair.h" #include "atom.h" #include "neighbor.h" @@ -210,11 +210,11 @@ void Pair::init() if (manybody_flag && atom->molecular) { int flag = 0; - if (atom->nbonds > 0 && force->special_lj[1] == 0.0 && + if (atom->nbonds > 0 && force->special_lj[1] == 0.0 && force->special_coul[1] == 0.0) flag = 1; - if (atom->nangles > 0 && force->special_lj[2] == 0.0 && + if (atom->nangles > 0 && force->special_lj[2] == 0.0 && force->special_coul[2] == 0.0) flag = 1; - if (atom->ndihedrals > 0 && force->special_lj[3] == 0.0 && + if (atom->ndihedrals > 0 && force->special_lj[3] == 0.0 && force->special_coul[3] == 0.0) flag = 1; if (flag && comm->me == 0) error->warning(FLERR,"Using a manybody potential with " @@ -321,9 +321,9 @@ void Pair::init_tables(double cut_coul, double *cut_respa) if (force->kspace == NULL) error->all(FLERR,"Pair style requires a KSpace style"); double g_ewald = force->kspace->g_ewald; - + double cut_coulsq = cut_coul * cut_coul; - + tabinnersq = tabinner*tabinner; init_bitmap(tabinner,cut_coul,ncoultablebits, masklo,maskhi,ncoulmask,ncoulshiftbits); @@ -530,33 +530,33 @@ void Pair::init_tables_disp(double cut_lj_global) double rsq; double g_ewald_6 = force->kspace->g_ewald_6; double g2 = g_ewald_6*g_ewald_6, g6 = g2*g2*g2, g8 = g6*g2; - + tabinnerdispsq = tabinner_disp*tabinner_disp; init_bitmap(tabinner_disp,cut_lj_global,ndisptablebits, masklo,maskhi,ndispmask,ndispshiftbits); - + int ntable = 1; for (int i = 0; i < ndisptablebits; i++) ntable *= 2; - + // linear lookup tables of length N = 2^ndisptablebits // stored value = value at lower edge of bin // d values = delta from lower edge to upper edge of bin - + if (fdisptable) free_disp_tables(); - + memory->create(rdisptable,ntable,"pair:rdisptable"); memory->create(fdisptable,ntable,"pair:fdisptable"); memory->create(edisptable,ntable,"pair:edisptable"); memory->create(drdisptable,ntable,"pair:drdisptable"); memory->create(dfdisptable,ntable,"pair:dfdisptable"); memory->create(dedisptable,ntable,"pair:dedisptable"); - + union_int_float_t rsq_lookup; union_int_float_t minrsq_lookup; int itablemin; minrsq_lookup.i = 0 << ndispshiftbits; minrsq_lookup.i |= maskhi; - + for (int i = 0; i < ntable; i++) { rsq_lookup.i = i << ndispshiftbits; rsq_lookup.i |= masklo; @@ -567,38 +567,38 @@ void Pair::init_tables_disp(double cut_lj_global) rsq = rsq_lookup.f; register double x2 = g2*rsq, a2 = 1.0/x2; x2 = a2*exp(-x2); - + rdisptable[i] = rsq_lookup.f; fdisptable[i] = g8*(((6.0*a2+6.0)*a2+3.0)*a2+1.0)*x2*rsq; edisptable[i] = g6*((a2+1.0)*a2+0.5)*x2; - + minrsq_lookup.f = MIN(minrsq_lookup.f,rsq_lookup.f); } - + tabinnerdispsq = minrsq_lookup.f; - + int ntablem1 = ntable - 1; - + for (int i = 0; i < ntablem1; i++) { drdisptable[i] = 1.0/(rdisptable[i+1] - rdisptable[i]); dfdisptable[i] = fdisptable[i+1] - fdisptable[i]; dedisptable[i] = edisptable[i+1] - edisptable[i]; } - + // get the delta values for the last table entries // tables are connected periodically between 0 and ntablem1 - + drdisptable[ntablem1] = 1.0/(rdisptable[0] - rdisptable[ntablem1]); dfdisptable[ntablem1] = fdisptable[0] - fdisptable[ntablem1]; dedisptable[ntablem1] = edisptable[0] - edisptable[ntablem1]; - + // get the correct delta values at itablemax // smallest r is in bin itablemin // largest r is in bin itablemax, which is itablemin-1, // or ntablem1 if itablemin=0 // deltas at itablemax only needed if corresponding rsq < cut*cut // if so, compute deltas between rsq and cut*cut - + double f_tmp,e_tmp; double cut_lj_globalsq; itablemin = minrsq_lookup.i & ndispmask; @@ -607,15 +607,15 @@ void Pair::init_tables_disp(double cut_lj_global) if (itablemin == 0) itablemax = ntablem1; rsq_lookup.i = itablemax << ndispshiftbits; rsq_lookup.i |= maskhi; - + if (rsq_lookup.f < (cut_lj_globalsq = cut_lj_global * cut_lj_global)) { rsq_lookup.f = cut_lj_globalsq; - + register double x2 = g2*rsq, a2 = 1.0/x2; x2 = a2*exp(-x2); f_tmp = g8*(((6.0*a2+6.0)*a2+3.0)*a2+1.0)*x2*rsq; e_tmp = g6*((a2+1.0)*a2+0.5)*x2; - + drdisptable[itablemax] = 1.0/(rsq_lookup.f - rdisptable[itablemax]); dfdisptable[itablemax] = f_tmp - fdisptable[itablemax]; dedisptable[itablemax] = e_tmp - edisptable[itablemax]; @@ -931,7 +931,7 @@ void Pair::ev_tally(int i, int j, int nlocal, int newton_pair, } } } - + /* ---------------------------------------------------------------------- tally eng_vdwl and virial into global and per-atom accumulators can use this version with full neighbor lists @@ -1519,7 +1519,7 @@ void Pair::virial_fdotr_compute() virial[5] += f[i][2]*x[i][1]; } } - + // prevent multiple calls to update the virial // when a hybrid pair style uses both a gpu and non-gpu pair style // or when respa is used with gpu pair styles diff --git a/src/pair.h b/src/pair.h index bc4db091f367f24e05cc74992668a512ee0eda88..a03f4c378d0d0ab25608d4834b6d5aaeeecfb00f 100644 --- a/src/pair.h +++ b/src/pair.h @@ -142,7 +142,7 @@ class Pair : protected Pointers { virtual void compute_outer(int, int) {} virtual double single(int, int, int, int, - double, double, double, + double, double, double, double& fforce) { fforce = 0.0; return 0.0; diff --git a/src/pair_beck.cpp b/src/pair_beck.cpp index 986a6c74ff244d1c0fbe6dd00374833825582cdf..0e05afb43ba758a6e35926a06e091b4726e9d0d6 100644 --- a/src/pair_beck.cpp +++ b/src/pair_beck.cpp @@ -15,9 +15,9 @@ Contributing author: Jonathan Zimmerman (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_beck.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_born.cpp b/src/pair_born.cpp index 623452f6433bcd5875226493b716cc7eaf4617ea..d925af1030beeb1567331de7c568a6260153e854 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -15,10 +15,10 @@ Contributing Author: Sai Jayaraman (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_born.h" #include "atom.h" #include "comm.h" @@ -33,7 +33,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairBorn::PairBorn(LAMMPS *lmp) : Pair(lmp) +PairBorn::PairBorn(LAMMPS *lmp) : Pair(lmp) { writedata = 1; } diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index 3eb5973b08a454165347d884190c9ddea6e22cd5..48066fc43e11ff2d4ad95f242d470df3a55c7d11 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -15,10 +15,10 @@ Contributing author: Yongfeng Zhang (INL), yongfeng.zhang@inl.gov ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_born_coul_wolf.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_buck.cpp b/src/pair_buck.cpp index 24b930af1e79994e3cf92b1907ce9b18ce0a06ab..baaea7ccdd2beb95ec8915f908ebccba3f7c7ffe 100644 --- a/src/pair_buck.cpp +++ b/src/pair_buck.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_buck.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index 1021bd1e4da4a24c87e2026ff2a458ec8d2b3695..06aeea3083e04724a333cf8e2908245880f1c28d 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -15,9 +15,9 @@ Contributing author: Eduardo Bringa (LLNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_buck_coul_cut.h" #include "atom.h" #include "comm.h" @@ -219,7 +219,7 @@ void PairBuckCoulCut::settings(int narg, char **arg) void PairBuckCoulCut::coeff(int narg, char **arg) { - if (narg < 5 || narg > 7) + if (narg < 5 || narg > 7) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index 4a54f2f2a8bb3e0b8310b923286c2bb9333948a6..4f21ba5ac1a8bbdeb0f0b0a66e458e55b9177dbe 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_cut.h" #include "atom.h" #include "comm.h" @@ -166,7 +166,7 @@ void PairCoulCut::settings(int narg, char **arg) void PairCoulCut::coeff(int narg, char **arg) { - if (narg < 2 || narg > 3) + if (narg < 2 || narg > 3) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); diff --git a/src/pair_coul_debye.cpp b/src/pair_coul_debye.cpp index c772961ec06a20a58b8c7ce482b8683cd4ce2928..dcb84d7e2d2b4e54d64be367a9a74a40799688f5 100644 --- a/src/pair_coul_debye.cpp +++ b/src/pair_coul_debye.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_debye.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index 2fa7b69fc9d2a4d7c59c7d6c119f2e7b294c2d25..264ba7648b5f47833bada399ddd107449857bb17 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ References: Fennell and Gezelter, JCP 124, 234104 (2006) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_dsf.h" #include "atom.h" #include "comm.h" @@ -69,11 +69,11 @@ void PairCoulDSF::compute(int eflag, int vflag) double r,rsq,r2inv,forcecoul,factor_coul; double prefactor,erfcc,erfcd,t; int *ilist,*jlist,*numneigh,**firstneigh; - + ecoul = 0.0; if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + double **x = atom->x; double **f = atom->f; double *q = atom->q; @@ -86,7 +86,7 @@ void PairCoulDSF::compute(int eflag, int vflag) ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { @@ -97,7 +97,7 @@ void PairCoulDSF::compute(int eflag, int vflag) ztmp = x[i][2]; jlist = firstneigh[i]; jnum = numneigh[i]; - + if (eflag) { double e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e; ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0); @@ -121,7 +121,7 @@ void PairCoulDSF::compute(int eflag, int vflag) erfcd = exp(-alpha*alpha*rsq); t = 1.0 / (1.0 + EWALD_P*alpha*r); erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; fpair = forcecoul * r2inv; @@ -190,7 +190,7 @@ void PairCoulDSF::coeff(int narg, char **arg) int ilo,ihi,jlo,jhi; force->bounds(arg[0],atom->ntypes,ilo,ihi); force->bounds(arg[1],atom->ntypes,jlo,jhi); - + int count = 0; for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { @@ -214,10 +214,10 @@ void PairCoulDSF::init_style() neighbor->request(this,instance_me); cut_coulsq = cut_coul * cut_coul; - double erfcc = erfc(alpha*cut_coul); + double erfcc = erfc(alpha*cut_coul); double erfcd = exp(-alpha*alpha*cut_coul*cut_coul); - f_shift = -(erfcc/cut_coulsq + 2.0/MY_PIS*alpha*erfcd/cut_coul); - e_shift = erfcc/cut_coul - f_shift*cut_coul; + f_shift = -(erfcc/cut_coulsq + 2.0/MY_PIS*alpha*erfcd/cut_coul); + e_shift = erfcc/cut_coul - f_shift*cut_coul; } /* ---------------------------------------------------------------------- @@ -300,7 +300,7 @@ double PairCoulDSF::single(int i, int j, int itype, int jtype, double rsq, { double r2inv,r,erfcc,erfcd,prefactor,t; double forcecoul,phicoul; - + r2inv = 1.0/rsq; double eng = 0.0; @@ -310,16 +310,16 @@ double PairCoulDSF::single(int i, int j, int itype, int jtype, double rsq, erfcd = exp(-alpha*alpha*rsq); t = 1.0 / (1.0 + EWALD_P*alpha*r); erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - - forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS*erfcd + + + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS*erfcd + r*f_shift) * r; phicoul = prefactor * (erfcc - r*e_shift - rsq*f_shift); eng += phicoul; } else forcecoul = 0.0; - + fforce = forcecoul * r2inv; - + return eng; } diff --git a/src/pair_coul_dsf.h b/src/pair_coul_dsf.h index 7a6f74edf5d63a0247b4398c88961e0cdd56514c..c74c88ee162571866b81a3a930ea1561e5066cb7 100644 --- a/src/pair_coul_dsf.h +++ b/src/pair_coul_dsf.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -44,7 +44,7 @@ class PairCoulDSF : public Pair { double cut_coul,cut_coulsq; double alpha; double f_shift,e_shift; - + void allocate(); }; diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 31aa7adabd25442a5afdff793713b762f7573917..97b9b551a65c89906e3b980c655d7455298d2fbb 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -15,10 +15,10 @@ Contributing author: Ray Shan (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_streitz.h" #include "atom.h" #include "comm.h" @@ -340,8 +340,8 @@ void PairCoulStreitz::read_file(char *file) params[nparams].zcore = atof(words[5]); // parameter sanity check - - if (params[nparams].eta < 0.0 || params[nparams].zeta < 0.0 || + + if (params[nparams].eta < 0.0 || params[nparams].zeta < 0.0 || params[nparams].zcore < 0.0 || params[nparams].gamma != 0.0 ) error->all(FLERR,"Illegal coul/streitz parameter"); @@ -357,7 +357,7 @@ void PairCoulStreitz::setup() { int i,m,n; - // set elem2param + // set elem2param memory->destroy(elem2param); memory->create(elem2param,nelements,"pair:elem2param"); @@ -400,7 +400,7 @@ void PairCoulStreitz::compute(int eflag, int vflag) double xtmp, ytmp, ztmp, ecoul, fpair; double qi, qj, selfion, r, rsq, delr[3]; - double zei, zej, zj, ci_jfi, dci_jfi, ci_fifj, dci_fifj; + double zei, zej, zj, ci_jfi, dci_jfi, ci_fifj, dci_fifj; double forcecoul, factor_coul; double **x = atom->x; @@ -422,7 +422,7 @@ void PairCoulStreitz::compute(int eflag, int vflag) firstneigh = list->firstneigh; // Wolf sum - + if (kspacetype == 1) { for (ii = 0; ii < inum; ii++) { @@ -472,9 +472,9 @@ void PairCoulStreitz::compute(int eflag, int vflag) // Wolf Sum - wolf_sum(qi, qj, zj, r, ci_jfi, dci_jfi, ci_fifj, dci_fifj, + wolf_sum(qi, qj, zj, r, ci_jfi, dci_jfi, ci_fifj, dci_fifj, ecoul, forcecoul); - + // Forces fpair = -forcecoul / r; @@ -495,7 +495,7 @@ void PairCoulStreitz::compute(int eflag, int vflag) } // Ewald Sum - + } else if (kspacetype == 2) { for (ii = 0; ii < inum; ii++) { @@ -543,8 +543,8 @@ void PairCoulStreitz::compute(int eflag, int vflag) coulomb_integral_ewald(zei, zej, r, ci_jfi, dci_jfi, ci_fifj, dci_fifj); // Ewald: real-space - - ewald_sum(qi, qj, zj, r, ci_jfi, dci_jfi, ci_fifj, dci_fifj, + + ewald_sum(qi, qj, zj, r, ci_jfi, dci_jfi, ci_fifj, dci_fifj, ecoul, forcecoul, factor_coul); // Forces @@ -577,7 +577,7 @@ double PairCoulStreitz::self(Param *param, double qi) double qqrd2e = force->qqrd2e; if (kspacetype == 1) return 1.0*qi*(s1+qi*(0.50*s2 - qqrd2e*woself)); - + if (kspacetype == 2) return 1.0*qi*(s1+qi*(0.50*s2)); return 0.0; @@ -586,7 +586,7 @@ double PairCoulStreitz::self(Param *param, double qi) /* ---------------------------------------------------------------------- */ void PairCoulStreitz::coulomb_integral_wolf(double zei, double zej, double r, - double &ci_jfi, double &dci_jfi, double &ci_fifj, + double &ci_jfi, double &dci_jfi, double &ci_fifj, double &dci_fifj) { double rinv = 1.0/r; @@ -646,17 +646,17 @@ void PairCoulStreitz::coulomb_integral_wolf(double zei, double zej, double r, fshift = (exp2zirsh*(2.0*zei*(e1+e3/rc) + e3*rcinv2) + exp2zjrsh*(2.0*zej*(e2+e4/rc) + e4*rcinv2)); - ci_fifj = -exp2zir*(e1+e3/r) - exp2zjr*(e2+e4/r) + ci_fifj = -exp2zir*(e1+e3/r) - exp2zjr*(e2+e4/r) - eshift - (r-rc)*fshift; - dci_fifj = (exp2zir*(2.0*zei*(e1+e3/r) + e3*rinv2) + + dci_fifj = (exp2zir*(2.0*zei*(e1+e3/r) + e3*rinv2) + exp2zjr*(2.0*zej*(e2+e4/r) + e4*rinv2)) - fshift; } } /* ---------------------------------------------------------------------- */ -void PairCoulStreitz::wolf_sum(double qi, double qj, double zj, double r, - double ci_jfi, double dci_jfi, double ci_fifj, +void PairCoulStreitz::wolf_sum(double qi, double qj, double zj, double r, + double ci_jfi, double dci_jfi, double ci_fifj, double dci_fifj, double &etmp, double &ftmp) { double a = g_wolf; @@ -676,7 +676,7 @@ void PairCoulStreitz::wolf_sum(double qi, double qj, double zj, double r, etmp1 = erfcr/r - erfcrc/rc; etmp2 = qi * zj * (ci_jfi - ci_fifj); etmp3 = qi * qj * 0.50 * (etmp1 + ci_fifj); - + ftmp1 = -erfcr/r/r - 2.0*a/MY_PIS*derfcr/r - dwoself; ftmp2 = qi * zj * (dci_jfi - dci_fifj); ftmp3 = qi * qj * 0.50 * (ftmp1 + dci_fifj); @@ -689,7 +689,7 @@ void PairCoulStreitz::wolf_sum(double qi, double qj, double zj, double r, /* ---------------------------------------------------------------------- */ void PairCoulStreitz::coulomb_integral_ewald(double zei, double zej, double r, - double &ci_jfi, double &dci_jfi, double &ci_fifj, + double &ci_jfi, double &dci_jfi, double &ci_fifj, double &dci_fifj) { double rinv = 1.0/r; @@ -718,7 +718,7 @@ void PairCoulStreitz::coulomb_integral_ewald(double zei, double zej, double r, if (zei == zej) { ci_fifj = -exp2zir*(rinv + zei*(sm1 + sm2*zei*r + sm3*zei2*r*r)); - dci_fifj = exp2zir*(rinv2 + 2.0*zei*rinv + + dci_fifj = exp2zir*(rinv2 + 2.0*zei*rinv + zei2*(2.0 + 7.0/6.0*zei*r + 1.0/3.0*zei2*r*r)); } else { @@ -739,8 +739,8 @@ void PairCoulStreitz::coulomb_integral_ewald(double zei, double zej, double r, /* ---------------------------------------------------------------------- */ -void PairCoulStreitz::ewald_sum(double qi, double qj, double zj, double r, - double ci_jfi, double dci_jfi, double ci_fifj, +void PairCoulStreitz::ewald_sum(double qi, double qj, double zj, double r, + double ci_jfi, double dci_jfi, double ci_fifj, double dci_fifj, double &etmp, double &ftmp, double fac) { double etmp1, etmp2, etmp3, etmp4; @@ -760,7 +760,7 @@ void PairCoulStreitz::ewald_sum(double qi, double qj, double zj, double r, etmp2 = qi * qj * 0.50 * ci_fifj; etmp3 = qqrd2e * (etmp1 + etmp2); etmp4 = qqrd2e * 0.50*qi*qj/r; - + ftmp1 = qi * zj * (dci_jfi - dci_fifj); ftmp2 = qi * qj * 0.50 * dci_fifj; ftmp3 = qqrd2e * (ftmp1 + ftmp2); diff --git a/src/pair_coul_streitz.h b/src/pair_coul_streitz.h index 87ced6ed7884d8f3b16bd15ba23e03e4ed2bd0f6..5c14fa4c38b5bcc5b5b7a20e7d57f424358acbcb 100644 --- a/src/pair_coul_streitz.h +++ b/src/pair_coul_streitz.h @@ -57,10 +57,10 @@ class PairCoulStreitz : public Pair { double cut_coul, cut_coulsq; double *cut_respa; double **scale; - + // Wolf double g_wolf, woself, dwoself; - + // Ewald double g_ewald; @@ -73,11 +73,11 @@ class PairCoulStreitz : public Pair { double self(Param *, double); void coulomb_integral_wolf(double, double, double, double &, double &, double &, double &); - void wolf_sum(double, double, double, double, double, double, double, + void wolf_sum(double, double, double, double, double, double, double, double, double &, double &); void coulomb_integral_ewald(double, double, double, double &, double &, double &, double &); - void ewald_sum(double, double, double, double, double, double, double, + void ewald_sum(double, double, double, double, double, double, double, double, double &, double &, double); }; diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index 170f4583463904515d6fab2e8e79e4d5128bf6be..8b9e3fc07db82d7f34bf876c8e18b3711498ac04 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -15,10 +15,10 @@ Contributing author: Yongfeng Zhang (INL), yongfeng.zhang@inl.gov ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_coul_wolf.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_dpd.cpp b/src/pair_dpd.cpp index 87af68d7fa8ce696484fac0943907e44859b2514..9dc16cab4b7a9c66aa96c2a157263506e87bca52 100644 --- a/src/pair_dpd.cpp +++ b/src/pair_dpd.cpp @@ -15,9 +15,9 @@ Contributing author: Kurt Smith (U Pittsburgh) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_dpd.h" #include "atom.h" #include "atom_vec.h" @@ -214,7 +214,7 @@ void PairDPD::settings(int narg, char **arg) void PairDPD::coeff(int narg, char **arg) { - if (narg < 4 || narg > 5) + if (narg < 4 || narg > 5) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); diff --git a/src/pair_dpd_tstat.cpp b/src/pair_dpd_tstat.cpp index 8d039a2bd550d08f1f1b0af82e45de9a5ed783de..2c51bb8d850b5a1edc5addd1ad7b01f75e2011c7 100644 --- a/src/pair_dpd_tstat.cpp +++ b/src/pair_dpd_tstat.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" +#include <math.h> #include "pair_dpd_tstat.h" #include "atom.h" #include "update.h" @@ -170,7 +170,7 @@ void PairDPDTstat::settings(int narg, char **arg) void PairDPDTstat::coeff(int narg, char **arg) { - if (narg < 3 || narg > 4) + if (narg < 3 || narg > 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index 80b3d3a79c564fe075daf6ff6f021a59ed813e4e..58373021e244f5c542fc5a4ddc9ceb4ee31d708d 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -15,10 +15,10 @@ Contributing author: Sai Jayaraman (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_gauss.h" #include "atom.h" #include "comm.h" @@ -183,7 +183,7 @@ void PairGauss::settings(int narg, char **arg) void PairGauss::coeff(int narg, char **arg) { - if (narg < 4 || narg > 5) + if (narg < 4 || narg > 5) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); @@ -217,7 +217,7 @@ void PairGauss::coeff(int narg, char **arg) double PairGauss::init_one(int i, int j) { - + // This error is triggered when ti is performed on lj/cut tail // in presence of extra atom type for tether sites // "i = 2 j = 1 ERROR: All pair coeffs are not set (pair_gauss.cpp:223)" @@ -315,7 +315,7 @@ double PairGauss::single(int i, int j, int itype, int jtype, double rsq, double factor_coul, double factor_lj, double &fforce) { - double philj = + double philj = -(a[itype][jtype]*exp(-b[itype][jtype]*rsq) - offset[itype][jtype]); fforce = -2.0*a[itype][jtype]*b[itype][jtype] * exp(-b[itype][jtype]*rsq); return philj; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 7ca6c0fb80b65719e1b9dd65552144b36b68049b..1493a8e165bc2cd4a619bb246aedea3742f31ae1 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" -#include "ctype.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> #include "pair_hybrid.h" #include "atom.h" #include "force.h" @@ -130,7 +130,7 @@ void PairHybrid::compute(int eflag, int vflag) // outerflag is set and sub-style has a compute_outer() method if (styles[m]->compute_flag == 0) continue; - if (outerflag && styles[m]->respa_enable) + if (outerflag && styles[m]->respa_enable) styles[m]->compute_outer(eflag,vflag_substyle); else styles[m]->compute(eflag,vflag_substyle); } @@ -813,7 +813,7 @@ void PairHybrid::modify_params(int narg, char **arg) int multiflag = force->inumeric(FLERR,arg[2]); for (m = 0; m < nstyles; m++) if (strcmp(arg[1],keywords[m]) == 0 && multiflag == multiple[m]) break; - if (m == nstyles) + if (m == nstyles) error->all(FLERR,"Unknown pair_modify hybrid sub-style"); iarg = 3; } diff --git a/src/pair_hybrid.h b/src/pair_hybrid.h index 27eaf472085b82d57f5ead832a3f7e57bf20db8a..1be07d1efe0ceff533b564c626ee3601b72f7a6e 100644 --- a/src/pair_hybrid.h +++ b/src/pair_hybrid.h @@ -20,7 +20,7 @@ PairStyle(hybrid,PairHybrid) #ifndef LMP_PAIR_HYBRID_H #define LMP_PAIR_HYBRID_H -#include "stdio.h" +#include <stdio.h> #include "pair.h" namespace LAMMPS_NS { diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index cf48dc14a01e6c91b1a7728af1941af47e2ed772..30c1d7d54ee5c08d6b66c6731c5d03bb33e05c3e 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" -#include "ctype.h" +#include <stdlib.h> +#include <string.h> +#include <ctype.h> #include "pair_hybrid_overlay.h" #include "atom.h" #include "force.h" diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index d5e24be739e2f3f288572dc7fe65d90577b5c07b..cba6fdbdb45780db25a9bcfc81bb3fe251de5e66 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -15,10 +15,10 @@ Contributing author: Chuanfu Luo (luochuanfu@gmail.com) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj96_cut.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_lj_cubic.cpp b/src/pair_lj_cubic.cpp index 87c774c69033a2273be37c2fdf7dff7343d21216..68b664fe210dc242bb50fd7427b9fbff12d79970 100644 --- a/src/pair_lj_cubic.cpp +++ b/src/pair_lj_cubic.cpp @@ -16,10 +16,10 @@ Contributing author: Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cubic.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index 8426862e0487e0bde7c9196a7b807fc53d6bd9a0..ab1710b2fc190bfd9e8efefac22d6b637361dbd8 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index 65e7aef5e251be8f1bbc2bfa3a334caed2dd2fc7..79d3fa12a843c6cccfc77aae12371c24d0a5c86e 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_cut.h" #include "atom.h" #include "comm.h" @@ -212,7 +212,7 @@ void PairLJCutCoulCut::settings(int narg, char **arg) void PairLJCutCoulCut::coeff(int narg, char **arg) { - if (narg < 4 || narg > 6) + if (narg < 4 || narg > 6) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); diff --git a/src/pair_lj_cut_coul_debye.cpp b/src/pair_lj_cut_coul_debye.cpp index 44f2b395b2b43bdeecde09e8b16423642b04e973..8f5e8e7a1721d74a39df8d98539230f52f08ae7b 100644 --- a/src/pair_lj_cut_coul_debye.cpp +++ b/src/pair_lj_cut_coul_debye.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_lj_cut_coul_debye.h" #include "atom.h" #include "neigh_list.h" diff --git a/src/pair_lj_cut_coul_dsf.cpp b/src/pair_lj_cut_coul_dsf.cpp index af8064a131d4696ddc0b738c97b935d6bbed208b..d80c7e74c05a569c6d56ec1f9088ef528b6c1a6a 100644 --- a/src/pair_lj_cut_coul_dsf.cpp +++ b/src/pair_lj_cut_coul_dsf.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -16,10 +16,10 @@ References: Fennell and Gezelter, JCP 124, 234104 (2006) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_cut_coul_dsf.h" #include "atom.h" #include "comm.h" @@ -79,11 +79,11 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) double r,rsq,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj; double prefactor,erfcc,erfcd,t; int *ilist,*jlist,*numneigh,**firstneigh; - + evdwl = ecoul = 0.0; if (eflag || vflag) ev_setup(eflag,vflag); else evflag = vflag_fdotr = 0; - + double **x = atom->x; double **f = atom->f; double *q = atom->q; @@ -98,7 +98,7 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) ilist = list->ilist; numneigh = list->numneigh; firstneigh = list->firstneigh; - + // loop over neighbors of my atoms for (ii = 0; ii < inum; ii++) { @@ -110,7 +110,7 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; - + if (eflag) { double e_self = -(e_shift/2.0 + alpha/MY_PIS) * qtmp*qtmp*qqrd2e; ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0); @@ -142,7 +142,7 @@ void PairLJCutCoulDSF::compute(int eflag, int vflag) erfcd = exp(-alpha*alpha*r*r); t = 1.0 / (1.0 + EWALD_P*alpha*r); erfcc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * erfcd; - forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } else forcecoul = 0.0; @@ -218,7 +218,7 @@ void PairLJCutCoulDSF::settings(int narg, char **arg) cut_lj_global = force->numeric(FLERR,arg[1]); if (narg == 2) cut_coul = cut_lj_global; else cut_coul = force->numeric(FLERR,arg[2]); - + // reset cutoffs that have been explicitly set if (allocated) { @@ -236,20 +236,20 @@ void PairLJCutCoulDSF::settings(int narg, char **arg) void PairLJCutCoulDSF::coeff(int narg, char **arg) { - if (narg < 4 || narg > 5) + if (narg < 4 || narg > 5) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); int ilo,ihi,jlo,jhi; force->bounds(arg[0],atom->ntypes,ilo,ihi); force->bounds(arg[1],atom->ntypes,jlo,jhi); - + double epsilon_one = force->numeric(FLERR,arg[2]); double sigma_one = force->numeric(FLERR,arg[3]); double cut_lj_one = cut_lj_global; if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); - + int count = 0; for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { @@ -276,10 +276,10 @@ void PairLJCutCoulDSF::init_style() neighbor->request(this,instance_me); cut_coulsq = cut_coul * cut_coul; - double erfcc = erfc(alpha*cut_coul); + double erfcc = erfc(alpha*cut_coul); double erfcd = exp(-alpha*alpha*cut_coul*cut_coul); - f_shift = -(erfcc/cut_coulsq + 2.0/MY_PIS*alpha*erfcd/cut_coul); - e_shift = erfcc/cut_coul - f_shift*cut_coul; + f_shift = -(erfcc/cut_coulsq + 2.0/MY_PIS*alpha*erfcd/cut_coul); + e_shift = erfcc/cut_coul - f_shift*cut_coul; } /* ---------------------------------------------------------------------- @@ -297,17 +297,17 @@ double PairLJCutCoulDSF::init_one(int i, int j) double cut = MAX(cut_lj[i][j],cut_coul); cut_ljsq[i][j] = cut_lj[i][j] * cut_lj[i][j]; - + lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j],12.0); lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0); lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0); lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0); - + if (offset_flag) { double ratio = sigma[i][j] / cut_lj[i][j]; offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0)); } else offset[i][j] = 0.0; - + cut_ljsq[j][i] = cut_ljsq[i][j]; lj1[j][i] = lj1[i][j]; lj2[j][i] = lj2[i][j]; @@ -329,17 +329,17 @@ double PairLJCutCoulDSF::init_one(int i, int j) if (type[k] == j) count[1] += 1.0; } MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world); - + double sig2 = sigma[i][j]*sigma[i][j]; double sig6 = sig2*sig2*sig2; double rc3 = cut_lj[i][j]*cut_lj[i][j]*cut_lj[i][j]; double rc6 = rc3*rc3; double rc9 = rc3*rc6; - etail_ij = 8.0*MY_PI*all[0]*all[1]*epsilon[i][j] * - sig6 * (sig6 - 3.0*rc6) / (9.0*rc9); - ptail_ij = 16.0*MY_PI*all[0]*all[1]*epsilon[i][j] * - sig6 * (2.0*sig6 - 3.0*rc6) / (9.0*rc9); - } + etail_ij = 8.0*MY_PI*all[0]*all[1]*epsilon[i][j] * + sig6 * (sig6 - 3.0*rc6) / (9.0*rc9); + ptail_ij = 16.0*MY_PI*all[0]*all[1]*epsilon[i][j] * + sig6 * (2.0*sig6 - 3.0*rc6) / (9.0*rc9); + } return cut; } @@ -436,7 +436,7 @@ double PairLJCutCoulDSF::single(int i, int j, int itype, int jtype, double rsq, { double r2inv,r6inv,r,erfcc,erfcd,prefactor; double forcecoul,forcelj,phicoul,philj; - + r2inv = 1.0/rsq; if (rsq < cut_ljsq[itype][jtype]) { r6inv = r2inv*r2inv*r2inv; @@ -446,14 +446,14 @@ double PairLJCutCoulDSF::single(int i, int j, int itype, int jtype, double rsq, if (rsq < cut_coulsq) { r = sqrt(rsq); prefactor = factor_coul * force->qqrd2e * atom->q[i]*atom->q[j]/r; - erfcc = erfc(alpha*r); + erfcc = erfc(alpha*r); erfcd = exp(-alpha*alpha*r*r); - forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + + forcecoul = prefactor * (erfcc/r + 2.0*alpha/MY_PIS * erfcd + r*f_shift) * r; } else forcecoul = 0.0; - + fforce = (forcecoul + factor_lj*forcelj) * r2inv; - + double eng = 0.0; if (rsq < cut_ljsq[itype][jtype]) { philj = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) - @@ -461,11 +461,11 @@ double PairLJCutCoulDSF::single(int i, int j, int itype, int jtype, double rsq, eng += factor_lj*philj; } - if (rsq < cut_coulsq) { + if (rsq < cut_coulsq) { phicoul = prefactor * (erfcc - r*e_shift - rsq*f_shift); eng += phicoul; - } - + } + return eng; } diff --git a/src/pair_lj_cut_coul_dsf.h b/src/pair_lj_cut_coul_dsf.h index 5a0a6b553dcb3c5af601458c5e36d65638863d70..3dfe272777735a0fd73970125c1632f02ac1faf8 100644 --- a/src/pair_lj_cut_coul_dsf.h +++ b/src/pair_lj_cut_coul_dsf.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -45,11 +45,11 @@ class PairLJCutCoulDSF : public Pair { double **cut_lj,**cut_ljsq; double **epsilon,**sigma; double **lj1,**lj2,**lj3,**lj4,**offset; - + double cut_coul,cut_coulsq; double alpha; double f_shift,e_shift; - + virtual void allocate(); }; diff --git a/src/pair_lj_expand.cpp b/src/pair_lj_expand.cpp index dc78373b4fe6da9bf2d74bcdfc87a9fb1ea77be3..237ee91cce83a5e284f8aaec8f67c242f151b902 100644 --- a/src/pair_lj_expand.cpp +++ b/src/pair_lj_expand.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_expand.h" #include "atom.h" #include "comm.h" @@ -277,13 +277,13 @@ double PairLJExpand::init_one(int i, int j) double shift2 = shift1*shift1; double shift3 = shift2*shift1; - etail_ij = 8.0*MY_PI*all[0]*all[1]*epsilon[i][j] * sig6 * + etail_ij = 8.0*MY_PI*all[0]*all[1]*epsilon[i][j] * sig6 * ((1.0/9.0 + 2.0*shift1/(10.0*rc1) + shift2/(11.0*rc2))*sig6/rc9 - (1.0/3.0 + 2.0*shift1/(4.0*rc1) + shift2/(5.0*rc2))/rc3); - ptail_ij = 16.0*MY_PI*all[0]*all[1]*epsilon[i][j] * sig6 * - ((1.0/9.0 + 3.0*shift1/(10.0*rc1) + + ptail_ij = 16.0*MY_PI*all[0]*all[1]*epsilon[i][j] * sig6 * + ((1.0/9.0 + 3.0*shift1/(10.0*rc1) + 3.0*shift2/(11.0*rc2) + shift3/(12.0*rc3))*2.0*sig6/rc9 - - (1.0/3.0 + 3.0*shift1/(4.0*rc1) + + (1.0/3.0 + 3.0*shift1/(4.0*rc1) + 3.0*shift2/(5.0*rc2) + shift3/(6.0*rc3))/rc3); } diff --git a/src/pair_lj_gromacs.cpp b/src/pair_lj_gromacs.cpp index d81be7e83d4b0ab7c8655ab159effc40c3ce6c94..d5b24b733ec83d6d139b6986c4b7e973144d05ef 100644 --- a/src/pair_lj_gromacs.cpp +++ b/src/pair_lj_gromacs.cpp @@ -15,10 +15,10 @@ Contributing author: Mark Stevens (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_gromacs.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_lj_gromacs_coul_gromacs.cpp b/src/pair_lj_gromacs_coul_gromacs.cpp index bd9bb56c7ee25dba9dd91f0e2578d0e39738feb6..b68a557dcb2750883e297a87e5f0eb615cbfaea7 100644 --- a/src/pair_lj_gromacs_coul_gromacs.cpp +++ b/src/pair_lj_gromacs_coul_gromacs.cpp @@ -15,10 +15,10 @@ Contributing author: Mark Stevens (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_lj_gromacs_coul_gromacs.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_lj_smooth.cpp b/src/pair_lj_smooth.cpp index 0e532ee1edc9861d78f191a6d2bca2e3b86cb708..b73545f57b509df0d172d20b1c1b86062e59def5 100644 --- a/src/pair_lj_smooth.cpp +++ b/src/pair_lj_smooth.cpp @@ -15,9 +15,9 @@ Contributing author: Craig Maloney (UCSB) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_smooth.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index a2cf43e50f407b618fcfaa2d95b36ed04010c106..fa41bcae4b5b7a8c5693b0de7a9a02daeb1ea861 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -15,9 +15,9 @@ Contributing author: Jonathan Zimmerman (Sandia) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> #include "pair_lj_smooth_linear.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_mie_cut.cpp b/src/pair_mie_cut.cpp index 0f7cb5eabeb1f00af7fcfd8ba4c7c2080c894748..7cb67b9437b3d11618d826945517936119320b21 100644 --- a/src/pair_mie_cut.cpp +++ b/src/pair_mie_cut.cpp @@ -15,10 +15,10 @@ Contributing author: Cassiano Aimoli (aimoli@gmail.com) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_mie_cut.h" #include "atom.h" #include "comm.h" @@ -380,7 +380,7 @@ void PairMIECut::compute_outer(int eflag, int vflag) r2inv = 1.0/rsq; rgamA = pow(r2inv,(gamA[itype][jtype]/2.0)); rgamR = pow(r2inv,(gamR[itype][jtype]/2.0)); - evdwl = (mie3[itype][jtype]*rgamR - mie4[itype][jtype]*rgamA) - + evdwl = (mie3[itype][jtype]*rgamR - mie4[itype][jtype]*rgamA) - offset[itype][jtype]; evdwl *= factor_mie; } @@ -567,22 +567,22 @@ double PairMIECut::init_one(int i, int j) gamA[i][j] = mix_distance(gamA[i][i],gamA[j][j]); cut[i][j] = mix_distance(cut[i][i],cut[j][j]); } - + gamA[j][i] = gamA[i][j]; gamR[j][i] = gamR[i][j]; - Cmie[i][j] = (gamR[i][j]/(gamR[i][j]-gamA[i][j]) * + Cmie[i][j] = (gamR[i][j]/(gamR[i][j]-gamA[i][j]) * pow((gamR[i][j]/gamA[i][j]), (gamA[i][j]/(gamR[i][j]-gamA[i][j])))); - mie1[i][j] = Cmie[i][j] * gamR[i][j]* epsilon[i][j] * + mie1[i][j] = Cmie[i][j] * gamR[i][j]* epsilon[i][j] * pow(sigma[i][j],gamR[i][j]); - mie2[i][j] = Cmie[i][j] * gamA[i][j] * epsilon[i][j] * + mie2[i][j] = Cmie[i][j] * gamA[i][j] * epsilon[i][j] * pow(sigma[i][j],gamA[i][j]); mie3[i][j] = Cmie[i][j] * epsilon[i][j] * pow(sigma[i][j],gamR[i][j]); mie4[i][j] = Cmie[i][j] * epsilon[i][j] * pow(sigma[i][j],gamA[i][j]); if (offset_flag) { double ratio = sigma[i][j] / cut[i][j]; - offset[i][j] = Cmie[i][j] * epsilon[i][j] * + offset[i][j] = Cmie[i][j] * epsilon[i][j] * (pow(ratio,gamR[i][j]) - pow(ratio,gamA[i][j])); } else offset[i][j] = 0.0; diff --git a/src/pair_morse.cpp b/src/pair_morse.cpp index 1122ed78ffc1d543a75f97ee9e7d0bc4bb4f553f..4e2d47be5c4ab92fc68ce9a729ac4753af4290d2 100644 --- a/src/pair_morse.cpp +++ b/src/pair_morse.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_morse.h" #include "atom.h" #include "comm.h" diff --git a/src/pair_soft.cpp b/src/pair_soft.cpp index 3b94997881592b8fda01861114afb6ce077e588c..d9b9bb819ba55b922322cd03b3d032a89d806839 100644 --- a/src/pair_soft.cpp +++ b/src/pair_soft.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_soft.h" #include "atom.h" #include "comm.h" @@ -169,7 +169,7 @@ void PairSoft::settings(int narg, char **arg) void PairSoft::coeff(int narg, char **arg) { - if (narg < 3 || narg > 4) + if (narg < 3 || narg > 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (!allocated) allocate(); diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 4c637b2d1f9933888b50786e0cb45bdd0d43456f..9bce67b529773aef0fe3e1e1c02345a7e5f8ac06 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -15,10 +15,10 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "pair_table.h" #include "atom.h" #include "force.h" diff --git a/src/pair_yukawa.cpp b/src/pair_yukawa.cpp index 69ca737bc141bb9ae8a00f1602fe7cb822ee672f..2cc309d949f2bb4fbe0731d509f17f0336f34a5c 100644 --- a/src/pair_yukawa.cpp +++ b/src/pair_yukawa.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" +#include <math.h> +#include <stdlib.h> #include "pair_yukawa.h" #include "atom.h" #include "force.h" diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 57278c7a3aefc41f90a92c912083fdf5a4bd0681..69622009826f1cfabcdd7cf3bc355644500b7eab 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -15,10 +15,10 @@ Contributing authors: Stephen Foiles, Aidan Thompson (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "pair_zbl.h" #include "atom.h" #include "comm.h" @@ -33,7 +33,7 @@ #include "memory.h" #include "error.h" -// From J.F. Zeigler, J. P. Biersack and U. Littmark, +// From J.F. Zeigler, J. P. Biersack and U. Littmark, // "The Stopping and Range of Ions in Matter" volume 1, Pergamon, 1985. using namespace LAMMPS_NS; @@ -117,7 +117,7 @@ void PairZBL::compute(int eflag, int vflag) if (rsq > cut_innersq) { t = r - cut_inner; - fswitch = t*t * + fswitch = t*t * (sw1[itype][jtype] + sw2[itype][jtype]*t); fpair += fswitch; } @@ -136,7 +136,7 @@ void PairZBL::compute(int eflag, int vflag) evdwl = e_zbl(r, itype, jtype); evdwl += sw5[itype][jtype]; if (rsq > cut_innersq) { - eswitch = t*t*t * + eswitch = t*t*t * (sw3[itype][jtype] + sw4[itype][jtype]*t); evdwl += eswitch; } @@ -275,7 +275,7 @@ double PairZBL::single(int i, int j, int itype, int jtype, double rsq, fforce = dzbldr(r, itype, jtype); if (rsq > cut_innersq) { t = r - cut_inner; - fswitch = t*t * + fswitch = t*t * (sw1[itype][jtype] + sw2[itype][jtype]*t); fforce += fswitch; } @@ -284,7 +284,7 @@ double PairZBL::single(int i, int j, int itype, int jtype, double rsq, phi = e_zbl(r, itype, jtype); phi += sw5[itype][jtype]; if (rsq > cut_innersq) { - eswitch = t*t*t * + eswitch = t*t*t * (sw3[itype][jtype] + sw4[itype][jtype]*t); phi += eswitch; } @@ -297,7 +297,7 @@ double PairZBL::single(int i, int j, int itype, int jtype, double rsq, ------------------------------------------------------------------------- */ double PairZBL::e_zbl(double r, int i, int j) { - + double d1aij = d1a[i][j]; double d2aij = d2a[i][j]; double d3aij = d3a[i][j]; @@ -343,9 +343,9 @@ double PairZBL::dzbldr(double r, int i, int j) { sum_p -= c2*d2aij*e2; sum_p -= c3*d3aij*e3; sum_p -= c4*d4aij*e4; - + double result = zzeij*(sum_p - sum*rinv)*rinv; - + return result; } @@ -381,15 +381,15 @@ double PairZBL::d2zbldr2(double r, int i, int j) { sum_pp += c2*e2*d2aij*d2aij; sum_pp += c3*e3*d3aij*d3aij; sum_pp += c4*e4*d4aij*d4aij; - - double result = zzeij*(sum_pp + 2.0*sum_p*rinv + + + double result = zzeij*(sum_pp + 2.0*sum_p*rinv + 2.0*sum*rinv*rinv)*rinv; - + return result; } /* ---------------------------------------------------------------------- - calculate the i,j entries in the various coeff arrays + calculate the i,j entries in the various coeff arrays ------------------------------------------------------------------------- */ void PairZBL::set_coeff(int i, int j, double zi, double zj) @@ -400,51 +400,51 @@ void PairZBL::set_coeff(int i, int j, double zi, double zj) d3a[i][j] = d3*ainv; d4a[i][j] = d4*ainv; zze[i][j] = zi*zj*force->qqr2e*force->qelectron*force->qelectron; - + d1a[j][i] = d1a[i][j]; d2a[j][i] = d2a[i][j]; d3a[j][i] = d3a[i][j]; d4a[j][i] = d4a[i][j]; zze[j][i] = zze[i][j]; - - // e = t^3 (sw3 + sw4*t) + sw5 + + // e = t^3 (sw3 + sw4*t) + sw5 // = A/3*t^3 + B/4*t^4 + C - // sw3 = A/3 - // sw4 = B/4 + // sw3 = A/3 + // sw4 = B/4 // sw5 = C - - // dedr = t^2 (sw1 + sw2*t) + + // dedr = t^2 (sw1 + sw2*t) // = A*t^2 + B*t^3 - // sw1 = A - // sw2 = B - + // sw1 = A + // sw2 = B + // de2dr2 = 2*A*t + 3*B*t^2 - + // Require that at t = tc: // e = -Fc // dedr = -Fc' - // d2edr2 = -Fc'' - + // d2edr2 = -Fc'' + // Hence: // A = (-3Fc' + tc*Fc'')/tc^2 // B = ( 2Fc' - tc*Fc'')/tc^3 // C = -Fc + tc/2*Fc' - tc^2/12*Fc'' - + double tc = cut_global - cut_inner; double fc = e_zbl(cut_global, i, j); double fcp = dzbldr(cut_global, i, j); double fcpp = d2zbldr2(cut_global, i, j); - + double swa = (-3.0*fcp + tc*fcpp)/(tc*tc); double swb = ( 2.0*fcp - tc*fcpp)/(tc*tc*tc); - double swc = -fc + (tc/2.0)*fcp - (tc*tc/12.0)*fcpp; - + double swc = -fc + (tc/2.0)*fcp - (tc*tc/12.0)*fcpp; + sw1[i][j] = swa; sw2[i][j] = swb; sw3[i][j] = swa/3.0; sw4[i][j] = swb/4.0; sw5[i][j] = swc; - + sw1[j][i] = sw1[i][j]; sw2[j][i] = sw2[i][j]; sw3[j][i] = sw3[i][j]; diff --git a/src/pointers.h b/src/pointers.h index faca833130afbe420cb58e664d6599dad9f4d1ec..dd528c3a747efaa5ff8765840161433a38474c54 100644 --- a/src/pointers.h +++ b/src/pointers.h @@ -22,7 +22,7 @@ #define LMP_POINTERS_H #include "lmptype.h" -#include "mpi.h" +#include <mpi.h> #include "lammps.h" namespace LAMMPS_NS { diff --git a/src/random_mars.cpp b/src/random_mars.cpp index fb5725b8c3e19068e19f0c4493ec51376da4c115..96398b170ccbf672f1f413cc6481fcd73ed918a8 100644 --- a/src/random_mars.cpp +++ b/src/random_mars.cpp @@ -14,7 +14,7 @@ // Marsaglia random number generator // see RANMAR in F James, Comp Phys Comm, 60, 329 (1990) -#include "math.h" +#include <math.h> #include "random_mars.h" #include "error.h" diff --git a/src/random_park.cpp b/src/random_park.cpp index 89e89fc4b939435e08716a67abfb32953cc3f671..28580c5cf5b99b05517059ac9a4da82bff17920c 100644 --- a/src/random_park.cpp +++ b/src/random_park.cpp @@ -13,7 +13,7 @@ // Park/Miller RNG -#include "math.h" +#include <math.h> #include "random_park.h" #include "error.h" diff --git a/src/rcb.cpp b/src/rcb.cpp index 94cdb155ace44d6c5a292093f15b76609c6db774..7223e4616aa94c805533bab34115596173cfeff1 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "rcb.h" #include "irregular.h" #include "memory.h" @@ -142,7 +142,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, // initial bounding box = simulation box // includes periodic or shrink-wrapped boundaries - + lo = bbox.lo; hi = bbox.hi; @@ -193,7 +193,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, procpartner = me + (procmid - proclower); else procpartner = me - (procmid - proclower); - + int readnumber = 1; if (procpartner > procupper) { readnumber = 0; @@ -203,7 +203,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, readnumber = 2; procpartner2 = procpartner + 1; } - + // wttot = summed weight of entire partition // search tolerance = largest single weight (plus epsilon) // targetlo = desired weight in lower half of partition @@ -276,14 +276,14 @@ void RCB::compute(int dimension, int n, double **x, double *wt, // choose bisector value // use old value on 1st iteration if old cut dimension is the same - // on 2nd option: could push valuehalf towards geometric center + // on 2nd option: could push valuehalf towards geometric center // with "1.0-factor" to force overshoot if (first_iteration && reuse && dim == tree[procmid].dim) { counters[5]++; valuehalf = tree[procmid].cut; if (valuehalf < valuemin || valuehalf > valuemax) - valuehalf = 0.5 * (valuemin + valuemax); + valuehalf = 0.5 * (valuemin + valuemax); } else if (wt) valuehalf = valuemin + (targetlo - wtlo) / (wttot - wtlo - wthi) * (valuemax - valuemin); @@ -291,7 +291,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, valuehalf = 0.5 * (valuemin + valuemax); first_iteration = 0; - + // initialize local median data structure medme.totallo = medme.totalhi = 0.0; @@ -361,7 +361,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, else { // multiple dots to move breakflag = 0; wtok = 0.0; - if (medme.valuehi == med.valuehi) wtok = medme.wthi; + if (medme.valuehi == med.valuehi) wtok = medme.wthi; if (wtlo + med.wthi >= targetlo) { // all done MPI_Scan(&wtok,&wtupto,1,MPI_DOUBLE,MPI_SUM,comm); wtmax = targetlo - wtlo; @@ -404,7 +404,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, else { // multiple dots to move breakflag = 0; wtok = 0.0; - if (medme.valuelo == med.valuelo) wtok = medme.wtlo; + if (medme.valuelo == med.valuelo) wtok = medme.wtlo; if (wthi + med.wtlo >= targethi) { // all done MPI_Scan(&wtok,&wtupto,1,MPI_DOUBLE,MPI_SUM,comm); wtmax = targethi - wthi; @@ -414,7 +414,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, for (j = 0, wtsum = 0.0; j < nlist && wtsum < wtok; j++) { i = dotlist[j]; if (dots[i].x[dim] == med.valuelo) { // only move if better - if (wtsum + dots[i].wt - wtok < wtok - wtsum) + if (wtsum + dots[i].wt - wtok < wtok - wtsum) dotmark[i] = 1; wtsum += dots[i].wt; } @@ -433,7 +433,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, break; // shrink the active list - + k = 0; for (j = 0; j < nlist; j++) { i = dotlist[j]; @@ -463,7 +463,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, if (dotmark[i] == markactive) outgoing++; else if (i < nkeep) keep++; nkeep = keep; - + // alert partner how many dots I'll send, read how many I'll recv MPI_Send(&outgoing,1,MPI_INT,procpartner,0,world); @@ -489,7 +489,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, counters[2] += incoming; if (ndotnew > counters[3]) counters[3] = ndotnew; if (maxdot > counters[4]) counters[4] = maxdot; - + // malloc comm send buffer if (outgoing > maxbuf) { @@ -500,7 +500,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, // fill buffer with dots that are marked for sending // pack down the unmarked ones - + keep = outgoing = 0; for (i = 0; i < ndot; i++) { if (dotmark[i] == markactive) @@ -520,9 +520,9 @@ void RCB::compute(int dimension, int n, double **x, double *wt, procpartner2,1,world,&request2); } } - + // handshake before sending dots to insure recvs have been posted - + if (readnumber > 0) { MPI_Send(NULL,0,MPI_INT,procpartner,0,world); if (readnumber == 2) MPI_Send(NULL,0,MPI_INT,procpartner2,0,world); @@ -532,7 +532,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, // send dots to partner MPI_Rsend(buf,outgoing*sizeof(Dot),MPI_CHAR,procpartner,1,world); - + // wait until all dots are received if (readnumber > 0) { @@ -620,7 +620,7 @@ void median_merge(void *in, void *inout, int *len, MPI_Datatype *dptr) { RCB::Median *med1 = (RCB::Median *) in; RCB::Median *med2 = (RCB::Median *) inout; - + med2->totallo += med1->totallo; if (med1->valuelo > med2->valuelo) { med2->valuelo = med1->valuelo; @@ -668,7 +668,7 @@ void RCB::invert(int sortflag) int *proclist; memory->create(proclist,nsend,"RCB:proclist"); - Invert *sinvert = + Invert *sinvert = (Invert *) memory->smalloc(nsend*sizeof(Invert),"RCB:sinvert"); int m = 0; @@ -679,12 +679,12 @@ void RCB::invert(int sortflag) sinvert[m].sindex = i; m++; } - + // perform inversion via irregular comm // nrecv = # of my dots to send to other procs int nrecv = irregular->create_data(nsend,proclist,sortflag); - Invert *rinvert = + Invert *rinvert = (Invert *) memory->smalloc(nrecv*sizeof(Invert),"RCB:rinvert"); irregular->exchange_data((char *) sinvert,sizeof(Invert),(char *) rinvert); irregular->destroy_data(); @@ -744,11 +744,11 @@ void RCB::check() MPI_Allreduce(&ndotorig,&total1,1,MPI_INT,MPI_SUM,world); MPI_Allreduce(&ndot,&total2,1,MPI_INT,MPI_SUM,world); if (total1 != total2) { - if (me == 0) + if (me == 0) printf("ERROR: Points before RCB = %d, Points after RCB = %d\n", total1,total2); } - + // check that result is load-balanced within log2(P)*max-wt weight = wtone = 0.0; @@ -768,17 +768,17 @@ void RCB::check() tolerance = tolerance * i * (1.0 + TINY); if (wtmax - wtmin > tolerance) { - if (me == 0) + if (me == 0) printf("ERROR: Load-imbalance > tolerance of %g\n",tolerance); MPI_Barrier(world); if (weight == wtmin) printf(" Proc %d has weight = %g\n",me,weight); if (weight == wtmax) printf(" Proc %d has weight = %g\n",me,weight); } - + MPI_Barrier(world); - + // check that final set of points is inside RCB box of each proc - + iflag = 0; for (i = 0; i < ndot; i++) { if (dots[i].x[0] < lo[0] || dots[i].x[0] > hi[0] || @@ -786,7 +786,7 @@ void RCB::check() dots[i].x[2] < lo[2] || dots[i].x[2] > hi[2]) iflag++; } - if (iflag > 0) + if (iflag > 0) printf("ERROR: %d points are out-of-box on proc %d\n",iflag,me); } @@ -801,7 +801,7 @@ void RCB::stats(int flag) if (me == 0) printf("RCB Statistics:\n"); // distribution info - + for (i = 0, weight = 0.0; i < ndot; i++) weight += dots[i].wt; MPI_Allreduce(&weight,&wttot,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&weight,&wtmin,1,MPI_DOUBLE,MPI_MIN,world); @@ -817,10 +817,10 @@ void RCB::stats(int flag) printf(" Proc %d has weight = %g\n",me,weight); } - for (i = 0, weight = 0.0; i < ndot; i++) + for (i = 0, weight = 0.0; i < ndot; i++) if (dots[i].wt > weight) weight = dots[i].wt; MPI_Allreduce(&weight,&wtmax,1,MPI_DOUBLE,MPI_MAX,world); - + if (me == 0) printf(" Maximum weight of single dot = %g\n",wtmax); if (flag) { MPI_Barrier(world); @@ -833,7 +833,7 @@ void RCB::stats(int flag) MPI_Allreduce(&counters[0],&min,1,MPI_INT,MPI_MIN,world); MPI_Allreduce(&counters[0],&max,1,MPI_INT,MPI_MAX,world); ave = ((double) sum)/nprocs; - if (me == 0) + if (me == 0) printf(" Median iter: ave = %g, min = %d, max = %d\n",ave,min,max); if (flag) { MPI_Barrier(world); @@ -844,7 +844,7 @@ void RCB::stats(int flag) MPI_Allreduce(&counters[1],&min,1,MPI_INT,MPI_MIN,world); MPI_Allreduce(&counters[1],&max,1,MPI_INT,MPI_MAX,world); ave = ((double) sum)/nprocs; - if (me == 0) + if (me == 0) printf(" Send count: ave = %g, min = %d, max = %d\n",ave,min,max); if (flag) { MPI_Barrier(world); @@ -855,7 +855,7 @@ void RCB::stats(int flag) MPI_Allreduce(&counters[2],&min,1,MPI_INT,MPI_MIN,world); MPI_Allreduce(&counters[2],&max,1,MPI_INT,MPI_MAX,world); ave = ((double) sum)/nprocs; - if (me == 0) + if (me == 0) printf(" Recv count: ave = %g, min = %d, max = %d\n",ave,min,max); if (flag) { MPI_Barrier(world); @@ -866,7 +866,7 @@ void RCB::stats(int flag) MPI_Allreduce(&counters[3],&min,1,MPI_INT,MPI_MIN,world); MPI_Allreduce(&counters[3],&max,1,MPI_INT,MPI_MAX,world); ave = ((double) sum)/nprocs; - if (me == 0) + if (me == 0) printf(" Max dots: ave = %g, min = %d, max = %d\n",ave,min,max); if (flag) { MPI_Barrier(world); @@ -877,7 +877,7 @@ void RCB::stats(int flag) MPI_Allreduce(&counters[4],&min,1,MPI_INT,MPI_MIN,world); MPI_Allreduce(&counters[4],&max,1,MPI_INT,MPI_MAX,world); ave = ((double) sum)/nprocs; - if (me == 0) + if (me == 0) printf(" Max memory: ave = %g, min = %d, max = %d\n",ave,min,max); if (flag) { MPI_Barrier(world); @@ -889,19 +889,19 @@ void RCB::stats(int flag) MPI_Allreduce(&counters[5],&min,1,MPI_INT,MPI_MIN,world); MPI_Allreduce(&counters[5],&max,1,MPI_INT,MPI_MAX,world); ave = ((double) sum)/nprocs; - if (me == 0) + if (me == 0) printf(" # of Reuse: ave = %g, min = %d, max = %d\n",ave,min,max); if (flag) { MPI_Barrier(world); printf(" Proc %d # of Reuse = %d\n",me,counters[5]); } } - + MPI_Allreduce(&counters[6],&sum,1,MPI_INT,MPI_SUM,world); MPI_Allreduce(&counters[6],&min,1,MPI_INT,MPI_MIN,world); MPI_Allreduce(&counters[6],&max,1,MPI_INT,MPI_MAX,world); ave = ((double) sum)/nprocs; - if (me == 0) + if (me == 0) printf(" # of OverAlloc: ave = %g, min = %d, max = %d\n",ave,min,max); if (flag) { MPI_Barrier(world); @@ -909,7 +909,7 @@ void RCB::stats(int flag) } // RCB boxes for each proc - + if (flag) { if (me == 0) printf(" RCB sub-domain boxes:\n"); for (i = 0; i < 3; i++) { diff --git a/src/rcb.h b/src/rcb.h index 345e0c6bb9408df7a67a1ef0aaeca8abb0be03f9..7a82d42f93b1fe96b402f45c29a2f583d8ec0eaa 100644 --- a/src/rcb.h +++ b/src/rcb.h @@ -14,7 +14,7 @@ #ifndef LAMMPS_RCB_H #define LAMMPS_RCB_H -#include "mpi.h" +#include <mpi.h> #include "pointers.h" namespace LAMMPS_NS { @@ -50,7 +50,7 @@ class RCB : protected Pointers { //void stats(int); // RCB cut info - + struct Median { double totallo,totalhi; // weight in each half of active partition double valuelo,valuehi; // position of dot(s) nearest to cut @@ -62,7 +62,7 @@ class RCB : protected Pointers { struct BBox { double lo[3],hi[3]; // corner points of a bounding box }; - + private: int me,nprocs; @@ -81,7 +81,7 @@ class RCB : protected Pointers { double cut; // position of cut int dim; // dimension = 0/1/2 of cut }; - + // inversion message struct Invert { @@ -114,7 +114,7 @@ class RCB : protected Pointers { int reuse; // 1/0 to use/not use previous cuts int dottop; // dots >= this index are new double bboxlo[3]; // bounding box of final RCB sub-domain - double bboxhi[3]; + double bboxhi[3]; Tree *tree; // tree of RCB cuts, used by reuse() int counters[7]; // diagnostic counts // 0 = # of median iterations diff --git a/src/read_data.cpp b/src/read_data.cpp index 7e4b70484b43d717c725a33e5da290cb707f9b6f..dfafa8a24b0039cb3d87369f570703a3dbbefe27 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -15,12 +15,12 @@ // due to OpenMPI bug which sets INT64_MAX via its mpi.h // before lmptype.h can set flags to insure it is done correctly -#include "lmptype.h" -#include "mpi.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" -#include "ctype.h" +#include "lmptype.h" +#include <mpi.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> #include "read_data.h" #include "atom.h" #include "atom_vec.h" @@ -125,7 +125,7 @@ void ReadData::command(int narg, char **arg) offsetflag = shiftflag = 0; toffset = boffset = aoffset = doffset = ioffset = 0; shift[0] = shift[1] = shift[2] = 0.0; - extra_atom_types = extra_bond_types = extra_angle_types = + extra_atom_types = extra_bond_types = extra_angle_types = extra_dihedral_types = extra_improper_types = 0; groupbit = 0; @@ -144,7 +144,7 @@ void ReadData::command(int narg, char **arg) else { addflag = VALUE; bigint offset = force->bnumeric(FLERR,arg[iarg+1]); - if (offset > MAXTAGINT) + if (offset > MAXTAGINT) error->all(FLERR,"Read data add offset is too big"); id_offset = offset; } @@ -157,8 +157,8 @@ void ReadData::command(int narg, char **arg) aoffset = force->inumeric(FLERR,arg[iarg+3]); doffset = force->inumeric(FLERR,arg[iarg+4]); ioffset = force->inumeric(FLERR,arg[iarg+5]); - if (toffset < 0 || boffset < 0 || aoffset < 0 || - doffset < 0 || ioffset < 0) + if (toffset < 0 || boffset < 0 || aoffset < 0 || + doffset < 0 || ioffset < 0) error->all(FLERR,"Illegal read_data command"); iarg += 6; } else if (strcmp(arg[iarg],"shift") == 0) { @@ -178,32 +178,32 @@ void ReadData::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"extra/bond/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); - if (!atom->avec->bonds_allow) + if (!atom->avec->bonds_allow) error->all(FLERR,"No bonds allowed with this atom style"); extra_bond_types = force->inumeric(FLERR,arg[iarg+1]); if (extra_bond_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; } else if (strcmp(arg[iarg],"extra/angle/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); - if (!atom->avec->angles_allow) + if (!atom->avec->angles_allow) error->all(FLERR,"No angles allowed with this atom style"); extra_angle_types = force->inumeric(FLERR,arg[iarg+1]); if (extra_angle_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; } else if (strcmp(arg[iarg],"extra/dihedral/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); - if (!atom->avec->dihedrals_allow) + if (!atom->avec->dihedrals_allow) error->all(FLERR,"No dihedrals allowed with this atom style"); extra_dihedral_types = force->inumeric(FLERR,arg[iarg+1]); - if (extra_dihedral_types < 0) + if (extra_dihedral_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; } else if (strcmp(arg[iarg],"extra/improper/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); - if (!atom->avec->impropers_allow) + if (!atom->avec->impropers_allow) error->all(FLERR,"No impropers allowed with this atom style"); extra_improper_types = force->inumeric(FLERR,arg[iarg+1]); - if (extra_improper_types < 0) + if (extra_improper_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; @@ -255,8 +255,8 @@ void ReadData::command(int narg, char **arg) error->all(FLERR,"Cannot use read_data offset without add flag"); if (shiftflag && addflag == NONE) error->all(FLERR,"Cannot use read_data shift without add flag"); - if (addflag != NONE && - (extra_atom_types || extra_bond_types || extra_angle_types || + if (addflag != NONE && + (extra_atom_types || extra_bond_types || extra_angle_types || extra_dihedral_types || extra_improper_types)) error->all(FLERR,"Cannot use read_data extra with add flag"); @@ -312,9 +312,9 @@ void ReadData::command(int narg, char **arg) if (firstpass && screen) fprintf(screen,"Reading data file ...\n"); open(arg[0]); } else fp = NULL; - + // read header info - + header(firstpass); // problem setup using info from header @@ -405,7 +405,7 @@ void ReadData::command(int narg, char **arg) atoms(); } else skip_lines(natoms); } else if (strcmp(keyword,"Velocities") == 0) { - if (atomflag == 0) + if (atomflag == 0) error->all(FLERR,"Must read Atoms before Velocities"); if (firstpass) velocities(); else skip_lines(natoms); @@ -434,14 +434,14 @@ void ReadData::command(int narg, char **arg) error->all(FLERR,"Invalid data file section: Impropers"); if (atomflag == 0) error->all(FLERR,"Must read Atoms before Impropers"); impropers(firstpass); - + } else if (strcmp(keyword,"Ellipsoids") == 0) { ellipsoidflag = 1; if (!avec_ellipsoid) error->all(FLERR,"Invalid data file section: Ellipsoids"); - if (atomflag == 0) + if (atomflag == 0) error->all(FLERR,"Must read Atoms before Ellipsoids"); - if (firstpass) + if (firstpass) bonus(nellipsoids,(AtomVec *) avec_ellipsoid,"ellipsoids"); else skip_lines(nellipsoids); } else if (strcmp(keyword,"Lines") == 0) { @@ -590,7 +590,7 @@ void ReadData::command(int narg, char **arg) "Must define dihedral_style before BondBond13 Coeffs"); if (firstpass) dihedralcoeffs(5); else skip_lines(ndihedraltypes); - + } else if (strcmp(keyword,"AngleAngle Coeffs") == 0) { if (atom->avec->impropers_allow == 0) error->all(FLERR,"Invalid data file section: AngleAngle Coeffs"); @@ -605,7 +605,7 @@ void ReadData::command(int narg, char **arg) sprintf(str,"Unknown identifier in data file: %s",keyword); error->all(FLERR,str); } - + parse_keyword(0); } @@ -613,9 +613,9 @@ void ReadData::command(int narg, char **arg) if (natoms > 0 && atomflag == 0) error->all(FLERR,"No atoms in data file"); - + // close file - + if (me == 0) { if (compressed) pclose(fp); else fclose(fp); @@ -639,7 +639,7 @@ void ReadData::command(int narg, char **arg) // break out of loop if no molecular topology in file // else make 2nd pass - + if (!topoflag) break; firstpass = 0; @@ -668,7 +668,7 @@ void ReadData::command(int narg, char **arg) special.build(); } - // for atom style template systems, count total bonds,angles,etc + // for atom style template systems, count total bonds,angles,etc if (atom->molecular == 2) { Molecule **onemols = atom->avec->onemols; @@ -894,7 +894,7 @@ void ReadData::header(int firstpass) sscanf(line,BIGINT_FORMAT,&nimpropers); if (addflag == NONE) atom->nimpropers = nimpropers; else atom->nimpropers += nimpropers; - + // Atom class type settings are only set by first data file } else if (strstr(line,"atom types")) { @@ -908,11 +908,11 @@ void ReadData::header(int firstpass) if (addflag == NONE) atom->nangletypes = nangletypes + extra_angle_types; } else if (strstr(line,"dihedral types")) { sscanf(line,"%d",&ndihedraltypes); - if (addflag == NONE) + if (addflag == NONE) atom->ndihedraltypes = ndihedraltypes + extra_dihedral_types; } else if (strstr(line,"improper types")) { sscanf(line,"%d",&nimpropertypes); - if (addflag == NONE) + if (addflag == NONE) atom->nimpropertypes = nimpropertypes + extra_improper_types; // these settings only used by first data file @@ -979,7 +979,7 @@ void ReadData::header(int firstpass) if ((atom->nimpropers || atom->nimpropertypes) && atom->avec->impropers_allow == 0) error->all(FLERR,"No impropers allowed with this atom style"); - + if (atom->nbonds > 0 && atom->nbondtypes <= 0) error->all(FLERR,"Bonds defined but no bond types"); if (atom->nangles > 0 && atom->nangletypes <= 0) @@ -1032,7 +1032,7 @@ void ReadData::atoms() if (sum != atom->natoms) error->all(FLERR,"Did not assign all atoms correctly"); - + // check that atom IDs are valid atom->tag_check(); @@ -1143,7 +1143,7 @@ void ReadData::bonds(int firstpass) } if (addflag != NONE) { - if (maxall > atom->bond_per_atom) + if (maxall > atom->bond_per_atom) error->all(FLERR,"Subsequent read data induced " "too many bonds per atom"); } else atom->bond_per_atom = maxall; @@ -1226,7 +1226,7 @@ void ReadData::angles(int firstpass) } if (addflag != NONE) { - if (maxall > atom->angle_per_atom) + if (maxall > atom->angle_per_atom) error->all(FLERR,"Subsequent read data induced " "too many angles per atom"); } else atom->angle_per_atom = maxall; @@ -1309,7 +1309,7 @@ void ReadData::dihedrals(int firstpass) } if (addflag != NONE) { - if (maxall > atom->dihedral_per_atom) + if (maxall > atom->dihedral_per_atom) error->all(FLERR,"Subsequent read data induced " "too many dihedrals per atom"); } else atom->dihedral_per_atom = maxall; @@ -1393,7 +1393,7 @@ void ReadData::impropers(int firstpass) } if (addflag != NONE) { - if (maxall > atom->improper_per_atom) + if (maxall > atom->improper_per_atom) error->all(FLERR,"Subsequent read data induced " "too many impropers per atom"); } else atom->improper_per_atom = maxall; @@ -1586,7 +1586,7 @@ void ReadData::pairIJcoeffs() { int i,j; char *next; - + int nsq = ntypes * (ntypes+1) / 2; char *buf = new char[nsq * MAXLINE]; diff --git a/src/read_data.h b/src/read_data.h index 925ec1f07eb071d4b1bb7ed3acfc41ca99aa9665..7a0369208665254ea4c469c29b85935013ec27cb 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -20,7 +20,7 @@ CommandStyle(read_data,ReadData) #ifndef LMP_READ_DATA_H #define LMP_READ_DATA_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { @@ -72,7 +72,7 @@ class ReadData : protected Pointers { int extra_dihedral_types,extra_improper_types; int groupbit; - int nfix; + int nfix; int *fix_index; char **fix_header; char **fix_section; diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 1aa121da571045d2d05cc895161257e3a1b19f33..47888c5ed82cd70a412c7eddfd51b6ebb2dc6714 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -19,10 +19,10 @@ // due to OpenMPI bug which sets INT64_MAX via its mpi.h // before lmptype.h can set flags to insure it is done correctly -#include "lmptype.h" -#include "mpi.h" -#include "string.h" -#include "stdlib.h" +#include "lmptype.h" +#include <mpi.h> +#include <string.h> +#include <stdlib.h> #include "read_dump.h" #include "reader.h" #include "style_reader.h" @@ -810,8 +810,8 @@ void ReadDump::process_atoms(int n) if (!wrapped) xbox = ybox = zbox = 0; - image[m] = ((imageint) (xbox + IMGMAX) & IMGMASK) | - (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + image[m] = ((imageint) (xbox + IMGMAX) & IMGMASK) | + (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } } @@ -899,8 +899,8 @@ void ReadDump::process_atoms(int n) // replace image flag in case changed by ix,iy,iz fields - image[m] = ((imageint) (xbox + IMGMAX) & IMGMASK) | - (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + image[m] = ((imageint) (xbox + IMGMAX) & IMGMASK) | + (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } } diff --git a/src/read_dump.h b/src/read_dump.h index 8301c8a5d078e7dd2a4809ce56abc7720e372048..8322ac0157404743e845fa6e9d84d2d730de8eb8 100644 --- a/src/read_dump.h +++ b/src/read_dump.h @@ -22,7 +22,7 @@ CommandStyle(read_dump,ReadDump) #ifndef LMP_READ_DUMP_H #define LMP_READ_DUMP_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 743c88ba2c5bc3f9db4e5cff83349ddbb60a2c47..b53b102c91236df75495b0b2e52b1740fb2cc9a2 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" -#include "stdlib.h" -#include "dirent.h" +#include <mpi.h> +#include <string.h> +#include <stdlib.h> +#include <dirent.h> #include "read_restart.h" #include "atom.h" #include "atom_vec.h" @@ -110,13 +110,13 @@ void ReadRestart::command(int narg, char **arg) if (strstr(arg[0],".mpiio")) mpiioflag = 1; else mpiioflag = 0; - if (multiproc && mpiioflag) + if (multiproc && mpiioflag) error->all(FLERR, "Read restart MPI-IO input not allowed with % in filename"); if (mpiioflag) { mpiio = new RestartMPIIO(lmp); - if (!mpiio->mpiio_exists) + if (!mpiio->mpiio_exists) error->all(FLERR,"Reading from MPI-IO filename when " "MPIIO package is not installed"); } @@ -234,7 +234,7 @@ void ReadRestart::command(int narg, char **arg) } for (int iproc = 0; iproc < nprocs_file; iproc++) { - if (read_int() != PERPROC) + if (read_int() != PERPROC) error->all(FLERR,"Invalid flag in peratom section of restart file"); n = read_int(); @@ -294,16 +294,16 @@ void ReadRestart::command(int narg, char **arg) } fread(&flag,sizeof(int),1,fp); - if (flag != PROCSPERFILE) + if (flag != PROCSPERFILE) error->one(FLERR,"Invalid flag in peratom section of restart file"); int procsperfile; fread(&procsperfile,sizeof(int),1,fp); for (int i = 0; i < procsperfile; i++) { fread(&flag,sizeof(int),1,fp); - if (flag != PERPROC) + if (flag != PERPROC) error->one(FLERR,"Invalid flag in peratom section of restart file"); - + fread(&n,sizeof(int),1,fp); if (n > maxbuf) { maxbuf = n; @@ -342,7 +342,7 @@ void ReadRestart::command(int narg, char **arg) int fileproc = static_cast<int> ((bigint) icluster * nprocs/nfile); int fcluster = static_cast<int> ((bigint) fileproc * nfile/nprocs); if (fcluster < icluster) fileproc++; - int fileprocnext = + int fileprocnext = static_cast<int> ((bigint) (icluster+1) * nprocs/nfile); fcluster = static_cast<int> ((bigint) fileprocnext * nfile/nprocs); if (fcluster < icluster+1) fileprocnext++; @@ -371,7 +371,7 @@ void ReadRestart::command(int narg, char **arg) if (filereader) { fread(&flag,sizeof(int),1,fp); - if (flag != PROCSPERFILE) + if (flag != PROCSPERFILE) error->one(FLERR,"Invalid flag in peratom section of restart file"); fread(&procsperfile,sizeof(int),1,fp); } @@ -383,7 +383,7 @@ void ReadRestart::command(int narg, char **arg) for (int i = 0; i < procsperfile; i++) { if (filereader) { fread(&flag,sizeof(int),1,fp); - if (flag != PERPROC) + if (flag != PERPROC) error->one(FLERR,"Invalid flag in peratom section of restart file"); fread(&n,sizeof(int),1,fp); @@ -666,7 +666,7 @@ void ReadRestart::header(int incompatible) if (screen) fprintf(screen," restart file = %s, LAMMPS = %s\n", version,universe->version); } - if (incompatible) + if (incompatible) error->all(FLERR,"Restart file incompatible with current version"); delete [] version; @@ -729,7 +729,7 @@ void ReadRestart::header(int incompatible) procgrid[1] != comm->user_procgrid[1]) flag = 1; if (comm->user_procgrid[2] != 0 && procgrid[2] != comm->user_procgrid[2]) flag = 1; - if (flag && me == 0) + if (flag && me == 0) error->warning(FLERR,"Restart file used different 3d processor grid"); // don't set newton_pair, leave input script value unchanged @@ -894,7 +894,7 @@ void ReadRestart::header(int incompatible) atom->sortfreq = read_int(); } else if (flag == ATOM_SORTBIN) { atom->userbinsize = read_double(); - + } else if (flag == COMM_MODE) { comm->mode = read_int(); } else if (flag == COMM_CUTOFF) { @@ -996,7 +996,7 @@ void ReadRestart::file_layout() if (mpiioflag && mpiioflag_file == 0) error->all(FLERR,"Restart file is not a MPI-IO file"); - if (mpiioflag) { + if (mpiioflag) { bigint *nproc_chunk_offsets; memory->create(nproc_chunk_offsets,nprocs, "write_restart:nproc_chunk_offsets"); @@ -1016,45 +1016,45 @@ void ReadRestart::file_layout() int *nproc_chunk_number; memory->create(nproc_chunk_number,nprocs, "write_restart:nproc_chunk_number"); - + fread(all_written_send_sizes,sizeof(int),nprocs_file,fp); - + int init_chunk_number = nprocs_file/nprocs; int num_extra_chunks = nprocs_file - (nprocs*init_chunk_number); - + for (int i = 0; i < nprocs; i++) { if (i < num_extra_chunks) nproc_chunk_number[i] = init_chunk_number+1; else nproc_chunk_number[i] = init_chunk_number; } - + int all_written_send_sizes_index = 0; bigint current_offset = 0; for (int i=0;i<nprocs;i++) { nproc_chunk_offsets[i] = current_offset; nproc_chunk_sizes[i] = 0; for (int j=0;j<nproc_chunk_number[i];j++) { - nproc_chunk_sizes[i] += + nproc_chunk_sizes[i] += all_written_send_sizes[all_written_send_sizes_index]; - current_offset += - (all_written_send_sizes[all_written_send_sizes_index] * + current_offset += + (all_written_send_sizes[all_written_send_sizes_index] * sizeof(double)); all_written_send_sizes_index++; } - + } memory->destroy(all_written_send_sizes); memory->destroy(nproc_chunk_number); } // scatter chunk sizes and offsets to all procs - + MPI_Scatter(nproc_chunk_sizes, 1, MPI_LMP_BIGINT, &assignedChunkSize , 1, MPI_LMP_BIGINT, 0,world); MPI_Scatter(nproc_chunk_offsets, 1, MPI_LMP_BIGINT, &assignedChunkOffset , 1, MPI_LMP_BIGINT, 0,world); - + memory->destroy(nproc_chunk_sizes); memory->destroy(nproc_chunk_offsets); } @@ -1089,10 +1089,10 @@ void ReadRestart::magic_string() int count; if (me == 0) count = fread(str,sizeof(char),n,fp); MPI_Bcast(&count,1,MPI_INT,0,world); - if (count < n) + if (count < n) error->all(FLERR,"Invalid LAMMPS restart file"); MPI_Bcast(str,n,MPI_CHAR,0,world); - if (strcmp(str,MAGIC_STRING) != 0) + if (strcmp(str,MAGIC_STRING) != 0) error->all(FLERR,"Invalid LAMMPS restart file"); delete [] str; } diff --git a/src/read_restart.h b/src/read_restart.h index 586a13c210ea7231906a437f4add321b93ed593b..e21c9dcbf3079d0e9177c5b4dccebd1fb5f74009 100644 --- a/src/read_restart.h +++ b/src/read_restart.h @@ -20,7 +20,7 @@ CommandStyle(read_restart,ReadRestart) #ifndef LMP_READ_RESTART_H #define LMP_READ_RESTART_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/reader.cpp b/src/reader.cpp index 588b21062cf72742e281b6a06bcd72d2e1ce239b..b8914d1b1003136dcc14a16d894c9a056d667967 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdio.h" -#include "string.h" +#include <stdio.h> +#include <string.h> #include "reader.h" #include "error.h" diff --git a/src/reader_native.cpp b/src/reader_native.cpp index 769a651739191bd66e742956e32afcc248c1ab6b..0a876d0728af418a1731addae9a24f4c6e48ae22 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "reader_native.h" #include "atom.h" #include "memory.h" diff --git a/src/reader_xyz.cpp b/src/reader_xyz.cpp index b95d917bd0c991b0aa2a72c603e953bc9ebe0114..a56b503f5e329d2fcd5aecfef8122f5ba8aa30b6 100644 --- a/src/reader_xyz.cpp +++ b/src/reader_xyz.cpp @@ -15,8 +15,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "reader_xyz.h" #include "atom.h" #include "memory.h" diff --git a/src/region.cpp b/src/region.cpp index 9c0897ecb139ac06be9ece3cc0869b411471cc9e..b8489401f236c084fa99ec50e24654f11cddf65e 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "region.h" #include "update.h" #include "domain.h" diff --git a/src/region_block.cpp b/src/region_block.cpp index 0325ae4b1ca9558c4dcec20f6c99af53cbbe7721..c06eeda544045f3b59435e5eee8260199d865454 100644 --- a/src/region_block.cpp +++ b/src/region_block.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "region_block.h" #include "domain.h" #include "error.h" diff --git a/src/region_cone.cpp b/src/region_cone.cpp index 09408c8d93f4e233cb6a4f1a38ed3436895399c5..deb8d04841099f1f3de072a32a3bad69923c60f3 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -15,9 +15,9 @@ Contributing author: Pim Schravendijk ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "region_cone.h" #include "domain.h" #include "error.h" diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index 2e46f5523dac34c6c676ec87ae98cdc0da6882dc..b77ff2a88120de41a3ce023c6df8190e0ecf8733 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "region_cylinder.h" #include "update.h" #include "domain.h" diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index 96c2e59a7c86a2a038584a6f6333c0fd66b0192e..bfbe579367ccb6bb850a8c255d0874f2d2bbb8b3 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "region_intersect.h" #include "domain.h" #include "error.h" @@ -43,7 +43,7 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : idsub[nregion] = new char[m]; strcpy(idsub[nregion],arg[iarg+3]); iregion = domain->find_region(idsub[nregion]); - if (iregion == -1) + if (iregion == -1) error->all(FLERR,"Region intersect region ID does not exist"); list[nregion++] = iregion; } @@ -117,7 +117,7 @@ void RegIntersect::init() int iregion; for (int ilist = 0; ilist < nregion; ilist++) { iregion = domain->find_region(idsub[ilist]); - if (iregion == -1) + if (iregion == -1) error->all(FLERR,"Region union region ID does not exist"); list[ilist] = iregion; } diff --git a/src/region_plane.cpp b/src/region_plane.cpp index 9a0d47c1fe2121134b68c28bbc8bb4d0b1fec6e7..38d5b92bcb82623c10e1033ff273e2b0f57ebd2c 100644 --- a/src/region_plane.cpp +++ b/src/region_plane.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "region_plane.h" #include "error.h" #include "force.h" diff --git a/src/region_prism.cpp b/src/region_prism.cpp index 01e6f60c8a744cc803e51d369e71ae3cfc0afe32..1efd3d964b5b8081447d404bcc17bf7db2092c6a 100644 --- a/src/region_prism.cpp +++ b/src/region_prism.cpp @@ -15,9 +15,9 @@ Contributing author: Pieter in 't Veld (SNL) ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "region_prism.h" #include "domain.h" #include "force.h" diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index 709080866d2ba21d7107ee7092256383de07633e..409a497f1118def64350c64c4eca7b9ee5014c2b 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -11,9 +11,9 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "region_sphere.h" #include "update.h" #include "input.h" diff --git a/src/region_union.cpp b/src/region_union.cpp index 30a33bf48ad638d14c0ab5755425f7f888105cfb..2772d7b4d52b7d6fa19edc504293ebef5b296e44 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "region_union.h" #include "domain.h" #include "error.h" @@ -44,7 +44,7 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) idsub[nregion] = new char[m]; strcpy(idsub[nregion],arg[iarg+3]); iregion = domain->find_region(idsub[nregion]); - if (iregion == -1) + if (iregion == -1) error->all(FLERR,"Region union region ID does not exist"); list[nregion++] = iregion; } @@ -109,7 +109,7 @@ void RegUnion::init() int iregion; for (int ilist = 0; ilist < nregion; ilist++) { iregion = domain->find_region(idsub[ilist]); - if (iregion == -1) + if (iregion == -1) error->all(FLERR,"Region union region ID does not exist"); list[ilist] = iregion; } diff --git a/src/replicate.cpp b/src/replicate.cpp index d94940d5e47741caf3a39045cf252619bc12f86d..941ec324921aaff78e6f47bc662353b7b4073a79 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "replicate.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/rerun.cpp b/src/rerun.cpp index bb98f23dfa8c754e868c29713604fab7aa2712e8..2f357c21028879abd0b129fb67e2a4d6d0bdc3b0 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "rerun.h" #include "read_dump.h" #include "domain.h" diff --git a/src/respa.cpp b/src/respa.cpp index dbd3effb63c76f094ef8a112384a8fd93ed477aa..e4afa2bd131a83c33e2ac488e3363707ea024bac 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -15,8 +15,8 @@ Contributing authors: Mark Stevens (SNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "respa.h" #include "neighbor.h" #include "atom.h" @@ -269,7 +269,7 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : Integrate(lmp, narg, arg) cutoff[3] = cutoff[1]; } - // ensure that pair->compute() is run properly when the "hybrid" keyword is not used. + // ensure that pair->compute() is run properly when the "hybrid" keyword is not used. if (nhybrid_styles < 1) { pair_compute = 1; tally_global = 1; @@ -628,7 +628,7 @@ void Respa::recurse(int ilevel) } timer->stamp(); comm->exchange(); - if (atom->sortfreq > 0 && + if (atom->sortfreq > 0 && update->ntimestep >= atom->nextsort) atom->sort(); comm->borders(); if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); diff --git a/src/run.cpp b/src/run.cpp index d321f921f86b2a137239c8decfe4faeee7888b00..b120d2a14cb758f3e3a06846e300c01f1f5938cc 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include "run.h" #include "domain.h" #include "update.h" diff --git a/src/set.cpp b/src/set.cpp index 99195182947b027731eee96a4b3ded1516bba052..33f6b77dc7c3966d3a71facaeba4b54c9dfccdfd 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -11,10 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "set.h" #include "atom.h" #include "atom_vec.h" @@ -565,7 +565,7 @@ void Set::set(int keyword) // overwrite dvalue, ivalue, xyzw value if variables defined // else the input script scalar value remains in place - + if (varflag) { if (varflag1) { dvalue = xvalue = vec1[i]; @@ -583,7 +583,7 @@ void Set::set(int keyword) if (ivalue <= 0 || ivalue > atom->ntypes) error->one(FLERR,"Invalid value in set command"); atom->type[i] = ivalue; - } + } else if (keyword == MOLECULE) atom->molecule[i] = ivalue; else if (keyword == X) atom->x[i][0] = dvalue; else if (keyword == Y) atom->x[i][1] = dvalue; @@ -592,7 +592,7 @@ void Set::set(int keyword) else if (keyword == MASS) { if (dvalue <= 0.0) error->one(FLERR,"Invalid mass in set command"); atom->rmass[i] = dvalue; - } + } else if (keyword == DIAMETER) { if (dvalue < 0.0) error->one(FLERR,"Invalid diameter in set command"); atom->radius[i] = 0.5 * dvalue; @@ -730,8 +730,8 @@ void Set::set(int keyword) if (ximageflag) xbox = ximage; if (yimageflag) ybox = yimage; if (zimageflag) zbox = zimage; - atom->image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | - (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + atom->image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | + (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } diff --git a/src/special.cpp b/src/special.cpp index ebabbff281aeea2db4b9d69a4a8ab25d9e8b0367..ae566ec4f5a1f32236a38d52679ec5ff628acc57 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "stdio.h" +#include <mpi.h> +#include <stdio.h> #include "special.h" #include "atom.h" #include "atom_vec.h" diff --git a/src/thermo.cpp b/src/thermo.cpp index 34ccfce9f45cf8d5c4a20217a9d8fc753ba58407..b96be64bf65116c4ce6cfcfa0c7bec6c0370591c 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -15,11 +15,11 @@ // due to OpenMPI bug which sets INT64_MAX via its mpi.h // before lmptype.h can set flags to insure it is done correctly -#include "lmptype.h" -#include "mpi.h" -#include "math.h" -#include "stdlib.h" -#include "string.h" +#include "lmptype.h" +#include <mpi.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> #include "thermo.h" #include "atom.h" #include "update.h" @@ -842,11 +842,11 @@ void Thermo::parse_fields(char *str) if (ptr == NULL) argindex1[nfield] = 0; else { *ptr = '\0'; - argindex1[nfield] = + argindex1[nfield] = (int) input->variable->int_between_brackets(ptr,0); ptr++; if (*ptr == '[') { - argindex2[nfield] = + argindex2[nfield] = (int) input->variable->int_between_brackets(ptr,0); ptr++; } else argindex2[nfield] = 0; @@ -890,7 +890,7 @@ void Thermo::parse_fields(char *str) if (argindex1[nfield] > 0 && argindex2[nfield] == 0) { if (modify->fix[n]->vector_flag == 0) error->all(FLERR,"Thermo fix does not compute vector"); - if (argindex1[nfield] > modify->fix[n]->size_vector && + if (argindex1[nfield] > modify->fix[n]->size_vector && modify->fix[n]->size_vector_variable == 0) error->all(FLERR,"Thermo fix vector is accessed out-of-range"); } @@ -909,7 +909,7 @@ void Thermo::parse_fields(char *str) } else if (word[0] == 'v') { n = input->variable->find(id); - if (n < 0) + if (n < 0) error->all(FLERR,"Could not find thermo custom variable name"); if (input->variable->equalstyle(n) == 0) error->all(FLERR, @@ -1431,7 +1431,7 @@ void Thermo::compute_compute() dvalue = compute->scalar; if (normflag && compute->extscalar) dvalue /= natoms; } else if (compute_which[m] == VECTOR) { - if (compute->size_vector_variable && argindex1[ifield] > + if (compute->size_vector_variable && argindex1[ifield] > compute->size_vector) dvalue = 0.0; else dvalue = compute->vector[argindex1[ifield]-1]; if (normflag) { @@ -1440,7 +1440,7 @@ void Thermo::compute_compute() else if (compute->extlist[argindex1[ifield]-1]) dvalue /= natoms; } } else { - if (compute->size_array_rows_variable && argindex1[ifield] > + if (compute->size_array_rows_variable && argindex1[ifield] > compute->size_array_rows) dvalue = 0.0; else dvalue = compute->array[argindex1[ifield]-1][argindex2[ifield]-1]; if (normflag && compute->extarray) dvalue /= natoms; @@ -1575,7 +1575,7 @@ void Thermo::compute_spcpu() void Thermo::compute_cpuremain() { if (firststep == 0) dvalue = 0.0; - else dvalue = timer->elapsed(Timer::TOTAL) * + else dvalue = timer->elapsed(Timer::TOTAL) * (update->laststep - update->ntimestep) / (update->ntimestep - update->firststep); } diff --git a/src/timer.cpp b/src/timer.cpp index 2fb84536845cc879e94771fb3c76dbea9b692f53..a075ff3dec7a1c7a2605525003d682ab4e125d6b 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "timer.h" #include "comm.h" #include "error.h" @@ -88,7 +88,7 @@ void Timer::_stamp(enum ttype which) if ((which > TOTAL) && (which < NUM_TIMER)) { const double delta_cpu = current_cpu - previous_cpu; const double delta_wall = current_wall - previous_wall; - + cpu_array[which] += delta_cpu; wall_array[which] += delta_wall; cpu_array[ALL] += delta_cpu; @@ -200,7 +200,7 @@ void Timer::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],timer_mode[NORMAL]) == 0) { _sync = NORMAL; } else error->all(FLERR,"Illegal timers command"); - ++iarg; + ++iarg; } if (comm->me == 0) { diff --git a/src/timer.h b/src/timer.h index adf554f46872771aa475f03b71dfb00473460b94..5737b52834cf83e2086289391ebc20f3af3fa987 100644 --- a/src/timer.h +++ b/src/timer.h @@ -36,7 +36,7 @@ class Timer : protected Pointers { void stamp(enum ttype which=START) { if (_level > LOOP) _stamp(which); } - + void barrier_start(); void barrier_stop(); diff --git a/src/universe.cpp b/src/universe.cpp index 35415bffa924ddfb98b4e00a00ede7dc2359a9b3..a856555de4f1bb6c2214629531d9ab87a4c36362 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -11,11 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "ctype.h" -#include "stdlib.h" -#include "string.h" -#include "stdio.h" +#include <mpi.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> #include "universe.h" #include "version.h" #include "error.h" diff --git a/src/universe.h b/src/universe.h index 897b6c968106467a8dd94a493a72feb4a5554834..017f869f5e2ef81fe94b8e95d1fe1697cf93a8ad 100644 --- a/src/universe.h +++ b/src/universe.h @@ -14,7 +14,7 @@ #ifndef LMP_UNIVERSE_H #define LMP_UNIVERSE_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/update.cpp b/src/update.cpp index 78f4fe73a325ad0c259fa58c409e104bb1dd0831..f53acbed3ac37804582f22d156abe9991a77f43f 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" -#include "stdlib.h" +#include <string.h> +#include <stdlib.h> #include "update.h" #include "integrate.h" #include "min.h" @@ -261,8 +261,8 @@ void Update::set_units(const char *style) dt = 2.0; neighbor->skin = 0.1; - - } else if (strcmp(style,"nano") == 0) { + + } else if (strcmp(style,"nano") == 0) { force->boltz = 0.013806504; force->hplanck = 6.62606896e-4; force->mvv2e = 1.0; @@ -279,7 +279,7 @@ void Update::set_units(const char *style) force->angstrom = 1.0e-1; force->femtosecond = 1.0e-6; force->qelectron = 1.0; - + dt = 0.00045; neighbor->skin = 0.1; @@ -339,11 +339,11 @@ void Update::new_integrate(char *style, int narg, char **arg, #include "style_integrate.h" #undef IntegrateStyle #undef INTEGRATE_CLASS - + else success = 0; if (success) return; } - + if (lmp->suffix2) { sflag = 2; char estyle[256]; @@ -358,7 +358,7 @@ void Update::new_integrate(char *style, int narg, char **arg, #include "style_integrate.h" #undef IntegrateStyle #undef INTEGRATE_CLASS - + else success = 0; if (success) return; } diff --git a/src/variable.cpp b/src/variable.cpp index 2e88da4fd3d47478882bc7ebd01238608e035e23..ddaff7d9911cdd13f35ffa582c623e2e3ce1a7c9 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -11,11 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "math.h" -#include "stdlib.h" -#include "string.h" -#include "ctype.h" -#include "unistd.h" +#include <math.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> #include "variable.h" #include "universe.h" #include "atom.h" @@ -533,8 +533,8 @@ int Variable::next(int narg, char **arg) // invalid styles: STRING, EQUAL, WORLD, ATOM, GETENV, FORMAT, PYTHON int istyle = style[find(arg[0])]; - if (istyle == STRING || istyle == EQUAL || istyle == WORLD || - istyle == GETENV || istyle == ATOM || istyle == FORMAT || + if (istyle == STRING || istyle == EQUAL || istyle == WORLD || + istyle == GETENV || istyle == ATOM || istyle == FORMAT || istyle == PYTHON) error->all(FLERR,"Invalid variable style with next command"); @@ -546,7 +546,7 @@ int Variable::next(int narg, char **arg) int iarg = 0; for (iarg = 0; iarg < narg; iarg++) if (strcmp(arg[iarg],names[i]) == 0) break; - if (iarg == narg) + if (iarg == narg) error->universe_one(FLERR,"Next command must list all " "universe and uloop variables"); } @@ -730,7 +730,7 @@ char *Variable::pythonstyle(char *name, char *funcname) /* ---------------------------------------------------------------------- return ptr to the data text associated with a variable - if INDEX or WORLD or UNIVERSE or STRING or SCALARFILE, + if INDEX or WORLD or UNIVERSE or STRING or SCALARFILE, return ptr to stored string if LOOP or ULOOP, write int to data[0] and return ptr to string if EQUAL, evaluate variable and put result in str @@ -748,13 +748,13 @@ char *Variable::retrieve(char *name) if (ivar < 0) return NULL; if (which[ivar] >= num[ivar]) return NULL; - if (eval_in_progress[ivar]) + if (eval_in_progress[ivar]) error->all(FLERR,"Variable has circular dependency"); eval_in_progress[ivar] = 1; char *str = NULL; if (style[ivar] == INDEX || style[ivar] == WORLD || - style[ivar] == UNIVERSE || style[ivar] == STRING || + style[ivar] == UNIVERSE || style[ivar] == STRING || style[ivar] == SCALARFILE) { str = data[ivar][which[ivar]]; } else if (style[ivar] == LOOP || style[ivar] == ULOOP) { @@ -793,7 +793,7 @@ char *Variable::retrieve(char *name) str = data[ivar][1]; } else if (style[ivar] == PYTHON) { int ifunc = python->variable_match(data[ivar][0],names[ivar],0); - if (ifunc < 0) + if (ifunc < 0) error->all(FLERR,"Python variable does not match Python function"); python->invoke_function(ifunc,data[ivar][1]); str = data[ivar][1]; @@ -813,7 +813,7 @@ char *Variable::retrieve(char *name) double Variable::compute_equal(int ivar) { - if (eval_in_progress[ivar]) + if (eval_in_progress[ivar]) error->all(FLERR,"Variable has circular dependency"); eval_in_progress[ivar] = 1; @@ -853,8 +853,8 @@ void Variable::compute_atom(int ivar, int igroup, { Tree *tree; double *vstore; - - if (eval_in_progress[ivar]) + + if (eval_in_progress[ivar]) error->all(FLERR,"Variable has circular dependency"); eval_in_progress[ivar] = 1; @@ -867,7 +867,7 @@ void Variable::compute_atom(int ivar, int igroup, eval_in_progress[ivar] = 0; return; } - + int groupbit = group->bitmask[igroup]; int *mask = atom->mask; int nlocal = atom->nlocal; @@ -991,7 +991,7 @@ void Variable::grow() memory->grow(which,maxvar,"var:which"); memory->grow(pad,maxvar,"var:pad"); - reader = (VarReader **) + reader = (VarReader **) memory->srealloc(reader,maxvar*sizeof(VarReader *),"var:reader"); for (int i = old; i < maxvar; i++) reader[i] = NULL; @@ -1151,7 +1151,7 @@ double Variable::evaluate(char *str, Tree **tree) "Variable evaluation before simulation box is defined"); int icompute = modify->find_compute(word+2); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Invalid compute ID in variable formula"); Compute *compute = modify->compute[icompute]; @@ -1216,7 +1216,7 @@ double Variable::evaluate(char *str, Tree **tree) compute->invoked_flag |= INVOKED_VECTOR; } - if (compute->size_vector_variable && + if (compute->size_vector_variable && index1 > compute->size_vector) value1 = 0.0; else value1 = compute->vector[index1-1]; if (tree) { @@ -1248,7 +1248,7 @@ double Variable::evaluate(char *str, Tree **tree) compute->invoked_flag |= INVOKED_ARRAY; } - if (compute->size_array_rows_variable && + if (compute->size_array_rows_variable && index1 > compute->size_array_rows) value1 = 0.0; else value1 = compute->array[index1-1][index2-1]; if (tree) { @@ -1424,7 +1424,7 @@ double Variable::evaluate(char *str, Tree **tree) "accessed out-of-range"); if (update->whichflag > 0 && update->ntimestep % fix->global_freq) error->all(FLERR,"Fix in variable not computed at compatible time"); - + value1 = fix->compute_vector(index1-1); if (tree) { Tree *newtree = new Tree(); @@ -1891,7 +1891,7 @@ double Variable::evaluate(char *str, Tree **tree) /* ---------------------------------------------------------------------- one-time collapse of an atom-style variable parse tree tree was created by one-time parsing of formula string via evaluate() - only keep tree nodes that depend on + only keep tree nodes that depend on ATOMARRAY, TYPEARRAY, INTARRAY, BIGINTARRAY remainder is converted to single VALUE this enables optimal eval_tree loop over atoms @@ -2321,8 +2321,8 @@ double Variable::collapse_tree(Tree *tree) int ivalue5 = static_cast<int> (collapse_tree(tree->extra[2])); int ivalue6 = static_cast<int> (collapse_tree(tree->extra[3])); if (tree->first->type != VALUE || tree->second->type != VALUE || - tree->extra[0]->type != VALUE || tree->extra[1]->type != VALUE || - tree->extra[2]->type != VALUE || tree->extra[3]->type != VALUE) + tree->extra[0]->type != VALUE || tree->extra[1]->type != VALUE || + tree->extra[2]->type != VALUE || tree->extra[3]->type != VALUE) return 0.0; tree->type = VALUE; if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) @@ -2337,7 +2337,7 @@ double Variable::collapse_tree(Tree *tree) if (update->ntimestep < ivalue4 || update->ntimestep > ivalue5) { int offset = update->ntimestep - ivalue1; istep = ivalue1 + (offset/ivalue3)*ivalue3 + ivalue3; - if (update->ntimestep < ivalue2 && istep > ivalue4) + if (update->ntimestep < ivalue2 && istep > ivalue4) tree->value = ivalue4; } else { int offset = update->ntimestep - ivalue4; @@ -2657,7 +2657,7 @@ double Variable::eval_tree(Tree *tree, int i) if (update->ntimestep < ivalue4 || update->ntimestep > ivalue5) { int offset = update->ntimestep - ivalue1; istep = ivalue1 + (offset/ivalue3)*ivalue3 + ivalue3; - if (update->ntimestep < ivalue2 && istep > ivalue4) + if (update->ntimestep < ivalue2 && istep > ivalue4) tree->value = ivalue4; } else { int offset = update->ntimestep - ivalue4; @@ -2859,7 +2859,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, if (strcmp(word,"sqrt") && strcmp(word,"exp") && strcmp(word,"ln") && strcmp(word,"log") && - strcmp(word,"abs") && + strcmp(word,"abs") && strcmp(word,"sin") && strcmp(word,"cos") && strcmp(word,"tan") && strcmp(word,"asin") && strcmp(word,"acos") && strcmp(word,"atan") && @@ -2867,15 +2867,15 @@ int Variable::math_function(char *word, char *contents, Tree **tree, strcmp(word,"normal") && strcmp(word,"ceil") && strcmp(word,"floor") && strcmp(word,"round") && strcmp(word,"ramp") && strcmp(word,"stagger") && - strcmp(word,"logfreq") && strcmp(word,"logfreq2") && - strcmp(word,"stride") && strcmp(word,"stride2") && - strcmp(word,"vdisplace") && strcmp(word,"swiggle") && + strcmp(word,"logfreq") && strcmp(word,"logfreq2") && + strcmp(word,"stride") && strcmp(word,"stride2") && + strcmp(word,"vdisplace") && strcmp(word,"swiggle") && strcmp(word,"cwiggle")) return 0; // parse contents for comma-separated args // narg = number of args, args = strings between commas - + char *args[MAXFUNCARG]; int narg = parse_args(contents,args); @@ -2909,7 +2909,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, if (narg > 1) { value2 = evaluate(args[1],NULL); if (narg > 2) { - for (int i = 2; i < narg; i++) + for (int i = 2; i < narg; i++) values[i-2] = evaluate(args[i],NULL); } } @@ -3264,7 +3264,7 @@ int Variable::group_function(char *word, char *contents, Tree **tree, // parse contents for comma-separated args // narg = number of args, args = strings between commas - + char *args[MAXFUNCARG]; int narg = parse_args(contents,args); @@ -3501,7 +3501,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, if (strcmp(word,"sum") && strcmp(word,"min") && strcmp(word,"max") && strcmp(word,"ave") && strcmp(word,"trap") && strcmp(word,"slope") && - strcmp(word,"gmask") && strcmp(word,"rmask") && + strcmp(word,"gmask") && strcmp(word,"rmask") && strcmp(word,"grmask") && strcmp(word,"next") && strcmp(word,"is_active") && strcmp(word,"is_defined") && strcmp(word,"is_available")) @@ -3509,7 +3509,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // parse contents for comma-separated args // narg = number of args, args = strings between commas - + char *args[MAXFUNCARG]; int narg = parse_args(contents,args); @@ -3527,7 +3527,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, else if (strcmp(word,"trap") == 0) method = TRAP; else if (strcmp(word,"slope") == 0) method = SLOPE; - if (narg != 1) + if (narg != 1) error->all(FLERR,"Invalid special function in variable formula"); Compute *compute = NULL; @@ -3544,7 +3544,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } else index = 0; int icompute = modify->find_compute(&args[0][2]); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Invalid compute ID in variable formula"); compute = modify->compute[icompute]; if (index == 0 && compute->vector_flag) { @@ -3654,9 +3654,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } } if (method == TRAP) { - if (index) value -= 0.5*fix->compute_array(0,index-1) + + if (index) value -= 0.5*fix->compute_array(0,index-1) + 0.5*fix->compute_array(nvec-1,index-1); - else value -= 0.5*fix->compute_vector(0) + + else value -= 0.5*fix->compute_vector(0) + 0.5*fix->compute_vector(nvec-1); } } @@ -3686,7 +3686,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } else if (strcmp(word,"gmask") == 0) { if (tree == NULL) error->all(FLERR,"Gmask function in equal-style variable formula"); - if (narg != 1) + if (narg != 1) error->all(FLERR,"Invalid special function in variable formula"); int igroup = group->find(args[0]); @@ -3703,7 +3703,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } else if (strcmp(word,"rmask") == 0) { if (tree == NULL) error->all(FLERR,"Rmask function in equal-style variable formula"); - if (narg != 1) + if (narg != 1) error->all(FLERR,"Invalid special function in variable formula"); int iregion = region_function(args[0]); @@ -3719,7 +3719,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } else if (strcmp(word,"grmask") == 0) { if (tree == NULL) error->all(FLERR,"Grmask function in equal-style variable formula"); - if (narg != 2) + if (narg != 2) error->all(FLERR,"Invalid special function in variable formula"); int igroup = group->find(args[0]); @@ -3739,7 +3739,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // special function for file-style or atomfile-style variables } else if (strcmp(word,"next") == 0) { - if (narg != 1) + if (narg != 1) error->all(FLERR,"Invalid special function in variable formula"); int ivar = find(args[0]); @@ -3768,7 +3768,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // set selfalloc = 1 so result will be deleted by free_tree() after eval } else if (style[ivar] == ATOMFILE) { - if (tree == NULL) + if (tree == NULL) error->all(FLERR,"Atomfile variable in equal-style variable formula"); double *result; @@ -3790,7 +3790,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } else error->all(FLERR,"Invalid variable style in special function next"); } else if (strcmp(word,"is_active") == 0) { - if (narg != 2) + if (narg != 2) error->all(FLERR,"Invalid is_active() function in variable formula"); Info info(lmp); @@ -3808,7 +3808,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } else argstack[nargstack++] = value; } else if (strcmp(word,"is_available") == 0) { - if (narg != 2) + if (narg != 2) error->all(FLERR,"Invalid is_available() function in variable formula"); Info info(lmp); @@ -3826,7 +3826,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, } else argstack[nargstack++] = value; } else if (strcmp(word,"is_defined") == 0) { - if (narg != 2) + if (narg != 2) error->all(FLERR,"Invalid is_defined() function in variable formula"); Info info(lmp); @@ -3892,7 +3892,7 @@ void Variable::peratom2global(int flag, char *word, } else if (strcmp(word,"type") == 0) mine = atom->type[index]; else if (strcmp(word,"mol") == 0) { - if (!atom->molecule_flag) + if (!atom->molecule_flag) error->one(FLERR,"Variable uses atom property that isn't allocated"); mine = atom->molecule[index]; } @@ -3906,7 +3906,7 @@ void Variable::peratom2global(int flag, char *word, else if (strcmp(word,"fy") == 0) mine = atom->f[index][1]; else if (strcmp(word,"fz") == 0) mine = atom->f[index][2]; else if (strcmp(word,"q") == 0) { - if (!atom->q_flag) + if (!atom->q_flag) error->one(FLERR,"Variable uses atom property that isn't allocated"); mine = atom->q[index]; } @@ -4002,7 +4002,7 @@ void Variable::atom_vector(char *word, Tree **tree, newtree->iarray = atom->type; } else if (strcmp(word,"mol") == 0) { - if (!atom->molecule_flag) + if (!atom->molecule_flag) error->one(FLERR,"Variable uses atom property that isn't allocated"); if (sizeof(tagint) == sizeof(smallint)) { newtree->type = INTARRAY; @@ -4169,7 +4169,7 @@ double Variable::evaluate_boolean(char *str) // ---------------- else if (onechar == '(') { - if (expect == OP) + if (expect == OP) error->all(FLERR,"Invalid Boolean syntax in if command"); expect = OP; @@ -4190,7 +4190,7 @@ double Variable::evaluate_boolean(char *str) // ---------------- } else if (isdigit(onechar) || onechar == '.' || onechar == '-') { - if (expect == OP) + if (expect == OP) error->all(FLERR,"Invalid Boolean syntax in if command"); expect = OP; @@ -4216,7 +4216,7 @@ double Variable::evaluate_boolean(char *str) // ---------------- } else if (isalpha(onechar)) { - if (expect == OP) + if (expect == OP) error->all(FLERR,"Invalid Boolean syntax in if command"); expect = OP; @@ -4280,7 +4280,7 @@ double Variable::evaluate_boolean(char *str) continue; } - if (expect == ARG) + if (expect == ARG) error->all(FLERR,"Invalid Boolean syntax in if command"); expect = ARG; @@ -4411,7 +4411,7 @@ unsigned int Variable::data_mask(char *str) "Variable evaluation before simulation box is defined"); int icompute = modify->find_compute(word+2); - if (icompute < 0) + if (icompute < 0) error->all(FLERR,"Invalid compute ID in variable formula"); datamask &= modify->compute[icompute]->data_mask(); @@ -4421,13 +4421,13 @@ unsigned int Variable::data_mask(char *str) if (domain->box_exist == 0) error->all(FLERR, "Variable evaluation before simulation box is defined"); - + int ifix = modify->find_fix(word+2); if (ifix < 0) error->all(FLERR,"Invalid fix ID in variable formula"); - + datamask &= modify->fix[ifix]->data_mask(); } - + if ((strncmp(word,"v_",2) == 0) && (i>0) && (!isalnum(str[i-1]))) { int ivar = find(word+2); if (ivar < 0) error->all(FLERR,"Invalid variable name in variable formula"); @@ -4446,7 +4446,7 @@ unsigned int Variable::data_mask(char *str) for flag = ATOMFILE, reads set of one value per atom ------------------------------------------------------------------------- */ -VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : +VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : Pointers(lmp) { me = comm->me; diff --git a/src/variable.h b/src/variable.h index ee554ad781e2858a3e0127216fa56c784d440d4e..e9bf29d4aff250b1e5d16bed78c808e8fe211c24 100644 --- a/src/variable.h +++ b/src/variable.h @@ -14,7 +14,7 @@ #ifndef LMP_VARIABLE_H #define LMP_VARIABLE_H -#include "stdlib.h" +#include <stdlib.h> #include "pointers.h" namespace LAMMPS_NS { @@ -74,7 +74,7 @@ class Variable : protected Pointers { class Python *python; // ptr to embedded Python interpreter struct Tree { // parse tree for atom-style variables - double value; // single scalar + double value; // single scalar double *array; // per-atom or per-type list of doubles int *iarray; // per-atom list of ints bigint *barray; // per-atom list of bigints diff --git a/src/velocity.cpp b/src/velocity.cpp index 37785af5c3c4555c6a0c0fa265ebe48d7390af61..e5eb19c81df77457b0b55a178e3fad966332cdc0 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -11,11 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "math.h" -#include "stdio.h" -#include "stdlib.h" -#include "string.h" +#include <mpi.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "velocity.h" #include "atom.h" #include "update.h" @@ -104,7 +104,7 @@ void Velocity::command(int narg, char **arg) // b/c methods invoked in the compute/fix perform forward/reverse comm int initcomm = 0; - if (style == ZERO && rfix >= 0 && + if (style == ZERO && rfix >= 0 && strcmp(modify->fix[rfix]->style,"rigid/small") == 0) initcomm = 1; if ((style == CREATE || style == SET) && temperature && strcmp(temperature->style,"temp/cs") == 0) initcomm = 1; diff --git a/src/verlet.cpp b/src/verlet.cpp index e5a067777ed2b46694ae939b47682af39d3dec95..de9a9034d0422a56eea25c68c9c01a69e0270004 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "verlet.h" #include "neighbor.h" #include "domain.h" diff --git a/src/write_data.cpp b/src/write_data.cpp index 2bf1ad84f8b1be4ce424028711618d935ccda81a..5a67c1081e4a42b962afa0648b651369fc86d98f 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "write_data.h" #include "atom.h" #include "atom_vec.h" @@ -198,7 +198,7 @@ void WriteData::write(char *file) // extra sections managed by fixes for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->wd_section) + if (modify->fix[i]->wd_section) for (int m = 0; m < modify->fix[i]->wd_section; m++) fix(i,m); // close data file @@ -243,10 +243,10 @@ void WriteData::header() } for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->wd_header) - for (int m = 0; m < modify->fix[i]->wd_header; m++) + if (modify->fix[i]->wd_header) + for (int m = 0; m < modify->fix[i]->wd_header; m++) modify->fix[i]->write_data_header(fp,m); - + fprintf(fp,"\n"); fprintf(fp,"%-1.16e %-1.16e xlo xhi\n",domain->boxlo[0],domain->boxhi[0]); @@ -349,7 +349,7 @@ void WriteData::atoms() atom->avec->write_data(fp,recvrow,buf); } - + } else { MPI_Recv(&tmp,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); MPI_Rsend(&buf[0][0],sendrow*ncol,MPI_DOUBLE,0,0,world); @@ -400,10 +400,10 @@ void WriteData::velocities() MPI_Get_count(&status,MPI_DOUBLE,&recvrow); recvrow /= ncol; } else recvrow = sendrow; - + atom->avec->write_vel(fp,recvrow,buf); } - + } else { MPI_Recv(&tmp,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); MPI_Rsend(&buf[0][0],sendrow*ncol,MPI_DOUBLE,0,0,world); @@ -457,7 +457,7 @@ void WriteData::bonds() atom->avec->write_bond(fp,recvrow,buf,index); index += recvrow; } - + } else { MPI_Recv(&tmp,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); MPI_Rsend(&buf[0][0],sendrow*ncol,MPI_LMP_TAGINT,0,0,world); @@ -507,11 +507,11 @@ void WriteData::angles() MPI_Get_count(&status,MPI_LMP_TAGINT,&recvrow); recvrow /= ncol; } else recvrow = sendrow; - + atom->avec->write_angle(fp,recvrow,buf,index); index += recvrow; } - + } else { MPI_Recv(&tmp,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); MPI_Rsend(&buf[0][0],sendrow*ncol,MPI_LMP_TAGINT,0,0,world); @@ -579,11 +579,11 @@ void WriteData::dihedrals() MPI_Get_count(&status,MPI_LMP_TAGINT,&recvrow); recvrow /= ncol; } else recvrow = sendrow; - + atom->avec->write_dihedral(fp,recvrow,buf,index); index += recvrow; } - + } else { MPI_Recv(&tmp,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); MPI_Rsend(&buf[0][0],sendrow*ncol,MPI_LMP_TAGINT,0,0,world); @@ -651,11 +651,11 @@ void WriteData::impropers() MPI_Get_count(&status,MPI_LMP_TAGINT,&recvrow); recvrow /= ncol; } else recvrow = sendrow; - + atom->avec->write_improper(fp,recvrow,buf,index); index += recvrow; } - + } else { MPI_Recv(&tmp,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); MPI_Rsend(&buf[0][0],sendrow*ncol,MPI_LMP_TAGINT,0,0,world); @@ -709,7 +709,7 @@ void WriteData::fix(int ifix, int mth) modify->fix[ifix]->write_data_section(mth,fp,recvrow,buf,index); index += recvrow; } - + } else { MPI_Recv(&tmp,0,MPI_INT,0,0,world,MPI_STATUS_IGNORE); MPI_Rsend(&buf[0][0],sendrow*ncol,MPI_DOUBLE,0,0,world); diff --git a/src/write_data.h b/src/write_data.h index 8a4fdfac4cb5c5c231cb1f35de1e78365e16bc49..8c196356024dbcfdfee80892d95adb589abd0f99 100644 --- a/src/write_data.h +++ b/src/write_data.h @@ -20,7 +20,7 @@ CommandStyle(write_data,WriteData) #ifndef LMP_WRITE_DATA_H #define LMP_WRITE_DATA_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS { diff --git a/src/write_dump.cpp b/src/write_dump.cpp index e906e23007059f2263e3e922cea5db5556eaaa56..f56faa0fcd43a196f5fd11872f88a5aee0ae0599 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "string.h" +#include <string.h> #include "write_dump.h" #include "style_dump.h" #include "dump.h" @@ -71,7 +71,7 @@ void WriteDump::command(int narg, char **arg) // write out one frame and then delete the dump again // set multifile_override for DumpImage so that filename needs no "*" - if (strcmp(arg[1],"image") == 0) + if (strcmp(arg[1],"image") == 0) ((DumpImage *) dump)->multifile_override = 1; if (strcmp(arg[1],"cfg") == 0) diff --git a/src/write_restart.cpp b/src/write_restart.cpp index c2824eff998eba91d51ab75a4992361e1d63e94f..9305c34ba68c97620105f3c3fe0648b95f0ccaad 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -11,8 +11,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "mpi.h" -#include "string.h" +#include <mpi.h> +#include <string.h> #include "write_restart.h" #include "atom.h" #include "atom_vec.h" @@ -150,13 +150,13 @@ void WriteRestart::multiproc_options(int multiproc_caller, int mpiioflag_caller, // error checks - if (multiproc && mpiioflag) + if (multiproc && mpiioflag) error->all(FLERR, "Restart file MPI-IO output not allowed with % in filename"); if (mpiioflag) { mpiio = new RestartMPIIO(lmp); - if (!mpiio->mpiio_exists) + if (!mpiio->mpiio_exists) error->all(FLERR,"Writing to MPI-IO filename when " "MPIIO package is not installed"); } @@ -186,7 +186,7 @@ void WriteRestart::multiproc_options(int multiproc_caller, int mpiioflag_caller, "without % in restart file name"); int nper = force->inumeric(FLERR,arg[iarg+1]); if (nper <= 0) error->all(FLERR,"Illegal write_restart command"); - + multiproc = nprocs/nper; if (nprocs % nper) multiproc++; fileproc = me/nper * nper; @@ -211,7 +211,7 @@ void WriteRestart::multiproc_options(int multiproc_caller, int mpiioflag_caller, fileproc = static_cast<int> ((bigint) icluster * nprocs/nfile); int fcluster = static_cast<int> ((bigint) fileproc * nfile/nprocs); if (fcluster < icluster) fileproc++; - int fileprocnext = + int fileprocnext = static_cast<int> ((bigint) (icluster+1) * nprocs/nfile); fcluster = static_cast<int> ((bigint) fileprocnext * nfile/nprocs); if (fcluster < icluster+1) fileprocnext++; @@ -418,7 +418,7 @@ void WriteRestart::write(char *file) MPI_Wait(&request,&status); MPI_Get_count(&status,MPI_DOUBLE,&recv_size); } else recv_size = send_size; - + write_double_vec(PERPROC,recv_size,buf); } fclose(fp); @@ -515,7 +515,7 @@ void WriteRestart::header() write_int(ATOM_SORTFREQ,atom->sortfreq); write_double(ATOM_SORTBIN,atom->userbinsize); - write_int(COMM_MODE,comm->mode); + write_int(COMM_MODE,comm->mode); write_double(COMM_CUTOFF,comm->cutghostuser); write_int(COMM_VEL,comm->ghost_velocity); diff --git a/src/write_restart.h b/src/write_restart.h index a27da32e3d83de0305c3373a5ae03c6365e5e410..df710759ab230fdac9a3b40bd5732a677a992c90 100644 --- a/src/write_restart.h +++ b/src/write_restart.h @@ -20,7 +20,7 @@ CommandStyle(write_restart,WriteRestart) #ifndef LMP_WRITE_RESTART_H #define LMP_WRITE_RESTART_H -#include "stdio.h" +#include <stdio.h> #include "pointers.h" namespace LAMMPS_NS {