clarified doc pages for fix property/atom and read_data

This commit is contained in:
Steve Plimpton
2021-08-19 11:34:25 -06:00
parent 1c67561be8
commit 9470a0eeb6
5 changed files with 41 additions and 40 deletions

View File

@ -180,7 +180,9 @@ atom-ID, the next two are a molecule-ID and a floating point value
that will be stored in a new property called "flag". If a per-atom that will be stored in a new property called "flag". If a per-atom
array was specified in the fix property/atom commmand then the *N* array was specified in the fix property/atom commmand then the *N*
values for that array must be specified consecutively for that values for that array must be specified consecutively for that
property on each line. property on each line. Note that the order of values on each line
corresponds to the order of custom names in the fix property/atom
command.
Note that the the lines of per-atom properties can be listed in any Note that the the lines of per-atom properties can be listed in any
order. Also note that all the per-atom properties specified by the order. Also note that all the per-atom properties specified by the
@ -301,12 +303,14 @@ uninterrupted fashion.
.. warning:: .. warning::
When reading data from a restart file, this fix command has to be specified When reading data from a restart file, this fix command has to be
**exactly** the same way as before. LAMMPS will only check whether a specified **exactly** the same was in the input script that created
fix is of the same style and has the same fix ID and in case of a match the restart file. LAMMPS will only check whether a fix is of the
will then try to initialize the fix with the data stored in the binary same style and has the same fix ID and in case of a match will then
restart file. If the fix property/atom command does not match exactly, try to initialize the fix with the data stored in the binary
data can be corrupted or LAMMPS may crash. restart file. If the names and associated date types in the new
fix property/atom command do not match the old one exactly, data
can be corrupted or LAMMPS may crash.
None of the :doc:`fix_modify <fix_modify>` options are relevant to None of the :doc:`fix_modify <fix_modify>` options are relevant to
this fix. No global or per-atom quantities are stored by this fix for this fix. No global or per-atom quantities are stored by this fix for

View File

@ -66,8 +66,8 @@ simulation. The file can be ASCII text or a gzipped text file
(detected by a .gz suffix). This is one of 3 ways to specify initial (detected by a .gz suffix). This is one of 3 ways to specify initial
atom coordinates; see the :doc:`read_restart <read_restart>` and atom coordinates; see the :doc:`read_restart <read_restart>` and
:doc:`create_atoms <create_atoms>` commands for alternative methods. :doc:`create_atoms <create_atoms>` commands for alternative methods.
Also see the explanation of the :doc:`-restart command-line switch <Run_options>` which can convert a restart file to a data Also see the explanation of the :doc:`-restart command-line switch
file. <Run_options>` which can convert a restart file to a data file.
This command can be used multiple times to add new atoms and their This command can be used multiple times to add new atoms and their
properties to an existing system by using the *add*, *offset*, and properties to an existing system by using the *add*, *offset*, and
@ -246,22 +246,22 @@ appear in any order, with a few exceptions as noted below.
The keyword *fix* can be used one or more times. Each usage specifies The keyword *fix* can be used one or more times. Each usage specifies
a fix that will be used to process a specific portion of the data a fix that will be used to process a specific portion of the data
file. Any header line containing *header-string* and any section with file. Any header line containing *header-string* and any section that
a name containing *section-string* will be passed to the specified is an exact match to *section-string* will be passed to the specified
fix. See the :doc:`fix property/atom <fix_property_atom>` command for fix. See the :doc:`fix property/atom <fix_property_atom>` command for
an example of a fix that operates in this manner. The page for an example of a fix that operates in this manner. The doc page for
the fix defines the syntax of the header line(s) and section(s) that the fix defines the syntax of the header line(s) and section that it
it reads from the data file. Note that the *header-string* can be reads from the data file. Note that the *header-string* can be
specified as NULL, in which case no header lines are passed to the specified as NULL, in which case no header lines are passed to the
fix. This means that it can infer the length of its Section from fix. This means the fix can infer the length of its Section from
standard header settings, such as the number of atoms. standard header settings, such as the number of atoms.
The formatting of individual lines in the data file (indentation, The formatting of individual lines in the data file (indentation,
spacing between words and numbers) is not important except that header spacing between words and numbers) is not important except that header
and section keywords (e.g. atoms, xlo xhi, Masses, Bond Coeffs) must and section keywords (e.g. atoms, xlo xhi, Masses, Bond Coeffs) must
be capitalized as shown and can't have extra white-space between their be capitalized as shown and cannot have extra white-space between
words - e.g. two spaces or a tab between the 2 words in "xlo xhi" or their words - e.g. two spaces or a tab between the 2 words in "xlo
the 2 words in "Bond Coeffs", is not valid. xhi" or the 2 words in "Bond Coeffs", is not valid.
---------- ----------

View File

@ -1551,8 +1551,6 @@ int DumpCustom::parse_fields(int narg, char **arg)
n = atom->find_custom(name,flag,cols); n = atom->find_custom(name,flag,cols);
printf("NAME %s\n",name);
if (n < 0) if (n < 0)
error->all(FLERR,"Could not find custom per-atom property ID: {}", name); error->all(FLERR,"Could not find custom per-atom property ID: {}", name);
if (argindex[iarg] == 0) { if (argindex[iarg] == 0) {

View File

@ -509,21 +509,6 @@ void ReadData::command(int narg, char **arg)
while (strlen(keyword)) { while (strlen(keyword)) {
// if special fix matches, it processes section
if (nfix) {
int i;
for (i = 0; i < nfix; i++)
if (strcmp(keyword,fix_section[i]) == 0) {
if (firstpass) fix(fix_index[i],keyword);
else skip_lines(modify->fix[fix_index[i]]->
read_data_skip_lines(keyword));
parse_keyword(0);
break;
}
if (i < nfix) continue;
}
if (strcmp(keyword,"Atoms") == 0) { if (strcmp(keyword,"Atoms") == 0) {
atomflag = 1; atomflag = 1;
if (firstpass) { if (firstpass) {
@ -728,8 +713,22 @@ void ReadData::command(int narg, char **arg)
if (firstpass) impropercoeffs(1); if (firstpass) impropercoeffs(1);
else skip_lines(nimpropertypes); else skip_lines(nimpropertypes);
} else error->all(FLERR,"Unknown identifier in data file: {}", // if specified fix matches, it processes section
keyword);
} else if (nfix) {
int i;
for (i = 0; i < nfix; i++)
if (strcmp(keyword,fix_section[i]) == 0) {
if (firstpass) fix(fix_index[i],keyword);
else skip_lines(modify->fix[fix_index[i]]->
read_data_skip_lines(keyword));
parse_keyword(0);
break;
}
if (i == nfix)
error->all(FLERR,"Unknown identifier in data file: {}",keyword);
} else error->all(FLERR,"Unknown identifier in data file: {}",keyword);
parse_keyword(0); parse_keyword(0);
} }

View File

@ -656,9 +656,9 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod
} }
} }
printf("NEWARG %d\n",newarg); //printf("NEWARG %d\n",newarg);
for (int i = 0; i < newarg; i++) //for (int i = 0; i < newarg; i++)
printf(" arg %d: %s\n",i,earg[i]); // printf(" arg %d: %s\n",i,earg[i]);
return newarg; return newarg;
} }