Date: Tue, 27 May 2014 17:04:19 +0000
Subject: [PATCH 4/8] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@12031
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
doc/fix_rigid.html | 18 ++++++++++++++----
doc/fix_rigid.txt | 18 ++++++++++++++----
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/doc/fix_rigid.html b/doc/fix_rigid.html
index a71ffde390..88ff880c02 100644
--- a/doc/fix_rigid.html
+++ b/doc/fix_rigid.html
@@ -103,12 +103,12 @@ fix 1 particles rigid/npt/small molecule temp 1.0 1.0 1.0 iso 0.5 0.5 1.0
Treat one or more sets of atoms as independent rigid bodies. This
means that each timestep the total force and torque on each rigid body
is computed as the sum of the forces and torques on its constituent
-particles and the coordinates, velocities, and orientations of the
-atoms in each body are updated so that the body moves and rotates as a
+particles. The coordinates, velocities, and orientations of the atoms
+in each body are then updated so that the body moves and rotates as a
single entity.
-Examples of large rigid bodies are a large colloidal particle, or
-portions of a large biomolecule such as a protein.
+
Examples of large rigid bodies are a colloidal particle, or portions
+of a biomolecule such as a protein.
Example of small rigid bodies are patchy nanoparticles, such as those
modeled in this paper by Sharon Glotzer's group, clumps of
@@ -183,6 +183,16 @@ command), setting the force on them to 0.0 (via the fix nve command).
+IMPORTANT NOTE: The aggregate properties of each rigid body are
+calculated at the start of each simulation run. These include its
+center of mass, moments of inertia, and net velocity and angular
+momentum. This means that before or between runs, per-atom properties
+can be changed, e.g. via the set or
+velocity command, which will affect the bodies. An
+exception is if the infile keyword is used, then all the body
+properties (except net velocity and angular momentum) are only
+calculated once so that values from the file are valid.
+
Each rigid body must have two or more atoms. An atom can belong to at
diff --git a/doc/fix_rigid.txt b/doc/fix_rigid.txt
index 62bd5e2ee3..66a6c7bd67 100644
--- a/doc/fix_rigid.txt
+++ b/doc/fix_rigid.txt
@@ -85,12 +85,12 @@ fix 1 particles rigid/npt/small molecule temp 1.0 1.0 1.0 iso 0.5 0.5 1.0 :pre
Treat one or more sets of atoms as independent rigid bodies. This
means that each timestep the total force and torque on each rigid body
is computed as the sum of the forces and torques on its constituent
-particles and the coordinates, velocities, and orientations of the
-atoms in each body are updated so that the body moves and rotates as a
+particles. The coordinates, velocities, and orientations of the atoms
+in each body are then updated so that the body moves and rotates as a
single entity.
-Examples of large rigid bodies are a large colloidal particle, or
-portions of a large biomolecule such as a protein.
+Examples of large rigid bodies are a colloidal particle, or portions
+of a biomolecule such as a protein.
Example of small rigid bodies are patchy nanoparticles, such as those
modeled in "this paper"_#Zhang by Sharon Glotzer's group, clumps of
@@ -165,6 +165,16 @@ command), setting the force on them to 0.0 (via the "fix
setforce"_fix_setforce.html command), and integrating them as usual
(e.g. via the "fix nve"_fix_nve.html command).
+IMPORTANT NOTE: The aggregate properties of each rigid body are
+calculated at the start of each simulation run. These include its
+center of mass, moments of inertia, and net velocity and angular
+momentum. This means that before or between runs, per-atom properties
+can be changed, e.g. via the "set"_set.html or
+"velocity"_velocity.html command, which will affect the bodies. An
+exception is if the {infile} keyword is used, then all the body
+properties (except net velocity and angular momentum) are only
+calculated once so that values from the file are valid.
+
:line
Each rigid body must have two or more atoms. An atom can belong to at
From 53ae7f08c3224f8418fdec747eba313c9cc47bae Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 27 May 2014 17:04:25 +0000
Subject: [PATCH 5/8] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@12032
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/RIGID/fix_rigid.cpp | 65 +++++++++++++++++++++--------------
src/RIGID/fix_rigid.h | 2 +-
src/RIGID/fix_rigid_small.cpp | 46 ++++++++++++++-----------
src/RIGID/fix_rigid_small.h | 2 +-
4 files changed, 67 insertions(+), 48 deletions(-)
diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp
index 8f965ffc2d..75080ec833 100644
--- a/src/RIGID/fix_rigid.cpp
+++ b/src/RIGID/fix_rigid.cpp
@@ -523,6 +523,13 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
MINUSPI = -MY_PI;
TWOPI = 2.0*MY_PI;
+ // if infile set, only setup rigid bodies once, using info from file
+ // this means users cannot change atom properties like mass between runs
+ // if they do, bodies will not reflect the changes
+
+ staticflag = 0;
+ if (infile) setup_bodies_static();
+
// print statistics
int nsum = 0;
@@ -532,10 +539,6 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
if (screen) fprintf(screen,"%d rigid bodies with %d atoms\n",nbody,nsum);
if (logfile) fprintf(logfile,"%d rigid bodies with %d atoms\n",nbody,nsum);
}
-
- // firstflag = 1 triggers one-time initialization of rigid body attributes
-
- firstflag = 1;
}
/* ---------------------------------------------------------------------- */
@@ -640,15 +643,11 @@ void FixRigid::init()
if (strstr(update->integrate_style,"respa"))
step_respa = ((Respa *) update->integrate)->step;
- // one-time initialization of rigid body attributes
- // setup_bodies_static = extended flags, masstotal, COM, inertia tensor
- // setup_bodies_dynamic = vcm and angmom
+ // setup rigid bodies, using current atom info
+ // allows resetting of atom properties like mass between runs
+ // only do this if not using an infile, else was called in constructor
- if (firstflag) {
- firstflag = 0;
- setup_bodies_static();
- setup_bodies_dynamic();
- }
+ if (!infile) setup_bodies_static();
// temperature scale factor
@@ -670,6 +669,12 @@ void FixRigid::setup(int vflag)
{
int i,n,ibody;
+ // setup_bodies_dynamic sets vcm and angmom
+ // so angmom_to_omega() and set_v() below will set per-atom vels correctly
+ // re-calling it every run allows reset of body/atom velocities between runs
+
+ setup_bodies_dynamic();
+
// fcm = force on center-of-mass of each rigid body
double **f = atom->f;
@@ -1113,10 +1118,10 @@ int FixRigid::dof(int tgroup)
{
// cannot count DOF correctly unless setup_bodies_static() has been called
- if (firstflag) {
+ if (!staticflag) {
if (comm->me == 0)
error->warning(FLERR,"Cannot count rigid body degrees-of-freedom "
- "before bodies are fully initialized");
+ "before bodies are initialized");
return 0;
}
@@ -1522,10 +1527,12 @@ void FixRigid::set_v()
}
/* ----------------------------------------------------------------------
- one-time initialization of static rigid body attributes
- extended flags, masstotal, center-of-mass
- Cartesian and diagonalized inertia tensor
- read per-body attributes from infile if specified
+ initialization of static rigid body attributes
+ called from init() so body/atom properties can be changed between runs
+ unless reading from infile, in which case called once from constructor
+ sets extended flags, masstotal, center-of-mass
+ sets Cartesian and diagonalized inertia tensor
+ sets body image flags, but only on first call
------------------------------------------------------------------------- */
void FixRigid::setup_bodies_static()
@@ -1682,10 +1689,13 @@ void FixRigid::setup_bodies_static()
// set image flags for each rigid body to default values
// then remap the xcm of each body back into simulation box if needed
+ // staticflag check insures this in only done once, not on successive runs
- for (ibody = 0; ibody < nbody; ibody++)
- imagebody[ibody] = ((imageint) IMGMAX << IMG2BITS) |
- ((imageint) IMGMAX << IMGBITS) | IMGMAX;
+ if (!staticflag) {
+ for (ibody = 0; ibody < nbody; ibody++)
+ imagebody[ibody] = ((imageint) IMGMAX << IMG2BITS) |
+ ((imageint) IMGMAX << IMGBITS) | IMGMAX;
+ }
pre_neighbor();
@@ -2018,13 +2028,18 @@ void FixRigid::setup_bodies_static()
}
if (infile) memory->destroy(inbody);
+
+ // static properties have now been initialized once
+ // used to prevent re-initialization which would re-read infile
+
+ staticflag = 1;
}
/* ----------------------------------------------------------------------
- one-time initialization of dynamic rigid body attributes
- Vcm and angmom, computed explicitly from constituent particles
- even if wrong for overlapping particles, is OK,
- since is just setting initial time=0 Vcm and angmom of the body
+ initialization of dynamic rigid body attributes
+ set vcm and angmom, computed explicitly from constituent particles
+ OK if wrong for overlapping particles,
+ since is just setting vcm/angmom at start of run,
which can be estimated value
------------------------------------------------------------------------- */
diff --git a/src/RIGID/fix_rigid.h b/src/RIGID/fix_rigid.h
index 62adce6e03..e984825049 100644
--- a/src/RIGID/fix_rigid.h
+++ b/src/RIGID/fix_rigid.h
@@ -67,7 +67,7 @@ class FixRigid : public Fix {
char *infile; // file to read rigid body attributes from
int rstyle; // SINGLE,MOLECULE,GROUP
- int firstflag; // 1 for first-time setup of rigid bodies
+ int staticflag; // 1 if static body properties are setup, else 0
int dimension; // # of dimensions
int nbody; // # of rigid bodies
diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp
index 0033a62475..18e4a51715 100644
--- a/src/RIGID/fix_rigid_small.cpp
+++ b/src/RIGID/fix_rigid_small.cpp
@@ -421,9 +421,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
mass_body = NULL;
nmax_mass = 0;
- // firstflag = 1 triggers one-time initialization of rigid body attributes
-
- firstflag = 1;
+ staticflag = 1;
}
/* ---------------------------------------------------------------------- */
@@ -505,19 +503,16 @@ void FixRigidSmall::init()
}
/* ----------------------------------------------------------------------
- one-time initialization of rigid body attributes via local comm
- extended flags, mass, COM, inertia tensor, displacement of each atom
- performed after init() b/c requires communication stencil
- has been setup by comm->borders()
+ setup static/dynamic properties of rigid bodies, using current atom info
+ allows resetting of atom properties like mass between runs
+ only do static initialization once if using an infile
+ cannot do this until now, b/c requires comm->setup() to have setup stencil
------------------------------------------------------------------------- */
void FixRigidSmall::setup_pre_neighbor()
{
- if (firstflag) {
- firstflag = 0;
- setup_bodies_static();
- setup_bodies_dynamic();
- } else pre_neighbor();
+ if (!staticflag || !infile) setup_bodies_static();
+ setup_bodies_dynamic();
}
/* ----------------------------------------------------------------------
@@ -972,7 +967,7 @@ int FixRigidSmall::dof(int tgroup)
// cannot count DOF correctly unless setup_bodies_static() has been called
- if (firstflag) {
+ if (!staticflag) {
if (comm->me == 0)
error->warning(FLERR,"Cannot count rigid body degrees-of-freedom "
"before bodies are fully initialized");
@@ -1672,10 +1667,12 @@ void FixRigidSmall::ring_farthest(int n, char *cbuf)
}
/* ----------------------------------------------------------------------
- one-time initialization of rigid body attributes
- extended flags, mass, center-of-mass
- Cartesian and diagonalized inertia tensor
- read per-body attributes from infile if specified
+ initialization of rigid body attributes
+ called at setup, so body/atom properties can be changed between runs
+ unless reading from infile, in which case only called once
+ sets extended flags, masstotal, center-of-mass
+ sets Cartesian and diagonalized inertia tensor
+ sets body image flags, but only on first call
------------------------------------------------------------------------- */
void FixRigidSmall::setup_bodies_static()
@@ -1838,10 +1835,12 @@ void FixRigidSmall::setup_bodies_static()
// set image flags for each rigid body to default values
// then remap the xcm of each body back into simulation box if needed
+ // staticflag check insures this in only done once, not on successive runs
- for (ibody = 0; ibody < nlocal_body; ibody++)
- body[ibody].image = ((imageint) IMGMAX << IMG2BITS) |
- ((imageint) IMGMAX << IMGBITS) | IMGMAX;
+ if (!staticflag)
+ for (ibody = 0; ibody < nlocal_body; ibody++)
+ body[ibody].image = ((imageint) IMGMAX << IMG2BITS) |
+ ((imageint) IMGMAX << IMGBITS) | IMGMAX;
pre_neighbor();
@@ -2175,6 +2174,11 @@ void FixRigidSmall::setup_bodies_static()
memory->destroy(itensor);
if (infile) memory->destroy(inbody);
+
+ // static properties have now been initialized once
+ // used to prevent re-initialization which would re-read infile
+
+ staticflag = 1;
}
/* ----------------------------------------------------------------------
@@ -2418,7 +2422,7 @@ void FixRigidSmall::write_restart_file(char *file)
// do not write file if bodies have not yet been intialized
- if (firstflag) return;
+ if (!staticflag) return;
// proc 0 opens file and writes header
diff --git a/src/RIGID/fix_rigid_small.h b/src/RIGID/fix_rigid_small.h
index 3cdc2fb9f1..2346c78937 100644
--- a/src/RIGID/fix_rigid_small.h
+++ b/src/RIGID/fix_rigid_small.h
@@ -78,7 +78,7 @@ class FixRigidSmall : public Fix {
double MINUSPI,TWOPI;
char *infile; // file to read rigid body attributes from
- int firstflag; // 1 for first-time setup of rigid bodies
+ int staticflag; // 1 if static body properties are setup, else 0
int commflag; // various modes of forward/reverse comm
int nbody; // total # of rigid bodies
tagint maxmol; // max mol-ID
From 3cf8560b941084e07b63618ea896100736d3c061 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 27 May 2014 19:21:49 +0000
Subject: [PATCH 6/8] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@12033
f3b2605a-c512-4ea7-a41b-209d697bcdaa
---
src/RIGID/fix_rigid_small.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp
index 18e4a51715..93c4144140 100644
--- a/src/RIGID/fix_rigid_small.cpp
+++ b/src/RIGID/fix_rigid_small.cpp
@@ -1738,7 +1738,6 @@ void FixRigidSmall::setup_bodies_static()
if (atom->line_flag) orientflag = 1;
if (atom->tri_flag) orientflag = 4;
if (atom->mu_flag) dorientflag = 1;
- grow_arrays(atom->nmax);
for (i = 0; i < nlocal; i++) {
eflags[i] = 0;
From 3b6deb5005bb4f732ecb1c85d31d1766e1244be4 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 27 May 2014 19:22:06 +0000
Subject: [PATCH 7/8] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@12034
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 f0f6c2230e..535898f618 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1 +1 @@
-#define LAMMPS_VERSION "23 May 2014"
+#define LAMMPS_VERSION "27 May 2014"
From 21141894f74935d765004c2499676166aff11317 Mon Sep 17 00:00:00 2001
From: sjplimp
Date: Tue, 27 May 2014 19:22:07 +0000
Subject: [PATCH 8/8] git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@12035
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 c0342b048a..f19aa6ab31 100644
--- a/doc/Manual.html
+++ b/doc/Manual.html
@@ -1,7 +1,7 @@
LAMMPS Users Manual
-
+
@@ -22,7 +22,7 @@
LAMMPS Documentation
-23 May 2014 version
+27 May 2014 version
Version info:
diff --git a/doc/Manual.txt b/doc/Manual.txt
index 94f85fe2af..36263db5ed 100644
--- a/doc/Manual.txt
+++ b/doc/Manual.txt
@@ -1,6 +1,6 @@
LAMMPS Users Manual
-
+
@@ -18,7 +18,7 @@
LAMMPS Documentation :c,h3
-23 May 2014 version :c,h4
+27 May 2014 version :c,h4
Version info: :h4