change 'groups' to 'fragments'

This commit is contained in:
jrgissing
2020-03-10 21:11:34 -06:00
parent 73186e4d26
commit 43a6c13f01
4 changed files with 44 additions and 43 deletions

View File

@ -4801,7 +4801,7 @@ Doc page with :doc:`WARNING messages <Errors_warnings>`
Atom IDs must be positive integers and within range of defined
atoms.
*Invalid atom ID in Groups section of molecule file*
*Invalid atom ID in Fragments section of molecule file*
Self-explanatory.
*Invalid atom ID in Impropers section of data file*

View File

@ -64,6 +64,7 @@ templates include:
* :doc:`fix rigid/small <fix_rigid>`
* :doc:`fix shake <fix_shake>`
* :doc:`fix gcmc <fix_gcmc>`
* :doc:`fix bond/react <fix_bond_react>`
* :doc:`create_atoms <create_atoms>`
* :doc:`atom_style template <atom_style>`
@ -148,7 +149,7 @@ appear if the value(s) are different than the default.
* Na *angles* = # of angles Na in molecule, default = 0
* Nd *dihedrals* = # of dihedrals Nd in molecule, default = 0
* Ni *impropers* = # of impropers Ni in molecule, default = 0
* Ng *groups* = # of groups in molecule, default = 0
* Nf *fragments* = # of fragments in molecule, default = 0
* Mtotal *mass* = total mass of molecule
* Xc Yc Zc *com* = coordinates of center-of-mass of molecule
* Ixx Iyy Izz Ixy Ixz Iyz *inertia* = 6 components of inertia tensor of molecule
@ -171,7 +172,7 @@ internally.
These are the allowed section keywords for the body of the file.
* *Coords, Types, Molecules, Groups, Charges, Diameters, Masses* = atom-property sections
* *Coords, Types, Molecules, Fragments, Charges, Diameters, Masses* = atom-property sections
* *Bonds, Angles, Dihedrals, Impropers* = molecular topology sections
* *Special Bond Counts, Special Bonds* = special neighbor info
* *Shake Flags, Shake Atoms, Shake Bond Types* = SHAKE info
@ -244,13 +245,13 @@ listed in order from 1 to Nlines, but LAMMPS does not check for this.
----------
*Groups* section:
*Fragments* section:
* one line per group
* one line per fragment
* line syntax: ID a b c d ...
* a,b,c,d,... = IDs of atoms in group
* a,b,c,d,... = IDs of atoms in fragment
The ID of a group can only contain alphanumeric characters and
The ID of a fragment can only contain alphanumeric characters and
underscores. The atom IDs should be values from 1 to Natoms, where
Natoms = # of atoms in the molecule.

View File

@ -46,7 +46,7 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) :
improper_atom3(NULL), improper_atom4(NULL), nspecial(NULL), special(NULL),
shake_flag(NULL), shake_atom(NULL), shake_type(NULL), avec_body(NULL), ibodyparams(NULL),
dbodyparams(NULL), dx(NULL), dxcom(NULL), dxbody(NULL), quat_external(NULL),
fp(NULL), count(NULL), groupmask(NULL)
fp(NULL), count(NULL), fragmentmask(NULL)
{
me = comm->me;
@ -447,8 +447,8 @@ void Molecule::read(int flag)
} else if (strstr(line,"impropers")) {
nmatch = sscanf(line,"%d",&nimpropers);
nwant = 1;
} else if (strstr(line,"groups")) {
nmatch = sscanf(line,"%d",&ngroups);
} else if (strstr(line,"fragments")) {
nmatch = sscanf(line,"%d",&nfragments);
nwant = 1;
} else if (strstr(line,"mass")) {
massflag = 1;
@ -526,10 +526,10 @@ void Molecule::read(int flag)
moleculeflag = 1;
if (flag) molecules(line);
else skip_lines(natoms,line);
} else if (strcmp(keyword,"Groups") == 0) {
groupflag = 1;
if (flag) groups(line);
else skip_lines(ngroups,line);
} else if (strcmp(keyword,"Fragments") == 0) {
fragmentflag = 1;
if (flag) fragments(line);
else skip_lines(nfragments,line);
} else if (strcmp(keyword,"Charges") == 0) {
qflag = 1;
if (flag) charges(line);
@ -729,28 +729,28 @@ void Molecule::molecules(char *line)
}
/* ----------------------------------------------------------------------
read groups from file
read fragments from file
------------------------------------------------------------------------- */
void Molecule::groups(char *line)
void Molecule::fragments(char *line)
{
int n,m,atomID,nwords;
char **words = new char*[natoms+1];
for (int i = 0; i < ngroups; i++) {
for (int i = 0; i < nfragments; i++) {
readline(line);
nwords = parse(line,words,natoms+1);
if (nwords > natoms+1)
error->all(FLERR,"Invalid atom ID in Groups section of molecule file");
error->all(FLERR,"Invalid atom ID in Fragments section of molecule file");
n = strlen(words[0]) + 1;
groupnames[i] = new char[n];
strcpy(groupnames[i],words[0]);
fragmentnames[i] = new char[n];
strcpy(fragmentnames[i],words[0]);
for (m = 1; m < nwords; m++) {
atomID = atoi(words[m]);
if (atomID <= 0 || atomID > natoms)
error->all(FLERR,"Invalid atom ID in Groups section of molecule file");
groupmask[i][atomID-1] = 1;
error->all(FLERR,"Invalid atom ID in Fragments section of molecule file");
fragmentmask[i][atomID-1] = 1;
}
}
@ -1423,13 +1423,13 @@ void Molecule::body(int flag, int pflag, char *line)
}
/* ----------------------------------------------------------------------
return group index if name matches existing group, -1 if no such group
return fragment index if name matches existing fragment, -1 if no such fragment
------------------------------------------------------------------------- */
int Molecule::findgroup(const char *name)
int Molecule::findfragment(const char *name)
{
for (int igroup = 0; igroup < ngroups; igroup++)
if (groupnames[igroup] && strcmp(name,groupnames[igroup]) == 0) return igroup;
for (int i = 0; i < nfragments; i++)
if (fragmentnames[i] && strcmp(name,fragmentnames[i]) == 0) return i;
return -1;
}
@ -1513,7 +1513,7 @@ void Molecule::initialize()
bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0;
maxspecial = 0;
xflag = typeflag = moleculeflag = groupflag = qflag = radiusflag = rmassflag = 0;
xflag = typeflag = moleculeflag = fragmentflag = qflag = radiusflag = rmassflag = 0;
bondflag = angleflag = dihedralflag = improperflag = 0;
nspecialflag = specialflag = 0;
shakeflag = shakeflagflag = shakeatomflag = shaketypeflag = 0;
@ -1569,10 +1569,10 @@ void Molecule::allocate()
if (xflag) memory->create(x,natoms,3,"molecule:x");
if (typeflag) memory->create(type,natoms,"molecule:type");
if (moleculeflag) memory->create(molecule,natoms,"molecule:molecule");
if (groupflag) groupnames = new char*[ngroups];
if (groupflag) memory->create(groupmask,ngroups,natoms,"molecule:groupmask");
for (int i = 0; i < ngroups; i++)
for (int j = 0; j < natoms; j++) groupmask[i][j] = 0;
if (fragmentflag) fragmentnames = new char*[nfragments];
if (fragmentflag) memory->create(fragmentmask,nfragments,natoms,"molecule:fragmentmask");
for (int i = 0; i < nfragments; i++)
for (int j = 0; j < natoms; j++) fragmentmask[i][j] = 0;
if (qflag) memory->create(q,natoms,"molecule:q");
if (radiusflag) memory->create(radius,natoms,"molecule:radius");
if (rmassflag) memory->create(rmass,natoms,"molecule:rmass");
@ -1665,10 +1665,10 @@ void Molecule::deallocate()
memory->destroy(radius);
memory->destroy(rmass);
memory->destroy(groupmask);
if (groupflag) {
for (int i = 0; i < ngroups; i++) delete [] groupnames[i];
delete [] groupnames;
memory->destroy(fragmentmask);
if (fragmentflag) {
for (int i = 0; i < nfragments; i++) delete [] fragmentnames[i];
delete [] fragmentnames;
}
memory->destroy(num_bond);

View File

@ -30,13 +30,13 @@ class Molecule : protected Pointers {
int natoms;
int nbonds,nangles,ndihedrals,nimpropers;
int ntypes,nmolecules,ngroups;
int ntypes,nmolecules,nfragments;
int nbondtypes,nangletypes,ndihedraltypes,nimpropertypes;
int nibody,ndbody;
// group info
char **groupnames;
int **groupmask; // ngroups by natoms
// fragment info
char **fragmentnames;
int **fragmentmask; // nfragments by natoms
// max bond,angle,etc per atom
@ -45,7 +45,7 @@ class Molecule : protected Pointers {
// 1 if attribute defined in file, 0 if not
int xflag,typeflag,moleculeflag,groupflag,qflag,radiusflag,rmassflag;
int xflag,typeflag,moleculeflag,fragmentflag,qflag,radiusflag,rmassflag;
int bondflag,angleflag,dihedralflag,improperflag;
int nspecialflag,specialflag;
int shakeflag,shakeflagflag,shakeatomflag,shaketypeflag;
@ -123,7 +123,7 @@ class Molecule : protected Pointers {
void compute_mass();
void compute_com();
void compute_inertia();
int findgroup(const char *);
int findfragment(const char *);
void check_attributes(int);
private:
@ -138,7 +138,7 @@ class Molecule : protected Pointers {
void coords(char *);
void types(char *);
void molecules(char *);
void groups(char *);
void fragments(char *);
void charges(char *);
void diameters(char *);
void masses(char *);
@ -379,7 +379,7 @@ E: Invalid Molecules section in molecule file
Self-explanatory.
E: Invalid atom ID in Groups section of molecule file
E: Invalid atom ID in Fragments section of molecule file
Self-explanatory.