From 4c3539e9ff225e345c2f7beb227eb9d25cb40af6 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 14:38:28 +0000 Subject: [PATCH 01/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12186 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/molecule.html | 8 +++++++- doc/molecule.txt | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) 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 From 1a2996c6a6881f6cd2865e77cf3b9a816192654a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 16:01:00 +0000 Subject: [PATCH 02/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12187 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/update.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) 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++) From 6bb86c2d52be3312577de1952995f18e0b87d623 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 16:01:12 +0000 Subject: [PATCH 03/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12188 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/molecule.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/molecule.cpp b/src/molecule.cpp index 83842af69c..a7fa72af83 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"); From 6640abfc6c4e425fddfc5db8806f94f0e9ece3cf Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 17:53:45 +0000 Subject: [PATCH 04/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12189 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 209d18aea3126664625f62529ce9bc293d83375f Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 17:53:46 +0000 Subject: [PATCH 05/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12190 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/Manual.html | 4 ++-- doc/Manual.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/Manual.html b/doc/Manual.html index 41c9884fe9..cbb0a34c7b 100644 --- a/doc/Manual.html +++ b/doc/Manual.html @@ -1,7 +1,7 @@ LAMMPS Users Manual - + @@ -22,7 +22,7 @@

LAMMPS Documentation

-

11 Jul 2014 version +

22 Jul 2014 version

Version info:

diff --git a/doc/Manual.txt b/doc/Manual.txt index 6e5c3a3c00..a05b429b9a 100644 --- a/doc/Manual.txt +++ b/doc/Manual.txt @@ -1,6 +1,6 @@ LAMMPS Users Manual - + @@ -18,7 +18,7 @@

LAMMPS Documentation :c,h3 -11 Jul 2014 version :c,h4 +22 Jul 2014 version :c,h4 Version info: :h4 From 20ddf0396d3b86f80e5df54c6f5b38f585dbc66a Mon Sep 17 00:00:00 2001 From: pscrozi Date: Tue, 22 Jul 2014 18:28:46 +0000 Subject: [PATCH 06/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12192 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/library.cpp | 3 +++ 1 file changed, 3 insertions(+) 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; From e9a0ca6dca757317051bb7b6be2638a0290b26a4 Mon Sep 17 00:00:00 2001 From: pscrozi Date: Tue, 22 Jul 2014 18:31:33 +0000 Subject: [PATCH 07/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12193 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- examples/COUPLE/lammps_quest/lmpqst.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 From 887151262e3a6c81e441d6f19f3ab005384e983b Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 22:52:19 +0000 Subject: [PATCH 08/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12194 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/compute_property_atom.html | 7 ++++--- doc/compute_property_atom.txt | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/compute_property_atom.html b/doc/compute_property_atom.html index 62a7e04da9..d22e65c54a 100644 --- a/doc/compute_property_atom.html +++ b/doc/compute_property_atom.html @@ -21,7 +21,7 @@
  • input = one or more atom attributes -
      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 From 76f04f768348f7e50ce204d4dee1adfe57d677f2 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 22:52:28 +0000 Subject: [PATCH 09/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12195 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/dump.html | 20 +++++++++++--------- doc/dump.txt | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) 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 738bbc7bf0..cfd0884c9c 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 @@ -445,17 +446,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 From 6760d0dd572dd04c48ef5c5d3cf4dbd081aa87b5 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 22:52:38 +0000 Subject: [PATCH 10/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12196 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/dump_custom.cpp | 20 +++++++++++++++++++- src/dump_custom.h | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 860f084058..a65485883b 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, @@ -451,6 +451,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]; @@ -978,6 +982,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; @@ -1384,6 +1391,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; @@ -1683,6 +1691,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 3d32a3fce6..794349515a 100644 --- a/src/dump_custom.h +++ b/src/dump_custom.h @@ -117,6 +117,7 @@ class DumpCustom : public Dump { void pack_id(int); void pack_molecule(int); + void pack_proc(int); void pack_type(int); void pack_mass(int); From f01d9363e7c6b0fc63b16e5299c54e338ccff2c2 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Tue, 22 Jul 2014 22:52:44 +0000 Subject: [PATCH 11/16] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12197 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/compute_property_atom.cpp | 18 ++++++++++++++++++ src/compute_property_atom.h | 1 + 2 files changed, 19 insertions(+) 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 8b4e958573..9315813f8e 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); From eb42e19e53ab2392758fe747211d7cd83f2fbb47 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 24 Jul 2014 13:11:59 -0400 Subject: [PATCH 12/16] document support for fix property/atom in fix store/state --- doc/fix_store_state.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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:] From 3082fd0bbbcda25e1dc636df6cd40f39e00b0ad6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 24 Jul 2014 17:23:50 -0400 Subject: [PATCH 13/16] add support for custom properties to dump custom --- doc/dump.txt | 8 ++- src/dump_custom.cpp | 159 +++++++++++++++++++++++++++++++++++++++++++- src/dump_custom.h | 6 ++ 3 files changed, 171 insertions(+), 2 deletions(-) diff --git a/doc/dump.txt b/doc/dump.txt index 0497358018..3f83f217ca 100644 --- a/doc/dump.txt +++ b/doc/dump.txt @@ -77,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:] @@ -549,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/src/dump_custom.cpp b/src/dump_custom.cpp index a65485883b..3f60b89de2 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -42,7 +42,7 @@ enum{ID,MOL,PROC,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) { @@ -1241,6 +1256,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; } @@ -1326,6 +1385,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) @@ -1566,6 +1653,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 @@ -1661,6 +1790,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 diff --git a/src/dump_custom.h b/src/dump_custom.h index b7dc788356..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,6 +119,7 @@ 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); From 1a1857320fff6ae10ce1ecc0b88690bbdc997b9b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 24 Jul 2014 18:00:21 -0400 Subject: [PATCH 14/16] handle custom atom properties in dump_modify properly --- src/dump_custom.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 3f60b89de2..35f6b1914c 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -847,6 +847,13 @@ 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; } // unselect atoms that don't meet threshhold criterion @@ -1678,22 +1685,8 @@ int DumpCustom::modify_param(int narg, char **arg) // 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; + error->all(FLERR,"Using custom per-atom integer vectors " + "for dump_modify is not supported"); } else error->all(FLERR,"Invalid dump_modify threshhold operator"); From e0808bef81e28932d432bca62a3bc6bc2a26dff9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 24 Jul 2014 18:20:58 -0400 Subject: [PATCH 15/16] enabled using integer custom per atom data for dump_modify threshold --- src/dump_custom.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 35f6b1914c..f1cb9379fa 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -854,6 +854,17 @@ int DumpCustom::count() 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 @@ -1685,8 +1696,22 @@ int DumpCustom::modify_param(int narg, char **arg) // must grow field2index and argindex arrays, since access is beyond nfield } else if (strncmp(arg[1],"i_",2) == 0) { - error->all(FLERR,"Using custom per-atom integer vectors " - "for dump_modify is not supported"); + 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"); From 0ba44e7c26e7e38519a7e268956bfee85af8c891 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 25 Jul 2014 07:07:56 -0400 Subject: [PATCH 16/16] enforce using a tip4p compatible kspace style with tip4p pair style. --- src/KSPACE/pppm.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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