diff --git a/src/GPU/Package.sh b/src/GPU/Package.sh index e62e0be8fd..cdac230d51 100644 --- a/src/GPU/Package.sh +++ b/src/GPU/Package.sh @@ -1,6 +1,6 @@ # Update package files in LAMMPS # cp package file to src if doesn't exist or is different -# do not copy gayberne files if non-GPU version does not exist +# do not copy dependent files if non-GPU version does not exist for file in *.cpp *.h; do if (test $file = pair_gayberne_gpu.cpp -a ! -e ../pair_gayberne.cpp) then diff --git a/src/OPT/Package.sh b/src/OPT/Package.sh index a1714684fc..5fb182c0f9 100644 --- a/src/OPT/Package.sh +++ b/src/OPT/Package.sh @@ -1,6 +1,6 @@ # Update package files in LAMMPS # cp package file to src if doesn't exist or is different -# do not copy eam and charmm files if non-OPT versions do not exist +# do not copy dependent files if non-OPT versions do not exist for file in *.cpp *.h; do if (test $file = pair_eam_opt.cpp -a ! -e ../pair_eam.cpp) then diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index 70d3530c6b..a553bf89be 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -421,12 +421,11 @@ void PairPeriLPS::init_style() { // error checks - if (!atom->peri_flag) error->all(FLERR,"Pair style peri requires atom style peri"); + 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"); - if (domain->lattice == NULL) - error->all(FLERR,"Pair peri requires a lattice be defined"); if (domain->lattice->xlattice != domain->lattice->ylattice || domain->lattice->xlattice != domain->lattice->zlattice || domain->lattice->ylattice != domain->lattice->zlattice) diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 38f14d7b53..501c14a121 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -359,12 +359,11 @@ void PairPeriPMB::init_style() { // error checks - if (!atom->peri_flag) error->all(FLERR,"Pair style peri requires atom style peri"); + 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"); - if (domain->lattice == NULL) - error->all(FLERR,"Pair peri requires a lattice be defined"); if (domain->lattice->xlattice != domain->lattice->ylattice || domain->lattice->xlattice != domain->lattice->zlattice || domain->lattice->ylattice != domain->lattice->zlattice) diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 8c7018c84b..b6095e420e 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -60,7 +60,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : randomx = NULL; randomt = NULL; - if (!domain->lattice) + if (domain->lattice->nbasis == 0) error->all(FLERR,"Fix append/atoms requires a lattice be defined"); nbasis = domain->lattice->nbasis; @@ -126,12 +126,10 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : iarg += 3; } else if (strcmp(arg[iarg],"basis") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command"); - if (domain->lattice == NULL) - error->all(FLERR,"Fix append/atoms requires a lattice be defined"); int ibasis = atoi(arg[iarg+1]); int itype = atoi(arg[iarg+2]); if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes) - error->all(FLERR,"Illegal fix append/atoms command"); + error->all(FLERR,"Invalid basis setting in fix append/atoms command"); basistype[ibasis-1] = itype; iarg += 3; } else if (strcmp(arg[iarg],"size") == 0) { @@ -184,9 +182,6 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : // setup scaling - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix append/atoms with undefined lattice"); - double xscale,yscale,zscale; if (scaleflag) { xscale = domain->lattice->xlattice; diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index 18d097d97b..e8686c197d 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -140,9 +140,6 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : // setup scaling - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix wall/piston with undefined lattice"); - double xscale,yscale,zscale; if (scaleflag) { xscale = domain->lattice->xlattice; diff --git a/src/SRD/fix_wall_srd.cpp b/src/SRD/fix_wall_srd.cpp index cd3b8df437..2fd302c601 100644 --- a/src/SRD/fix_wall_srd.cpp +++ b/src/SRD/fix_wall_srd.cpp @@ -127,9 +127,6 @@ FixWallSRD::FixWallSRD(LAMMPS *lmp, int narg, char **arg) : if (wallstyle[m] == CONSTANT) flag = 1; if (flag) { - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix wall with undefined lattice"); - double xscale,yscale,zscale; if (scaleflag) { xscale = domain->lattice->xlattice; diff --git a/src/USER-MOLFILE/Package.sh b/src/USER-MOLFILE/Package.sh index f4e52b70d7..3f6db2b877 100644 --- a/src/USER-MOLFILE/Package.sh +++ b/src/USER-MOLFILE/Package.sh @@ -1,5 +1,6 @@ # Update package files in LAMMPS # copy package file to src if it doesn't exists or is different + for file in molfile_interface.cpp molfile_interface.h molfile_plugin.h \ dump_molfile.cpp dump_molfile.h reader_molfile.h reader_molfile.cpp \ vmdplugin.h ; do \ diff --git a/src/change_box.cpp b/src/change_box.cpp index 2ff513b570..9da5535237 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -185,9 +185,6 @@ void ChangeBox::command(int narg, char **arg) for (int i = 0; i < nops; i++) if (ops[i].style == FINAL || ops[i].style == DELTA) flag = 1; - if (flag && scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of change_box with undefined lattice"); - if (flag && scaleflag) { scale[0] = domain->lattice->xlattice; scale[1] = domain->lattice->ylattice; diff --git a/src/compute_temp_ramp.cpp b/src/compute_temp_ramp.cpp index b96467da6d..f2636b1adc 100644 --- a/src/compute_temp_ramp.cpp +++ b/src/compute_temp_ramp.cpp @@ -59,9 +59,6 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) : // setup scaling - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of compute temp/ramp with undefined lattice"); - if (scaleflag) { xscale = domain->lattice->xlattice; yscale = domain->lattice->ylattice; diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 45cb6ac183..336d18fe2f 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -91,22 +91,18 @@ void CreateAtoms::command(int narg, char **arg) int scaleflag = 1; remapflag = 0; - if (domain->lattice) { - nbasis = domain->lattice->nbasis; - basistype = new int[nbasis]; - for (int i = 0; i < nbasis; i++) basistype[i] = itype; - } + nbasis = domain->lattice->nbasis; + basistype = new int[nbasis]; + for (int i = 0; i < nbasis; i++) basistype[i] = itype; while (iarg < narg) { if (strcmp(arg[iarg],"basis") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); - if (domain->lattice == NULL) - error->all(FLERR,"Cannot create atoms with undefined lattice"); int ibasis = atoi(arg[iarg+1]); itype = atoi(arg[iarg+2]); if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes) - error->all(FLERR,"Illegal create_atoms command"); + error->all(FLERR,"Invalid basis setting in create_atoms command"); basistype[ibasis-1] = itype; iarg += 3; } else if (strcmp(arg[iarg],"remap") == 0) { @@ -131,18 +127,16 @@ void CreateAtoms::command(int narg, char **arg) if (seed <= 0) error->all(FLERR,"Illegal create_atoms command"); } - // demand lattice be defined - // else setup scaling for single atom + // demand non-none lattice be defined for BOX and REGION + // else setup scaling for SINGLE and RANDOM // could use domain->lattice->lattice2box() to do conversion of // lattice to box, but not consistent with other uses of units=lattice // triclinic remapping occurs in add_single() if (style == BOX || style == REGION) { - if (domain->lattice == NULL) + if (nbasis == 0) error->all(FLERR,"Cannot create atoms with undefined lattice"); } else if (scaleflag == 1) { - if (domain->lattice == NULL) - error->all(FLERR,"Cannot create atoms with undefined lattice"); xone[0] *= domain->lattice->xlattice; xone[1] *= domain->lattice->ylattice; xone[2] *= domain->lattice->zlattice; diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 2f26f46b93..d9f5ce55c0 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -77,9 +77,6 @@ void DisplaceAtoms::command(int narg, char **arg) // setup scaling - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of displace_atoms with undefined lattice"); - double xscale,yscale,zscale; if (scaleflag) { xscale = domain->lattice->xlattice; diff --git a/src/domain.cpp b/src/domain.cpp index ab0c918c9e..cbfd7fec82 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -85,6 +85,11 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) boxhi_lamda[0] = boxhi_lamda[1] = boxhi_lamda[2] = 1.0; lattice = NULL; + char **args = new char*[2]; + args[0] = (char *) "none"; + args[1] = (char *) "1.0"; + set_lattice(2,args); + nregion = maxregion = 0; regions = NULL; } @@ -1229,17 +1234,12 @@ void Domain::image_flip(int m, int n, int p) /* ---------------------------------------------------------------------- create a lattice - delete it if style = none ------------------------------------------------------------------------- */ void Domain::set_lattice(int narg, char **arg) { if (lattice) delete lattice; lattice = new Lattice(lmp,narg,arg); - if (lattice->style == 0) { - delete lattice; - lattice = NULL; - } } /* ---------------------------------------------------------------------- diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp index 66c8ab30d5..6cfb753ffd 100644 --- a/src/fix_ave_spatial.cpp +++ b/src/fix_ave_spatial.cpp @@ -340,9 +340,6 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/spatial for triclinic boxes requires units reduced"); - if (scaleflag == LATTICE && domain->lattice == NULL) - error->all(FLERR,"Use of fix ave/spatial with undefined lattice"); - if (scaleflag == LATTICE) { xscale = domain->lattice->xlattice; yscale = domain->lattice->ylattice; diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index c622c3b589..78b5e99313 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -256,9 +256,6 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (set[i].style == FINAL || set[i].style == DELTA || set[i].style == VEL || set[i].style == WIGGLE) flag = 1; - if (flag && scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix deform with undefined lattice"); - double xscale,yscale,zscale; if (flag && scaleflag) { xscale = domain->lattice->xlattice; diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index 1bc91e13ae..c708a8fdbe 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -98,9 +98,6 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : // setup scaling - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix deposit with undefined lattice"); - double xscale,yscale,zscale; if (scaleflag) { xscale = domain->lattice->xlattice; diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp index 79e9441f6b..553e6ee04d 100644 --- a/src/fix_dt_reset.cpp +++ b/src/fix_dt_reset.cpp @@ -83,8 +83,6 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) : // setup scaling, based on xlattice parameter - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix dt/reset with undefined lattice"); if (scaleflag) xmax *= domain->lattice->xlattice; // initializations diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 6f4700c2ad..558121697b 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -59,9 +59,6 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) : // setup scaling - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix indent with undefined lattice"); - double xscale,yscale,zscale; if (scaleflag) { xscale = domain->lattice->xlattice; diff --git a/src/fix_move.cpp b/src/fix_move.cpp index e00c8e3063..0e241b8882 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -192,9 +192,6 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if ((mstyle == LINEAR || mstyle == WIGGLE || mstyle == ROTATE) && scaleflag) { - if (domain->lattice == NULL) - error->all(FLERR,"Use of fix move with undefined lattice"); - double xscale,yscale,zscale; if (scaleflag) { xscale = domain->lattice->xlattice; diff --git a/src/fix_recenter.cpp b/src/fix_recenter.cpp index dbdbb19744..50ea9c2303 100644 --- a/src/fix_recenter.cpp +++ b/src/fix_recenter.cpp @@ -75,9 +75,6 @@ FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) : // scale xcom,ycom,zcom - if (scaleflag == LATTICE && domain->lattice == NULL) - error->all(FLERR,"Use of fix recenter with undefined lattice"); - double xscale,yscale,zscale; if (scaleflag == LATTICE) { xscale = domain->lattice->xlattice; diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index 9cac82b859..07cb7255c4 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -163,9 +163,6 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : if (xstyle[m] != EDGE) flag = 1; if (flag) { - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix wall with undefined lattice"); - if (scaleflag) { xscale = domain->lattice->xlattice; yscale = domain->lattice->ylattice; diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index a79333ad14..9fc7d60264 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -115,9 +115,6 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) : if (wallstyle[m] != EDGE) flag = 1; if (flag) { - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of fix wall with undefined lattice"); - if (scaleflag) { xscale = domain->lattice->xlattice; yscale = domain->lattice->ylattice; diff --git a/src/lattice.cpp b/src/lattice.cpp index 5b8a5aed34..195cde8f0b 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -51,7 +51,9 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) else error->all(FLERR,"Illegal lattice command"); if (style == NONE) { - if (narg > 1) error->all(FLERR,"Illegal lattice command"); + if (narg != 2) error->all(FLERR,"Illegal lattice command"); + xlattice = ylattice = zlattice = atof(arg[1]); + if (xlattice <= 0.0) error->all(FLERR,"Illegal lattice command"); return; } diff --git a/src/region.cpp b/src/region.cpp index 53e05a156c..a6b5022ca8 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -368,9 +368,6 @@ void Region::options(int narg, char **arg) // setup scaling - if (scaleflag && domain->lattice == NULL) - error->all(FLERR,"Use of region with undefined lattice"); - if (scaleflag) { xscale = domain->lattice->xlattice; yscale = domain->lattice->ylattice; diff --git a/src/thermo.cpp b/src/thermo.cpp index 7c49b6c98b..a146f3c169 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -741,16 +741,10 @@ void Thermo::parse_fields(char *str) addfield("Yz",&Thermo::compute_yz,FLOAT); } else if (strcmp(word,"xlat") == 0) { - if (domain->lattice == NULL) - error->all(FLERR,"Thermo keyword requires lattice be defined"); addfield("Xlat",&Thermo::compute_xlat,FLOAT); } else if (strcmp(word,"ylat") == 0) { - if (domain->lattice == NULL) - error->all(FLERR,"Thermo keyword requires lattice be defined"); addfield("Ylat",&Thermo::compute_ylat,FLOAT); } else if (strcmp(word,"zlat") == 0) { - if (domain->lattice == NULL) - error->all(FLERR,"Thermo keyword requires lattice be defined"); addfield("Zlat",&Thermo::compute_zlat,FLOAT); } else if (strcmp(word,"pxx") == 0) { @@ -1245,16 +1239,10 @@ int Thermo::evaluate_keyword(char *word, double *answer) else if (strcmp(word,"yz") == 0) compute_yz(); else if (strcmp(word,"xlat") == 0) { - if (domain->lattice == NULL) - error->all(FLERR,"Thermo keyword in variable requires lattice be defined"); compute_xlat(); } else if (strcmp(word,"ylat") == 0) { - if (domain->lattice == NULL) - error->all(FLERR,"Thermo keyword in variable requires lattice be defined"); compute_ylat(); } else if (strcmp(word,"zlat") == 0) { - if (domain->lattice == NULL) - error->all(FLERR,"Thermo keyword in variable requires lattice be defined"); compute_zlat(); } else if (strcmp(word,"pxx") == 0) { diff --git a/src/velocity.cpp b/src/velocity.cpp index eb64b8cc90..b0c203b25d 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -378,20 +378,14 @@ void Velocity::set(int narg, char **arg) xscale = yscale = zscale = 1.0; if (xstyle && !xstr) { - if (scale_flag && domain->lattice == NULL) - error->all(FLERR,"Use of velocity with undefined lattice"); if (scale_flag) xscale = domain->lattice->xlattice; vx *= xscale; } if (ystyle && !ystr) { - if (scale_flag && domain->lattice == NULL) - error->all(FLERR,"Use of velocity with undefined lattice"); if (scale_flag) yscale = domain->lattice->ylattice; vy *= yscale; } if (zstyle && !zstr) { - if (scale_flag && domain->lattice == NULL) - error->all(FLERR,"Use of velocity with undefined lattice"); if (scale_flag) zscale = domain->lattice->zlattice; vz *= zscale; } @@ -552,9 +546,6 @@ void Velocity::ramp(int narg, char **arg) { // set scale factors - if (scale_flag && domain->lattice == NULL) - error->all(FLERR,"Use of velocity with undefined lattice"); - if (scale_flag) { xscale = domain->lattice->xlattice; yscale = domain->lattice->ylattice;