diff --git a/doc/Manual.html b/doc/Manual.html index 6880db2a4c..5c3360c546 100644 --- a/doc/Manual.html +++ b/doc/Manual.html @@ -1,7 +1,7 @@ LAMMPS-ICMS Users Manual - + @@ -22,7 +22,7 @@

LAMMPS-ICMS Documentation

-

26 Feb 2014 version +

10 Mar 2014 version

Version info:

diff --git a/doc/Manual.txt b/doc/Manual.txt index 9e262770e5..15e31f441f 100644 --- a/doc/Manual.txt +++ b/doc/Manual.txt @@ -1,7 +1,7 @@ LAMMPS-ICMS Users Manual LAMMPS Users Manual - + @@ -19,7 +19,7 @@

LAMMPS-ICMS Documentation :c,h3 -26 Feb 2014 version :c,h4 +10 Mar 2014 version :c,h4 Version info: :h4 diff --git a/doc/Section_commands.html b/doc/Section_commands.html index ae49190355..b847c19c7e 100644 --- a/doc/Section_commands.html +++ b/doc/Section_commands.html @@ -399,13 +399,13 @@ of each style or click on the style itself for a full description: gldgravityheatindentlangevinlineforcemomentummove msstnebnphnphugnph/aspherenph/spherenptnpt/asphere npt/spherenvenve/aspherenve/asphere/noforcenve/bodynve/limitnve/linenve/noforce -nve/spherenve/trinvtnvt/aspherenvt/sllodnvt/sphereorient/fccplaneforce -poemspourpress/berendsenprintproperty/atomqeq/combreax/bondsrecenter -restrainrigidrigid/nphrigid/nptrigid/nverigid/nvtrigid/smallsetforce -shakespringspring/rgspring/selfsrdstore/forcestore/statetemp/berendsen -temp/rescalethermal/conductivitytmdttmtune/kspacevectorviscosityviscous -wall/colloidwall/granwall/harmonicwall/lj1043wall/lj126wall/lj93wall/pistonwall/reflect -wall/regionwall/srd +nve/spherenve/trinvtnvt/aspherenvt/sllodnvt/sphereonewayorient/fcc +planeforcepoemspourpress/berendsenprintproperty/atomqeq/combreax/bonds +recenterrestrainrigidrigid/nphrigid/nptrigid/nverigid/nvtrigid/small +setforceshakespringspring/rgspring/selfsrdstore/forcestore/state +temp/berendsentemp/csvrtemp/rescalethermal/conductivitytmdttmtune/kspacevector +viscosityviscouswall/colloidwall/granwall/harmonicwall/lj1043wall/lj126wall/lj93 +wall/pistonwall/reflectwall/regionwall/srd

These are fix styles contributed by users, which can be used if diff --git a/doc/Section_commands.txt b/doc/Section_commands.txt index 758d73f177..f236c19a8d 100644 --- a/doc/Section_commands.txt +++ b/doc/Section_commands.txt @@ -513,6 +513,7 @@ of each style or click on the style itself for a full description: "nvt/asphere"_fix_nvt_asphere.html, "nvt/sllod"_fix_nvt_sllod.html, "nvt/sphere"_fix_nvt_sphere.html, +"oneway"_fix_oneway.html, "orient/fcc"_fix_orient_fcc.html, "planeforce"_fix_planeforce.html, "poems"_fix_poems.html, @@ -539,6 +540,7 @@ of each style or click on the style itself for a full description: "store/force"_fix_store_force.html, "store/state"_fix_store_state.html, "temp/berendsen"_fix_temp_berendsen.html, +"temp/csvr"_fix_temp_csvr.html, "temp/rescale"_fix_temp_rescale.html, "thermal/conductivity"_fix_thermal_conductivity.html, "tmd"_fix_tmd.html, diff --git a/doc/Section_howto.html b/doc/Section_howto.html index db12c18d4c..21994ed9a3 100644 --- a/doc/Section_howto.html +++ b/doc/Section_howto.html @@ -1613,16 +1613,17 @@ velocity of spherical or aspherical particles to be adjusted in prescribed ways.

Thermostatting in LAMMPS is performed by fixes, or in one -case by a pair style. Four thermostatting fixes are currently -available: Nose-Hoover (nvt), Berendsen, Langevin, and direct -rescaling (temp/rescale). Dissipative particle dynamics (DPD) -thermostatting can be invoked via the dpd/tstat pair style: +case by a pair style. Several thermostatting fixes are available: +Nose-Hoover (nvt), Berendsen, CSVR, Langevin, and direct rescaling +(temp/rescale). Dissipative particle dynamics (DPD) thermostatting +can be invoked via the dpd/tstat pair style:

+

These keywords will check an appended comment for a match with the +currently defined style: +

+ +

For example, these lines: +

+
Atoms # sphere
+Pair Coeffs # lj/cut 
+
+

will check if the currently-defined atom_style is +sphere, and the current pair_style is lj/cut. If +not, LAMMPS will issue a warning to indicate that the data file +section likely does not contain the correct number or type of +parameters expected for the currently-defined style. +

Each section is listed below in alphabetic order. The format of each section is described including the number of lines it must contain and rules (if any) for where it can appear in the data file. diff --git a/doc/read_data.txt b/doc/read_data.txt index 59bd1e131a..4ff5159bf8 100644 --- a/doc/read_data.txt +++ b/doc/read_data.txt @@ -50,11 +50,13 @@ value(s) is read from the line. If it doesn't contain a header keyword, the line begins the body of the file. The body of the file contains zero or more sections. The first line -of a section has only a keyword. The next line is skipped. The -remaining lines of the section contain values. The number of lines -depends on the section keyword as described below. Zero or more blank -lines can be used between sections. Sections can appear in any order, -with a few exceptions as noted below. +of a section has only a keyword. This line can have a trailing +comment starting with '#' that is either ignored or can be used to +check for a style match, as described below. The next line is +skipped. The remaining lines of the section contain values. The +number of lines depends on the section keyword as described below. +Zero or more blank lines can be used between sections. Sections can +appear in any order, with a few exceptions as noted below. The keyword {fix} can be used one or more times. Each usage specifies a fix that will be used to process a specific portion of the data @@ -223,6 +225,22 @@ These are the section keywords for the body of the file. EndBondTorsion Coeffs, AngleTorsion Coeffs, AngleAngleTorsion Coeffs, \ BondBond13 Coeffs, AngleAngle Coeffs} = class 2 force field sections :ul +These keywords will check an appended comment for a match with the +currently defined style: + +{Atoms, Pair Coeffs, PairIJ Coeffs, Bond Coeffs, Angle Coeffs, Dihedral Coeffs, Improper Coeffs} :ul + +For example, these lines: + +Atoms # sphere +Pair Coeffs # lj/cut :pre + +will check if the currently-defined "atom_style"_atom_style.html is +{sphere}, and the current "pair_style"_pair_style is {lj/cut}. If +not, LAMMPS will issue a warning to indicate that the data file +section likely does not contain the correct number or type of +parameters expected for the currently-defined style. + Each section is listed below in alphabetic order. The format of each section is described including the number of lines it must contain and rules (if any) for where it can appear in the data file. diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index ac98f224f2..a684ce80a5 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -143,7 +143,7 @@ void Ewald::init() // setup K-space resolution - q2 = qsqsum * force->qqrd2e / force->dielectric; + q2 = qsqsum * force->qqrd2e; bigint natoms = atom->natoms; triclinic = domain->triclinic; diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index f623c3a5df..39951b8b0c 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -189,8 +189,8 @@ void EwaldDisp::init() // setup K-space resolution - q2 = qsqsum * force->qqrd2e / force->dielectric; - M2 *= mumurd2e / force->dielectric; + q2 = qsqsum * force->qqrd2e; + M2 *= mumurd2e; b2 = bsbsum; //Are these units right? bigint natoms = atom->natoms; @@ -862,7 +862,8 @@ void EwaldDisp::compute_force() void EwaldDisp::compute_surface() { // assume conducting metal (tinfoil) boundary conditions, so this function is - // not called because dielectric --> infinity, which makes all the terms here zero. + // not called because dielectric at the boundary --> infinity, which makes all + // the terms here zero. if (!function[3]) return; if (!atom->mu) return; diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index c7dd91e083..a99d5bb1fb 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -191,7 +191,7 @@ void MSM::init() qsum = tmp; MPI_Allreduce(&qsqsum,&tmp,1,MPI_DOUBLE,MPI_SUM,world); qsqsum = tmp; - q2 = qsqsum * force->qqrd2e / force->dielectric; + q2 = qsqsum * force->qqrd2e; if (qsqsum == 0.0) error->all(FLERR,"Cannot use kspace solver on system with no charge"); diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index db17cb2689..1f010f2a51 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -261,7 +261,7 @@ void PPPM::init() qsum = tmp; MPI_Allreduce(&qsqsum,&tmp,1,MPI_DOUBLE,MPI_SUM,world); qsqsum = tmp; - q2 = qsqsum * force->qqrd2e / force->dielectric; + q2 = qsqsum * force->qqrd2e; if (qsqsum == 0.0) error->all(FLERR,"Cannot use kspace solver on system with no charge"); diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index ea9f4a578b..0750ec02e9 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -756,7 +756,7 @@ void PPPMDisp::setup() b = 0.5*sqrt(sqk)*gewinv; bs = b*b; bt = bs*b; - erft = 2*bt*rtpi*erfc(b); + erft = 2*bt*rtpi*erfc((double) b); expt = exp(-bs); nom = erft - 2*bs*expt; denom = nom + expt; @@ -2535,7 +2535,7 @@ void PPPMDisp::deallocate_peratom() void PPPMDisp::set_grid() { - double q2 = qsqsum * force->qqrd2e / force->dielectric; + double q2 = qsqsum * force->qqrd2e; // use xprd,yprd,zprd even if triclinic so grid size is the same // adjust z dimension for 2d slab PPPM @@ -2835,7 +2835,7 @@ void PPPMDisp::adjust_gewald() double PPPMDisp::f() { double df_rspace, df_kspace; - double q2 = qsqsum * force->qqrd2e / force->dielectric; + double q2 = qsqsum * force->qqrd2e; double xprd = domain->xprd; double yprd = domain->yprd; double zprd = domain->zprd; @@ -2878,7 +2878,7 @@ double PPPMDisp::derivf() double PPPMDisp::final_accuracy() { double df_rspace, df_kspace; - double q2 = qsqsum * force->qqrd2e / force->dielectric; + double q2 = qsqsum * force->qqrd2e; double xprd = domain->xprd; double yprd = domain->yprd; double zprd = domain->zprd; diff --git a/src/KSPACE/pppm_old.cpp b/src/KSPACE/pppm_old.cpp index d4c2a4e739..c2959823ff 100644 --- a/src/KSPACE/pppm_old.cpp +++ b/src/KSPACE/pppm_old.cpp @@ -971,7 +971,7 @@ void PPPMOld::set_grid() acons[7][5] = 1755948832039.0 / 36229939200000.0; acons[7][6] = 4887769399.0 / 37838389248.0; - double q2 = qsqsum * force->qqrd2e / force->dielectric; + double q2 = qsqsum * force->qqrd2e; // use xprd,yprd,zprd even if triclinic so grid size is the same // adjust z dimension for 2d slab PPPM diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index 6ea10735e2..0369c0d367 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -343,12 +343,14 @@ void FixDeposit::pre_exchange() // coords = coords of all atoms // for molecule, perform random rotation around center pt // apply PBC so final coords are inside box - // also store image flag modified due to PBC + // also modify image flags due to PBC if (mode == ATOM) { coords[0][0] = coord[0]; coords[0][1] = coord[1]; coords[0][2] = coord[2]; + imageflags[0] = ((imageint) IMGMAX << IMG2BITS) | + ((imageint) IMGMAX << IMGBITS) | IMGMAX; } else { if (dimension == 3) { r[0] = random->uniform() - 0.5; diff --git a/src/USER-MISC/fix_oneway.cpp b/src/MISC/fix_oneway.cpp similarity index 61% rename from src/USER-MISC/fix_oneway.cpp rename to src/MISC/fix_oneway.cpp index 18f2d333a7..e0345de3fd 100644 --- a/src/USER-MISC/fix_oneway.cpp +++ b/src/MISC/fix_oneway.cpp @@ -11,6 +11,11 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (ICTP, Italy) +------------------------------------------------------------------------- */ + +#include "string.h" #include "fix_oneway.h" #include "atom.h" #include "domain.h" @@ -18,9 +23,6 @@ #include "force.h" #include "region.h" -#include -#include - using namespace LAMMPS_NS; using namespace FixConst; @@ -28,36 +30,34 @@ enum{NONE=-1,X=0,Y=1,Z=2,XYZMASK=3,MINUS=4,PLUS=0}; /* ---------------------------------------------------------------------- */ -FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) +FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { direction = NONE; regionidx = 0; regionstr = NULL; - if (narg < 6) - error->all(FLERR,"Illegal fix oneway command"); + if (narg < 6) error->all(FLERR,"Illegal fix oneway command"); - int len = strlen(arg[3]); + nevery = force->inumeric(FLERR,arg[3]); + if (nevery < 1) error->all(FLERR,"Illegal nevery value for fix oneway"); + + int len = strlen(arg[4]); regionstr = new char[len]; - strcpy(regionstr,arg[3]); + strcpy(regionstr,arg[4]); - if (strcmp(arg[4], "x") == 0) direction = X|PLUS; - if (strcmp(arg[4], "X") == 0) direction = X|PLUS; - if (strcmp(arg[4], "y") == 0) direction = Y|PLUS; - if (strcmp(arg[4], "Y") == 0) direction = Y|PLUS; - if (strcmp(arg[4], "z") == 0) direction = Z|PLUS; - if (strcmp(arg[4], "Z") == 0) direction = Z|PLUS; - if (strcmp(arg[4],"-x") == 0) direction = X|MINUS; - if (strcmp(arg[4],"-X") == 0) direction = X|MINUS; - if (strcmp(arg[4],"-y") == 0) direction = Y|MINUS; - if (strcmp(arg[4],"-Y") == 0) direction = Y|MINUS; - if (strcmp(arg[4],"-z") == 0) direction = Z|MINUS; - if (strcmp(arg[4],"-Z") == 0) direction = Z|MINUS; + if (strcmp(arg[5], "x") == 0) direction = X|PLUS; + if (strcmp(arg[5], "X") == 0) direction = X|PLUS; + if (strcmp(arg[5], "y") == 0) direction = Y|PLUS; + if (strcmp(arg[5], "Y") == 0) direction = Y|PLUS; + if (strcmp(arg[5], "z") == 0) direction = Z|PLUS; + if (strcmp(arg[5], "Z") == 0) direction = Z|PLUS; + if (strcmp(arg[5],"-x") == 0) direction = X|MINUS; + if (strcmp(arg[5],"-X") == 0) direction = X|MINUS; + if (strcmp(arg[5],"-y") == 0) direction = Y|MINUS; + if (strcmp(arg[5],"-Y") == 0) direction = Y|MINUS; + if (strcmp(arg[5],"-z") == 0) direction = Z|MINUS; + if (strcmp(arg[5],"-Z") == 0) direction = Z|MINUS; - nevery = force->inumeric(FLERR,arg[5]); - if (nevery < 1) - error->all(FLERR,"Illegal nevery value for fix oneway"); global_freq = nevery; } @@ -65,8 +65,7 @@ FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : FixOneWay::~FixOneWay() { - if (regionstr) - delete[] regionstr; + if (regionstr) delete[] regionstr; } /* ---------------------------------------------------------------------- */ @@ -89,19 +88,16 @@ void FixOneWay::init() void FixOneWay::end_of_step() { - // nothing to do for non-existing region - if (regionidx < 0) return; + Region *region = domain->regions[regionidx]; + const int idx = direction & XYZMASK; const double * const * const x = atom->x; double * const * const v = atom->v; const int *mask = atom->mask; - Region *region = domain->regions[regionidx]; const int nlocal = atom->nlocal; - const int idx = direction & XYZMASK; for (int 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])) { if (direction & MINUS) { if (v[i][idx] > 0.0) v[i][idx] = -v[i][idx]; } else { diff --git a/src/USER-MISC/fix_oneway.h b/src/MISC/fix_oneway.h similarity index 98% rename from src/USER-MISC/fix_oneway.h rename to src/MISC/fix_oneway.h index 8a66d2f531..4d760c73ec 100644 --- a/src/USER-MISC/fix_oneway.h +++ b/src/MISC/fix_oneway.h @@ -10,6 +10,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ + #ifdef FIX_CLASS FixStyle(oneway,FixOneWay) @@ -32,7 +33,6 @@ class FixOneWay : public Fix { virtual void end_of_step(); protected: - int nevery; int direction; int regionidx; char *regionstr; diff --git a/src/USER-CUDA/pppm_cuda.cpp b/src/USER-CUDA/pppm_cuda.cpp index c2dedf151f..eb6d328bdc 100644 --- a/src/USER-CUDA/pppm_cuda.cpp +++ b/src/USER-CUDA/pppm_cuda.cpp @@ -1095,7 +1095,7 @@ void PPPMCuda::set_grid() acons[7][5] = 1755948832039.0 / 36229939200000.0; acons[7][6] = 4887769399.0 / 37838389248.0; - double q2 = qsqsum * force->qqrd2e/ force->dielectric; + double q2 = qsqsum * force->qqrd2e; bigint natoms = atom->natoms; // use xprd,yprd,zprd even if triclinic so grid size is the same diff --git a/src/atom.cpp b/src/atom.cpp index a850c66f58..2280943a33 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -620,7 +620,7 @@ int Atom::count_words(const char *line) strcpy(copy,line); char *ptr; - if (ptr = strchr(copy,'#')) *ptr = '\0'; + if ((ptr = strchr(copy,'#'))) *ptr = '\0'; if (strtok(copy," \t\n\r\f") == NULL) { memory->destroy(copy); diff --git a/src/atom.h b/src/atom.h index 0056ecee55..fa917eec76 100644 --- a/src/atom.h +++ b/src/atom.h @@ -187,7 +187,7 @@ class Atom : protected Pointers { void data_bonus(int, char *, class AtomVec *); void data_bodies(int, char *, class AtomVecBody *); - void allocate_type_arrays(); + virtual void allocate_type_arrays(); void set_mass(const char *); void set_mass(int, double); void set_mass(int, char **); @@ -202,7 +202,7 @@ class Atom : protected Pointers { void add_molecule_atom(class Molecule *, int, int, tagint); void first_reorder(); - void sort(); + virtual void sort(); void add_callback(int); void delete_callback(const char *, int); diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index 51c72c8661..7058d1f34f 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -560,7 +560,7 @@ int AtomVecBody::pack_border(int n, int *list, double *buf, { int i,j,m; double dx,dy,dz; - double *quat,*c1,*c2,*c3,*inertia; + double *quat,*inertia; m = 0; if (pbc_flag == 0) { @@ -640,7 +640,7 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf, { int i,j,m; double dx,dy,dz,dvx,dvy,dvz; - double *quat,*c1,*c2,*c3,*inertia; + double *quat,*inertia; m = 0; if (pbc_flag == 0) { @@ -773,7 +773,7 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf, int AtomVecBody::pack_border_hybrid(int n, int *list, double *buf) { int i,j,m; - double *quat,*c1,*c2,*c3,*inertia; + double *quat,*inertia; m = 0; for (i = 0; i < n; i++) { @@ -803,7 +803,7 @@ int AtomVecBody::pack_border_hybrid(int n, int *list, double *buf) void AtomVecBody::unpack_border(int n, int first, double *buf) { int i,j,m,last; - double *quat,*c1,*c2,*c3,*inertia; + double *quat,*inertia; m = 0; last = first + n; @@ -851,7 +851,7 @@ void AtomVecBody::unpack_border(int n, int first, double *buf) void AtomVecBody::unpack_border_vel(int n, int first, double *buf) { int i,j,m,last; - double *quat,*c1,*c2,*c3,*inertia; + double *quat,*inertia; m = 0; last = first + n; @@ -905,7 +905,7 @@ void AtomVecBody::unpack_border_vel(int n, int first, double *buf) int AtomVecBody::unpack_border_hybrid(int n, int first, double *buf) { int i,j,m,last; - double *quat,*c1,*c2,*c3,*inertia; + double *quat,*inertia; m = 0; last = first + n; @@ -1344,9 +1344,6 @@ int AtomVecBody::data_vel_hybrid(int m, char **values) void AtomVecBody::pack_data(double **buf) { - double c2mc1[2],c3mc1[3],norm[3]; - double area; - int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { buf[i][0] = ubuf(tag[i]).d; diff --git a/src/balance.cpp b/src/balance.cpp index e1bcf36924..010c2e8740 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -781,7 +781,7 @@ void Balance::dumpout(bigint tstep, FILE *bfp) int nx = comm->procgrid[0] + 1; int ny = comm->procgrid[1] + 1; - int nz = comm->procgrid[2] + 1; + //int nz = comm->procgrid[2] + 1; if (dimension == 2) { int m = 0; diff --git a/src/change_box.cpp b/src/change_box.cpp index e0fb7d20ab..fcc90b7512 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -70,7 +70,6 @@ void ChangeBox::command(int narg, char **arg) memset(ops,0,(narg-1)*sizeof(Operation)); nops = 0; - int index; int iarg = 1; while (iarg < narg) { if (strcmp(arg[iarg],"x") == 0 || strcmp(arg[iarg],"y") == 0 || diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index b4f080f86c..049887e0d5 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -48,9 +48,7 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : tflag = eflag = -1; nvalues = 0; - int i; for (int iarg = 3; iarg < narg; iarg++) { - i = iarg-3; if (strcmp(arg[iarg],"theta") == 0) tflag = nvalues++; else if (strcmp(arg[iarg],"eng") == 0) eflag = nvalues++; else error->all(FLERR,"Invalid keyword in compute angle/local command"); diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index 00aefeda3a..826e1aeeb9 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -119,7 +119,6 @@ int ComputeBondLocal::compute_bonds(int flag) int i,m,n,nb,atom1,atom2,imol,iatom,btype; tagint tagprev; double delx,dely,delz,rsq; - double *dbuf,*ebuf,*fbuf; double *ptr; double **x = atom->x; diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index b1713873b2..c217142e33 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -94,7 +94,7 @@ void ComputeClusterAtom::init_list(int id, NeighList *ptr) void ComputeClusterAtom::compute_peratom() { - int i,j,ii,jj,inum,jnum,n; + int i,j,ii,jj,inum,jnum; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *ilist,*jlist,*numneigh,**firstneigh; @@ -156,7 +156,6 @@ void ComputeClusterAtom::compute_peratom() jlist = firstneigh[i]; jnum = numneigh[i]; - n = 0; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; j &= NEIGHMASK; diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index a43681c8f3..5565a6b289 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -50,9 +50,7 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : pflag = -1; nvalues = 0; - int i; for (int iarg = 3; iarg < narg; iarg++) { - i = iarg-3; if (strcmp(arg[iarg],"phi") == 0) pflag = nvalues++; else error->all(FLERR,"Invalid keyword in compute dihedral/local command"); } @@ -111,7 +109,7 @@ int ComputeDihedralLocal::compute_dihedrals(int flag) int i,m,n,nd,atom1,atom2,atom3,atom4,imol,iatom; tagint tagprev; double vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z,vb2xm,vb2ym,vb2zm; - double ax,ay,az,bx,by,bz,rasq,rbsq,rgsq,rg,rginv,ra2inv,rb2inv,rabinv; + double ax,ay,az,bx,by,bz,rasq,rbsq,rgsq,rg,ra2inv,rb2inv,rabinv; double s,c; double *pbuf; @@ -207,8 +205,7 @@ int ComputeDihedralLocal::compute_dihedrals(int flag) rgsq = vb2xm*vb2xm + vb2ym*vb2ym + vb2zm*vb2zm; rg = sqrt(rgsq); - rginv = ra2inv = rb2inv = 0.0; - if (rg > 0) rginv = 1.0/rg; + ra2inv = rb2inv = 0.0; if (rasq > 0) ra2inv = 1.0/rasq; if (rbsq > 0) rb2inv = 1.0/rbsq; rabinv = sqrt(ra2inv*rb2inv); diff --git a/src/compute_gyration_molecule.cpp b/src/compute_gyration_molecule.cpp index f81a373830..c1fc54c5dc 100644 --- a/src/compute_gyration_molecule.cpp +++ b/src/compute_gyration_molecule.cpp @@ -223,7 +223,7 @@ void ComputeGyrationMolecule::compute_array() void ComputeGyrationMolecule::molcom() { tagint imol; - double dx,dy,dz,massone; + double massone; double unwrap[3]; for (int i = 0; i < nmolecules; i++) diff --git a/src/compute_improper_local.cpp b/src/compute_improper_local.cpp index 7726781439..33dcff53bb 100644 --- a/src/compute_improper_local.cpp +++ b/src/compute_improper_local.cpp @@ -51,9 +51,7 @@ ComputeImproperLocal::ComputeImproperLocal(LAMMPS *lmp, int narg, char **arg) : cflag = -1; nvalues = 0; - int i; for (int iarg = 3; iarg < narg; iarg++) { - i = iarg-3; if (strcmp(arg[iarg],"chi") == 0) cflag = nvalues++; else error->all(FLERR,"Invalid keyword in compute improper/local command"); } diff --git a/src/compute_property_local.cpp b/src/compute_property_local.cpp index 675ca7e58c..da34de08ae 100644 --- a/src/compute_property_local.cpp +++ b/src/compute_property_local.cpp @@ -342,8 +342,6 @@ int ComputePropertyLocal::count_pairs(int allflag, int forceflag) int *type = atom->type; int *mask = atom->mask; int nlocal = atom->nlocal; - double *special_coul = force->special_coul; - double *special_lj = force->special_lj; int newton_pair = force->newton_pair; // invoke half neighbor list (will copy or build if necessary) diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index d4bd7e68c5..9f87fcd09b 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -531,7 +531,8 @@ double ComputeReduce::compute_one(int m, int flag) } else if (which[m] == FIX) { if (update->ntimestep % modify->fix[vidx]->peratom_freq) - error->all(FLERR,"Fix used in compute reduce not computed at compatible time"); + error->all(FLERR,"Fix used in compute reduce not " + "computed at compatible time"); Fix *fix = modify->fix[vidx]; if (flavor[m] == PERATOM) { diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index 7b5f362f4a..ecfad04046 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -55,7 +55,6 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : ncount += 2; nbinx = nbiny = nbinz = 1; - int lastarg; int iarg = 6; if (strcmp(arg[iarg],"x") == 0) { diff --git a/src/dump.cpp b/src/dump.cpp index a94ba4af92..878304addf 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -105,7 +105,7 @@ Dump::Dump(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) multiname = NULL; char *ptr; - if (ptr = strchr(filename,'%')) { + if ((ptr = strchr(filename,'%'))) { if (strstr(style,"mpiio")) error->all(FLERR, "Dump file MPI-IO output not allowed with % in filename"); diff --git a/src/dump_image.cpp b/src/dump_image.cpp index c7bfd868d4..1c2326b474 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -969,14 +969,14 @@ int DumpImage::modify_param(int narg, char **arg) int ncount = 1; char *nextptr; char *ptr = arg[2]; - while (nextptr = strchr(ptr,'/')) { + while ((nextptr = strchr(ptr,'/'))) { ptr = nextptr + 1; ncount++; } char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while (ptrs[ncount++] = strtok(NULL,"/")); + while ((ptrs[ncount++] = strtok(NULL,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types @@ -1029,14 +1029,14 @@ int DumpImage::modify_param(int narg, char **arg) int ncount = 1; char *nextptr; char *ptr = arg[2]; - while (nextptr = strchr(ptr,'/')) { + while ((nextptr = strchr(ptr,'/'))) { ptr = nextptr + 1; ncount++; } char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while (ptrs[ncount++] = strtok(NULL,"/")); + while ((ptrs[ncount++] = strtok(NULL,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types diff --git a/src/fix.h b/src/fix.h index bf2aa7e46a..5b1f5e2dea 100644 --- a/src/fix.h +++ b/src/fix.h @@ -87,8 +87,7 @@ class Fix : protected Pointers { // KOKKOS host/device flag and per-fix data masks ExecutionSpace execution_space; - unsigned int datamask_read, datamask_read_ext; - unsigned int datamask_modify, datamask_modify_ext; + unsigned int datamask_read, datamask_modify; // USER-CUDA per-fix data masks diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index 8f2a1bf253..0842ea01de 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -812,7 +812,7 @@ int FixBoxRelax::modify_param(int narg, char **arg) void FixBoxRelax::compute_sigma() { - double pdeviatoric[3][3],htmp[3][3]; + double pdeviatoric[3][3]; double tmp1[3][3],sigma_tensor[3][3],h_invtmp[3][3]; // reset reference box dimensions @@ -830,16 +830,6 @@ void FixBoxRelax::compute_sigma() h0_inv[4] = domain->h_inv[4]; h0_inv[5] = domain->h_inv[5]; - htmp[0][0] = h0[0]; - htmp[1][1] = h0[1]; - htmp[2][2] = h0[2]; - htmp[1][2] = h0[3]; - htmp[0][2] = h0[4]; - htmp[0][1] = h0[5]; - htmp[2][1] = 0.0; - htmp[2][0] = 0.0; - htmp[1][0] = 0.0; - h_invtmp[0][0] = h0_inv[0]; h_invtmp[1][1] = h0_inv[1]; h_invtmp[2][2] = h0_inv[2]; diff --git a/src/fix_move.cpp b/src/fix_move.cpp index ef1c6f5de1..c39646fee0 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -761,6 +761,7 @@ void FixMove::final_integrate() v[i][0] += dtfm * f[i][0]; } } + if (yflag) { if (rmass) { dtfm = dtf / rmass[i]; @@ -770,6 +771,7 @@ void FixMove::final_integrate() v[i][1] += dtfm * f[i][1]; } } + if (zflag) { if (rmass) { dtfm = dtf / rmass[i]; diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index f77fda92f1..139b9ae105 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -1535,19 +1535,20 @@ double FixNH::compute_vector(int n) } else if (pstyle == ANISO) { ilen = 3; if (n < ilen) { - if (p_flag[n]) { + if (p_flag[n]) return p_hydro*(volume-vol0) / (pdim*nktv2p); - } else return 0.0; + else + return 0.0; } n -= ilen; } else { ilen = 6; if (n < ilen) { - if (n > 2) { - return 0.0; - } else if (p_flag[n]) { + if (n > 2) return 0.0; + else if (p_flag[n]) return p_hydro*(volume-vol0) / (pdim*nktv2p); - } else return 0.0; + else + return 0.0; } n -= ilen; } @@ -1560,17 +1561,17 @@ double FixNH::compute_vector(int n) } else if (pstyle == ANISO) { ilen = 3; if (n < ilen) { - if (p_flag[n]) { + if (p_flag[n]) return 0.5*omega_dot[n]*omega_dot[n]*omega_mass[n]; - } else return 0.0; + else return 0.0; } n -= ilen; } else { ilen = 6; if (n < ilen) { - if (p_flag[n]) { + if (p_flag[n]) return 0.5*omega_dot[n]*omega_dot[n]*omega_mass[n]; - } else return 0.0; + else return 0.0; } n -= ilen; } @@ -1579,19 +1580,17 @@ double FixNH::compute_vector(int n) ilen = mpchain; if (n < ilen) { ich = n; - if (ich == 0) { - return lkt_press * etap[0]; - } else return kt * etap[ich]; + if (ich == 0) return lkt_press * etap[0]; + else return kt * etap[ich]; } n -= ilen; ilen = mpchain; if (n < ilen) { ich = n; - if (ich == 0) { + if (ich == 0) return 0.5*etap_mass[0]*etap_dot[0]*etap_dot[0]; - } else { + else return 0.5*etap_mass[ich]*etap_dot[ich]*etap_dot[ich]; - } } n -= ilen; } @@ -2156,6 +2155,7 @@ void FixNH::nh_omega_dot() mtk_term1 /= pdim * atom->natoms; } } + for (int i = 0; i < 3; i++) if (p_flag[i]) { f_omega = (p_current[i]-p_hydro)*volume / diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index f4e86f74c9..25e0f9a44c 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -347,8 +347,8 @@ void FixPressBerendsen::end_of_step() // compute new T,P if (pstyle == ISO) { - double tmp = temperature->compute_scalar(); - tmp = pressure->compute_scalar(); + temperature->compute_scalar(); + pressure->compute_scalar(); } else { temperature->compute_vector(); pressure->compute_vector(); diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index dd3a7757ce..c540e675ce 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -11,6 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (ICTP, Italy) +------------------------------------------------------------------------- */ + #include "string.h" #include "stdlib.h" #include "math.h" diff --git a/src/image.cpp b/src/image.cpp index 8f88433c48..80ea5293dd 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -692,7 +692,6 @@ void Image::draw_triangle(double *x, double *y, double *z, double *surfaceColor) { double d1[3], d1len, d2[3], d2len, normal[3], invndotd; double xlocal[3], ylocal[3], zlocal[3]; - double center[3], bounds[6]; double surface[3]; double depth; @@ -723,10 +722,6 @@ void Image::draw_triangle(double *x, double *y, double *z, double *surfaceColor) double r[3],u[3]; - center[0] = (xlocal[0] + ylocal[0] + zlocal[0]) / 3; - center[1] = (xlocal[1] + ylocal[1] + zlocal[1]) / 3; - center[2] = (xlocal[2] + ylocal[2] + zlocal[2]) / 3; - r[0] = MathExtra::dot3(camRight,xlocal); r[1] = MathExtra::dot3(camRight,ylocal); r[2] = MathExtra::dot3(camRight,zlocal); @@ -1088,7 +1083,7 @@ void Image::write_PPM(FILE *fp) { fprintf (fp,"P6\n%d %d\n255\n",width,height); - int x,y; + int y; for (y = height-1; y >= 0; y --) fwrite(&writeBuffer[y*width*3],3,width,fp); } @@ -1878,7 +1873,7 @@ int ColorMap::minmax(double mindynamic, double maxdynamic) double *ColorMap::value2color(double value) { - double lo,hi; + double lo;//,hi; value = MAX(value,locurrent); value = MIN(value,hicurrent); @@ -1887,10 +1882,10 @@ double *ColorMap::value2color(double value) if (locurrent == hicurrent) value = 0.0; else value = (value-locurrent) / (hicurrent-locurrent); lo = 0.0; - hi = 1.0; + //hi = 1.0; } else { lo = locurrent; - hi = hicurrent; + //hi = hicurrent; } if (mstyle == CONTINUOUS) { diff --git a/src/irregular.cpp b/src/irregular.cpp index 373a21a518..679428fb48 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -199,14 +199,14 @@ int Irregular::migrate_check() int *periodicity = domain->periodicity; int *myloc = comm->myloc; int *procgrid = comm->procgrid; - int newproc,igx,igy,igz,glo,ghi; + int igx,igy,igz,glo,ghi; int flag = 0; for (int i = 0; i < nlocal; i++) { if (x[i][0] < sublo[0] || x[i][0] >= subhi[0] || x[i][1] < sublo[1] || x[i][1] >= subhi[1] || x[i][2] < sublo[2] || x[i][2] >= subhi[2]) { - newproc = coord2proc(x[i],igx,igy,igz); + coord2proc(x[i],igx,igy,igz); glo = myloc[0] - 1; ghi = myloc[0] + 1; diff --git a/src/lmptype.h b/src/lmptype.h index 1390d32477..a03c8601ad 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -48,7 +48,7 @@ namespace LAMMPS_NS { -// enum used for KOKKOS host/device flag +// enum used for KOKKOS host/device flags enum ExecutionSpace{Host,Device}; diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index eda07c67a5..b0f22ce096 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -586,7 +586,7 @@ int MinLineSearch::linemin_forcezero(double eoriginal, double &alpha) { int i,m,n; double fdothall,fdothme,hme,hmax,hmaxall; - double de_ideal,de; + double de; double *xatom,*x0atom,*fatom,*hatom; double alpha_max, alpha_init, alpha_del; @@ -884,7 +884,7 @@ double MinLineSearch::alpha_step(double alpha, int resetflag) double MinLineSearch::compute_dir_deriv(double &ff) { int i,m,n; - double *xatom,*hatom, *fatom; + double *hatom, *fatom; double dot[2],dotall[2]; double fh; diff --git a/src/molecule.cpp b/src/molecule.cpp index bf54e5091a..e68f3ff8b4 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -231,7 +231,6 @@ void Molecule::compute_inertia() // inertia = 3 eigenvalues = principal moments of inertia // evectors and exzy = 3 evectors = principal axes of rigid body - int ierror; double cross[3]; double tensor[3][3],evectors[3][3]; @@ -313,7 +312,7 @@ void Molecule::read(int flag) // trim anything from '#' onward // if line is blank, continue - if (ptr = strchr(line,'#')) *ptr = '\0'; + if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") == strlen(line)) continue; // search line for header keywords and set corresponding variable @@ -1325,7 +1324,7 @@ int Molecule::parse(char *line, char **words, int max) int nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while (ptr = strtok(NULL," \t\n\r\f")) { + while ((ptr = strtok(NULL," \t\n\r\f"))) { if (nwords < max) words[nwords] = ptr; nwords++; } diff --git a/src/molecule.h b/src/molecule.h index e45e7b61dc..45aae371a0 100644 --- a/src/molecule.h +++ b/src/molecule.h @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #ifndef LMP_ONE_MOLECULE_H -#define LMP_ONE_MOLEUCULE_H +#define LMP_ONE_MOLECULE_H #include "pointers.h" diff --git a/src/my_page.h b/src/my_page.h index 5fdf1e1351..8add279494 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -213,9 +213,9 @@ class MyPage { return; } - void *ptr; for (int i = npage-pagedelta; i < npage; i++) { #if defined(LAMMPS_MEMALIGN) + void *ptr; if (posix_memalign(&ptr, LAMMPS_MEMALIGN, pagesize*sizeof(T))) errorflag = 2; pages[i] = (T *) ptr; diff --git a/src/neigh_stencil.cpp b/src/neigh_stencil.cpp index 4c0320a180..65fd860d2b 100644 --- a/src/neigh_stencil.cpp +++ b/src/neigh_stencil.cpp @@ -63,13 +63,12 @@ void Neighbor::stencil_half_bin_2d_no_newton(NeighList *list, void Neighbor::stencil_half_ghost_bin_2d_no_newton(NeighList *list, int sx, int sy, int sz) { - int i,j; int *stencil = list->stencil; int **stencilxyz = list->stencilxyz; int nstencil = 0; - for (j = -sy; j <= sy; j++) - for (i = -sx; i <= sx; i++) + for (int j = -sy; j <= sy; j++) + for (int i = -sx; i <= sx; i++) if (bin_distance(i,j,0) < cutneighmaxsq) { stencilxyz[nstencil][0] = i; stencilxyz[nstencil][1] = j; diff --git a/src/pair.cpp b/src/pair.cpp index efeac53592..edfeb78c3d 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -233,12 +233,10 @@ void Pair::init() void Pair::reinit() { - int i,j; - etail = ptail = 0.0; - for (i = 1; i <= atom->ntypes; i++) - for (j = i; j <= atom->ntypes; j++) { + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) { init_one(i,j); if (tail_flag) { etail += etail_ij; diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index 4ecaa88340..6829401926 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -84,7 +84,6 @@ void PairBornCoulWolf::compute(int eflag, int vflag) double *q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; - int nall = nlocal + atom->nghost; double *special_coul = force->special_coul; double *special_lj = force->special_lj; int newton_pair = force->newton_pair; @@ -285,7 +284,7 @@ void PairBornCoulWolf::init_style() if (!atom->q_flag) error->all(FLERR,"Pair style born/coul/wolf requires atom attribute q"); - int irequest = neighbor->request(this); + neighbor->request(this); cut_coulsq = cut_coul * cut_coul; } diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index 973d1e2c2d..250a8bb1d4 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -53,11 +53,11 @@ PairCoulWolf::~PairCoulWolf() void PairCoulWolf::compute(int eflag, int vflag) { - int i,j,ii,jj,inum,jnum,itype,jtype; + int i,j,ii,jj,inum,jnum; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair; double rsq,forcecoul,factor_coul; double prefactor; - double r,rexp; + double r; int *ilist,*jlist,*numneigh,**firstneigh; double erfcc,erfcd,v_sh,dvdrr,e_self,e_shift,f_shift,qisq; @@ -68,9 +68,7 @@ void PairCoulWolf::compute(int eflag, int vflag) double **x = atom->x; double **f = atom->f; double *q = atom->q; - int *type = atom->type; int nlocal = atom->nlocal; - int nall = nlocal + atom->nghost; double *special_coul = force->special_coul; int newton_pair = force->newton_pair; double qqrd2e = force->qqrd2e; @@ -95,7 +93,6 @@ void PairCoulWolf::compute(int eflag, int vflag) xtmp = x[i][0]; ytmp = x[i][1]; ztmp = x[i][2]; - itype = type[i]; jlist = firstneigh[i]; jnum = numneigh[i]; @@ -112,7 +109,6 @@ void PairCoulWolf::compute(int eflag, int vflag) dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; rsq = delx*delx + dely*dely + delz*delz; - jtype = type[j]; if (rsq < cut_coulsq) { r = sqrt(rsq); @@ -214,7 +210,7 @@ void PairCoulWolf::init_style() if (!atom->q_flag) error->all(FLERR,"Pair coul/wolf requires atom attribute q"); - int irequest = neighbor->request(this); + neighbor->request(this); cut_coulsq = cut_coul*cut_coul; } @@ -298,8 +294,8 @@ double PairCoulWolf::single(int i, int j, int itype, int jtype, double rsq, double factor_coul, double factor_lj, double &fforce) { - double r6inv,r,prefactor,rexp; - double forcecoul,forceborn,phicoul; + double r,prefactor; + double forcecoul,phicoul; double e_shift,f_shift,dvdrr,erfcc,erfcd; e_shift = erfc(alf*cut_coul) / cut_coul; diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index 94d74d3c67..80b3d3a79c 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -63,7 +63,7 @@ void PairGauss::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair; - double r,rsq; + double rsq; int *ilist,*jlist,*numneigh,**firstneigh; evdwl = 0.0; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 517fe97995..e15d4b00d8 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -189,16 +189,14 @@ void PairHybrid::allocate() void PairHybrid::settings(int narg, char **arg) { - int m; - if (narg < 1) error->all(FLERR,"Illegal pair_style command"); // delete old lists, since cannot just change settings if (nstyles) { - for (m = 0; m < nstyles; m++) delete styles[m]; + for (int m = 0; m < nstyles; m++) delete styles[m]; delete [] styles; - for (m = 0; m < nstyles; m++) delete [] keywords[m]; + for (int m = 0; m < nstyles; m++) delete [] keywords[m]; delete [] keywords; } diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index ed0eeeb6bc..a2cf43e50f 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -69,7 +69,6 @@ void PairLJSmoothLinear::compute(int eflag, int vflag) double **f = atom->f; int *type = atom->type; int nlocal = atom->nlocal; - int nall = nlocal + atom->nghost; double *special_lj = force->special_lj; int newton_pair = force->newton_pair; diff --git a/src/procmap.cpp b/src/procmap.cpp index 6703b08d25..b24e59421b 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -291,7 +291,7 @@ void ProcMap::custom_grid(char *cfile, int nprocs, if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of custom file"); while (1) { - if (ptr = strchr(line,'#')) *ptr = '\0'; + if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") != strlen(line)) break; if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of custom file"); diff --git a/src/read_data.cpp b/src/read_data.cpp index 29936f5bb4..9d2f82ccb6 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -23,6 +23,7 @@ #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" #include "atom_vec_tri.h" +#include "force.h" #include "molecule.h" #include "comm.h" #include "update.h" @@ -50,48 +51,13 @@ using namespace LAMMPS_NS; // customize for new sections #define NSECTIONS 25 // change when add to header::section_keywords -/* ---------------------------------------------------------------------- */ +// pair style suffixes to ignore +// when matching Pair Coeffs comment to currently-defined pair style -// compare two style strings and compare under consideration of possibly -// having suffixes which should be ignored (like /cuda, /gpu, /omp, /opt) -// we also need to strip off all coulomb related parts, since they do not -// affect the choice of coefficients (with very few execptions). - -static const char *suffixes[] = {"/cuda","/gpu","/opt","/omp","/coul/cut", - "/coul/long","/coul/msm","/coul/dsf","/coul/debye","/coul/charmm",NULL}; - -static int style_match(const char *one, const char *two) -{ - int i, delta, len, len1, len2; - - // cannot compare empty styles - - if ((one == NULL) || (two == NULL)) return 1; - - len1 = strlen(one); - len2 = strlen(two); - - for (i=0; suffixes[i] != NULL; ++i) { - len = strlen(suffixes[i]); - - if ((delta = len1 - len) > 0) - if (strcmp(one+delta,suffixes[i]) == 0) - len1 = delta; - - if ((delta = len2 - len) > 0) - if (strcmp(two+delta,suffixes[i]) == 0) - len2 = delta; - } - - // if the data file has no style hint, accept it unconditionally. - // otherwise the length of the style without suffix has to match - // and the style name up to that point has to be identical, too. - - if ((len1 == 0) || (len1 == len2) || (strncmp(one,two,len1) == 0)) - return 1; - - return 0; -} +const char *suffixes[] = {"/cuda","/gpu","/opt","/omp","/kk", + "/coul/cut","/coul/long","/coul/msm", + "/coul/dsf","/coul/debye","/coul/charmm", + NULL}; /* ---------------------------------------------------------------------- */ @@ -143,13 +109,10 @@ void ReadData::command(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal read_data command"); - if (domain->box_exist) - error->all(FLERR,"Cannot read_data after simulation box is defined"); - if (domain->dimension == 2 && domain->zperiodic == 0) - error->all(FLERR,"Cannot run 2d simulation with nonperiodic Z dimension"); - - // fixes that process data file info + // optional args + addflag = mergeflag = 0; + offset[0] = offset[1] = offset[2] = 0.0; nfix = 0; fix_index = NULL; fix_header = NULL; @@ -157,7 +120,20 @@ void ReadData::command(int narg, char **arg) int iarg = 1; while (iarg < narg) { - if (strcmp(arg[iarg],"fix") == 0) { + if (strcmp(arg[iarg],"add") == 0) { + addflag = 1; + iarg++; + } else if (strcmp(arg[iarg],"merge") == 0) { + mergeflag = 1; + iarg++; + } else if (strcmp(arg[iarg],"offset") == 0) { + if (iarg+4 > narg) + error->all(FLERR,"Illegal read_data command"); + offset[0] = force->numeric(FLERR,arg[iarg+1]); + offset[1] = force->numeric(FLERR,arg[iarg+2]); + offset[2] = force->numeric(FLERR,arg[iarg+3]); + iarg += 4; + } else if (strcmp(arg[iarg],"fix") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal read_data command"); memory->grow(fix_index,nfix+1,"read_data:fix_index"); @@ -184,6 +160,18 @@ void ReadData::command(int narg, char **arg) } else error->all(FLERR,"Illegal read_data command"); } + // error checks + + if (domain->box_exist && !addflag && !mergeflag) + error->all(FLERR,"Cannot read_data after simulation box is defined"); + if (addflag && mergeflag) error->all(FLERR,"Cannot read_data add and merge"); + if (domain->dimension == 2 && offset[2] != 0.0) + error->all(FLERR,"Cannot use non-zero z offset in read_data " + "for 2d simulation"); + + if (domain->dimension == 2 && domain->zperiodic == 0) + error->all(FLERR,"Cannot run 2d simulation with nonperiodic Z dimension"); + // perform 1-pass read if no molecular topoogy in file // perform 2-pass read if molecular topology, // first pass calculates max topology/atom @@ -269,7 +257,8 @@ void ReadData::command(int narg, char **arg) atomflag = 1; if (firstpass) { if (me == 0 && !style_match(style,atom->atom_style)) - error->warning(FLERR,"Recommended atom style in data file differs"); + error->warning(FLERR,"Atom style in data file differs " + "from currently defined atom style"); atoms(); } else skip_lines(atom->natoms); } else if (strcmp(keyword,"Velocities") == 0) { @@ -341,7 +330,8 @@ void ReadData::command(int narg, char **arg) error->all(FLERR,"Must define pair_style before Pair Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->pair_style)) - error->warning(FLERR,"Recommended pair style in data file differs"); + error->warning(FLERR,"Pair style in data file differs " + "from currently defined pair style"); paircoeffs(); } else skip_lines(atom->ntypes); } else if (strcmp(keyword,"PairIJ Coeffs") == 0) { @@ -349,7 +339,8 @@ void ReadData::command(int narg, char **arg) error->all(FLERR,"Must define pair_style before PairIJ Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->pair_style)) - error->warning(FLERR,"Recommended pair style in data file differs"); + error->warning(FLERR,"Pair style in data file differs " + "from currently defined pair style"); pairIJcoeffs(); } else skip_lines(atom->ntypes*(atom->ntypes+1)/2); } else if (strcmp(keyword,"Bond Coeffs") == 0) { @@ -359,7 +350,8 @@ void ReadData::command(int narg, char **arg) error->all(FLERR,"Must define bond_style before Bond Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->bond_style)) - error->warning(FLERR,"Recommended bond style in data file differs"); + error->warning(FLERR,"Bond style in data file differs " + "from currently defined bond style"); bondcoeffs(); } else skip_lines(atom->nbondtypes); } else if (strcmp(keyword,"Angle Coeffs") == 0) { @@ -369,7 +361,8 @@ void ReadData::command(int narg, char **arg) error->all(FLERR,"Must define angle_style before Angle Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->angle_style)) - error->warning(FLERR,"Recommended angle style in data file differs"); + error->warning(FLERR,"Angle style in data file differs " + "from currently defined angle style"); anglecoeffs(0); } else skip_lines(atom->nangletypes); } else if (strcmp(keyword,"Dihedral Coeffs") == 0) { @@ -379,7 +372,8 @@ void ReadData::command(int narg, char **arg) error->all(FLERR,"Must define dihedral_style before Dihedral Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->dihedral_style)) - error->warning(FLERR,"Recommended dihedral style in data file differs"); + error->warning(FLERR,"Dihedral style in data file differs " + "from currently defined dihedral style"); dihedralcoeffs(0); } else skip_lines(atom->ndihedraltypes); } else if (strcmp(keyword,"Improper Coeffs") == 0) { @@ -389,7 +383,8 @@ void ReadData::command(int narg, char **arg) error->all(FLERR,"Must define improper_style before Improper Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->improper_style)) - error->warning(FLERR,"Recommended improper style in data file differs"); + error->warning(FLERR,"Improper style in data file differs " + "from currently defined improper style"); impropercoeffs(0); } else skip_lines(atom->nimpropertypes); @@ -665,8 +660,6 @@ void ReadData::header() if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); } - // customize for new header lines - while (1) { // read a line and bcast length if flag is set @@ -707,6 +700,7 @@ void ReadData::header() } // search line for header keyword and set corresponding variable + // customize for new header lines if (strstr(line,"atoms")) { sscanf(line,BIGINT_FORMAT,&atom->natoms); @@ -1331,7 +1325,6 @@ void ReadData::bodies(int firstpass) void ReadData::mass() { - int i,m; char *next; char *buf = new char[atom->ntypes*MAXLINE]; @@ -1339,7 +1332,7 @@ void ReadData::mass() if (eof) error->all(FLERR,"Unexpected end of data file"); char *original = buf; - for (i = 0; i < atom->ntypes; i++) { + for (int i = 0; i < atom->ntypes; i++) { next = strchr(buf,'\n'); *next = '\0'; atom->set_mass(buf); @@ -1565,6 +1558,7 @@ void ReadData::open(char *file) grab next keyword read lines until one is non-blank keyword is all text on line w/out leading & trailing white space + optional style can be appended after comment char '#' read one additional line (assumed blank) if any read hits EOF, set keyword to empty if first = 1, line variable holds non-blank line that ended header @@ -1602,20 +1596,17 @@ void ReadData::parse_keyword(int first) MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(line,n,MPI_CHAR,0,world); - // handle comments following the keyword - // truncate string and increment pointer over whitespace + // store optional "style" following comment char '#' after keyword char *ptr; - if ((ptr = strrchr(line,'#'))) { - *ptr++ = '\0'; - while (*ptr == ' ' || *ptr == '\t') ++ptr; - - int stop = strlen(ptr) - 1; - while (ptr[stop] == ' ' || ptr[stop] == '\t' - || ptr[stop] == '\n' || ptr[stop] == '\r') stop--; - ptr[stop+1] = '\0'; - - strcpy(style,ptr); + if ((ptr = strchr(line,'#'))) { + *ptr++ = '\0'; + while (*ptr == ' ' || *ptr == '\t') ptr++; + int stop = strlen(ptr) - 1; + while (ptr[stop] == ' ' || ptr[stop] == '\t' + || ptr[stop] == '\n' || ptr[stop] == '\r') stop--; + ptr[stop+1] = '\0'; + strcpy(style,ptr); } else style[0] = '\0'; // copy non-whitespace portion of line into keyword @@ -1671,3 +1662,30 @@ void ReadData::parse_coeffs(char *line, const char *addstr, int dupflag) word = strtok(NULL," \t\n\r\f"); } } + +/* ---------------------------------------------------------------------- + compare two style strings if they both exist + one = comment in data file section, two = currently-defined style + ignore suffixes listed in suffixes array at top of file +------------------------------------------------------------------------- */ + +int ReadData::style_match(const char *one, const char *two) +{ + int i,delta,len,len1,len2; + + if ((one == NULL) || (two == NULL)) return 1; + + len1 = strlen(one); + len2 = strlen(two); + + for (i = 0; suffixes[i] != NULL; i++) { + len = strlen(suffixes[i]); + if ((delta = len1 - len) > 0) + if (strcmp(one+delta,suffixes[i]) == 0) len1 = delta; + if ((delta = len2 - len) > 0) + if (strcmp(two+delta,suffixes[i]) == 0) len2 = delta; + } + + if ((len1 == 0) || (len1 == len2) || (strncmp(one,two,len1) == 0)) return 1; + return 0; +} diff --git a/src/read_data.h b/src/read_data.h index 186f43c4fb..685c707b8e 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -37,7 +37,11 @@ class ReadData : protected Pointers { char **arg; int me,narg,maxarg,compressed; - int nfix; // # of extra fixes that process/store info in data file + // optional args + + int addflag,mergeflag; + double offset[3]; + int nfix; int *fix_index; char **fix_header; char **fix_section; @@ -58,6 +62,7 @@ class ReadData : protected Pointers { void parse_keyword(int); void skip_lines(bigint); void parse_coeffs(char *, const char *, int); + int style_match(const char *, const char *); void atoms(); void velocities(); diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 978b2d2bc9..fb8cb02e31 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -549,7 +549,7 @@ void ReadRestart::file_search(char *infile, char *outfile) char *pattern = new char[strlen(filename) + 16]; - if (ptr = strchr(filename,'%')) { + if ((ptr = strchr(filename,'%'))) { *ptr = '\0'; sprintf(pattern,"%s%s%s",filename,"base",ptr+1); *ptr = '%'; @@ -574,7 +574,7 @@ void ReadRestart::file_search(char *infile, char *outfile) DIR *dp = opendir(dirname); if (dp == NULL) error->one(FLERR,"Cannot open dir to search for restart file"); - while (ep = readdir(dp)) { + while ((ep = readdir(dp))) { if (strstr(ep->d_name,begin) != ep->d_name) continue; if ((ptr = strstr(&ep->d_name[nbegin],end)) == NULL) continue; if (strlen(end) == 0) ptr = ep->d_name + strlen(ep->d_name); @@ -611,9 +611,7 @@ void ReadRestart::file_search(char *infile, char *outfile) void ReadRestart::header(int incompatible) { - int px,py,pz; int xperiodic,yperiodic,zperiodic; - int boundary[3][2]; // read flags and fields until flag = -1 @@ -859,7 +857,6 @@ void ReadRestart::type_arrays() void ReadRestart::force_fields() { - int n; char *style; int flag = read_int(); diff --git a/src/set.cpp b/src/set.cpp index c221fbc3e0..23a654af67 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -723,7 +723,6 @@ void Set::setrandom(int keyword) AtomVecEllipsoid *avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line"); AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri"); RanPark *random = new RanPark(lmp,1); @@ -787,8 +786,6 @@ void Set::setrandom(int keyword) // set quaternions to random orientations in 3d or 2d } else if (keyword == QUAT_RANDOM) { - int *ellipsoid = atom->ellipsoid; - int *tri = atom->tri; int nlocal = atom->nlocal; double *quat; diff --git a/src/universe.cpp b/src/universe.cpp index 2b36bd856a..3e3ed7d84b 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -100,7 +100,7 @@ void Universe::reorder(char *style, char *arg) if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of -reorder file"); while (1) { - if (ptr = strchr(line,'#')) *ptr = '\0'; + if ((ptr = strchr(line,'#'))) *ptr = '\0'; if (strspn(line," \t\n\r") != strlen(line)) break; if (!fgets(line,MAXLINE,fp)) error->one(FLERR,"Unexpected end of -reorder file"); diff --git a/src/variable.cpp b/src/variable.cpp index ee2bc4ec53..b0a9a48a91 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -680,8 +680,8 @@ void Variable::compute_atom(int ivar, int igroup, double *vstore; if (style[ivar] == ATOM) { - double tmp = evaluate(data[ivar][0],&tree); - tmp = collapse_tree(tree); + evaluate(data[ivar][0],&tree); + collapse_tree(tree); } else vstore = reader[ivar]->fix->vstore; int groupbit = group->bitmask[igroup]; @@ -2543,27 +2543,27 @@ int Variable::math_function(char *word, char *contents, Tree **tree, // evaluate args Tree *newtree; - double tmp,value1,value2,value3; + double value1,value2,value3; if (tree) { newtree = new Tree(); Tree *argtree; if (narg == 1) { - tmp = evaluate(arg1,&argtree); + evaluate(arg1,&argtree); newtree->left = argtree; newtree->middle = newtree->right = NULL; } else if (narg == 2) { - tmp = evaluate(arg1,&argtree); + evaluate(arg1,&argtree); newtree->left = argtree; newtree->middle = NULL; - tmp = evaluate(arg2,&argtree); + evaluate(arg2,&argtree); newtree->right = argtree; } else if (narg == 3) { - tmp = evaluate(arg1,&argtree); + evaluate(arg1,&argtree); newtree->left = argtree; - tmp = evaluate(arg2,&argtree); + evaluate(arg2,&argtree); newtree->middle = argtree; - tmp = evaluate(arg3,&argtree); + evaluate(arg3,&argtree); newtree->right = argtree; } treestack[ntreestack++] = newtree; @@ -3953,7 +3953,7 @@ unsigned int Variable::data_mask(char *str) { unsigned int datamask = EMPTY_MASK; - for (unsigned int i=0; i < strlen(str)-2; i++) { + for (unsigned int i = 0; i < strlen(str)-2; i++) { int istart = i; while (isalnum(str[i]) || str[i] == '_') i++; int istop = i-1; @@ -3986,21 +3986,21 @@ unsigned int Variable::data_mask(char *str) } if ((strncmp(word,"f_",2) == 0) && (i>0) && (!isalnum(str[i-1]))) { - if (domain->box_exist == 0) - error->all(FLERR, - "Variable evaluation before simulation box is defined"); - - n = strlen(word) - 2 + 1; - char *id = new char[n]; - strcpy(id,&word[2]); - - int ifix = modify->find_fix(id); - if (ifix < 0) error->all(FLERR,"Invalid fix ID in variable formula"); - - datamask &= modify->fix[ifix]->data_mask(); - delete [] id; + if (domain->box_exist == 0) + error->all(FLERR, + "Variable evaluation before simulation box is defined"); + + n = strlen(word) - 2 + 1; + char *id = new char[n]; + strcpy(id,&word[2]); + + int ifix = modify->find_fix(id); + if (ifix < 0) error->all(FLERR,"Invalid fix ID in variable formula"); + + datamask &= modify->fix[ifix]->data_mask(); + delete [] id; } - + if ((strncmp(word,"v_",2) == 0) && (i>0) && (!isalnum(str[i-1]))) { int ivar = find(word); datamask &= data_mask(ivar); @@ -4100,7 +4100,7 @@ int VarReader::read_scalar(char *str) else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline - if (ptr = strchr(str,'#')) *ptr = '\0'; // strip comment + if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank n = strlen(str) + 1; break; @@ -4143,7 +4143,7 @@ int VarReader::read_peratom() else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline - if (ptr = strchr(str,'#')) *ptr = '\0'; // strip comment + if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank n = strlen(str) + 1; break; diff --git a/src/version.h b/src/version.h index 287b27670a..6371867d57 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "26 Feb 2014" +#define LAMMPS_VERSION "10 Mar 2014" diff --git a/src/write_data.cpp b/src/write_data.cpp index 41d35c31ca..e9809692c9 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -65,7 +65,7 @@ void WriteData::command(int narg, char **arg) int n = strlen(arg[0]) + 16; char *file = new char[n]; - if (ptr = strchr(arg[0],'*')) { + if ((ptr = strchr(arg[0],'*'))) { *ptr = '\0'; sprintf(file,"%s" BIGINT_FORMAT "%s",arg[0],update->ntimestep,ptr+1); } else strcpy(file,arg[0]); @@ -152,11 +152,11 @@ void WriteData::write(char *file) // sum up bond,angle counts // may be different than atom->nbonds,nangles if broken/turned-off - if (atom->molecular == 1 && atom->nbonds || atom->nbondtypes) { + if (atom->molecular == 1 && (atom->nbonds || atom->nbondtypes)) { nbonds_local = atom->avec->pack_bond(NULL); MPI_Allreduce(&nbonds_local,&nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world); } - if (atom->molecular == 1 && atom->nangles || atom->nangletypes) { + if (atom->molecular == 1 && (atom->nangles || atom->nangletypes)) { nangles_local = atom->avec->pack_angle(NULL); MPI_Allreduce(&nangles_local,&nangles,1,MPI_LMP_BIGINT,MPI_SUM,world); } @@ -422,7 +422,7 @@ void WriteData::bonds() // pack my bond data into buf - int foo = atom->avec->pack_bond(buf); + atom->avec->pack_bond(buf); // write one chunk of info per proc to file // proc 0 pings each proc, receives its chunk, writes to file diff --git a/tools/msi2lmp/src/msi2lmp.c b/tools/msi2lmp/src/msi2lmp.c index 0ec782d17f..c474b51544 100644 --- a/tools/msi2lmp/src/msi2lmp.c +++ b/tools/msi2lmp/src/msi2lmp.c @@ -264,9 +264,9 @@ int main (int argc, char *argv[]) shift[2] = atof(argv[++n]); } else if (strncmp(argv[n],"-i",2) == 0 ) { iflag = 1; - } else if (strncmp(argv[n],"-n",4) == 0 ) { + } else if (strncmp(argv[n],"-n",2) == 0 ) { centerflag = 0; - } else if (strncmp(argv[n],"-o",4) == 0 ) { + } else if (strncmp(argv[n],"-o",2) == 0 ) { hintflag = 0; } else if (strncmp(argv[n],"-p",2) == 0) { n++;