fix spring doc page update

This commit is contained in:
Steve Plimpton 2017-01-17 09:02:56 -07:00
parent c31f1e9f22
commit 5cd856c97f
16 changed files with 233 additions and 183 deletions

View File

@ -89,11 +89,7 @@ NOTE: The center of mass of a group of atoms is calculated in
group can straddle a periodic boundary. See the "dump"_dump.html doc
page for a discussion of unwrapped coordinates. It also means that a
spring connecting two groups or a group and the tether point can cross
a periodic boundary and its length be calculated correctly. One
exception is for rigid bodies, which should not be used with the fix
spring command, if the rigid body will cross a periodic boundary.
This is because image flags for rigid bodies are used in a different
way, as explained on the "fix rigid"_fix_rigid.html doc page.
a periodic boundary and its length be calculated correctly.
[Restart, fix_modify, output, run start/stop, minimize info:]

View File

@ -51,7 +51,7 @@ void AtomVecAtomic::grow(int n)
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0)
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");
tag = memory->grow(atom->tag,nmax,"atom:tag");

View File

@ -118,7 +118,7 @@ void AtomVecBody::grow(int n)
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0)
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");
tag = memory->grow(atom->tag,nmax,"atom:tag");

View File

@ -53,7 +53,7 @@ void AtomVecCharge::grow(int n)
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0)
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");
tag = memory->grow(atom->tag,nmax,"atom:tag");

View File

@ -72,7 +72,7 @@ void AtomVecEllipsoid::grow(int n)
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0)
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");
tag = memory->grow(atom->tag,nmax,"atom:tag");

View File

@ -144,7 +144,7 @@ void AtomVecHybrid::grow(int n)
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0)
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");
// sub-styles perform all reallocation

View File

@ -83,7 +83,7 @@ void AtomVecLine::grow(int n)
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0)
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");
tag = memory->grow(atom->tag,nmax,"atom:tag");

View File

@ -84,7 +84,7 @@ void AtomVecSphere::grow(int n)
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0)
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");
tag = memory->grow(atom->tag,nmax,"atom:tag");

View File

@ -88,7 +88,7 @@ void AtomVecTri::grow(int n)
if (n == 0) grow_nmax();
else nmax = n;
atom->nmax = nmax;
if (nmax < 0)
if (nmax < 0 || nmax > MAXSMALLINT)
error->one(FLERR,"Per-processor system is too big");
tag = memory->grow(atom->tag,nmax,"atom:tag");

View File

@ -51,10 +51,14 @@ enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; // several files
/* ---------------------------------------------------------------------- */
CommBrick::CommBrick(LAMMPS *lmp) : Comm(lmp),
sendnum(NULL), recvnum(NULL), sendproc(NULL), recvproc(NULL), size_forward_recv(NULL),
size_reverse_send(NULL), size_reverse_recv(NULL), slablo(NULL), slabhi(NULL), multilo(NULL), multihi(NULL),
cutghostmulti(NULL), pbc_flag(NULL), pbc(NULL), firstrecv(NULL), sendlist(NULL), maxsendlist(NULL), buf_send(NULL), buf_recv(NULL)
CommBrick::CommBrick(LAMMPS *lmp) :
Comm(lmp),
sendnum(NULL), recvnum(NULL), sendproc(NULL), recvproc(NULL),
size_forward_recv(NULL),
size_reverse_send(NULL), size_reverse_recv(NULL),
slablo(NULL), slabhi(NULL), multilo(NULL), multihi(NULL),
cutghostmulti(NULL), pbc_flag(NULL), pbc(NULL), firstrecv(NULL),
sendlist(NULL), maxsendlist(NULL), buf_send(NULL), buf_recv(NULL)
{
style = 0;
layout = LAYOUT_UNIFORM;

View File

@ -1102,6 +1102,40 @@ int Domain::closest_image(int i, int j)
return closest;
}
/* ----------------------------------------------------------------------
return local index of atom J or any of its images that is closest to pos
if J is not a valid index like -1, just return it
------------------------------------------------------------------------- */
int Domain::closest_image(double *pos, int j)
{
if (j < 0) return j;
int *sametag = atom->sametag;
double **x = atom->x;
int closest = j;
double delx = pos[0] - x[j][0];
double dely = pos[1] - x[j][1];
double delz = pos[2] - x[j][2];
double rsqmin = delx*delx + dely*dely + delz*delz;
double rsq;
while (sametag[j] >= 0) {
j = sametag[j];
delx = pos[0] - x[j][0];
dely = pos[1] - x[j][1];
delz = pos[2] - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq < rsqmin) {
rsqmin = rsq;
closest = j;
}
}
return closest;
}
/* ----------------------------------------------------------------------
find and return Xj image = periodic image of Xj that is closest to Xi
for triclinic, add/subtract tilt factors in other dims as needed

View File

@ -113,6 +113,7 @@ class Domain : protected Pointers {
void minimum_image(double &, double &, double &);
void minimum_image(double *);
int closest_image(int, int);
int closest_image(double *, int);
void closest_image(const double * const, const double * const,
double * const);
void remap(double *, imageint &);

View File

@ -40,6 +40,7 @@ namespace MathExtra {
inline void sub3(const double *v1, const double *v2, double *ans);
inline double len3(const double *v);
inline double lensq3(const double *v);
inline double distsq3(const double *v1, const double *v2);
inline double dot3(const double *v1, const double *v2);
inline void cross3(const double *v1, const double *v2, double *ans);
@ -265,6 +266,18 @@ inline double MathExtra::lensq3(const double *v)
return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
}
/* ----------------------------------------------------------------------
ans = distance squared between pts v1 and v2
------------------------------------------------------------------------- */
inline double MathExtra::distsq3(const double *v1, const double *v2)
{
double dx = v1[0] - v2[0];
double dy = v1[1] - v2[1];
double dz = v1[2] - v2[2];
return dx*dx + dy*dy + dz*dz;
}
/* ----------------------------------------------------------------------
dot product of 2 vectors
------------------------------------------------------------------------- */

View File

@ -28,8 +28,10 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
Region::Region(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp),
id(NULL), style(NULL), contact(NULL), list(NULL), xstr(NULL), ystr(NULL), zstr(NULL), tstr(NULL)
Region::Region(LAMMPS *lmp, int narg, char **arg) :
Pointers(lmp),
id(NULL), style(NULL), contact(NULL), list(NULL),
xstr(NULL), ystr(NULL), zstr(NULL), tstr(NULL)
{
int n = strlen(arg[0]) + 1;
id = new char[n];