Merge pull request #554 from jewettaij/master

Have extra/XXX/per/atom set by keyword to the read_data command
This commit is contained in:
sjplimp 2017-06-30 11:47:46 -06:00 committed by GitHub
commit b79044d4f6
4 changed files with 114 additions and 51 deletions

View File

@ -4696,9 +4696,9 @@ Self-explanatory. :dd
{Fix bond/create induced too many angles/dihedrals/impropers per atom} :dt
See the read_data command for info on setting the "extra angle per
atom", etc header values to allow for additional angles, etc to be
formed. :dd
See the read_data command for info on using the "extra/angle/per/atom",
(or dihedral, improper) keywords to allow for additional
angles, dihedrals, and impropers to be formed. :dd
{Fix bond/create needs ghost atoms from further away} :dt
@ -7876,18 +7876,20 @@ See the setting for tagint in the src/lmptype.h file. :dd
{New bond exceeded bonds per atom in create_bonds} :dt
See the read_data command for info on setting the "extra bond per
atom" header value to allow for additional bonds to be formed. :dd
See the read_data command for info on using the "extra/bond/per/atom"
keyword to allow for additional bonds to be formed
{New bond exceeded bonds per atom in fix bond/create} :dt
See the read_data command for info on setting the "extra bond per
atom" header value to allow for additional bonds to be formed. :dd
See the read_data command for info on using the "extra/bond/per/atom"
keyword to allow for additional bonds to be formed :dd
{New bond exceeded special list size in fix bond/create} :dt
See the special_bonds extra command for info on how to leave space in
the special bonds list to allow for additional bonds to be formed. :dd
See the "special_bonds extra" command
(or the "read_data extra/special/per/atom" command)
for info on how to leave space in the special bonds
list to allow for additional bonds to be formed. :dd
{Newton bond change after simulation box is defined} :dt
@ -9664,9 +9666,10 @@ you are running. :dd
{Special list size exceeded in fix bond/create} :dt
See the read_data command for info on setting the "extra special per
atom" header value to allow for additional special values to be
stored. :dd
See the special_bonds extra command
(or the read_data extra/special/per/atom command)
for info on how to leave space in the special bonds
list to allow for additional bonds to be formed. :dd
{Specified processors != physical processors} :dt
@ -9683,23 +9686,23 @@ Self-explanatory. :dd
{Subsequent read data induced too many angles per atom} :dt
See the create_box extra/angle/per/atom or read_data "extra angle per
atom" header value to set this limit larger. :dd
See the extra/angle/per/atom keyword for the create_box
or the read_data command to set this limit larger :dd
{Subsequent read data induced too many bonds per atom} :dt
See the create_box extra/bond/per/atom or read_data "extra bond per
atom" header value to set this limit larger. :dd
See the extra/bond/per/atom keyword for the create_box
or the read_data command to set this limit larger :dd
{Subsequent read data induced too many dihedrals per atom} :dt
See the create_box extra/dihedral/per/atom or read_data "extra
dihedral per atom" header value to set this limit larger. :dd
See the extra/dihedral/per/atom keyword for the create_box
or the read_data command to set this limit larger :dd
{Subsequent read data induced too many impropers per atom} :dt
See the create_box extra/improper/per/atom or read_data "extra
improper per atom" header value to set this limit larger. :dd
See the extra/improper/per/atom keyword for the create_box
or the read_data command to set this limit larger :dd
{Substitution for illegal variable} :dt

View File

@ -32,6 +32,11 @@ keyword = {add} or {offset} or {shift} or {extra/atom/types} or {extra/bond/type
{extra/angle/types} arg = # of extra angle types
{extra/dihedral/types} arg = # of extra dihedral types
{extra/improper/types} arg = # of extra improper types
{extra/bond/per/atom} arg = leave space for this many new bonds per atom
{extra/angle/per/atom} arg = leave space for this many new angles per atom
{extra/dihedral/per/atom} arg = leave space for this many new dihedrals per atom
{extra/improper/per/atom} arg = leave space for this many new impropers per atom
{extra/special/per/atom} arg = leave space for extra 1-2,1-3,1-4 interactions per atom
{group} args = groupID
groupID = add atoms in data file to this group
{nocoeff} = ignore force field parameters
@ -264,11 +269,11 @@ is different than the default.
{angle types} = # of angle types in system
{dihedral types} = # of dihedral types in system
{improper types} = # of improper types in system
{extra bond per atom} = leave space for this many new bonds per atom
{extra angle per atom} = leave space for this many new angles per atom
{extra dihedral per atom} = leave space for this many new dihedrals per atom
{extra improper per atom} = leave space for this many new impropers per atom
{extra special per atom} = leave space for this many new special bonds per atom
{extra bond per atom} = leave space for this many new bonds per atom (deprecated, use extra/bond/per/atom keyword)
{extra angle per atom} = leave space for this many new angles per atom (deprecated, use extra/angle/per/atom keyword)
{extra dihedral per atom} = leave space for this many new dihedrals per atom (deprecated, use extra/dihedral/per/atom keyword)
{extra improper per atom} = leave space for this many new impropers per atom (deprecated, use extra/improper/per/atom keyword)
{extra special per atom} = leave space for this many new special bonds per atom (deprecated, use extra/special/per/atom keyword)
{ellipsoids} = # of ellipsoids in system
{lines} = # of line segments in system
{triangles} = # of triangles in system
@ -367,25 +372,32 @@ read_data command will generate an error in this case.
The "extra bond per atom" setting (angle, dihedral, improper) is only
needed if new bonds (angles, dihedrals, impropers) will be added to
the system when a simulation runs, e.g. by using the "fix
bond/create"_fix_bond_create.html command. This will pre-allocate
space in LAMMPS data structures for storing the new bonds (angles,
bond/create"_fix_bond_create.html command. Using this header flag
is deprecated; please use the {extra/bond/per/atom} keyword (and
correspondingly for angles, dihedrals and impropers) in the
read_data command instead. Either will pre-allocate space in LAMMPS
data structures for storing the new bonds (angles,
dihedrals, impropers).
The "extra special per atom" setting is typically only needed if new
bonds/angles/etc will be added to the system, e.g. by using the "fix
bond/create"_fix_bond_create.html command. Or if entire new molecules
will be added to the system, e.g. by using the "fix
deposit"_fix_deposit.html or "fix pour"_fix_pour.html commands, which
will have more special 1-2,1-3,1-4 neighbors than any other molecules
defined in the data file. Using this setting will pre-allocate space
in the LAMMPS data structures for storing these neighbors. See the
will be added to the system, e.g. by using the
"fix deposit"_fix_deposit.html or "fix pour"_fix_pour.html commands,
which will have more special 1-2,1-3,1-4 neighbors than any other
molecules defined in the data file. Using this header flag is
deprecated; please use the {extra/special/per/atom} keyword instead.
Using this setting will pre-allocate space in the LAMMPS data
structures for storing these neighbors. See the
"special_bonds"_special_bonds.html and "molecule"_molecule.html doc
pages for more discussion of 1-2,1-3,1-4 neighbors.
NOTE: All of the "extra" settings are only used if they appear in the
first data file read; see the description of the {add} keyword above
for reading multiple data files. If they appear in later data files,
they are ignored.
NOTE: All of the "extra" settings are only applied in the first data
file read and when no simulation box has yet been created; as soon as
the simulation box is created (and read_data implies that), these
settings are {locked} and cannot be changed anymore. Please see the
description of the {add} keyword above for reading multiple data files.
If they appear in later data files, they are ignored.
The "ellipsoids" and "lines" and "triangles" and "bodies" settings are
only used with "atom_style ellipsoid or line or tri or

View File

@ -211,13 +211,51 @@ void ReadData::command(int narg, char **arg)
if (extra_improper_types < 0)
error->all(FLERR,"Illegal read_data command");
iarg += 2;
} else if (strcmp(arg[iarg],"extra/bond/per/atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
if (! atom->molecular)
error->all(FLERR,"No bonds allowed with this atom style");
atom->extra_bond_per_atom = force->inumeric(FLERR,arg[iarg+1]);
if (atom->extra_bond_per_atom < 0)
error->all(FLERR,"Illegal read_data command");
iarg += 2;
} else if (strcmp(arg[iarg],"extra/angle/per/atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
if (! atom->molecular)
error->all(FLERR,"No angles allowed with this atom style");
atom->extra_angle_per_atom = force->inumeric(FLERR,arg[iarg+1]);
if (atom->extra_angle_per_atom < 0)
error->all(FLERR,"Illegal read_data command");
iarg += 2;
} else if (strcmp(arg[iarg],"extra/dihedral/per/atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
if (! atom->molecular)
error->all(FLERR,"No dihedrals allowed with this atom style");
atom->extra_dihedral_per_atom = force->inumeric(FLERR,arg[iarg+1]);
if (atom->extra_dihedral_per_atom < 0)
error->all(FLERR,"Illegal read_data command");
iarg += 2;
} else if (strcmp(arg[iarg],"extra/improper/per/atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
if (! atom->molecular)
error->all(FLERR,"No impropers allowed with this atom style");
atom->extra_improper_per_atom = force->inumeric(FLERR,arg[iarg+1]);
if (atom->extra_improper_per_atom < 0)
error->all(FLERR,"Illegal read_data command");
iarg += 2;
} else if (strcmp(arg[iarg],"extra/special/per/atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
if (! atom->molecular)
error->all(FLERR,"No bonded interactions allowed with this atom style");
force->special_extra = force->inumeric(FLERR,arg[iarg+1]);
if (force->special_extra < 0)
error->all(FLERR,"Illegal read_data command");
iarg += 2;
} else if (strcmp(arg[iarg],"group") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
int igroup = group->find_or_create(arg[iarg+1]);
groupbit = group->bitmask[igroup];
iarg += 2;
} else if (strcmp(arg[iarg],"fix") == 0) {
if (iarg+4 > narg)
error->all(FLERR,"Illegal read_data command");
@ -930,6 +968,7 @@ void ReadData::header(int firstpass)
// search line for header keyword and set corresponding variable
// customize for new header lines
// check for triangles before angles so "triangles" not matched as "angles"
int extra_flag_value = 0;
if (strstr(line,"atoms")) {
sscanf(line,BIGINT_FORMAT,&natoms);
@ -991,17 +1030,26 @@ void ReadData::header(int firstpass)
atom->nimpropertypes = nimpropertypes + extra_improper_types;
// these settings only used by first data file
// also, these are obsolescent. we parse them to maintain backward
// compatibility, but the recommended way is to set them via keywords
// in the LAMMPS input file. In case these flags are set in both,
// the input and the data file, we use the larger of the two.
} else if (strstr(line,"extra bond per atom")) {
if (addflag == NONE) sscanf(line,"%d",&atom->extra_bond_per_atom);
if (addflag == NONE) sscanf(line,"%d",&extra_flag_value);
atom->extra_bond_per_atom = MAX(atom->extra_bond_per_atom,extra_flag_value);
} else if (strstr(line,"extra angle per atom")) {
if (addflag == NONE) sscanf(line,"%d",&atom->extra_angle_per_atom);
if (addflag == NONE) sscanf(line,"%d",&extra_flag_value);
atom->extra_angle_per_atom = MAX(atom->extra_angle_per_atom,extra_flag_value);
} else if (strstr(line,"extra dihedral per atom")) {
if (addflag == NONE) sscanf(line,"%d",&atom->extra_dihedral_per_atom);
if (addflag == NONE) sscanf(line,"%d",&extra_flag_value);
atom->extra_dihedral_per_atom = MAX(atom->extra_dihedral_per_atom,extra_flag_value);
} else if (strstr(line,"extra improper per atom")) {
if (addflag == NONE) sscanf(line,"%d",&atom->extra_improper_per_atom);
if (addflag == NONE) sscanf(line,"%d",&extra_flag_value);
atom->extra_improper_per_atom = MAX(atom->extra_improper_per_atom,extra_flag_value);
} else if (strstr(line,"extra special per atom")) {
if (addflag == NONE) sscanf(line,"%d",&force->special_extra);
if (addflag == NONE) sscanf(line,"%d",&extra_flag_value);
force->special_extra = MAX(force->special_extra,extra_flag_value);
// local copy of box info
// so can treat differently for first vs subsequent data files

View File

@ -472,8 +472,8 @@ outside a non-periodic simulation box.
E: Subsequent read data induced too many bonds per atom
See the create_box extra/bond/per/atom or read_data "extra bond per
atom" header value to set this limit larger.
See the extra/bond/per/atom keyword for the create_box
or the read_data command to set this limit larger.
E: Bonds assigned incorrectly
@ -482,8 +482,8 @@ This means there is something invalid about the topology definitions.
E: Subsequent read data induced too many angles per atom
See the create_box extra/angle/per/atom or read_data "extra angle per
atom" header value to set this limit larger.
See the extra/angle/per/atom keyword for the create_box
or the read_data command to set this limit larger.
E: Angles assigned incorrectly
@ -493,8 +493,8 @@ definitions.
E: Subsequent read data induced too many dihedrals per atom
See the create_box extra/dihedral/per/atom or read_data "extra
dihedral per atom" header value to set this limit larger.
See the extra/dihedral/per/atom keyword for the create_box
or the read_data command to set this limit larger.
E: Dihedrals assigned incorrectly
@ -504,8 +504,8 @@ definitions.
E: Subsequent read data induced too many impropers per atom
See the create_box extra/improper/per/atom or read_data "extra
improper per atom" header value to set this limit larger.
See the extra/improper/per/atom keyword for the create_box
or the read_data command to set this limit larger.
E: Impropers assigned incorrectly