modified doc page, added examples

This commit is contained in:
Steve Plimpton
2024-05-06 16:44:45 -06:00
parent 25a9bf1ff6
commit a4449fb6ff
24 changed files with 2015 additions and 163 deletions

View File

@ -8,86 +8,118 @@ Syntax
.. code-block:: LAMMPS .. code-block:: LAMMPS
replicate nx ny nz *keyword* replicate nx ny nz *keyword* ...
nx,ny,nz = replication factors in each dimension nx,ny,nz = replication factors in each dimension
* optional *keyword* = *bbox* or *bondlist* * zero or more keywords may be appended
* keyword = *bbox* or *bond/periodic*
.. parsed-literal:: .. parsed-literal::
*bbox* = only check atoms in replicas that overlap with a processor's subdomain *bbox* = only check atoms in replicas that overlap with a processor's subdomain
*bondlist* = use a generalized algorithm that correctly replicates periodic loops *bond/periodic* = use a different algorithm that correctly replicates periodic bond loops
Examples Examples
"""""""" """"""""
For an example of replicating periodically looped carbon nanotubes, see examples/replicate. For examples of replicating simple linear polymer chains (periodic or
non-periodic) or periodic carbon nanotubes, see examples/replicate.
.. code-block:: LAMMPS .. code-block:: LAMMPS
replicate 2 3 2 replicate 2 3 2
replicate 2 3 2 bbox
replicate 2 3 2 bond/periodic
Description Description
""""""""""" """""""""""
Replicate the current simulation one or more times in each dimension. Replicate the current system one or more times in each dimension. For
For example, replication factors of 2,2,2 will create a simulation example, replication factors of 2,2,2 will create a simulation with 8x
with 8x as many atoms by doubling the simulation domain in each as many atoms by doubling the size of the simulation box in each
dimension. A replication factor of 1 in a dimension leaves the dimension. A replication factor of 1 leaves the simulation domain
simulation domain unchanged. When the new simulation box is created unchanged in that dimension.
it is also partitioned into a regular 3d grid of rectangular bricks,
one per processor, based on the number of processors being used and
the settings of the :doc:`processors <processors>` command. The
partitioning can later be changed by the :doc:`balance <balance>` or
:doc:`fix balance <fix_balance>` commands.
All properties of the atoms are replicated, including their When the new simulation box is created it is partitioned into a
velocities, which may or may not be desirable. New atom IDs are regular 3d grid of rectangular bricks, one per processor, based on the
assigned to new atoms, as are molecule IDs. Bonds and other topology number of processors being used and the settings of the
interactions are created between pairs of new atoms as well as between :doc:`processors <processors>` command. The partitioning can be
old and new atoms. This is done by using the image flag for each atom changed by subsequent :doc:`balance <balance>` or :doc:`fix balance
to "unwrap" it out of the periodic box before replicating it. <fix_balance>` commands.
This means that any molecular bond you specify in the original data All properties of each atom are replicated (except per-atom fix data,
file that crosses a periodic boundary should be between two atoms with see the Restrictions section below). This includes their velocities,
image flags that differ by 1. This will allow the bond to be which may or may not be desirable. New atom IDs are assigned to new
unwrapped appropriately. atoms, as are new molecule IDs. Bonds and other topology interactions
are created between pairs of new atoms as well as between old and new
The optional keyword *bbox* uses a bounding box to only check atoms in atoms.
replicas that overlap with a processor's subdomain when assigning
atoms to processors. It typically results in a substantial speedup
when using the replicate command on a large number of processors. It
does require temporary use of more memory, specifically that each
processor can store all atoms in the entire system before it is
replicated.
The optional keyword *bondlist* correctly treats molecules that span
the box and are bonded to themselves across a periodic boundary, by
relying on self-consistent nearest-image assumptions (rather than
using image flags). The *bondlist* option resets all image flags to
zero. Therefore, the *bondlist* keyword can also be used in general
for systems that may not have consistent image flags. The *bondlist*
algorithm builds off the *bbox* algorithm, so it is fast when using a
large number of processors, but does require temporary use of more
memory. Specifically, each processor must be able to store arrays for
all atoms in the entire system before it is replicated.
.. note:: .. note::
For systems that contain a molecule that spans the box and is The bond discussion which follows only refers to models with
bonded to itself across a periodic boundary (so that the molecule permanent covalent bonds typically defined in LAMMPS via a data
is effectively a loop), the *bondlist* keyword must be used. A file. It is not relevant to sytems modeled with many-body
simple example would be a linear polymer chain that spans the potentials which can define bonds on-the-fly, based on the current
simulation box and bonds back to itself across the periodic positions of nearby atoms, e.g. models using the :doc:`AIREBO
boundary. More realistic examples would be a CNT (meant to be an <pair_airebo>` or :doc:`ReaxFF <pair_reaxff>` potentials.
infinitely long CNT) or a graphene sheet or a bulk periodic crystal
where there are explicit bonds specified between near neighbors. If the *bond/periodic* keyword is not specified, bond replication is
(Note that this restriction only applies to systems that have done by using the image flag for each atom to "unwrap" it out of the
permanent bonds as specified in the data file. A CNT that is just periodic box before replicating it. After replication is performed,
atoms modeled with the :doc:`AIREBO potential <pair_airebo>` has no atoms outside the new periodic box are wrapped back into it. This
such permanent bonds, so it can be replicated without the assigns correct images flags to all atoms in the system. For this to
*bondlist* keyword.) work, all original atoms in the original simulation box must have
consistent image flags. This means that if two atoms have a bond
between them which crosses a periodic boundary, their respective image
flags will differ by 1 in that dimension.
Image flag consistency is not possible if a system has a periodic bond
loop, meaning there is a chain of bonds which crosses an entire
dimension and re-connects to itself across a periodic boundary. In
this case you MUST use the *bond/periodic* keyword to correctly
replicate the system. This option zeroes the image flags for all
atoms and uses a different algorithm to find new (nearby) bond
neighbors in the replicated system. In the final replicated system
all image flags are zero (in each dimension).
-- note:
LAMMPS does not check for image flag consistency before performing
the replication (it does issue a warning about this before a
simulation is run). If the original image flags are inconsistent,
the replicated system will also have inconsistent image flags, but
will otherwise be correctly replicated. This is NOT the case if
there is a periodic bond loop. See the next note.
-- note:
LAMMPS does not check for periodic bond loops. If you use the
*bond/periodic* option for a system without periodic bond loops,
the system will be correctly replicated, but image flag information
will be lost (which may or may not be important to your model). If
you do not use the *bond/periodic* option for a system with
periodic bond loops, the replicated system will have invalid bonds
(typically very long), resulting in bad dynamics.
If possible, the *bbox* keyword should be used when running on a large
number of processors, as it can result in a substantial speed-up for
the replication operation. It uses a bounding box to only check atoms
in replicas that overlap with each processor's new subdomain when
assigning atoms to processors. It also preserves image flag
information. The only drawback to the *bbox* option is that it
requires a temporary use of more memory. Each processor must be able
to store all atoms (and their per-atom data) in the original system,
before it is replicated.
-- note:
The algorithm used by the *bond/periodic* keyword builds on the
algorithm used by the *bbox* keyword and thus has the same memory
requirements. If you specify only the *bond/peridoic* keyword it
will internally set the *bbox* keyword as well.
----------
Restrictions Restrictions
"""""""""""" """"""""""""
@ -95,26 +127,30 @@ Restrictions
A 2d simulation cannot be replicated in the z dimension. A 2d simulation cannot be replicated in the z dimension.
If a simulation is non-periodic in a dimension, care should be used If a simulation is non-periodic in a dimension, care should be used
when replicating it in that dimension, as it may put atoms nearly on when replicating it in that dimension, as it may generate atoms nearly
top of each other. on top of each other.
If the current simulation was read in from a restart file (before a If the current simulation was read in from a restart file (before a
run is performed), there must not be any fix information stored in run is performed), there must not be any fix information stored in the
the file for individual atoms. Similarly, no fixes can be defined at file for individual atoms. Similarly, no fixes can be defined at the
the time the replicate command is used that require vectors of atom time the replicate command is used that require vectors of atom
information to be stored. This is because the replicate command does information to be stored. This is because the replicate command does
not know how to replicate that information for new atoms it creates. not know how to replicate that information for new atoms it creates.
To work around this restriction, restart files may be converted into
data files and fixes may be undefined via the :doc:`unfix <unfix>` To work around this restriction two options are possible. (1) Fixes
command before and redefined after the replicate command. which use the stored data in the restart file can be defined before
replication and then deleted via the :doc:`unfix <unfix>` command and
re-defined after it. Or (2) the restart file can be converted to a
data file (which deletes the stored fix infomation) and fixes defined
after the replicate command. In both these scenarios, the per-atom
fix information in the restart file is lost.
Related commands Related commands
"""""""""""""""" """"""""""""""""
none none
Default Default
""""""" """""""
none No settings for using the *bbox* or *bond/periodic* algorithms.

View File

@ -104,6 +104,7 @@ prd: parallel replica dynamics of vacancy diffusion in bulk Si
python: use of PYTHON package to invoke Python code from input script python: use of PYTHON package to invoke Python code from input script
qeq: use of QEQ package for charge equilibration qeq: use of QEQ package for charge equilibration
reaxff: RDX and TATB and several other models using ReaxFF reaxff: RDX and TATB and several other models using ReaxFF
replicate: use of replicate command
rerun: use of rerun and read_dump commands rerun: use of rerun and read_dump commands
rigid: rigid bodies modeled as independent or coupled rigid: rigid bodies modeled as independent or coupled
shear: sideways shear applied to 2d solid, with and without a void shear: sideways shear applied to 2d solid, with and without a void

23
examples/replicate/README Normal file
View File

@ -0,0 +1,23 @@
This directory has input scripts which demonstrate how to use the
replicate command both for systems with and without periodic bond
loops. A periodic bond loop is where a chain of bonds spans a
periodic dimension of the box and includes one or more bonds which
cross the periodic boundary to close the loop.
To run these scripts, LAMMPS should be built with the MOLECULE and
CLASS2 packages. The latter is only needed for the CNT example.
These scripts are tiny examples which illustrate both kinds of
systems. Each produces a series of images which can be visualized.
If the 3 lines for a dump movie command are uncommented, a MPG movie
is produced, assuming LAMMPS is build with FFMPEG support.
in.replicate.bond.x # linear chains in x direction, bond loop in x
in.replcate.bond.x.y # 2d grid of bonded atoms, bond loops in x and y
in.replicate.bond.xy # linear chains in diagonal direction, bond loop in x and y
in.replicate.bond.noloop # linear chains in x direction, no bond loop
This script is for a complex system of 3 orthogonal CNTs which has
periodic bond loops in all 3 dimensions xyz.
in.replicate.cnt

View File

@ -0,0 +1,22 @@
# system with periodic bonds in x
3 atoms
3 bonds
1 atom types
1 bond types
0 3 xlo xhi
0 1 ylo yhi
Atoms
1 1 1 0.5 0.5 0
2 1 1 1.5 0.5 0
3 1 1 2.5 0.5 0
Bonds
1 1 1 2
2 1 2 3
3 1 3 1

View File

@ -0,0 +1,21 @@
# system with non-periodic bonds in x
3 atoms
2 bonds
1 atom types
1 bond types
0 3 xlo xhi
0 1 ylo yhi
Atoms
1 1 1 0.5 0.5 0 0 0 0
2 1 1 1.5 0.5 0 0 0 0
3 1 1 2.5 0.5 0 -1 0 0
Bonds
1 1 1 2
2 1 3 1

View File

@ -0,0 +1,43 @@
# system with periodic bonds in both x and y
9 atoms
18 bonds
1 atom types
1 bond types
0 3 xlo xhi
0 3 ylo yhi
Atoms
1 1 1 0.5 0.5 0
2 1 1 1.5 0.5 0
3 1 1 2.5 0.5 0
4 1 1 0.5 1.5 0
5 1 1 1.5 1.5 0
6 1 1 2.5 1.5 0
7 1 1 0.5 2.5 0
8 1 1 1.5 2.5 0
9 1 1 2.5 2.5 0
Bonds
1 1 1 2
2 1 2 3
3 1 3 1
4 1 4 5
5 1 5 6
6 1 6 4
7 1 7 8
8 1 8 9
9 1 9 7
10 1 1 4
11 1 4 7
12 1 7 1
13 1 2 5
14 1 5 8
15 1 8 2
16 1 3 6
17 1 6 9
18 1 9 3

View File

@ -0,0 +1,22 @@
# system with periodic bonds in xy direction
3 atoms
3 bonds
1 atom types
1 bond types
0 3 xlo xhi
0 3 ylo yhi
Atoms
1 1 1 0.5 0.5 0
2 1 1 1.5 1.5 0
3 1 1 2.5 2.5 0
Bonds
1 1 1 2
2 1 2 3
3 1 3 1

View File

@ -0,0 +1,34 @@
# test of replicating system with periodic bonds in x
dimension 2
atom_style molecular
read_data data.bond.x
#replicate 3 3 1
replicate 3 3 1 bond/periodic
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
fix 1 all nve
write_data tmp.data.x
dump 1 all image 100 tmp.image.x.*.ppm type type &
adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.mpg type type &
# adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000

View File

@ -0,0 +1,34 @@
# test of replicating system with periodic bonds in x
dimension 2
atom_style molecular
read_data data.bond.x.noloop
replicate 3 3 1
#replicate 3 3 1 bond/periodic
mass 1 1.0
velocity all create 0.001 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
fix 1 all nve
write_data tmp.data.x.non
dump 1 all image 100 tmp.image.x.non.*.ppm type type &
adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.non.mpg type type &
# adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000

View File

@ -0,0 +1,34 @@
# test of replicating system with periodic bonds in both x and y
dimension 2
atom_style molecular
read_data data.bond.x.y
#replicate 3 3 1
replicate 3 3 1 bond/periodic
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
fix 1 all nve
write_data tmp.data.x.y
dump 1 all image 100 tmp.image.x.y.*.ppm type type &
adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.y.mpg type type &
# adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000

View File

@ -0,0 +1,34 @@
# test of replicating system with periodic bonds in xy diagonal direction
dimension 2
atom_style molecular
read_data data.bond.xy
#replicate 3 3 1
replicate 3 3 1 bond/periodic
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.5
bond_style harmonic
bond_coeff 1 50.0 1.414
special_bonds fene
fix 1 all nve
write_data tmp.data.xy
dump 1 all image 100 tmp.image.xy.*.ppm type type &
adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.xy.mpg type type &
# adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000

View File

@ -22,7 +22,7 @@ improper_style class2
read_data three_periodic_CNTs.data.gz read_data three_periodic_CNTs.data.gz
replicate 2 2 2 bondlist replicate 2 2 2 bond/periodic
fix 1 all nve fix 1 all nve

View File

@ -0,0 +1,125 @@
LAMMPS (17 Apr 2024)
# test of replicating system with periodic bonds in x
dimension 2
atom_style molecular
read_data data.bond.x
Reading data file ...
orthogonal box = (0 0 -0.5) to (3 1 0.5)
1 by 1 by 1 MPI processor grid
reading atoms ...
3 atoms
scanning bonds ...
1 = max bonds/atom
orthogonal box = (0 0 -0.5) to (3 1 0.5)
1 by 1 by 1 MPI processor grid
reading bonds ...
3 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.004 seconds
#replicate 3 3 1
replicate 3 3 1 bond/periodic
Replication is creating a 3x3x1 = 9 times larger system...
orthogonal box = (0 0 -0.5) to (9 3 0.5)
1 by 1 by 1 MPI processor grid
bounding box image = (0 0 0) to (0 0 0)
bounding box extra memory = 0.00 MB
average # of replicas added to proc = 9.00 out of 9 (100.00%)
27 atoms
27 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
6 = max # of special neighbors
special bonds CPU = 0.000 seconds
replicate CPU = 0.001 seconds
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 1 1
special bond factors coul: 0 1 1
2 = max # of 1-2 neighbors
6 = max # of special neighbors
special bonds CPU = 0.000 seconds
fix 1 all nve
write_data tmp.data.x
System init for write_data ...
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 7 3 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/2d
bin: standard
dump 1 all image 100 tmp.image.x.*.ppm type type adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.mpg type type # adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
WARNING: Inconsistent image flags (../domain.cpp:1051)
Per MPI rank memory allocation (min/avg/max) = 6.302 | 6.302 | 6.302 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0.02 -1.1250229 0 -1.1057636 9.028122
5000 0.54111971 -1.9054641 0.29066874 -1.0937172 3.4346743
Loop time of 0.0764878 on 1 procs for 5000 steps with 27 atoms
Performance: 28239805.842 tau/day, 65369.921 timesteps/s, 1.765 Matom-step/s
66.5% CPU use with 1 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.0048837 | 0.0048837 | 0.0048837 | 0.0 | 6.38
Bond | 0.00065879 | 0.00065879 | 0.00065879 | 0.0 | 0.86
Neigh | 0.0019897 | 0.0019897 | 0.0019897 | 0.0 | 2.60
Comm | 0.0012815 | 0.0012815 | 0.0012815 | 0.0 | 1.68
Output | 0.066351 | 0.066351 | 0.066351 | 0.0 | 86.75
Modify | 0.00069789 | 0.00069789 | 0.00069789 | 0.0 | 0.91
Other | | 0.0006247 | | | 0.82
Nlocal: 27 ave 27 max 27 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 108 ave 108 max 108 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 284 ave 284 max 284 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 284
Ave neighs/atom = 10.518519
Ave special neighs/atom = 2
Neighbor list builds = 287
Dangerous builds = 0
Total wall time: 0:00:00

View File

@ -0,0 +1,126 @@
LAMMPS (17 Apr 2024)
WARNING: Using I/O redirection is unreliable with parallel runs. Better to use the -in switch to read input files. (../lammps.cpp:551)
# test of replicating system with periodic bonds in x
dimension 2
atom_style molecular
read_data data.bond.x
Reading data file ...
orthogonal box = (0 0 -0.5) to (3 1 0.5)
4 by 1 by 1 MPI processor grid
reading atoms ...
3 atoms
scanning bonds ...
1 = max bonds/atom
orthogonal box = (0 0 -0.5) to (3 1 0.5)
4 by 1 by 1 MPI processor grid
reading bonds ...
3 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.003 seconds
#replicate 3 3 1
replicate 3 3 1 bond/periodic
Replication is creating a 3x3x1 = 9 times larger system...
orthogonal box = (0 0 -0.5) to (9 3 0.5)
4 by 1 by 1 MPI processor grid
bounding box image = (0 0 0) to (0 0 0)
bounding box extra memory = 0.00 MB
average # of replicas added to proc = 5.25 out of 9 (58.33%)
27 atoms
27 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
6 = max # of special neighbors
special bonds CPU = 0.000 seconds
replicate CPU = 0.002 seconds
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 1 1
special bond factors coul: 0 1 1
2 = max # of 1-2 neighbors
6 = max # of special neighbors
special bonds CPU = 0.000 seconds
fix 1 all nve
write_data tmp.data.x
System init for write_data ...
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 7 3 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/2d
bin: standard
dump 1 all image 100 tmp.image.x.*.ppm type type adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.mpg type type # adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
WARNING: Inconsistent image flags (../domain.cpp:1051)
Per MPI rank memory allocation (min/avg/max) = 6.309 | 6.309 | 6.309 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0.02 -1.1250229 0 -1.1057636 9.028122
5000 0.50911963 -1.7968226 0.21209852 -1.0944607 4.1676488
Loop time of 0.21682 on 4 procs for 5000 steps with 27 atoms
Performance: 9962160.612 tau/day, 23060.557 timesteps/s, 622.635 katom-step/s
93.9% CPU use with 4 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.001787 | 0.0021247 | 0.0028772 | 1.0 | 0.98
Bond | 0.00039682 | 0.00045617 | 0.00059887 | 0.0 | 0.21
Neigh | 0.0013626 | 0.0014006 | 0.0014798 | 0.1 | 0.65
Comm | 0.017009 | 0.01791 | 0.018656 | 0.5 | 8.26
Output | 0.06892 | 0.12188 | 0.18918 | 13.7 | 56.21
Modify | 0.00060336 | 0.00072159 | 0.00088047 | 0.0 | 0.33
Other | | 0.07233 | | | 33.36
Nlocal: 6.75 ave 7 max 6 min
Histogram: 1 0 0 0 0 0 0 0 0 3
Nghost: 64.5 ave 65 max 63 min
Histogram: 1 0 0 0 0 0 0 0 0 3
Neighs: 70.25 ave 77 max 60 min
Histogram: 1 0 0 0 0 1 0 0 1 1
Total # of neighbors = 281
Ave neighs/atom = 10.407407
Ave special neighs/atom = 2
Neighbor list builds = 287
Dangerous builds = 0
Total wall time: 0:00:00

View File

@ -0,0 +1,121 @@
LAMMPS (17 Apr 2024)
# test of replicating system with periodic bonds in x
dimension 2
atom_style molecular
read_data data.bond.x.non
Reading data file ...
orthogonal box = (0 0 -0.5) to (3 1 0.5)
1 by 1 by 1 MPI processor grid
reading atoms ...
3 atoms
scanning bonds ...
1 = max bonds/atom
orthogonal box = (0 0 -0.5) to (3 1 0.5)
1 by 1 by 1 MPI processor grid
reading bonds ...
2 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
1 = max # of 1-3 neighbors
1 = max # of 1-4 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.004 seconds
replicate 3 3 1
Replication is creating a 3x3x1 = 9 times larger system...
orthogonal box = (0 0 -0.5) to (9 3 0.5)
1 by 1 by 1 MPI processor grid
27 atoms
18 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
1 = max # of 1-3 neighbors
1 = max # of 1-4 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
replicate CPU = 0.001 seconds
#replicate 3 3 1 bond/periodic
mass 1 1.0
velocity all create 0.001 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 1 1
special bond factors coul: 0 1 1
2 = max # of 1-2 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
fix 1 all nve
write_data tmp.data.x.non
System init for write_data ...
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 7 3 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/2d
bin: standard
dump 1 all image 100 tmp.image.x.non.*.ppm type type adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.non.mpg type type # adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Per MPI rank memory allocation (min/avg/max) = 6.052 | 6.052 | 6.052 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0.001 -1.1250229 0 -1.1240599 13.009826
5000 0.62003692 -2.0147214 0.30861545 -1.1090334 8.0279226
Loop time of 0.0734456 on 1 procs for 5000 steps with 27 atoms
Performance: 29409520.548 tau/day, 68077.594 timesteps/s, 1.838 Matom-step/s
94.4% CPU use with 1 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.0051444 | 0.0051444 | 0.0051444 | 0.0 | 7.00
Bond | 0.00048789 | 0.00048789 | 0.00048789 | 0.0 | 0.66
Neigh | 0.0019333 | 0.0019333 | 0.0019333 | 0.0 | 2.63
Comm | 0.001332 | 0.001332 | 0.001332 | 0.0 | 1.81
Output | 0.063139 | 0.063139 | 0.063139 | 0.0 | 85.97
Modify | 0.00077014 | 0.00077014 | 0.00077014 | 0.0 | 1.05
Other | | 0.0006387 | | | 0.87
Nlocal: 27 ave 27 max 27 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 101 ave 101 max 101 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 288 ave 288 max 288 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 288
Ave neighs/atom = 10.666667
Ave special neighs/atom = 1.3333333
Neighbor list builds = 322
Dangerous builds = 0
Total wall time: 0:00:00

View File

@ -0,0 +1,122 @@
LAMMPS (17 Apr 2024)
WARNING: Using I/O redirection is unreliable with parallel runs. Better to use the -in switch to read input files. (../lammps.cpp:551)
# test of replicating system with periodic bonds in x
dimension 2
atom_style molecular
read_data data.bond.x.non
Reading data file ...
orthogonal box = (0 0 -0.5) to (3 1 0.5)
4 by 1 by 1 MPI processor grid
reading atoms ...
3 atoms
scanning bonds ...
1 = max bonds/atom
orthogonal box = (0 0 -0.5) to (3 1 0.5)
4 by 1 by 1 MPI processor grid
reading bonds ...
2 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
1 = max # of 1-3 neighbors
1 = max # of 1-4 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.004 seconds
replicate 3 3 1
Replication is creating a 3x3x1 = 9 times larger system...
orthogonal box = (0 0 -0.5) to (9 3 0.5)
4 by 1 by 1 MPI processor grid
27 atoms
18 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
1 = max # of 1-3 neighbors
1 = max # of 1-4 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
replicate CPU = 0.002 seconds
#replicate 3 3 1 bond/periodic
mass 1 1.0
velocity all create 0.001 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 1 1
special bond factors coul: 0 1 1
2 = max # of 1-2 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
fix 1 all nve
write_data tmp.data.x.non
System init for write_data ...
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 7 3 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/2d
bin: standard
dump 1 all image 100 tmp.image.x.non.*.ppm type type adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.non.mpg type type # adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Per MPI rank memory allocation (min/avg/max) = 6.059 | 6.059 | 6.059 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0.001 -1.1250229 0 -1.1240599 13.009826
5000 0.74931971 -2.233724 0.40158766 -1.1105692 5.6354701
Loop time of 0.197835 on 4 procs for 5000 steps with 27 atoms
Performance: 10918214.594 tau/day, 25273.645 timesteps/s, 682.388 katom-step/s
88.8% CPU use with 4 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.0018771 | 0.0021131 | 0.0027188 | 0.8 | 1.07
Bond | 0.00032659 | 0.00038248 | 0.00049555 | 0.0 | 0.19
Neigh | 0.001385 | 0.0014211 | 0.0014704 | 0.1 | 0.72
Comm | 0.017163 | 0.017405 | 0.017805 | 0.2 | 8.80
Output | 0.070971 | 0.11052 | 0.17112 | 12.1 | 55.87
Modify | 0.00058993 | 0.00067708 | 0.00075608 | 0.0 | 0.34
Other | | 0.06532 | | | 33.02
Nlocal: 6.75 ave 7 max 6 min
Histogram: 1 0 0 0 0 0 0 0 0 3
Nghost: 59.75 ave 60 max 59 min
Histogram: 1 0 0 0 0 0 0 0 0 3
Neighs: 72 ave 79 max 63 min
Histogram: 1 0 0 0 0 0 2 0 0 1
Total # of neighbors = 288
Ave neighs/atom = 10.666667
Ave special neighs/atom = 1.3333333
Neighbor list builds = 323
Dangerous builds = 0
Total wall time: 0:00:00

View File

@ -0,0 +1,125 @@
LAMMPS (17 Apr 2024)
# test of replicating system with periodic bonds in both x and y
dimension 2
atom_style molecular
read_data data.bond.x.y
Reading data file ...
orthogonal box = (0 0 -0.5) to (3 3 0.5)
1 by 1 by 1 MPI processor grid
reading atoms ...
9 atoms
scanning bonds ...
2 = max bonds/atom
orthogonal box = (0 0 -0.5) to (3 3 0.5)
1 by 1 by 1 MPI processor grid
reading bonds ...
18 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
4 = max # of 1-2 neighbors
12 = max # of 1-3 neighbors
48 = max # of 1-4 neighbors
8 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.004 seconds
#replicate 3 3 1
replicate 3 3 1 bond/periodic
Replication is creating a 3x3x1 = 9 times larger system...
orthogonal box = (0 0 -0.5) to (9 9 0.5)
1 by 1 by 1 MPI processor grid
bounding box image = (0 0 0) to (0 0 0)
bounding box extra memory = 0.00 MB
average # of replicas added to proc = 9.00 out of 9 (100.00%)
81 atoms
162 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
4 = max # of 1-2 neighbors
12 = max # of 1-3 neighbors
48 = max # of 1-4 neighbors
24 = max # of special neighbors
special bonds CPU = 0.000 seconds
replicate CPU = 0.001 seconds
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 1 1
special bond factors coul: 0 1 1
4 = max # of 1-2 neighbors
24 = max # of special neighbors
special bonds CPU = 0.000 seconds
fix 1 all nve
write_data tmp.data.x.y
System init for write_data ...
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 7 7 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/2d
bin: standard
dump 1 all image 100 tmp.image.x.y.*.ppm type type adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.y.mpg type type # adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
WARNING: Inconsistent image flags (../domain.cpp:1051)
Per MPI rank memory allocation (min/avg/max) = 7.555 | 7.555 | 7.555 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0.02 -1.1250229 0 -1.1052698 -2.9713842
5000 0.046175679 -1.2280388 0.080003864 -1.1024293 -4.1097897
Loop time of 0.212344 on 1 procs for 5000 steps with 81 atoms
Performance: 10172161.526 tau/day, 23546.670 timesteps/s, 1.907 Matom-step/s
93.0% CPU use with 1 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.01283 | 0.01283 | 0.01283 | 0.0 | 6.04
Bond | 0.0032785 | 0.0032785 | 0.0032785 | 0.0 | 1.54
Neigh | 0.0018379 | 0.0018379 | 0.0018379 | 0.0 | 0.87
Comm | 0.0016247 | 0.0016247 | 0.0016247 | 0.0 | 0.77
Output | 0.18991 | 0.18991 | 0.18991 | 0.0 | 89.44
Modify | 0.0018198 | 0.0018198 | 0.0018198 | 0.0 | 0.86
Other | | 0.001039 | | | 0.49
Nlocal: 81 ave 81 max 81 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 144 ave 144 max 144 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 714 ave 714 max 714 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 714
Ave neighs/atom = 8.8148148
Ave special neighs/atom = 4
Neighbor list builds = 72
Dangerous builds = 0
Total wall time: 0:00:00

View File

@ -0,0 +1,126 @@
LAMMPS (17 Apr 2024)
WARNING: Using I/O redirection is unreliable with parallel runs. Better to use the -in switch to read input files. (../lammps.cpp:551)
# test of replicating system with periodic bonds in both x and y
dimension 2
atom_style molecular
read_data data.bond.x.y
Reading data file ...
orthogonal box = (0 0 -0.5) to (3 3 0.5)
2 by 2 by 1 MPI processor grid
reading atoms ...
9 atoms
scanning bonds ...
2 = max bonds/atom
orthogonal box = (0 0 -0.5) to (3 3 0.5)
2 by 2 by 1 MPI processor grid
reading bonds ...
18 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
4 = max # of 1-2 neighbors
12 = max # of 1-3 neighbors
48 = max # of 1-4 neighbors
8 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.003 seconds
#replicate 3 3 1
replicate 3 3 1 bond/periodic
Replication is creating a 3x3x1 = 9 times larger system...
orthogonal box = (0 0 -0.5) to (9 9 0.5)
2 by 2 by 1 MPI processor grid
bounding box image = (0 0 0) to (0 0 0)
bounding box extra memory = 0.00 MB
average # of replicas added to proc = 6.25 out of 9 (69.44%)
81 atoms
162 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
4 = max # of 1-2 neighbors
12 = max # of 1-3 neighbors
48 = max # of 1-4 neighbors
24 = max # of special neighbors
special bonds CPU = 0.000 seconds
replicate CPU = 0.001 seconds
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0
bond_style harmonic
bond_coeff 1 50.0 1.0
special_bonds fene
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 1 1
special bond factors coul: 0 1 1
4 = max # of 1-2 neighbors
24 = max # of special neighbors
special bonds CPU = 0.000 seconds
fix 1 all nve
write_data tmp.data.x.y
System init for write_data ...
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 7 7 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/2d
bin: standard
dump 1 all image 100 tmp.image.x.y.*.ppm type type adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.x.y.mpg type type # adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
WARNING: Inconsistent image flags (../domain.cpp:1051)
Per MPI rank memory allocation (min/avg/max) = 7.552 | 7.552 | 7.552 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0.02 -1.1250229 0 -1.1052698 -2.9713842
5000 0.046175679 -1.2280388 0.080003864 -1.1024293 -4.1097897
Loop time of 0.273847 on 4 procs for 5000 steps with 81 atoms
Performance: 7887622.810 tau/day, 18258.386 timesteps/s, 1.479 Matom-step/s
92.4% CPU use with 4 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.0039465 | 0.0042593 | 0.0046129 | 0.4 | 1.56
Bond | 0.0011489 | 0.001207 | 0.0012757 | 0.2 | 0.44
Neigh | 0.00079819 | 0.0008044 | 0.00081324 | 0.0 | 0.29
Comm | 0.024107 | 0.024703 | 0.025269 | 0.3 | 9.02
Output | 0.14406 | 0.18123 | 0.23779 | 8.7 | 66.18
Modify | 0.00089401 | 0.00095321 | 0.0010422 | 0.0 | 0.35
Other | | 0.06069 | | | 22.16
Nlocal: 20.25 ave 22 max 19 min
Histogram: 2 0 0 0 0 0 1 0 0 1
Nghost: 81.5 ave 82 max 80 min
Histogram: 1 0 0 0 0 0 0 0 0 3
Neighs: 178.5 ave 195 max 165 min
Histogram: 2 0 0 0 0 0 0 1 0 1
Total # of neighbors = 714
Ave neighs/atom = 8.8148148
Ave special neighs/atom = 4
Neighbor list builds = 72
Dangerous builds = 0
Total wall time: 0:00:00

View File

@ -0,0 +1,125 @@
LAMMPS (17 Apr 2024)
# test of replicating system with periodic bonds in xy diagonal direction
dimension 2
atom_style molecular
read_data data.bond.xy
Reading data file ...
orthogonal box = (0 0 -0.5) to (3 3 0.5)
1 by 1 by 1 MPI processor grid
reading atoms ...
3 atoms
scanning bonds ...
1 = max bonds/atom
orthogonal box = (0 0 -0.5) to (3 3 0.5)
1 by 1 by 1 MPI processor grid
reading bonds ...
3 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.004 seconds
#replicate 3 3 1
replicate 3 3 1 bond/periodic
Replication is creating a 3x3x1 = 9 times larger system...
orthogonal box = (0 0 -0.5) to (9 9 0.5)
1 by 1 by 1 MPI processor grid
bounding box image = (0 0 0) to (0 0 0)
bounding box extra memory = 0.00 MB
average # of replicas added to proc = 9.00 out of 9 (100.00%)
27 atoms
27 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
6 = max # of special neighbors
special bonds CPU = 0.000 seconds
replicate CPU = 0.001 seconds
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.5
bond_style harmonic
bond_coeff 1 50.0 1.414
special_bonds fene
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 1 1
special bond factors coul: 0 1 1
2 = max # of 1-2 neighbors
6 = max # of special neighbors
special bonds CPU = 0.000 seconds
fix 1 all nve
write_data tmp.data.xy
System init for write_data ...
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 7 7 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/2d
bin: standard
dump 1 all image 100 tmp.image.xy.*.ppm type type adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.xy.mpg type type # adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
WARNING: Inconsistent image flags (../domain.cpp:1051)
Per MPI rank memory allocation (min/avg/max) = 6.302 | 6.302 | 6.302 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0.02 -0.66256987 2.2804444e-06 -0.64330834 -0.59475371
5000 0.43110862 -1.1484506 0.16888799 -0.56442095 -0.3683968
Loop time of 0.124095 on 1 procs for 5000 steps with 27 atoms
Performance: 17406010.885 tau/day, 40291.692 timesteps/s, 1.088 Matom-step/s
82.3% CPU use with 1 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.0013734 | 0.0013734 | 0.0013734 | 0.0 | 1.11
Bond | 0.00064058 | 0.00064058 | 0.00064058 | 0.0 | 0.52
Neigh | 0.00090424 | 0.00090424 | 0.00090424 | 0.0 | 0.73
Comm | 0.00081732 | 0.00081732 | 0.00081732 | 0.0 | 0.66
Output | 0.11905 | 0.11905 | 0.11905 | 0.0 | 95.93
Modify | 0.0007252 | 0.0007252 | 0.0007252 | 0.0 | 0.58
Other | | 0.0005888 | | | 0.47
Nlocal: 27 ave 27 max 27 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 45 ave 45 max 45 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 66 ave 66 max 66 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 66
Ave neighs/atom = 2.4444444
Ave special neighs/atom = 2
Neighbor list builds = 244
Dangerous builds = 0
Total wall time: 0:00:00

View File

@ -0,0 +1,126 @@
LAMMPS (17 Apr 2024)
WARNING: Using I/O redirection is unreliable with parallel runs. Better to use the -in switch to read input files. (../lammps.cpp:551)
# test of replicating system with periodic bonds in xy diagonal direction
dimension 2
atom_style molecular
read_data data.bond.xy
Reading data file ...
orthogonal box = (0 0 -0.5) to (3 3 0.5)
2 by 2 by 1 MPI processor grid
reading atoms ...
3 atoms
scanning bonds ...
1 = max bonds/atom
orthogonal box = (0 0 -0.5) to (3 3 0.5)
2 by 2 by 1 MPI processor grid
reading bonds ...
3 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
2 = max # of special neighbors
special bonds CPU = 0.000 seconds
read_data CPU = 0.003 seconds
#replicate 3 3 1
replicate 3 3 1 bond/periodic
Replication is creating a 3x3x1 = 9 times larger system...
orthogonal box = (0 0 -0.5) to (9 9 0.5)
2 by 2 by 1 MPI processor grid
bounding box image = (0 0 0) to (0 0 0)
bounding box extra memory = 0.00 MB
average # of replicas added to proc = 6.25 out of 9 (69.44%)
27 atoms
27 bonds
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 0 0
special bond factors coul: 0 0 0
2 = max # of 1-2 neighbors
2 = max # of 1-3 neighbors
4 = max # of 1-4 neighbors
6 = max # of special neighbors
special bonds CPU = 0.000 seconds
replicate CPU = 0.001 seconds
mass 1 1.0
velocity all create 0.02 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.5
bond_style harmonic
bond_coeff 1 50.0 1.414
special_bonds fene
Finding 1-2 1-3 1-4 neighbors ...
special bond factors lj: 0 1 1
special bond factors coul: 0 1 1
2 = max # of 1-2 neighbors
6 = max # of special neighbors
special bonds CPU = 0.000 seconds
fix 1 all nve
write_data tmp.data.xy
System init for write_data ...
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 7 7 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/newton
stencil: half/bin/2d
bin: standard
dump 1 all image 100 tmp.image.xy.*.ppm type type adiam 0.2 bond type 0.1 zoom 1.6
dump_modify 1 pad 5
#dump 2 all movie 100 tmp.movie.xy.mpg type type # adiam 0.2 bond type 0.1 zoom 1.6
#dump_modify 2 pad 5
run 5000
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
WARNING: Inconsistent image flags (../domain.cpp:1051)
Per MPI rank memory allocation (min/avg/max) = 6.301 | 6.301 | 6.301 Mbytes
Step Temp E_pair E_mol TotEng Press
0 0.02 -0.66256988 2.2804444e-06 -0.64330834 -0.59475371
5000 0.43110877 -1.1484507 0.168888 -0.56442093 -0.36839692
Loop time of 0.286423 on 4 procs for 5000 steps with 27 atoms
Performance: 7541285.935 tau/day, 17456.680 timesteps/s, 471.330 katom-step/s
92.9% CPU use with 4 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.00054941 | 0.00084836 | 0.0013689 | 0.0 | 0.30
Bond | 0.00034068 | 0.00045816 | 0.00068461 | 0.0 | 0.16
Neigh | 0.00092076 | 0.00098494 | 0.0010463 | 0.0 | 0.34
Comm | 0.018151 | 0.018737 | 0.019531 | 0.4 | 6.54
Output | 0.13261 | 0.19363 | 0.2596 | 10.7 | 67.60
Modify | 0.00053153 | 0.00071381 | 0.0010268 | 0.0 | 0.25
Other | | 0.07105 | | | 24.81
Nlocal: 6.75 ave 9 max 5 min
Histogram: 2 0 0 0 0 0 0 1 0 1
Nghost: 26.25 ave 28 max 25 min
Histogram: 2 0 0 0 0 0 1 0 0 1
Neighs: 16.5 ave 23 max 10 min
Histogram: 1 1 0 0 0 0 0 0 1 1
Total # of neighbors = 66
Ave neighs/atom = 2.4444444
Ave special neighs/atom = 2
Neighbor list builds = 244
Dangerous builds = 0
Total wall time: 0:00:00

View File

@ -1,4 +1,4 @@
LAMMPS (7 Jan 2022) LAMMPS (17 Apr 2024)
# three orthogonal periodic CNTs # three orthogonal periodic CNTs
# demo for replicating triply looped system # demo for replicating triply looped system
# infinite loops in x, y, z # infinite loops in x, y, z
@ -37,6 +37,8 @@ Reading data file ...
12 = max dihedrals/atom 12 = max dihedrals/atom
scanning impropers ... scanning impropers ...
1 = max impropers/atom 1 = max impropers/atom
orthogonal box = (0 0 0) to (80.96 80.96 80.96)
1 by 1 by 1 MPI processor grid
reading bonds ... reading bonds ...
4752 bonds 4752 bonds
reading angles ... reading angles ...
@ -52,11 +54,11 @@ Finding 1-2 1-3 1-4 neighbors ...
6 = max # of 1-3 neighbors 6 = max # of 1-3 neighbors
18 = max # of 1-4 neighbors 18 = max # of 1-4 neighbors
18 = max # of special neighbors 18 = max # of special neighbors
special bonds CPU = 0.003 seconds special bonds CPU = 0.002 seconds
read_data CPU = 0.115 seconds read_data CPU = 0.056 seconds
replicate 2 2 2 bondlist replicate 2 2 2 bond/periodic
Replicating atoms ... Replication is creating a 2x2x2 = 8 times larger system...
orthogonal box = (0 0 0) to (161.92 161.92 161.92) orthogonal box = (0 0 0) to (161.92 161.92 161.92)
1 by 1 by 1 MPI processor grid 1 by 1 by 1 MPI processor grid
bounding box image = (0 0 0) to (0 0 0) bounding box image = (0 0 0) to (0 0 0)
@ -74,15 +76,15 @@ Finding 1-2 1-3 1-4 neighbors ...
6 = max # of 1-3 neighbors 6 = max # of 1-3 neighbors
18 = max # of 1-4 neighbors 18 = max # of 1-4 neighbors
18 = max # of special neighbors 18 = max # of special neighbors
special bonds CPU = 0.021 seconds special bonds CPU = 0.012 seconds
replicate CPU = 0.052 seconds replicate CPU = 0.027 seconds
fix 1 all nve fix 1 all nve
run 100 run 100
generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Generated 0 of 0 mixed pair_coeff terms from sixthpower/geometric mixing rule
Neighbor list info ... Neighbor list info ...
update every 1 steps, delay 10 steps, check yes update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000 max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12 master list distance cutoff = 12
ghost atom cutoff = 12 ghost atom cutoff = 12
@ -93,26 +95,26 @@ Neighbor list info ...
pair build: half/bin/newton pair build: half/bin/newton
stencil: half/bin/3d stencil: half/bin/3d
bin: standard bin: standard
WARNING: Inconsistent image flags (../domain.cpp:814) WARNING: Inconsistent image flags (../domain.cpp:1051)
Per MPI rank memory allocation (min/avg/max) = 51.87 | 51.87 | 51.87 Mbytes Per MPI rank memory allocation (min/avg/max) = 51.87 | 51.87 | 51.87 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
0 0 -14266.189 1466925.5 1452659.3 -29908.753 0 0 -14266.189 1466925.5 1452659.3 -29908.753
100 2155.9128 -17224.188 1306769.8 1452409 1985.2082 100 2155.9128 -17224.188 1306769.8 1452409 1985.2082
Loop time of 15.0972 on 1 procs for 100 steps with 25344 atoms Loop time of 5.0155 on 1 procs for 100 steps with 25344 atoms
Performance: 0.572 ns/day, 41.937 hours/ns, 6.624 timesteps/s Performance: 1.723 ns/day, 13.932 hours/ns, 19.938 timesteps/s, 505.314 katom-step/s
100.0% CPU use with 1 MPI tasks x no OpenMP threads 100.0% CPU use with 1 MPI tasks x no OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 3.7175 | 3.7175 | 3.7175 | 0.0 | 24.62 Pair | 1.6557 | 1.6557 | 1.6557 | 0.0 | 33.01
Bond | 11.222 | 11.222 | 11.222 | 0.0 | 74.33 Bond | 3.2813 | 3.2813 | 3.2813 | 0.0 | 65.42
Neigh | 0.1032 | 0.1032 | 0.1032 | 0.0 | 0.68 Neigh | 0.047025 | 0.047025 | 0.047025 | 0.0 | 0.94
Comm | 0.014487 | 0.014487 | 0.014487 | 0.0 | 0.10 Comm | 0.0085317 | 0.0085317 | 0.0085317 | 0.0 | 0.17
Output | 0.00010894 | 0.00010894 | 0.00010894 | 0.0 | 0.00 Output | 7.8551e-05 | 7.8551e-05 | 7.8551e-05 | 0.0 | 0.00
Modify | 0.027112 | 0.027112 | 0.027112 | 0.0 | 0.18 Modify | 0.014635 | 0.014635 | 0.014635 | 0.0 | 0.29
Other | | 0.01274 | | | 0.08 Other | | 0.008159 | | | 0.16
Nlocal: 25344 ave 25344 max 25344 min Nlocal: 25344 ave 25344 max 25344 min
Histogram: 1 0 0 0 0 0 0 0 0 0 Histogram: 1 0 0 0 0 0 0 0 0 0
@ -129,4 +131,4 @@ Dangerous builds = 0
# write_restart replicate.restart # write_restart replicate.restart
# write_data replicate.data # write_data replicate.data
Total wall time: 0:00:15 Total wall time: 0:00:05

View File

@ -1,4 +1,5 @@
LAMMPS (7 Jan 2022) LAMMPS (17 Apr 2024)
WARNING: Using I/O redirection is unreliable with parallel runs. Better to use the -in switch to read input files. (../lammps.cpp:551)
# three orthogonal periodic CNTs # three orthogonal periodic CNTs
# demo for replicating triply looped system # demo for replicating triply looped system
# infinite loops in x, y, z # infinite loops in x, y, z
@ -37,6 +38,8 @@ Reading data file ...
12 = max dihedrals/atom 12 = max dihedrals/atom
scanning impropers ... scanning impropers ...
1 = max impropers/atom 1 = max impropers/atom
orthogonal box = (0 0 0) to (80.96 80.96 80.96)
1 by 2 by 2 MPI processor grid
reading bonds ... reading bonds ...
4752 bonds 4752 bonds
reading angles ... reading angles ...
@ -53,10 +56,10 @@ Finding 1-2 1-3 1-4 neighbors ...
18 = max # of 1-4 neighbors 18 = max # of 1-4 neighbors
18 = max # of special neighbors 18 = max # of special neighbors
special bonds CPU = 0.001 seconds special bonds CPU = 0.001 seconds
read_data CPU = 0.315 seconds read_data CPU = 0.064 seconds
replicate 2 2 2 bondlist replicate 2 2 2 bond/periodic
Replicating atoms ... Replication is creating a 2x2x2 = 8 times larger system...
orthogonal box = (0 0 0) to (161.92 161.92 161.92) orthogonal box = (0 0 0) to (161.92 161.92 161.92)
1 by 2 by 2 MPI processor grid 1 by 2 by 2 MPI processor grid
bounding box image = (0 0 0) to (0 0 0) bounding box image = (0 0 0) to (0 0 0)
@ -74,15 +77,15 @@ Finding 1-2 1-3 1-4 neighbors ...
6 = max # of 1-3 neighbors 6 = max # of 1-3 neighbors
18 = max # of 1-4 neighbors 18 = max # of 1-4 neighbors
18 = max # of special neighbors 18 = max # of special neighbors
special bonds CPU = 0.007 seconds special bonds CPU = 0.004 seconds
replicate CPU = 0.020 seconds replicate CPU = 0.012 seconds
fix 1 all nve fix 1 all nve
run 100 run 100
generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Generated 0 of 0 mixed pair_coeff terms from sixthpower/geometric mixing rule
Neighbor list info ... Neighbor list info ...
update every 1 steps, delay 10 steps, check yes update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000 max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12 master list distance cutoff = 12
ghost atom cutoff = 12 ghost atom cutoff = 12
@ -93,26 +96,26 @@ Neighbor list info ...
pair build: half/bin/newton pair build: half/bin/newton
stencil: half/bin/3d stencil: half/bin/3d
bin: standard bin: standard
WARNING: Inconsistent image flags (../domain.cpp:814) WARNING: Inconsistent image flags (../domain.cpp:1051)
Per MPI rank memory allocation (min/avg/max) = 28.69 | 28.69 | 28.69 Mbytes Per MPI rank memory allocation (min/avg/max) = 28.69 | 28.69 | 28.69 Mbytes
Step Temp E_pair E_mol TotEng Press Step Temp E_pair E_mol TotEng Press
0 0 -14266.189 1466925.5 1452659.3 -29908.753 0 0 -14266.189 1466925.5 1452659.3 -29908.753
100 2155.9128 -17224.188 1306769.8 1452409 1985.2082 100 2155.9128 -17224.188 1306769.8 1452409 1985.2082
Loop time of 4.13195 on 4 procs for 100 steps with 25344 atoms Loop time of 1.3667 on 4 procs for 100 steps with 25344 atoms
Performance: 2.091 ns/day, 11.478 hours/ns, 24.202 timesteps/s Performance: 6.322 ns/day, 3.796 hours/ns, 73.169 timesteps/s, 1.854 Matom-step/s
100.0% CPU use with 4 MPI tasks x no OpenMP threads 99.8% CPU use with 4 MPI tasks x no OpenMP threads
MPI task timing breakdown: MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total Section | min time | avg time | max time |%varavg| %total
--------------------------------------------------------------- ---------------------------------------------------------------
Pair | 0.99372 | 1.014 | 1.0672 | 3.1 | 24.54 Pair | 0.43424 | 0.43539 | 0.43741 | 0.2 | 31.86
Bond | 2.9449 | 2.9795 | 3.0136 | 2.0 | 72.11 Bond | 0.88613 | 0.89013 | 0.90094 | 0.7 | 65.13
Neigh | 0.026695 | 0.026706 | 0.026716 | 0.0 | 0.65 Neigh | 0.013198 | 0.013199 | 0.013201 | 0.0 | 0.97
Comm | 0.012404 | 0.099546 | 0.15425 | 18.7 | 2.41 Comm | 0.010742 | 0.020522 | 0.02546 | 4.1 | 1.50
Output | 4.3822e-05 | 5.0693e-05 | 7.0516e-05 | 0.0 | 0.00 Output | 3.2788e-05 | 3.6302e-05 | 4.4556e-05 | 0.0 | 0.00
Modify | 0.0074219 | 0.0074887 | 0.0075411 | 0.1 | 0.18 Modify | 0.0042029 | 0.0042366 | 0.004267 | 0.0 | 0.31
Other | | 0.004616 | | | 0.11 Other | | 0.003188 | | | 0.23
Nlocal: 6336 ave 6336 max 6336 min Nlocal: 6336 ave 6336 max 6336 min
Histogram: 4 0 0 0 0 0 0 0 0 0 Histogram: 4 0 0 0 0 0 0 0 0 0
@ -129,4 +132,4 @@ Dangerous builds = 0
# write_restart replicate.restart # write_restart replicate.restart
# write_data replicate.data # write_data replicate.data
Total wall time: 0:00:04 Total wall time: 0:00:01

View File

@ -12,6 +12,12 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing authors:
Chris Knight (ANL) for bbox option
Jake Gissinger (Stevens Institute of Technology) for bond/periodic option
------------------------------------------------------------------------- */
#include "replicate.h" #include "replicate.h"
#include "accelerator_kokkos.h" #include "accelerator_kokkos.h"
@ -70,13 +76,24 @@ void Replicate::command(int narg, char **arg)
utils::logmesg(lmp, "Replication is creating a {}x{}x{} = {} times larger system...\n", utils::logmesg(lmp, "Replication is creating a {}x{}x{} = {} times larger system...\n",
nx, ny, nz, nrep); nx, ny, nz, nrep);
int bbox_flag = 0; // optional keywords
int bondlist_flag = 0;
if (narg == 4) { bbox_flag = 0;
if (strcmp(arg[3],"bbox") == 0) bbox_flag = 1; bond_flag = 0;
if (strcmp(arg[3],"bondlist") == 0) bondlist_flag = 1;
int iarg = 3;
while (iarg < narg) {
if (strcmp(arg[iarg],"bbox") == 0) {
bbox_flag = 1;
iarg++;
} else if (strcmp(arg[iarg],"bond/periodic") == 0) {
bond_flag = 1;
iarg++;
} else error->all(FLERR,"Illegal replicate command");
} }
if (bond_flag) bbox_flag = 1;
// error and warning checks // error and warning checks
if (nx <= 0 || ny <= 0 || nz <= 0) if (nx <= 0 || ny <= 0 || nz <= 0)
@ -91,7 +108,7 @@ void Replicate::command(int narg, char **arg)
} }
if (atom->nextra_grow || atom->nextra_restart || atom->nextra_store) if (atom->nextra_grow || atom->nextra_restart || atom->nextra_store)
error->all(FLERR,"Cannot replicate with fixes that store atom quantities"); error->all(FLERR,"Cannot replicate with fixes that store per-atom quantities");
// record wall time for atom replication // record wall time for atom replication
@ -110,7 +127,7 @@ void Replicate::command(int narg, char **arg)
// maxmol = largest molecule tag across all existing atoms // maxmol = largest molecule tag across all existing atoms
tagint maxmol = 0; maxmol = 0;
if (atom->molecule_flag) { if (atom->molecule_flag) {
for (i = 0; i < atom->nlocal; i++) maxmol = MAX(atom->molecule[i],maxmol); for (i = 0; i < atom->nlocal; i++) maxmol = MAX(atom->molecule[i],maxmol);
tagint maxmol_all; tagint maxmol_all;
@ -118,16 +135,16 @@ void Replicate::command(int narg, char **arg)
maxmol = maxmol_all; maxmol = maxmol_all;
} }
// reset image flags for bondlist option // reset image flags to zero for bond/periodic option
if (bondlist_flag)
if (bond_flag)
for (i=0; i<atom->nlocal; ++i) for (i=0; i<atom->nlocal; ++i)
atom->image[i] = ((imageint) IMGMAX << IMG2BITS) | atom->image[i] = ((imageint) IMGMAX << IMG2BITS) |
((imageint) IMGMAX << IMGBITS) | IMGMAX; ((imageint) IMGMAX << IMGBITS) | IMGMAX;
// check image flags maximum extent // _imagelo/hi = maximum extent of image flags in each dimension
// only efficient small image flags compared to new system // only efficient small image flags compared to new system
int _imagelo[3], _imagehi[3];
_imagelo[0] = 0; _imagelo[0] = 0;
_imagelo[1] = 0; _imagelo[1] = 0;
_imagelo[2] = 0; _imagelo[2] = 0;
@ -135,7 +152,7 @@ void Replicate::command(int narg, char **arg)
_imagehi[1] = 0; _imagehi[1] = 0;
_imagehi[2] = 0; _imagehi[2] = 0;
if (bbox_flag || bondlist_flag) { if (bbox_flag || bond_flag) {
for (i=0; i<atom->nlocal; ++i) { for (i=0; i<atom->nlocal; ++i) {
imageint image = atom->image[i]; imageint image = atom->image[i];
@ -157,14 +174,14 @@ void Replicate::command(int narg, char **arg)
} }
// unmap existing atoms via image flags // unmap existing atoms via image flags
// no-op for bond/periodic option
for (i = 0; i < atom->nlocal; i++) for (i = 0; i < atom->nlocal; i++)
domain->unmap(atom->x[i],atom->image[i]); domain->unmap(atom->x[i],atom->image[i]);
// communication buffer for all my atom's info // communication buffer for all my atom's info
// max_size = largest buffer needed by any proc // max_size = largest buffer needed by any proc
// must do before new Atom class created, // must do before new Atom class created, since size_restart() uses atom->nlocal
// since size_restart() uses atom->nlocal
int max_size; int max_size;
int send_size = atom->avec->size_restart(); int send_size = atom->avec->size_restart();
@ -177,7 +194,7 @@ void Replicate::command(int narg, char **arg)
// atom = new replicated atom class // atom = new replicated atom class
// also set atomKK for Kokkos version of Atom class // also set atomKK for Kokkos version of Atom class
Atom *old = atom; old = atom;
atomKK = nullptr; atomKK = nullptr;
if (lmp->kokkos) atom = atomKK = new AtomKokkos(lmp); if (lmp->kokkos) atom = atomKK = new AtomKokkos(lmp);
else atom = new Atom(lmp); else atom = new Atom(lmp);
@ -216,7 +233,7 @@ void Replicate::command(int narg, char **arg)
nrep*old->nimpropers < 0 || nrep*old->nimpropers >= MAXBIGINT) nrep*old->nimpropers < 0 || nrep*old->nimpropers >= MAXBIGINT)
error->all(FLERR,"Replicated system is too big"); error->all(FLERR,"Replicated system is too big");
// assign atom and topology counts in new class from old one // assign atom and topology counts in new Atom class from old Atom class
atom->natoms = old->natoms * nrep; atom->natoms = old->natoms * nrep;
atom->nbonds = old->nbonds * nrep; atom->nbonds = old->nbonds * nrep;
@ -258,18 +275,18 @@ void Replicate::command(int narg, char **arg)
// store old simulation box // store old simulation box
int triclinic = domain->triclinic; int triclinic = domain->triclinic;
double old_xprd = domain->xprd; old_xprd = domain->xprd;
double old_yprd = domain->yprd; old_yprd = domain->yprd;
double old_zprd = domain->zprd; old_zprd = domain->zprd;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
old_prd_half[i] = domain->prd_half[i]; old_prd_half[i] = domain->prd_half[i];
old_center[i] = 0.5*(domain->boxlo[i]+domain->boxhi[i]); old_center[i] = 0.5*(domain->boxlo[i]+domain->boxhi[i]);
} }
double old_xy = domain->xy; old_xy = domain->xy;
double old_xz = domain->xz; old_xz = domain->xz;
double old_yz = domain->yz; old_yz = domain->yz;
// setup new simulation box // define new simulation box
domain->boxhi[0] = domain->boxlo[0] + nx*old_xprd; domain->boxhi[0] = domain->boxlo[0] + nx*old_xprd;
domain->boxhi[1] = domain->boxlo[1] + ny*old_yprd; domain->boxhi[1] = domain->boxlo[1] + ny*old_yprd;
@ -280,15 +297,14 @@ void Replicate::command(int narg, char **arg)
domain->yz *= nz; domain->yz *= nz;
} }
// new problem setup using new box boundaries // setup of new system using new atom counts and new box boundaries
// allocate atom arrays to size N, rounded up by AtomVec->DELTA
if (nprocs == 1) n = static_cast<int> (atom->natoms); if (nprocs == 1) n = static_cast<int> (atom->natoms);
else n = static_cast<int> (LB_FACTOR * atom->natoms / nprocs); else n = static_cast<int> (LB_FACTOR * atom->natoms / nprocs);
atom->allocate_type_arrays(); atom->allocate_type_arrays();
// allocate atom arrays to size N, rounded up by AtomVec->DELTA
bigint nbig = n; bigint nbig = n;
nbig = atom->avec->roundup(nbig); nbig = atom->avec->roundup(nbig);
n = static_cast<int> (nbig); n = static_cast<int> (nbig);
@ -362,15 +378,23 @@ void Replicate::command(int narg, char **arg)
} }
} }
// loop over all procs // use
// if this iteration of loop is me:
// pack my unmapped atom data into buf
// bcast it to all other procs
// performs 3d replicate loop with while loop over atoms in buf
// x = new replicated position, remapped into simulation box
// unpack atom into new atom class from buf if I own it
// adjust tag, mol #, coord, topology info as needed
if (!bbox_flag) {
replicate_by_proc(nx,ny,nz,sublo,subhi,buf);
} else {
replicate_by_bbox(nx,ny,nz,sublo,subhi,buf);
}
/*
AtomVec *old_avec = old->avec; AtomVec *old_avec = old->avec;
AtomVec *avec = atom->avec; AtomVec *avec = atom->avec;
@ -381,7 +405,7 @@ void Replicate::command(int narg, char **arg)
double *coord; double *coord;
int tag_enable = atom->tag_enable; int tag_enable = atom->tag_enable;
if (bbox_flag || bondlist_flag) { if (bbox_flag || bond_flag) {
// allgather size of buf on each proc // allgather size of buf on each proc
@ -456,7 +480,7 @@ void Replicate::command(int narg, char **arg)
// store x and tag for the whole system (before replication) // store x and tag for the whole system (before replication)
if (bondlist_flag) { if (bond_flag) {
memory->create(old_x,old->natoms,3,"replicate:old_x"); memory->create(old_x,old->natoms,3,"replicate:old_x");
memory->create(old_tag,old->natoms,"replicate:old_tag"); memory->create(old_tag,old->natoms,"replicate:old_tag");
@ -668,13 +692,13 @@ void Replicate::command(int narg, char **arg)
if (atom->molecular == Atom::MOLECULAR) { if (atom->molecular == Atom::MOLECULAR) {
if (atom->avec->bonds_allow) if (atom->avec->bonds_allow)
for (j = 0; j < atom->num_bond[i]; j++) { for (j = 0; j < atom->num_bond[i]; j++) {
if (bondlist_flag) if (bond_flag)
newtag(atom0tag,atom->bond_atom[i][j]); newtag(atom0tag,atom->bond_atom[i][j]);
else atom->bond_atom[i][j] += atom_offset; else atom->bond_atom[i][j] += atom_offset;
} }
if (atom->avec->angles_allow) if (atom->avec->angles_allow)
for (j = 0; j < atom->num_angle[i]; j++) { for (j = 0; j < atom->num_angle[i]; j++) {
if (bondlist_flag) { if (bond_flag) {
newtag(atom0tag,atom->angle_atom1[i][j]); newtag(atom0tag,atom->angle_atom1[i][j]);
newtag(atom0tag,atom->angle_atom2[i][j]); newtag(atom0tag,atom->angle_atom2[i][j]);
newtag(atom0tag,atom->angle_atom3[i][j]); newtag(atom0tag,atom->angle_atom3[i][j]);
@ -686,7 +710,7 @@ void Replicate::command(int narg, char **arg)
} }
if (atom->avec->dihedrals_allow) if (atom->avec->dihedrals_allow)
for (j = 0; j < atom->num_dihedral[i]; j++) { for (j = 0; j < atom->num_dihedral[i]; j++) {
if (bondlist_flag) { if (bond_flag) {
newtag(atom0tag,atom->dihedral_atom1[i][j]); newtag(atom0tag,atom->dihedral_atom1[i][j]);
newtag(atom0tag,atom->dihedral_atom2[i][j]); newtag(atom0tag,atom->dihedral_atom2[i][j]);
newtag(atom0tag,atom->dihedral_atom3[i][j]); newtag(atom0tag,atom->dihedral_atom3[i][j]);
@ -700,7 +724,7 @@ void Replicate::command(int narg, char **arg)
} }
if (atom->avec->impropers_allow) if (atom->avec->impropers_allow)
for (j = 0; j < atom->num_improper[i]; j++) { for (j = 0; j < atom->num_improper[i]; j++) {
if (bondlist_flag) { if (bond_flag) {
newtag(atom0tag,atom->improper_atom1[i][j]); newtag(atom0tag,atom->improper_atom1[i][j]);
newtag(atom0tag,atom->improper_atom2[i][j]); newtag(atom0tag,atom->improper_atom2[i][j]);
newtag(atom0tag,atom->improper_atom3[i][j]); newtag(atom0tag,atom->improper_atom3[i][j]);
@ -725,7 +749,7 @@ void Replicate::command(int narg, char **arg)
memory->destroy(size_buf_rnk); memory->destroy(size_buf_rnk);
memory->destroy(disp_buf_rnk); memory->destroy(disp_buf_rnk);
memory->destroy(buf_all); memory->destroy(buf_all);
if (bondlist_flag) { if (bond_flag) {
memory->destroy(old_x); memory->destroy(old_x);
memory->destroy(old_tag); memory->destroy(old_tag);
} }
@ -825,7 +849,13 @@ void Replicate::command(int narg, char **arg)
} }
} }
} }
} // if (bbox_flag || bondlist_flag) } // if (bbox_flag || bond_flag)
*/
// free communication buffer and old atom class // free communication buffer and old atom class
@ -889,8 +919,511 @@ void Replicate::command(int narg, char **arg)
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
find new tag for the atom 'atom2bond' bonded to atom 'atom0' simple replication algorithm, suitable for small proc count
for bondlist option, useful for periodic loops or inconsistent image flags ------------------------------------------------------------------------- */
void Replicate::replicate_by_proc(int nx, int ny, int nz,
double *sublo, double *subhi, double *buf)
{
int i,j,m,n;
int ix,iy,iz;
int me = comm->me;
int nprocs = comm->nprocs;
int triclinic = domain->triclinic;
int tag_enable = atom->tag_enable;
AtomVec *old_avec = old->avec;
AtomVec *avec = atom->avec;
tagint atom_offset,mol_offset;
imageint image;
double x[3],lamda[3];
double *coord;
// loop over all procs
// if this iteration of loop is me:
// pack my unmapped atom data into buf
// bcast it to all other procs
for (int iproc = 0; iproc < nprocs; iproc++) {
if (me == iproc) {
n = 0;
for (i = 0; i < old->nlocal; i++) n += old_avec->pack_restart(i,&buf[n]);
}
MPI_Bcast(&n,1,MPI_INT,iproc,world);
MPI_Bcast(buf,n,MPI_DOUBLE,iproc,world);
for (ix = 0; ix < nx; ix++) {
for (iy = 0; iy < ny; iy++) {
for (iz = 0; iz < nz; iz++) {
// while loop over one proc's atom list
// x = new replicated position, remapped into new simulation box
// if atom is within my new subdomain, unpack it into new atom class
// adjust tag, mol #, coord, topology info as needed
m = 0;
while (m < n) {
image = ((imageint) IMGMAX << IMG2BITS) |
((imageint) IMGMAX << IMGBITS) | IMGMAX;
if (triclinic == 0) {
x[0] = buf[m+1] + ix*old_xprd;
x[1] = buf[m+2] + iy*old_yprd;
x[2] = buf[m+3] + iz*old_zprd;
} else {
x[0] = buf[m+1] + ix*old_xprd + iy*old_xy + iz*old_xz;
x[1] = buf[m+2] + iy*old_yprd + iz*old_yz;
x[2] = buf[m+3] + iz*old_zprd;
}
domain->remap(x,image);
if (triclinic) {
domain->x2lamda(x,lamda);
coord = lamda;
} else coord = x;
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]) {
m += avec->unpack_restart(&buf[m]);
i = atom->nlocal - 1;
if (tag_enable) atom_offset = iz*ny*nx*maxtag + iy*nx*maxtag + ix*maxtag;
else atom_offset = 0;
mol_offset = iz*ny*nx*maxmol + iy*nx*maxmol + ix*maxmol;
atom->x[i][0] = x[0];
atom->x[i][1] = x[1];
atom->x[i][2] = x[2];
atom->tag[i] += atom_offset;
atom->image[i] = image;
if (atom->molecular != Atom::ATOMIC) {
if (atom->molecule[i] > 0)
atom->molecule[i] += mol_offset;
if (atom->molecular == Atom::MOLECULAR) {
if (atom->avec->bonds_allow)
for (j = 0; j < atom->num_bond[i]; j++)
atom->bond_atom[i][j] += atom_offset;
if (atom->avec->angles_allow)
for (j = 0; j < atom->num_angle[i]; j++) {
atom->angle_atom1[i][j] += atom_offset;
atom->angle_atom2[i][j] += atom_offset;
atom->angle_atom3[i][j] += atom_offset;
}
if (atom->avec->dihedrals_allow)
for (j = 0; j < atom->num_dihedral[i]; j++) {
atom->dihedral_atom1[i][j] += atom_offset;
atom->dihedral_atom2[i][j] += atom_offset;
atom->dihedral_atom3[i][j] += atom_offset;
atom->dihedral_atom4[i][j] += atom_offset;
}
if (atom->avec->impropers_allow)
for (j = 0; j < atom->num_improper[i]; j++) {
atom->improper_atom1[i][j] += atom_offset;
atom->improper_atom2[i][j] += atom_offset;
atom->improper_atom3[i][j] += atom_offset;
atom->improper_atom4[i][j] += atom_offset;
}
}
}
} else m += static_cast<int> (buf[m]);
}
}
}
}
}
}
/* ----------------------------------------------------------------------
more complex replication algorithm
uses bounding box of each proc's subdomain to avoid checking individual atoms
faster for large processor counts
required for bond/periodic option
------------------------------------------------------------------------- */
void Replicate::replicate_by_bbox(int nx, int ny, int nz,
double *sublo, double *subhi, double *buf)
{
int i,j,m,n;
int ix,iy,iz;
int me = comm->me;
int nprocs = comm->nprocs;
int triclinic = domain->triclinic;
int tag_enable = atom->tag_enable;
AtomVec *old_avec = old->avec;
AtomVec *avec = atom->avec;
tagint atom_offset,mol_offset,atom0tag;
imageint image;
double x[3],lamda[3];
double *coord;
// allgather size of buf on each proc
n = 0;
for (i = 0; i < old->nlocal; i++) n += old_avec->pack_restart(i,&buf[n]);
int * size_buf_rnk;
memory->create(size_buf_rnk, nprocs, "replicate:size_buf_rnk");
MPI_Allgather(&n, 1, MPI_INT, size_buf_rnk, 1, MPI_INT, world);
// size of buf_all
int size_buf_all = 0;
MPI_Allreduce(&n, &size_buf_all, 1, MPI_INT, MPI_SUM, world);
if (me == 0) {
auto mesg = fmt::format(" bounding box image = ({} {} {}) "
"to ({} {} {})\n",
_imagelo[0],_imagelo[1],_imagelo[2],
_imagehi[0],_imagehi[1],_imagehi[2]);
mesg += fmt::format(" bounding box extra memory = {:.2f} MB\n",
(double)size_buf_all*sizeof(double)/1024/1024);
utils::logmesg(lmp,mesg);
}
// rnk offsets
int *disp_buf_rnk;
memory->create(disp_buf_rnk, nprocs, "replicate:disp_buf_rnk");
disp_buf_rnk[0] = 0;
for (i = 1; i < nprocs; i++)
disp_buf_rnk[i] = disp_buf_rnk[i-1] + size_buf_rnk[i-1];
// allgather buf_all
double *buf_all;
memory->create(buf_all, size_buf_all, "replicate:buf_all");
MPI_Allgatherv(buf,n,MPI_DOUBLE,buf_all,size_buf_rnk,disp_buf_rnk,
MPI_DOUBLE,world);
// bounding box of original unwrapped system
double _orig_lo[3], _orig_hi[3];
if (triclinic) {
_orig_lo[0] = domain->boxlo[0] +
_imagelo[0] * old_xprd + _imagelo[1] * old_xy + _imagelo[2] * old_xz;
_orig_lo[1] = domain->boxlo[1] +
_imagelo[1] * old_yprd + _imagelo[2] * old_yz;
_orig_lo[2] = domain->boxlo[2] + _imagelo[2] * old_zprd;
_orig_hi[0] = domain->boxlo[0] +
(_imagehi[0]+1) * old_xprd +
(_imagehi[1]+1) * old_xy + (_imagehi[2]+1) * old_xz;
_orig_hi[1] = domain->boxlo[1] +
(_imagehi[1]+1) * old_yprd + (_imagehi[2]+1) * old_yz;
_orig_hi[2] = domain->boxlo[2] + (_imagehi[2]+1) * old_zprd;
} else {
_orig_lo[0] = domain->boxlo[0] + _imagelo[0] * old_xprd;
_orig_lo[1] = domain->boxlo[1] + _imagelo[1] * old_yprd;
_orig_lo[2] = domain->boxlo[2] + _imagelo[2] * old_zprd;
_orig_hi[0] = domain->boxlo[0] + (_imagehi[0]+1) * old_xprd;
_orig_hi[1] = domain->boxlo[1] + (_imagehi[1]+1) * old_yprd;
_orig_hi[2] = domain->boxlo[2] + (_imagehi[2]+1) * old_zprd;
}
double _lo[3], _hi[3];
int num_replicas_added = 0;
// if bond/periodic option
// store old_x and old_tag for the entire original system
if (bond_flag) {
memory->create(old_x,old->natoms,3,"replicate:old_x");
memory->create(old_tag,old->natoms,"replicate:old_tag");
i = m = 0;
while (m < size_buf_all) {
old_x[i][0] = buf_all[m+1];
old_x[i][1] = buf_all[m+2];
old_x[i][2] = buf_all[m+3];
old_tag[i] = (tagint) ubuf(buf_all[m+4]).i;
old_map.insert({old_tag[i],i});
m += static_cast<int> (buf_all[m]);
i++;
}
}
// replication loop
for (ix = 0; ix < nx; ix++) {
for (iy = 0; iy < ny; iy++) {
for (iz = 0; iz < nz; iz++) {
thisrep[0] = ix;
thisrep[1] = iy;
thisrep[2] = iz;
// domain->remap() overwrites coordinates, so always recompute here
if (triclinic) {
_lo[0] = _orig_lo[0] + ix * old_xprd + iy * old_xy + iz * old_xz;
_hi[0] = _orig_hi[0] + ix * old_xprd + iy * old_xy + iz * old_xz;
_lo[1] = _orig_lo[1] + iy * old_yprd + iz * old_yz;
_hi[1] = _orig_hi[1] + iy * old_yprd + iz * old_yz;
_lo[2] = _orig_lo[2] + iz * old_zprd;
_hi[2] = _orig_hi[2] + iz * old_zprd;
} else {
_lo[0] = _orig_lo[0] + ix * old_xprd;
_hi[0] = _orig_hi[0] + ix * old_xprd;
_lo[1] = _orig_lo[1] + iy * old_yprd;
_hi[1] = _orig_hi[1] + iy * old_yprd;
_lo[2] = _orig_lo[2] + iz * old_zprd;
_hi[2] = _orig_hi[2] + iz * old_zprd;
}
// test if bounding box of shifted replica overlaps sub-domain of proc
// if not, then can skip testing of any individual atoms
int xoverlap = 1;
int yoverlap = 1;
int zoverlap = 1;
if (triclinic) {
double _llo[3];
domain->x2lamda(_lo,_llo);
double _lhi[3];
domain->x2lamda(_hi,_lhi);
if (_llo[0] > (subhi[0] - EPSILON)
|| _lhi[0] < (sublo[0] + EPSILON) ) xoverlap = 0;
if (_llo[1] > (subhi[1] - EPSILON)
|| _lhi[1] < (sublo[1] + EPSILON) ) yoverlap = 0;
if (_llo[2] > (subhi[2] - EPSILON)
|| _lhi[2] < (sublo[2] + EPSILON) ) zoverlap = 0;
} else {
if (_lo[0] > (subhi[0] - EPSILON)
|| _hi[0] < (sublo[0] + EPSILON) ) xoverlap = 0;
if (_lo[1] > (subhi[1] - EPSILON)
|| _hi[1] < (sublo[1] + EPSILON) ) yoverlap = 0;
if (_lo[2] > (subhi[2] - EPSILON)
|| _hi[2] < (sublo[2] + EPSILON) ) zoverlap = 0;
}
int overlap = 0;
if (xoverlap && yoverlap && zoverlap) overlap = 1;
// if no overlap, test if bounding box wrapped back into new system
if (!overlap) {
// wrap back into cell
imageint imagelo = ((imageint) IMGMAX << IMG2BITS) |
((imageint) IMGMAX << IMGBITS) | IMGMAX;
domain->remap(&(_lo[0]), imagelo);
int xboxlo = (imagelo & IMGMASK) - IMGMAX;
int yboxlo = (imagelo >> IMGBITS & IMGMASK) - IMGMAX;
int zboxlo = (imagelo >> IMG2BITS) - IMGMAX;
imageint imagehi = ((imageint) IMGMAX << IMG2BITS) |
((imageint) IMGMAX << IMGBITS) | IMGMAX;
domain->remap(&(_hi[0]), imagehi);
int xboxhi = (imagehi & IMGMASK) - IMGMAX;
int yboxhi = (imagehi >> IMGBITS & IMGMASK) - IMGMAX;
int zboxhi = (imagehi >> IMG2BITS) - IMGMAX;
if (triclinic) {
double _llo[3];
_llo[0] = _lo[0]; _llo[1] = _lo[1]; _llo[2] = _lo[2];
domain->x2lamda(_llo,_lo);
double _lhi[3];
_lhi[0] = _hi[0]; _lhi[1] = _hi[1]; _lhi[2] = _hi[2];
domain->x2lamda(_lhi,_hi);
}
// test all fragments for any overlap; ok to include false positives
int _xoverlap1 = 0;
int _xoverlap2 = 0;
if (!xoverlap) {
if (xboxlo < 0) {
_xoverlap1 = 1;
if (_lo[0] > (subhi[0] - EPSILON)) _xoverlap1 = 0;
}
if (xboxhi > 0) {
_xoverlap2 = 1;
if (_hi[0] < (sublo[0] + EPSILON)) _xoverlap2 = 0;
}
if (_xoverlap1 || _xoverlap2) xoverlap = 1;
}
int _yoverlap1 = 0;
int _yoverlap2 = 0;
if (!yoverlap) {
if (yboxlo < 0) {
_yoverlap1 = 1;
if (_lo[1] > (subhi[1] - EPSILON)) _yoverlap1 = 0;
}
if (yboxhi > 0) {
_yoverlap2 = 1;
if (_hi[1] < (sublo[1] + EPSILON)) _yoverlap2 = 0;
}
if (_yoverlap1 || _yoverlap2) yoverlap = 1;
}
int _zoverlap1 = 0;
int _zoverlap2 = 0;
if (!zoverlap) {
if (zboxlo < 0) {
_zoverlap1 = 1;
if (_lo[2] > (subhi[2] - EPSILON)) _zoverlap1 = 0;
}
if (zboxhi > 0) {
_zoverlap2 = 1;
if (_hi[2] < (sublo[2] + EPSILON)) _zoverlap2 = 0;
}
if (_zoverlap1 || _zoverlap2) zoverlap = 1;
}
// does either fragment overlap w/ sub-domain
if (xoverlap && yoverlap && zoverlap) overlap = 1;
}
// while loop over one proc's atom list
if (overlap) {
num_replicas_added++;
m = 0;
while (m < size_buf_all) {
image = ((imageint) IMGMAX << IMG2BITS) |
((imageint) IMGMAX << IMGBITS) | IMGMAX;
if (triclinic == 0) {
x[0] = buf_all[m+1] + ix*old_xprd;
x[1] = buf_all[m+2] + iy*old_yprd;
x[2] = buf_all[m+3] + iz*old_zprd;
} else {
x[0] = buf_all[m+1] + ix*old_xprd + iy*old_xy + iz*old_xz;
x[1] = buf_all[m+2] + iy*old_yprd + iz*old_yz;
x[2] = buf_all[m+3] + iz*old_zprd;
}
domain->remap(x,image);
if (triclinic) {
domain->x2lamda(x,lamda);
coord = lamda;
} else coord = x;
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]) {
m += avec->unpack_restart(&buf_all[m]);
i = atom->nlocal - 1;
if (tag_enable)
atom_offset = iz*ny*nx*maxtag + iy*nx*maxtag + ix*maxtag;
else atom_offset = 0;
mol_offset = iz*ny*nx*maxmol + iy*nx*maxmol + ix*maxmol;
atom->x[i][0] = x[0];
atom->x[i][1] = x[1];
atom->x[i][2] = x[2];
atom0tag = atom->tag[i];
atom->tag[i] += atom_offset;
atom->image[i] = image;
if (atom->molecular != Atom::ATOMIC) {
if (atom->molecule[i] > 0)
atom->molecule[i] += mol_offset;
if (atom->molecular == Atom::MOLECULAR) {
if (atom->avec->bonds_allow)
for (j = 0; j < atom->num_bond[i]; j++) {
if (bond_flag)
newtag(atom0tag,atom->bond_atom[i][j]);
else atom->bond_atom[i][j] += atom_offset;
}
if (atom->avec->angles_allow)
for (j = 0; j < atom->num_angle[i]; j++) {
if (bond_flag) {
newtag(atom0tag,atom->angle_atom1[i][j]);
newtag(atom0tag,atom->angle_atom2[i][j]);
newtag(atom0tag,atom->angle_atom3[i][j]);
} else {
atom->angle_atom1[i][j] += atom_offset;
atom->angle_atom2[i][j] += atom_offset;
atom->angle_atom3[i][j] += atom_offset;
}
}
if (atom->avec->dihedrals_allow)
for (j = 0; j < atom->num_dihedral[i]; j++) {
if (bond_flag) {
newtag(atom0tag,atom->dihedral_atom1[i][j]);
newtag(atom0tag,atom->dihedral_atom2[i][j]);
newtag(atom0tag,atom->dihedral_atom3[i][j]);
newtag(atom0tag,atom->dihedral_atom4[i][j]);
} else {
atom->dihedral_atom1[i][j] += atom_offset;
atom->dihedral_atom2[i][j] += atom_offset;
atom->dihedral_atom3[i][j] += atom_offset;
atom->dihedral_atom4[i][j] += atom_offset;
}
}
if (atom->avec->impropers_allow)
for (j = 0; j < atom->num_improper[i]; j++) {
if (bond_flag) {
newtag(atom0tag,atom->improper_atom1[i][j]);
newtag(atom0tag,atom->improper_atom2[i][j]);
newtag(atom0tag,atom->improper_atom3[i][j]);
newtag(atom0tag,atom->improper_atom4[i][j]);
} else {
atom->improper_atom1[i][j] += atom_offset;
atom->improper_atom2[i][j] += atom_offset;
atom->improper_atom3[i][j] += atom_offset;
atom->improper_atom4[i][j] += atom_offset;
}
}
}
}
} else m += static_cast<int> (buf_all[m]);
}
}
}
}
}
memory->destroy(size_buf_rnk);
memory->destroy(disp_buf_rnk);
memory->destroy(buf_all);
if (bond_flag) {
memory->destroy(old_x);
memory->destroy(old_tag);
}
int sum = 0;
MPI_Reduce(&num_replicas_added, &sum, 1, MPI_INT, MPI_SUM, 0, world);
double avg = (double) sum / nprocs;
if (me == 0)
utils::logmesg(lmp," average # of replicas added to proc = {:.2f} out "
"of {} ({:.2f}%)\n",avg,nx*ny*nz,avg/(nx*ny*nz)*100.0);
}
/* ----------------------------------------------------------------------
find new tag for atom 'atom2bond' bonded to atom 'atom0'
for bond/periodic option
useful for periodic loops or inconsistent image flags
reassign bond if > old boxlength / 2 reassign bond if > old boxlength / 2
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -32,12 +32,26 @@ class Replicate : public Command {
void command(int, char **) override; void command(int, char **) override;
private: private:
std::unordered_map<tagint, int> old_map; int bbox_flag, bond_flag;
class Atom *old;
double old_xprd, old_yprd, old_zprd;
double old_xy, old_xz, old_yz;
int _imagelo[3], _imagehi[3];
double **old_x; double **old_x;
double old_prd_half[3], old_center[3]; double old_prd_half[3], old_center[3];
tagint *old_tag; tagint *old_tag;
tagint maxtag; tagint maxtag, maxmol;
int thisrep[3], allnrep[3]; int thisrep[3], allnrep[3];
std::unordered_map<tagint, int> old_map;
void replicate_by_proc(int, int, int, double *, double *, double *);
void replicate_by_bbox(int, int, int, double *, double *, double *);
void newtag(tagint, tagint &); void newtag(tagint, tagint &);
}; };