diff --git a/doc/src/Section_errors.txt b/doc/src/Section_errors.txt index 23942a75e55950cc36db03116aed3f045e069f19..40e61a248e1945415a5bbf3a2c65f7a6a37f6519 100644 --- a/doc/src/Section_errors.txt +++ b/doc/src/Section_errors.txt @@ -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 diff --git a/doc/src/read_data.txt b/doc/src/read_data.txt index b9924989a6a3bede29372c10fd6339139d6fee93..bd602eee5a9cdc39aaf9e6f51b83bc5e7be2cef8 100644 --- a/doc/src/read_data.txt +++ b/doc/src/read_data.txt @@ -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 diff --git a/src/read_data.cpp b/src/read_data.cpp index d6a33d6e9d5b2b708c252af22ec10e0ec48951e4..b1a42608c050a1214fb3eed63df2f19554159e1c 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -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 diff --git a/src/read_data.h b/src/read_data.h index 5463c86f08e2fa849c9254f13f1feec008e203d9..730229c72296fccdfc86ec401051801f6bd6ae27 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -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