Merge remote-tracking branch 'lammps-ro/master' into lammps-icms
# Conflicts: # doc/Manual.html # doc/Manual.txt # doc/read_restart.txt # src/atom.cpp # src/read_data.cpp
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS-ICMS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="17 Jul 2015 version">
|
||||
<META NAME="docnumber" CONTENT="18 Jul 2015 version">
|
||||
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
|
||||
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
|
||||
</HEAD>
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
<CENTER><H3>LAMMPS-ICMS Documentation
|
||||
</H3></CENTER>
|
||||
<CENTER><H4>17 Jul 2015 version
|
||||
<CENTER><H4>18 Jul 2015 version
|
||||
</H4></CENTER>
|
||||
<H4>Version info:
|
||||
</H4>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS-ICMS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="17 Jul 2015 version">
|
||||
<META NAME="docnumber" CONTENT="18 Jul 2015 version">
|
||||
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
|
||||
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
|
||||
</HEAD>
|
||||
@ -18,7 +18,7 @@
|
||||
<H1></H1>
|
||||
|
||||
LAMMPS-ICMS Documentation :c,h3
|
||||
17 Jul 2015 version :c,h4
|
||||
18 Jul 2015 version :c,h4
|
||||
|
||||
Version info: :h4
|
||||
|
||||
|
||||
@ -46,16 +46,18 @@ simulation box is defined; other keywords can be specified any time.
|
||||
to each atom. If the value is <I>yes</I>, which is the default, IDs are
|
||||
assigned, whether you use the <A HREF = "create_atoms.html">create atoms</A> or
|
||||
<A HREF = "read_data.html">read_data</A> or <A HREF = "read_restart.html">read_restart</A>
|
||||
commands to initialize atoms. If atom IDs are used, they must all be
|
||||
positive integers. They should also be unique, though LAMMPS does not
|
||||
check for this. Typically they should also be consecutively numbered
|
||||
(from 1 to Natoms), though this is not required. Molecular <A HREF = "atom_style.html">atom
|
||||
styles</A> are those that store bond topology information
|
||||
(styles bond, angle, molecular, full). These styles require atom IDs
|
||||
since the IDs are used to encode the topology. Some other LAMMPS
|
||||
commands also require the use of atom IDs. E.g. some many-body pair
|
||||
styles use them to avoid double computation of the I-J interaction
|
||||
between two atoms.
|
||||
commands to initialize atoms. If the value is <I>no</I> the IDs for all
|
||||
atoms are assumed to be 0.
|
||||
</P>
|
||||
<P>If atom IDs are used, they must all be positive integers. They should
|
||||
also be unique, though LAMMPS does not check for this. Typically they
|
||||
should also be consecutively numbered (from 1 to Natoms), though this
|
||||
is not required. Molecular <A HREF = "atom_style.html">atom styles</A> are those
|
||||
that store bond topology information (styles bond, angle, molecular,
|
||||
full). These styles require atom IDs since the IDs are used to encode
|
||||
the topology. Some other LAMMPS commands also require the use of atom
|
||||
IDs. E.g. some many-body pair styles use them to avoid double
|
||||
computation of the I-J interaction between two atoms.
|
||||
</P>
|
||||
<P>The only reason not to use atom IDs is if you are running an atomic
|
||||
simulation so large that IDs cannot be uniquely assigned. For a
|
||||
|
||||
@ -40,16 +40,18 @@ The {id} keyword determines whether non-zero atom IDs can be assigned
|
||||
to each atom. If the value is {yes}, which is the default, IDs are
|
||||
assigned, whether you use the "create atoms"_create_atoms.html or
|
||||
"read_data"_read_data.html or "read_restart"_read_restart.html
|
||||
commands to initialize atoms. If atom IDs are used, they must all be
|
||||
positive integers. They should also be unique, though LAMMPS does not
|
||||
check for this. Typically they should also be consecutively numbered
|
||||
(from 1 to Natoms), though this is not required. Molecular "atom
|
||||
styles"_atom_style.html are those that store bond topology information
|
||||
(styles bond, angle, molecular, full). These styles require atom IDs
|
||||
since the IDs are used to encode the topology. Some other LAMMPS
|
||||
commands also require the use of atom IDs. E.g. some many-body pair
|
||||
styles use them to avoid double computation of the I-J interaction
|
||||
between two atoms.
|
||||
commands to initialize atoms. If the value is {no} the IDs for all
|
||||
atoms are assumed to be 0.
|
||||
|
||||
If atom IDs are used, they must all be positive integers. They should
|
||||
also be unique, though LAMMPS does not check for this. Typically they
|
||||
should also be consecutively numbered (from 1 to Natoms), though this
|
||||
is not required. Molecular "atom styles"_atom_style.html are those
|
||||
that store bond topology information (styles bond, angle, molecular,
|
||||
full). These styles require atom IDs since the IDs are used to encode
|
||||
the topology. Some other LAMMPS commands also require the use of atom
|
||||
IDs. E.g. some many-body pair styles use them to avoid double
|
||||
computation of the I-J interaction between two atoms.
|
||||
|
||||
The only reason not to use atom IDs is if you are running an atomic
|
||||
simulation so large that IDs cannot be uniquely assigned. For a
|
||||
|
||||
@ -15,20 +15,30 @@
|
||||
</P>
|
||||
<PRE>info args
|
||||
</PRE>
|
||||
<UL><LI>args = one or more of the following keywords: <I>system</I>, <I>computes</I>, <I>dumps</I>, <I>fixes</I>, <I>groups</I>, <I>regions</I>, <I>variables</I>, <I>time</I>, or <I>configuration</I>
|
||||
</UL>
|
||||
<P>args = one or more of the following keywords: <I>out</I>, <I>all</I>, <I>system</I>, <I>computes</I>, <I>dumps</I>, <I>fixes</I>, <I>groups</I>, <I>regions</I>, <I>variables</I>, <I>time</I>, or <I>configuration</I>
|
||||
<I>out</I> values = <I>screen</I>, <I>log</I>, <I>append</I> filename, <I>overwrite</I> filename:ul
|
||||
</P>
|
||||
<P><B>Examples:</B>
|
||||
</P>
|
||||
<PRE>info system
|
||||
info groups computes variables
|
||||
info groups computes variables
|
||||
info all out log
|
||||
info all out append info.txt
|
||||
</PRE>
|
||||
<P><B>Description:</B>
|
||||
</P>
|
||||
<P>Print out information about the current internal state of the running
|
||||
LAMMPS process. This can be helpful when debugging or validating
|
||||
complex input scripts. Several output categories are available and
|
||||
one or more output category may be requested. Output is only sent to
|
||||
the screen, provided screen output is enabled.
|
||||
one or more output category may be requested.
|
||||
</P>
|
||||
<P>The <I>out</I> flag controls where the output is sent. It can only be sent
|
||||
to one target. By default this is the screen, if it is active. The
|
||||
<I>log</I> argument selects the log file instead. With the <I>append</I> and
|
||||
<I>overwrite</I> option, followed by a filename, the output is written
|
||||
to that file, which is either appended to or overwritten, respectively.
|
||||
</P>
|
||||
<P>The <I>all</I> flag activates printing all categories listed below.
|
||||
</P>
|
||||
<P>The <I>system</I> category prints a general system overview listing. This
|
||||
includes the unit style, atom style, number of atoms, bonds, angles,
|
||||
@ -68,6 +78,8 @@ reported.
|
||||
</P>
|
||||
<P><A HREF = "print.html">print</A>
|
||||
</P>
|
||||
<P><B>Default:</B> none
|
||||
<P><B>Default:</B>
|
||||
</P>
|
||||
<P>The <I>out</I> option has the default <I>screen</I>.
|
||||
</P>
|
||||
</HTML>
|
||||
|
||||
@ -19,9 +19,28 @@
|
||||
|
||||
<LI>zero or more keyword/arg pairs may be appended
|
||||
|
||||
<LI>keyword = <I>fix</I>
|
||||
<LI>keyword = <I>add</I> or <I>offset</I> or <I>shift</I> or <I>extra/atom/types</I> or <I>extra/bond/types</I> or <I>extra/angle/types</I> or <I>extra/dihedral/types</I> or <I>extra/improper/types</I> or <I>group</I> or <I>fix</I>
|
||||
|
||||
<PRE> <I>fix</I> args = fix-ID header-string section-string
|
||||
<PRE> <I>add</I> arg = <I>append</I> or <I>Nstart</I> or <I>merge</I>
|
||||
append = add new atoms with IDs appended to current IDs
|
||||
Nstart = add new atoms with IDs starting with Nstart
|
||||
merge = add new atoms with their IDs unchanged
|
||||
<I>offset</I> args = toff boff aoff doff ioff
|
||||
toff = offset to add to atom types
|
||||
boff = offset to add to bond types
|
||||
aoff = offset to add to angle types
|
||||
doff = offset to add to dihedral types
|
||||
ioff = offset to add to improper types
|
||||
<I>shift</I> args = Sx Sy Sz
|
||||
Sx,Sy,Sz = distance to shift atoms when adding to system (distance units)
|
||||
<I>extra/atom/types</I> arg = # of extra atom types
|
||||
<I>extra/bond/types</I> arg = # of extra bond types
|
||||
<I>extra/angle/types</I> arg = # of extra angle types
|
||||
<I>extra/dihedral/types</I> arg = # of extra dihedral types
|
||||
<I>extra/improper/types</I> arg = # of extra improper types
|
||||
<I>group</I> args = groupID
|
||||
groupID = add atoms in data file to this group
|
||||
<I>fix</I> args = fix-ID header-string section-string
|
||||
fix-ID = ID of fix to process header lines and sections of data file
|
||||
header-string = header lines containing this string will be passed to fix
|
||||
section-string = section names with this string will be passed to fix
|
||||
@ -33,6 +52,8 @@
|
||||
<PRE>read_data data.lj
|
||||
read_data ../run7/data.polymer.gz
|
||||
read_data data.protein fix mycmap crossterm CMAP
|
||||
read_data data.water add append offset 3 1 1 1 1 shift 0.0 0.0 50.0
|
||||
read_data data.water add merge 1 group solvent
|
||||
</PRE>
|
||||
<P><B>Description:</B>
|
||||
</P>
|
||||
@ -45,6 +66,140 @@ Also see the explanation of the <A HREF = "Section_start.html#start_7">-restart
|
||||
switch</A> which can convert a restart file to
|
||||
a data file.
|
||||
</P>
|
||||
<P>This command can be used multiple times to add new atoms and their
|
||||
properties to an existing system by using the <I>add</I>, <I>offset</I>, and
|
||||
<I>shift</I> keywords. See more details below, which includes the use case
|
||||
for the <I>extra</I> keywords.
|
||||
</P>
|
||||
<P>The <I>group</I> keyword adds all the atoms in the data file to the
|
||||
specified group-ID. The group will be created if it does not already
|
||||
exist. This is useful if you are reading multiple data files and wish
|
||||
to put sets of atoms into different groups so they can be operated on
|
||||
later. E.g. a group of added atoms can be moved to new positions via
|
||||
the <A HREF = "displace_atoms.html">displace_atoms</A> command. Note that atoms
|
||||
read from the data file are also always added to the "all" group. The
|
||||
<A HREF = "group.html">group</A> command discusses atom groups, as used in LAMMPS.
|
||||
</P>
|
||||
<P>The use of the <I>fix</I> keyword is discussed below.
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
<P><B>Reading multiple data files</B>
|
||||
</P>
|
||||
<P>The read_data command can be used multiple times with the same or
|
||||
different data files to build up a complex system from components
|
||||
contained in individual data files. For example one data file could
|
||||
contain fluid in a confined domain; a second could contain wall atoms,
|
||||
and the second file could be read a third time to create a wall on the
|
||||
other side of the fluid. The third set of atoms could be rotated to
|
||||
an opposing direction using the <A HREF = "displace_atoms.html">displace_atoms</A>
|
||||
command, after the third read_data command is used.
|
||||
</P>
|
||||
<P>The <I>add</I>, <I>offset</I>, <I>shift</I>, <I>extra</I>, and <I>group</I> keywords are
|
||||
useful in this context.
|
||||
</P>
|
||||
<P>If a simulation box does not yet exist, the <I>add</I> keyword
|
||||
cannot be used; the read_data command is being used for the first
|
||||
time. If a simulation box does exist, due to using the
|
||||
<A HREF = "create_box.html">create_box</A> command, or a previous read_data command,
|
||||
then the <I>add</I> keyword must be used.
|
||||
</P>
|
||||
<P>IMPORTANT NOTE: The simulation box size (xlo to xhi, ylo to yhi, zlo
|
||||
to zhi) in the new data file will be merged with the existing
|
||||
simulation box to create a large enough box in each dimension to
|
||||
contain both the existing and new atoms. Each box dimension never
|
||||
shrinks due to this merge operation, it only stays the same or
|
||||
grows. Care must be used if you are growing the existing simulation
|
||||
box in a periodic dimension. If there are existing atoms with bonds
|
||||
that straddle that periodic boundary, then the atoms may become far
|
||||
apart if the box size grows. This will separate the atoms in the
|
||||
bond, which can lead to "lost" bond atoms or bad dynamics.
|
||||
</P>
|
||||
<P>The three choices for the <I>add</I> argument affect how the IDs of atoms
|
||||
in the data file are treated. If <I>append</I> is specified, atoms in the
|
||||
data file are added to the current system, with their atom IDs reset
|
||||
so that an atomID = M in the data file becomes atomID = N+M, where N
|
||||
is the largest atom ID in the current system. This rule is applied to
|
||||
all occurrences of atom IDs in the data file, e.g. in the Velocity or
|
||||
Bonds section. If <I>Nstart</I> is specified, then <I>Nstart</I> is a numeric
|
||||
value is given, e.g. 1000, so that an atomID = M in the data file
|
||||
becomes atomID = 1000+M. If <I>merge</I> is specified, the data file atoms
|
||||
are added to the current system without changing their IDs. They are
|
||||
assumed to merge (without duplication) with the currently defined
|
||||
atoms. It is up to you to insure there are no multiply defined atom
|
||||
IDs, as LAMMPS only performs an incomplete check that this is the case
|
||||
by insuring the resulting max atomID >= the number of atoms.
|
||||
</P>
|
||||
<P>The <I>offset</I> and <I>shift</I> keywords can only be used if the <I>add</I>
|
||||
keyword is also specified.
|
||||
</P>
|
||||
<P>The <I>offset</I> keyword adds the specified offset values to the atom
|
||||
types, bond types, angle types, dihedral types, and improper types as
|
||||
they are read from the data file. E.g. if <I>toff</I> = 2, and the file
|
||||
uses atom types 1,2,3, then the added atoms will have atom types
|
||||
3,4,5. These offsets apply to all occurrences of types in the data
|
||||
file, e.g. for the Atoms or Masses or Pair Coeffs or Bond Coeffs
|
||||
sections. This makes it easy to use atoms and molecules and their
|
||||
attributes from a data file in different simulations, where you want
|
||||
their types (atom, bond, angle, etc) to be different depending on what
|
||||
other types already exist. All five offset values must be specified,
|
||||
but individual values will be ignored if the data file does not use
|
||||
that attribute (e.g. no bonds).
|
||||
</P>
|
||||
<P>The <I>shift</I> keyword can be used to specify an (Sx, Sy, Sz)
|
||||
displacement applied to the coordinates of each atom. Sz must be 0.0
|
||||
for a 2d simulation. This is a mechanism for adding structured
|
||||
collections of atoms at different locations within the simulation box,
|
||||
to build up a complex geometry. It is up to you to insure atoms do
|
||||
not end up overlapping unphysically which would lead to bad dynamics.
|
||||
Note that the <A HREF = "displace_atoms.html">displace_atoms</A> command can be used
|
||||
to move a subset of atoms after they have been read from a data file.
|
||||
Likewise, the <A HREF = "delete_atoms.html">delete_atoms</A> command can be used to
|
||||
remove overlapping atoms. Note that the shift values (Sx, Sy, Sz) are
|
||||
also added to the simulation box information (xlo, xhi, ylo, yhi, zlo,
|
||||
zhi) in the data file to shift its boundaries. E.g. xlo_new = xlo +
|
||||
Sx, xhi_new = xhi + Sx.
|
||||
</P>
|
||||
<P>The <I>extra</I> keywords can only be used the first time the read_data
|
||||
command is used. They are useful if you intend to add new atom, bond,
|
||||
angle, etc types later with additional read_data commands. This is
|
||||
because the maximum number of allowed atom, bond, angle, etc types is
|
||||
set by LAMMPS when the system is first initialized. If you do not use
|
||||
the <I>extra</I> keywords, then the number of these types will be limited
|
||||
to what appears in the first data file you read. For example, if the
|
||||
first data file is a solid substrate of Si, it will likely specify a
|
||||
single atom type. If you read a second data file with a different
|
||||
material (water molecules) that sit on top of the substrate, you will
|
||||
want to use different atom types for those atoms. You can only do
|
||||
this if you set the <I>extra/atom/types</I> keyword to a sufficiently large
|
||||
value when reading the substrate data file. Note that use of the
|
||||
<I>extra</I> keywords also allows each data file to contain sections like
|
||||
Masses or Pair Coeffs or Bond Coeffs which are sized appropriately for
|
||||
the number of types in that data file. If the <I>offset</I> keyword is
|
||||
used appropriately when each data file is read, the values in those
|
||||
sections will be stored correctly in the larger data structures
|
||||
allocated by the use of the <I>extra</I> keywords. E.g. the substrate file
|
||||
can list mass and pair coefficients for type 1 silicon atoms. The
|
||||
water file can list mass and pair coeffcients for type 1 and type 2
|
||||
hydrogen and oxygen atoms. Use of the <I>extra</I> and <I>offset</I> keywords
|
||||
will store those mass and pair coefficient values appropriately in
|
||||
data structures that allow for 3 atom types (Si, H, O). Of course,
|
||||
you would still need to specify coefficients for H/Si and O/Si
|
||||
interactions in your input script to have a complete pairwise
|
||||
interaction model.
|
||||
</P>
|
||||
<P>An alternative to using the <I>extra</I> keywords with the read_data
|
||||
command, is to use the <A HREF = "create_box.html">create_box</A> command to
|
||||
initialize the simulation box and all the various type limits you need
|
||||
via its <I>extra</I> keywords. Then use the read_data command one or more
|
||||
times to populate the system with atoms, bonds, angles, etc, using the
|
||||
<I>offset</I> keyword if desired to alter types used in the various data
|
||||
files you read.
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
<P><B>Format of a data file</B>
|
||||
</P>
|
||||
<P>The structure of the data file is important, though many settings and
|
||||
sections are optional or can come in any order. See the examples
|
||||
directory for sample data files for different problems.
|
||||
@ -88,6 +243,8 @@ the 2 words in "Bond Coeffs", is not valid.
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
<P><B>Format of the header of a data file</B>
|
||||
</P>
|
||||
<P>These are the recognized header keywords. Header lines can come in
|
||||
any order. The value(s) are read from the beginning of the line.
|
||||
Thus the keyword <I>atoms</I> should be in a line like "1000 atoms"; the
|
||||
@ -183,7 +340,11 @@ and yz tilt factors must be 0.0.
|
||||
</P>
|
||||
<P>If the system is periodic (in a dimension), then atom coordinates can
|
||||
be outside the bounds (in that dimension); they will be remapped (in a
|
||||
periodic sense) back inside the box.
|
||||
periodic sense) back inside the box. Note that if the <I>add</I> option is
|
||||
being used to add atoms to a simulation box that already exists, this
|
||||
periodic remapping will be performed using simulation box bounds that
|
||||
are the union of the existing box and the box boundaries in the new
|
||||
data file.
|
||||
</P>
|
||||
<P>IMPORTANT NOTE: If the system is non-periodic (in a dimension), then
|
||||
all atoms in the data file must have coordinates (in that dimension)
|
||||
@ -222,6 +383,11 @@ in the LAMMPS data structures for storing these neighbors. See the
|
||||
<A HREF = "special_bonds.html">special_bonds</A> and <A HREF = "molecule.html">molecule</A> doc
|
||||
pages for more discussion of 1-2,1-3,1-4 neighbors.
|
||||
</P>
|
||||
<P>IMPORTANT NOTE: All of the "extra" settings are only used if they
|
||||
appear in the first data file read; see the description of the <I>add</I>
|
||||
keyword above for reading multiple data files. If they appear in
|
||||
later data files, they are ignored.
|
||||
</P>
|
||||
<P>The "ellipsoids" and "lines" and "triangles" and "bodies" settings are
|
||||
only used with <A HREF = "atom_style.html">atom_style ellipsoid or line or tri or
|
||||
body</A> and specify how many of the atoms are
|
||||
@ -243,6 +409,8 @@ the maximum values defined in any of the template molecules.
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
<P><B>Format of the body of a data file</B>
|
||||
</P>
|
||||
<P>These are the section keywords for the body of the file.
|
||||
</P>
|
||||
<UL><LI><I>Atoms, Velocities, Masses, Ellipsoids, Lines, Triangles, Bodies</I> = atom-property sections
|
||||
@ -1056,6 +1224,8 @@ LAMMPS</A> section of the documentation.
|
||||
<P><A HREF = "read_dump.html">read_dump</A>, <A HREF = "read_restart.html">read_restart</A>,
|
||||
<A HREF = "create_atoms.html">create_atoms</A>, <A HREF = "write_data.html">write_data</A>
|
||||
</P>
|
||||
<P><B>Default:</B> none
|
||||
<P><B>Default:</B>
|
||||
</P>
|
||||
<P>The default for all the <I>extra</I> keywords is 0.
|
||||
</P>
|
||||
</HTML>
|
||||
|
||||
@ -14,19 +14,39 @@ read_data file keyword args ... :pre
|
||||
|
||||
file = name of data file to read in :ulb,l
|
||||
zero or more keyword/arg pairs may be appended :l
|
||||
keyword = {fix} :l
|
||||
keyword = {add} or {offset} or {shift} or {extra/atom/types} or {extra/bond/types} or {extra/angle/types} or {extra/dihedral/types} or {extra/improper/types} or {group} or {fix} :l
|
||||
{add} arg = {append} or {Nstart} or {merge}
|
||||
append = add new atoms with IDs appended to current IDs
|
||||
Nstart = add new atoms with IDs starting with Nstart
|
||||
merge = add new atoms with their IDs unchanged
|
||||
{offset} args = toff boff aoff doff ioff
|
||||
toff = offset to add to atom types
|
||||
boff = offset to add to bond types
|
||||
aoff = offset to add to angle types
|
||||
doff = offset to add to dihedral types
|
||||
ioff = offset to add to improper types
|
||||
{shift} args = Sx Sy Sz
|
||||
Sx,Sy,Sz = distance to shift atoms when adding to system (distance units)
|
||||
{extra/atom/types} arg = # of extra atom types
|
||||
{extra/bond/types} arg = # of extra bond types
|
||||
{extra/angle/types} arg = # of extra angle types
|
||||
{extra/dihedral/types} arg = # of extra dihedral types
|
||||
{extra/improper/types} arg = # of extra improper types
|
||||
{group} args = groupID
|
||||
groupID = add atoms in data file to this group
|
||||
{fix} args = fix-ID header-string section-string
|
||||
fix-ID = ID of fix to process header lines and sections of data file
|
||||
header-string = header lines containing this string will be passed to fix
|
||||
section-string = section names with this string will be passed to fix :pre
|
||||
:ule
|
||||
|
||||
|
||||
[Examples:]
|
||||
|
||||
read_data data.lj
|
||||
read_data ../run7/data.polymer.gz
|
||||
read_data data.protein fix mycmap crossterm CMAP :pre
|
||||
read_data data.protein fix mycmap crossterm CMAP
|
||||
read_data data.water add append offset 3 1 1 1 1 shift 0.0 0.0 50.0
|
||||
read_data data.water add merge 1 group solvent :pre
|
||||
|
||||
[Description:]
|
||||
|
||||
@ -39,6 +59,140 @@ Also see the explanation of the "-restart command-line
|
||||
switch"_Section_start.html#start_7 which can convert a restart file to
|
||||
a data file.
|
||||
|
||||
This command can be used multiple times to add new atoms and their
|
||||
properties to an existing system by using the {add}, {offset}, and
|
||||
{shift} keywords. See more details below, which includes the use case
|
||||
for the {extra} keywords.
|
||||
|
||||
The {group} keyword adds all the atoms in the data file to the
|
||||
specified group-ID. The group will be created if it does not already
|
||||
exist. This is useful if you are reading multiple data files and wish
|
||||
to put sets of atoms into different groups so they can be operated on
|
||||
later. E.g. a group of added atoms can be moved to new positions via
|
||||
the "displace_atoms"_displace_atoms.html command. Note that atoms
|
||||
read from the data file are also always added to the "all" group. The
|
||||
"group"_group.html command discusses atom groups, as used in LAMMPS.
|
||||
|
||||
The use of the {fix} keyword is discussed below.
|
||||
|
||||
:line
|
||||
|
||||
[Reading multiple data files]
|
||||
|
||||
The read_data command can be used multiple times with the same or
|
||||
different data files to build up a complex system from components
|
||||
contained in individual data files. For example one data file could
|
||||
contain fluid in a confined domain; a second could contain wall atoms,
|
||||
and the second file could be read a third time to create a wall on the
|
||||
other side of the fluid. The third set of atoms could be rotated to
|
||||
an opposing direction using the "displace_atoms"_displace_atoms.html
|
||||
command, after the third read_data command is used.
|
||||
|
||||
The {add}, {offset}, {shift}, {extra}, and {group} keywords are
|
||||
useful in this context.
|
||||
|
||||
If a simulation box does not yet exist, the {add} keyword
|
||||
cannot be used; the read_data command is being used for the first
|
||||
time. If a simulation box does exist, due to using the
|
||||
"create_box"_create_box.html command, or a previous read_data command,
|
||||
then the {add} keyword must be used.
|
||||
|
||||
IMPORTANT NOTE: The simulation box size (xlo to xhi, ylo to yhi, zlo
|
||||
to zhi) in the new data file will be merged with the existing
|
||||
simulation box to create a large enough box in each dimension to
|
||||
contain both the existing and new atoms. Each box dimension never
|
||||
shrinks due to this merge operation, it only stays the same or
|
||||
grows. Care must be used if you are growing the existing simulation
|
||||
box in a periodic dimension. If there are existing atoms with bonds
|
||||
that straddle that periodic boundary, then the atoms may become far
|
||||
apart if the box size grows. This will separate the atoms in the
|
||||
bond, which can lead to "lost" bond atoms or bad dynamics.
|
||||
|
||||
The three choices for the {add} argument affect how the IDs of atoms
|
||||
in the data file are treated. If {append} is specified, atoms in the
|
||||
data file are added to the current system, with their atom IDs reset
|
||||
so that an atomID = M in the data file becomes atomID = N+M, where N
|
||||
is the largest atom ID in the current system. This rule is applied to
|
||||
all occurrences of atom IDs in the data file, e.g. in the Velocity or
|
||||
Bonds section. If {Nstart} is specified, then {Nstart} is a numeric
|
||||
value is given, e.g. 1000, so that an atomID = M in the data file
|
||||
becomes atomID = 1000+M. If {merge} is specified, the data file atoms
|
||||
are added to the current system without changing their IDs. They are
|
||||
assumed to merge (without duplication) with the currently defined
|
||||
atoms. It is up to you to insure there are no multiply defined atom
|
||||
IDs, as LAMMPS only performs an incomplete check that this is the case
|
||||
by insuring the resulting max atomID >= the number of atoms.
|
||||
|
||||
The {offset} and {shift} keywords can only be used if the {add}
|
||||
keyword is also specified.
|
||||
|
||||
The {offset} keyword adds the specified offset values to the atom
|
||||
types, bond types, angle types, dihedral types, and improper types as
|
||||
they are read from the data file. E.g. if {toff} = 2, and the file
|
||||
uses atom types 1,2,3, then the added atoms will have atom types
|
||||
3,4,5. These offsets apply to all occurrences of types in the data
|
||||
file, e.g. for the Atoms or Masses or Pair Coeffs or Bond Coeffs
|
||||
sections. This makes it easy to use atoms and molecules and their
|
||||
attributes from a data file in different simulations, where you want
|
||||
their types (atom, bond, angle, etc) to be different depending on what
|
||||
other types already exist. All five offset values must be specified,
|
||||
but individual values will be ignored if the data file does not use
|
||||
that attribute (e.g. no bonds).
|
||||
|
||||
The {shift} keyword can be used to specify an (Sx, Sy, Sz)
|
||||
displacement applied to the coordinates of each atom. Sz must be 0.0
|
||||
for a 2d simulation. This is a mechanism for adding structured
|
||||
collections of atoms at different locations within the simulation box,
|
||||
to build up a complex geometry. It is up to you to insure atoms do
|
||||
not end up overlapping unphysically which would lead to bad dynamics.
|
||||
Note that the "displace_atoms"_displace_atoms.html command can be used
|
||||
to move a subset of atoms after they have been read from a data file.
|
||||
Likewise, the "delete_atoms"_delete_atoms.html command can be used to
|
||||
remove overlapping atoms. Note that the shift values (Sx, Sy, Sz) are
|
||||
also added to the simulation box information (xlo, xhi, ylo, yhi, zlo,
|
||||
zhi) in the data file to shift its boundaries. E.g. xlo_new = xlo +
|
||||
Sx, xhi_new = xhi + Sx.
|
||||
|
||||
The {extra} keywords can only be used the first time the read_data
|
||||
command is used. They are useful if you intend to add new atom, bond,
|
||||
angle, etc types later with additional read_data commands. This is
|
||||
because the maximum number of allowed atom, bond, angle, etc types is
|
||||
set by LAMMPS when the system is first initialized. If you do not use
|
||||
the {extra} keywords, then the number of these types will be limited
|
||||
to what appears in the first data file you read. For example, if the
|
||||
first data file is a solid substrate of Si, it will likely specify a
|
||||
single atom type. If you read a second data file with a different
|
||||
material (water molecules) that sit on top of the substrate, you will
|
||||
want to use different atom types for those atoms. You can only do
|
||||
this if you set the {extra/atom/types} keyword to a sufficiently large
|
||||
value when reading the substrate data file. Note that use of the
|
||||
{extra} keywords also allows each data file to contain sections like
|
||||
Masses or Pair Coeffs or Bond Coeffs which are sized appropriately for
|
||||
the number of types in that data file. If the {offset} keyword is
|
||||
used appropriately when each data file is read, the values in those
|
||||
sections will be stored correctly in the larger data structures
|
||||
allocated by the use of the {extra} keywords. E.g. the substrate file
|
||||
can list mass and pair coefficients for type 1 silicon atoms. The
|
||||
water file can list mass and pair coeffcients for type 1 and type 2
|
||||
hydrogen and oxygen atoms. Use of the {extra} and {offset} keywords
|
||||
will store those mass and pair coefficient values appropriately in
|
||||
data structures that allow for 3 atom types (Si, H, O). Of course,
|
||||
you would still need to specify coefficients for H/Si and O/Si
|
||||
interactions in your input script to have a complete pairwise
|
||||
interaction model.
|
||||
|
||||
An alternative to using the {extra} keywords with the read_data
|
||||
command, is to use the "create_box"_create_box.html command to
|
||||
initialize the simulation box and all the various type limits you need
|
||||
via its {extra} keywords. Then use the read_data command one or more
|
||||
times to populate the system with atoms, bonds, angles, etc, using the
|
||||
{offset} keyword if desired to alter types used in the various data
|
||||
files you read.
|
||||
|
||||
:line
|
||||
|
||||
[Format of a data file]
|
||||
|
||||
The structure of the data file is important, though many settings and
|
||||
sections are optional or can come in any order. See the examples
|
||||
directory for sample data files for different problems.
|
||||
@ -82,6 +236,8 @@ the 2 words in "Bond Coeffs", is not valid.
|
||||
|
||||
:line
|
||||
|
||||
[Format of the header of a data file]
|
||||
|
||||
These are the recognized header keywords. Header lines can come in
|
||||
any order. The value(s) are read from the beginning of the line.
|
||||
Thus the keyword {atoms} should be in a line like "1000 atoms"; the
|
||||
@ -177,7 +333,11 @@ and yz tilt factors must be 0.0.
|
||||
|
||||
If the system is periodic (in a dimension), then atom coordinates can
|
||||
be outside the bounds (in that dimension); they will be remapped (in a
|
||||
periodic sense) back inside the box.
|
||||
periodic sense) back inside the box. Note that if the {add} option is
|
||||
being used to add atoms to a simulation box that already exists, this
|
||||
periodic remapping will be performed using simulation box bounds that
|
||||
are the union of the existing box and the box boundaries in the new
|
||||
data file.
|
||||
|
||||
IMPORTANT NOTE: If the system is non-periodic (in a dimension), then
|
||||
all atoms in the data file must have coordinates (in that dimension)
|
||||
@ -216,6 +376,11 @@ 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.
|
||||
|
||||
IMPORTANT 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.
|
||||
|
||||
The "ellipsoids" and "lines" and "triangles" and "bodies" settings are
|
||||
only used with "atom_style ellipsoid or line or tri or
|
||||
body"_atom_style.html and specify how many of the atoms are
|
||||
@ -237,6 +402,8 @@ the maximum values defined in any of the template molecules.
|
||||
|
||||
:line
|
||||
|
||||
[Format of the body of a data file]
|
||||
|
||||
These are the section keywords for the body of the file.
|
||||
|
||||
{Atoms, Velocities, Masses, Ellipsoids, Lines, Triangles, Bodies} = atom-property sections
|
||||
@ -946,4 +1113,6 @@ LAMMPS"_Section_start.html#start_2 section of the documentation.
|
||||
"read_dump"_read_dump.html, "read_restart"_read_restart.html,
|
||||
"create_atoms"_create_atoms.html, "write_data"_write_data.html
|
||||
|
||||
[Default:] none
|
||||
[Default:]
|
||||
|
||||
The default for all the {extra} keywords is 0.
|
||||
|
||||
@ -30,12 +30,13 @@ read_restart poly.*.% remap
|
||||
</PRE>
|
||||
<P><B>Description:</B>
|
||||
</P>
|
||||
<P>Read in a previously saved simulation from a restart file. This
|
||||
allows continuation of a previous run. Information about what is
|
||||
stored in a restart file is given below. Basically this operation
|
||||
will re-create the simulation box with all its atoms and their
|
||||
attributes, at the point in time it was written to the restart file by
|
||||
a previous simluation. The simulation box will be partitioned into a
|
||||
<P>Read in a previously saved system configuration from a restart file.
|
||||
This allows continuation of a previous run. Details about what
|
||||
information is stored (and not stored) in a restart file is given
|
||||
below. Basically this operation will re-create the simulation box
|
||||
with all its atoms and their attributes as well as some related global
|
||||
settings, at the point in time it was written to the restart file by a
|
||||
previous simluation. The simulation box will be partitioned into a
|
||||
regular 3d grid of rectangular bricks, one per processor, based on the
|
||||
number of processors in the current simulation and the settings of the
|
||||
<A HREF = "processors.html">processors</A> command. The partitioning can later be
|
||||
@ -137,22 +138,25 @@ written and read using MPI-IO.
|
||||
<HR>
|
||||
|
||||
<P>A restart file stores the following information about a simulation:
|
||||
units and atom style, simulation box size and shape and boundary
|
||||
settings, group definitions, per-type atom settings such as mass,
|
||||
per-atom attributes including their group assignments and molecular
|
||||
topology attributes, force field styles and coefficients, and
|
||||
units, atom style and atom style related settings (<I>id</I>, <I>map</I>,
|
||||
<I>sort</I>), communication settings (<I>mode</I>, <I>cutoff</I>, <I>vel</I>), timestep,
|
||||
simulation box size and shape and boundary settings, group
|
||||
definitions, per-type atom settings such as mass, per-atom attributes
|
||||
including their group assignments and molecular topology attributes,
|
||||
force field styles and - in most cases - force field coefficients, and
|
||||
<A HREF = "special_bonds.html">special_bonds</A> settings. This means that commands
|
||||
for these quantities do not need to be re-specified in the input
|
||||
script that reads the restart file, though you can redefine settings
|
||||
after the restart file is read.
|
||||
</P>
|
||||
<P>One exception is that some pair styles do not store their info in
|
||||
restart files. Typically these are many-body potentials which read
|
||||
their parameters from separate files; you need to re-specify the <A HREF = "pair_style.html">pair
|
||||
<P>One exception is that some force styles (pair, bond, angle, etc) do
|
||||
not store their coefficient info in restart files. Typically these
|
||||
are many-body or tabulated potentials which read their parameters from
|
||||
separate files; you may need to re-specify the <A HREF = "pair_style.html">pair
|
||||
style</A> and <A HREF = "pair_coeff.html">pair coeff</A> commands in
|
||||
your restart input script. The doc pages for individual pair styles
|
||||
note if this is the case. This is also true of bond_style hybrid (and
|
||||
angle_style, dihedral_style, improper_style hybrid).
|
||||
mention if this is the case. This is also true of bond_style hybrid
|
||||
(and angle_style, dihedral_style, improper_style hybrid).
|
||||
</P>
|
||||
<P>All settings made by the <A HREF = "pair_modify.html">pair_modify</A> command, such
|
||||
as the shift and tail settings, are stored in the restart file with
|
||||
|
||||
@ -28,15 +28,14 @@ read_restart poly.*.% remap :pre
|
||||
[Description:]
|
||||
|
||||
Read in a previously saved system configuration from a restart file.
|
||||
This allows continuation of a previous run. However, not the entire
|
||||
state of a simulation can be saved and read back. Details about what
|
||||
information is stored in a restart file is given below. Basically
|
||||
this operation will re-create the simulation box with all its atoms
|
||||
and their attributes as well as some related global settings, at the
|
||||
point in time it was written to the restart file by a previous
|
||||
simluation. The simulation box will be partitioned into a regular 3d
|
||||
grid of rectangular bricks, one per processor, based on the number of
|
||||
processors in the current simulation and the settings of the
|
||||
This allows continuation of a previous run. Details about what
|
||||
information is stored (and not stored) in a restart file is given
|
||||
below. Basically this operation will re-create the simulation box
|
||||
with all its atoms and their attributes as well as some related global
|
||||
settings, at the point in time it was written to the restart file by a
|
||||
previous simluation. The simulation box will be partitioned into a
|
||||
regular 3d grid of rectangular bricks, one per processor, based on the
|
||||
number of processors in the current simulation and the settings of the
|
||||
"processors"_processors.html command. The partitioning can later be
|
||||
changed by the "balance"_balance.html or "fix
|
||||
balance"_fix_balance.html commands.
|
||||
@ -147,14 +146,14 @@ for these quantities do not need to be re-specified in the input
|
||||
script that reads the restart file, though you can redefine settings
|
||||
after the restart file is read.
|
||||
|
||||
One exception is that some force styles do not store their coefficient
|
||||
info in restart files. Typically these are many-body or tabulated
|
||||
potentials which read their parameters from separate files;
|
||||
you may need to re-specify the "pair style"_pair_style.html and
|
||||
"pair coeff"_pair_coeff.html commands in your restart input script.
|
||||
The doc pages for individual pair styles mention if this is the case.
|
||||
This is also true of bond_style hybrid (and angle_style, dihedral_style,
|
||||
improper_style hybrid).
|
||||
One exception is that some force styles (pair, bond, angle, etc) do
|
||||
not store their coefficient info in restart files. Typically these
|
||||
are many-body or tabulated potentials which read their parameters from
|
||||
separate files; you may need to re-specify the "pair
|
||||
style"_pair_style.html and "pair coeff"_pair_coeff.html commands in
|
||||
your restart input script. The doc pages for individual pair styles
|
||||
mention if this is the case. This is also true of bond_style hybrid
|
||||
(and angle_style, dihedral_style, improper_style hybrid).
|
||||
|
||||
All settings made by the "pair_modify"_pair_modify.html command, such
|
||||
as the shift and tail settings, are stored in the restart file with
|
||||
|
||||
@ -47,13 +47,14 @@ restart v_mystep poly.restart
|
||||
</PRE>
|
||||
<P><B>Description:</B>
|
||||
</P>
|
||||
<P>Write out a binary restart file every so many timesteps, in either or
|
||||
both of two modes, as a run proceeds. A value of 0 means do not write
|
||||
out any restart files. The two modes are as follows. If one filename
|
||||
is specified, a series of filenames will be created which include the
|
||||
timestep in the filename. If two filenames are specified, only 2
|
||||
restart files will be created, with those names. LAMMPS will toggle
|
||||
between the 2 names as it writes successive restart files.
|
||||
<P>Write out a binary restart file with the current state of the
|
||||
simulation every so many timesteps, in either or both of two modes, as
|
||||
a run proceeds. A value of 0 means do not write out any restart
|
||||
files. The two modes are as follows. If one filename is specified, a
|
||||
series of filenames will be created which include the timestep in the
|
||||
filename. If two filenames are specified, only 2 restart files will
|
||||
be created, with those names. LAMMPS will toggle between the 2 names
|
||||
as it writes successive restart files.
|
||||
</P>
|
||||
<P>Note that you can specify the restart command twice, once with a
|
||||
single filename and once with two filenames. This would allow you,
|
||||
|
||||
@ -83,9 +83,10 @@ fixes that were specified during the initial run is not stored, which
|
||||
means the new input script must specify any fixes you want to use.
|
||||
Even when restart information is stored in the file, as it is for some
|
||||
fixes, commands may need to be re-specified in the new input script,
|
||||
in order to re-use that information. See the
|
||||
<A HREF = "read_restart.html">read_restart</A> command for information about what is
|
||||
stored in a restart file.
|
||||
in order to re-use that information. Details are usually given in
|
||||
the documentation of the respective command. Also, see the
|
||||
<A HREF = "read_restart.html">read_restart</A> command for general information
|
||||
about what is stored in a restart file.
|
||||
</P>
|
||||
<HR>
|
||||
|
||||
|
||||
185
lib/kokkos/config/nvcc_wrapper
Executable file
185
lib/kokkos/config/nvcc_wrapper
Executable file
@ -0,0 +1,185 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This shell script (nvcc_wrapper) wraps both the host compiler and
|
||||
# NVCC, if you are building Trilinos with CUDA enabled. The script
|
||||
# remedies some differences between the interface of NVCC and that of
|
||||
# the host compiler, in particular for linking. It also means that
|
||||
# Trilinos doesn't need separate .cu files; it can just use .cpp
|
||||
# files.
|
||||
#
|
||||
# Hopefully, at some point, NVIDIA may fix NVCC so as to make this
|
||||
# script obsolete. For now, this script exists and if you want to
|
||||
# build Trilinos with CUDA enabled, you must use this script as your
|
||||
# compiler.
|
||||
|
||||
# Default settings: change those according to your machine. For
|
||||
# example, you may have have two different wrappers with either icpc
|
||||
# or g++ as their back-end compiler. The defaults can be overwritten
|
||||
# by using the usual arguments (e.g., -arch=sm_30 -ccbin icpc).
|
||||
|
||||
default_arch="sm_35"
|
||||
#default_arch="sm_50"
|
||||
|
||||
#
|
||||
# The default C++ compiler.
|
||||
#
|
||||
default_compiler=${NVCC_WRAPPER_DEFAULT_COMPILER:-"g++"}
|
||||
#default_compiler="icpc"
|
||||
#default_compiler="/usr/local/gcc/4.8.3/bin/g++"
|
||||
#default_compiler="/usr/local/gcc/4.9.1/bin/g++"
|
||||
|
||||
#
|
||||
# Internal variables
|
||||
#
|
||||
cpp_files=""
|
||||
xcompiler_args=""
|
||||
cuda_arg=""
|
||||
xlinker_args=""
|
||||
object_files=""
|
||||
object_files_xlinker=""
|
||||
first_host_option=1
|
||||
arch_set=0
|
||||
ccbin_set=0
|
||||
nvcc_error_code=0
|
||||
dry_run=0
|
||||
replace_pragma_ident=0
|
||||
|
||||
#echo "Arguments: $# $@"
|
||||
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case $1 in
|
||||
#show the executed command
|
||||
--show)
|
||||
dry_run=1
|
||||
;;
|
||||
#replace '#pragma ident' with '#ident' this is needed to compile OpenMPI due to a configure script bug and a non standardized behaviour of pragma with macros
|
||||
--replace-pragma-ident)
|
||||
replace_pragma_ident=1
|
||||
;;
|
||||
#handle source files to be compiled as cuda files
|
||||
*.cpp|*.cxx|*.cc|*.C|*.c++|*.cu)
|
||||
cpp_files="$cpp_files $1"
|
||||
;;
|
||||
#Handle known nvcc args
|
||||
-O*|-D*|-gencode*|-c|-I*|-L*|-l*|-g|--help|--version|--dryrun|--verbose|--keep-dir|-E|-M|-G|--relocatable-device-code*|-shared|-lineinfo|-expt-extended-lambda|--resource-usage)
|
||||
cuda_args="$cuda_args $1"
|
||||
;;
|
||||
#Handle c++11 setting
|
||||
--std=c++11|-std=c++11)
|
||||
cuda_args="$cuda_args $1"
|
||||
;;
|
||||
#strip of -std=c++98 due to nvcc warnings and Tribits will place both -std=c++11 and -std=c++98
|
||||
-std=c++98|--std=c++98)
|
||||
;;
|
||||
#Handle known nvcc args that have an argument
|
||||
-o|-rdc|-maxrregcount|--default-stream)
|
||||
cuda_args="$cuda_args $1 $2"
|
||||
shift
|
||||
;;
|
||||
#strip of pedantic because it produces endless warnings about #LINE added by the preprocessor
|
||||
-pedantic|-Wpedantic|-ansi)
|
||||
;;
|
||||
#strip -Xcompiler because we add it
|
||||
-Xcompiler)
|
||||
;;
|
||||
#strip of "-x cu" because we add that
|
||||
-x)
|
||||
if [[ $2 != "cu" ]]; then
|
||||
xcompiler_args="$xcompiler_args,-x,$2"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
#Handle -ccbin (if its not set we can set it to a default value)
|
||||
-ccbin)
|
||||
cuda_args="$cuda_args $1 $2"
|
||||
ccbin_set=1
|
||||
shift
|
||||
;;
|
||||
#Handle -arch argument (if its not set use a default
|
||||
-arch*)
|
||||
cuda_args="$cuda_args $1"
|
||||
arch_set=1
|
||||
;;
|
||||
#Handle -Xcudafe argument
|
||||
-Xcudafe)
|
||||
cuda_args="$cuda_args -Xcudafe $2"
|
||||
shift
|
||||
;;
|
||||
#Handle args that should be sent to the linker
|
||||
-Wl*)
|
||||
xlinker_args="$xlinker_args -Xlinker ${1:4:${#1}}"
|
||||
;;
|
||||
#Handle object files: -x cu applies to all input files, so give them to linker, except if only linking
|
||||
*.a|*.so|*.o|*.obj)
|
||||
object_files="$object_files $1"
|
||||
object_files_xlinker="$object_files_xlinker -Xlinker $1"
|
||||
;;
|
||||
#Handle object files: -x cu applies to all input files, so give them to linker, except if only linking
|
||||
*.so.*|*.dylib)
|
||||
object_files_xlinker="$object_files_xlinker -Xlinker $1"
|
||||
object_files="$object_files -Xlinker $1"
|
||||
;;
|
||||
#All other args are sent to the host compiler
|
||||
*)
|
||||
if [ $first_host_option -eq 0 ]; then
|
||||
xcompiler_args="$xcompiler_args,$1"
|
||||
else
|
||||
xcompiler_args="-Xcompiler $1"
|
||||
first_host_option=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
#Add default host compiler if necessary
|
||||
if [ $ccbin_set -ne 1 ]; then
|
||||
cuda_args="$cuda_args -ccbin $default_compiler"
|
||||
fi
|
||||
|
||||
#Add architecture command
|
||||
if [ $arch_set -ne 1 ]; then
|
||||
cuda_args="$cuda_args -arch=$default_arch"
|
||||
fi
|
||||
|
||||
#Compose compilation command
|
||||
command="nvcc $cuda_args $xlinker_args $xcompiler_args"
|
||||
|
||||
#nvcc does not accept '#pragma ident SOME_MACRO_STRING' but it does accept '#ident SOME_MACRO_STRING'
|
||||
if [ $replace_pragma_ident -eq 1 ]; then
|
||||
cpp_files2=""
|
||||
for file in $cpp_files
|
||||
do
|
||||
var=`grep pragma ${file} | grep ident | grep "#"`
|
||||
if [ "${#var}" -gt 0 ]
|
||||
then
|
||||
sed 's/#[\ \t]*pragma[\ \t]*ident/#ident/g' $file > /tmp/nvcc_wrapper_tmp_$file
|
||||
cpp_files2="$cpp_files2 /tmp/nvcc_wrapper_tmp_$file"
|
||||
else
|
||||
cpp_files2="$cpp_files2 $file"
|
||||
fi
|
||||
done
|
||||
cpp_files=$cpp_files2
|
||||
echo $cpp_files
|
||||
fi
|
||||
|
||||
if [ "$cpp_files" ]; then
|
||||
command="$command $object_files_xlinker -x cu $cpp_files"
|
||||
else
|
||||
command="$command $object_files"
|
||||
fi
|
||||
|
||||
#Print command for dryrun
|
||||
if [ $dry_run -eq 1 ]; then
|
||||
echo $command
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#Run compilation command
|
||||
$command
|
||||
nvcc_error_code=$?
|
||||
|
||||
#Report error code
|
||||
exit $nvcc_error_code
|
||||
@ -396,9 +396,9 @@ void NeighborKokkos::operator()(TagNeighborCheckDistance<DeviceType>, const int
|
||||
void NeighborKokkos::build(int topoflag)
|
||||
{
|
||||
if (nlist_device)
|
||||
this->template build_kokkos<LMPDeviceType>(topoflag);
|
||||
build_kokkos<LMPDeviceType>(topoflag);
|
||||
else
|
||||
this->template build_kokkos<LMPHostType>(topoflag);
|
||||
build_kokkos<LMPHostType>(topoflag);
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
|
||||
@ -74,7 +74,7 @@ class PairBuckCoulCutKokkos : public PairBuckCoulCut {
|
||||
|
||||
Kokkos::DualView<params_buck_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_buck_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_buck_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class PairBuckCoulLongKokkos : public PairBuckCoulLong {
|
||||
|
||||
Kokkos::DualView<params_buck_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_buck_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_buck_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ class PairBuckKokkos : public PairBuck {
|
||||
|
||||
|
||||
Kokkos::DualView<params_buck**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_buck**,Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
typename Kokkos::DualView<params_buck**,Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
params_buck m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; // hardwired to space for 15 atom types
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
|
||||
|
||||
@ -80,7 +80,7 @@ class PairCoulCutKokkos : public PairCoulCut {
|
||||
|
||||
Kokkos::DualView<params_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ class PairCoulDebyeKokkos : public PairCoulDebye {
|
||||
|
||||
Kokkos::DualView<params_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ class PairCoulLongKokkos : public PairCoulLong {
|
||||
|
||||
Kokkos::DualView<params_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class PairLJCharmmCoulCharmmImplicitKokkos : public PairLJCharmmCoulCharmmImplic
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class PairLJCharmmCoulCharmmKokkos : public PairLJCharmmCoulCharmm {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class PairLJCharmmCoulLongKokkos : public PairLJCharmmCoulLong {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ class PairLJClass2CoulCutKokkos : public PairLJClass2CoulCut {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class PairLJClass2CoulLongKokkos : public PairLJClass2CoulLong {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ class PairLJClass2Kokkos : public PairLJClass2 {
|
||||
}
|
||||
|
||||
Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
typename Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
params_lj m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; // hardwired to space for 15 atom types
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
|
||||
|
||||
@ -76,7 +76,7 @@ class PairLJCutCoulCutKokkos : public PairLJCutCoulCut {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ class PairLJCutCoulDebyeKokkos : public PairLJCutCoulDebye {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ class PairLJCutCoulDSFKokkos : public PairLJCutCoulDSF {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class PairLJCutCoulLongKokkos : public PairLJCutCoulLong {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ class PairLJCutKokkos : public PairLJCut {
|
||||
|
||||
|
||||
Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
typename Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
params_lj m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; // hardwired to space for 15 atom types
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
|
||||
|
||||
@ -74,7 +74,7 @@ class PairLJExpandKokkos : public PairLJExpand {
|
||||
}
|
||||
|
||||
Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
typename Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
params_lj m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; // hardwired to space for 15 atom types
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
|
||||
|
||||
@ -75,7 +75,7 @@ class PairLJGromacsCoulGromacsKokkos : public PairLJGromacsCoulGromacs {
|
||||
|
||||
Kokkos::DualView<params_lj_coul**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj_coul**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ class PairLJGromacsKokkos : public PairLJGromacs {
|
||||
|
||||
Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj**,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
// hardwired to space for 15 atom types
|
||||
params_lj m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ class PairLJSDKKokkos : public PairLJSDK {
|
||||
|
||||
|
||||
Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>::t_dev_const params;
|
||||
typename Kokkos::DualView<params_lj**,Kokkos::LayoutRight,DeviceType>::t_dev_const_um params;
|
||||
params_lj m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; // hardwired to space for 15 atom types
|
||||
F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
|
||||
|
||||
@ -180,7 +180,7 @@ class PairTersoffKokkos : public PairTersoff {
|
||||
typedef Kokkos::DualView<int***,DeviceType> tdual_int_3d;
|
||||
Kokkos::DualView<params_ters***,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_ters***,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const paramskk;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um paramskk;
|
||||
// hardwired to space for 15 atom types
|
||||
//params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ class PairTersoffMODKokkos : public PairTersoffMOD {
|
||||
typedef Kokkos::DualView<int***,DeviceType> tdual_int_3d;
|
||||
Kokkos::DualView<params_ters***,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_ters***,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const paramskk;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um paramskk;
|
||||
// hardwired to space for 15 atom types
|
||||
//params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ class PairTersoffZBLKokkos : public PairTersoffZBL {
|
||||
typedef Kokkos::DualView<int***,DeviceType> tdual_int_3d;
|
||||
Kokkos::DualView<params_ters***,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_ters***,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const paramskk;
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const_um paramskk;
|
||||
// hardwired to space for 15 atom types
|
||||
//params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
# kokkos_cuda = KOKKOS package with CUDA support, nvcc/mpicxx compiler
|
||||
# kokkos_cuda = KOKKOS package with CUDA support, OpenMPI, nvcc/mpicxx compiler
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd)
|
||||
export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# compiler/linker settings
|
||||
# specify flags and libraries needed for your compiler
|
||||
|
||||
CC = nvcc -ccbin=mpicxx
|
||||
CC = mpicxx
|
||||
CCFLAGS = -g -O3
|
||||
SHFLAGS = -fPIC
|
||||
DEPFLAGS = -M
|
||||
|
||||
LINK = nvcc -ccbin=mpicxx
|
||||
LINK = mpicxx
|
||||
LINKFLAGS = -g -O
|
||||
LIB =
|
||||
SIZE = size
|
||||
@ -21,7 +24,6 @@ ARFLAGS = -rc
|
||||
SHLIBFLAGS = -shared
|
||||
KOKKOS_DEVICES = Cuda, OpenMP
|
||||
KOKKOS_ARCH = Kepler35
|
||||
CUDA_PATH = /usr/local/cuda
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# LAMMPS-specific settings, all OPTIONAL
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# kokkos_phi = KOKKOS package with PHI support, MPI compiler, default MPI
|
||||
# kokkos_phi = KOKKOS package with PHI support, Intel compiler, default MPI
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
@ -6,12 +6,12 @@ SHELL = /bin/sh
|
||||
# compiler/linker settings
|
||||
# specify flags and libraries needed for your compiler
|
||||
|
||||
CC = mpicxx
|
||||
CC = mpiicpc
|
||||
CCFLAGS = -g -O3
|
||||
SHFLAGS = -fPIC
|
||||
DEPFLAGS = -M
|
||||
|
||||
LINK = mpicxx
|
||||
LINK = mpiicpc
|
||||
LINKFLAGS = -g -O
|
||||
LIB =
|
||||
SIZE = size
|
||||
|
||||
94
src/atom.cpp
94
src/atom.cpp
@ -516,7 +516,7 @@ void Atom::modify_params(int narg, char **arg)
|
||||
error->all(FLERR,
|
||||
"Atom_modify id command after simulation box is defined");
|
||||
if (strcmp(arg[iarg+1],"yes") == 0) tag_enable = 1;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) tag_enable = 2;
|
||||
else if (strcmp(arg[iarg+1],"no") == 0) tag_enable = 0;
|
||||
else error->all(FLERR,"Illegal atom_modify command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"map") == 0) {
|
||||
@ -559,9 +559,11 @@ void Atom::modify_params(int narg, char **arg)
|
||||
check that atom IDs are valid
|
||||
error if any atom ID < 0 or atom ID = MAXTAGINT
|
||||
if any atom ID > 0, error if any atom ID == 0
|
||||
if any atom ID > 0, error if tag_enable = 0
|
||||
if all atom IDs = 0, tag_enable must be 0
|
||||
OK if atom IDs > natoms
|
||||
NOTE: not checking that atom IDs are unique
|
||||
if max atom IDs < natoms, must be duplicates
|
||||
OK if max atom IDs > natoms
|
||||
NOTE: not fully checking that atom IDs are unique
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::tag_check()
|
||||
@ -578,12 +580,16 @@ void Atom::tag_check()
|
||||
MPI_Allreduce(&min,&minall,1,MPI_LMP_TAGINT,MPI_MIN,world);
|
||||
MPI_Allreduce(&max,&maxall,1,MPI_LMP_TAGINT,MPI_MAX,world);
|
||||
|
||||
if (minall < 0) error->all(FLERR,"Atom ID is negative");
|
||||
if (maxall >= MAXTAGINT) error->all(FLERR,"Atom ID is too big");
|
||||
if (maxall > 0 && minall == 0) error->all(FLERR,"Atom ID is zero");
|
||||
// this last message is wrong
|
||||
if (maxall == 0 && tag_enable && natoms)
|
||||
error->all(FLERR,"Not all atom IDs are 0");
|
||||
if (minall < 0) error->all(FLERR,"One or more Atom IDs is negative");
|
||||
if (maxall >= MAXTAGINT) error->all(FLERR,"One or more atom IDs is too big");
|
||||
if (maxall > 0 && minall == 0)
|
||||
error->all(FLERR,"One or more atom IDs is zero");
|
||||
if (maxall > 0 && tag_enable == 0)
|
||||
error->all(FLERR,"Non-zero atom IDs with atom_modify id = no");
|
||||
if (maxall == 0 && natoms && tag_enable)
|
||||
error->all(FLERR,"All atom IDs = 0 but atom_modify id = yes");
|
||||
if (tag_enable && maxall < natoms)
|
||||
error->all(FLERR,"Duplicate atom IDs exist");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -725,7 +731,8 @@ void Atom::deallocate_topology()
|
||||
call style-specific routine to parse line
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::data_atoms(int n, char *buf)
|
||||
void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset,
|
||||
int shiftflag, double *shift)
|
||||
{
|
||||
int m,xptr,iptr;
|
||||
imageint imagedata;
|
||||
@ -833,6 +840,12 @@ void Atom::data_atoms(int n, char *buf)
|
||||
xdata[0] = atof(values[xptr]);
|
||||
xdata[1] = atof(values[xptr+1]);
|
||||
xdata[2] = atof(values[xptr+2]);
|
||||
if (shiftflag) {
|
||||
xdata[0] += shift[0];
|
||||
xdata[1] += shift[1];
|
||||
xdata[2] += shift[2];
|
||||
}
|
||||
|
||||
domain->remap(xdata,imagedata);
|
||||
if (triclinic) {
|
||||
domain->x2lamda(xdata,lamda);
|
||||
@ -841,8 +854,15 @@ void Atom::data_atoms(int n, char *buf)
|
||||
|
||||
if (coord[0] >= sublo[0] && coord[0] < subhi[0] &&
|
||||
coord[1] >= sublo[1] && coord[1] < subhi[1] &&
|
||||
coord[2] >= sublo[2] && coord[2] < subhi[2])
|
||||
coord[2] >= sublo[2] && coord[2] < subhi[2]) {
|
||||
avec->data_atom(xdata,imagedata,values);
|
||||
if (id_offset) tag[nlocal-1] += id_offset;
|
||||
if (type_offset) {
|
||||
type[nlocal-1] += type_offset;
|
||||
if (type[nlocal-1] > ntypes)
|
||||
error->one(FLERR,"Invalid atom type in Atoms section of data file");
|
||||
}
|
||||
}
|
||||
|
||||
buf = next + 1;
|
||||
}
|
||||
@ -856,7 +876,7 @@ void Atom::data_atoms(int n, char *buf)
|
||||
call style-specific routine to parse line
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::data_vels(int n, char *buf)
|
||||
void Atom::data_vels(int n, char *buf, tagint id_offset)
|
||||
{
|
||||
int j,m;
|
||||
tagint tagdata;
|
||||
@ -883,7 +903,7 @@ void Atom::data_vels(int n, char *buf)
|
||||
for (j = 1; j < nwords; j++)
|
||||
values[j] = strtok(NULL," \t\n\r\f");
|
||||
|
||||
tagdata = ATOTAGINT(values[0]);
|
||||
tagdata = ATOTAGINT(values[0]) + id_offset;
|
||||
if (tagdata <= 0 || tagdata > map_tag_max)
|
||||
error->one(FLERR,"Invalid atom ID in Velocities section of data file");
|
||||
if ((m = map(tagdata)) >= 0) avec->data_vel(m,&values[1]);
|
||||
@ -901,7 +921,7 @@ void Atom::data_vels(int n, char *buf)
|
||||
check that atom IDs are > 0 and <= map_tag_max
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::data_bonds(int n, char *buf, int *count)
|
||||
void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset)
|
||||
{
|
||||
int m,tmp,itype;
|
||||
tagint atom1,atom2;
|
||||
@ -913,6 +933,11 @@ void Atom::data_bonds(int n, char *buf, int *count)
|
||||
*next = '\0';
|
||||
sscanf(buf,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT,
|
||||
&tmp,&itype,&atom1,&atom2);
|
||||
if (id_offset) {
|
||||
atom1 += id_offset;
|
||||
atom2 += id_offset;
|
||||
}
|
||||
|
||||
if (atom1 <= 0 || atom1 > map_tag_max ||
|
||||
atom2 <= 0 || atom2 > map_tag_max)
|
||||
error->one(FLERR,"Invalid atom ID in Bonds section of data file");
|
||||
@ -947,7 +972,7 @@ void Atom::data_bonds(int n, char *buf, int *count)
|
||||
check that atom IDs are > 0 and <= map_tag_max
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::data_angles(int n, char *buf, int *count)
|
||||
void Atom::data_angles(int n, char *buf, int *count, tagint id_offset)
|
||||
{
|
||||
int m,tmp,itype;
|
||||
tagint atom1,atom2,atom3;
|
||||
@ -959,6 +984,12 @@ void Atom::data_angles(int n, char *buf, int *count)
|
||||
*next = '\0';
|
||||
sscanf(buf,"%d %d " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT,
|
||||
&tmp,&itype,&atom1,&atom2,&atom3);
|
||||
if (id_offset) {
|
||||
atom1 += id_offset;
|
||||
atom2 += id_offset;
|
||||
atom3 += id_offset;
|
||||
}
|
||||
|
||||
if (atom1 <= 0 || atom1 > map_tag_max ||
|
||||
atom2 <= 0 || atom2 > map_tag_max ||
|
||||
atom3 <= 0 || atom3 > map_tag_max)
|
||||
@ -1008,7 +1039,7 @@ void Atom::data_angles(int n, char *buf, int *count)
|
||||
check that atom IDs are > 0 and <= map_tag_max
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::data_dihedrals(int n, char *buf, int *count)
|
||||
void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset)
|
||||
{
|
||||
int m,tmp,itype;
|
||||
tagint atom1,atom2,atom3,atom4;
|
||||
@ -1021,6 +1052,13 @@ void Atom::data_dihedrals(int n, char *buf, int *count)
|
||||
sscanf(buf,"%d %d "
|
||||
TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT,
|
||||
&tmp,&itype,&atom1,&atom2,&atom3,&atom4);
|
||||
if (id_offset) {
|
||||
atom1 += id_offset;
|
||||
atom2 += id_offset;
|
||||
atom3 += id_offset;
|
||||
atom4 += id_offset;
|
||||
}
|
||||
|
||||
if (atom1 <= 0 || atom1 > map_tag_max ||
|
||||
atom2 <= 0 || atom2 > map_tag_max ||
|
||||
atom3 <= 0 || atom3 > map_tag_max ||
|
||||
@ -1086,7 +1124,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count)
|
||||
check that atom IDs are > 0 and <= map_tag_max
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::data_impropers(int n, char *buf, int *count)
|
||||
void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset)
|
||||
{
|
||||
int m,tmp,itype;
|
||||
tagint atom1,atom2,atom3,atom4;
|
||||
@ -1099,6 +1137,13 @@ void Atom::data_impropers(int n, char *buf, int *count)
|
||||
sscanf(buf,"%d %d "
|
||||
TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT,
|
||||
&tmp,&itype,&atom1,&atom2,&atom3,&atom4);
|
||||
if (id_offset) {
|
||||
atom1 += id_offset;
|
||||
atom2 += id_offset;
|
||||
atom3 += id_offset;
|
||||
atom4 += id_offset;
|
||||
}
|
||||
|
||||
if (atom1 <= 0 || atom1 > map_tag_max ||
|
||||
atom2 <= 0 || atom2 > map_tag_max ||
|
||||
atom3 <= 0 || atom3 > map_tag_max ||
|
||||
@ -1163,7 +1208,7 @@ void Atom::data_impropers(int n, char *buf, int *count)
|
||||
call style-specific routine to parse line
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus)
|
||||
void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset)
|
||||
{
|
||||
int j,m,tagdata;
|
||||
char *next;
|
||||
@ -1189,7 +1234,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus)
|
||||
for (j = 1; j < nwords; j++)
|
||||
values[j] = strtok(NULL," \t\n\r\f");
|
||||
|
||||
tagdata = ATOTAGINT(values[0]);
|
||||
tagdata = ATOTAGINT(values[0]) + id_offset;
|
||||
if (tagdata <= 0 || tagdata > map_tag_max)
|
||||
error->one(FLERR,"Invalid atom ID in Bonus section of data file");
|
||||
|
||||
@ -1210,7 +1255,8 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus)
|
||||
call style-specific routine to parse line
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::data_bodies(int n, char *buf, AtomVecBody *avec_body)
|
||||
void Atom::data_bodies(int n, char *buf, AtomVecBody *avec_body,
|
||||
tagint id_offset)
|
||||
{
|
||||
int j,m,tagdata,ninteger,ndouble;
|
||||
|
||||
@ -1222,8 +1268,8 @@ void Atom::data_bodies(int n, char *buf, AtomVecBody *avec_body)
|
||||
// if I own atom tag, unpack its values
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (i == 0) tagdata = ATOTAGINT(strtok(buf," \t\n\r\f"));
|
||||
else tagdata = ATOTAGINT(strtok(NULL," \t\n\r\f"));
|
||||
if (i == 0) tagdata = ATOTAGINT(strtok(buf," \t\n\r\f")) + id_offset;
|
||||
else tagdata = ATOTAGINT(strtok(NULL," \t\n\r\f")) + id_offset;
|
||||
ninteger = atoi(strtok(NULL," \t\n\r\f"));
|
||||
ndouble = atoi(strtok(NULL," \t\n\r\f"));
|
||||
|
||||
@ -1260,9 +1306,10 @@ void Atom::allocate_type_arrays()
|
||||
/* ----------------------------------------------------------------------
|
||||
set a mass and flag it as set
|
||||
called from reading of data file
|
||||
type_offset may be used when reading multiple data files
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Atom::set_mass(const char *str)
|
||||
void Atom::set_mass(const char *str, int type_offset)
|
||||
{
|
||||
if (mass == NULL) error->all(FLERR,"Cannot set mass for this atom style");
|
||||
|
||||
@ -1270,6 +1317,7 @@ void Atom::set_mass(const char *str)
|
||||
double mass_one;
|
||||
int n = sscanf(str,"%d %lg",&itype,&mass_one);
|
||||
if (n != 2) error->all(FLERR,"Invalid mass line in data file");
|
||||
itype += type_offset;
|
||||
|
||||
if (itype < 1 || itype > ntypes)
|
||||
error->all(FLERR,"Invalid type for mass set");
|
||||
|
||||
18
src/atom.h
18
src/atom.h
@ -188,19 +188,19 @@ class Atom : protected Pointers {
|
||||
|
||||
void deallocate_topology();
|
||||
|
||||
void data_atoms(int, char *);
|
||||
void data_vels(int, char *);
|
||||
void data_atoms(int, char *, tagint, int, int, double *);
|
||||
void data_vels(int, char *, tagint);
|
||||
|
||||
void data_bonds(int, char *, int *);
|
||||
void data_angles(int, char *, int *);
|
||||
void data_dihedrals(int, char *, int *);
|
||||
void data_impropers(int, char *, int *);
|
||||
void data_bonds(int, char *, int *, tagint);
|
||||
void data_angles(int, char *, int *, tagint);
|
||||
void data_dihedrals(int, char *, int *, tagint);
|
||||
void data_impropers(int, char *, int *, tagint);
|
||||
|
||||
void data_bonus(int, char *, class AtomVec *);
|
||||
void data_bodies(int, char *, class AtomVecBody *);
|
||||
void data_bonus(int, char *, class AtomVec *, tagint);
|
||||
void data_bodies(int, char *, class AtomVecBody *, tagint);
|
||||
|
||||
virtual void allocate_type_arrays();
|
||||
void set_mass(const char *);
|
||||
void set_mass(const char *, int);
|
||||
void set_mass(int, double);
|
||||
void set_mass(int, char **);
|
||||
void set_mass(double *);
|
||||
|
||||
@ -182,7 +182,7 @@ class Fix : protected Pointers {
|
||||
virtual void reset_dt() {}
|
||||
|
||||
virtual void read_data_header(char *) {}
|
||||
virtual void read_data_section(char *, int, char *) {}
|
||||
virtual void read_data_section(char *, int, char *, tagint) {}
|
||||
virtual bigint read_data_skip_lines(char *) {return 0;}
|
||||
|
||||
virtual void write_data_header(FILE *, int) {}
|
||||
|
||||
@ -182,9 +182,11 @@ void FixPropertyAtom::init()
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
unpack N lines in buf from section of data file labeled by keyword
|
||||
id_offset is applied to first atomID field if multiple data files are read
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf)
|
||||
void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf,
|
||||
tagint id_offset)
|
||||
{
|
||||
int j,m;
|
||||
tagint itag;
|
||||
@ -223,7 +225,7 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf)
|
||||
for (j = 1; j < nwords; j++)
|
||||
values[j] = strtok(NULL," \t\n\r\f");
|
||||
|
||||
itag = ATOTAGINT(values[0]);
|
||||
itag = ATOTAGINT(values[0]) + id_offset;
|
||||
if (itag <= 0 || itag > map_tag_max) {
|
||||
char str[128];
|
||||
sprintf(str,"Invalid atom ID in %s section of data file",keyword);
|
||||
|
||||
@ -31,7 +31,7 @@ class FixPropertyAtom : public Fix {
|
||||
int setmask();
|
||||
void init();
|
||||
|
||||
void read_data_section(char *, int, char *);
|
||||
void read_data_section(char *, int, char *, tagint);
|
||||
bigint read_data_skip_lines(char *);
|
||||
void write_data_section_size(int, int &, int &);
|
||||
void write_data_section_pack(int, double **);
|
||||
|
||||
@ -587,6 +587,26 @@ int Group::find(const char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
find group with name or create group if it doesn't exist
|
||||
return group index
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int Group::find_or_create(const char *name)
|
||||
{
|
||||
int igroup = find(name);
|
||||
if (igroup >= 0) return igroup;
|
||||
|
||||
if (ngroup == MAX_GROUP) error->all(FLERR,"Too many groups");
|
||||
igroup = find_unused();
|
||||
int n = strlen(name) + 1;
|
||||
names[igroup] = new char[n];
|
||||
strcpy(names[igroup],name);
|
||||
ngroup++;
|
||||
|
||||
return igroup;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return index of first available group
|
||||
should never be called when group limit has been reached
|
||||
|
||||
@ -33,6 +33,7 @@ class Group : protected Pointers {
|
||||
void assign(int, char **); // assign atoms to a group
|
||||
void create(char *, int *); // add flagged atoms to a group
|
||||
int find(const char *); // lookup name in list of groups
|
||||
int find_or_create(const char *); // lookup name or create new group
|
||||
void write_restart(FILE *);
|
||||
void read_restart(FILE *);
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include "atom_vec_tri.h"
|
||||
#include "force.h"
|
||||
#include "molecule.h"
|
||||
#include "group.h"
|
||||
#include "comm.h"
|
||||
#include "update.h"
|
||||
#include "modify.h"
|
||||
@ -41,6 +42,7 @@
|
||||
#include "dihedral.h"
|
||||
#include "improper.h"
|
||||
#include "special.h"
|
||||
#include "irregular.h"
|
||||
#include "error.h"
|
||||
#include "memory.h"
|
||||
|
||||
@ -55,6 +57,8 @@ using namespace LAMMPS_NS;
|
||||
// customize for new sections
|
||||
#define NSECTIONS 25 // change when add to header::section_keywords
|
||||
|
||||
enum{NONE,APPEND,VALUE,MERGE};
|
||||
|
||||
// pair style suffixes to ignore
|
||||
// when matching Pair Coeffs comment to currently-defined pair style
|
||||
|
||||
@ -115,8 +119,16 @@ void ReadData::command(int narg, char **arg)
|
||||
|
||||
// optional args
|
||||
|
||||
addflag = mergeflag = 0;
|
||||
offset[0] = offset[1] = offset[2] = 0.0;
|
||||
addflag = NONE;
|
||||
id_offset = 0;
|
||||
offsetflag = shiftflag = 0;
|
||||
toffset = boffset = aoffset = doffset = ioffset = 0;
|
||||
shift[0] = shift[1] = shift[2] = 0.0;
|
||||
extra_atom_types = extra_bond_types = extra_angle_types =
|
||||
extra_dihedral_types = extra_improper_types = 0;
|
||||
|
||||
groupbit = 0;
|
||||
|
||||
nfix = 0;
|
||||
fix_index = NULL;
|
||||
fix_header = NULL;
|
||||
@ -125,18 +137,81 @@ void ReadData::command(int narg, char **arg)
|
||||
int iarg = 1;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"add") == 0) {
|
||||
addflag = 1;
|
||||
iarg++;
|
||||
} else if (strcmp(arg[iarg],"merge") == 0) {
|
||||
mergeflag = 1;
|
||||
iarg++;
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
if (strcmp(arg[iarg+1],"append") == 0) addflag = APPEND;
|
||||
else if (strcmp(arg[iarg+1],"merge") == 0) addflag = MERGE;
|
||||
else {
|
||||
addflag = VALUE;
|
||||
bigint offset = force->bnumeric(FLERR,arg[iarg+1]);
|
||||
if (offset > MAXTAGINT)
|
||||
error->all(FLERR,"Read data add offset is too big");
|
||||
id_offset = offset;
|
||||
}
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"offset") == 0) {
|
||||
if (iarg+4 > narg)
|
||||
if (iarg+6 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
offsetflag = 1;
|
||||
toffset = force->inumeric(FLERR,arg[iarg+1]);
|
||||
boffset = force->inumeric(FLERR,arg[iarg+2]);
|
||||
aoffset = force->inumeric(FLERR,arg[iarg+3]);
|
||||
doffset = force->inumeric(FLERR,arg[iarg+4]);
|
||||
ioffset = force->inumeric(FLERR,arg[iarg+5]);
|
||||
if (toffset < 0 || boffset < 0 || aoffset < 0 ||
|
||||
doffset < 0 || ioffset < 0)
|
||||
error->all(FLERR,"Illegal read_data command");
|
||||
offset[0] = force->numeric(FLERR,arg[iarg+1]);
|
||||
offset[1] = force->numeric(FLERR,arg[iarg+2]);
|
||||
offset[2] = force->numeric(FLERR,arg[iarg+3]);
|
||||
iarg += 6;
|
||||
} else if (strcmp(arg[iarg],"shift") == 0) {
|
||||
if (iarg+4 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
shiftflag = 1;
|
||||
shift[0] = force->numeric(FLERR,arg[iarg+1]);
|
||||
shift[1] = force->numeric(FLERR,arg[iarg+2]);
|
||||
shift[2] = force->numeric(FLERR,arg[iarg+3]);
|
||||
if (domain->dimension == 2 && shift[2] != 0.0)
|
||||
error->all(FLERR,"Non-zero read_data shift z value for 2d simulation");
|
||||
iarg += 4;
|
||||
|
||||
} else if (strcmp(arg[iarg],"extra/atom/types") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
extra_atom_types = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (extra_atom_types < 0) error->all(FLERR,"Illegal read_data command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"extra/bond/types") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
if (!atom->avec->bonds_allow)
|
||||
error->all(FLERR,"No bonds allowed with this atom style");
|
||||
extra_bond_types = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (extra_bond_types < 0) error->all(FLERR,"Illegal read_data command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"extra/angle/types") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
if (!atom->avec->angles_allow)
|
||||
error->all(FLERR,"No angles allowed with this atom style");
|
||||
extra_angle_types = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (extra_angle_types < 0) error->all(FLERR,"Illegal read_data command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"extra/dihedral/types") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
if (!atom->avec->dihedrals_allow)
|
||||
error->all(FLERR,"No dihedrals allowed with this atom style");
|
||||
extra_dihedral_types = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (extra_dihedral_types < 0)
|
||||
error->all(FLERR,"Illegal read_data command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"extra/improper/types") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command");
|
||||
if (!atom->avec->impropers_allow)
|
||||
error->all(FLERR,"No impropers allowed with this atom style");
|
||||
extra_improper_types = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (extra_improper_types < 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");
|
||||
@ -161,25 +236,54 @@ void ReadData::command(int narg, char **arg)
|
||||
strcpy(fix_section[nfix],arg[iarg+3]);
|
||||
nfix++;
|
||||
iarg += 4;
|
||||
|
||||
} else error->all(FLERR,"Illegal read_data command");
|
||||
}
|
||||
|
||||
// error checks
|
||||
|
||||
if (domain->box_exist && !addflag && !mergeflag)
|
||||
error->all(FLERR,"Cannot read_data after simulation box is defined");
|
||||
if (addflag && mergeflag) error->all(FLERR,"Cannot read_data add and merge");
|
||||
if (domain->dimension == 2 && offset[2] != 0.0)
|
||||
error->all(FLERR,"Cannot use non-zero z offset in read_data "
|
||||
"for 2d simulation");
|
||||
|
||||
if (domain->dimension == 2 && domain->zperiodic == 0)
|
||||
error->all(FLERR,"Cannot run 2d simulation with nonperiodic Z dimension");
|
||||
if (domain->box_exist && !addflag)
|
||||
error->all(FLERR,"Cannot read_data without add keyword "
|
||||
"after simulation box is defined");
|
||||
if (!domain->box_exist && addflag)
|
||||
error->all(FLERR,"Cannot use read_data add before "
|
||||
"simulation box is defined");
|
||||
if (offsetflag && addflag == NONE)
|
||||
error->all(FLERR,"Cannot use read_data offset without add flag");
|
||||
if (shiftflag && addflag == NONE)
|
||||
error->all(FLERR,"Cannot use read_data shift without add flag");
|
||||
if (addflag != NONE &&
|
||||
(extra_atom_types || extra_bond_types || extra_angle_types ||
|
||||
extra_dihedral_types || extra_improper_types))
|
||||
error->all(FLERR,"Cannot use read_data extra with add flag");
|
||||
|
||||
// first time system initialization
|
||||
|
||||
if (addflag == NONE) {
|
||||
domain->box_exist = 1;
|
||||
update->ntimestep = 0;
|
||||
}
|
||||
|
||||
// compute atomID offset for addflag = MERGE
|
||||
|
||||
if (addflag == APPEND) {
|
||||
tagint *tag = atom->tag;
|
||||
int nlocal = atom->nlocal;
|
||||
tagint max = 0;
|
||||
for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]);
|
||||
MPI_Allreduce(&max,&id_offset,1,MPI_LMP_TAGINT,MPI_MAX,world);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// perform 1-pass read if no molecular topoogy in file
|
||||
// perform 2-pass read if molecular topology,
|
||||
// first pass calculates max topology/atom
|
||||
|
||||
// flags for this data file
|
||||
|
||||
int atomflag,topoflag;
|
||||
int bondflag,angleflag,dihedralflag,improperflag;
|
||||
int ellipsoidflag,lineflag,triflag,bodyflag;
|
||||
@ -188,6 +292,14 @@ void ReadData::command(int narg, char **arg)
|
||||
bondflag = angleflag = dihedralflag = improperflag = 0;
|
||||
ellipsoidflag = lineflag = triflag = bodyflag = 0;
|
||||
|
||||
// values in this data file
|
||||
|
||||
natoms = ntypes = 0;
|
||||
nbonds = nangles = ndihedrals = nimpropers = 0;
|
||||
nbondtypes = nangletypes = ndihedraltypes = nimpropertypes = 0;
|
||||
triclinic = 0;
|
||||
|
||||
int nlocal_previous = atom->nlocal;
|
||||
int firstpass = 1;
|
||||
|
||||
while (1) {
|
||||
@ -204,16 +316,12 @@ void ReadData::command(int narg, char **arg)
|
||||
header();
|
||||
|
||||
// problem setup using info from header
|
||||
// 1st pass only
|
||||
|
||||
if (firstpass) {
|
||||
domain->box_exist = 1;
|
||||
update->ntimestep = 0;
|
||||
|
||||
// apply extra settings before grow(), even if no topology in file
|
||||
// deallocate() insures new settings are used for topology arrays
|
||||
// if per-atom topology is in file, another grow() is done below
|
||||
// only done once, if firstpass and first data file
|
||||
// apply extra settings before grow(), even if no topology in file
|
||||
// deallocate() insures new settings are used for topology arrays
|
||||
// if per-atom topology is in file, another grow() is done below
|
||||
|
||||
if (firstpass && addflag == NONE) {
|
||||
atom->bond_per_atom = atom->extra_bond_per_atom;
|
||||
atom->angle_per_atom = atom->extra_angle_per_atom;
|
||||
atom->dihedral_per_atom = atom->extra_dihedral_per_atom;
|
||||
@ -227,6 +335,37 @@ void ReadData::command(int narg, char **arg)
|
||||
atom->deallocate_topology();
|
||||
atom->avec->grow(n);
|
||||
|
||||
domain->boxlo[0] = boxlo[0]; domain->boxhi[0] = boxhi[0];
|
||||
domain->boxlo[1] = boxlo[1]; domain->boxhi[1] = boxhi[1];
|
||||
domain->boxlo[2] = boxlo[2]; domain->boxhi[2] = boxhi[2];
|
||||
|
||||
if (triclinic) {
|
||||
domain->xy = xy; domain->xz = xz; domain->yz = yz;
|
||||
}
|
||||
|
||||
domain->print_box(" ");
|
||||
domain->set_initial_box();
|
||||
domain->set_global_box();
|
||||
comm->set_proc_grid();
|
||||
domain->set_local_box();
|
||||
}
|
||||
|
||||
// change simulation box to be union of existing box and new box + shift
|
||||
// only done if firstpass and not first data file
|
||||
|
||||
if (firstpass && addflag != NONE) {
|
||||
domain->boxlo[0] = MIN(domain->boxlo[0],boxlo[0]+shift[0]);
|
||||
domain->boxhi[0] = MAX(domain->boxhi[0],boxhi[0]+shift[0]);
|
||||
domain->boxlo[1] = MIN(domain->boxlo[1],boxlo[1]+shift[1]);
|
||||
domain->boxhi[1] = MAX(domain->boxhi[1],boxhi[1]+shift[1]);
|
||||
domain->boxlo[2] = MIN(domain->boxlo[2],boxlo[2]+shift[2]);
|
||||
domain->boxhi[2] = MAX(domain->boxhi[2],boxhi[2]+shift[2]);
|
||||
|
||||
// NOTE: not sure what to do about tilt value in subsequent data files
|
||||
//if (triclinic) {
|
||||
// domain->xy = xy; domain->xz = xz; domain->yz = yz;
|
||||
// }
|
||||
|
||||
domain->print_box(" ");
|
||||
domain->set_initial_box();
|
||||
domain->set_global_box();
|
||||
@ -261,34 +400,34 @@ void ReadData::command(int narg, char **arg)
|
||||
error->warning(FLERR,"Atom style in data file differs "
|
||||
"from currently defined atom style");
|
||||
atoms();
|
||||
} else skip_lines(atom->natoms);
|
||||
} else skip_lines(natoms);
|
||||
} else if (strcmp(keyword,"Velocities") == 0) {
|
||||
if (atomflag == 0)
|
||||
error->all(FLERR,"Must read Atoms before Velocities");
|
||||
if (firstpass) velocities();
|
||||
else skip_lines(atom->natoms);
|
||||
else skip_lines(natoms);
|
||||
|
||||
} else if (strcmp(keyword,"Bonds") == 0) {
|
||||
topoflag = bondflag = 1;
|
||||
if (atom->nbonds == 0)
|
||||
if (nbonds == 0)
|
||||
error->all(FLERR,"Invalid data file section: Bonds");
|
||||
if (atomflag == 0) error->all(FLERR,"Must read Atoms before Bonds");
|
||||
bonds(firstpass);
|
||||
} else if (strcmp(keyword,"Angles") == 0) {
|
||||
topoflag = angleflag = 1;
|
||||
if (atom->nangles == 0)
|
||||
if (nangles == 0)
|
||||
error->all(FLERR,"Invalid data file section: Angles");
|
||||
if (atomflag == 0) error->all(FLERR,"Must read Atoms before Angles");
|
||||
angles(firstpass);
|
||||
} else if (strcmp(keyword,"Dihedrals") == 0) {
|
||||
topoflag = dihedralflag = 1;
|
||||
if (atom->ndihedrals == 0)
|
||||
if (ndihedrals == 0)
|
||||
error->all(FLERR,"Invalid data file section: Dihedrals");
|
||||
if (atomflag == 0) error->all(FLERR,"Must read Atoms before Dihedrals");
|
||||
dihedrals(firstpass);
|
||||
} else if (strcmp(keyword,"Impropers") == 0) {
|
||||
topoflag = improperflag = 1;
|
||||
if (atom->nimpropers == 0)
|
||||
if (nimpropers == 0)
|
||||
error->all(FLERR,"Invalid data file section: Impropers");
|
||||
if (atomflag == 0) error->all(FLERR,"Must read Atoms before Impropers");
|
||||
impropers(firstpass);
|
||||
@ -325,7 +464,7 @@ void ReadData::command(int narg, char **arg)
|
||||
|
||||
} else if (strcmp(keyword,"Masses") == 0) {
|
||||
if (firstpass) mass();
|
||||
else skip_lines(atom->ntypes);
|
||||
else skip_lines(ntypes);
|
||||
} else if (strcmp(keyword,"Pair Coeffs") == 0) {
|
||||
if (force->pair == NULL)
|
||||
error->all(FLERR,"Must define pair_style before Pair Coeffs");
|
||||
@ -334,7 +473,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->warning(FLERR,"Pair style in data file differs "
|
||||
"from currently defined pair style");
|
||||
paircoeffs();
|
||||
} else skip_lines(atom->ntypes);
|
||||
} else skip_lines(ntypes);
|
||||
} else if (strcmp(keyword,"PairIJ Coeffs") == 0) {
|
||||
if (force->pair == NULL)
|
||||
error->all(FLERR,"Must define pair_style before PairIJ Coeffs");
|
||||
@ -343,7 +482,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->warning(FLERR,"Pair style in data file differs "
|
||||
"from currently defined pair style");
|
||||
pairIJcoeffs();
|
||||
} else skip_lines(atom->ntypes*(atom->ntypes+1)/2);
|
||||
} else skip_lines(ntypes*(ntypes+1)/2);
|
||||
} else if (strcmp(keyword,"Bond Coeffs") == 0) {
|
||||
if (atom->avec->bonds_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: Bond Coeffs");
|
||||
@ -354,7 +493,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->warning(FLERR,"Bond style in data file differs "
|
||||
"from currently defined bond style");
|
||||
bondcoeffs();
|
||||
} else skip_lines(atom->nbondtypes);
|
||||
} else skip_lines(nbondtypes);
|
||||
} else if (strcmp(keyword,"Angle Coeffs") == 0) {
|
||||
if (atom->avec->angles_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: Angle Coeffs");
|
||||
@ -365,7 +504,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->warning(FLERR,"Angle style in data file differs "
|
||||
"from currently defined angle style");
|
||||
anglecoeffs(0);
|
||||
} else skip_lines(atom->nangletypes);
|
||||
} else skip_lines(nangletypes);
|
||||
} else if (strcmp(keyword,"Dihedral Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: Dihedral Coeffs");
|
||||
@ -376,7 +515,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->warning(FLERR,"Dihedral style in data file differs "
|
||||
"from currently defined dihedral style");
|
||||
dihedralcoeffs(0);
|
||||
} else skip_lines(atom->ndihedraltypes);
|
||||
} else skip_lines(ndihedraltypes);
|
||||
} else if (strcmp(keyword,"Improper Coeffs") == 0) {
|
||||
if (atom->avec->impropers_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: Improper Coeffs");
|
||||
@ -387,7 +526,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->warning(FLERR,"Improper style in data file differs "
|
||||
"from currently defined improper style");
|
||||
impropercoeffs(0);
|
||||
} else skip_lines(atom->nimpropertypes);
|
||||
} else skip_lines(nimpropertypes);
|
||||
|
||||
} else if (strcmp(keyword,"BondBond Coeffs") == 0) {
|
||||
if (atom->avec->angles_allow == 0)
|
||||
@ -395,14 +534,14 @@ void ReadData::command(int narg, char **arg)
|
||||
if (force->angle == NULL)
|
||||
error->all(FLERR,"Must define angle_style before BondBond Coeffs");
|
||||
if (firstpass) anglecoeffs(1);
|
||||
else skip_lines(atom->nangletypes);
|
||||
else skip_lines(nangletypes);
|
||||
} else if (strcmp(keyword,"BondAngle Coeffs") == 0) {
|
||||
if (atom->avec->angles_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: BondAngle Coeffs");
|
||||
if (force->angle == NULL)
|
||||
error->all(FLERR,"Must define angle_style before BondAngle Coeffs");
|
||||
if (firstpass) anglecoeffs(2);
|
||||
else skip_lines(atom->nangletypes);
|
||||
else skip_lines(nangletypes);
|
||||
|
||||
} else if (strcmp(keyword,"MiddleBondTorsion Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
@ -413,7 +552,7 @@ void ReadData::command(int narg, char **arg)
|
||||
"Must define dihedral_style before "
|
||||
"MiddleBondTorsion Coeffs");
|
||||
if (firstpass) dihedralcoeffs(1);
|
||||
else skip_lines(atom->ndihedraltypes);
|
||||
else skip_lines(ndihedraltypes);
|
||||
} else if (strcmp(keyword,"EndBondTorsion Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: EndBondTorsion Coeffs");
|
||||
@ -421,7 +560,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR,
|
||||
"Must define dihedral_style before EndBondTorsion Coeffs");
|
||||
if (firstpass) dihedralcoeffs(2);
|
||||
else skip_lines(atom->ndihedraltypes);
|
||||
else skip_lines(ndihedraltypes);
|
||||
} else if (strcmp(keyword,"AngleTorsion Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: AngleTorsion Coeffs");
|
||||
@ -429,7 +568,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR,
|
||||
"Must define dihedral_style before AngleTorsion Coeffs");
|
||||
if (firstpass) dihedralcoeffs(3);
|
||||
else skip_lines(atom->ndihedraltypes);
|
||||
else skip_lines(ndihedraltypes);
|
||||
} else if (strcmp(keyword,"AngleAngleTorsion Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,
|
||||
@ -439,7 +578,7 @@ void ReadData::command(int narg, char **arg)
|
||||
"Must define dihedral_style before "
|
||||
"AngleAngleTorsion Coeffs");
|
||||
if (firstpass) dihedralcoeffs(4);
|
||||
else skip_lines(atom->ndihedraltypes);
|
||||
else skip_lines(ndihedraltypes);
|
||||
} else if (strcmp(keyword,"BondBond13 Coeffs") == 0) {
|
||||
if (atom->avec->dihedrals_allow == 0)
|
||||
error->all(FLERR,"Invalid data file section: BondBond13 Coeffs");
|
||||
@ -447,7 +586,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR,
|
||||
"Must define dihedral_style before BondBond13 Coeffs");
|
||||
if (firstpass) dihedralcoeffs(5);
|
||||
else skip_lines(atom->ndihedraltypes);
|
||||
else skip_lines(ndihedraltypes);
|
||||
|
||||
} else if (strcmp(keyword,"AngleAngle Coeffs") == 0) {
|
||||
if (atom->avec->impropers_allow == 0)
|
||||
@ -456,7 +595,7 @@ void ReadData::command(int narg, char **arg)
|
||||
error->all(FLERR,
|
||||
"Must define improper_style before AngleAngle Coeffs");
|
||||
if (firstpass) impropercoeffs(1);
|
||||
else skip_lines(atom->nimpropertypes);
|
||||
else skip_lines(nimpropertypes);
|
||||
|
||||
} else {
|
||||
char str[128];
|
||||
@ -469,7 +608,7 @@ void ReadData::command(int narg, char **arg)
|
||||
|
||||
// error if natoms > 0 yet no atoms were read
|
||||
|
||||
if (atom->natoms > 0 && atomflag == 0)
|
||||
if (natoms > 0 && atomflag == 0)
|
||||
error->all(FLERR,"No atoms in data file");
|
||||
|
||||
// close file
|
||||
@ -486,9 +625,8 @@ void ReadData::command(int narg, char **arg)
|
||||
// at end of 1st pass, error check for required sections
|
||||
// customize for new sections
|
||||
|
||||
if ((atom->nbonds && !bondflag) || (atom->nangles && !angleflag) ||
|
||||
(atom->ndihedrals && !dihedralflag) ||
|
||||
(atom->nimpropers && !improperflag))
|
||||
if ((nbonds && !bondflag) || (nangles && !angleflag) ||
|
||||
(ndihedrals && !dihedralflag) || (nimpropers && !improperflag))
|
||||
error->one(FLERR,"Needed molecular topology not in data file");
|
||||
|
||||
if ((nellipsoids && !ellipsoidflag) || (nlines && !lineflag) ||
|
||||
@ -510,6 +648,15 @@ void ReadData::command(int narg, char **arg)
|
||||
atom->avec->grow(atom->nmax);
|
||||
}
|
||||
|
||||
// assign atoms added by this data file to specified group
|
||||
|
||||
if (groupbit) {
|
||||
int *mask = atom->mask;
|
||||
int nlocal = atom->nlocal;
|
||||
for (int i = nlocal_previous; i < nlocal; i++)
|
||||
mask[i] |= groupbit;
|
||||
}
|
||||
|
||||
// create special bond lists for molecular systems
|
||||
|
||||
if (atom->molecular == 1) {
|
||||
@ -590,6 +737,19 @@ void ReadData::command(int narg, char **arg)
|
||||
|
||||
if (atom->molecular == 2) atom->avec->onemols[0]->check_attributes(1);
|
||||
|
||||
// if adding atoms, migrate atoms to new processors
|
||||
// use irregular() b/c box size could have changed dramaticaly
|
||||
// resulting in procs now owning very different subboxes
|
||||
// with their previously owned atoms now far outside the subbox
|
||||
|
||||
if (addflag != NONE) {
|
||||
if (domain->triclinic) domain->x2lamda(atom->nlocal);
|
||||
Irregular *irregular = new Irregular(lmp);
|
||||
irregular->migrate_atoms(1);
|
||||
delete irregular;
|
||||
if (domain->triclinic) domain->lamda2x(atom->nlocal);
|
||||
}
|
||||
|
||||
// shrink-wrap the box if necessary and move atoms to new procs
|
||||
// if atoms are lost is b/c data file box was far from shrink-wrapped
|
||||
// do not use irregular() comm, which would not lose atoms,
|
||||
@ -621,6 +781,7 @@ void ReadData::command(int narg, char **arg)
|
||||
header ends with EOF or non-blank line containing no header keyword
|
||||
if EOF, line is set to blank line
|
||||
else line has first keyword line for rest of file
|
||||
some logic differs if adding atoms
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadData::header()
|
||||
@ -648,7 +809,7 @@ void ReadData::header()
|
||||
|
||||
while (1) {
|
||||
|
||||
// read a line and bcast length if flag is set
|
||||
// read a line and bcast length
|
||||
|
||||
if (me == 0) {
|
||||
if (fgets(line,MAXLINE,fp) == NULL) n = 0;
|
||||
@ -689,7 +850,9 @@ void ReadData::header()
|
||||
// customize for new header lines
|
||||
|
||||
if (strstr(line,"atoms")) {
|
||||
sscanf(line,BIGINT_FORMAT,&atom->natoms);
|
||||
sscanf(line,BIGINT_FORMAT,&natoms);
|
||||
if (addflag == NONE) atom->natoms = natoms;
|
||||
else atom->natoms += natoms;
|
||||
|
||||
// check for these first
|
||||
// otherwise "triangles" will be matched as "angles"
|
||||
@ -710,52 +873,70 @@ void ReadData::header()
|
||||
if (!avec_body)
|
||||
error->all(FLERR,"No bodies allowed with this atom style");
|
||||
sscanf(line,BIGINT_FORMAT,&nbodies);
|
||||
}
|
||||
|
||||
else if (strstr(line,"bonds")) sscanf(line,BIGINT_FORMAT,&atom->nbonds);
|
||||
else if (strstr(line,"angles")) sscanf(line,BIGINT_FORMAT,&atom->nangles);
|
||||
else if (strstr(line,"dihedrals")) sscanf(line,BIGINT_FORMAT,
|
||||
&atom->ndihedrals);
|
||||
else if (strstr(line,"impropers")) sscanf(line,BIGINT_FORMAT,
|
||||
&atom->nimpropers);
|
||||
} else if (strstr(line,"bonds")) {
|
||||
sscanf(line,BIGINT_FORMAT,&nbonds);
|
||||
if (addflag == NONE) atom->nbonds = nbonds;
|
||||
else atom->nbonds += nbonds;
|
||||
} else if (strstr(line,"angles")) {
|
||||
sscanf(line,BIGINT_FORMAT,&nangles);
|
||||
if (addflag == NONE) atom->nangles = nangles;
|
||||
else atom->nangles += nangles;
|
||||
} else if (strstr(line,"dihedrals")) {
|
||||
sscanf(line,BIGINT_FORMAT,&ndihedrals);
|
||||
if (addflag == NONE) atom->ndihedrals = ndihedrals;
|
||||
else atom->ndihedrals += natoms;
|
||||
} else if (strstr(line,"impropers")) {
|
||||
sscanf(line,BIGINT_FORMAT,&nimpropers);
|
||||
if (addflag == NONE) atom->nimpropers = nimpropers;
|
||||
else atom->nimpropers += nimpropers;
|
||||
|
||||
// Atom class type settings are only set by first data file
|
||||
|
||||
else if (strstr(line,"atom types")) sscanf(line,"%d",&atom->ntypes);
|
||||
else if (strstr(line,"bond types")) sscanf(line,"%d",&atom->nbondtypes);
|
||||
else if (strstr(line,"angle types")) sscanf(line,"%d",&atom->nangletypes);
|
||||
else if (strstr(line,"dihedral types"))
|
||||
sscanf(line,"%d",&atom->ndihedraltypes);
|
||||
else if (strstr(line,"improper types"))
|
||||
sscanf(line,"%d",&atom->nimpropertypes);
|
||||
} else if (strstr(line,"atom types")) {
|
||||
sscanf(line,"%d",&ntypes);
|
||||
if (addflag == NONE) atom->ntypes = ntypes + extra_atom_types;
|
||||
} else if (strstr(line,"bond types")) {
|
||||
sscanf(line,"%d",&nbondtypes);
|
||||
if (addflag == NONE) atom->nbondtypes = nbondtypes + extra_bond_types;
|
||||
} else if (strstr(line,"angle types")) {
|
||||
sscanf(line,"%d",&nangletypes);
|
||||
if (addflag == NONE) atom->nangletypes = nangletypes + extra_angle_types;
|
||||
} else if (strstr(line,"dihedral types")) {
|
||||
sscanf(line,"%d",&ndihedraltypes);
|
||||
if (addflag == NONE)
|
||||
atom->ndihedraltypes = ndihedraltypes + extra_dihedral_types;
|
||||
} else if (strstr(line,"improper types")) {
|
||||
sscanf(line,"%d",&nimpropertypes);
|
||||
if (addflag == NONE)
|
||||
atom->nimpropertypes = nimpropertypes + extra_improper_types;
|
||||
|
||||
else if (strstr(line,"extra bond per atom"))
|
||||
sscanf(line,"%d",&atom->extra_bond_per_atom);
|
||||
else if (strstr(line,"extra angle per atom"))
|
||||
sscanf(line,"%d",&atom->extra_angle_per_atom);
|
||||
else if (strstr(line,"extra dihedral per atom"))
|
||||
sscanf(line,"%d",&atom->extra_dihedral_per_atom);
|
||||
else if (strstr(line,"extra improper per atom"))
|
||||
sscanf(line,"%d",&atom->extra_improper_per_atom);
|
||||
else if (strstr(line,"extra special per atom"))
|
||||
sscanf(line,"%d",&force->special_extra);
|
||||
// these settings only used by first data file
|
||||
|
||||
else if (strstr(line,"extra bonds per atom"))
|
||||
sscanf(line,"%d",&atom->extra_bond_per_atom);
|
||||
else if (strstr(line,"extra angles per atom"))
|
||||
sscanf(line,"%d",&atom->extra_angle_per_atom);
|
||||
else if (strstr(line,"extra dihedrals per atom"))
|
||||
sscanf(line,"%d",&atom->extra_dihedral_per_atom);
|
||||
else if (strstr(line,"extra impropers per atom"))
|
||||
sscanf(line,"%d",&atom->extra_improper_per_atom);
|
||||
} else if (strstr(line,"extra bond per atom")) {
|
||||
if (addflag == NONE) sscanf(line,"%d",&atom->extra_bond_per_atom);
|
||||
} else if (strstr(line,"extra angle per atom")) {
|
||||
if (addflag == NONE) sscanf(line,"%d",&atom->extra_angle_per_atom);
|
||||
} else if (strstr(line,"extra dihedral per atom")) {
|
||||
if (addflag == NONE) sscanf(line,"%d",&atom->extra_dihedral_per_atom);
|
||||
} else if (strstr(line,"extra improper per atom")) {
|
||||
if (addflag == NONE) sscanf(line,"%d",&atom->extra_improper_per_atom);
|
||||
} else if (strstr(line,"extra special per atom")) {
|
||||
if (addflag == NONE) sscanf(line,"%d",&force->special_extra);
|
||||
|
||||
// local copy of box info
|
||||
// so can treat differently for first vs subsequent data files
|
||||
|
||||
} else if (strstr(line,"xlo xhi")) {
|
||||
sscanf(line,"%lg %lg",&boxlo[0],&boxhi[0]);
|
||||
} else if (strstr(line,"ylo yhi")) {
|
||||
sscanf(line,"%lg %lg",&boxlo[1],&boxhi[1]);
|
||||
} else if (strstr(line,"zlo zhi")) {
|
||||
sscanf(line,"%lg %lg",&boxlo[2],&boxhi[2]);
|
||||
} else if (strstr(line,"xy xz yz")) {
|
||||
triclinic = 1;
|
||||
sscanf(line,"%lg %lg %lg",&xy,&xz,&yz);
|
||||
|
||||
else if (strstr(line,"xlo xhi"))
|
||||
sscanf(line,"%lg %lg",&domain->boxlo[0],&domain->boxhi[0]);
|
||||
else if (strstr(line,"ylo yhi"))
|
||||
sscanf(line,"%lg %lg",&domain->boxlo[1],&domain->boxhi[1]);
|
||||
else if (strstr(line,"zlo zhi"))
|
||||
sscanf(line,"%lg %lg",&domain->boxlo[2],&domain->boxhi[2]);
|
||||
else if (strstr(line,"xy xz yz")) {
|
||||
domain->triclinic = 1;
|
||||
sscanf(line,"%lg %lg %lg",&domain->xy,&domain->xz,&domain->yz);
|
||||
} else break;
|
||||
}
|
||||
|
||||
@ -824,27 +1005,28 @@ void ReadData::atoms()
|
||||
}
|
||||
|
||||
bigint nread = 0;
|
||||
bigint natoms = atom->natoms;
|
||||
|
||||
while (nread < natoms) {
|
||||
nchunk = MIN(natoms-nread,CHUNK);
|
||||
eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
atom->data_atoms(nchunk,buffer);
|
||||
atom->data_atoms(nchunk,buffer,id_offset,toffset,shiftflag,shift);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
// check that all atoms were assigned correctly
|
||||
|
||||
bigint tmp = atom->nlocal;
|
||||
MPI_Allreduce(&tmp,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
bigint n = atom->nlocal;
|
||||
bigint sum;
|
||||
MPI_Allreduce(&n,&sum,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||
bigint nassign = sum - (atom->natoms - natoms);
|
||||
|
||||
if (me == 0) {
|
||||
if (screen) fprintf(screen," " BIGINT_FORMAT " atoms\n",natoms);
|
||||
if (logfile) fprintf(logfile," " BIGINT_FORMAT " atoms\n",natoms);
|
||||
if (screen) fprintf(screen," " BIGINT_FORMAT " atoms\n",nassign);
|
||||
if (logfile) fprintf(logfile," " BIGINT_FORMAT " atoms\n",nassign);
|
||||
}
|
||||
|
||||
if (natoms != atom->natoms)
|
||||
if (sum != atom->natoms)
|
||||
error->all(FLERR,"Did not assign all atoms correctly");
|
||||
|
||||
// check that atom IDs are valid
|
||||
@ -881,13 +1063,12 @@ void ReadData::velocities()
|
||||
}
|
||||
|
||||
bigint nread = 0;
|
||||
bigint natoms = atom->natoms;
|
||||
|
||||
while (nread < natoms) {
|
||||
nchunk = MIN(natoms-nread,CHUNK);
|
||||
eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
atom->data_vels(nchunk,buffer);
|
||||
atom->data_vels(nchunk,buffer,id_offset);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
@ -937,7 +1118,7 @@ void ReadData::bonds(int firstpass)
|
||||
nchunk = MIN(nbonds-nread,CHUNK);
|
||||
eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
atom->data_bonds(nchunk,buffer,count);
|
||||
atom->data_bonds(nchunk,buffer,count,id_offset);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
@ -1012,7 +1193,7 @@ void ReadData::angles(int firstpass)
|
||||
nchunk = MIN(nangles-nread,CHUNK);
|
||||
eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
atom->data_angles(nchunk,buffer,count);
|
||||
atom->data_angles(nchunk,buffer,count,id_offset);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
@ -1087,7 +1268,7 @@ void ReadData::dihedrals(int firstpass)
|
||||
nchunk = MIN(ndihedrals-nread,CHUNK);
|
||||
eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
atom->data_dihedrals(nchunk,buffer,count);
|
||||
atom->data_dihedrals(nchunk,buffer,count,id_offset);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
@ -1162,7 +1343,7 @@ void ReadData::impropers(int firstpass)
|
||||
nchunk = MIN(nimpropers-nread,CHUNK);
|
||||
eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
atom->data_impropers(nchunk,buffer,count);
|
||||
atom->data_impropers(nchunk,buffer,count,id_offset);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
@ -1225,7 +1406,7 @@ void ReadData::bonus(bigint nbonus, AtomVec *ptr, const char *type)
|
||||
nchunk = MIN(natoms-nread,CHUNK);
|
||||
eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
atom->data_bonus(nchunk,buffer,ptr);
|
||||
atom->data_bonus(nchunk,buffer,ptr,id_offset);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
@ -1305,7 +1486,7 @@ void ReadData::bodies(int firstpass)
|
||||
MPI_Bcast(&m,1,MPI_INT,0,world);
|
||||
MPI_Bcast(buffer,m,MPI_CHAR,0,world);
|
||||
|
||||
if (firstpass) atom->data_bodies(nchunk,buffer,avec_body);
|
||||
if (firstpass) atom->data_bodies(nchunk,buffer,avec_body,id_offset);
|
||||
nread += nchunk;
|
||||
}
|
||||
|
||||
@ -1325,16 +1506,16 @@ void ReadData::bodies(int firstpass)
|
||||
void ReadData::mass()
|
||||
{
|
||||
char *next;
|
||||
char *buf = new char[atom->ntypes*MAXLINE];
|
||||
char *buf = new char[ntypes*MAXLINE];
|
||||
|
||||
int eof = comm->read_lines_from_file(fp,atom->ntypes,MAXLINE,buf);
|
||||
int eof = comm->read_lines_from_file(fp,ntypes,MAXLINE,buf);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
|
||||
char *original = buf;
|
||||
for (int i = 0; i < atom->ntypes; i++) {
|
||||
for (int i = 0; i < ntypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
atom->set_mass(buf);
|
||||
atom->set_mass(buf,toffset);
|
||||
buf = next + 1;
|
||||
}
|
||||
delete [] original;
|
||||
@ -1345,16 +1526,16 @@ void ReadData::mass()
|
||||
void ReadData::paircoeffs()
|
||||
{
|
||||
char *next;
|
||||
char *buf = new char[atom->ntypes*MAXLINE];
|
||||
char *buf = new char[ntypes*MAXLINE];
|
||||
|
||||
int eof = comm->read_lines_from_file(fp,atom->ntypes,MAXLINE,buf);
|
||||
int eof = comm->read_lines_from_file(fp,ntypes,MAXLINE,buf);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
|
||||
char *original = buf;
|
||||
for (int i = 0; i < atom->ntypes; i++) {
|
||||
for (int i = 0; i < ntypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
parse_coeffs(buf,NULL,1);
|
||||
parse_coeffs(buf,NULL,1,2,toffset);
|
||||
if (narg == 0) error->all(FLERR,"Unexpected end of PairCoeffs section");
|
||||
force->pair->coeff(narg,arg);
|
||||
buf = next + 1;
|
||||
@ -1369,18 +1550,18 @@ void ReadData::pairIJcoeffs()
|
||||
int i,j;
|
||||
char *next;
|
||||
|
||||
int nsq = atom->ntypes* (atom->ntypes+1) / 2;
|
||||
int nsq = ntypes * (ntypes+1) / 2;
|
||||
char *buf = new char[nsq * MAXLINE];
|
||||
|
||||
int eof = comm->read_lines_from_file(fp,nsq,MAXLINE,buf);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
|
||||
char *original = buf;
|
||||
for (i = 0; i < atom->ntypes; i++)
|
||||
for (j = i; j < atom->ntypes; j++) {
|
||||
for (i = 0; i < ntypes; i++)
|
||||
for (j = i; j < ntypes; j++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
parse_coeffs(buf,NULL,0);
|
||||
parse_coeffs(buf,NULL,0,2,toffset);
|
||||
if (narg == 0) error->all(FLERR,"Unexpected end of PairCoeffs section");
|
||||
force->pair->coeff(narg,arg);
|
||||
buf = next + 1;
|
||||
@ -1393,16 +1574,16 @@ void ReadData::pairIJcoeffs()
|
||||
void ReadData::bondcoeffs()
|
||||
{
|
||||
char *next;
|
||||
char *buf = new char[atom->nbondtypes*MAXLINE];
|
||||
char *buf = new char[nbondtypes*MAXLINE];
|
||||
|
||||
int eof = comm->read_lines_from_file(fp,atom->nbondtypes,MAXLINE,buf);
|
||||
int eof = comm->read_lines_from_file(fp,nbondtypes,MAXLINE,buf);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
|
||||
char *original = buf;
|
||||
for (int i = 0; i < atom->nbondtypes; i++) {
|
||||
for (int i = 0; i < nbondtypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
parse_coeffs(buf,NULL,0);
|
||||
parse_coeffs(buf,NULL,0,1,boffset);
|
||||
if (narg == 0) error->all(FLERR,"Unexpected end of BondCoeffs section");
|
||||
force->bond->coeff(narg,arg);
|
||||
buf = next + 1;
|
||||
@ -1415,18 +1596,18 @@ void ReadData::bondcoeffs()
|
||||
void ReadData::anglecoeffs(int which)
|
||||
{
|
||||
char *next;
|
||||
char *buf = new char[atom->nangletypes*MAXLINE];
|
||||
char *buf = new char[nangletypes*MAXLINE];
|
||||
|
||||
int eof = comm->read_lines_from_file(fp,atom->nangletypes,MAXLINE,buf);
|
||||
int eof = comm->read_lines_from_file(fp,nangletypes,MAXLINE,buf);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
|
||||
char *original = buf;
|
||||
for (int i = 0; i < atom->nangletypes; i++) {
|
||||
for (int i = 0; i < nangletypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
if (which == 0) parse_coeffs(buf,NULL,0);
|
||||
else if (which == 1) parse_coeffs(buf,"bb",0);
|
||||
else if (which == 2) parse_coeffs(buf,"ba",0);
|
||||
if (which == 0) parse_coeffs(buf,NULL,0,1,aoffset);
|
||||
else if (which == 1) parse_coeffs(buf,"bb",0,1,aoffset);
|
||||
else if (which == 2) parse_coeffs(buf,"ba",0,1,aoffset);
|
||||
if (narg == 0) error->all(FLERR,"Unexpected end of AngleCoeffs section");
|
||||
force->angle->coeff(narg,arg);
|
||||
buf = next + 1;
|
||||
@ -1439,21 +1620,21 @@ void ReadData::anglecoeffs(int which)
|
||||
void ReadData::dihedralcoeffs(int which)
|
||||
{
|
||||
char *next;
|
||||
char *buf = new char[atom->ndihedraltypes*MAXLINE];
|
||||
char *buf = new char[ndihedraltypes*MAXLINE];
|
||||
|
||||
int eof = comm->read_lines_from_file(fp,atom->ndihedraltypes,MAXLINE,buf);
|
||||
int eof = comm->read_lines_from_file(fp,ndihedraltypes,MAXLINE,buf);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
|
||||
char *original = buf;
|
||||
for (int i = 0; i < atom->ndihedraltypes; i++) {
|
||||
for (int i = 0; i < ndihedraltypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
if (which == 0) parse_coeffs(buf,NULL,0);
|
||||
else if (which == 1) parse_coeffs(buf,"mbt",0);
|
||||
else if (which == 2) parse_coeffs(buf,"ebt",0);
|
||||
else if (which == 3) parse_coeffs(buf,"at",0);
|
||||
else if (which == 4) parse_coeffs(buf,"aat",0);
|
||||
else if (which == 5) parse_coeffs(buf,"bb13",0);
|
||||
if (which == 0) parse_coeffs(buf,NULL,0,1,doffset);
|
||||
else if (which == 1) parse_coeffs(buf,"mbt",0,1,doffset);
|
||||
else if (which == 2) parse_coeffs(buf,"ebt",0,1,doffset);
|
||||
else if (which == 3) parse_coeffs(buf,"at",0,1,doffset);
|
||||
else if (which == 4) parse_coeffs(buf,"aat",0,1,doffset);
|
||||
else if (which == 5) parse_coeffs(buf,"bb13",0,1,doffset);
|
||||
if (narg == 0) error->all(FLERR,"Unexpected end of DihedralCoeffs section");
|
||||
force->dihedral->coeff(narg,arg);
|
||||
buf = next + 1;
|
||||
@ -1466,17 +1647,17 @@ void ReadData::dihedralcoeffs(int which)
|
||||
void ReadData::impropercoeffs(int which)
|
||||
{
|
||||
char *next;
|
||||
char *buf = new char[atom->nimpropertypes*MAXLINE];
|
||||
char *buf = new char[nimpropertypes*MAXLINE];
|
||||
|
||||
int eof = comm->read_lines_from_file(fp,atom->nimpropertypes,MAXLINE,buf);
|
||||
int eof = comm->read_lines_from_file(fp,nimpropertypes,MAXLINE,buf);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
|
||||
char *original = buf;
|
||||
for (int i = 0; i < atom->nimpropertypes; i++) {
|
||||
for (int i = 0; i < nimpropertypes; i++) {
|
||||
next = strchr(buf,'\n');
|
||||
*next = '\0';
|
||||
if (which == 0) parse_coeffs(buf,NULL,0);
|
||||
else if (which == 1) parse_coeffs(buf,"aa",0);
|
||||
if (which == 0) parse_coeffs(buf,NULL,0,1,ioffset);
|
||||
else if (which == 1) parse_coeffs(buf,"aa",0,1,ioffset);
|
||||
if (narg == 0) error->all(FLERR,"Unexpected end of ImproperCoeffs section");
|
||||
force->improper->coeff(narg,arg);
|
||||
buf = next + 1;
|
||||
@ -1500,7 +1681,7 @@ void ReadData::fix(int ifix, char *keyword)
|
||||
nchunk = MIN(nline-nread,CHUNK);
|
||||
eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer);
|
||||
if (eof) error->all(FLERR,"Unexpected end of data file");
|
||||
modify->fix[ifix]->read_data_section(keyword,nchunk,buffer);
|
||||
modify->fix[ifix]->read_data_section(keyword,nchunk,buffer,id_offset);
|
||||
nread += nchunk;
|
||||
}
|
||||
}
|
||||
@ -1643,9 +1824,11 @@ void ReadData::skip_lines(bigint n)
|
||||
if 2nd word starts with letter, then is hybrid style, add addstr after it
|
||||
else add addstr before 2nd word
|
||||
if dupflag, duplicate 1st word, so pair_coeff "2" becomes "2 2"
|
||||
if noffset, add offset to first noffset args, which are atom/bond/etc types
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ReadData::parse_coeffs(char *line, const char *addstr, int dupflag)
|
||||
void ReadData::parse_coeffs(char *line, const char *addstr,
|
||||
int dupflag, int noffset, int offset)
|
||||
{
|
||||
char *ptr;
|
||||
if ((ptr = strchr(line,'#'))) *ptr = '\0';
|
||||
@ -1664,6 +1847,17 @@ void ReadData::parse_coeffs(char *line, const char *addstr, int dupflag)
|
||||
if (dupflag && narg == 1) arg[narg++] = word;
|
||||
word = strtok(NULL," \t\n\r\f");
|
||||
}
|
||||
|
||||
if (noffset) {
|
||||
int value = force->inumeric(FLERR,arg[0]);
|
||||
sprintf(argoffset1,"%d",value+offset);
|
||||
arg[0] = argoffset1;
|
||||
if (noffset == 2) {
|
||||
value = force->inumeric(FLERR,arg[1]);
|
||||
sprintf(argoffset2,"%d",value+offset);
|
||||
arg[1] = argoffset2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -32,19 +32,19 @@ class ReadData : protected Pointers {
|
||||
void command(int, char **);
|
||||
|
||||
private:
|
||||
int me,compressed;
|
||||
char *line,*keyword,*buffer,*style;
|
||||
FILE *fp;
|
||||
char **arg;
|
||||
int me,narg,maxarg,compressed;
|
||||
int narg,maxarg;
|
||||
char argoffset1[8],argoffset2[8];
|
||||
|
||||
// optional args
|
||||
bigint id_offset;
|
||||
|
||||
int addflag,mergeflag;
|
||||
double offset[3];
|
||||
int nfix;
|
||||
int *fix_index;
|
||||
char **fix_header;
|
||||
char **fix_section;
|
||||
bigint natoms;
|
||||
bigint nbonds,nangles,ndihedrals,nimpropers;
|
||||
int ntypes;
|
||||
int nbondtypes,nangletypes,ndihedraltypes,nimpropertypes;
|
||||
|
||||
bigint nellipsoids;
|
||||
class AtomVecEllipsoid *avec_ellipsoid;
|
||||
@ -55,13 +55,36 @@ class ReadData : protected Pointers {
|
||||
bigint nbodies;
|
||||
class AtomVecBody *avec_body;
|
||||
|
||||
// box info
|
||||
|
||||
double boxlo[3],boxhi[3];
|
||||
double xy,xz,yz;
|
||||
int triclinic;
|
||||
|
||||
// optional args
|
||||
|
||||
int addflag,offsetflag,shiftflag;
|
||||
tagint addvalue;
|
||||
int toffset,boffset,aoffset,doffset,ioffset;
|
||||
double shift[3];
|
||||
int extra_atom_types,extra_bond_types,extra_angle_types;
|
||||
int extra_dihedral_types,extra_improper_types;
|
||||
int groupbit;
|
||||
|
||||
int nfix;
|
||||
int *fix_index;
|
||||
char **fix_header;
|
||||
char **fix_section;
|
||||
|
||||
// methods
|
||||
|
||||
void open(char *);
|
||||
void scan(int &, int &, int &, int &);
|
||||
int reallocate(int **, int, int);
|
||||
void header();
|
||||
void parse_keyword(int);
|
||||
void skip_lines(bigint);
|
||||
void parse_coeffs(char *, const char *, int);
|
||||
void parse_coeffs(char *, const char *, int, int, int);
|
||||
int style_match(const char *, const char *);
|
||||
|
||||
void atoms();
|
||||
|
||||
@ -1 +1 @@
|
||||
#define LAMMPS_VERSION "17 Jul 2015"
|
||||
#define LAMMPS_VERSION "18 Jul 2015"
|
||||
|
||||
Reference in New Issue
Block a user