diff --git a/doc/Manual.html b/doc/Manual.html index f23b5a0cf3..43e96bec91 100644 --- a/doc/Manual.html +++ b/doc/Manual.html @@ -1,7 +1,7 @@
possible attributes = id, mol, type, mass, +possible attributes = id, mol, proc, type, mass, x, y, z, xs, ys, zs, xu, yu, zu, ix, iy, iz, vx, vy, vz, fx, fy, fz, q, mux, muy, muz, mu, @@ -41,6 +41,7 @@id = atom ID mol = molecule ID + proc = ID of processor that owns atom type = atom type mass = atom mass x,y,z = unscaled atom coordinates @@ -104,8 +105,8 @@ variable commands.The list of possible attributes is the same as that used by the dump custom command, which describes their meaning, with some additional quantities that are only defined for certain atom -styles. Basically, this list gives your input script -access to any per-atom quantity stored by LAMMPS. +styles. Basically, this augmented list gives an +input script access to any per-atom quantity stored by LAMMPS.
The values are stored in a per-atom vector or array as discussed below. Zeroes are stored for atoms not in the specified group or for diff --git a/doc/compute_property_atom.txt b/doc/compute_property_atom.txt index b6c1cc2f03..82f6e651b9 100644 --- a/doc/compute_property_atom.txt +++ b/doc/compute_property_atom.txt @@ -15,7 +15,7 @@ compute ID group-ID property/atom input1 input2 ... :pre ID, group-ID are documented in "compute"_compute.html command :ulb,l property/atom = style name of this compute command :l input = one or more atom attributes :l - possible attributes = id, mol, type, mass, + possible attributes = id, mol, proc, type, mass, x, y, z, xs, ys, zs, xu, yu, zu, ix, iy, iz, vx, vy, vz, fx, fy, fz, q, mux, muy, muz, mu, @@ -34,6 +34,7 @@ input = one or more atom attributes :l i_name, d_name :pre id = atom ID mol = molecule ID + proc = ID of processor that owns atom type = atom type mass = atom mass x,y,z = unscaled atom coordinates @@ -96,8 +97,8 @@ variable"_variable.html commands. The list of possible attributes is the same as that used by the "dump custom"_dump.html command, which describes their meaning, with some additional quantities that are only defined for certain "atom -styles"_atom_style.html. Basically, this list gives your input script -access to any per-atom quantity stored by LAMMPS. +styles"_atom_style.html. Basically, this augmented list gives an +input script access to any per-atom quantity stored by LAMMPS. The values are stored in a per-atom vector or array as discussed below. Zeroes are stored for atoms not in the specified group or for diff --git a/doc/dump.html b/doc/dump.html index 5527540cc4..e83d9f5c5f 100644 --- a/doc/dump.html +++ b/doc/dump.html @@ -68,6 +68,7 @@
id = atom ID mol = molecule ID + proc = ID of processor that owns atom type = atom type element = name of atom element, as defined by dump_modify command mass = atom mass @@ -459,17 +460,18 @@ dump 1 all local 1000 tmp.dump index c_1[1] c_1[2] c_1[3] c_2[1] c_2[2]This section explains the atom attributes that can be specified as part of the custom and cfg styles.
-The id, mol, type, element, mass, vx, vy, vz, fx, fy, -fz, q attributes are self-explanatory. +
The id, mol, proc, type, element, mass, vx, vy, vz, +fx, fy, fz, q attributes are self-explanatory.
Id is the atom ID. Mol is the molecule ID, included in the data -file for molecular systems. Type is the atom type. Element is -typically the chemical name of an element, which you must assign to -each type via the dump_modify element command. -More generally, it can be any string you wish to associated with an -atom type. Mass is the atom mass. Vx, vy, vz, fx, fy, -fz, and q are components of atom velocity and force and atomic -charge. +file for molecular systems. Proc is the ID of the processor (0 to +Nprocs-1) that currently owns the atom. Type is the atom type. +Element is typically the chemical name of an element, which you must +assign to each type via the dump_modify element +command. More generally, it can be any string you wish to associated +with an atom type. Mass is the atom mass. Vx, vy, vz, fx, +fy, fz, and q are components of atom velocity and force and +atomic charge.
There are several options for outputting atom coordinates. The x, y, z attributes write atom coordinates "unscaled", in the diff --git a/doc/dump.txt b/doc/dump.txt index 5d1be5881d..3f83f217ca 100644 --- a/doc/dump.txt +++ b/doc/dump.txt @@ -55,6 +55,7 @@ args = list of arguments for a particular style :l id = atom ID mol = molecule ID + proc = ID of processor that owns atom type = atom type element = name of atom element, as defined by "dump_modify"_dump_modify.html command mass = atom mass @@ -76,7 +77,9 @@ args = list of arguments for a particular style :l c_ID\[N\] = Nth column of per-atom array calculated by a compute with ID f_ID = per-atom vector calculated by a fix with ID f_ID\[N\] = Nth column of per-atom array calculated by a fix with ID - v_name = per-atom vector calculated by an atom-style variable with name :pre + v_name = per-atom vector calculated by an atom-style variable with name + d_name = per-atom floating point vector with name managed by fix property/atom + i_name = per-atom integer vector with name managed by fix property/atom :pre :ule [Examples:] @@ -444,17 +447,18 @@ dump 1 all local 1000 tmp.dump index c_1\[1\] c_1\[2\] c_1\[3\] c_2\[1\] c_2\[2\ This section explains the atom attributes that can be specified as part of the {custom} and {cfg} styles. -The {id}, {mol}, {type}, {element}, {mass}, {vx}, {vy}, {vz}, {fx}, {fy}, -{fz}, {q} attributes are self-explanatory. +The {id}, {mol}, {proc}, {type}, {element}, {mass}, {vx}, {vy}, {vz}, +{fx}, {fy}, {fz}, {q} attributes are self-explanatory. {Id} is the atom ID. {Mol} is the molecule ID, included in the data -file for molecular systems. {Type} is the atom type. {Element} is -typically the chemical name of an element, which you must assign to -each type via the "dump_modify element"_dump_modify.html command. -More generally, it can be any string you wish to associated with an -atom type. {Mass} is the atom mass. {Vx}, {vy}, {vz}, {fx}, {fy}, -{fz}, and {q} are components of atom velocity and force and atomic -charge. +file for molecular systems. {Proc} is the ID of the processor (0 to +Nprocs-1) that currently owns the atom. {Type} is the atom type. +{Element} is typically the chemical name of an element, which you must +assign to each type via the "dump_modify element"_dump_modify.html +command. More generally, it can be any string you wish to associated +with an atom type. {Mass} is the atom mass. {Vx}, {vy}, {vz}, {fx}, +{fy}, {fz}, and {q} are components of atom velocity and force and +atomic charge. There are several options for outputting atom coordinates. The {x}, {y}, {z} attributes write atom coordinates "unscaled", in the @@ -547,6 +551,10 @@ invoke other computes, fixes, or variables when they are evaluated, so this is a very general means of creating quantities to output to a dump file. +The {d_name} and {i_name} attributes allow to output custom per atom +floating point or integer properties that are managed by +"fix property/atom"_fix_property_atom.html. + See "Section_modify"_Section_modify.html of the manual for information on how to add new compute and fix styles to LAMMPS to calculate per-atom quantities which could then be output into dump files. diff --git a/doc/fix_store_state.txt b/doc/fix_store_state.txt index bc3e9d2d8d..e40a0f49cc 100644 --- a/doc/fix_store_state.txt +++ b/doc/fix_store_state.txt @@ -21,8 +21,9 @@ input = one or more atom attributes :l vx, vy, vz, fx, fy, fz, q, mux, muy, muz, radius, omegax, omegay, omegaz, - angmomx, angmomy, angmomz, tqx, tqy, tqz - c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name :pre + angmomx, angmomy, angmomz, tqx, tqy, tqz, + c_ID, c_ID\[N\], f_ID, f_ID\[N\], v_name, + d_name, i_name :pre id = atom ID mol = molecule ID @@ -44,7 +45,9 @@ input = one or more atom attributes :l c_ID\[I\] = Ith column of per-atom array calculated by a compute with ID f_ID = per-atom vector calculated by a fix with ID f_ID\[I\] = Ith column of per-atom array calculated by a fix with ID - v_name = per-atom vector calculated by an atom-style variable with name :pre + v_name = per-atom vector calculated by an atom-style variable with name + d_name = per-atom floating point vector managed by fix property/atom + i_name = per-atom integer vector managed by fix property/atom :pre zero or more keyword/value pairs may be appended :l keyword = {com} :l @@ -120,7 +123,8 @@ minimization"_minimize.html. [Related commands:] "dump custom"_dump.html, "compute -property/atom"_compute_property_atom.html, "variable"_variable.html +property/atom"_compute_property_atom.html, +"fix property/atom"_fix_property_atom.html, "variable"_variable.html [Default:] diff --git a/doc/molecule.html b/doc/molecule.html index 270a3742d1..46c1cf3469 100644 --- a/doc/molecule.html +++ b/doc/molecule.html @@ -29,7 +29,7 @@ molecule CO2 co2.txt
Define a molecule template that can be used as part of other LAMMPS commands, typically to define a collection of particles as a bonded molecule or a rigid body. Commands that currently use molecule -templates (or will in the future) include: +templates include:
If a Bonds section is specified then the Special Bond Counts and +Special Bonds sections must be also, since the latter is needed for +LAMMPS to properly exclude or weight bonded pairwise interactions +between bonded atoms. See the special_bonds +command for more details. +
IMPORTANT NOTE: Whether a section is required depends on how the molecule template is used by other LAMMPS commands. For example, to add a molecule via the fix deposit command, the diff --git a/doc/molecule.txt b/doc/molecule.txt index 1af3078c65..f437222851 100644 --- a/doc/molecule.txt +++ b/doc/molecule.txt @@ -26,7 +26,7 @@ molecule CO2 co2.txt :pre Define a molecule template that can be used as part of other LAMMPS commands, typically to define a collection of particles as a bonded molecule or a rigid body. Commands that currently use molecule -templates (or will in the future) include: +templates include: "fix deposit"_fix_deposit.html "fix pour"_fix_pour.html @@ -113,6 +113,12 @@ These are the allowed section keywords for the body of the file. {Special Bond Counts, Special Bonds} = special neighbor info {Shake Flags, Shake Atoms, Shake Bond Types} = SHAKE info :ul +If a Bonds section is specified then the Special Bond Counts and +Special Bonds sections must be also, since the latter is needed for +LAMMPS to properly exclude or weight bonded pairwise interactions +between bonded atoms. See the "special_bonds"_special_bonds.html +command for more details. + IMPORTANT NOTE: Whether a section is required depends on how the molecule template is used by other LAMMPS commands. For example, to add a molecule via the "fix deposit"_fix_deposit.html command, the diff --git a/examples/COUPLE/lammps_quest/lmpqst.cpp b/examples/COUPLE/lammps_quest/lmpqst.cpp index a9f364a232..e7f2d92c1d 100644 --- a/examples/COUPLE/lammps_quest/lmpqst.cpp +++ b/examples/COUPLE/lammps_quest/lmpqst.cpp @@ -146,15 +146,21 @@ void quest_callback(void *ptr, bigint ntimestep, double boxyhi = *((double *) lammps_extract_global(info->lmp,"boxyhi")); double boxzlo = *((double *) lammps_extract_global(info->lmp,"boxzlo")); double boxzhi = *((double *) lammps_extract_global(info->lmp,"boxzhi")); + double boxxy = *((double *) lammps_extract_global(info->lmp,"xy")); + double boxxz = *((double *) lammps_extract_global(info->lmp,"xz")); + double boxyz = *((double *) lammps_extract_global(info->lmp,"yz")); double xprd = (boxxhi-boxxlo)/ANGSTROM_per_BOHR; double yprd = (boxyhi-boxylo)/ANGSTROM_per_BOHR; double zprd = (boxzhi-boxzlo)/ANGSTROM_per_BOHR; + double xy = boxxy/ANGSTROM_per_BOHR; + double xz = boxxz/ANGSTROM_per_BOHR; + double yz = boxyz/ANGSTROM_per_BOHR; if (info->me == 0) { sprintf(boxlines[0],"%g %g %g\n",xprd,0.0,0.0); - sprintf(boxlines[1],"%g %g %g\n",0.0,yprd,0.0); - sprintf(boxlines[2],"%g %g %g\n",0.0,0.0,zprd); + sprintf(boxlines[1],"%g %g %g\n",xy,yprd,0.0); + sprintf(boxlines[2],"%g %g %g\n",xz,yz,zprd); } // xlines = x for atoms on each proc converted to text lines diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 5f3f8ce2db..4d45ef2227 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -211,6 +211,11 @@ void PPPM::init() error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; + // a TIP4P pair style requires a matching long-range solver + if (!tip4pflag && force->pair->tip4pflag) + error->all(FLERR,"Using a TIP4P pair style without a " + "compatible kspace style"); + // if kspace is TIP4P, extract TIP4P params from pair style // bond/angle are not yet init(), so insure equilibrium request is valid diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index 0c20744a5c..56282052c4 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -23,6 +23,7 @@ #include "atom_vec_body.h" #include "update.h" #include "domain.h" +#include "comm.h" #include "memory.h" #include "error.h" @@ -57,6 +58,8 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute property/atom for " "atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_molecule; + } else if (strcmp(arg[iarg],"proc") == 0) { + pack_choice[i] = &ComputePropertyAtom::pack_proc; } else if (strcmp(arg[iarg],"type") == 0) { pack_choice[i] = &ComputePropertyAtom::pack_type; } else if (strcmp(arg[iarg],"mass") == 0) { @@ -455,6 +458,21 @@ void ComputePropertyAtom::pack_molecule(int n) /* ---------------------------------------------------------------------- */ +void ComputePropertyAtom::pack_proc(int n) +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + int me = comm->me; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) buf[n] = me; + else buf[n] = 0.0; + n += nvalues; + } +} + +/* ---------------------------------------------------------------------- */ + void ComputePropertyAtom::pack_type(int n) { int *type = atom->type; diff --git a/src/compute_property_atom.h b/src/compute_property_atom.h index a1a4faa977..e9e957918b 100644 --- a/src/compute_property_atom.h +++ b/src/compute_property_atom.h @@ -49,6 +49,7 @@ class ComputePropertyAtom : public Compute { void pack_id(int); void pack_molecule(int); + void pack_proc(int); void pack_type(int); void pack_mass(int); diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 860f084058..f1cb9379fa 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -34,7 +34,7 @@ using namespace LAMMPS_NS; // customize by adding keyword // also customize compute_atom_property.cpp -enum{ID,MOL,TYPE,ELEMENT,MASS, +enum{ID,MOL,PROC,TYPE,ELEMENT,MASS, X,Y,Z,XS,YS,ZS,XSTRI,YSTRI,ZSTRI,XU,YU,ZU,XUTRI,YUTRI,ZUTRI, XSU,YSU,ZSU,XSUTRI,YSUTRI,ZSUTRI, IX,IY,IZ, @@ -42,7 +42,7 @@ enum{ID,MOL,TYPE,ELEMENT,MASS, Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER, OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ, TQX,TQY,TQZ, - COMPUTE,FIX,VARIABLE}; + COMPUTE,FIX,VARIABLE,INAME,DNAME}; enum{LT,LE,GT,GE,EQ,NEQ}; enum{INT,DOUBLE,STRING,BIGINT}; // same as in DumpCFG @@ -94,6 +94,10 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : variable = NULL; vbuf = NULL; + ncustom = 0; + id_custom = NULL; + flag_custom = NULL; + // process attributes // ioptional = start of additional optional args // only dump image and dump movie styles process optional args @@ -172,6 +176,10 @@ DumpCustom::~DumpCustom() for (int i = 0; i < nvariable; i++) memory->destroy(vbuf[i]); delete [] vbuf; + for (int i = 0; i < ncustom; i++) delete [] id_custom[i]; + memory->sfree(id_custom); + delete [] flag_custom; + memory->destroy(choose); memory->destroy(dchoose); memory->destroy(clist); @@ -269,6 +277,13 @@ void DumpCustom::init_style() variable[i] = ivariable; } + int icustom; + for (int i = 0; i < ncustom; i++) { + icustom = atom->find_custom(id_custom[i],flag_custom[i]); + if (icustom < 0) + error->all(FLERR,"Could not find custom per-atom property ID"); + } + // set index and check validity of region if (iregion >= 0) { @@ -451,6 +466,10 @@ int DumpCustom::count() for (i = 0; i < nlocal; i++) dchoose[i] = molecule[i]; ptr = dchoose; nstride = 1; + } else if (thresh_array[ithresh] == PROC) { + for (i = 0; i < nlocal; i++) dchoose[i] = me; + ptr = dchoose; + nstride = 1; } else if (thresh_array[ithresh] == TYPE) { int *type = atom->type; for (i = 0; i < nlocal; i++) dchoose[i] = type[i]; @@ -828,6 +847,24 @@ int DumpCustom::count() i = nfield + ithresh; ptr = vbuf[field2index[i]]; nstride = 1; + + } else if (thresh_array[ithresh] == DNAME) { + int iwhich,tmp; + i = nfield + ithresh; + iwhich = atom->find_custom(id_custom[field2index[i]],tmp); + ptr = atom->dvector[iwhich]; + nstride = 1; + + } else if (thresh_array[ithresh] == INAME) { + int iwhich,tmp; + i = nfield + ithresh; + iwhich = atom->find_custom(id_custom[field2index[i]],tmp); + + int *ivector = atom->ivector[iwhich]; + for (i = 0; i < nlocal; i++) + dchoose[i] = ivector[i]; + ptr = dchoose; + nstride = 1; } // unselect atoms that don't meet threshhold criterion @@ -978,6 +1015,9 @@ int DumpCustom::parse_fields(int narg, char **arg) error->all(FLERR,"Dumping an atom property that isn't allocated"); pack_choice[i] = &DumpCustom::pack_molecule; vtype[i] = INT; + } else if (strcmp(arg[iarg],"proc") == 0) { + pack_choice[i] = &DumpCustom::pack_proc; + vtype[i] = INT; } else if (strcmp(arg[iarg],"type") == 0) { pack_choice[i] = &DumpCustom::pack_type; vtype[i] = INT; @@ -1234,6 +1274,50 @@ int DumpCustom::parse_fields(int narg, char **arg) field2index[i] = add_variable(suffix); delete [] suffix; + // custom per-atom floating point value = d_ID + + } else if (strncmp(arg[iarg],"d_",2) == 0) { + pack_choice[i] = &DumpCustom::pack_custom; + vtype[i] = DOUBLE; + + int n = strlen(arg[iarg]); + char *suffix = new char[n]; + strcpy(suffix,&arg[iarg][2]); + argindex[i] = 0; + + int tmp = -1; + 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"); + + field2index[i] = add_custom(suffix,1); + delete [] suffix; + + // custom per-atom integer value = i_ID + + } else if (strncmp(arg[iarg],"i_",2) == 0) { + pack_choice[i] = &DumpCustom::pack_custom; + vtype[i] = INT; + + int n = strlen(arg[iarg]); + char *suffix = new char[n]; + strcpy(suffix,&arg[iarg][2]); + argindex[i] = 0; + + int tmp = -1; + 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"); + + field2index[i] = add_custom(suffix,0); + delete [] suffix; + } else return iarg; } @@ -1319,6 +1403,34 @@ int DumpCustom::add_variable(char *id) return nvariable-1; } +/* ---------------------------------------------------------------------- + add custom atom property to list used by dump + return index of where this property is in list + if already in list, do not add, just return index, else add to list +------------------------------------------------------------------------- */ + +int DumpCustom::add_custom(char *id, int flag) +{ + int icustom; + for (icustom = 0; icustom < ncustom; icustom++) + if ((strcmp(id,id_custom[icustom]) == 0) + && (flag == flag_custom[icustom])) break; + if (icustom < ncustom) return icustom; + + id_custom = (char **) + 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); + flag_custom[ncustom] = flag; + + ncustom++; + return ncustom-1; +} + /* ---------------------------------------------------------------------- */ int DumpCustom::modify_param(int narg, char **arg) @@ -1384,6 +1496,7 @@ int DumpCustom::modify_param(int narg, char **arg) if (strcmp(arg[1],"id") == 0) thresh_array[nthresh] = ID; else if (strcmp(arg[1],"mol") == 0) thresh_array[nthresh] = MOL; + else if (strcmp(arg[1],"proc") == 0) thresh_array[nthresh] = PROC; else if (strcmp(arg[1],"type") == 0) thresh_array[nthresh] = TYPE; else if (strcmp(arg[1],"mass") == 0) thresh_array[nthresh] = MASS; @@ -1558,6 +1671,48 @@ int DumpCustom::modify_param(int narg, char **arg) field2index[nfield+nthresh] = add_variable(suffix); delete [] suffix; + // custom per atom floating point value = d_ID + // must grow field2index and argindex arrays, since access is beyond nfield + + } else if (strncmp(arg[1],"d_",2) == 0) { + thresh_array[nthresh] = DNAME; + memory->grow(field2index,nfield+nthresh+1,"dump:field2index"); + memory->grow(argindex,nfield+nthresh+1,"dump:argindex"); + int n = strlen(arg[1]); + char *suffix = new char[n]; + strcpy(suffix,&arg[1][2]); + argindex[nfield+nthresh] = 0; + + int tmp = -1; + n = atom->find_custom(suffix,tmp); + if ((n < 0) || (tmp != 1)) + error->all(FLERR,"Could not find dump modify " + "custom atom floating point property ID"); + + field2index[nfield+nthresh] = add_custom(suffix,1); + delete [] suffix; + + // custom per atom integer value = i_ID + // must grow field2index and argindex arrays, since access is beyond nfield + + } else if (strncmp(arg[1],"i_",2) == 0) { + thresh_array[nthresh] = INAME; + memory->grow(field2index,nfield+nthresh+1,"dump:field2index"); + memory->grow(argindex,nfield+nthresh+1,"dump:argindex"); + int n = strlen(arg[1]); + char *suffix = new char[n]; + strcpy(suffix,&arg[1][2]); + argindex[nfield+nthresh] = 0; + + int tmp = -1; + n = atom->find_custom(suffix,tmp); + if ((n < 0) || (tmp != 0)) + error->all(FLERR,"Could not find dump modify " + "custom atom integer property ID"); + + field2index[nfield+nthresh] = add_custom(suffix,0); + delete [] suffix; + } else error->all(FLERR,"Invalid dump_modify threshhold operator"); // set operation type of threshhold @@ -1653,6 +1808,34 @@ void DumpCustom::pack_variable(int n) } } +/* ---------------------------------------------------------------------- */ + +void DumpCustom::pack_custom(int n) +{ + + int index = field2index[n]; + + if (flag_custom[index] == 0) { // integer + int iwhich,tmp; + iwhich = atom->find_custom(id_custom[index],tmp); + + int *ivector = atom->ivector[iwhich]; + for (int i = 0; i < nchoose; i++) { + buf[n] = ivector[clist[i]]; + n += size_one; + } + } else if (flag_custom[index] == 1) { // double + int iwhich,tmp; + iwhich = atom->find_custom(id_custom[index],tmp); + + double *dvector = atom->dvector[iwhich]; + for (int i = 0; i < nchoose; i++) { + buf[n] = dvector[clist[i]]; + n += size_one; + } + } +} + /* ---------------------------------------------------------------------- one method for every attribute dump custom can output the atom property is packed into buf starting at n with stride size_one @@ -1683,6 +1866,16 @@ void DumpCustom::pack_molecule(int n) /* ---------------------------------------------------------------------- */ +void DumpCustom::pack_proc(int n) +{ + for (int i = 0; i < nchoose; i++) { + buf[n] = me; + n += size_one; + } +} + +/* ---------------------------------------------------------------------- */ + void DumpCustom::pack_type(int n) { int *type = atom->type; diff --git a/src/dump_custom.h b/src/dump_custom.h index b0153faf25..c483d5b7e1 100644 --- a/src/dump_custom.h +++ b/src/dump_custom.h @@ -69,6 +69,10 @@ class DumpCustom : public Dump { int *variable; // list of indices for the Variables double **vbuf; // local storage for variable evaluation + int ncustom; // # of custom atom properties + char **id_custom; // their names + int *flag_custom; // their data type + int ntypes; // # of atom types char **typenames; // array of element names for each type @@ -86,6 +90,7 @@ class DumpCustom : public Dump { int add_compute(char *); int add_fix(char *); int add_variable(char *); + int add_custom(char *, int); virtual int modify_param(int, char **); typedef void (DumpCustom::*FnPtrHeader)(bigint); @@ -114,9 +119,11 @@ class DumpCustom : public Dump { void pack_compute(int); void pack_fix(int); void pack_variable(int); + void pack_custom(int); void pack_id(int); void pack_molecule(int); + void pack_proc(int); void pack_type(int); void pack_mass(int); diff --git a/src/library.cpp b/src/library.cpp index 2ca41aa960..2018c0ee7d 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -135,6 +135,9 @@ void *lammps_extract_global(void *ptr, char *name) if (strcmp(name,"boxyhi") == 0) return (void *) &lmp->domain->boxhi[1]; if (strcmp(name,"boxzlo") == 0) return (void *) &lmp->domain->boxlo[2]; if (strcmp(name,"boxzhi") == 0) return (void *) &lmp->domain->boxhi[2]; + if (strcmp(name,"xy") == 0) return (void *) &lmp->domain->xy; + if (strcmp(name,"xz") == 0) return (void *) &lmp->domain->xz; + if (strcmp(name,"yz") == 0) return (void *) &lmp->domain->yz; if (strcmp(name,"natoms") == 0) return (void *) &lmp->atom->natoms; if (strcmp(name,"nlocal") == 0) return (void *) &lmp->atom->nlocal; return NULL; diff --git a/src/molecule.cpp b/src/molecule.cpp index c118431f96..af2dfaf60a 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -447,6 +447,8 @@ void Molecule::read(int flag) error->all(FLERR,"Molecule file needs both Special Bond sections"); if (specialflag && !bondflag) error->all(FLERR,"Molecule file has special flags but no bonds"); + if (!specialflag && bondflag) + error->all(FLERR,"Molecule file has bonds but no special flags"); if ((shakeflagflag || shakeatomflag || shaketypeflag) && !shakeflag) error->all(FLERR,"Molecule file shake info is incomplete"); diff --git a/src/update.cpp b/src/update.cpp index aac3e7382f..a2017db066 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -19,6 +19,7 @@ #include "style_integrate.h" #include "style_minimize.h" #include "neighbor.h" +#include "neigh_list.h" #include "force.h" #include "modify.h" #include "fix.h" @@ -395,13 +396,6 @@ void Update::reset_timestep(int narg, char **arg) /* ---------------------------------------------------------------------- reset timestep - set atimestep to new timestep, so future update_time() calls will be correct - trigger reset of timestep for output and for fixes that require it - do not allow any timestep-dependent fixes to be defined - reset eflag/vflag global so nothing will think eng/virial are current - reset invoked flags of computes, - so nothing will think they are current between runs - clear timestep list of computes that store future invocation times called from rerun command and input script (indirectly) ------------------------------------------------------------------------- */ @@ -411,8 +405,14 @@ void Update::reset_timestep(bigint newstep) if (ntimestep < 0) error->all(FLERR,"Timestep must be >= 0"); if (ntimestep > MAXBIGINT) error->all(FLERR,"Too big a timestep"); + // set atimestep to new timestep + // so future update_time() calls will be correct + atimestep = ntimestep; + // trigger reset of timestep for output and for fixes that require it + // do not allow any timestep-dependent fixes to be defined + output->reset_timestep(ntimestep); for (int i = 0; i < modify->nfix; i++) { @@ -422,8 +422,13 @@ void Update::reset_timestep(bigint newstep) modify->fix[i]->reset_timestep(ntimestep); } + // reset eflag/vflag global so no commands will think eng/virial are current + eflag_global = vflag_global = -1; + // reset invoked flags of computes, + // so no commands will think they are current between runs + for (int i = 0; i < modify->ncompute; i++) { modify->compute[i]->invoked_scalar = -1; modify->compute[i]->invoked_vector = -1; @@ -432,9 +437,16 @@ void Update::reset_timestep(bigint newstep) modify->compute[i]->invoked_local = -1; } + // clear timestep list of computes that store future invocation times + for (int i = 0; i < modify->ncompute; i++) if (modify->compute[i]->timeflag) modify->compute[i]->clearstep(); + // set last_build of all neigh lists to -1 to force rebuild + + for (int i = 0; i < neighbor->nlist; i++) + neighbor->lists[i]->last_build = -1; + // NOTE: 7Jun12, adding rerun command, don't think this is required //for (int i = 0; i < domain->nregion; i++) diff --git a/src/version.h b/src/version.h index 7e1adf092b..25d90d9612 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "11 Jul 2014" +#define LAMMPS_VERSION "22 Jul 2014"