Merge pull request #2536 from jtclemm/multi_epcc

Add faster method for multi neighboring
This commit is contained in:
Axel Kohlmeyer
2021-05-12 15:25:28 -04:00
committed by GitHub
163 changed files with 28876 additions and 1639 deletions

View File

@ -108,6 +108,8 @@ Lowercase directories
+-------------+------------------------------------------------------------------+ +-------------+------------------------------------------------------------------+
| msst | MSST shock dynamics | | msst | MSST shock dynamics |
+-------------+------------------------------------------------------------------+ +-------------+------------------------------------------------------------------+
| multi | multi neighboring for systems with large interaction disparities |
+-------------+------------------------------------------------------------------+
| nb3b | use of non-bonded 3-body harmonic pair style | | nb3b | use of non-bonded 3-body harmonic pair style |
+-------------+------------------------------------------------------------------+ +-------------+------------------------------------------------------------------+
| neb | nudged elastic band (NEB) calculation for barrier finding | | neb | nudged elastic band (NEB) calculation for barrier finding |

View File

@ -11,13 +11,17 @@ Syntax
comm_modify keyword value ... comm_modify keyword value ...
* zero or more keyword/value pairs may be appended * zero or more keyword/value pairs may be appended
* keyword = *mode* or *cutoff* or *cutoff/multi* or *group* or *vel* * keyword = *mode* or *cutoff* or *cutoff/multi* or *multi/reduce* or *group* or *vel*
.. parsed-literal:: .. parsed-literal::
*mode* value = *single* or *multi* = communicate atoms within a single or multiple distances *mode* value = *single*, *multi*, or *multi/old* = communicate atoms within a single or multiple distances
*cutoff* value = Rcut (distance units) = communicate atoms from this far away *cutoff* value = Rcut (distance units) = communicate atoms from this far away
*cutoff/multi* type value *cutoff/multi* collection value
collection = atom collection or collection range (supports asterisk notation)
value = Rcut (distance units) = communicate atoms for selected types from this far away
*reduce/multi* arg = none = reduce number of communicated ghost atoms for multi style
*cutoff/multi/old* type value
type = atom type or type range (supports asterisk notation) type = atom type or type range (supports asterisk notation)
value = Rcut (distance units) = communicate atoms for selected types from this far away value = Rcut (distance units) = communicate atoms for selected types from this far away
*group* value = group-ID = only communicate atoms in the group *group* value = group-ID = only communicate atoms in the group
@ -28,7 +32,7 @@ Examples
.. code-block:: LAMMPS .. code-block:: LAMMPS
comm_modify mode multi comm_modify mode multi reduce/multi
comm_modify mode multi group solvent comm_modify mode multi group solvent
comm_modift mode multi cutoff/multi 1 10.0 cutoff/multi 2*4 15.0 comm_modift mode multi cutoff/multi 1 10.0 cutoff/multi 2*4 15.0
comm_modify vel yes comm_modify vel yes
@ -62,12 +66,18 @@ sub-domain. The distance is by default the maximum of the neighbor
cutoff across all atom type pairs. cutoff across all atom type pairs.
For many systems this is an efficient algorithm, but for systems with For many systems this is an efficient algorithm, but for systems with
widely varying cutoffs for different type pairs, the *multi* mode can widely varying cutoffs for different type pairs, the *multi* or *multi/old* mode can
be faster. In this case, each atom type is assigned its own distance be faster. In *multi*, each atom is assigned to a collection which should
correspond to a set of atoms with similar interaction cutoffs.
In this case, each atom collection is assigned its own distance
cutoff for communication purposes, and fewer atoms will be cutoff for communication purposes, and fewer atoms will be
communicated. See the :doc:`neighbor multi <neighbor>` command for a communicated. in *multi/old*, a similar technique is used but atoms
neighbor list construction option that may also be beneficial for are grouped by atom type. See the :doc:`neighbor multi <neighbor>` and
simulations of this kind. :doc:`neighbor multi/old <neighbor>` commands for
neighbor list construction options that may also be beneficial for
simulations of this kind. The *multi* communiction mode is only compatable
with the *multi* neighbor style. The *multi/old* communication mode is compatble
with both the *multi* and *multi/old* neighbor styles.
The *cutoff* keyword allows you to extend the ghost cutoff distance The *cutoff* keyword allows you to extend the ghost cutoff distance
for communication mode *single*\ , which is the distance from the borders for communication mode *single*\ , which is the distance from the borders
@ -87,12 +97,26 @@ warning is printed, if this bond based estimate is larger than the
communication cutoff used. communication cutoff used.
The *cutoff/multi* option is equivalent to *cutoff*\ , but applies to The *cutoff/multi* option is equivalent to *cutoff*\ , but applies to
communication mode *multi* instead. Since in this case the communication communication mode *multi* instead. Since the communication
cutoffs are determined per atom type, a type specifier is needed and cutoffs are determined per atom collections, a collection specifier is needed and
cutoff for one or multiple types can be extended. Also ranges of types cutoff for one or multiple collections can be extended. Also ranges of collections
using the usual asterisk notation can be given. For granular pair styles, using the usual asterisk notation can be given.
the default cutoff is set to the sum of the current maximum atomic radii Collections are indexed from 1 to N where N is the total number of collections.
for each type. Note that the arguments for *cutoff/multi* are parsed right before each
simulation to account for potential changes in the number of collections.
Custom cutoffs are preserved between runs but if collections are redefined,
one may want to respecify communication cutoffs.
For granular pair styles,the default cutoff is set to the sum of the
current maximum atomic radii for each collection.
The *cutoff/multi/old* option is similar to *cutoff/multi* except it
operates on atom types as opposed to collections.
The *reduce/multi* option applies to *multi* and sets the communication
cutoff for a particle equal to the maximum interaction distance between particles
in the same collection. This reduces the number of
ghost atoms that need to be communicated. This method is only compatible with the
*multi* neighbor style and requires a half neighbor list and Newton on.
See the :doc:`neighbor multi <neighbor>` command for more information.
These are simulation scenarios in which it may be useful or even These are simulation scenarios in which it may be useful or even
necessary to set a ghost cutoff > neighbor cutoff: necessary to set a ghost cutoff > neighbor cutoff:

View File

@ -14,7 +14,7 @@ Syntax
.. parsed-literal:: .. parsed-literal::
keyword = *delay* or *every* or *check* or *once* or *cluster* or *include* or *exclude* or *page* or *one* or *binsize* keyword = *delay* or *every* or *check* or *once* or *cluster* or *include* or *exclude* or *page* or *one* or *binsize* or *collection/type* or *collection/interval*
*delay* value = N *delay* value = N
N = delay building until this many steps since last build N = delay building until this many steps since last build
*every* value = M *every* value = M
@ -47,6 +47,12 @@ Syntax
N = max number of neighbors of one atom N = max number of neighbors of one atom
*binsize* value = size *binsize* value = size
size = bin size for neighbor list construction (distance units) size = bin size for neighbor list construction (distance units)
*collection/type* values = N arg1 ... argN
N = number of custom collections
arg = N separate lists of types (see below)
*collection/interval* values = N arg1 ... argN
N = number of custom collections
arg = N separate cutoffs for intervals (see below)
Examples Examples
"""""""" """"""""
@ -58,6 +64,8 @@ Examples
neigh_modify exclude group frozen frozen check no neigh_modify exclude group frozen frozen check no
neigh_modify exclude group residue1 chain3 neigh_modify exclude group residue1 chain3
neigh_modify exclude molecule/intra rigid neigh_modify exclude molecule/intra rigid
neigh_modify collection/type 2 1*2,5 3*4
neigh_modify collection/interval 2 1.0 10.0
Description Description
""""""""""" """""""""""
@ -188,8 +196,9 @@ atom can have.
The *binsize* option allows you to specify what size of bins will be The *binsize* option allows you to specify what size of bins will be
used in neighbor list construction to sort and find neighboring atoms. used in neighbor list construction to sort and find neighboring atoms.
By default, for :doc:`neighbor style bin <neighbor>`, LAMMPS uses bins By default, for :doc:`neighbor style bin <neighbor>`, LAMMPS uses bins
that are 1/2 the size of the maximum pair cutoff. For :doc:`neighbor style multi <neighbor>`, the bins are 1/2 the size of the minimum pair that are 1/2 the size of the maximum pair cutoff. For :doc:`neighbor style multi <neighbor>`,
cutoff. Typically these are good values for minimizing the time for the bins are 1/2 the size of the collection interaction cutoff.
Typically these are good values for minimizing the time for
neighbor list construction. This setting overrides the default. neighbor list construction. This setting overrides the default.
If you make it too big, there is little overhead due to If you make it too big, there is little overhead due to
looping over bins, but more atoms are checked. If you make it too looping over bins, but more atoms are checked. If you make it too
@ -197,6 +206,30 @@ small, the optimal number of atoms is checked, but bin overhead goes
up. If you set the binsize to 0.0, LAMMPS will use the default up. If you set the binsize to 0.0, LAMMPS will use the default
binsize of 1/2 the cutoff. binsize of 1/2 the cutoff.
The *collection/type* option allows you to define collections of atom
types, used by the *multi* neighbor mode. By grouping atom types with
similar physical size or interaction cutoff lengths, one may be able
to improve performance by reducing
overhead. You must first specify the number of collections N to be
defined followed by N lists of types. Each list consists of a series of type
ranges separated by commas. The range can be specified as a
single numeric value, or a wildcard asterisk can be used to specify a range
of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For
example, if M = the number of atom types, then an asterisk with no numeric
values means all types from 1 to M. A leading asterisk means all types
from 1 to n (inclusive). A trailing asterisk means all types from n to M
(inclusive). A middle asterisk means all types from m to n (inclusive).
Note that all atom types must be included in exactly one of the N collections.
The *collection/interval* option provides a similar capability.
This command allows a user to define collections by specifying a
series of cutoff intervals. LAMMPS will automatically sort atoms into these intervals
based on their type-dependent cutoffs or their finite size.
You must first specify the number of collections N to be
defined followed by N values representing the upper cutoff of each interval.
This command is particularly useful for granular pairstyles where the interaction distance
of particles depends on their radius and may not depend on their atom type.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -11,7 +11,7 @@ Syntax
neighbor skin style neighbor skin style
* skin = extra distance beyond force cutoff (distance units) * skin = extra distance beyond force cutoff (distance units)
* style = *bin* or *nsq* or *multi* * style = *bin* or *nsq* or *multi* or *multi/old*
Examples Examples
"""""""" """"""""
@ -55,14 +55,31 @@ For the *bin* style, the bin size is set to 1/2 of
the largest cutoff distance between any pair of atom types and a the largest cutoff distance between any pair of atom types and a
single set of bins is defined to search over for all atom types. This single set of bins is defined to search over for all atom types. This
can be inefficient if one pair of types has a very long cutoff, but can be inefficient if one pair of types has a very long cutoff, but
other type pairs have a much shorter cutoff. For style *multi* the other type pairs have a much shorter cutoff. The *multi* style uses
bin size is set to 1/2 of the shortest cutoff distance and multiple different sized bins for collections of different sized particles, where
sets of bins are defined to search over for different atom types. "size" may mean the physical size of the particle or its cutoff
distance for interacting with other particles. Different
sets of bins are then used to construct the neighbor lists as as further
described by Shire, Hanley, and Stratford :ref:`(Shire) <bytype-Shire>`.
This imposes some extra setup overhead, but the searches themselves This imposes some extra setup overhead, but the searches themselves
may be much faster for the short-cutoff cases. may be much faster. By default, each atom type defines a separate
See the :doc:`comm_modify mode multi <comm_modify>` command for a collection of particles. For systems where two or more atom types
communication option that may also be beneficial for simulations of have the same size (either physical size or cutoff distance), the
this kind. definition of collections can be customized, which can result in less
overhead and faster performance. See the :doc:`neigh_modify <neigh_modify>`
command for how to define custom collections. Whether the collection
definition is customized or not, also see the
:doc:`comm_modify mode multi <comm_modify>` command for communication
options that further improve performance in a manner consistent with
neighbor style multi.
An alternate style, *multi/old*, sets the bin size to 1/2 of the shortest
cutoff distance and multiple sets of bins are defined to search over for
different atom types. This algorithm used to be the default *multi*
algorithm in LAMMPS but was found to be significantly slower than the new
approach. For now we are keeping the old option in case there are use cases
where multi/old outperforms the new multi style.
The :doc:`neigh_modify <neigh_modify>` command has additional options The :doc:`neigh_modify <neigh_modify>` command has additional options
that control how often neighbor lists are built and which pairs are that control how often neighbor lists are built and which pairs are
@ -90,3 +107,9 @@ Default
| 0.001 bin for units = si, skin = 0.001 meters = 1.0 mm | 0.001 bin for units = si, skin = 0.001 meters = 1.0 mm
| 0.1 bin for units = cgs, skin = 0.1 cm = 1.0 mm | 0.1 bin for units = cgs, skin = 0.1 cm = 1.0 mm
| |
----------
.. _bytype-Shire:
**(Shire)** Shire, Hanley and Stratford, Comp Part Mech, (2020).

View File

@ -86,7 +86,7 @@ pair_style gran/hertz/history &
${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
pair_coeff * * pair_coeff * *
neighbor ${skin} bin neighbor ${skin} multi
thermo ${logfreq} thermo ${logfreq}
comm_style brick comm_style brick

View File

@ -49,7 +49,7 @@ pair_style gran/hertz/history &
${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1 ${kn} ${kt} ${gamma_n} ${gamma_t} ${coeffFric} 1
pair_coeff * * pair_coeff * *
neighbor ${skin} bin neighbor ${skin} multi
thermo ${logfreq} thermo ${logfreq}
comm_style brick comm_style brick

20015
examples/multi/data.powerlaw Normal file

File diff suppressed because it is too large Load Diff

67
examples/multi/in.colloid Normal file
View File

@ -0,0 +1,67 @@
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.1
region box block 0 60 0 60 -0.5 0.5
create_box 5 box
create_atoms 1 box
#Roughly equally partition atoms between types 1-4
set group all type/fraction 2 0.500 23984
set group all type/fraction 3 0.333 43684
set group all type/fraction 4 0.250 87811
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 60.0 60.0 0.0 30.0 units box
region sphere2 sphere 130.0 130.0 0.0 30.0 units box
delete_atoms region sphere1
delete_atoms region sphere2
create_atoms 5 single 60.0 60.0 0.0 units box
create_atoms 5 single 130.0 130.0 0.0 units box
set type 1 mass 400
set type 2 mass 1
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi #multi/old
neigh_modify delay 0 collection/type 2 1*4 5
comm_modify mode multi reduce/multi #multi/old
# colloid potential
pair_style colloid 20.0
pair_coeff * * 144.0 1.0 0.0 0.0 3.0
pair_coeff 1 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 2 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 3 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 4 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 5 5 39.5 1.0 20.0 20.0 30.0
fix 1 all npt temp 2.0 2.0 1.0 iso 0.0 1.0 10.0 drag 1.0 &
mtk no pchain 0 tchain 1
fix 2 all enforce2d
#dump 1 all atom 1000 dump.colloid
#dump 2 all image 1000 image.*.jpg type type &
# zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type &
# zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 100
timestep 0.005
run 2000

View File

@ -0,0 +1,50 @@
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.5
region box block 0 60 0 60 -0.5 0.5
create_box 2 box
create_atoms 1 box
change_box all triclinic
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 20.0 20.0 0.0 10.0 units box
region sphere2 sphere 60.0 60.0 0.0 10.0 units box
delete_atoms region sphere1
delete_atoms region sphere2
create_atoms 2 single 20.0 20.0 0.0 units box
create_atoms 2 single 60.0 60.0 0.0 units box
set type 2 mass 400
set type 1 mass 1
set type 2 diameter 20
set type 1 diameter 1
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi #multi/old
neigh_modify delay 0 collection/interval 2 1 20
comm_modify mode multi vel yes reduce/multi #multi/old
# granular potential
pair_style granular
pair_coeff * * hooke 1.0 0.5 tangential linear_history 1.0 0.5 0.1 damping mass_velocity
fix 1 all nph/sphere iso 0.0 1.0 10.0 drag 1.0
fix 2 all enforce2d
fix 3 all deform 1 xy erate 1e-3
#dump 1 all custom 1000 dump.granular id x y z radius
thermo_style custom step temp epair etotal press vol
thermo 100
timestep 0.005
run 2000

View File

@ -0,0 +1,33 @@
# Shear power-law distributed granular particles
units lj
atom_style sphere
dimension 2
read_data data.powerlaw
change_box all triclinic
# multi neighbor and comm for efficiency
neighbor 1 multi
neigh_modify delay 0 collection/interval 6 1.5 3 10 30 100 200
comm_modify mode multi vel yes reduce/multi
# granular potential
pair_style granular
pair_coeff * * hooke 20.0 0.5 tangential linear_history 1.0 0.5 0.1 damping mass_velocity
# fixes
fix 1 all nve/sphere
fix 2 all enforce2d
fix 3 all deform 1 xy erate 1e-4
# dump 1 all custom 20000 dump.granular id x y z radius
thermo_style custom step temp epair etotal press vol pxy
thermo 100
timestep 0.005
run 1000

View File

@ -0,0 +1,183 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.1
Lattice spacing in x,y,z = 3.1622777 3.1622777 3.1622777
region box block 0 60 0 60 -0.5 0.5
create_box 5 box
Created orthogonal box = (0.0000000 0.0000000 -1.5811388) to (189.73666 189.73666 1.5811388)
1 by 1 by 1 MPI processor grid
create_atoms 1 box
Created 3600 atoms
create_atoms CPU = 0.001 seconds
#Roughly equally partition atoms between types 1-4
set group all type/fraction 2 0.500 23984
Setting atom values ...
1768 settings made for type/fraction
set group all type/fraction 3 0.333 43684
Setting atom values ...
1255 settings made for type/fraction
set group all type/fraction 4 0.250 87811
Setting atom values ...
927 settings made for type/fraction
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 60.0 60.0 0.0 30.0 units box
region sphere2 sphere 130.0 130.0 0.0 30.0 units box
delete_atoms region sphere1
Deleted 289 atoms, new total = 3311
delete_atoms region sphere2
Deleted 287 atoms, new total = 3024
create_atoms 5 single 60.0 60.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
create_atoms 5 single 130.0 130.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
set type 1 mass 400
Setting atom values ...
753 settings made for mass
set type 2 mass 1
Setting atom values ...
722 settings made for mass
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi #multi/old
neigh_modify delay 0 collection/type 2 1*4 5
comm_modify mode multi reduce/multi #multi/old
# colloid potential
pair_style colloid 20.0
pair_coeff * * 144.0 1.0 0.0 0.0 3.0
pair_coeff 1 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 2 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 3 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 4 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 5 5 39.5 1.0 20.0 20.0 30.0
fix 1 all npt temp 2.0 2.0 1.0 iso 0.0 1.0 10.0 drag 1.0 mtk no pchain 0 tchain 1
fix 2 all enforce2d
#dump 1 all atom 1000 dump.colloid
#dump 2 all image 1000 image.*.jpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 1000
timestep 0.005
run 50000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 31
ghost atom cutoff = 31
binsize = 2, bins = 95 95 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair colloid, perpetual
attributes: half, newton on
pair build: half/multi/newton
stencil: half/multi/2d
bin: multi
Per MPI rank memory allocation (min/avg/max) = 4.385 | 4.385 | 4.385 Mbytes
Step Temp E_pair TotEng Press Volume
0 1.44 0 1.4395241 0.121 36000
1000 1.8856066 -0.15771717 1.7272663 0.13840578 42574.399
2000 1.8589993 -0.11434676 1.7440382 0.097157151 58590.69
3000 1.8984314 -0.093445816 1.8043582 0.07444246 77824.12
4000 1.9603204 -0.07451891 1.8851536 0.066010381 90951.299
5000 2.0298924 -0.073898174 1.9553234 0.075791214 90146.92
6000 2.0797015 -0.086800285 1.992214 0.082095164 78182.702
7000 2.0867886 -0.10960963 1.9764893 0.10103655 63990.386
8000 2.0803886 -0.12736298 1.9523381 0.12561727 52648.372
9000 2.0605661 -0.14572043 1.9141648 0.15154081 44589.764
10000 2.0636909 -0.18556771 1.8774412 0.1604707 38996.941
11000 2.0498344 -0.20303461 1.8461224 0.18295046 34927.993
12000 2.0466611 -0.2217963 1.8241884 0.23031182 31760.363
13000 2.0441824 -0.24716826 1.7963386 0.22167931 29178.226
14000 2.047513 -0.26988172 1.7769547 0.24070752 26991.372
15000 2.0154283 -0.26144354 1.7533187 0.27587713 25247.715
16000 2.0160849 -0.28106984 1.7343488 0.32297139 23703.607
17000 2.0184729 -0.31071368 1.7070922 0.29815613 22300.6
18000 2.0237288 -0.33944941 1.6836106 0.3262795 21098.856
19000 2.0329827 -0.35438937 1.6779215 0.33691952 19989.867
20000 2.021113 -0.37316841 1.6472766 0.39687648 18978.666
21000 2.0352439 -0.40857976 1.6259915 0.38632613 18146.277
22000 2.0158566 -0.41271329 1.6024771 0.41480502 17409.593
23000 2.0170409 -0.42611776 1.5902566 0.40446612 16748.968
24000 2.0108878 -0.43899286 1.5712304 0.42075035 16086.941
25000 2.0218394 -0.47012156 1.5510497 0.46655183 15460.154
26000 2.0100713 -0.47985916 1.5295479 0.45575323 15013.774
27000 2.0251738 -0.5016665 1.5228381 0.50151992 14591.521
28000 2.0062966 -0.50284394 1.5027897 0.5462034 14135.093
29000 2.0146666 -0.53126035 1.4827405 0.60379062 13725.945
30000 2.0036455 -0.53246643 1.4705169 0.56784088 13417.305
31000 2.0127662 -0.54487777 1.4672233 0.6427741 13139.392
32000 2.0221816 -0.5625554 1.4589579 0.60695012 12779.609
33000 2.024983 -0.59515221 1.4291616 0.60005385 12584.572
34000 2.0184045 -0.59033569 1.4274018 0.62519753 12355.49
35000 2.0155635 -0.61190466 1.4029927 0.71044196 12106.819
36000 2.0252503 -0.61581601 1.408765 0.68805882 11728.608
37000 2.0112487 -0.64540754 1.3651765 0.66981639 11475.772
38000 2.0147475 -0.64161981 1.3724619 0.71130901 11285.511
39000 2.0213092 -0.67174661 1.3488946 0.6969697 11044.647
40000 2.0178739 -0.67924699 1.3379601 0.77309897 10824.198
41000 1.9952353 -0.67490899 1.3196669 0.76592358 10646.649
42000 2.002415 -0.70533555 1.2964178 0.81084741 10519.804
43000 2.0211625 -0.71370366 1.3067909 0.77355048 10434.893
44000 2.0252106 -0.72635544 1.2981859 0.83770143 10132.262
45000 2.0126446 -0.75197714 1.2600024 0.88927993 9946.7842
46000 2.0431159 -0.78445975 1.257981 0.84492327 9869.8151
47000 2.0199724 -0.76967899 1.2496259 0.90977181 9653.4334
48000 2.0109636 -0.78968551 1.2206135 0.89458323 9496.7246
49000 2.0131059 -0.79687252 1.2155681 0.91239613 9418.3093
50000 2.0073361 -0.79981468 1.206858 0.98524334 9289.4715
Loop time of 19.7532 on 1 procs for 50000 steps with 3026 atoms
Performance: 1093493.133 tau/day, 2531.234 timesteps/s
100.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 10.789 | 10.789 | 10.789 | 0.0 | 54.62
Neigh | 2.6848 | 2.6848 | 2.6848 | 0.0 | 13.59
Comm | 0.53244 | 0.53244 | 0.53244 | 0.0 | 2.70
Output | 0.0010482 | 0.0010482 | 0.0010482 | 0.0 | 0.01
Modify | 4.9599 | 4.9599 | 4.9599 | 0.0 | 25.11
Other | | 0.7856 | | | 3.98
Nlocal: 3026.00 ave 3026 max 3026 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 584.000 ave 584 max 584 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 25892.0 ave 25892 max 25892 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 25892
Ave neighs/atom = 8.5565102
Neighbor list builds = 4330
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:00:19

View File

@ -0,0 +1,183 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.1
Lattice spacing in x,y,z = 3.1622777 3.1622777 3.1622777
region box block 0 60 0 60 -0.5 0.5
create_box 5 box
Created orthogonal box = (0.0000000 0.0000000 -1.5811388) to (189.73666 189.73666 1.5811388)
2 by 2 by 1 MPI processor grid
create_atoms 1 box
Created 3600 atoms
create_atoms CPU = 0.001 seconds
#Roughly equally partition atoms between types 1-4
set group all type/fraction 2 0.500 23984
Setting atom values ...
1768 settings made for type/fraction
set group all type/fraction 3 0.333 43684
Setting atom values ...
1255 settings made for type/fraction
set group all type/fraction 4 0.250 87811
Setting atom values ...
927 settings made for type/fraction
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 60.0 60.0 0.0 30.0 units box
region sphere2 sphere 130.0 130.0 0.0 30.0 units box
delete_atoms region sphere1
Deleted 289 atoms, new total = 3311
delete_atoms region sphere2
Deleted 287 atoms, new total = 3024
create_atoms 5 single 60.0 60.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
create_atoms 5 single 130.0 130.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
set type 1 mass 400
Setting atom values ...
753 settings made for mass
set type 2 mass 1
Setting atom values ...
722 settings made for mass
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi #multi/old
neigh_modify delay 0 collection/type 2 1*4 5
comm_modify mode multi reduce/multi #multi/old
# colloid potential
pair_style colloid 20.0
pair_coeff * * 144.0 1.0 0.0 0.0 3.0
pair_coeff 1 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 2 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 3 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 4 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 5 5 39.5 1.0 20.0 20.0 30.0
fix 1 all npt temp 2.0 2.0 1.0 iso 0.0 1.0 10.0 drag 1.0 mtk no pchain 0 tchain 1
fix 2 all enforce2d
#dump 1 all atom 1000 dump.colloid
#dump 2 all image 1000 image.*.jpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 1000
timestep 0.005
run 50000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 31
ghost atom cutoff = 31
binsize = 2, bins = 95 95 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair colloid, perpetual
attributes: half, newton on
pair build: half/multi/newton
stencil: half/multi/2d
bin: multi
Per MPI rank memory allocation (min/avg/max) = 4.327 | 4.329 | 4.330 Mbytes
Step Temp E_pair TotEng Press Volume
0 1.44 0 1.4395241 0.121 36000
1000 1.8856066 -0.15771717 1.7272663 0.13840578 42574.399
2000 1.8590154 -0.11436231 1.7440387 0.097150798 58590.688
3000 1.8956738 -0.090814176 1.8042332 0.075557943 77825.289
4000 1.9570462 -0.072505537 1.8838939 0.072824365 90931.708
5000 2.0376745 -0.083247829 1.9537533 0.068496975 90055.295
6000 2.0744887 -0.085395371 1.9884077 0.0821927 78070.648
7000 2.1002183 -0.11654617 1.9829781 0.10523249 63934.448
8000 2.0818325 -0.13271654 1.948428 0.11909162 52636.484
9000 2.0693987 -0.16404154 1.9046733 0.14702552 44539.609
10000 2.0667772 -0.19779488 1.8682993 0.17245383 38822.542
11000 2.0640582 -0.22114917 1.842227 0.18083079 34788.927
12000 2.0308462 -0.20353105 1.8266441 0.20640739 31706.009
13000 2.0395895 -0.24217765 1.7967378 0.21832952 29152.654
14000 2.030848 -0.2586169 1.77156 0.26577748 27068.89
15000 2.0222966 -0.27554585 1.7460825 0.2777169 25272.786
16000 2.0398867 -0.31547563 1.723737 0.27763622 23666.792
17000 2.03026 -0.32453791 1.7050512 0.28099246 22272.809
18000 2.0345512 -0.35026242 1.6836164 0.36600779 21023.172
19000 2.0242864 -0.35813231 1.6654851 0.33415432 19941.244
20000 2.0132465 -0.36563904 1.6469422 0.403365 18979.884
21000 2.0280384 -0.4075867 1.6197815 0.37205362 18152.487
22000 2.0206494 -0.40600336 1.6139782 0.42704594 17370.812
23000 2.0395761 -0.45083258 1.5880695 0.40276343 16700.427
24000 2.017203 -0.44930293 1.5672335 0.43867313 16161.79
25000 2.0191846 -0.4672218 1.5512955 0.47031215 15622.756
26000 2.0131624 -0.46436088 1.5481363 0.51717944 15141.645
27000 2.0322461 -0.50659994 1.5249745 0.49218933 14627.657
28000 2.0169304 -0.50555565 1.5107082 0.55547935 14186.079
29000 2.024656 -0.52258414 1.5014028 0.59125812 13759.99
30000 2.0153725 -0.53585947 1.478847 0.57235811 13384.355
31000 2.0163261 -0.56383766 1.4518221 0.58232057 13098.196
32000 2.0109673 -0.56784395 1.4424588 0.58282178 12831.934
33000 2.0099169 -0.57625621 1.4329964 0.65139601 12479.442
34000 2.0238152 -0.60189607 1.4212503 0.62659152 12210.628
35000 2.0359989 -0.62654733 1.4087787 0.67574446 11972.725
36000 2.0222689 -0.62880837 1.3927923 0.66602146 11690.049
37000 1.9982569 -0.62746376 1.3701328 0.71326589 11433.825
38000 1.9969836 -0.63975181 1.3565719 0.72799891 11285.497
39000 2.0071087 -0.65781805 1.3486274 0.79121297 11107.469
40000 2.0243046 -0.6881221 1.3355135 0.77519099 10943.846
41000 2.0351657 -0.70309175 1.3314014 0.68815156 10742.515
42000 2.0224788 -0.70975664 1.3120538 0.80484619 10505.657
43000 2.0123135 -0.70818545 1.3034631 0.84204556 10353.024
44000 1.999883 -0.70981202 1.2894101 0.94070546 10212.224
45000 2.0127291 -0.73338075 1.2786832 0.82095205 10109.959
46000 2.0109037 -0.75130029 1.2589389 0.88538358 9953.4822
47000 1.9879175 -0.73152019 1.2557404 0.92089629 9832.892
48000 2.0108204 -0.76655178 1.2436041 0.95379465 9633.6453
49000 1.9868193 -0.76613798 1.2200247 0.88790224 9504.2918
50000 2.0141467 -0.80029827 1.2131829 1.0064263 9346.3268
Loop time of 6.98615 on 4 procs for 50000 steps with 3026 atoms
Performance: 3091831.080 tau/day, 7157.016 timesteps/s
99.8% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 2.2795 | 2.5856 | 2.9414 | 17.4 | 37.01
Neigh | 0.62273 | 0.70156 | 0.76736 | 7.4 | 10.04
Comm | 1.0765 | 1.4945 | 1.8884 | 28.6 | 21.39
Output | 0.00076496 | 0.0008953 | 0.0012832 | 0.0 | 0.01
Modify | 1.718 | 1.7755 | 1.827 | 3.7 | 25.41
Other | | 0.4281 | | | 6.13
Nlocal: 756.500 ave 839 max 673 min
Histogram: 1 0 1 0 0 0 0 1 0 1
Nghost: 292.500 ave 307 max 282 min
Histogram: 2 0 0 0 0 0 1 0 0 1
Neighs: 6435.25 ave 7367 max 5493 min
Histogram: 1 0 0 1 0 0 1 0 0 1
Total # of neighbors = 25741
Ave neighs/atom = 8.5066094
Neighbor list builds = 4335
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:00:07

View File

@ -0,0 +1,183 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.1
Lattice spacing in x,y,z = 3.1622777 3.1622777 3.1622777
region box block 0 60 0 60 -0.5 0.5
create_box 5 box
Created orthogonal box = (0.0000000 0.0000000 -1.5811388) to (189.73666 189.73666 1.5811388)
1 by 1 by 1 MPI processor grid
create_atoms 1 box
Created 3600 atoms
create_atoms CPU = 0.001 seconds
#Roughly equally partition atoms between types 1-4
set group all type/fraction 2 0.500 23984
Setting atom values ...
1768 settings made for type/fraction
set group all type/fraction 3 0.333 43684
Setting atom values ...
1255 settings made for type/fraction
set group all type/fraction 4 0.250 87811
Setting atom values ...
927 settings made for type/fraction
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 60.0 60.0 0.0 30.0 units box
region sphere2 sphere 130.0 130.0 0.0 30.0 units box
delete_atoms region sphere1
Deleted 289 atoms, new total = 3311
delete_atoms region sphere2
Deleted 287 atoms, new total = 3024
create_atoms 5 single 60.0 60.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
create_atoms 5 single 130.0 130.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
set type 1 mass 400
Setting atom values ...
753 settings made for mass
set type 2 mass 1
Setting atom values ...
722 settings made for mass
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi/old #multi
neigh_modify delay 0 #multi/custom 2 1*4 5
comm_modify mode multi/old #multi multi/reduce
# colloid potential
pair_style colloid 20.0
pair_coeff * * 144.0 1.0 0.0 0.0 3.0
pair_coeff 1 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 2 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 3 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 4 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 5 5 39.5 1.0 20.0 20.0 30.0
fix 1 all npt temp 2.0 2.0 1.0 iso 0.0 1.0 10.0 drag 1.0 mtk no pchain 0 tchain 1
fix 2 all enforce2d
#dump 1 all atom 1000 dump.colloid
#dump 2 all image 1000 image.*.jpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 1000
timestep 0.005
run 50000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 31
ghost atom cutoff = 31
binsize = 2, bins = 95 95 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair colloid, perpetual
attributes: half, newton on
pair build: half/multi/old/newton
stencil: half/multi/old/2d
bin: standard
Per MPI rank memory allocation (min/avg/max) = 4.496 | 4.496 | 4.496 Mbytes
Step Temp E_pair TotEng Press Volume
0 1.44 0 1.4395241 0.121 36000
1000 1.8856066 -0.15771717 1.7272663 0.13840578 42574.399
2000 1.8589993 -0.11434676 1.7440382 0.097157151 58590.69
3000 1.8984314 -0.093445816 1.8043582 0.07444246 77824.12
4000 1.9603204 -0.07451891 1.8851536 0.066010381 90951.299
5000 2.0298924 -0.073898174 1.9553234 0.075791214 90146.92
6000 2.0797015 -0.086800284 1.992214 0.082095164 78182.702
7000 2.086794 -0.10961479 1.9764895 0.10103993 63990.387
8000 2.082863 -0.12779588 1.9543788 0.12672452 52629.802
9000 2.0718275 -0.15189022 1.9192526 0.14728063 44541.722
10000 2.0603856 -0.18054161 1.8791631 0.16715133 38940.135
11000 2.046791 -0.20458359 1.841531 0.19532742 34907.116
12000 2.0406846 -0.2252868 1.8147234 0.2036178 31740.208
13000 2.0369763 -0.23721632 1.7990869 0.25542564 29079.901
14000 2.0376121 -0.26282517 1.7741135 0.24722118 26947.344
15000 2.0312772 -0.2851101 1.7454959 0.2801199 25180.963
16000 2.0080448 -0.28992973 1.7174515 0.30099318 23723.043
17000 2.0234993 -0.30440169 1.7184289 0.3193226 22342.977
18000 2.0216103 -0.32036933 1.7005729 0.3460322 21068.99
19000 2.0493952 -0.37711533 1.6716026 0.33804972 20013.325
20000 2.0307894 -0.38462795 1.6454903 0.37041981 19092.745
21000 2.0328577 -0.39442652 1.6377594 0.36327057 18260.298
22000 2.0325613 -0.40481002 1.6270796 0.42756691 17447.199
23000 2.0199358 -0.42175719 1.5975111 0.40948041 16768.71
24000 2.0149952 -0.43618764 1.5781417 0.45406069 16187.334
25000 2.0153221 -0.45884172 1.5558143 0.52717203 15605.577
26000 2.0099026 -0.47080566 1.5384327 0.49181459 15088.041
27000 2.0128537 -0.49799999 1.5141885 0.53907465 14590.392
28000 2.0287266 -0.53112525 1.4969309 0.59750714 14208.419
29000 2.0143609 -0.53175704 1.4819381 0.56118773 13840.642
30000 2.0235262 -0.53923416 1.4836234 0.52579997 13500.15
31000 2.0390444 -0.57976823 1.4586023 0.5760349 13082.091
32000 2.018046 -0.57797686 1.4394022 0.59127933 12761.726
33000 2.0059068 -0.57185148 1.4333925 0.58992758 12473.866
34000 1.9828456 -0.57147221 1.4107181 0.77593228 12208.869
35000 1.9900097 -0.58349168 1.4058604 0.681968 11937.285
36000 2.0271405 -0.64374859 1.382722 0.63152587 11675.264
37000 2.0032809 -0.63520712 1.3674117 0.71639384 11440.274
38000 2.0000566 -0.63941617 1.3599795 0.74099652 11235.252
39000 1.9872705 -0.64765522 1.3389586 0.7575743 11080.857
40000 2.0224403 -0.6795645 1.3422075 0.82918546 10861.905
41000 2.0137595 -0.69863075 1.3144633 0.80397759 10712.981
42000 1.9950915 -0.68892531 1.3055069 0.77631365 10632.931
43000 2.0080851 -0.70534369 1.3020778 0.82408436 10408.82
44000 2.0239806 -0.73189482 1.2914169 0.83228695 10227.18
45000 2.0019542 -0.72613202 1.2751606 0.9145618 10044.013
46000 2.0173095 -0.75370218 1.2629407 0.99791312 9837.9611
47000 1.9921201 -0.75875076 1.232711 1.0047839 9711.2083
48000 2.0283587 -0.79063641 1.237052 0.83617499 9610.9933
49000 2.0051919 -0.79078067 1.2137485 0.95651813 9411.7165
50000 2.0140985 -0.81796958 1.1954634 0.93791038 9296.069
Loop time of 28.5339 on 1 procs for 50000 steps with 3026 atoms
Performance: 756994.490 tau/day, 1752.302 timesteps/s
100.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 10.918 | 10.918 | 10.918 | 0.0 | 38.26
Neigh | 10.375 | 10.375 | 10.375 | 0.0 | 36.36
Comm | 1.2856 | 1.2856 | 1.2856 | 0.0 | 4.51
Output | 0.0010955 | 0.0010955 | 0.0010955 | 0.0 | 0.00
Modify | 5.0132 | 5.0132 | 5.0132 | 0.0 | 17.57
Other | | 0.9412 | | | 3.30
Nlocal: 3026.00 ave 3026 max 3026 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 2292.00 ave 2292 max 2292 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 25767.0 ave 25767 max 25767 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 25767
Ave neighs/atom = 8.5152016
Neighbor list builds = 4332
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:00:28

View File

@ -0,0 +1,183 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.1
Lattice spacing in x,y,z = 3.1622777 3.1622777 3.1622777
region box block 0 60 0 60 -0.5 0.5
create_box 5 box
Created orthogonal box = (0.0000000 0.0000000 -1.5811388) to (189.73666 189.73666 1.5811388)
2 by 2 by 1 MPI processor grid
create_atoms 1 box
Created 3600 atoms
create_atoms CPU = 0.001 seconds
#Roughly equally partition atoms between types 1-4
set group all type/fraction 2 0.500 23984
Setting atom values ...
1768 settings made for type/fraction
set group all type/fraction 3 0.333 43684
Setting atom values ...
1255 settings made for type/fraction
set group all type/fraction 4 0.250 87811
Setting atom values ...
927 settings made for type/fraction
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 60.0 60.0 0.0 30.0 units box
region sphere2 sphere 130.0 130.0 0.0 30.0 units box
delete_atoms region sphere1
Deleted 289 atoms, new total = 3311
delete_atoms region sphere2
Deleted 287 atoms, new total = 3024
create_atoms 5 single 60.0 60.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
create_atoms 5 single 130.0 130.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
set type 1 mass 400
Setting atom values ...
753 settings made for mass
set type 2 mass 1
Setting atom values ...
722 settings made for mass
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi/old #multi
neigh_modify delay 0 #multi/custom 2 1*4 5
comm_modify mode multi/old #multi multi/reduce
# colloid potential
pair_style colloid 20.0
pair_coeff * * 144.0 1.0 0.0 0.0 3.0
pair_coeff 1 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 2 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 3 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 4 5 75.4 1.0 0.0 20.0 14.0
pair_coeff 5 5 39.5 1.0 20.0 20.0 30.0
fix 1 all npt temp 2.0 2.0 1.0 iso 0.0 1.0 10.0 drag 1.0 mtk no pchain 0 tchain 1
fix 2 all enforce2d
#dump 1 all atom 1000 dump.colloid
#dump 2 all image 1000 image.*.jpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 1000
timestep 0.005
run 50000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 31
ghost atom cutoff = 31
binsize = 2, bins = 95 95 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair colloid, perpetual
attributes: half, newton on
pair build: half/multi/old/newton
stencil: half/multi/old/2d
bin: standard
Per MPI rank memory allocation (min/avg/max) = 4.404 | 4.406 | 4.410 Mbytes
Step Temp E_pair TotEng Press Volume
0 1.44 0 1.4395241 0.121 36000
1000 1.8856066 -0.15771717 1.7272663 0.13840578 42574.399
2000 1.8590154 -0.11436231 1.7440387 0.097150798 58590.688
3000 1.8956738 -0.090814168 1.8042332 0.075557943 77825.289
4000 1.9567884 -0.072243657 1.8838981 0.072836007 90931.521
5000 2.0386455 -0.084279096 1.9536927 0.06867562 90054.581
6000 2.0816461 -0.093158646 1.9877995 0.082802397 78084.994
7000 2.0854943 -0.10553618 1.979269 0.10230351 63886.068
8000 2.0923948 -0.14072173 1.9509816 0.11775174 52590.899
9000 2.0687841 -0.15957251 1.9085279 0.14963059 44575.69
10000 2.0607467 -0.18970216 1.8703636 0.17210861 39016.271
11000 2.0538523 -0.20866031 1.8445133 0.18554787 34992.223
12000 2.0408745 -0.22276635 1.8174337 0.21228473 31794.869
13000 2.0366678 -0.24217764 1.7938171 0.22999314 29186.441
14000 2.0470314 -0.26923854 1.7771164 0.2576977 26941.432
15000 2.0262458 -0.27296827 1.7526079 0.25960813 25184.491
16000 2.0410096 -0.30940081 1.7309343 0.27842776 23619.633
17000 2.027379 -0.32411477 1.7025943 0.32102949 22231.582
18000 2.0338405 -0.34468182 1.6884866 0.3306203 21028.933
19000 2.032206 -0.36558904 1.6659454 0.33926726 19958.945
20000 2.0347643 -0.3915229 1.642569 0.33718716 19054.271
21000 2.0242901 -0.38913219 1.634489 0.38062225 18190.934
22000 2.0207557 -0.41078199 1.6093059 0.40143768 17422.03
23000 2.0069068 -0.42062708 1.5856165 0.40146954 16717.999
24000 2.0300595 -0.4536262 1.5757624 0.49229743 16097.323
25000 2.0347548 -0.47655047 1.5575319 0.46787969 15564.848
26000 2.0180789 -0.46537586 1.5520362 0.48541997 15072.597
27000 2.0150506 -0.4886202 1.5257645 0.53829749 14621.24
28000 2.0175464 -0.50951413 1.5073655 0.50140171 14253.441
29000 2.0186127 -0.53911975 1.4788258 0.52955802 13930.266
30000 2.0006844 -0.52621334 1.4738099 0.60130639 13650.051
31000 2.0179614 -0.54573939 1.4715551 0.58747508 13285.903
32000 2.0333208 -0.57431851 1.4583303 0.62631039 12894.077
33000 2.0017273 -0.57778326 1.4232825 0.61159622 12595.987
34000 2.0063025 -0.58192939 1.4237101 0.66174764 12316.964
35000 2.0174782 -0.60591394 1.4108976 0.63571024 12063.433
36000 2.025112 -0.64319133 1.3812514 0.62829458 11930.246
37000 2.0431268 -0.64342323 1.3990283 0.68038546 11651.664
38000 2.0064271 -0.63716263 1.3686014 0.72167175 11345.421
39000 2.0284014 -0.67236471 1.3553663 0.68693225 11062.293
40000 2.0181711 -0.6962559 1.3212483 0.76033095 10864.176
41000 1.9908152 -0.66607906 1.3240783 0.90250403 10812.599
42000 2.0007084 -0.68853623 1.311511 0.88096905 10627.922
43000 1.998883 -0.69053805 1.3076844 0.81765345 10469.928
44000 2.0197069 -0.72507021 1.2939693 0.87004916 10194.954
45000 2.0112835 -0.72638581 1.284233 0.99236207 9968.2662
46000 2.0195002 -0.75152677 1.2673061 0.92706763 9751.1162
47000 1.983694 -0.75006702 1.2329714 0.8945741 9652.1453
48000 1.9977505 -0.77207122 1.225019 0.92107083 9647.1543
49000 2.0000901 -0.76254934 1.2368798 1.0320945 9536.2823
50000 2.0150929 -0.80463979 1.2097872 0.99556424 9324.0277
Loop time of 10.7578 on 4 procs for 50000 steps with 3026 atoms
Performance: 2007847.166 tau/day, 4647.794 timesteps/s
98.2% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 2.3814 | 2.6878 | 2.9507 | 15.2 | 24.98
Neigh | 2.3959 | 2.6615 | 2.9677 | 16.2 | 24.74
Comm | 2.4113 | 2.9894 | 3.5621 | 29.6 | 27.79
Output | 0.00077024 | 0.00091029 | 0.0012971 | 0.0 | 0.01
Modify | 1.7966 | 1.8497 | 1.907 | 3.8 | 17.19
Other | | 0.5686 | | | 5.29
Nlocal: 756.500 ave 838 max 693 min
Histogram: 2 0 0 0 0 0 0 1 0 1
Nghost: 1282.50 ave 1333 max 1216 min
Histogram: 1 0 0 0 1 0 0 0 1 1
Neighs: 6426.25 ave 7350 max 5786 min
Histogram: 2 0 0 0 0 1 0 0 0 1
Total # of neighbors = 25705
Ave neighs/atom = 8.4947125
Neighbor list builds = 4326
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:00:10

View File

@ -0,0 +1,175 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.5
Lattice spacing in x,y,z = 1.4142136 1.4142136 1.4142136
region box block 0 60 0 60 -0.5 0.5
create_box 2 box
Created orthogonal box = (0.0000000 0.0000000 -0.70710678) to (84.852814 84.852814 0.70710678)
1 by 1 by 1 MPI processor grid
create_atoms 1 box
Created 3600 atoms
create_atoms CPU = 0.001 seconds
change_box all triclinic
Changing box ...
triclinic box = (0.0000000 0.0000000 -0.70710678) to (84.852814 84.852814 0.70710678) with tilt (0.0000000 0.0000000 0.0000000)
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 20.0 20.0 0.0 10.0 units box
region sphere2 sphere 60.0 60.0 0.0 10.0 units box
delete_atoms region sphere1
Deleted 154 atoms, new total = 3446
delete_atoms region sphere2
Deleted 158 atoms, new total = 3288
create_atoms 2 single 20.0 20.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
create_atoms 2 single 60.0 60.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
set type 2 mass 400
Setting atom values ...
2 settings made for mass
set type 1 mass 1
Setting atom values ...
3288 settings made for mass
set type 2 diameter 20
Setting atom values ...
2 settings made for diameter
set type 1 diameter 1
Setting atom values ...
3288 settings made for diameter
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi #multi/old
neigh_modify delay 0 collection/interval 2 1 20
comm_modify mode multi vel yes reduce/multi #multi/old
# colloid potential
pair_style granular
pair_coeff * * hooke 1.0 0.5 tangential linear_history 1.0 0.5 0.1 damping mass_velocity
fix 1 all nph/sphere iso 0.0 1.0 10.0 drag 1.0
fix 2 all enforce2d
fix 3 all deform 1 xy erate 1e-3
#dump 1 all custom 1000 dump.granular id x y z radius
#dump 2 all image 1000 image.*.jpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 1000
timestep 0.005
run 50000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 21
ghost atom cutoff = 21
binsize = 1, bins = 85 85 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair granular, perpetual
attributes: half, newton on, size, history
pair build: half/size/multi/newton/tri
stencil: half/multi/2d/tri
bin: multi
Per MPI rank memory allocation (min/avg/max) = 10.29 | 10.29 | 10.29 Mbytes
Step Temp E_pair TotEng Press Volume
0 1.44 0 1.4395623 0.66837658 7200
1000 0.32604952 0 0.32595042 0.17341597 7862.5013
2000 0.12631038 0 0.12627198 0.069126477 8216.6956
3000 0.069351715 0 0.069330635 0.040799593 8344.1931
4000 0.045023755 0 0.04501007 0.029184795 8239.1832
5000 0.032735149 0 0.0327252 0.025640841 7943.5691
6000 0.026205227 0 0.026197262 0.021206924 7617.6672
7000 0.02165475 0 0.021648168 0.018789365 7255.2897
8000 0.018299317 0 0.018293755 0.019272158 6887.3386
9000 0.016283763 0 0.016278813 0.020434892 6524.0274
10000 0.015148918 0 0.015144313 0.021650465 6168.4941
11000 0.014180465 0 0.014176155 0.022320009 5823.98
12000 0.013505744 0 0.013501639 0.023978674 5492.4853
13000 0.013009585 0 0.01300563 0.024391329 5175.7455
14000 0.012494373 0 0.012490576 0.027331543 4874.3212
15000 0.012057669 0 0.012054004 0.030561239 4589.518
16000 0.011510988 0 0.01150749 0.034613772 4321.1694
17000 0.011198594 0 0.01119519 0.042263536 4070.0115
18000 0.010978603 0 0.010975266 0.053637275 3836.0304
19000 0.010768789 0 0.010765516 0.069472547 3619.75
20000 0.0102256 0 0.010222492 0.085332898 3420.2738
21000 0.0089630315 0 0.0089603072 0.11199196 3236.9821
22000 0.006565581 0 0.0065635854 0.14807426 3071.3012
23000 0.0050916998 0 0.0050901522 0.1903446 2923.4162
24000 0.0040345997 0 0.0040333734 0.237983 2792.2658
25000 0.0032995328 0 0.0032985299 0.29120001 2677.7475
26000 0.0024157863 0 0.002415052 0.33851944 2578.4972
27000 0.0020664445 0 0.0020658164 0.37561848 2491.0264
28000 0.0017843883 0 0.0017838459 0.41119961 2412.3871
29000 0.0011813262 0 0.0011809672 0.44749341 2341.7208
30000 0.00063084711 0 0.00063065536 0.4879202 2279.0452
31000 0.00056027405 0 0.00056010376 0.52932126 2224.9456
32000 0.00053304715 0 0.00053288513 0.56822504 2179.1224
33000 0.00052245707 0 0.00052229826 0.60025509 2140.5345
34000 0.00073726189 0 0.0007370378 0.62001489 2106.3045
35000 0.00075804791 0 0.0007578175 0.6359631 2072.525
36000 0.00052579203 0 0.00052563222 0.65678516 2038.1907
37000 0.00036977909 0 0.0003696667 0.68784389 2005.5831
38000 0.00036252798 0 0.00036241779 0.72116044 1977.7441
39000 0.00036254566 0 0.00036243547 0.74720837 1954.9127
40000 0.00036237175 0 0.00036226161 0.76605408 1934.6006
41000 0.00032453104 0 0.00032443239 0.78424188 1914.1939
42000 0.00025394755 0 0.00025387036 0.80529272 1893.064
43000 0.00021067821 0 0.00021061418 0.82962095 1872.365
44000 0.00017927684 0 0.00017922235 0.85522899 1853.531
45000 0.0001464225 0 0.000146378 0.87925998 1837.2423
46000 0.00012922979 0 0.00012919051 0.8986549 1822.9227
47000 0.0001643557 0 0.00016430575 0.91743602 1809.0605
48000 0.00020154753 0 0.00020148627 0.93686779 1794.9227
49000 0.00017742528 0 0.00017737135 0.94988773 1780.3811
50000 0.00015150521 0 0.00015145916 0.97929588 1764.7507
Loop time of 54.9135 on 1 procs for 50000 steps with 3290 atoms
Performance: 393345.914 tau/day, 910.523 timesteps/s
100.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 44.691 | 44.691 | 44.691 | 0.0 | 81.38
Neigh | 0.21653 | 0.21653 | 0.21653 | 0.0 | 0.39
Comm | 0.75388 | 0.75388 | 0.75388 | 0.0 | 1.37
Output | 0.0011999 | 0.0011999 | 0.0011999 | 0.0 | 0.00
Modify | 8.4718 | 8.4718 | 8.4718 | 0.0 | 15.43
Other | | 0.7794 | | | 1.42
Nlocal: 3290.00 ave 3290 max 3290 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 525.000 ave 525 max 525 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 26732.0 ave 26732 max 26732 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 26732
Ave neighs/atom = 8.1252280
Neighbor list builds = 342
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:00:54

View File

@ -0,0 +1,175 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.5
Lattice spacing in x,y,z = 1.4142136 1.4142136 1.4142136
region box block 0 60 0 60 -0.5 0.5
create_box 2 box
Created orthogonal box = (0.0000000 0.0000000 -0.70710678) to (84.852814 84.852814 0.70710678)
2 by 2 by 1 MPI processor grid
create_atoms 1 box
Created 3600 atoms
create_atoms CPU = 0.001 seconds
change_box all triclinic
Changing box ...
triclinic box = (0.0000000 0.0000000 -0.70710678) to (84.852814 84.852814 0.70710678) with tilt (0.0000000 0.0000000 0.0000000)
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 20.0 20.0 0.0 10.0 units box
region sphere2 sphere 60.0 60.0 0.0 10.0 units box
delete_atoms region sphere1
Deleted 154 atoms, new total = 3446
delete_atoms region sphere2
Deleted 158 atoms, new total = 3288
create_atoms 2 single 20.0 20.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
create_atoms 2 single 60.0 60.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
set type 2 mass 400
Setting atom values ...
2 settings made for mass
set type 1 mass 1
Setting atom values ...
3288 settings made for mass
set type 2 diameter 20
Setting atom values ...
2 settings made for diameter
set type 1 diameter 1
Setting atom values ...
3288 settings made for diameter
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi #multi/old
neigh_modify delay 0 collection/interval 2 1 20
comm_modify mode multi vel yes reduce/multi #multi/old
# colloid potential
pair_style granular
pair_coeff * * hooke 1.0 0.5 tangential linear_history 1.0 0.5 0.1 damping mass_velocity
fix 1 all nph/sphere iso 0.0 1.0 10.0 drag 1.0
fix 2 all enforce2d
fix 3 all deform 1 xy erate 1e-3
#dump 1 all custom 1000 dump.granular id x y z radius
#dump 2 all image 1000 image.*.jpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 1000
timestep 0.005
run 50000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 21
ghost atom cutoff = 21
binsize = 1, bins = 85 85 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair granular, perpetual
attributes: half, newton on, size, history
pair build: half/size/multi/newton/tri
stencil: half/multi/2d/tri
bin: multi
Per MPI rank memory allocation (min/avg/max) = 10.09 | 10.10 | 10.10 Mbytes
Step Temp E_pair TotEng Press Volume
0 1.44 0 1.4395623 0.66837658 7200
1000 0.32605303 0 0.32595393 0.17341558 7862.5037
2000 0.12631567 0 0.12627728 0.069188881 8216.7174
3000 0.069373812 0 0.069352726 0.040740832 8344.2982
4000 0.045084633 0 0.045070929 0.029328609 8239.3656
5000 0.032681746 0 0.032671813 0.025416741 7943.7831
6000 0.026301239 0 0.026293245 0.021418793 7617.8426
7000 0.021666723 0 0.021660138 0.018961011 7255.9338
8000 0.018141337 0 0.018135823 0.019306113 6887.4963
9000 0.015922309 0 0.015917469 0.020033398 6524.016
10000 0.014744547 0 0.014740066 0.020959503 6168.1945
11000 0.013872852 0 0.013868636 0.021708943 5823.3153
12000 0.013321594 0 0.013317545 0.02332141 5491.4979
13000 0.01269964 0 0.012695779 0.024796428 5174.6263
14000 0.01227055 0 0.012266821 0.027785072 4873.4516
15000 0.012120508 0 0.012116824 0.029656636 4588.8603
16000 0.011612027 0 0.011608498 0.034695109 4320.4674
17000 0.011216697 0 0.011213288 0.042746966 4069.4275
18000 0.010950166 0 0.010946838 0.053528994 3835.5439
19000 0.010887635 0 0.010884325 0.069684492 3619.562
20000 0.010563449 0 0.010560238 0.08654561 3420.2636
21000 0.0092336323 0 0.0092308257 0.11286068 3237.1408
22000 0.006929086 0 0.0069269799 0.15018917 3072.0438
23000 0.0052239156 0 0.0052223277 0.19067193 2924.441
24000 0.0044210081 0 0.0044196644 0.23908686 2793.2426
25000 0.0034916086 0 0.0034905473 0.29112824 2678.7912
26000 0.002549072 0 0.0025482972 0.33567824 2579.3738
27000 0.0020890726 0 0.0020884377 0.37328514 2491.0502
28000 0.001772982 0 0.0017724431 0.41079958 2411.9111
29000 0.001127719 0 0.0011273762 0.44752241 2341.1888
30000 0.00053266563 0 0.00053250373 0.48791815 2278.5611
31000 0.00050278646 0 0.00050263364 0.52896525 2224.5328
32000 0.00051880956 0 0.00051865187 0.56884574 2178.6674
33000 0.00054908167 0 0.00054891477 0.6016387 2140.3696
34000 0.00075213884 0 0.00075191023 0.62070188 2106.6504
35000 0.00081295162 0 0.00081270452 0.63492031 2073.0077
36000 0.00056699821 0 0.00056682587 0.65608409 2038.3251
37000 0.0003540723 0 0.00035396468 0.68803919 2005.497
38000 0.00031139738 0 0.00031130273 0.72103717 1977.7345
39000 0.00034087822 0 0.00034077461 0.74697975 1954.8979
40000 0.00035452426 0 0.0003544165 0.76682035 1934.5695
41000 0.00030882258 0 0.00030872871 0.78390763 1914.3326
42000 0.00025492799 0 0.00025485051 0.80439795 1893.1474
43000 0.00021545017 0 0.00021538468 0.82803644 1872.073
44000 0.00017293257 0 0.00017288 0.85436769 1852.6548
45000 0.00014097725 0 0.0001409344 0.8796181 1836.0087
46000 0.0001139199 0 0.00011388527 0.90006173 1821.7977
47000 0.00012678598 0 0.00012674745 0.90876359 1808.4913
48000 0.00013796773 0 0.00013792579 0.93661523 1793.8082
49000 0.00014723144 0 0.00014718669 0.95869417 1779.1875
50000 0.00013610653 0 0.00013606516 0.97777198 1765.3247
Loop time of 17.7405 on 4 procs for 50000 steps with 3290 atoms
Performance: 1217551.996 tau/day, 2818.407 timesteps/s
100.0% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 6.6629 | 9.6168 | 12.444 | 76.6 | 54.21
Neigh | 0.049771 | 0.055182 | 0.06133 | 2.0 | 0.31
Comm | 1.7883 | 4.6306 | 7.6179 | 111.5 | 26.10
Output | 0.00085342 | 0.0010606 | 0.0015425 | 0.9 | 0.01
Modify | 2.7244 | 2.895 | 3.0436 | 8.2 | 16.32
Other | | 0.5419 | | | 3.05
Nlocal: 822.500 ave 897 max 779 min
Histogram: 1 1 0 1 0 0 0 0 0 1
Nghost: 190.500 ave 211 max 179 min
Histogram: 2 0 0 1 0 0 0 0 0 1
Neighs: 6665.75 ave 7329 max 6104 min
Histogram: 1 0 0 1 1 0 0 0 0 1
Total # of neighbors = 26663
Ave neighs/atom = 8.1042553
Neighbor list builds = 342
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:00:17

View File

@ -0,0 +1,175 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.5
Lattice spacing in x,y,z = 1.4142136 1.4142136 1.4142136
region box block 0 60 0 60 -0.5 0.5
create_box 2 box
Created orthogonal box = (0.0000000 0.0000000 -0.70710678) to (84.852814 84.852814 0.70710678)
1 by 1 by 1 MPI processor grid
create_atoms 1 box
Created 3600 atoms
create_atoms CPU = 0.001 seconds
change_box all triclinic
Changing box ...
triclinic box = (0.0000000 0.0000000 -0.70710678) to (84.852814 84.852814 0.70710678) with tilt (0.0000000 0.0000000 0.0000000)
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 20.0 20.0 0.0 10.0 units box
region sphere2 sphere 60.0 60.0 0.0 10.0 units box
delete_atoms region sphere1
Deleted 154 atoms, new total = 3446
delete_atoms region sphere2
Deleted 158 atoms, new total = 3288
create_atoms 2 single 20.0 20.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
create_atoms 2 single 60.0 60.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
set type 2 mass 400
Setting atom values ...
2 settings made for mass
set type 1 mass 1
Setting atom values ...
3288 settings made for mass
set type 2 diameter 20
Setting atom values ...
2 settings made for diameter
set type 1 diameter 1
Setting atom values ...
3288 settings made for diameter
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi/old #multi
neigh_modify delay 0 #collection/interval 2 1 20
comm_modify mode multi/old vel yes #reduce/multi
# colloid potential
pair_style granular
pair_coeff * * hooke 1.0 0.5 tangential linear_history 1.0 0.5 0.1 damping mass_velocity
fix 1 all nph/sphere iso 0.0 1.0 10.0 drag 1.0
fix 2 all enforce2d
fix 3 all deform 1 xy erate 1e-3
#dump 1 all custom 1000 dump.granular id x y z radius
#dump 2 all image 1000 image.*.jpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 1000
timestep 0.005
run 50000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 21
ghost atom cutoff = 21
binsize = 1, bins = 85 85 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair granular, perpetual
attributes: half, newton on, size, history
pair build: half/size/multi/old/newton/tri
stencil: half/multi/old/2d/tri
bin: standard
Per MPI rank memory allocation (min/avg/max) = 10.38 | 10.38 | 10.38 Mbytes
Step Temp E_pair TotEng Press Volume
0 1.44 0 1.4395623 0.66837658 7200
1000 0.32273428 0 0.32263619 0.17174972 7859.8897
2000 0.12441598 0 0.12437817 0.067078155 8212.9946
3000 0.067389284 0 0.067368801 0.040425551 8336.7112
4000 0.044312733 0 0.044299264 0.028220228 8229.0658
5000 0.032702163 0 0.032692223 0.024302012 7931.1298
6000 0.025856 0 0.025848141 0.021241317 7603.5534
7000 0.021437473 0 0.021430957 0.019285494 7243.5757
8000 0.018129567 0 0.018124057 0.020738727 6877.4816
9000 0.016370159 0 0.016365184 0.020261904 6515.3445
10000 0.01500918 0 0.015004618 0.020551803 6160.4475
11000 0.014156551 0 0.014152248 0.021324815 5815.4665
12000 0.013725406 0 0.013721235 0.021159958 5483.6304
13000 0.013215746 0 0.013211729 0.021685712 5165.4758
14000 0.012398153 0 0.012394384 0.024155434 4862.8657
15000 0.011842796 0 0.011839196 0.028503991 4577.9008
16000 0.011433182 0 0.011429706 0.033564839 4309.8792
17000 0.011166574 0 0.01116318 0.040592677 4058.9964
18000 0.01100067 0 0.010997326 0.04899206 3825.155
19000 0.010224474 0 0.010221366 0.063670337 3607.6577
20000 0.0091360558 0 0.0091332789 0.088230111 3408.5658
21000 0.0077336471 0 0.0077312964 0.11769368 3227.7002
22000 0.0060202357 0 0.0060184059 0.15272492 3064.3986
23000 0.0046705738 0 0.0046691542 0.19450723 2918.0014
24000 0.0040248311 0 0.0040236078 0.24161743 2788.4113
25000 0.0032075267 0 0.0032065518 0.28976925 2674.5604
26000 0.0021358008 0 0.0021351516 0.33635615 2574.9564
27000 0.0016902771 0 0.0016897633 0.37624261 2487.2379
28000 0.0014038216 0 0.0014033949 0.41492061 2409.2461
29000 0.00090262588 0 0.00090235152 0.45392924 2340.0308
30000 0.00049466445 0 0.0004945141 0.49295063 2279.2316
31000 0.00056998139 0 0.00056980814 0.53299532 2226.5683
32000 0.00057327032 0 0.00057309607 0.56856551 2181.7093
33000 0.00044845449 0 0.00044831818 0.59623461 2142.7574
34000 0.00059840346 0 0.00059822157 0.61758978 2107.1254
35000 0.00075311121 0 0.0007528823 0.63756791 2072.7217
36000 0.00053773653 0 0.00053757309 0.66026022 2039.1654
37000 0.00030439696 0 0.00030430444 0.69059127 2007.7901
38000 0.00034435616 0 0.00034425149 0.72166346 1980.7136
39000 0.00039692535 0 0.0003968047 0.7468036 1957.9531
40000 0.0003542502 0 0.00035414252 0.76604173 1937.3834
41000 0.0003094667 0 0.00030937263 0.78323183 1916.7027
42000 0.00027258976 0 0.0002725069 0.80315572 1895.0714
43000 0.00020659987 0 0.00020653707 0.82746098 1873.5408
44000 0.00016023865 0 0.00016018994 0.85418945 1853.8677
45000 0.00016112731 0 0.00016107833 0.87913874 1837.1144
46000 0.00016131366 0 0.00016126463 0.89921653 1822.7355
47000 0.00015754747 0 0.00015749958 0.91653641 1809.0285
48000 0.00017794764 0 0.00017789356 0.93582953 1794.7043
49000 0.00018879338 0 0.000188736 0.95775166 1780.0323
50000 0.00017781117 0 0.00017775712 0.97893641 1765.9442
Loop time of 74.6636 on 1 procs for 50000 steps with 3290 atoms
Performance: 289297.713 tau/day, 669.671 timesteps/s
100.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 56.696 | 56.696 | 56.696 | 0.0 | 75.93
Neigh | 2.2232 | 2.2232 | 2.2232 | 0.0 | 2.98
Comm | 6.1867 | 6.1867 | 6.1867 | 0.0 | 8.29
Output | 0.0012016 | 0.0012016 | 0.0012016 | 0.0 | 0.00
Modify | 8.432 | 8.432 | 8.432 | 0.0 | 11.29
Other | | 1.125 | | | 1.51
Nlocal: 3290.00 ave 3290 max 3290 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 6295.00 ave 6295 max 6295 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 53729.0 ave 53729 max 53729 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 53729
Ave neighs/atom = 16.331003
Neighbor list builds = 348
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:01:14

View File

@ -0,0 +1,175 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Big colloid particles and small LJ particles
units lj
atom_style sphere
dimension 2
lattice sq 0.5
Lattice spacing in x,y,z = 1.4142136 1.4142136 1.4142136
region box block 0 60 0 60 -0.5 0.5
create_box 2 box
Created orthogonal box = (0.0000000 0.0000000 -0.70710678) to (84.852814 84.852814 0.70710678)
2 by 2 by 1 MPI processor grid
create_atoms 1 box
Created 3600 atoms
create_atoms CPU = 0.063 seconds
change_box all triclinic
Changing box ...
triclinic box = (0.0000000 0.0000000 -0.70710678) to (84.852814 84.852814 0.70710678) with tilt (0.0000000 0.0000000 0.0000000)
# remove two spheres of small particles and add large particles in the voids
region sphere1 sphere 20.0 20.0 0.0 10.0 units box
region sphere2 sphere 60.0 60.0 0.0 10.0 units box
delete_atoms region sphere1
Deleted 154 atoms, new total = 3446
delete_atoms region sphere2
Deleted 158 atoms, new total = 3288
create_atoms 2 single 20.0 20.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
create_atoms 2 single 60.0 60.0 0.0 units box
Created 1 atoms
create_atoms CPU = 0.000 seconds
set type 2 mass 400
Setting atom values ...
2 settings made for mass
set type 1 mass 1
Setting atom values ...
3288 settings made for mass
set type 2 diameter 20
Setting atom values ...
2 settings made for diameter
set type 1 diameter 1
Setting atom values ...
3288 settings made for diameter
velocity all create 1.44 87287 loop geom
# multi neighbor and comm for efficiency
neighbor 1 multi/old #multi
neigh_modify delay 0 #collection/interval 2 1 20
comm_modify mode multi/old vel yes #reduce/multi
# colloid potential
pair_style granular
pair_coeff * * hooke 1.0 0.5 tangential linear_history 1.0 0.5 0.1 damping mass_velocity
fix 1 all nph/sphere iso 0.0 1.0 10.0 drag 1.0
fix 2 all enforce2d
fix 3 all deform 1 xy erate 1e-3
#dump 1 all custom 1000 dump.granular id x y z radius
#dump 2 all image 1000 image.*.jpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 2 pad 5 adiam 1 5.0 adiam 2 1.5
#dump 3 all movie 1000 movie.mpg type type # zoom 1.5 center d 0.5 0.5 0.5
#dump_modify 3 pad 5 adiam 1 5.0 adiam 2 1.5
thermo_style custom step temp epair etotal press vol
thermo 1000
timestep 0.005
run 50000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 21
ghost atom cutoff = 21
binsize = 1, bins = 85 85 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair granular, perpetual
attributes: half, newton on, size, history
pair build: half/size/multi/old/newton/tri
stencil: half/multi/old/2d/tri
bin: standard
Per MPI rank memory allocation (min/avg/max) = 10.20 | 10.20 | 10.20 Mbytes
Step Temp E_pair TotEng Press Volume
0 1.44 0 1.4395623 0.66837658 7200
1000 0.32273428 0 0.32263619 0.17174972 7859.8897
2000 0.12441598 0 0.12437817 0.067078155 8212.9946
3000 0.067389284 0 0.067368801 0.040425551 8336.7112
4000 0.044312733 0 0.044299264 0.028220228 8229.0658
5000 0.032702163 0 0.032692223 0.024302012 7931.1298
6000 0.025856 0 0.025848141 0.021241317 7603.5534
7000 0.021437473 0 0.021430957 0.019285494 7243.5757
8000 0.018129567 0 0.018124057 0.020738727 6877.4816
9000 0.01637016 0 0.016365184 0.020261904 6515.3445
10000 0.01500918 0 0.015004618 0.020551803 6160.4475
11000 0.014156553 0 0.01415225 0.021324818 5815.4665
12000 0.013725412 0 0.01372124 0.021159958 5483.6304
13000 0.013215733 0 0.013211716 0.021685624 5165.4758
14000 0.012398179 0 0.012394411 0.024155572 4862.8657
15000 0.01184269 0 0.01183909 0.028504106 4577.901
16000 0.01143291 0 0.011429435 0.033564204 4309.88
17000 0.011166204 0 0.01116281 0.040588854 4058.9972
18000 0.011000875 0 0.010997532 0.048998904 3825.1569
19000 0.010225905 0 0.010222797 0.063669588 3607.6622
20000 0.0091390255 0 0.0091362477 0.088165402 3408.567
21000 0.0077382041 0 0.0077358521 0.11770474 3227.6936
22000 0.00601731 0 0.0060154811 0.15261994 3064.3873
23000 0.0046667591 0 0.0046653407 0.19453819 2917.9782
24000 0.0040425749 0 0.0040413461 0.24145833 2788.3897
25000 0.0031933217 0 0.0031923511 0.28989713 2674.5164
26000 0.0021138997 0 0.0021132571 0.33598673 2574.9312
27000 0.001700508 0 0.0016999912 0.37665013 2487.1626
28000 0.0014434246 0 0.0014429859 0.41572163 2409.327
29000 0.00089885063 0 0.00089857742 0.453431 2340.2313
30000 0.00048556478 0 0.00048541719 0.49176025 2279.2155
31000 0.00058130972 0 0.00058113303 0.53236818 2226.2349
32000 0.00057749847 0 0.00057732294 0.5691506 2181.2738
33000 0.00044719326 0 0.00044705733 0.59696179 2142.571
34000 0.00060924828 0 0.0006090631 0.61735036 2107.1282
35000 0.00077419805 0 0.00077396273 0.63696098 2072.6008
36000 0.00055752003 0 0.00055735057 0.65981842 2038.8242
37000 0.00031402452 0 0.00031392907 0.69018949 2007.3235
38000 0.00034969879 0 0.0003495925 0.72155053 1980.1706
39000 0.00041434197 0 0.00041421603 0.74680715 1957.3838
40000 0.00037229243 0 0.00037217927 0.76581686 1936.8034
41000 0.00031028842 0 0.00031019411 0.78321059 1916.1108
42000 0.00026623668 0 0.00026615575 0.80267329 1894.4649
43000 0.00020543723 0 0.00020537479 0.82714001 1872.7672
44000 0.0001563321 0 0.00015628458 0.85496396 1853.0284
45000 0.00014981713 0 0.00014977159 0.87924842 1836.4755
46000 0.00015641585 0 0.00015636831 0.89896936 1822.1989
47000 0.00016004701 0 0.00015999837 0.91661933 1808.4606
48000 0.00017437702 0 0.00017432402 0.93565475 1794.1258
49000 0.00018645903 0 0.00018640235 0.95733183 1779.4032
50000 0.00018469122 0 0.00018463508 0.96446925 1765.1534
Loop time of 30.1448 on 4 procs for 50000 steps with 3290 atoms
Performance: 716540.413 tau/day, 1658.658 timesteps/s
90.0% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 8.7565 | 12.704 | 16.036 | 89.8 | 42.14
Neigh | 0.4494 | 0.56436 | 0.66263 | 11.8 | 1.87
Comm | 9.5962 | 12.989 | 17.006 | 90.8 | 43.09
Output | 0.00088467 | 0.0011022 | 0.0015811 | 0.9 | 0.00
Modify | 2.9732 | 3.0944 | 3.2463 | 7.0 | 10.27
Other | | 0.7918 | | | 2.63
Nlocal: 822.500 ave 859 max 785 min
Histogram: 1 0 1 0 0 0 0 0 1 1
Nghost: 3049.75 ave 3089 max 2999 min
Histogram: 1 0 0 1 0 0 0 0 0 2
Neighs: 13440.5 ave 14459 max 11964 min
Histogram: 1 0 0 0 0 1 0 0 1 1
Total # of neighbors = 53762
Ave neighs/atom = 16.341033
Neighbor list builds = 348
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:00:30

View File

@ -0,0 +1,291 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Shear power-law distributed granular particles
units lj
atom_style sphere
dimension 2
read_data data.powerlaw
Reading data file ...
triclinic box = (9.9514336 9.9514336 0.0000000) to (331.81396 331.81396 1.0000000) with tilt (0.0000000 0.0000000 0.0000000)
1 by 1 by 1 MPI processor grid
reading atoms ...
10000 atoms
reading velocities ...
10000 velocities
read_data CPU = 0.027 seconds
change_box all triclinic
Changing box ...
triclinic box = (9.9514336 9.9514336 0.0000000) to (331.81396 331.81396 1.0000000) with tilt (0.0000000 0.0000000 0.0000000)
# multi neighbor and comm for efficiency
neighbor 1 multi
neigh_modify delay 0 collection/interval 6 1.5 3 10 30 100 200
comm_modify mode multi vel yes reduce/multi
# granular potential
pair_style granular
pair_coeff * * hooke 20.0 0.5 tangential linear_history 1.0 0.5 0.1 damping mass_velocity
# fixes
fix 1 all nve/sphere
fix 2 all enforce2d
fix 3 all deform 1 xy erate 1e-4
# dump 1 all custom 20000 dump.granular id x y z radius
thermo_style custom step temp epair etotal press vol pxy
thermo 1000
timestep 0.005
run 200000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 164.7888
ghost atom cutoff = 164.7888
binsize = 82.3944, bins = 4 4 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair granular, perpetual
attributes: half, newton on, size, history
pair build: half/size/multi/newton/tri
stencil: half/multi/2d/tri
bin: multi
Per MPI rank memory allocation (min/avg/max) = 14.77 | 14.77 | 14.77 Mbytes
Step Temp E_pair TotEng Press Volume Pxy
0 4.9204851e-05 0 4.9199931e-05 0.61204991 103595.49 -0.00083309917
1000 0.00038076464 0 0.00038072657 0.58694623 103595.49 -0.0066712806
2000 0.00027986478 0 0.00027983679 0.5845274 103595.49 -0.008880933
3000 0.00022105227 0 0.00022103017 0.58295464 103595.49 -0.011327442
4000 0.00020888366 0 0.00020886277 0.5826542 103595.49 -0.014147424
5000 0.00019912663 0 0.00019910672 0.58175837 103595.49 -0.015685634
6000 0.0001989441 0 0.00019892421 0.58170841 103595.49 -0.017379973
7000 0.00019307783 0 0.00019305852 0.58133913 103595.49 -0.019556709
8000 0.00018132444 0 0.00018130631 0.58134077 103595.49 -0.021609399
9000 0.00017909088 0 0.00017907297 0.58117179 103595.49 -0.023603514
10000 0.00018391928 0 0.00018390089 0.58070675 103595.49 -0.026026784
11000 0.00018985439 0 0.00018983541 0.58006086 103595.49 -0.028574238
12000 0.00018903569 0 0.00018901678 0.5794232 103595.49 -0.031151884
13000 0.00019070382 0 0.00019068475 0.57890243 103595.49 -0.033469404
14000 0.00019371625 0 0.00019369688 0.5787389 103595.49 -0.035646526
15000 0.00019833475 0 0.00019831492 0.57883166 103595.49 -0.037709788
16000 0.0002011729 0 0.00020115278 0.57875606 103595.49 -0.039452453
17000 0.00020285197 0 0.00020283169 0.5786311 103595.49 -0.040960671
18000 0.00020319174 0 0.00020317142 0.57842387 103595.49 -0.042257072
19000 0.00020290253 0 0.00020288224 0.57795042 103595.49 -0.043364149
20000 0.00020509848 0 0.00020507797 0.5771478 103595.49 -0.044392259
21000 0.00021803258 0 0.00021801078 0.57569003 103595.49 -0.044749043
22000 0.00020751217 0 0.00020749141 0.57477071 103595.49 -0.045719593
23000 0.00022053275 0 0.0002205107 0.57409228 103595.49 -0.047332146
24000 0.00022689646 0 0.00022687377 0.57325004 103595.49 -0.04871759
25000 0.00025224804 0 0.00025222282 0.57283712 103595.49 -0.050254871
26000 0.00025343198 0 0.00025340664 0.57238659 103595.49 -0.051604284
27000 0.00026689801 0 0.00026687132 0.57221042 103595.49 -0.052915257
28000 0.00027867954 0 0.00027865167 0.57197974 103595.49 -0.053832129
29000 0.00028697929 0 0.00028695059 0.57177264 103595.49 -0.054693121
30000 0.00028857612 0 0.00028854727 0.57145453 103595.49 -0.055559611
31000 0.00029228405 0 0.00029225482 0.5711044 103595.49 -0.056492699
32000 0.00029648627 0 0.00029645663 0.57060211 103595.49 -0.05729896
33000 0.00030524162 0 0.00030521109 0.57002519 103595.49 -0.058201322
34000 0.00031725644 0 0.00031722472 0.56920654 103595.49 -0.059128438
35000 0.00032273791 0 0.00032270564 0.56844677 103595.49 -0.060009671
36000 0.00033013013 0 0.00033009712 0.56795943 103595.49 -0.061074282
37000 0.00033942153 0 0.00033938759 0.56749208 103595.49 -0.062058531
38000 0.00035141528 0 0.00035138014 0.56682741 103595.49 -0.062953956
39000 0.00036126777 0 0.00036123164 0.56655193 103595.49 -0.063757684
40000 0.00037765934 0 0.00037762157 0.5661991 103595.49 -0.064535541
41000 0.00040834365 0 0.00040830281 0.56554085 103595.49 -0.064688281
42000 0.00042857233 0 0.00042852948 0.56474014 103595.49 -0.065262664
43000 0.00042692021 0 0.00042687752 0.56362013 103595.49 -0.065276794
44000 0.00040298912 0 0.00040294882 0.5631005 103595.49 -0.065626396
45000 0.00040947381 0 0.00040943286 0.56291946 103595.49 -0.066167734
46000 0.00040202686 0 0.00040198666 0.56273846 103595.49 -0.066543782
47000 0.00038914356 0 0.00038910465 0.56265937 103595.49 -0.067359923
48000 0.00038429737 0 0.00038425894 0.56274908 103595.49 -0.068231096
49000 0.00036912968 0 0.00036909277 0.56261623 103595.49 -0.068791569
50000 0.00035203094 0 0.00035199574 0.56257856 103595.49 -0.069298217
51000 0.00034403223 0 0.00034399783 0.56236537 103595.49 -0.070273225
52000 0.00034132431 0 0.00034129018 0.56220555 103595.49 -0.071740344
53000 0.000335692 0 0.00033565843 0.56194913 103595.49 -0.072834415
54000 0.00033048196 0 0.00033044891 0.56231491 103595.49 -0.073996938
55000 0.00032751145 0 0.00032747869 0.56225025 103595.49 -0.07506664
56000 0.00032696951 0 0.00032693682 0.56285506 103595.49 -0.076445354
57000 0.00033158698 0 0.00033155382 0.56354729 103595.49 -0.077682996
58000 0.00034300009 0 0.00034296579 0.56416964 103595.49 -0.078836604
59000 0.00034340257 0 0.00034336823 0.56490867 103595.49 -0.079658197
60000 0.00034736137 0 0.00034732663 0.56519398 103595.49 -0.080570223
61000 0.00034984523 0 0.00034981025 0.5651693 103595.49 -0.081115325
62000 0.00034995431 0 0.00034991932 0.56534549 103595.49 -0.081486038
63000 0.00033854269 0 0.00033850883 0.56582558 103595.49 -0.081892374
64000 0.00032621515 0 0.00032618253 0.5658388 103595.49 -0.082786608
65000 0.00031773942 0 0.00031770764 0.56576287 103595.49 -0.083706189
66000 0.00031772736 0 0.00031769558 0.56548117 103595.49 -0.084236463
67000 0.0003148631 0 0.00031483161 0.56483795 103595.49 -0.084506082
68000 0.00030359752 0 0.00030356716 0.56446443 103595.49 -0.084985509
69000 0.00030395128 0 0.00030392088 0.56437593 103595.49 -0.085548157
70000 0.00032811658 0 0.00032808376 0.56372411 103595.49 -0.085304154
71000 0.00035494531 0 0.00035490981 0.56326137 103595.49 -0.085047806
72000 0.0003253841 0 0.00032535156 0.56244462 103595.49 -0.085693663
73000 0.00032328895 0 0.00032325662 0.5629287 103595.49 -0.086119464
74000 0.00032650113 0 0.00032646848 0.56306166 103595.49 -0.087182721
75000 0.00034303222 0 0.00034299792 0.56219559 103595.49 -0.086604025
76000 0.00033786129 0 0.0003378275 0.56188071 103595.49 -0.086852177
77000 0.00033559735 0 0.00033556379 0.5619155 103595.49 -0.08689764
78000 0.00032579863 0 0.00032576605 0.56177059 103595.49 -0.087109469
79000 0.00031610815 0 0.00031607654 0.56160391 103595.49 -0.087250861
80000 0.00031246546 0 0.00031243422 0.56181676 103595.49 -0.087117648
81000 0.00029392131 0 0.00029389192 0.56205441 103595.49 -0.087601617
82000 0.00029624453 0 0.00029621491 0.56285229 103595.49 -0.08824145
83000 0.00030538821 0 0.00030535767 0.5627754 103595.49 -0.088318188
84000 0.00029587833 0 0.00029584874 0.56267246 103595.49 -0.08930338
85000 0.00030551128 0 0.00030548073 0.56251282 103595.49 -0.0897211
86000 0.00030000969 0 0.00029997969 0.56249642 103595.49 -0.089920789
87000 0.00030211667 0 0.00030208646 0.56256648 103595.49 -0.090315024
88000 0.00030524995 0 0.00030521943 0.5623007 103595.49 -0.090706456
89000 0.00031961257 0 0.00031958061 0.56210244 103595.49 -0.090852204
90000 0.0003195337 0 0.00031950175 0.56207472 103595.49 -0.090879606
91000 0.00033860446 0 0.0003385706 0.56197196 103595.49 -0.090891252
92000 0.0003327551 0 0.00033272183 0.56172473 103595.49 -0.090725694
93000 0.00032983619 0 0.00032980321 0.5619443 103595.49 -0.090626404
94000 0.00034024354 0 0.00034020952 0.56150371 103595.49 -0.090769983
95000 0.00033201405 0 0.00033198084 0.56145998 103595.49 -0.09102312
96000 0.00032851608 0 0.00032848323 0.56201045 103595.49 -0.09152522
97000 0.0003353172 0 0.00033528367 0.56256203 103595.49 -0.092443634
98000 0.00033453146 0 0.00033449801 0.5632537 103595.49 -0.093069693
99000 0.00034432742 0 0.00034429299 0.56355465 103595.49 -0.093332298
100000 0.00035299312 0 0.00035295782 0.56420115 103595.49 -0.093871701
101000 0.00042149444 0 0.00042145229 0.56424332 103595.49 -0.094001873
102000 0.0004580706 0 0.0004580248 0.56378535 103595.49 -0.093786943
103000 0.00046113464 0 0.00046108853 0.56428549 103595.49 -0.093463429
104000 0.00047583409 0 0.00047578651 0.5645355 103595.49 -0.093225615
105000 0.00048367276 0 0.00048362439 0.56469488 103595.49 -0.092935582
106000 0.00046931008 0 0.00046926315 0.56464923 103595.49 -0.09282958
107000 0.00046460766 0 0.00046456119 0.56502528 103595.49 -0.093077749
108000 0.00046398187 0 0.00046393547 0.56532911 103595.49 -0.09321949
109000 0.00047530523 0 0.0004752577 0.56561281 103595.49 -0.093217991
110000 0.00048531886 0 0.00048527033 0.56549262 103595.49 -0.092956034
111000 0.00049659003 0 0.00049654038 0.56507505 103595.49 -0.092554122
112000 0.00050113619 0 0.00050108607 0.56528891 103595.49 -0.092227508
113000 0.0005138896 0 0.00051383821 0.56550655 103595.49 -0.092096556
114000 0.00052560295 0 0.00052555039 0.56567551 103595.49 -0.09181586
115000 0.00054349317 0 0.00054343882 0.56530917 103595.49 -0.090961623
116000 0.00056022902 0 0.00056017299 0.56482302 103595.49 -0.090810658
117000 0.00055876064 0 0.00055870476 0.56488791 103595.49 -0.090329656
118000 0.00056191427 0 0.00056185808 0.56461166 103595.49 -0.090161067
119000 0.0005488829 0 0.00054882801 0.56437975 103595.49 -0.090328459
120000 0.00054084712 0 0.00054079303 0.564481 103595.49 -0.090602791
121000 0.00053717105 0 0.00053711733 0.56481743 103595.49 -0.090309102
122000 0.00053834163 0 0.00053828779 0.56385259 103595.49 -0.090433254
123000 0.00053319394 0 0.00053314062 0.56335613 103595.49 -0.090723928
124000 0.00053127439 0 0.00053122127 0.5631684 103595.49 -0.091178253
125000 0.00053624623 0 0.00053619261 0.56387166 103595.49 -0.091701174
126000 0.0005253773 0 0.00052532476 0.5639006 103595.49 -0.092033098
127000 0.00052459276 0 0.0005245403 0.56361298 103595.49 -0.092219098
128000 0.00054030806 0 0.00054025403 0.56307203 103595.49 -0.092196938
129000 0.00055474894 0 0.00055469346 0.5622815 103595.49 -0.09178309
130000 0.00057391115 0 0.00057385376 0.56244981 103595.49 -0.09170211
131000 0.00058650769 0 0.00058644904 0.56195859 103595.49 -0.090649841
132000 0.00058529163 0 0.0005852331 0.56162943 103595.49 -0.090167101
133000 0.00062544817 0 0.00062538563 0.5594761 103595.49 -0.088989624
134000 0.00063457749 0 0.00063451403 0.55917757 103595.49 -0.089702278
135000 0.00065371789 0 0.00065365252 0.55885043 103595.49 -0.090030252
136000 0.00070050714 0 0.00070043709 0.55854751 103595.49 -0.08960124
137000 0.0006750775 0 0.00067501 0.55809563 103595.49 -0.090252473
138000 0.00068827043 0 0.0006882016 0.55806674 103595.49 -0.090238994
139000 0.00069748073 0 0.00069741098 0.55734587 103595.49 -0.090118549
140000 0.00071065284 0 0.00071058177 0.55711669 103595.49 -0.090336074
141000 0.00070994204 0 0.00070987104 0.55638115 103595.49 -0.089917062
142000 0.00071514386 0 0.00071507235 0.55614391 103595.49 -0.090392071
143000 0.00071334667 0 0.00071327533 0.55640687 103595.49 -0.091256718
144000 0.00069553102 0 0.00069546147 0.55705702 103595.49 -0.091761396
145000 0.00068849503 0 0.00068842618 0.55692035 103595.49 -0.091895738
146000 0.00068407816 0 0.00068400975 0.55660026 103595.49 -0.092191588
147000 0.00069521557 0 0.00069514605 0.55556456 103595.49 -0.092354739
148000 0.00068349281 0 0.00068342446 0.55537498 103595.49 -0.092914636
149000 0.00067959644 0 0.00067952848 0.55537695 103595.49 -0.093738463
150000 0.00067100566 0 0.00067093856 0.55544851 103595.49 -0.094104003
151000 0.00068044722 0 0.00068037917 0.5554655 103595.49 -0.094943239
152000 0.00068109012 0 0.00068102201 0.55585405 103595.49 -0.095355111
153000 0.00068666181 0 0.00068659314 0.55501583 103595.49 -0.095234652
154000 0.00068283406 0 0.00068276578 0.55644996 103595.49 -0.095902623
155000 0.00069836346 0 0.00069829363 0.55747472 103595.49 -0.096978444
156000 0.00072807264 0 0.00072799984 0.55807332 103595.49 -0.097415305
157000 0.00077300609 0 0.00077292879 0.55871196 103595.49 -0.098034508
158000 0.00081631408 0 0.00081623245 0.558479 103595.49 -0.09825722
159000 0.00079291984 0 0.00079284054 0.55784788 103595.49 -0.097758094
160000 0.0008203256 0 0.00082024357 0.55700259 103595.49 -0.097519328
161000 0.00081471235 0 0.00081463087 0.556622 103595.49 -0.097787992
162000 0.00080692462 0 0.00080684393 0.5566795 103595.49 -0.097210216
163000 0.00081149678 0 0.00081141564 0.55596697 103595.49 -0.097517476
164000 0.00081577795 0 0.00081569637 0.55569684 103595.49 -0.096908869
165000 0.00084604988 0 0.00084596528 0.55492052 103595.49 -0.095481627
166000 0.00082198923 0 0.00082190703 0.5552628 103595.49 -0.09477531
167000 0.00084903108 0 0.00084894618 0.55477991 103595.49 -0.094758799
168000 0.00081613582 0 0.00081605421 0.55508416 103595.49 -0.094804088
169000 0.00083341061 0 0.00083332727 0.55476794 103595.49 -0.094519882
170000 0.00077835092 0 0.00077827308 0.55516626 103595.49 -0.094843673
171000 0.00074843733 0 0.00074836249 0.55417469 103595.49 -0.094731356
172000 0.0007425125 0 0.00074243825 0.55431854 103595.49 -0.095174333
173000 0.00074144093 0 0.00074136678 0.55429464 103595.49 -0.094982598
174000 0.00072375323 0 0.00072368086 0.55421045 103595.49 -0.09489531
175000 0.0007270779 0 0.00072700519 0.55413607 103595.49 -0.094197685
176000 0.00071114682 0 0.00071107571 0.55342226 103595.49 -0.093083865
177000 0.00069325125 0 0.00069318193 0.55441386 103595.49 -0.093289572
178000 0.00067686202 0 0.00067679434 0.55504892 103595.49 -0.093512587
179000 0.00068326039 0 0.00068319206 0.55519365 103595.49 -0.093974329
180000 0.00075070045 0 0.00075062538 0.55415541 103595.49 -0.09327459
181000 0.00077670344 0 0.00077662577 0.55328725 103595.49 -0.092373689
182000 0.00077422781 0 0.00077415038 0.553131 103595.49 -0.092353979
183000 0.00080250542 0 0.00080242517 0.5519122 103595.49 -0.091897169
184000 0.00081235214 0 0.00081227091 0.55172769 103595.49 -0.091906209
185000 0.00078879443 0 0.00078871555 0.55145488 103595.49 -0.091198506
186000 0.00078497746 0 0.00078489896 0.55202944 103595.49 -0.091674987
187000 0.00079483049 0 0.000794751 0.55278073 103595.49 -0.092508295
188000 0.00079056756 0 0.0007904885 0.55362903 103595.49 -0.092801369
189000 0.00079162262 0 0.00079154346 0.55429061 103595.49 -0.092964781
190000 0.00078121133 0 0.00078113321 0.55386716 103595.49 -0.092689851
191000 0.00076574893 0 0.00076567235 0.5546533 103595.49 -0.093414672
192000 0.00076215201 0 0.0007620758 0.55503049 103595.49 -0.093986391
193000 0.00075652635 0 0.0007564507 0.55477696 103595.49 -0.094417347
194000 0.00075725781 0 0.00075718208 0.55457687 103595.49 -0.094241721
195000 0.0007434693 0 0.00074339496 0.55471575 103595.49 -0.094102015
196000 0.00073792493 0 0.00073785114 0.55463671 103595.49 -0.094452279
197000 0.00074673445 0 0.00074665978 0.55459327 103595.49 -0.09463863
198000 0.00072734835 0 0.00072727561 0.55514628 103595.49 -0.094622434
199000 0.00071846919 0 0.00071839734 0.55501969 103595.49 -0.094414887
200000 0.00072384651 0 0.00072377412 0.55533335 103595.49 -0.094159469
Loop time of 443.321 on 1 procs for 200000 steps with 10000 atoms
Performance: 194892.839 tau/day, 451.141 timesteps/s
100.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 362.28 | 362.28 | 362.28 | 0.0 | 81.72
Neigh | 1.737 | 1.737 | 1.737 | 0.0 | 0.39
Comm | 5.0082 | 5.0082 | 5.0082 | 0.0 | 1.13
Output | 0.01774 | 0.01774 | 0.01774 | 0.0 | 0.00
Modify | 64.992 | 64.992 | 64.992 | 0.0 | 14.66
Other | | 9.286 | | | 2.09
Nlocal: 10000.0 ave 10000 max 10000 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 487.000 ave 487 max 487 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 34427.0 ave 34427 max 34427 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 34427
Ave neighs/atom = 3.4427000
Neighbor list builds = 244
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:07:23

View File

@ -0,0 +1,291 @@
LAMMPS (24 Dec 2020)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:97)
using 1 OpenMP thread(s) per MPI task
# Shear power-law distributed granular particles
units lj
atom_style sphere
dimension 2
read_data data.powerlaw
Reading data file ...
triclinic box = (9.9514336 9.9514336 0.0000000) to (331.81396 331.81396 1.0000000) with tilt (0.0000000 0.0000000 0.0000000)
2 by 2 by 1 MPI processor grid
reading atoms ...
10000 atoms
reading velocities ...
10000 velocities
read_data CPU = 0.114 seconds
change_box all triclinic
Changing box ...
triclinic box = (9.9514336 9.9514336 0.0000000) to (331.81396 331.81396 1.0000000) with tilt (0.0000000 0.0000000 0.0000000)
# multi neighbor and comm for efficiency
neighbor 1 multi
neigh_modify delay 0 collection/interval 6 1.5 3 10 30 100 200
comm_modify mode multi vel yes reduce/multi
# granular potential
pair_style granular
pair_coeff * * hooke 20.0 0.5 tangential linear_history 1.0 0.5 0.1 damping mass_velocity
# fixes
fix 1 all nve/sphere
fix 2 all enforce2d
fix 3 all deform 1 xy erate 1e-4
# dump 1 all custom 20000 dump.granular id x y z radius
thermo_style custom step temp epair etotal press vol pxy
thermo 1000
timestep 0.005
run 200000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 164.7888
ghost atom cutoff = 164.7888
binsize = 82.3944, bins = 4 4 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair granular, perpetual
attributes: half, newton on, size, history
pair build: half/size/multi/newton/tri
stencil: half/multi/2d/tri
bin: multi
Per MPI rank memory allocation (min/avg/max) = 12.65 | 12.67 | 12.68 Mbytes
Step Temp E_pair TotEng Press Volume Pxy
0 4.9204851e-05 0 4.9199931e-05 0.61204991 103595.49 -0.00083309917
1000 0.00038076464 0 0.00038072657 0.58694623 103595.49 -0.0066712806
2000 0.00027986478 0 0.00027983679 0.5845274 103595.49 -0.008880933
3000 0.00022105227 0 0.00022103017 0.58295464 103595.49 -0.011327442
4000 0.00020888366 0 0.00020886277 0.5826542 103595.49 -0.014147424
5000 0.00019912663 0 0.00019910672 0.58175837 103595.49 -0.015685634
6000 0.0001989441 0 0.00019892421 0.58170841 103595.49 -0.017379973
7000 0.00019307783 0 0.00019305852 0.58133913 103595.49 -0.019556709
8000 0.00018132444 0 0.00018130631 0.58134077 103595.49 -0.021609399
9000 0.00017909088 0 0.00017907297 0.58117179 103595.49 -0.023603514
10000 0.00018391928 0 0.00018390089 0.58070675 103595.49 -0.026026784
11000 0.00018985439 0 0.00018983541 0.58006086 103595.49 -0.028574238
12000 0.00018903569 0 0.00018901678 0.5794232 103595.49 -0.031151884
13000 0.00019070382 0 0.00019068475 0.57890243 103595.49 -0.033469404
14000 0.00019371625 0 0.00019369688 0.5787389 103595.49 -0.035646526
15000 0.00019833475 0 0.00019831492 0.57883166 103595.49 -0.037709788
16000 0.0002011729 0 0.00020115278 0.57875606 103595.49 -0.039452453
17000 0.00020285197 0 0.00020283168 0.5786311 103595.49 -0.040960671
18000 0.00020319173 0 0.00020317141 0.57842387 103595.49 -0.042257076
19000 0.00020290253 0 0.00020288224 0.57795043 103595.49 -0.043364149
20000 0.00020509847 0 0.00020507796 0.57714779 103595.49 -0.04439226
21000 0.0002180326 0 0.0002180108 0.57569003 103595.49 -0.044749042
22000 0.00020751218 0 0.00020749143 0.57477071 103595.49 -0.045719595
23000 0.0002205328 0 0.00022051075 0.57409228 103595.49 -0.047332145
24000 0.00022689643 0 0.00022687374 0.57325004 103595.49 -0.048717593
25000 0.00025224797 0 0.00025222275 0.57283728 103595.49 -0.050255013
26000 0.00025343192 0 0.00025340657 0.5723866 103595.49 -0.051604294
27000 0.0002668981 0 0.00026687141 0.57221051 103595.49 -0.052915314
28000 0.00027867942 0 0.00027865155 0.57197889 103595.49 -0.053831415
29000 0.00028697868 0 0.00028694998 0.57177287 103595.49 -0.054693262
30000 0.00028857623 0 0.00028854737 0.5714545 103595.49 -0.055559583
31000 0.00029228526 0 0.00029225603 0.57110328 103595.49 -0.056491646
32000 0.00029648479 0 0.00029645514 0.57060242 103595.49 -0.057299367
33000 0.00030524226 0 0.00030521174 0.57003089 103595.49 -0.058207205
34000 0.00031725278 0 0.00031722106 0.56920179 103595.49 -0.059123522
35000 0.00032273715 0 0.00032270488 0.56844806 103595.49 -0.06001074
36000 0.00033013214 0 0.00033009912 0.56795631 103595.49 -0.06107304
37000 0.00033942364 0 0.00033938969 0.56749308 103595.49 -0.062060209
38000 0.00035140856 0 0.00035137342 0.56682754 103595.49 -0.062954063
39000 0.00036125739 0 0.00036122126 0.56654839 103595.49 -0.063755554
40000 0.00037765404 0 0.00037761628 0.56619876 103595.49 -0.064535888
41000 0.00040833154 0 0.00040829071 0.56554179 103595.49 -0.064688901
42000 0.0004285629 0 0.00042852004 0.56474124 103595.49 -0.06526276
43000 0.00042691211 0 0.00042686942 0.56362219 103595.49 -0.065275494
44000 0.00040296803 0 0.00040292773 0.56310053 103595.49 -0.065625772
45000 0.00040933842 0 0.00040929749 0.56291338 103595.49 -0.066164396
46000 0.00040202229 0 0.00040198209 0.56273845 103595.49 -0.066541045
47000 0.00038914157 0 0.00038910266 0.562658 103595.49 -0.067357923
48000 0.00038428678 0 0.00038424835 0.5627468 103595.49 -0.068230972
49000 0.00036912501 0 0.0003690881 0.56261857 103595.49 -0.068794933
50000 0.00035203987 0 0.00035200467 0.56258099 103595.49 -0.069290362
51000 0.00034400774 0 0.00034397334 0.56237066 103595.49 -0.070274303
52000 0.00034126666 0 0.00034123253 0.56221436 103595.49 -0.071744779
53000 0.00033563205 0 0.00033559849 0.56195218 103595.49 -0.072836324
54000 0.0003304406 0 0.00033040756 0.5623187 103595.49 -0.073999087
55000 0.00032742828 0 0.00032739553 0.56225383 103595.49 -0.075066978
56000 0.00032696921 0 0.00032693651 0.56285643 103595.49 -0.076445225
57000 0.0003316388 0 0.00033160564 0.56354513 103595.49 -0.077683955
58000 0.00034325202 0 0.0003432177 0.56416895 103595.49 -0.078839054
59000 0.0003433584 0 0.00034332406 0.56490343 103595.49 -0.079658776
60000 0.00034732721 0 0.00034729247 0.5651932 103595.49 -0.080573609
61000 0.00034978913 0 0.00034975415 0.56517379 103595.49 -0.081109788
62000 0.00034995232 0 0.00034991733 0.56534537 103595.49 -0.081491908
63000 0.00033854315 0 0.00033850929 0.56582246 103595.49 -0.081894953
64000 0.0003260452 0 0.00032601259 0.56583259 103595.49 -0.082790811
65000 0.00031763096 0 0.0003175992 0.56576947 103595.49 -0.083707224
66000 0.00031761371 0 0.00031758194 0.56548785 103595.49 -0.084243042
67000 0.00031503681 0 0.0003150053 0.56483862 103595.49 -0.08451056
68000 0.0003036386 0 0.00030360824 0.56444755 103595.49 -0.084967521
69000 0.00030398979 0 0.00030395939 0.56436362 103595.49 -0.085541879
70000 0.0003281569 0 0.00032812409 0.56372598 103595.49 -0.085287975
71000 0.00035614631 0 0.0003561107 0.56322133 103595.49 -0.084970215
72000 0.00032709207 0 0.00032705936 0.56231837 103595.49 -0.085540239
73000 0.00032545048 0 0.00032541793 0.56278947 103595.49 -0.085940822
74000 0.00033285331 0 0.00033282002 0.56288405 103595.49 -0.08695227
75000 0.00034622589 0 0.00034619127 0.56198219 103595.49 -0.086349357
76000 0.00033654825 0 0.0003365146 0.56183659 103595.49 -0.086892729
77000 0.00033550364 0 0.00033547009 0.56197292 103595.49 -0.087018641
78000 0.00032680247 0 0.00032676979 0.56183307 103595.49 -0.087097072
79000 0.00031624495 0 0.00031621333 0.56161689 103595.49 -0.087358849
80000 0.0003124879 0 0.00031245665 0.5618608 103595.49 -0.087165611
81000 0.00029451552 0 0.00029448606 0.56211081 103595.49 -0.087652479
82000 0.00029588468 0 0.00029585509 0.5628096 103595.49 -0.08832193
83000 0.00030483225 0 0.00030480177 0.56261673 103595.49 -0.088586937
84000 0.00029556003 0 0.00029553047 0.56272654 103595.49 -0.089434209
85000 0.00030506369 0 0.00030503319 0.5627918 103595.49 -0.089830152
86000 0.00030015302 0 0.00030012301 0.56240656 103595.49 -0.090100219
87000 0.00030322942 0 0.0003031991 0.56243997 103595.49 -0.090327187
88000 0.00030569181 0 0.00030566124 0.56236256 103595.49 -0.090734148
89000 0.00031220625 0 0.00031217503 0.5621542 103595.49 -0.090898044
90000 0.00032214966 0 0.00032211744 0.56209534 103595.49 -0.090909986
91000 0.00033884101 0 0.00033880712 0.56191673 103595.49 -0.090818046
92000 0.00033260559 0 0.00033257233 0.56172194 103595.49 -0.090647169
93000 0.00032732547 0 0.00032729274 0.5619652 103595.49 -0.090575176
94000 0.00033817734 0 0.00033814352 0.56155436 103595.49 -0.090700379
95000 0.00033009649 0 0.00033006348 0.56147407 103595.49 -0.090940641
96000 0.00032882782 0 0.00032879494 0.56191577 103595.49 -0.091469188
97000 0.00032856078 0 0.00032852793 0.56271585 103595.49 -0.092256803
98000 0.00033030749 0 0.00033027446 0.56340097 103595.49 -0.093188128
99000 0.00033611507 0 0.00033608146 0.56375754 103595.49 -0.093539699
100000 0.00034990568 0 0.00034987069 0.56450225 103595.49 -0.093951624
101000 0.00044441478 0 0.00044437034 0.56437908 103595.49 -0.094161976
102000 0.00045403284 0 0.00045398743 0.56433013 103595.49 -0.093900071
103000 0.00045412317 0 0.00045407776 0.56468095 103595.49 -0.093670567
104000 0.00046494637 0 0.00046489988 0.56478442 103595.49 -0.093397211
105000 0.00047962271 0 0.00047957475 0.56482329 103595.49 -0.093141318
106000 0.00046840864 0 0.0004683618 0.56494359 103595.49 -0.092994704
107000 0.00046432422 0 0.00046427779 0.56543377 103595.49 -0.093135897
108000 0.0004655443 0 0.00046549774 0.5656898 103595.49 -0.093383926
109000 0.0004863785 0 0.00048632986 0.5657434 103595.49 -0.093328929
110000 0.00048804324 0 0.00048799443 0.5656147 103595.49 -0.09302382
111000 0.00050352097 0 0.00050347062 0.56529279 103595.49 -0.092461373
112000 0.00050474509 0 0.00050469461 0.56537494 103595.49 -0.092212501
113000 0.0005125299 0 0.00051247865 0.56547326 103595.49 -0.092304578
114000 0.00052700168 0 0.00052694898 0.56568076 103595.49 -0.092013613
115000 0.00054217865 0 0.00054212444 0.56526328 103595.49 -0.091011537
116000 0.00055122699 0 0.00055117186 0.56489606 103595.49 -0.090688925
117000 0.00055802701 0 0.00055797121 0.56458767 103595.49 -0.090385903
118000 0.00055416633 0 0.00055411091 0.56433528 103595.49 -0.090454192
119000 0.00055519395 0 0.00055513843 0.56411926 103595.49 -0.090495063
120000 0.0005535194 0 0.00055346405 0.56424847 103595.49 -0.090915789
121000 0.00054781097 0 0.00054775619 0.56443756 103595.49 -0.090687173
122000 0.00054528815 0 0.00054523362 0.56401103 103595.49 -0.090443168
123000 0.0005456223 0 0.00054556773 0.56376875 103595.49 -0.090277114
124000 0.00054080131 0 0.00054074723 0.563306 103595.49 -0.091297668
125000 0.00054597 0 0.0005459154 0.56387718 103595.49 -0.091522394
126000 0.000544669 0 0.00054461453 0.56318185 103595.49 -0.091100523
127000 0.00054592361 0 0.00054586902 0.56328758 103595.49 -0.091299714
128000 0.00056246325 0 0.000562407 0.56296852 103595.49 -0.091491356
129000 0.00057655488 0 0.00057649723 0.56242057 103595.49 -0.091474584
130000 0.00060363901 0 0.00060357864 0.56182729 103595.49 -0.091367782
131000 0.00060590757 0 0.00060584698 0.56115572 103595.49 -0.090594163
132000 0.00061689139 0 0.0006168297 0.56029248 103595.49 -0.089857939
133000 0.00063288773 0 0.00063282444 0.55971427 103595.49 -0.08954619
134000 0.00064153654 0 0.00064147238 0.55929877 103595.49 -0.089860563
135000 0.00065473169 0 0.00065466622 0.5590797 103595.49 -0.089932375
136000 0.0006814182 0 0.00068135006 0.55797116 103595.49 -0.08929097
137000 0.00068344911 0 0.00068338077 0.55796657 103595.49 -0.089644888
138000 0.00071510067 0 0.00071502916 0.55752379 103595.49 -0.089734088
139000 0.00074772787 0 0.0007476531 0.55740054 103595.49 -0.089968295
140000 0.00072706311 0 0.0007269904 0.55659113 103595.49 -0.090370844
141000 0.0007179286 0 0.00071785681 0.55659012 103595.49 -0.089976688
142000 0.00072587657 0 0.00072580399 0.55589037 103595.49 -0.090532153
143000 0.00074470967 0 0.0007446352 0.55553128 103595.49 -0.091019969
144000 0.00071737422 0 0.00071730248 0.55555994 103595.49 -0.090926005
145000 0.00070363824 0 0.00070356787 0.55548936 103595.49 -0.0912353
146000 0.00069604487 0 0.00069597527 0.55540516 103595.49 -0.091656715
147000 0.00070047196 0 0.00070040191 0.55466746 103595.49 -0.092101291
148000 0.00069764904 0 0.00069757927 0.55460283 103595.49 -0.092334573
149000 0.00068884707 0 0.00068877819 0.55462796 103595.49 -0.0928736
150000 0.00067704593 0 0.00067697823 0.55520015 103595.49 -0.093512131
151000 0.00067702275 0 0.00067695505 0.55530068 103595.49 -0.094127311
152000 0.000690717 0 0.00069064792 0.55432538 103595.49 -0.094248615
153000 0.00067758953 0 0.00067752177 0.55460446 103595.49 -0.094839924
154000 0.00067748542 0 0.00067741767 0.55532529 103595.49 -0.095832411
155000 0.00068723442 0 0.0006871657 0.55637763 103595.49 -0.096838207
156000 0.00071590663 0 0.00071583504 0.5569485 103595.49 -0.097686166
157000 0.00078378647 0 0.0007837081 0.55755381 103595.49 -0.097968527
158000 0.00080144334 0 0.00080136319 0.55741023 103595.49 -0.098119361
159000 0.00079183165 0 0.00079175247 0.55756142 103595.49 -0.097925888
160000 0.00081212358 0 0.00081204237 0.55669124 103595.49 -0.098171108
161000 0.00082903843 0 0.00082895553 0.55608918 103595.49 -0.097827206
162000 0.00084257416 0 0.0008424899 0.5560239 103595.49 -0.096775743
163000 0.00086279615 0 0.00086270987 0.55550215 103595.49 -0.095981927
164000 0.00092139657 0 0.00092130443 0.55395137 103595.49 -0.095215338
165000 0.00095519936 0 0.00095510384 0.55376787 103595.49 -0.0945666
166000 0.00092201276 0 0.00092192056 0.55373794 103595.49 -0.093531233
167000 0.0008525194 0 0.00085243415 0.55375862 103595.49 -0.09389901
168000 0.00081977785 0 0.00081969587 0.5536646 103595.49 -0.093829746
169000 0.00079692467 0 0.00079684497 0.55416599 103595.49 -0.094433271
170000 0.00077787798 0 0.0007778002 0.55416629 103595.49 -0.095043413
171000 0.0007651362 0 0.00076505969 0.55418872 103595.49 -0.095212376
172000 0.00074631438 0 0.00074623975 0.55403881 103595.49 -0.095463949
173000 0.00074431288 0 0.00074423845 0.55415801 103595.49 -0.095319615
174000 0.00073924649 0 0.00073917257 0.55373682 103595.49 -0.094724272
175000 0.00070973165 0 0.00070966068 0.55393569 103595.49 -0.094201112
176000 0.00069820766 0 0.00069813784 0.55341229 103595.49 -0.093530469
177000 0.00070922657 0 0.00070915564 0.55282781 103595.49 -0.093282587
178000 0.00073688566 0 0.00073681197 0.55223248 103595.49 -0.092190554
179000 0.00072455886 0 0.0007244864 0.55244288 103595.49 -0.09182393
180000 0.00071894558 0 0.00071887369 0.55281517 103595.49 -0.092177032
181000 0.00071752475 0 0.000717453 0.55297293 103595.49 -0.09230934
182000 0.00072247421 0 0.00072240196 0.55287294 103595.49 -0.092465908
183000 0.00070596821 0 0.00070589761 0.5526242 103595.49 -0.092013313
184000 0.00072460909 0 0.00072453663 0.55230817 103595.49 -0.092211243
185000 0.00072499917 0 0.00072492667 0.55273387 103595.49 -0.092920761
186000 0.00072852698 0 0.00072845413 0.55358929 103595.49 -0.093428623
187000 0.00072515668 0 0.00072508417 0.55336733 103595.49 -0.093440126
188000 0.00071355728 0 0.00071348593 0.55408468 103595.49 -0.094819333
189000 0.00071703212 0 0.00071696042 0.55424355 103595.49 -0.096198144
190000 0.00071808849 0 0.00071801668 0.55504118 103595.49 -0.097199842
191000 0.00072458142 0 0.00072450896 0.55493515 103595.49 -0.097564772
192000 0.00071472504 0 0.00071465357 0.55572657 103595.49 -0.097663072
193000 0.00070803966 0 0.00070796886 0.55546116 103595.49 -0.097306162
194000 0.00068236077 0 0.00068229254 0.55581155 103595.49 -0.097141594
195000 0.00067304613 0 0.00067297882 0.55559507 103595.49 -0.096646489
196000 0.00066680808 0 0.0006667414 0.55512029 103595.49 -0.096241456
197000 0.00065829161 0 0.00065822578 0.55545375 103595.49 -0.095808778
198000 0.0006617611 0 0.00066169492 0.55551074 103595.49 -0.095423531
199000 0.00066805655 0 0.00066798975 0.55581298 103595.49 -0.095287337
200000 0.00067263902 0 0.00067257175 0.55601669 103595.49 -0.095551006
Loop time of 145.127 on 4 procs for 200000 steps with 10000 atoms
Performance: 595339.507 tau/day, 1378.101 timesteps/s
100.0% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 57.89 | 91.946 | 113.82 | 229.7 | 63.36
Neigh | 0.34276 | 0.48607 | 0.56708 | 13.1 | 0.33
Comm | 6.569 | 28.916 | 63.505 | 417.0 | 19.92
Output | 0.0087178 | 0.011935 | 0.01563 | 2.3 | 0.01
Modify | 10.432 | 16.495 | 20.378 | 97.7 | 11.37
Other | | 7.272 | | | 5.01
Nlocal: 2500.00 ave 2990 max 1652 min
Histogram: 1 0 0 0 0 1 0 0 0 2
Nghost: 228.000 ave 254 max 198 min
Histogram: 1 0 1 0 0 0 0 0 0 2
Neighs: 8611.25 ave 10364 max 5676 min
Histogram: 1 0 0 0 0 1 0 0 0 2
Total # of neighbors = 34445
Ave neighs/atom = 3.4445000
Neighbor list builds = 241
Dangerous builds = 0
Please see the log.cite file for references relevant to this simulation
Total wall time: 0:02:25

View File

@ -62,7 +62,7 @@ delete_atoms overlap 0.5 small big
reset_timestep 0 reset_timestep 0
neighbor 0.3 bin neighbor 0.3 multi
neigh_modify delay 0 every 1 check yes neigh_modify delay 0 every 1 check yes
comm_modify mode multi group big vel yes comm_modify mode multi group big vel yes

View File

@ -911,14 +911,14 @@ class lammps(object):
else: return None else: return None
if ctype == LMP_TYPE_SCALAR: if ctype == LMP_TYPE_SCALAR:
if style == LMP_STYLE_GLOBAL: if cstyle == LMP_STYLE_GLOBAL:
self.lib.lammps_extract_compute.restype = POINTER(c_double) self.lib.lammps_extract_compute.restype = POINTER(c_double)
with ExceptionCheck(self): with ExceptionCheck(self):
ptr = self.lib.lammps_extract_compute(self.lmp,cid,cstyle,ctype) ptr = self.lib.lammps_extract_compute(self.lmp,cid,cstyle,ctype)
return ptr[0] return ptr[0]
elif style == LMP_STYLE_ATOM: elif cstyle == LMP_STYLE_ATOM:
return None return None
elif style == LMP_STYLE_LOCAL: elif cstyle == LMP_STYLE_LOCAL:
self.lib.lammps_extract_compute.restype = POINTER(c_int) self.lib.lammps_extract_compute.restype = POINTER(c_int)
with ExceptionCheck(self): with ExceptionCheck(self):
ptr = self.lib.lammps_extract_compute(self.lmp,cid,cstyle,ctype) ptr = self.lib.lammps_extract_compute(self.lmp,cid,cstyle,ctype)

View File

@ -43,6 +43,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp)
single_enable = 1; single_enable = 1;
no_virial_fdotr_compute = 1; no_virial_fdotr_compute = 1;
centroidstressflag = CENTROID_NOTAVAIL; centroidstressflag = CENTROID_NOTAVAIL;
finitecutflag = 1;
history = 1; history = 1;
size_history = 3; size_history = 3;
@ -798,3 +799,23 @@ double PairGranHookeHistory::memory_usage()
double bytes = (double)nmax * sizeof(double); double bytes = (double)nmax * sizeof(double);
return bytes; return bytes;
} }
/* ----------------------------------------------------------------------
self-interaction range of particle
------------------------------------------------------------------------- */
double PairGranHookeHistory::atom2cut(int i)
{
double cut = atom->radius[i]*2;
return cut;
}
/* ----------------------------------------------------------------------
maximum interaction range for two finite particles
------------------------------------------------------------------------- */
double PairGranHookeHistory::radii2cut(double r1, double r2)
{
double cut = r1+r2;
return cut;
}

View File

@ -42,6 +42,8 @@ class PairGranHookeHistory : public Pair {
int pack_forward_comm(int, int *, double *, int, int *); int pack_forward_comm(int, int *, double *, int, int *);
void unpack_forward_comm(int, int, double *); void unpack_forward_comm(int, int, double *);
double memory_usage(); double memory_usage();
double atom2cut(int);
double radii2cut(double,double);
protected: protected:
double kn,kt,gamman,gammat,xmu; double kn,kt,gamman,gammat,xmu;

View File

@ -67,6 +67,7 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp)
single_enable = 1; single_enable = 1;
no_virial_fdotr_compute = 1; no_virial_fdotr_compute = 1;
centroidstressflag = CENTROID_NOTAVAIL; centroidstressflag = CENTROID_NOTAVAIL;
finitecutflag = 1;
single_extra = 12; single_extra = 12;
svector = new double[single_extra]; svector = new double[single_extra];
@ -1837,3 +1838,50 @@ void PairGranular::transfer_history(double* source, double* target)
for (int i = 0; i < size_history; i++) for (int i = 0; i < size_history; i++)
target[i] = history_transfer_factors[i]*source[i]; target[i] = history_transfer_factors[i]*source[i];
} }
/* ----------------------------------------------------------------------
self-interaction range of particle
------------------------------------------------------------------------- */
double PairGranular::atom2cut(int i)
{
double cut;
cut = atom->radius[i]*2;
if(beyond_contact) {
int itype = atom->type[i];
if(normal_model[itype][itype] == JKR) {
cut += pulloff_distance(cut, cut, itype, itype);
}
}
return cut;
}
/* ----------------------------------------------------------------------
maximum interaction range for two finite particles
------------------------------------------------------------------------- */
double PairGranular::radii2cut(double r1, double r2)
{
double cut = 0.0;
if(beyond_contact) {
int n = atom->ntypes;
double temp;
// Check all combinations of i and j to find theoretical maximum pull off distance
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(normal_model[i][j] == JKR) {
temp = pulloff_distance(r1, r2, i, j);
if(temp > cut) cut = temp;
}
}
}
}
cut += r1 + r2;
return cut;
}

View File

@ -40,6 +40,8 @@ class PairGranular : public Pair {
int pack_forward_comm(int, int *, double *, int, int *); int pack_forward_comm(int, int *, double *, int, int *);
void unpack_forward_comm(int, int, double *); void unpack_forward_comm(int, int, double *);
double memory_usage(); double memory_usage();
double atom2cut(int);
double radii2cut(double,double);
protected: protected:
double dt; double dt;

View File

@ -15,11 +15,11 @@
NBinStyle(kk/host, NBinStyle(kk/host,
NBinKokkos<LMPHostType>, NBinKokkos<LMPHostType>,
NB_KOKKOS_HOST) NB_STANDARD | NB_KOKKOS_HOST)
NBinStyle(kk/device, NBinStyle(kk/device,
NBinKokkos<LMPDeviceType>, NBinKokkos<LMPDeviceType>,
NB_KOKKOS_DEVICE) NB_STANDARD | NB_KOKKOS_DEVICE)
#else #else

View File

@ -15,11 +15,11 @@
NBinStyle(ssa/kk/host, NBinStyle(ssa/kk/host,
NBinSSAKokkos<LMPHostType>, NBinSSAKokkos<LMPHostType>,
NB_SSA | NB_KOKKOS_HOST) NB_STANDARD | NB_SSA | NB_KOKKOS_HOST)
NBinStyle(ssa/kk/device, NBinStyle(ssa/kk/device,
NBinSSAKokkos<LMPDeviceType>, NBinSSAKokkos<LMPDeviceType>,
NB_SSA | NB_KOKKOS_DEVICE) NB_STANDARD | NB_SSA | NB_KOKKOS_DEVICE)
#else #else

View File

@ -15,7 +15,7 @@
NBinStyle(ssa, NBinStyle(ssa,
NBinSSA, NBinSSA,
NB_SSA) NB_STANDARD | NB_SSA)
#else #else

View File

@ -16,13 +16,13 @@
James Larentzos and Timothy I. Mattox (Engility Corporation) James Larentzos and Timothy I. Mattox (Engility Corporation)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "nstencil_half_bin_2d_newton_ssa.h" #include "nstencil_half_bin_2d_ssa.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NStencilHalfBin2dNewtonSSA::NStencilHalfBin2dNewtonSSA(LAMMPS *lmp) : NStencilHalfBin2dSSA::NStencilHalfBin2dSSA(LAMMPS *lmp) :
NStencilSSA(lmp) {} NStencilSSA(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -37,7 +37,7 @@ NStencilHalfBin2dNewtonSSA::NStencilHalfBin2dNewtonSSA(LAMMPS *lmp) :
to locate all the Active Interaction Region (AIR) ghosts for SSA to locate all the Active Interaction Region (AIR) ghosts for SSA
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NStencilHalfBin2dNewtonSSA::create() void NStencilHalfBin2dSSA::create()
{ {
int i,j,pos = 0; int i,j,pos = 0;
nstencil_ssa[0] = 0; // redundant info, but saves a conditional nstencil_ssa[0] = 0; // redundant info, but saves a conditional

View File

@ -13,23 +13,23 @@
#ifdef NSTENCIL_CLASS #ifdef NSTENCIL_CLASS
NStencilStyle(half/bin/2d/newton/ssa, NStencilStyle(half/bin/2d/ssa,
NStencilHalfBin2dNewtonSSA, NStencilHalfBin2dSSA,
NS_HALF | NS_BIN | NS_2D | NS_NEWTON | NS_SSA | NS_ORTHO | NS_GHOST) NS_HALF | NS_BIN | NS_2D | NS_SSA | NS_ORTHO | NS_GHOST)
#else #else
#ifndef LMP_NSTENCIL_HALF_BIN_2D_NEWTON_SSA_H #ifndef LMP_NSTENCIL_HALF_BIN_2D_SSA_H
#define LMP_NSTENCIL_HALF_BIN_2D_NEWTON_SSA_H #define LMP_NSTENCIL_HALF_BIN_2D_SSA_H
#include "nstencil_ssa.h" #include "nstencil_ssa.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class NStencilHalfBin2dNewtonSSA : public NStencilSSA { class NStencilHalfBin2dSSA : public NStencilSSA {
public: public:
NStencilHalfBin2dNewtonSSA(class LAMMPS *); NStencilHalfBin2dSSA(class LAMMPS *);
~NStencilHalfBin2dNewtonSSA() {} ~NStencilHalfBin2dSSA() {}
void create(); void create();
}; };

View File

@ -16,13 +16,13 @@
James Larentzos and Timothy I. Mattox (Engility Corporation) James Larentzos and Timothy I. Mattox (Engility Corporation)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "nstencil_half_bin_3d_newton_ssa.h" #include "nstencil_half_bin_3d_ssa.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NStencilHalfBin3dNewtonSSA::NStencilHalfBin3dNewtonSSA(LAMMPS *lmp) : NStencilHalfBin3dSSA::NStencilHalfBin3dSSA(LAMMPS *lmp) :
NStencilSSA(lmp) {} NStencilSSA(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -37,7 +37,7 @@ NStencilHalfBin3dNewtonSSA::NStencilHalfBin3dNewtonSSA(LAMMPS *lmp) :
to locate all the Active Interaction Region (AIR) ghosts for SSA to locate all the Active Interaction Region (AIR) ghosts for SSA
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NStencilHalfBin3dNewtonSSA::create() void NStencilHalfBin3dSSA::create()
{ {
int i,j,k,pos = 0; int i,j,k,pos = 0;
nstencil_ssa[0] = 0; // redundant info, but saves a conditional nstencil_ssa[0] = 0; // redundant info, but saves a conditional

View File

@ -13,23 +13,23 @@
#ifdef NSTENCIL_CLASS #ifdef NSTENCIL_CLASS
NStencilStyle(half/bin/3d/newton/ssa, NStencilStyle(half/bin/3d/ssa,
NStencilHalfBin3dNewtonSSA, NStencilHalfBin3dSSA,
NS_HALF | NS_BIN | NS_3D | NS_NEWTON | NS_SSA | NS_ORTHO | NS_GHOST) NS_HALF | NS_BIN | NS_3D | NS_SSA | NS_ORTHO | NS_GHOST)
#else #else
#ifndef LMP_NSTENCIL_HALF_BIN_3D_NEWTON_SSA_H #ifndef LMP_NSTENCIL_HALF_BIN_3D_SSA_H
#define LMP_NSTENCIL_HALF_BIN_3D_NEWTON_SSA_H #define LMP_NSTENCIL_HALF_BIN_3D_SSA_H
#include "nstencil_ssa.h" #include "nstencil_ssa.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class NStencilHalfBin3dNewtonSSA : public NStencilSSA { class NStencilHalfBin3dSSA : public NStencilSSA {
public: public:
NStencilHalfBin3dNewtonSSA(class LAMMPS *); NStencilHalfBin3dSSA(class LAMMPS *);
~NStencilHalfBin3dNewtonSSA() {} ~NStencilHalfBin3dSSA() {}
void create(); void create();
}; };

View File

@ -15,7 +15,7 @@
NBinStyle(intel, NBinStyle(intel,
NBinIntel, NBinIntel,
NB_INTEL) NB_STANDARD | NB_INTEL)
#else #else

View File

@ -0,0 +1,142 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "npair_full_multi_old_omp.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairFullMultiOldOmp::NPairFullMultiOldOmp(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction for all neighbors
multi-type stencil is itype dependent and is distance checked
every neighbor pair appears in list of both atoms i and j
------------------------------------------------------------------------- */
void NPairFullMultiOldOmp::build(NeighList *list)
{
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int molecular = atom->molecular;
const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0;
NPAIR_OMP_INIT;
#if defined(_OPENMP)
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(list)
#endif
NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom;
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
double *cutsq,*distsq;
// loop over each atom, storing neighbors
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
tagint *tag = atom->tag;
tagint *molecule = atom->molecule;
tagint **special = atom->special;
int **nspecial = atom->nspecial;
int *molindex = atom->molindex;
int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
// each thread has its own page allocator
MyPage<int> &ipage = list->ipage[tid];
ipage.reset();
for (i = ifrom; i < ito; i++) {
n = 0;
neighptr = ipage.vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
if (moltemplate) {
imol = molindex[i];
iatom = molatom[i];
tagprev = tag[i] - iatom - 1;
}
// loop over all atoms in other bins in stencil, including self
// skip if i,j neighbor cutoff is less than bin distance
// skip i = j
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (i == j) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >=0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
ilist[i] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage.vgot(n);
if (ipage.status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
NPAIR_OMP_CLOSE;
list->inum = nlocal;
list->gnum = 0;
}

View File

@ -11,26 +11,27 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef NSTENCIL_CLASS #ifdef NPAIR_CLASS
NStencilStyle(half/bin/2d/newtoff, NPairStyle(full/multi/old/omp,
NStencilHalfBin2dNewtoff, NPairFullMultiOldOmp,
NS_HALF | NS_BIN | NS_2D | NS_NEWTOFF | NS_ORTHO | NS_TRI) NP_FULL | NP_MULTI_OLD | NP_OMP |
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI)
#else #else
#ifndef LMP_NSTENCIL_HALF_BIN_2D_NEWTOFF_H #ifndef LMP_NPAIR_FULL_MULTI_OLD_OMP_H
#define LMP_NSTENCIL_HALF_BIN_2D_NEWTOFF_H #define LMP_NPAIR_FULL_MULTI_OLD_OMP_H
#include "nstencil.h" #include "npair.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class NStencilHalfBin2dNewtoff : public NStencil { class NPairFullMultiOldOmp : public NPair {
public: public:
NStencilHalfBin2dNewtoff(class LAMMPS *); NPairFullMultiOldOmp(class LAMMPS *);
~NStencilHalfBin2dNewtoff() {} ~NPairFullMultiOldOmp() {}
void create(); void build(class NeighList *);
}; };
} }

View File

@ -14,6 +14,7 @@
#include "omp_compat.h" #include "omp_compat.h"
#include "npair_full_multi_omp.h" #include "npair_full_multi_omp.h"
#include "npair_omp.h" #include "npair_omp.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
@ -30,7 +31,7 @@ NPairFullMultiOmp::NPairFullMultiOmp(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binned neighbor list construction for all neighbors binned neighbor list construction for all neighbors
multi-type stencil is itype dependent and is distance checked multi stencil is icollection-jcollection dependent
every neighbor pair appears in list of both atoms i and j every neighbor pair appears in list of both atoms i and j
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -46,14 +47,15 @@ void NPairFullMultiOmp::build(NeighList *list)
#endif #endif
NPAIR_OMP_SETUP(nlocal); NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom;
tagint tagprev; tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
// loop over each atom, storing neighbors // loop over each atom, storing neighbors
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -80,6 +82,7 @@ void NPairFullMultiOmp::build(NeighList *list)
neighptr = ipage.vget(); neighptr = ipage.vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
@ -89,43 +92,51 @@ void NPairFullMultiOmp::build(NeighList *list)
tagprev = tag[i] - iatom - 1; tagprev = tag[i] - iatom - 1;
} }
// loop over all atoms in other bins in stencil, including self
// skip if i,j neighbor cutoff is less than bin distance
// skip i = j
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (i == j) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if (icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { // loop over all atoms in surrounding bins in stencil including self
if (molecular != Atom::ATOMIC) { // skip i = j
if (!moltemplate) // use full stencil for all collection combinations
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >=0) s = stencil_multi[icollection][jcollection];
which = find_special(onemols[imol]->special[iatom], ns = nstencil_multi[icollection][jcollection];
onemols[imol]->nspecial[iatom],
tag[j]-tagprev); for (k = 0; k < ns; k++) {
else which = 0; js = binhead_multi[jcollection][jbin + s[k]];
if (which == 0) neighptr[n++] = j; for (j = js; j >= 0; j = bins[j]) {
else if (domain->minimum_image_check(delx,dely,delz)) if (i == j) continue;
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); jtype = type[j];
} else neighptr[n++] = j; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
}
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
} }
} }

View File

@ -14,6 +14,7 @@
#include "omp_compat.h" #include "omp_compat.h"
#include "npair_half_multi_newtoff_omp.h" #include "npair_half_multi_newtoff_omp.h"
#include "npair_omp.h" #include "npair_omp.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
@ -30,8 +31,8 @@ NPairHalfMultiNewtoffOmp::NPairHalfMultiNewtoffOmp(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binned neighbor list construction with partial Newton's 3rd law binned neighbor list construction with partial Newton's 3rd law
multi stencil is icollection-jcollection dependent
each owned atom i checks own bin and other bins in stencil each owned atom i checks own bin and other bins in stencil
multi-type stencil is itype dependent and is distance checked
pair stored once if i,j are both owned and i < j pair stored once if i,j are both owned and i < j
pair stored by me if j is ghost (also stored by proc owning j) pair stored by me if j is ghost (also stored by proc owning j)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -48,14 +49,15 @@ void NPairHalfMultiNewtoffOmp::build(NeighList *list)
#endif #endif
NPAIR_OMP_SETUP(nlocal); NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom;
tagint tagprev; tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
// loop over each atom, storing neighbors // loop over each atom, storing neighbors
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -82,6 +84,7 @@ void NPairHalfMultiNewtoffOmp::build(NeighList *list)
neighptr = ipage.vget(); neighptr = ipage.vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
@ -91,44 +94,52 @@ void NPairHalfMultiNewtoffOmp::build(NeighList *list)
tagprev = tag[i] - iatom - 1; tagprev = tag[i] - iatom - 1;
} }
// loop over all atoms in other bins in stencil including self
// only store pair if i < j
// skip if i,j neighbor cutoff is less than bin distance
// stores own/own pairs only once
// stores own/ghost pairs on both procs
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if (icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { // loop over all atoms in other bins in stencil including self
if (molecular != Atom::ATOMIC) { // only store pair if i < j
if (!moltemplate) // stores own/own pairs only once
which = find_special(special[i],nspecial[i],tag[j]); // stores own/ghost pairs on both procs
else if (imol >=0) // use full stencil for all collection combinations
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom], s = stencil_multi[icollection][jcollection];
tag[j]-tagprev); ns = nstencil_multi[icollection][jcollection];
else which = 0;
if (which == 0) neighptr[n++] = j; for (k = 0; k < ns; k++) {
else if (domain->minimum_image_check(delx,dely,delz)) js = binhead_multi[jcollection][jbin + s[k]];
neighptr[n++] = j; for (j = js; j >= 0; j = bins[j]) {
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); if (j <= i) continue;
} else neighptr[n++] = j;
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
} }
} }
} }

View File

@ -14,6 +14,7 @@
#include "omp_compat.h" #include "omp_compat.h"
#include "npair_half_multi_newton_omp.h" #include "npair_half_multi_newton_omp.h"
#include "npair_omp.h" #include "npair_omp.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
@ -30,8 +31,8 @@ NPairHalfMultiNewtonOmp::NPairHalfMultiNewtonOmp(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binned neighbor list construction with full Newton's 3rd law binned neighbor list construction with full Newton's 3rd law
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in Newton stencil each owned atom i checks its own bin and other bins in Newton stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor every pair stored exactly once by some processor
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -47,14 +48,15 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
#endif #endif
NPAIR_OMP_SETUP(nlocal); NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom;
tagint tagprev; tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
// loop over each atom, storing neighbors // loop over each atom, storing neighbors
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -81,6 +83,7 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
neighptr = ipage.vget(); neighptr = ipage.vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
@ -90,80 +93,103 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
tagprev = tag[i] - iatom - 1; tagprev = tag[i] - iatom - 1;
} }
// loop over rest of atoms in i's bin, ghosts are at end of linked list
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = bins[i]; j >= 0; j = bins[j]) {
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >=0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
// loop over all atoms in other bins in stencil, store every pair
// skip if i,j neighbor cutoff is less than bin distance
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if (icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { // if same size: uses half stencil so check central bin
if (molecular != Atom::ATOMIC) { if (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]); if (icollection == jcollection) js = bins[i];
else if (imol >=0) else js = binhead_multi[jcollection][jbin];
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom], // if same collection,
tag[j]-tagprev); // if j is owned atom, store it, since j is beyond i in linked list
else which = 0; // if j is ghost, only store if j coords are "above and to the right" of i
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz)) // if different collections,
neighptr[n++] = j; // if j is owned atom, store it if j > i
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); // if j is ghost, only store if j coords are "above and to the right" of i
} else neighptr[n++] = j;
} for (j = js; j >= 0; j = bins[j]) {
if ((icollection != jcollection) && (j < i)) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
} }
// for all collections, loop over all atoms in other bins in stencil, store every pair
// stencil is empty if i larger than j
// stencil is half if i same size as j
// stencil is full if i smaller than j
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
} }
ilist[i] = i; ilist[i] = i;

View File

@ -14,6 +14,7 @@
#include "omp_compat.h" #include "omp_compat.h"
#include "npair_half_multi_newton_tri_omp.h" #include "npair_half_multi_newton_tri_omp.h"
#include "npair_omp.h" #include "npair_omp.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
@ -31,8 +32,8 @@ NPairHalfMultiNewtonTriOmp::NPairHalfMultiNewtonTriOmp(LAMMPS *lmp) :
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binned neighbor list construction with Newton's 3rd law for triclinic binned neighbor list construction with Newton's 3rd law for triclinic
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in triclinic stencil each owned atom i checks its own bin and other bins in triclinic stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor every pair stored exactly once by some processor
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -48,14 +49,15 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list)
#endif #endif
NPAIR_OMP_SETUP(nlocal); NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom; int i,j,k,n,itype,jtype,ibin,jbin,icollection,jcollection,which,ns,imol,iatom;
tagint tagprev; tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
// loop over each atom, storing neighbors // loop over each atom, storing neighbors
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -82,6 +84,7 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list)
neighptr = ipage.vget(); neighptr = ipage.vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
@ -91,55 +94,68 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list)
tagprev = tag[i] - iatom - 1; tagprev = tag[i] - iatom - 1;
} }
// loop over all atoms in bins, including self, in stencil
// skip if i,j neighbor cutoff is less than bin distance
// bins below self are excluded from stencil
// pairs for atoms j "below" i are excluded
// below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype]; // loop through stencils for all collections
cutsq = cutneighsq[itype]; for (jcollection = 0; jcollection < ncollections; jcollection++) {
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) { // if same collection use own bin
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) { if (icollection == jcollection) jbin = ibin;
jtype = type[j]; else jbin = coord2bin(x[i], jcollection);
if (cutsq[jtype] < distsq[k]) continue;
if (x[j][2] < ztmp) continue; // loop over all atoms in bins in stencil
if (x[j][2] == ztmp) { // stencil is empty if i larger than j
if (x[j][1] < ytmp) continue; // stencil is half if i same size as j
if (x[j][1] == ytmp) { // stencil is full if i smaller than j
if (x[j][0] < xtmp) continue; // if half: pairs for atoms j "below" i are excluded
if (x[j][0] == xtmp && j <= i) continue; // below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
// if same size (same collection), use half stencil
if (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp) {
if (x[j][0] < xtmp) continue;
if (x[j][0] == xtmp && j <= i) continue;
}
}
} }
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0]; delx = xtmp - x[j][0];
dely = ytmp - x[j][1]; dely = ytmp - x[j][1];
delz = ztmp - x[j][2]; delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) { if (molecular != Atom::ATOMIC) {
if (!moltemplate) if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]); which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >=0) else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom], which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom], onemols[imol]->nspecial[iatom],
tag[j]-tagprev); tag[j]-tagprev);
else which = 0; else which = 0;
if (which == 0) neighptr[n++] = j; if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz)) else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j; neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j; } else neighptr[n++] = j;
} }
} }
}
} }
ilist[i] = i; ilist[i] = i;

View File

@ -0,0 +1,145 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "npair_half_multi_old_newtoff_omp.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfMultiOldNewtoffOmp::NPairHalfMultiOldNewtoffOmp(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with partial Newton's 3rd law
each owned atom i checks own bin and other bins in stencil
multi-type stencil is itype dependent and is distance checked
pair stored once if i,j are both owned and i < j
pair stored by me if j is ghost (also stored by proc owning j)
------------------------------------------------------------------------- */
void NPairHalfMultiOldNewtoffOmp::build(NeighList *list)
{
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int molecular = atom->molecular;
const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0;
NPAIR_OMP_INIT;
#if defined(_OPENMP)
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(list)
#endif
NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom;
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
double *cutsq,*distsq;
// loop over each atom, storing neighbors
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
tagint *tag = atom->tag;
tagint *molecule = atom->molecule;
tagint **special = atom->special;
int **nspecial = atom->nspecial;
int *molindex = atom->molindex;
int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
// each thread has its own page allocator
MyPage<int> &ipage = list->ipage[tid];
ipage.reset();
for (i = ifrom; i < ito; i++) {
n = 0;
neighptr = ipage.vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
if (moltemplate) {
imol = molindex[i];
iatom = molatom[i];
tagprev = tag[i] - iatom - 1;
}
// loop over all atoms in other bins in stencil including self
// only store pair if i < j
// skip if i,j neighbor cutoff is less than bin distance
// stores own/own pairs only once
// stores own/ghost pairs on both procs
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >=0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
ilist[i] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage.vgot(n);
if (ipage.status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
NPAIR_OMP_CLOSE;
list->inum = nlocal;
}

View File

@ -0,0 +1,43 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/multi/old/newtoff/omp,
NPairHalfMultiOldNewtoffOmp,
NP_HALF | NP_MULTI_OLD | NP_NEWTOFF | NP_OMP | NP_ORTHO | NP_TRI)
#else
#ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTOFF_OMP_H
#define LMP_NPAIR_HALF_MULTI_OLD_NEWTOFF_OMP_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfMultiOldNewtoffOmp : public NPair {
public:
NPairHalfMultiOldNewtoffOmp(class LAMMPS *);
~NPairHalfMultiOldNewtoffOmp() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/

View File

@ -0,0 +1,178 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "npair_half_multi_old_newton_omp.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfMultiOldNewtonOmp::NPairHalfMultiOldNewtonOmp(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with full Newton's 3rd law
each owned atom i checks its own bin and other bins in Newton stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor
------------------------------------------------------------------------- */
void NPairHalfMultiOldNewtonOmp::build(NeighList *list)
{
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int molecular = atom->molecular;
const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0;
NPAIR_OMP_INIT;
#if defined(_OPENMP)
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(list)
#endif
NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom;
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
double *cutsq,*distsq;
// loop over each atom, storing neighbors
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
tagint *tag = atom->tag;
tagint *molecule = atom->molecule;
tagint **special = atom->special;
int **nspecial = atom->nspecial;
int *molindex = atom->molindex;
int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
// each thread has its own page allocator
MyPage<int> &ipage = list->ipage[tid];
ipage.reset();
for (i = ifrom; i < ito; i++) {
n = 0;
neighptr = ipage.vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
if (moltemplate) {
imol = molindex[i];
iatom = molatom[i];
tagprev = tag[i] - iatom - 1;
}
// loop over rest of atoms in i's bin, ghosts are at end of linked list
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = bins[i]; j >= 0; j = bins[j]) {
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >=0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
// loop over all atoms in other bins in stencil, store every pair
// skip if i,j neighbor cutoff is less than bin distance
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >=0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
ilist[i] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage.vgot(n);
if (ipage.status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
NPAIR_OMP_CLOSE;
list->inum = nlocal;
}

View File

@ -11,26 +11,26 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef NSTENCIL_CLASS #ifdef NPAIR_CLASS
NStencilStyle(half/bin/2d/newton/tri, NPairStyle(half/multi/old/newton/omp,
NStencilHalfBin2dNewtonTri, NPairHalfMultiOldNewtonOmp,
NS_HALF | NS_BIN | NS_2D | NS_NEWTON | NS_TRI) NP_HALF | NP_MULTI_OLD | NP_NEWTON | NP_OMP | NP_ORTHO)
#else #else
#ifndef LMP_NSTENCIL_HALF_BIN_2D_NEWTON_TRI_H #ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTON_OMP_H
#define LMP_NSTENCIL_HALF_BIN_2D_NEWTON_TRI_H #define LMP_NPAIR_HALF_MULTI_OLD_NEWTON_OMP_H
#include "nstencil.h" #include "npair.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class NStencilHalfBin2dNewtonTri : public NStencil { class NPairHalfMultiOldNewtonOmp : public NPair {
public: public:
NStencilHalfBin2dNewtonTri(class LAMMPS *); NPairHalfMultiOldNewtonOmp(class LAMMPS *);
~NStencilHalfBin2dNewtonTri() {} ~NPairHalfMultiOldNewtonOmp() {}
void create(); void build(class NeighList *);
}; };
} }

View File

@ -0,0 +1,154 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "npair_half_multi_old_newton_tri_omp.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfMultiOldNewtonTriOmp::NPairHalfMultiOldNewtonTriOmp(LAMMPS *lmp) :
NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with Newton's 3rd law for triclinic
each owned atom i checks its own bin and other bins in triclinic stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor
------------------------------------------------------------------------- */
void NPairHalfMultiOldNewtonTriOmp::build(NeighList *list)
{
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int molecular = atom->molecular;
const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0;
NPAIR_OMP_INIT;
#if defined(_OPENMP)
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(list)
#endif
NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom;
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
double *cutsq,*distsq;
// loop over each atom, storing neighbors
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
tagint *tag = atom->tag;
tagint *molecule = atom->molecule;
tagint **special = atom->special;
int **nspecial = atom->nspecial;
int *molindex = atom->molindex;
int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
// each thread has its own page allocator
MyPage<int> &ipage = list->ipage[tid];
ipage.reset();
for (i = ifrom; i < ito; i++) {
n = 0;
neighptr = ipage.vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
if (moltemplate) {
imol = molindex[i];
iatom = molatom[i];
tagprev = tag[i] - iatom - 1;
}
// loop over all atoms in bins, including self, in stencil
// skip if i,j neighbor cutoff is less than bin distance
// bins below self are excluded from stencil
// pairs for atoms j "below" i are excluded
// below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp) {
if (x[j][0] < xtmp) continue;
if (x[j][0] == xtmp && j <= i) continue;
}
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >=0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
ilist[i] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage.vgot(n);
if (ipage.status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
NPAIR_OMP_CLOSE;
list->inum = nlocal;
}

View File

@ -0,0 +1,43 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/multi/old/newton/tri/omp,
NPairHalfMultiOldNewtonTriOmp,
NP_HALF | NP_MULTI_OLD | NP_NEWTON | NP_TRI | NP_OMP)
#else
#ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTON_TRI_OMP_H
#define LMP_NPAIR_HALF_MULTI_OLD_NEWTON_TRI_OMP_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfMultiOldNewtonTriOmp : public NPair {
public:
NPairHalfMultiOldNewtonTriOmp(class LAMMPS *);
~NPairHalfMultiOldNewtonTriOmp() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/

View File

@ -16,6 +16,7 @@
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include "my_page.h" #include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "npair_omp.h" #include "npair_omp.h"
@ -25,14 +26,13 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NPairHalfSizeMultiNewtoffOmp::NPairHalfSizeMultiNewtoffOmp(LAMMPS *lmp) : NPairHalfSizeMultiNewtoffOmp::NPairHalfSizeMultiNewtoffOmp(LAMMPS *lmp) : NPair(lmp) {}
NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
size particles size particles
binned neighbor list construction with partial Newton's 3rd law binned neighbor list construction with partial Newton's 3rd law
multi stencil is icollection-jcollection dependent
each owned atom i checks own bin and other bins in stencil each owned atom i checks own bin and other bins in stencil
multi-type stencil is itype dependent and is distance checked
pair stored once if i,j are both owned and i < j pair stored once if i,j are both owned and i < j
pair stored by me if j is ghost (also stored by proc owning j) pair stored by me if j is ghost (also stored by proc owning j)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -49,12 +49,15 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list)
#endif #endif
NPAIR_OMP_SETUP(nlocal); NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,ns; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq; double radi,radsum,cutdistsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
// loop over each atom, storing neighbors
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
double *radius = atom->radius; double *radius = atom->radius;
int *type = atom->type; int *type = atom->type;
@ -75,43 +78,52 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list)
neighptr = ipage.vget(); neighptr = ipage.vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
radi = radius[i]; radi = radius[i];
// loop over all atoms in other bins in stencil including self
// only store pair if i < j
// skip if i,j neighbor cutoff is less than bin distance
// stores own/own pairs only once
// stores own/ghost pairs on both procs
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if(icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) { // loop over all atoms in other bins in stencil including self
if (history && rsq < radsum*radsum) // only store pair if i < j
neighptr[n++] = j ^ mask_history; // stores own/own pairs only once
else // stores own/ghost pairs on both procs
neighptr[n++] = j; // use full stencil for all collection combinations
}
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >=0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
} }
} }

View File

@ -15,8 +15,7 @@
NPairStyle(half/size/multi/newtoff/omp, NPairStyle(half/size/multi/newtoff/omp,
NPairHalfSizeMultiNewtoffOmp, NPairHalfSizeMultiNewtoffOmp,
NP_HALF | NP_SIZE | NP_MULTI | NP_NEWTOFF | NP_OMP | NP_HALF | NP_SIZE | NP_MULTI | NP_NEWTOFF | NP_OMP | NP_ORTHO | NP_TRI)
NP_ORTHO | NP_TRI)
#else #else

View File

@ -16,6 +16,7 @@
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include "my_page.h" #include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "npair_omp.h" #include "npair_omp.h"
@ -25,14 +26,13 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
NPairHalfSizeMultiNewtonOmp::NPairHalfSizeMultiNewtonOmp(LAMMPS *lmp) : NPairHalfSizeMultiNewtonOmp::NPairHalfSizeMultiNewtonOmp(LAMMPS *lmp) : NPair(lmp) {}
NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
size particles size particles
binned neighbor list construction with full Newton's 3rd law binned neighbor list construction with full Newton's 3rd law
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in Newton stencil each owned atom i checks its own bin and other bins in Newton stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor every pair stored exactly once by some processor
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -48,12 +48,15 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
#endif #endif
NPAIR_OMP_SETUP(nlocal); NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,ns; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq; double radi,radsum,cutdistsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
// loop over each atom, storing neighbors
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
double *radius = atom->radius; double *radius = atom->radius;
int *type = atom->type; int *type = atom->type;
@ -74,70 +77,95 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
neighptr = ipage.vget(); neighptr = ipage.vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
radi = radius[i]; radi = radius[i];
// loop over rest of atoms in i's bin, ghosts are at end of linked list
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = bins[i]; j >= 0; j = bins[j]) {
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
// loop over all atoms in other bins in stencil, store every pair
// skip if i,j neighbor cutoff is less than bin distance
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if(icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) { // if same size: uses half stencil so check central bin
if (history && rsq < radsum*radsum) if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
neighptr[n++] = j ^ mask_history;
else if(icollection == jcollection) js = bins[i];
neighptr[n++] = j; else js = binhead_multi[jcollection][jbin];
// if same collection,
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
// if different collections,
// if j is owned atom, store it if j > i
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = js; j >= 0; j = bins[j]) {
if(icollection != jcollection and j < i) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
} }
} }
// for all collections, loop over all atoms in other bins in stencil, store every pair
// stencil is empty if i larger than j
// stencil is half if i same size as j
// stencil is full if i smaller than j
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
}
} }
ilist[i] = i; ilist[i] = i;

View File

@ -16,6 +16,7 @@
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include "my_page.h" #include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
#include "npair_omp.h" #include "npair_omp.h"
@ -31,8 +32,8 @@ NPairHalfSizeMultiNewtonTriOmp::NPairHalfSizeMultiNewtonTriOmp(LAMMPS *lmp) :
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
size particles size particles
binned neighbor list construction with Newton's 3rd law for triclinic binned neighbor list construction with Newton's 3rd law for triclinic
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in triclinic stencil each owned atom i checks its own bin and other bins in triclinic stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor every pair stored exactly once by some processor
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -48,12 +49,15 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
#endif #endif
NPAIR_OMP_SETUP(nlocal); NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,ns; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq; double radi,radsum,cutdistsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
// loop over each atom, storing neighbors
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
double *radius = atom->radius; double *radius = atom->radius;
int *type = atom->type; int *type = atom->type;
@ -74,53 +78,68 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
neighptr = ipage.vget(); neighptr = ipage.vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
radi = radius[i]; radi = radius[i];
// loop over all atoms in bins, including self, in stencil
// skip if i,j neighbor cutoff is less than bin distance
// bins below self are excluded from stencil
// pairs for atoms j "below" i are excluded
// below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype]; // loop through stencils for all collections
cutsq = cutneighsq[itype]; for (jcollection = 0; jcollection < ncollections; jcollection++) {
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) { // if same collection use own bin
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) { if(icollection == jcollection) jbin = ibin;
jtype = type[j]; else jbin = coord2bin(x[i], jcollection);
if (cutsq[jtype] < distsq[k]) continue;
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) { // loop over all atoms in bins in stencil
if (x[j][1] < ytmp) continue; // stencil is empty if i larger than j
if (x[j][1] == ytmp) { // stencil is half if i same size as j
if (x[j][0] < xtmp) continue; // stencil is full if i smaller than j
if (x[j][0] == xtmp && j <= i) continue; // if half: pairs for atoms j "below" i are excluded
// below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
// if same size (same collection), use half stencil
if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp) {
if (x[j][0] < xtmp) continue;
if (x[j][0] == xtmp && j <= i) continue;
}
}
} }
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0]; delx = xtmp - x[j][0];
dely = ytmp - x[j][1]; dely = ytmp - x[j][1];
delz = ztmp - x[j][2]; delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j]; radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin); cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) { if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum) if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history; neighptr[n++] = j ^ mask_history;
else else
neighptr[n++] = j; neighptr[n++] = j;
} }
} }
}
} }
ilist[i] = i; ilist[i] = i;

View File

@ -0,0 +1,126 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "npair_half_size_multi_old_newtoff_omp.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfSizeMultiOldNewtoffOmp::NPairHalfSizeMultiOldNewtoffOmp(LAMMPS *lmp) :
NPair(lmp) {}
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with partial Newton's 3rd law
each owned atom i checks own bin and other bins in stencil
multi-type stencil is itype dependent and is distance checked
pair stored once if i,j are both owned and i < j
pair stored by me if j is ghost (also stored by proc owning j)
------------------------------------------------------------------------- */
void NPairHalfSizeMultiOldNewtoffOmp::build(NeighList *list)
{
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int history = list->history;
const int mask_history = 3 << SBBITS;
NPAIR_OMP_INIT;
#if defined(_OPENMP)
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(list)
#endif
NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
double *radius = atom->radius;
int *type = atom->type;
int *mask = atom->mask;
tagint *molecule = atom->molecule;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
// each thread has its own page allocator
MyPage<int> &ipage = list->ipage[tid];
ipage.reset();
for (i = ifrom; i < ito; i++) {
n = 0;
neighptr = ipage.vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
radi = radius[i];
// loop over all atoms in other bins in stencil including self
// only store pair if i < j
// skip if i,j neighbor cutoff is less than bin distance
// stores own/own pairs only once
// stores own/ghost pairs on both procs
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
}
ilist[i] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage.vgot(n);
if (ipage.status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
NPAIR_OMP_CLOSE;
list->inum = nlocal;
}

View File

@ -0,0 +1,44 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/size/multi/old/newtoff/omp,
NPairHalfSizeMultiOldNewtoffOmp,
NP_HALF | NP_SIZE | NP_MULTI_OLD | NP_NEWTOFF | NP_OMP |
NP_ORTHO | NP_TRI)
#else
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTOFF_OMP_H
#define LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTOFF_OMP_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfSizeMultiOldNewtoffOmp : public NPair {
public:
NPairHalfSizeMultiOldNewtoffOmp(class LAMMPS *);
~NPairHalfSizeMultiOldNewtoffOmp() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/

View File

@ -0,0 +1,151 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "npair_half_size_multi_old_newton_omp.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfSizeMultiOldNewtonOmp::NPairHalfSizeMultiOldNewtonOmp(LAMMPS *lmp) :
NPair(lmp) {}
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with full Newton's 3rd law
each owned atom i checks its own bin and other bins in Newton stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor
------------------------------------------------------------------------- */
void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list)
{
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int history = list->history;
const int mask_history = 3 << SBBITS;
NPAIR_OMP_INIT;
#if defined(_OPENMP)
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(list)
#endif
NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
double *radius = atom->radius;
int *type = atom->type;
int *mask = atom->mask;
tagint *molecule = atom->molecule;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
// each thread has its own page allocator
MyPage<int> &ipage = list->ipage[tid];
ipage.reset();
for (i = ifrom; i < ito; i++) {
n = 0;
neighptr = ipage.vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
radi = radius[i];
// loop over rest of atoms in i's bin, ghosts are at end of linked list
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = bins[i]; j >= 0; j = bins[j]) {
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
// loop over all atoms in other bins in stencil, store every pair
// skip if i,j neighbor cutoff is less than bin distance
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
}
ilist[i] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage.vgot(n);
if (ipage.status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
NPAIR_OMP_CLOSE;
list->inum = nlocal;
}

View File

@ -0,0 +1,43 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/size/multi/old/newton/omp,
NPairHalfSizeMultiOldNewtonOmp,
NP_HALF | NP_SIZE | NP_MULTI_OLD | NP_NEWTON | NP_OMP | NP_ORTHO)
#else
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTON_OMP_H
#define LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTON_OMP_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfSizeMultiOldNewtonOmp : public NPair {
public:
NPairHalfSizeMultiOldNewtonOmp(class LAMMPS *);
~NPairHalfSizeMultiOldNewtonOmp() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/

View File

@ -0,0 +1,134 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "npair_half_size_multi_old_newton_tri_omp.h"
#include "npair_omp.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfSizeMultiOldNewtonTriOmp::NPairHalfSizeMultiOldNewtonTriOmp(LAMMPS *lmp) :
NPair(lmp) {}
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with Newton's 3rd law for triclinic
each owned atom i checks its own bin and other bins in triclinic stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor
------------------------------------------------------------------------- */
void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list)
{
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int history = list->history;
const int mask_history = 3 << SBBITS;
NPAIR_OMP_INIT;
#if defined(_OPENMP)
#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(list)
#endif
NPAIR_OMP_SETUP(nlocal);
int i,j,k,n,itype,jtype,ibin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
double *radius = atom->radius;
int *type = atom->type;
int *mask = atom->mask;
tagint *molecule = atom->molecule;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
// each thread has its own page allocator
MyPage<int> &ipage = list->ipage[tid];
ipage.reset();
for (i = ifrom; i < ito; i++) {
n = 0;
neighptr = ipage.vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
radi = radius[i];
// loop over all atoms in bins, including self, in stencil
// skip if i,j neighbor cutoff is less than bin distance
// bins below self are excluded from stencil
// pairs for atoms j "below" i are excluded
// below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp) {
if (x[j][0] < xtmp) continue;
if (x[j][0] == xtmp && j <= i) continue;
}
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
}
ilist[i] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage.vgot(n);
if (ipage.status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
NPAIR_OMP_CLOSE;
list->inum = nlocal;
}

View File

@ -0,0 +1,43 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/size/multi/old/newton/tri/omp,
NPairHalfSizeMultiOldNewtonTriOmp,
NP_HALF | NP_SIZE | NP_MULTI_OLD | NP_NEWTON | NP_TRI | NP_OMP)
#else
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTON_TRI_OMP_H
#define LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTON_TRI_OMP_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfSizeMultiOldNewtonTriOmp : public NPair {
public:
NPairHalfSizeMultiOldNewtonTriOmp(class LAMMPS *);
~NPairHalfSizeMultiOldNewtonTriOmp() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
*/

View File

@ -15,12 +15,12 @@
NPairStyle(halffull/newtoff/omp, NPairStyle(halffull/newtoff/omp,
NPairHalffullNewtoffOmp, NPairHalffullNewtoffOmp,
NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_HALF | NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF |
NP_ORTHO | NP_TRI |NP_OMP) NP_ORTHO | NP_TRI |NP_OMP)
NPairStyle(halffull/newtoff/skip/omp, NPairStyle(halffull/newtoff/skip/omp,
NPairHalffullNewtoffOmp, NPairHalffullNewtoffOmp,
NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_HALF | NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF |
NP_ORTHO | NP_TRI | NP_SKIP | NP_OMP) NP_ORTHO | NP_TRI | NP_SKIP | NP_OMP)
#else #else

View File

@ -15,12 +15,12 @@
NPairStyle(halffull/newton/omp, NPairStyle(halffull/newton/omp,
NPairHalffullNewtonOmp, NPairHalffullNewtonOmp,
NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
NP_ORTHO | NP_TRI| NP_OMP) NP_ORTHO | NP_TRI| NP_OMP)
NPairStyle(halffull/newton/skip/omp, NPairStyle(halffull/newton/skip/omp,
NPairHalffullNewtonOmp, NPairHalffullNewtonOmp,
NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
NP_ORTHO | NP_TRI | NP_SKIP | NP_OMP) NP_ORTHO | NP_TRI | NP_SKIP | NP_OMP)
#else #else

View File

@ -19,36 +19,36 @@
NPairStyle(skip/omp, NPairStyle(skip/omp,
NPairSkip, NPairSkip,
NP_SKIP | NP_HALF | NP_FULL | NP_SKIP | NP_HALF | NP_FULL |
NP_NSQ | NP_BIN | NP_MULTI | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP) NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP)
NPairStyle(skip/half/respa/omp, NPairStyle(skip/half/respa/omp,
NPairSkipRespa, NPairSkipRespa,
NP_SKIP | NP_RESPA | NP_HALF | NP_FULL | NP_SKIP | NP_RESPA | NP_HALF | NP_FULL |
NP_NSQ | NP_BIN | NP_MULTI | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP) NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP)
NPairStyle(skip/half/size/omp, NPairStyle(skip/half/size/omp,
NPairSkipSize, NPairSkipSize,
NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP) NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP)
NPairStyle(skip/size/off2on/omp, NPairStyle(skip/size/off2on/omp,
NPairSkipSizeOff2on, NPairSkipSizeOff2on,
NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF | NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF |
NP_NSQ | NP_BIN | NP_MULTI | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_MULTI_OLD |
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP) NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP)
NPairStyle(skip/size/off2on/oneside/omp, NPairStyle(skip/size/off2on/oneside/omp,
NPairSkipSizeOff2onOneside, NPairSkipSizeOff2onOneside,
NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF | NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF |
NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF |
NP_ORTHO | NP_TRI | NP_OMP) NP_ORTHO | NP_TRI | NP_OMP)
NPairStyle(skip/ghost/omp, NPairStyle(skip/ghost/omp,
NPairSkip, NPairSkip,
NP_SKIP | NP_HALF | NP_FULL | NP_SKIP | NP_HALF | NP_FULL |
NP_NSQ | NP_BIN | NP_MULTI | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP | NP_GHOST) NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP | NP_GHOST)
#endif #endif

View File

@ -35,7 +35,6 @@
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
#endif #endif
@ -58,6 +57,9 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
bordergroup = 0; bordergroup = 0;
cutghostuser = 0.0; cutghostuser = 0.0;
cutusermulti = nullptr; cutusermulti = nullptr;
cutusermultiold = nullptr;
ncollections = 0;
ncollections_cutoff = 0;
ghost_velocity = 0; ghost_velocity = 0;
user_procgrid[0] = user_procgrid[1] = user_procgrid[2] = 0; user_procgrid[0] = user_procgrid[1] = user_procgrid[2] = 0;
@ -76,6 +78,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
grid2proc = nullptr; grid2proc = nullptr;
xsplit = ysplit = zsplit = nullptr; xsplit = ysplit = zsplit = nullptr;
rcbnew = 0; rcbnew = 0;
multi_reduce = 0;
// use of OpenMP threads // use of OpenMP threads
// query OpenMP for number of threads/process set by user at run-time // query OpenMP for number of threads/process set by user at run-time
@ -117,6 +120,7 @@ Comm::~Comm()
memory->destroy(ysplit); memory->destroy(ysplit);
memory->destroy(zsplit); memory->destroy(zsplit);
memory->destroy(cutusermulti); memory->destroy(cutusermulti);
memory->destroy(cutusermultiold);
delete [] customfile; delete [] customfile;
delete [] outfile; delete [] outfile;
} }
@ -144,9 +148,16 @@ void Comm::copy_arrays(Comm *oldcomm)
memcpy(zsplit,oldcomm->zsplit,(procgrid[2]+1)*sizeof(double)); memcpy(zsplit,oldcomm->zsplit,(procgrid[2]+1)*sizeof(double));
} }
ncollections = oldcomm->ncollections;
ncollections_cutoff = oldcomm->ncollections_cutoff;
if (oldcomm->cutusermulti) { if (oldcomm->cutusermulti) {
memory->create(cutusermulti,atom->ntypes+1,"comm:cutusermulti"); memory->create(cutusermulti,ncollections_cutoff,"comm:cutusermulti");
memcpy(cutusermulti,oldcomm->cutusermulti,atom->ntypes+1); memcpy(cutusermulti,oldcomm->cutusermulti,ncollections_cutoff);
}
if (oldcomm->cutusermultiold) {
memory->create(cutusermultiold,atom->ntypes+1,"comm:cutusermultiold");
memcpy(cutusermultiold,oldcomm->cutusermultiold,atom->ntypes+1);
} }
if (customfile) if (customfile)
@ -235,6 +246,18 @@ void Comm::init()
maxexchange_fix_dynamic = 0; maxexchange_fix_dynamic = 0;
for (int i = 0; i < nfix; i++) for (int i = 0; i < nfix; i++)
if (fix[i]->maxexchange_dynamic) maxexchange_fix_dynamic = 1; if (fix[i]->maxexchange_dynamic) maxexchange_fix_dynamic = 1;
if ((mode == Comm::MULTI) && (neighbor->style != Neighbor::MULTI))
error->all(FLERR,"Cannot use comm mode multi without multi-style neighbor lists");
if (multi_reduce) {
if (force->newton == 0)
error->all(FLERR,"Cannot use multi/reduce communication with Newton off");
if (neighbor->any_full())
error->all(FLERR,"Cannot use multi/reduce communication with a full neighbor list");
if (mode != Comm::MULTI)
error->all(FLERR,"Cannot use multi/reduce communication without mode multi");
}
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -270,13 +293,26 @@ void Comm::modify_params(int narg, char **arg)
if (strcmp(arg[iarg+1],"single") == 0) { if (strcmp(arg[iarg+1],"single") == 0) {
// need to reset cutghostuser when switching comm mode // need to reset cutghostuser when switching comm mode
if (mode == Comm::MULTI) cutghostuser = 0.0; if (mode == Comm::MULTI) cutghostuser = 0.0;
if (mode == Comm::MULTIOLD) cutghostuser = 0.0;
memory->destroy(cutusermulti); memory->destroy(cutusermulti);
cutusermulti = nullptr; memory->destroy(cutusermultiold);
mode = Comm::SINGLE; mode = Comm::SINGLE;
} else if (strcmp(arg[iarg+1],"multi") == 0) { } else if (strcmp(arg[iarg+1],"multi") == 0) {
if (neighbor->style != Neighbor::MULTI)
error->all(FLERR,"Cannot use comm mode 'multi' without 'multi' style neighbor lists");
// need to reset cutghostuser when switching comm mode // need to reset cutghostuser when switching comm mode
if (mode == Comm::SINGLE) cutghostuser = 0.0; if (mode == Comm::SINGLE) cutghostuser = 0.0;
if (mode == Comm::MULTIOLD) cutghostuser = 0.0;
memory->destroy(cutusermultiold);
mode = Comm::MULTI; mode = Comm::MULTI;
} else if (strcmp(arg[iarg+1],"multi/old") == 0) {
if (neighbor->style == Neighbor::MULTI)
error->all(FLERR,"Cannot use comm mode 'multi/old' with 'multi' style neighbor lists");
// need to reset cutghostuser when switching comm mode
if (mode == Comm::SINGLE) cutghostuser = 0.0;
if (mode == Comm::MULTI) cutghostuser = 0.0;
memory->destroy(cutusermulti);
mode = Comm::MULTIOLD;
} else error->all(FLERR,"Illegal comm_modify command"); } else error->all(FLERR,"Illegal comm_modify command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"group") == 0) { } else if (strcmp(arg[iarg],"group") == 0) {
@ -291,8 +327,9 @@ void Comm::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg],"cutoff") == 0) { } else if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
if (mode == Comm::MULTI) if (mode == Comm::MULTI)
error->all(FLERR, error->all(FLERR, "Use cutoff/multi keyword to set cutoff in multi mode");
"Use cutoff/multi keyword to set cutoff in multi mode"); if (mode == Comm::MULTIOLD)
error->all(FLERR, "Use cutoff/multi/old keyword to set cutoff in multi mode");
cutghostuser = utils::numeric(FLERR,arg[iarg+1],false,lmp); cutghostuser = utils::numeric(FLERR,arg[iarg+1],false,lmp);
if (cutghostuser < 0.0) if (cutghostuser < 0.0)
error->all(FLERR,"Invalid cutoff in comm_modify command"); error->all(FLERR,"Invalid cutoff in comm_modify command");
@ -302,16 +339,45 @@ void Comm::modify_params(int narg, char **arg)
double cut; double cut;
if (mode == Comm::SINGLE) if (mode == Comm::SINGLE)
error->all(FLERR,"Use cutoff keyword to set cutoff in single mode"); error->all(FLERR,"Use cutoff keyword to set cutoff in single mode");
if (mode == Comm::MULTIOLD)
error->all(FLERR,"Use cutoff/multi/old keyword to set cutoff in multi/old mode");
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR, error->all(FLERR, "Cannot set cutoff/multi before simulation box is defined");
"Cannot set cutoff/multi before simulation box is defined");
// Check if # of collections has changed, if so erase any previously defined cutoffs
// Neighbor will reset ncollections if collections are redefined
if (! cutusermulti || ncollections_cutoff != neighbor->ncollections) {
ncollections_cutoff = neighbor->ncollections;
memory->destroy(cutusermulti);
memory->create(cutusermulti,ncollections_cutoff,"comm:cutusermulti");
for (i=0; i < ncollections_cutoff; ++i)
cutusermulti[i] = -1.0;
}
utils::bounds(FLERR,arg[iarg+1],1,ncollections_cutoff,nlo,nhi,error);
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
cutghostuser = MAX(cutghostuser,cut);
if (cut < 0.0)
error->all(FLERR,"Invalid cutoff in comm_modify command");
// collections use 1-based indexing externally and 0-based indexing internally
for (i=nlo; i<=nhi; ++i)
cutusermulti[i-1] = cut;
iarg += 3;
} else if (strcmp(arg[iarg],"cutoff/multi/old") == 0) {
int i,nlo,nhi;
double cut;
if (mode == Comm::SINGLE)
error->all(FLERR,"Use cutoff keyword to set cutoff in single mode");
if (mode == Comm::MULTI)
error->all(FLERR,"Use cutoff/multi keyword to set cutoff in multi mode");
if (domain->box_exist == 0)
error->all(FLERR, "Cannot set cutoff/multi before simulation box is defined");
const int ntypes = atom->ntypes; const int ntypes = atom->ntypes;
if (iarg+3 > narg) if (iarg+3 > narg)
error->all(FLERR,"Illegal comm_modify command"); error->all(FLERR,"Illegal comm_modify command");
if (cutusermulti == nullptr) { if (cutusermultiold == nullptr) {
memory->create(cutusermulti,ntypes+1,"comm:cutusermulti"); memory->create(cutusermultiold,ntypes+1,"comm:cutusermultiold");
for (i=0; i < ntypes+1; ++i) for (i=0; i < ntypes+1; ++i)
cutusermulti[i] = -1.0; cutusermultiold[i] = -1.0;
} }
utils::bounds(FLERR,arg[iarg+1],1,ntypes,nlo,nhi,error); utils::bounds(FLERR,arg[iarg+1],1,ntypes,nlo,nhi,error);
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp); cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
@ -319,8 +385,13 @@ void Comm::modify_params(int narg, char **arg)
if (cut < 0.0) if (cut < 0.0)
error->all(FLERR,"Invalid cutoff in comm_modify command"); error->all(FLERR,"Invalid cutoff in comm_modify command");
for (i=nlo; i<=nhi; ++i) for (i=nlo; i<=nhi; ++i)
cutusermulti[i] = cut; cutusermultiold[i] = cut;
iarg += 3; iarg += 3;
} else if (strcmp(arg[iarg],"reduce/multi") == 0) {
if (mode == Comm::SINGLE)
error->all(FLERR,"Use reduce/multi in mode multi only");
multi_reduce = 1;
iarg += 1;
} else if (strcmp(arg[iarg],"vel") == 0) { } else if (strcmp(arg[iarg],"vel") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal comm_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) ghost_velocity = 1; if (strcmp(arg[iarg+1],"yes") == 0) ghost_velocity = 1;
@ -667,6 +738,13 @@ double Comm::get_comm_cutoff()
error->warning(FLERR,"Communication cutoff adjusted to {}",maxcommcutoff); error->warning(FLERR,"Communication cutoff adjusted to {}",maxcommcutoff);
} }
// Check maximum interval size for neighbor multi
if (neighbor->interval_collection_flag) {
for (int i = 0; i < neighbor->ncollections; i++){
maxcommcutoff = MAX(maxcommcutoff, neighbor->collection2cut[i]);
}
}
return maxcommcutoff; return maxcommcutoff;
} }

View File

@ -25,14 +25,17 @@ class Comm : protected Pointers {
// LAYOUT_NONUNIFORM = logical bricks, but diff sizes via LB // LAYOUT_NONUNIFORM = logical bricks, but diff sizes via LB
// LAYOUT_TILED = general tiling, due to RCB LB // LAYOUT_TILED = general tiling, due to RCB LB
enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED}; enum{LAYOUT_UNIFORM,LAYOUT_NONUNIFORM,LAYOUT_TILED};
int mode; // 0 = single cutoff, 1 = multi-type cutoff int mode; // 0 = single cutoff, 1 = multi-collection cutoff, 2 = multiold-type cutoff
enum{SINGLE,MULTI}; enum{SINGLE,MULTI,MULTIOLD};
int me,nprocs; // proc info int me,nprocs; // proc info
int ghost_velocity; // 1 if ghost atoms have velocity, 0 if not int ghost_velocity; // 1 if ghost atoms have velocity, 0 if not
double cutghost[3]; // cutoffs used for acquiring ghost atoms double cutghost[3]; // cutoffs used for acquiring ghost atoms
double cutghostuser; // user-specified ghost cutoff (mode == 0) double cutghostuser; // user-specified ghost cutoff (mode == SINGLE)
double *cutusermulti; // per type user ghost cutoff (mode == 1) double *cutusermulti; // per collection user ghost cutoff (mode == MULTI)
double *cutusermultiold; // per type user ghost cutoff (mode == MULTIOLD)
int ncollections; // # of collections known by comm, used to test if # has changed
int ncollections_cutoff; // # of collections stored b cutoff/multi
int recv_from_partition; // recv proc layout from this partition int recv_from_partition; // recv proc layout from this partition
int send_to_partition; // send my proc layout to this partition int send_to_partition; // send my proc layout to this partition
// -1 if no recv or send // -1 if no recv or send
@ -149,6 +152,7 @@ class Comm : protected Pointers {
int ncores; // # of cores per node int ncores; // # of cores per node
int coregrid[3]; // 3d grid of cores within a node int coregrid[3]; // 3d grid of cores within a node
int user_coregrid[3]; // user request for cores in each dim int user_coregrid[3]; // user request for cores in each dim
int multi_reduce; // 1 if multi cutoff is intra-collection cutoff
void init_exchange(); void init_exchange();
int rendezvous_irregular(int, char *, int, int, int *, int rendezvous_irregular(int, char *, int, int, int *,
@ -195,6 +199,10 @@ E: Use cutoff keyword to set cutoff in single mode
Mode is single so cutoff/multi keyword cannot be used. Mode is single so cutoff/multi keyword cannot be used.
E: Use cutoff/bytype in mode multi only
Mode is single so cutoff/bytype keyword cannot be used.
E: Cannot set cutoff/multi before simulation box is defined E: Cannot set cutoff/multi before simulation box is defined
Self-explanatory. Self-explanatory.
@ -239,6 +247,10 @@ E: Processor count in z must be 1 for 2d simulation
Self-explanatory. Self-explanatory.
E: Cannot use multi/tiered communication with Newton off
Self-explanatory.
E: Cannot put data on ring from nullptr pointer E: Cannot put data on ring from nullptr pointer
W: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. W: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost.

View File

@ -30,6 +30,7 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <vector>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -42,12 +43,11 @@ using namespace LAMMPS_NS;
CommBrick::CommBrick(LAMMPS *lmp) : CommBrick::CommBrick(LAMMPS *lmp) :
Comm(lmp), Comm(lmp),
sendnum(nullptr), recvnum(nullptr), sendproc(nullptr), recvproc(nullptr), sendnum(nullptr), recvnum(nullptr), sendproc(nullptr), recvproc(nullptr),
size_forward_recv(nullptr), size_forward_recv(nullptr), size_reverse_send(nullptr), size_reverse_recv(nullptr),
size_reverse_send(nullptr), size_reverse_recv(nullptr),
slablo(nullptr), slabhi(nullptr), multilo(nullptr), multihi(nullptr), slablo(nullptr), slabhi(nullptr), multilo(nullptr), multihi(nullptr),
cutghostmulti(nullptr), pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr), multioldlo(nullptr), multioldhi(nullptr), cutghostmulti(nullptr), cutghostmultiold(nullptr),
sendlist(nullptr), localsendlist(nullptr), maxsendlist(nullptr), pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr), sendlist(nullptr),
buf_send(nullptr), buf_recv(nullptr) localsendlist(nullptr), maxsendlist(nullptr), buf_send(nullptr), buf_recv(nullptr)
{ {
style = 0; style = 0;
layout = Comm::LAYOUT_UNIFORM; layout = Comm::LAYOUT_UNIFORM;
@ -65,6 +65,11 @@ CommBrick::~CommBrick()
memory->destroy(cutghostmulti); memory->destroy(cutghostmulti);
} }
if (mode == Comm::MULTIOLD) {
free_multiold();
memory->destroy(cutghostmultiold);
}
if (sendlist) for (int i = 0; i < maxswap; i++) memory->destroy(sendlist[i]); if (sendlist) for (int i = 0; i < maxswap; i++) memory->destroy(sendlist[i]);
if (localsendlist) memory->destroy(localsendlist); if (localsendlist) memory->destroy(localsendlist);
memory->sfree(sendlist); memory->sfree(sendlist);
@ -101,6 +106,9 @@ void CommBrick::init_buffers()
multilo = multihi = nullptr; multilo = multihi = nullptr;
cutghostmulti = nullptr; cutghostmulti = nullptr;
multioldlo = multioldhi = nullptr;
cutghostmultiold = nullptr;
buf_send = buf_recv = nullptr; buf_send = buf_recv = nullptr;
maxsend = maxrecv = BUFMIN; maxsend = maxrecv = BUFMIN;
grow_send(maxsend,2); grow_send(maxsend,2);
@ -128,23 +136,55 @@ void CommBrick::init()
init_exchange(); init_exchange();
if (bufextra > bufextra_old) grow_send(maxsend+bufextra,2); if (bufextra > bufextra_old) grow_send(maxsend+bufextra,2);
// memory for multi-style communication // memory for multi style communication
// allocate in setup
if (mode == Comm::MULTI && multilo == nullptr) { if (mode == Comm::MULTI) {
allocate_multi(maxswap); // If inconsitent # of collections, destroy any preexisting arrays (may be missized)
memory->create(cutghostmulti,atom->ntypes+1,3,"comm:cutghostmulti"); if (ncollections != neighbor->ncollections) {
ncollections = neighbor->ncollections;
if (multilo != nullptr) {
free_multi();
memory->destroy(cutghostmulti);
}
}
// delete any old user cutoffs if # of collections chanaged
if (cutusermulti && ncollections != ncollections_cutoff) {
if(me == 0) error->warning(FLERR, "cutoff/multi settings discarded, must be defined"
" after customizing collections in neigh_modify");
memory->destroy(cutusermulti);
cutusermulti = nullptr;
}
if (multilo == nullptr) {
allocate_multi(maxswap);
memory->create(cutghostmulti,ncollections,3,"comm:cutghostmulti");
}
} }
if (mode == Comm::SINGLE && multilo) { if ((mode == Comm::SINGLE || mode == Comm::MULTIOLD) && multilo) {
free_multi(); free_multi();
memory->destroy(cutghostmulti); memory->destroy(cutghostmulti);
} }
// memory for multi/old-style communication
if (mode == Comm::MULTIOLD && multioldlo == nullptr) {
allocate_multiold(maxswap);
memory->create(cutghostmultiold,atom->ntypes+1,3,"comm:cutghostmultiold");
}
if ((mode == Comm::SINGLE || mode == Comm::MULTI) && multioldlo) {
free_multiold();
memory->destroy(cutghostmultiold);
}
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
setup spatial-decomposition communication patterns setup spatial-decomposition communication patterns
function of neighbor cutoff(s) & cutghostuser & current box size function of neighbor cutoff(s) & cutghostuser & current box size
single mode sets slab boundaries (slablo,slabhi) based on max cutoff single mode sets slab boundaries (slablo,slabhi) based on max cutoff
multi mode sets type-dependent slab boundaries (multilo,multihi) multi mode sets collection-dependent slab boundaries (multilo,multihi)
multi/old mode sets type-dependent slab boundaries (multioldlo,multioldhi)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void CommBrick::setup() void CommBrick::setup()
@ -156,9 +196,11 @@ void CommBrick::setup()
// neigh->cutghost = distance between tilted planes in box coords // neigh->cutghost = distance between tilted planes in box coords
// cutghost is in lamda coords = distance between those planes // cutghost is in lamda coords = distance between those planes
// for multi: // for multi:
// cutghostmulti = same as cutghost, only for each atom type // cutghostmulti = same as cutghost, only for each atom collection
// for multi/old:
// cutghostmultiold = same as cutghost, only for each atom type
int i; int i,j;
int ntypes = atom->ntypes; int ntypes = atom->ntypes;
double *prd,*sublo,*subhi; double *prd,*sublo,*subhi;
@ -167,23 +209,51 @@ void CommBrick::setup()
error->warning(FLERR,"Communication cutoff is 0.0. No ghost atoms " error->warning(FLERR,"Communication cutoff is 0.0. No ghost atoms "
"will be generated. Atoms may get lost."); "will be generated. Atoms may get lost.");
if (mode == Comm::MULTI) {
double **cutcollectionsq = neighbor->cutcollectionsq;
// build collection array for atom exchange
neighbor->build_collection(0);
// If using multi/reduce, communicate particles a distance equal
// to the max cutoff with equally sized or smaller collections
// If not, communicate the maximum cutoff of the entire collection
for (i = 0; i < ncollections; i++) {
if (cutusermulti) {
cutghostmulti[i][0] = cutusermulti[i];
cutghostmulti[i][1] = cutusermulti[i];
cutghostmulti[i][2] = cutusermulti[i];
} else {
cutghostmulti[i][0] = 0.0;
cutghostmulti[i][1] = 0.0;
cutghostmulti[i][2] = 0.0;
}
for (j = 0; j < ncollections; j++){
if (multi_reduce && (cutcollectionsq[j][j] > cutcollectionsq[i][i])) continue;
cutghostmulti[i][0] = MAX(cutghostmulti[i][0],sqrt(cutcollectionsq[i][j]));
cutghostmulti[i][1] = MAX(cutghostmulti[i][1],sqrt(cutcollectionsq[i][j]));
cutghostmulti[i][2] = MAX(cutghostmulti[i][2],sqrt(cutcollectionsq[i][j]));
}
}
}
if (mode == Comm::MULTIOLD) {
double *cuttype = neighbor->cuttype;
for (i = 1; i <= ntypes; i++) {
double tmp = 0.0;
if (cutusermultiold) tmp = cutusermultiold[i];
cutghostmultiold[i][0] = MAX(tmp,cuttype[i]);
cutghostmultiold[i][1] = MAX(tmp,cuttype[i]);
cutghostmultiold[i][2] = MAX(tmp,cuttype[i]);
}
}
if (triclinic == 0) { if (triclinic == 0) {
prd = domain->prd; prd = domain->prd;
sublo = domain->sublo; sublo = domain->sublo;
subhi = domain->subhi; subhi = domain->subhi;
cutghost[0] = cutghost[1] = cutghost[2] = cut; cutghost[0] = cutghost[1] = cutghost[2] = cut;
if (mode == Comm::MULTI) {
double *cuttype = neighbor->cuttype;
for (i = 1; i <= ntypes; i++) {
cut = 0.0;
if (cutusermulti) cut = cutusermulti[i];
cutghostmulti[i][0] = MAX(cut,cuttype[i]);
cutghostmulti[i][1] = MAX(cut,cuttype[i]);
cutghostmulti[i][2] = MAX(cut,cuttype[i]);
}
}
} else { } else {
prd = domain->prd_lamda; prd = domain->prd_lamda;
sublo = domain->sublo_lamda; sublo = domain->sublo_lamda;
@ -196,15 +266,19 @@ void CommBrick::setup()
cutghost[1] = cut * length1; cutghost[1] = cut * length1;
length2 = h_inv[2]; length2 = h_inv[2];
cutghost[2] = cut * length2; cutghost[2] = cut * length2;
if (mode == Comm::MULTI) { if (mode == Comm::MULTI) {
double *cuttype = neighbor->cuttype; for (i = 0; i < ncollections; i++) {
cutghostmulti[i][0] *= length0;
cutghostmulti[i][1] *= length1;
cutghostmulti[i][2] *= length2;
}
}
if (mode == Comm::MULTIOLD) {
for (i = 1; i <= ntypes; i++) { for (i = 1; i <= ntypes; i++) {
cut = 0.0; cutghostmultiold[i][0] *= length0;
if (cutusermulti) cut = cutusermulti[i]; cutghostmultiold[i][1] *= length1;
cutghostmulti[i][0] = length0 * MAX(cut,cuttype[i]); cutghostmultiold[i][2] *= length2;
cutghostmulti[i][1] = length1 * MAX(cut,cuttype[i]);
cutghostmulti[i][2] = length2 * MAX(cut,cuttype[i]);
} }
} }
} }
@ -350,12 +424,18 @@ void CommBrick::setup()
if (ineed < 2) slablo[iswap] = -BIG; if (ineed < 2) slablo[iswap] = -BIG;
else slablo[iswap] = 0.5 * (sublo[dim] + subhi[dim]); else slablo[iswap] = 0.5 * (sublo[dim] + subhi[dim]);
slabhi[iswap] = sublo[dim] + cutghost[dim]; slabhi[iswap] = sublo[dim] + cutghost[dim];
} else { } else if (mode == Comm::MULTI) {
for (i = 1; i <= ntypes; i++) { for (i = 0; i < ncollections; i++) {
if (ineed < 2) multilo[iswap][i] = -BIG; if (ineed < 2) multilo[iswap][i] = -BIG;
else multilo[iswap][i] = 0.5 * (sublo[dim] + subhi[dim]); else multilo[iswap][i] = 0.5 * (sublo[dim] + subhi[dim]);
multihi[iswap][i] = sublo[dim] + cutghostmulti[i][dim]; multihi[iswap][i] = sublo[dim] + cutghostmulti[i][dim];
} }
} else {
for (i = 1; i <= ntypes; i++) {
if (ineed < 2) multioldlo[iswap][i] = -BIG;
else multioldlo[iswap][i] = 0.5 * (sublo[dim] + subhi[dim]);
multioldhi[iswap][i] = sublo[dim] + cutghostmultiold[i][dim];
}
} }
if (myloc[dim] == 0) { if (myloc[dim] == 0) {
pbc_flag[iswap] = 1; pbc_flag[iswap] = 1;
@ -373,12 +453,18 @@ void CommBrick::setup()
slablo[iswap] = subhi[dim] - cutghost[dim]; slablo[iswap] = subhi[dim] - cutghost[dim];
if (ineed < 2) slabhi[iswap] = BIG; if (ineed < 2) slabhi[iswap] = BIG;
else slabhi[iswap] = 0.5 * (sublo[dim] + subhi[dim]); else slabhi[iswap] = 0.5 * (sublo[dim] + subhi[dim]);
} else { } else if (mode == Comm::MULTI) {
for (i = 1; i <= ntypes; i++) { for (i = 0; i < ncollections; i++) {
multilo[iswap][i] = subhi[dim] - cutghostmulti[i][dim]; multilo[iswap][i] = subhi[dim] - cutghostmulti[i][dim];
if (ineed < 2) multihi[iswap][i] = BIG; if (ineed < 2) multihi[iswap][i] = BIG;
else multihi[iswap][i] = 0.5 * (sublo[dim] + subhi[dim]); else multihi[iswap][i] = 0.5 * (sublo[dim] + subhi[dim]);
} }
} else {
for (i = 1; i <= ntypes; i++) {
multioldlo[iswap][i] = subhi[dim] - cutghostmultiold[i][dim];
if (ineed < 2) multioldhi[iswap][i] = BIG;
else multioldhi[iswap][i] = 0.5 * (sublo[dim] + subhi[dim]);
}
} }
if (myloc[dim] == procgrid[dim]-1) { if (myloc[dim] == procgrid[dim]-1) {
pbc_flag[iswap] = 1; pbc_flag[iswap] = 1;
@ -699,15 +785,19 @@ void CommBrick::exchange()
void CommBrick::borders() void CommBrick::borders()
{ {
int i,n,itype,iswap,dim,ineed,twoneed; int i,n,itype,icollection,iswap,dim,ineed,twoneed;
int nsend,nrecv,sendflag,nfirst,nlast,ngroup; int nsend,nrecv,sendflag,nfirst,nlast,ngroup,nprior;
double lo,hi; double lo,hi;
int *type; int *type;
int *collection;
double **x; double **x;
double *buf,*mlo,*mhi; double *buf,*mlo,*mhi;
MPI_Request request; MPI_Request request;
AtomVec *avec = atom->avec; AtomVec *avec = atom->avec;
// After exchanging/sorting, need to reconstruct collection array for border communication
if (mode == Comm::MULTI) neighbor->build_collection(0);
// do swaps over all 3 dimensions // do swaps over all 3 dimensions
iswap = 0; iswap = 0;
@ -728,10 +818,14 @@ void CommBrick::borders()
if (mode == Comm::SINGLE) { if (mode == Comm::SINGLE) {
lo = slablo[iswap]; lo = slablo[iswap];
hi = slabhi[iswap]; hi = slabhi[iswap];
} else { } else if (mode == Comm::MULTI) {
type = atom->type; collection = neighbor->collection;
mlo = multilo[iswap]; mlo = multilo[iswap];
mhi = multihi[iswap]; mhi = multihi[iswap];
} else {
type = atom->type;
mlo = multioldlo[iswap];
mhi = multioldhi[iswap];
} }
if (ineed % 2 == 0) { if (ineed % 2 == 0) {
nfirst = nlast; nfirst = nlast;
@ -760,6 +854,14 @@ void CommBrick::borders()
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend); if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
sendlist[iswap][nsend++] = i; sendlist[iswap][nsend++] = i;
} }
} else if (mode == Comm::MULTI) {
for (i = nfirst; i < nlast; i++) {
icollection = collection[i];
if (x[i][dim] >= mlo[icollection] && x[i][dim] <= mhi[icollection]) {
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
sendlist[iswap][nsend++] = i;
}
}
} else { } else {
for (i = nfirst; i < nlast; i++) { for (i = nfirst; i < nlast; i++) {
itype = type[i]; itype = type[i];
@ -783,6 +885,22 @@ void CommBrick::borders()
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend); if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
sendlist[iswap][nsend++] = i; sendlist[iswap][nsend++] = i;
} }
} else if (mode == Comm::MULTI) {
ngroup = atom->nfirst;
for (i = 0; i < ngroup; i++) {
icollection = collection[i];
if (x[i][dim] >= mlo[icollection] && x[i][dim] <= mhi[icollection]) {
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
sendlist[iswap][nsend++] = i;
}
}
for (i = atom->nlocal; i < nlast; i++) {
icollection = collection[i];
if (x[i][dim] >= mlo[icollection] && x[i][dim] <= mhi[icollection]) {
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
sendlist[iswap][nsend++] = i;
}
}
} else { } else {
ngroup = atom->nfirst; ngroup = atom->nfirst;
for (i = 0; i < ngroup; i++) { for (i = 0; i < ngroup; i++) {
@ -850,7 +968,10 @@ void CommBrick::borders()
size_reverse_send[iswap] = nrecv*size_reverse; size_reverse_send[iswap] = nrecv*size_reverse;
size_reverse_recv[iswap] = nsend*size_reverse; size_reverse_recv[iswap] = nsend*size_reverse;
firstrecv[iswap] = atom->nlocal + atom->nghost; firstrecv[iswap] = atom->nlocal + atom->nghost;
nprior = atom->nlocal + atom->nghost;
atom->nghost += nrecv; atom->nghost += nrecv;
if (neighbor->style == Neighbor::MULTI) neighbor->build_collection(nprior);
iswap++; iswap++;
} }
} }
@ -1403,6 +1524,12 @@ void CommBrick::grow_swap(int n)
allocate_multi(n); allocate_multi(n);
} }
if (mode == Comm::MULTIOLD) {
free_multiold();
allocate_multiold(n);
}
sendlist = (int **) sendlist = (int **)
memory->srealloc(sendlist,n*sizeof(int *),"comm:sendlist"); memory->srealloc(sendlist,n*sizeof(int *),"comm:sendlist");
memory->grow(maxsendlist,n,"comm:maxsendlist"); memory->grow(maxsendlist,n,"comm:maxsendlist");
@ -1434,15 +1561,26 @@ void CommBrick::allocate_swap(int n)
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
allocation of multi-type swap info allocation of multi-collection swap info
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void CommBrick::allocate_multi(int n) void CommBrick::allocate_multi(int n)
{ {
multilo = memory->create(multilo,n,atom->ntypes+1,"comm:multilo"); multilo = memory->create(multilo,n,ncollections,"comm:multilo");
multihi = memory->create(multihi,n,atom->ntypes+1,"comm:multihi"); multihi = memory->create(multihi,n,ncollections,"comm:multihi");
} }
/* ----------------------------------------------------------------------
allocation of multi/old-type swap info
------------------------------------------------------------------------- */
void CommBrick::allocate_multiold(int n)
{
multioldlo = memory->create(multioldlo,n,atom->ntypes+1,"comm:multioldlo");
multioldhi = memory->create(multioldhi,n,atom->ntypes+1,"comm:multioldhi");
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
free memory for swaps free memory for swaps
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -1464,7 +1602,7 @@ void CommBrick::free_swap()
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
free memory for multi-type swaps free memory for multi-collection swaps
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void CommBrick::free_multi() void CommBrick::free_multi()
@ -1474,6 +1612,17 @@ void CommBrick::free_multi()
multilo = multihi = nullptr; multilo = multihi = nullptr;
} }
/* ----------------------------------------------------------------------
free memory for multi/old-type swaps
------------------------------------------------------------------------- */
void CommBrick::free_multiold()
{
memory->destroy(multioldlo);
memory->destroy(multioldhi);
multioldlo = multioldhi = nullptr;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
extract data potentially useful to other classes extract data potentially useful to other classes
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -61,8 +61,10 @@ class CommBrick : public Comm {
int *size_reverse_send; // # to send in each reverse comm int *size_reverse_send; // # to send in each reverse comm
int *size_reverse_recv; // # to recv in each reverse comm int *size_reverse_recv; // # to recv in each reverse comm
double *slablo,*slabhi; // bounds of slab to send at each swap double *slablo,*slabhi; // bounds of slab to send at each swap
double **multilo,**multihi; // bounds of slabs for multi-type swap double **multilo,**multihi; // bounds of slabs for multi-collection swap
double **cutghostmulti; // cutghost on a per-type basis double **multioldlo,**multioldhi; // bounds of slabs for multi-type swap
double **cutghostmulti; // cutghost on a per-collection basis
double **cutghostmultiold; // cutghost on a per-type basis
int *pbc_flag; // general flag for sending atoms thru PBC int *pbc_flag; // general flag for sending atoms thru PBC
int **pbc; // dimension flags for PBC adjustments int **pbc; // dimension flags for PBC adjustments
@ -84,11 +86,13 @@ class CommBrick : public Comm {
virtual void grow_send(int, int); // reallocate send buffer virtual void grow_send(int, int); // reallocate send buffer
virtual void grow_recv(int); // free/allocate recv buffer virtual void grow_recv(int); // free/allocate recv buffer
virtual void grow_list(int, int); // reallocate one sendlist virtual void grow_list(int, int); // reallocate one sendlist
virtual void grow_swap(int); // grow swap and multi arrays virtual void grow_swap(int); // grow swap, multi, and multi/old arrays
virtual void allocate_swap(int); // allocate swap arrays virtual void allocate_swap(int); // allocate swap arrays
virtual void allocate_multi(int); // allocate multi arrays virtual void allocate_multi(int); // allocate multi arrays
virtual void allocate_multiold(int); // allocate multi/old arrays
virtual void free_swap(); // free swap arrays virtual void free_swap(); // free swap arrays
virtual void free_multi(); // free multi arrays virtual void free_multi(); // free multi arrays
virtual void free_multiold(); // free multi/old arrays
}; };
} }

View File

@ -31,6 +31,7 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <vector>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -53,6 +54,7 @@ CommTiled::CommTiled(LAMMPS *lmp) : Comm(lmp)
overlap = nullptr; overlap = nullptr;
rcbinfo = nullptr; rcbinfo = nullptr;
cutghostmulti = nullptr; cutghostmulti = nullptr;
cutghostmultiold = nullptr;
init_buffers(); init_buffers();
} }
@ -81,6 +83,7 @@ CommTiled::~CommTiled()
deallocate_swap(maxswap); deallocate_swap(maxswap);
memory->sfree(rcbinfo); memory->sfree(rcbinfo);
memory->destroy(cutghostmulti); memory->destroy(cutghostmulti);
memory->destroy(cutghostmultiold);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -98,8 +101,11 @@ void CommTiled::init_buffers()
overlap = nullptr; overlap = nullptr;
rcbinfo = nullptr; rcbinfo = nullptr;
cutghostmulti = nullptr; cutghostmulti = nullptr;
cutghostmultiold = nullptr;
sendbox_multi = nullptr; sendbox_multi = nullptr;
sendbox_multiold = nullptr;
// Note this may skip growing multi arrays, will call again in init()
maxswap = 6; maxswap = 6;
allocate_swap(maxswap); allocate_swap(maxswap);
} }
@ -116,8 +122,30 @@ void CommTiled::init()
nswap = 2*domain->dimension; nswap = 2*domain->dimension;
memory->destroy(cutghostmulti); memory->destroy(cutghostmulti);
if (mode == Comm::MULTI) if (mode == Comm::MULTI) {
memory->create(cutghostmulti,atom->ntypes+1,3,"comm:cutghostmulti"); // If inconsitent # of collections, destroy any preexisting arrays (may be missized)
if (ncollections != neighbor->ncollections) {
ncollections = neighbor->ncollections;
}
// delete any old user cutoffs if # of collections chanaged
if (cutusermulti && ncollections != ncollections_cutoff) {
if(me == 0) error->warning(FLERR, "cutoff/multi settings discarded, must be defined"
" after customizing collections in neigh_modify");
memory->destroy(cutusermulti);
cutusermulti = nullptr;
}
// grow sendbox_multi now that ncollections is known
for (int i = 0; i < maxswap; i ++)
grow_swap_send_multi(i,DELTA_PROCS);
memory->create(cutghostmulti,ncollections,3,"comm:cutghostmulti");
}
memory->destroy(cutghostmultiold);
if (mode == Comm::MULTIOLD)
memory->create(cutghostmultiold,atom->ntypes+1,3,"comm:cutghostmultiold");
int bufextra_old = bufextra; int bufextra_old = bufextra;
init_exchange(); init_exchange();
@ -175,14 +203,42 @@ void CommTiled::setup()
// check that cutoff < any periodic box length // check that cutoff < any periodic box length
if (mode == Comm::MULTI) { if (mode == Comm::MULTI) {
double **cutcollectionsq = neighbor->cutcollectionsq;
// build collection array for atom exchange
neighbor->build_collection(0);
// If using multi/reduce, communicate particles a distance equal
// to the max cutoff with equally sized or smaller collections
// If not, communicate the maximum cutoff of the entire collection
for (i = 0; i < ncollections; i++) {
if (cutusermulti) {
cutghostmulti[i][0] = cutusermulti[i];
cutghostmulti[i][1] = cutusermulti[i];
cutghostmulti[i][2] = cutusermulti[i];
} else {
cutghostmulti[i][0] = 0.0;
cutghostmulti[i][1] = 0.0;
cutghostmulti[i][2] = 0.0;
}
for (j = 0; j < ncollections; j++){
if (multi_reduce && (cutcollectionsq[j][j] > cutcollectionsq[i][i])) continue;
cutghostmulti[i][0] = MAX(cutghostmulti[i][0],sqrt(cutcollectionsq[i][j]));
cutghostmulti[i][1] = MAX(cutghostmulti[i][1],sqrt(cutcollectionsq[i][j]));
cutghostmulti[i][2] = MAX(cutghostmulti[i][2],sqrt(cutcollectionsq[i][j]));
}
}
}
if (mode == Comm::MULTIOLD) {
double *cuttype = neighbor->cuttype; double *cuttype = neighbor->cuttype;
double cut;
for (i = 1; i <= ntypes; i++) { for (i = 1; i <= ntypes; i++) {
cut = 0.0; double tmp = 0.0;
if (cutusermulti) cut = cutusermulti[i]; if (cutusermultiold) tmp = cutusermultiold[i];
cutghostmulti[i][0] = MAX(cut,cuttype[i]); cutghostmultiold[i][0] = MAX(tmp,cuttype[i]);
cutghostmulti[i][1] = MAX(cut,cuttype[i]); cutghostmultiold[i][1] = MAX(tmp,cuttype[i]);
cutghostmulti[i][2] = MAX(cut,cuttype[i]); cutghostmultiold[i][2] = MAX(tmp,cuttype[i]);
} }
} }
@ -202,12 +258,20 @@ void CommTiled::setup()
length2 = h_inv[2]; length2 = h_inv[2];
cutghost[2] = cut * length2; cutghost[2] = cut * length2;
if (mode == Comm::MULTI) { if (mode == Comm::MULTI) {
for (i = 1; i <= ntypes; i++) { for (i = 0; i < ncollections; i++) {
cutghostmulti[i][0] *= length0; cutghostmulti[i][0] *= length0;
cutghostmulti[i][1] *= length1; cutghostmulti[i][1] *= length1;
cutghostmulti[i][2] *= length2; cutghostmulti[i][2] *= length2;
} }
} }
if (mode == Comm::MULTIOLD) {
for (i = 1; i <= ntypes; i++) {
cutghostmultiold[i][0] *= length0;
cutghostmultiold[i][1] *= length1;
cutghostmultiold[i][2] *= length2;
}
}
} }
if ((periodicity[0] && cutghost[0] > prd[0]) || if ((periodicity[0] && cutghost[0] > prd[0]) ||
@ -345,7 +409,7 @@ void CommTiled::setup()
// extend sbox in those lower dims to include ghost atoms // extend sbox in those lower dims to include ghost atoms
// single mode and multi mode // single mode and multi mode
double oboxlo[3],oboxhi[3],sbox[6],sbox_multi[6]; double oboxlo[3],oboxhi[3],sbox[6],sbox_multi[6],sbox_multiold[6];
if (mode == Comm::SINGLE) { if (mode == Comm::SINGLE) {
for (i = 0; i < noverlap; i++) { for (i = 0; i < noverlap; i++) {
@ -434,7 +498,7 @@ void CommTiled::setup()
sbox[5] = MIN(oboxhi[2],hi2[2]); sbox[5] = MIN(oboxhi[2],hi2[2]);
} }
for (int itype = 1; itype <= atom->ntypes; itype++) { for (int icollection = 0; icollection < ncollections; icollection++) {
sbox_multi[0] = sbox[0]; sbox_multi[0] = sbox[0];
sbox_multi[1] = sbox[1]; sbox_multi[1] = sbox[1];
sbox_multi[2] = sbox[2]; sbox_multi[2] = sbox[2];
@ -445,36 +509,112 @@ void CommTiled::setup()
sbox_multi[idim] = sublo[idim]; sbox_multi[idim] = sublo[idim];
if (i < noverlap1) if (i < noverlap1)
sbox_multi[3+idim] = sbox_multi[3+idim] =
MIN(sbox_multi[3+idim]+cutghostmulti[itype][idim],subhi[idim]); MIN(sbox_multi[3+idim]+cutghostmulti[icollection][idim],subhi[idim]);
else else
sbox_multi[3+idim] = sbox_multi[3+idim] =
MIN(sbox_multi[3+idim]-prd[idim]+cutghostmulti[itype][idim], MIN(sbox_multi[3+idim]-prd[idim]+cutghostmulti[icollection][idim],
subhi[idim]); subhi[idim]);
} else { } else {
if (i < noverlap1) if (i < noverlap1)
sbox_multi[idim] = sbox_multi[idim] =
MAX(sbox_multi[idim]-cutghostmulti[itype][idim],sublo[idim]); MAX(sbox_multi[idim]-cutghostmulti[icollection][idim],sublo[idim]);
else else
sbox_multi[idim] = sbox_multi[idim] =
MAX(sbox_multi[idim]+prd[idim]-cutghostmulti[itype][idim], MAX(sbox_multi[idim]+prd[idim]-cutghostmulti[icollection][idim],
sublo[idim]); sublo[idim]);
sbox_multi[3+idim] = subhi[idim]; sbox_multi[3+idim] = subhi[idim];
} }
if (idim >= 1) { if (idim >= 1) {
if (sbox_multi[0] == oboxlo[0]) if (sbox_multi[0] == oboxlo[0])
sbox_multi[0] -= cutghostmulti[itype][idim]; sbox_multi[0] -= cutghostmulti[icollection][idim];
if (sbox_multi[3] == oboxhi[0]) if (sbox_multi[3] == oboxhi[0])
sbox_multi[3] += cutghostmulti[itype][idim]; sbox_multi[3] += cutghostmulti[icollection][idim];
} }
if (idim == 2) { if (idim == 2) {
if (sbox_multi[1] == oboxlo[1]) if (sbox_multi[1] == oboxlo[1])
sbox_multi[1] -= cutghostmulti[itype][idim]; sbox_multi[1] -= cutghostmulti[icollection][idim];
if (sbox_multi[4] == oboxhi[1]) if (sbox_multi[4] == oboxhi[1])
sbox_multi[4] += cutghostmulti[itype][idim]; sbox_multi[4] += cutghostmulti[icollection][idim];
} }
memcpy(sendbox_multi[iswap][i][itype],sbox_multi,6*sizeof(double)); memcpy(sendbox_multi[iswap][i][icollection],sbox_multi,6*sizeof(double));
}
}
}
if (mode == Comm::MULTIOLD) {
for (i = 0; i < noverlap; i++) {
pbc_flag[iswap][i] = 0;
pbc[iswap][i][0] = pbc[iswap][i][1] = pbc[iswap][i][2] =
pbc[iswap][i][3] = pbc[iswap][i][4] = pbc[iswap][i][5] = 0;
(this->*box_other)(idim,idir,overlap[i],oboxlo,oboxhi);
if (i < noverlap1) {
sbox[0] = MAX(oboxlo[0],lo1[0]);
sbox[1] = MAX(oboxlo[1],lo1[1]);
sbox[2] = MAX(oboxlo[2],lo1[2]);
sbox[3] = MIN(oboxhi[0],hi1[0]);
sbox[4] = MIN(oboxhi[1],hi1[1]);
sbox[5] = MIN(oboxhi[2],hi1[2]);
} else {
pbc_flag[iswap][i] = 1;
if (idir == 0) pbc[iswap][i][idim] = 1;
else pbc[iswap][i][idim] = -1;
if (triclinic) {
if (idim == 1) pbc[iswap][i][5] = pbc[iswap][i][idim];
if (idim == 2) pbc[iswap][i][4] = pbc[iswap][i][3] = pbc[iswap][i][idim];
}
sbox[0] = MAX(oboxlo[0],lo2[0]);
sbox[1] = MAX(oboxlo[1],lo2[1]);
sbox[2] = MAX(oboxlo[2],lo2[2]);
sbox[3] = MIN(oboxhi[0],hi2[0]);
sbox[4] = MIN(oboxhi[1],hi2[1]);
sbox[5] = MIN(oboxhi[2],hi2[2]);
}
for (int itype = 1; itype <= atom->ntypes; itype++) {
sbox_multiold[0] = sbox[0];
sbox_multiold[1] = sbox[1];
sbox_multiold[2] = sbox[2];
sbox_multiold[3] = sbox[3];
sbox_multiold[4] = sbox[4];
sbox_multiold[5] = sbox[5];
if (idir == 0) {
sbox_multiold[idim] = sublo[idim];
if (i < noverlap1)
sbox_multiold[3+idim] =
MIN(sbox_multiold[3+idim]+cutghostmultiold[itype][idim],subhi[idim]);
else
sbox_multiold[3+idim] =
MIN(sbox_multiold[3+idim]-prd[idim]+cutghostmultiold[itype][idim],
subhi[idim]);
} else {
if (i < noverlap1)
sbox_multiold[idim] =
MAX(sbox_multiold[idim]-cutghostmultiold[itype][idim],sublo[idim]);
else
sbox_multiold[idim] =
MAX(sbox_multiold[idim]+prd[idim]-cutghostmultiold[itype][idim],
sublo[idim]);
sbox_multiold[3+idim] = subhi[idim];
}
if (idim >= 1) {
if (sbox_multiold[0] == oboxlo[0])
sbox_multiold[0] -= cutghostmultiold[itype][idim];
if (sbox_multiold[3] == oboxhi[0])
sbox_multiold[3] += cutghostmultiold[itype][idim];
}
if (idim == 2) {
if (sbox_multiold[1] == oboxlo[1])
sbox_multiold[1] -= cutghostmultiold[itype][idim];
if (sbox_multiold[4] == oboxhi[1])
sbox_multiold[4] += cutghostmultiold[itype][idim];
}
memcpy(sendbox_multiold[iswap][i][itype],sbox_multiold,6*sizeof(double));
} }
} }
} }
@ -906,12 +1046,15 @@ void CommTiled::exchange()
void CommTiled::borders() void CommTiled::borders()
{ {
int i,m,n,nlast,nsend,nrecv,ngroup,ncount,ncountall; int i,m,n,nlast,nsend,nrecv,ngroup,nprior,ncount,ncountall;
double xlo,xhi,ylo,yhi,zlo,zhi; double xlo,xhi,ylo,yhi,zlo,zhi;
double *bbox; double *bbox;
double **x; double **x;
AtomVec *avec = atom->avec; AtomVec *avec = atom->avec;
// After exchanging, need to reconstruct collection array for border communication
if (mode == Comm::MULTI) neighbor->build_collection(0);
// send/recv max one = max # of atoms in single send/recv for any swap // send/recv max one = max # of atoms in single send/recv for any swap
// send/recv max all = max # of atoms in all sends/recvs within any swap // send/recv max all = max # of atoms in all sends/recvs within any swap
@ -977,6 +1120,56 @@ void CommTiled::borders()
smaxone = MAX(smaxone,ncount); smaxone = MAX(smaxone,ncount);
ncountall += ncount; ncountall += ncount;
} else if (mode == Comm::MULTI) {
int* collection=neighbor->collection;
int icollection;
ncount = 0;
if (!bordergroup) {
for (i = 0; i < nlast; i++) {
icollection=collection[i];
bbox = sendbox_multi[iswap][m][icollection];
xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2];
xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5];
if (x[i][0] >= xlo && x[i][0] < xhi &&
x[i][1] >= ylo && x[i][1] < yhi &&
x[i][2] >= zlo && x[i][2] < zhi) {
if (ncount == maxsendlist[iswap][m]) grow_list(iswap,m,ncount);
sendlist[iswap][m][ncount++] = i;
}
}
} else {
ngroup = atom->nfirst;
for (i = 0; i < ngroup; i++) {
icollection=collection[i];
bbox = sendbox_multi[iswap][m][icollection];
xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2];
xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5];
if (x[i][0] >= xlo && x[i][0] < xhi &&
x[i][1] >= ylo && x[i][1] < yhi &&
x[i][2] >= zlo && x[i][2] < zhi) {
if (ncount == maxsendlist[iswap][m]) grow_list(iswap,m,ncount);
sendlist[iswap][m][ncount++] = i;
}
}
for (i = atom->nlocal; i < nlast; i++) {
icollection=collection[i];
bbox = sendbox_multi[iswap][m][icollection];
xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2];
xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5];
if (x[i][0] >= xlo && x[i][0] < xhi &&
x[i][1] >= ylo && x[i][1] < yhi &&
x[i][2] >= zlo && x[i][2] < zhi) {
if (ncount == maxsendlist[iswap][m]) grow_list(iswap,m,ncount);
sendlist[iswap][m][ncount++] = i;
}
}
}
sendnum[iswap][m] = ncount;
smaxone = MAX(smaxone,ncount);
ncountall += ncount;
} else { } else {
int* type=atom->type; int* type=atom->type;
@ -986,7 +1179,7 @@ void CommTiled::borders()
if (!bordergroup) { if (!bordergroup) {
for (i = 0; i < nlast; i++) { for (i = 0; i < nlast; i++) {
itype=type[i]; itype=type[i];
bbox = sendbox_multi[iswap][m][itype]; bbox = sendbox_multiold[iswap][m][itype];
xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2]; xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2];
xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5]; xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5];
if (x[i][0] >= xlo && x[i][0] < xhi && if (x[i][0] >= xlo && x[i][0] < xhi &&
@ -1000,7 +1193,7 @@ void CommTiled::borders()
ngroup = atom->nfirst; ngroup = atom->nfirst;
for (i = 0; i < ngroup; i++) { for (i = 0; i < ngroup; i++) {
itype=type[i]; itype=type[i];
bbox = sendbox_multi[iswap][m][itype]; bbox = sendbox_multiold[iswap][m][itype];
xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2]; xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2];
xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5]; xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5];
if (x[i][0] >= xlo && x[i][0] < xhi && if (x[i][0] >= xlo && x[i][0] < xhi &&
@ -1012,7 +1205,7 @@ void CommTiled::borders()
} }
for (i = atom->nlocal; i < nlast; i++) { for (i = atom->nlocal; i < nlast; i++) {
itype=type[i]; itype=type[i];
bbox = sendbox_multi[iswap][m][itype]; bbox = sendbox_multiold[iswap][m][itype];
xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2]; xlo = bbox[0]; ylo = bbox[1]; zlo = bbox[2];
xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5]; xhi = bbox[3]; yhi = bbox[4]; zhi = bbox[5];
if (x[i][0] >= xlo && x[i][0] < xhi && if (x[i][0] >= xlo && x[i][0] < xhi &&
@ -1148,8 +1341,11 @@ void CommTiled::borders()
// increment ghost atoms // increment ghost atoms
n = nrecvproc[iswap]; n = nrecvproc[iswap];
if (n) if (n) {
nprior = atom->nghost + atom->nlocal;
atom->nghost += forward_recv_offset[iswap][n-1] + recvnum[iswap][n-1]; atom->nghost += forward_recv_offset[iswap][n-1] + recvnum[iswap][n-1];
if (neighbor->style == Neighbor::MULTI) neighbor->build_collection(nprior);
}
} }
// For molecular systems we lose some bits for local atom indices due // For molecular systems we lose some bits for local atom indices due
@ -2089,6 +2285,7 @@ void CommTiled::allocate_swap(int n)
pbc = new int**[n]; pbc = new int**[n];
sendbox = new double**[n]; sendbox = new double**[n];
sendbox_multi = new double***[n]; sendbox_multi = new double***[n];
sendbox_multiold = new double***[n];
maxsendlist = new int*[n]; maxsendlist = new int*[n];
sendlist = new int**[n]; sendlist = new int**[n];
@ -2103,6 +2300,7 @@ void CommTiled::allocate_swap(int n)
pbc[i] = nullptr; pbc[i] = nullptr;
sendbox[i] = nullptr; sendbox[i] = nullptr;
sendbox_multi[i] = nullptr; sendbox_multi[i] = nullptr;
sendbox_multiold[i] = nullptr;
maxsendlist[i] = nullptr; maxsendlist[i] = nullptr;
sendlist[i] = nullptr; sendlist[i] = nullptr;
} }
@ -2151,8 +2349,9 @@ void CommTiled::grow_swap_send(int i, int n, int nold)
memory->create(pbc[i],n,6,"comm:pbc_flag"); memory->create(pbc[i],n,6,"comm:pbc_flag");
memory->destroy(sendbox[i]); memory->destroy(sendbox[i]);
memory->create(sendbox[i],n,6,"comm:sendbox"); memory->create(sendbox[i],n,6,"comm:sendbox");
memory->destroy(sendbox_multi[i]); grow_swap_send_multi(i,n);
memory->create(sendbox_multi[i],n,atom->ntypes+1,6,"comm:sendbox_multi"); memory->destroy(sendbox_multiold[i]);
memory->create(sendbox_multiold[i],n,atom->ntypes+1,6,"comm:sendbox_multiold");
delete [] maxsendlist[i]; delete [] maxsendlist[i];
maxsendlist[i] = new int[n]; maxsendlist[i] = new int[n];
@ -2184,6 +2383,19 @@ void CommTiled::grow_swap_recv(int i, int n)
size_reverse_send[i] = new int[n]; size_reverse_send[i] = new int[n];
} }
/* ----------------------------------------------------------------------
grow info for swap I for multi as ncollections can change
------------------------------------------------------------------------- */
void CommTiled::grow_swap_send_multi(int i, int n)
{
memory->destroy(sendbox_multi[i]);
if (ncollections > 0)
memory->create(sendbox_multi[i],n,ncollections,6,"comm:sendbox_multi");
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
deallocate swap info deallocate swap info
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -2212,6 +2424,7 @@ void CommTiled::deallocate_swap(int n)
memory->destroy(pbc[i]); memory->destroy(pbc[i]);
memory->destroy(sendbox[i]); memory->destroy(sendbox[i]);
memory->destroy(sendbox_multi[i]); memory->destroy(sendbox_multi[i]);
memory->destroy(sendbox_multiold[i]);
delete [] maxsendlist[i]; delete [] maxsendlist[i];
@ -2234,6 +2447,7 @@ void CommTiled::deallocate_swap(int n)
delete [] pbc; delete [] pbc;
delete [] sendbox; delete [] sendbox;
delete [] sendbox_multi; delete [] sendbox_multi;
delete [] sendbox_multiold;
delete [] maxsendlist; delete [] maxsendlist;
delete [] sendlist; delete [] sendlist;

View File

@ -77,9 +77,12 @@ class CommTiled : public Comm {
double ***sendbox; // bounding box of atoms to send per swap/proc double ***sendbox; // bounding box of atoms to send per swap/proc
double **cutghostmulti; // cutghost on a per-type basis double **cutghostmulti; // cutghost on a per-collection basis
double **cutghostmultiold; // cutghost on a per-type basis
double ****sendbox_multi; // bounding box of atoms to send double ****sendbox_multi; // bounding box of atoms to send
// per swap/proc for multi comm // per swap/proc for multi comm
double ****sendbox_multiold; // bounding box of atoms to send
// per swap/proc for multi/old comm
// exchange comm info, proc lists do not include self // exchange comm info, proc lists do not include self
@ -148,6 +151,7 @@ class CommTiled : public Comm {
void grow_list(int, int, int); // reallocate sendlist for one swap/proc void grow_list(int, int, int); // reallocate sendlist for one swap/proc
void allocate_swap(int); // allocate swap arrays void allocate_swap(int); // allocate swap arrays
void grow_swap_send(int, int, int); // grow swap arrays for send and recv void grow_swap_send(int, int, int); // grow swap arrays for send and recv
void grow_swap_send_multi(int, int); // grow multi swap arrays for send and recv
void grow_swap_recv(int, int); void grow_swap_recv(int, int);
void deallocate_swap(int); // deallocate swap arrays void deallocate_swap(int); // deallocate swap arrays
@ -163,10 +167,6 @@ E: Cannot yet use comm_style tiled with triclinic box
Self-explanatory. Self-explanatory.
E: Cannot yet use comm_style tiled with multi-mode comm
Self-explanatory.
E: Communication cutoff for comm_style tiled cannot exceed periodic box length E: Communication cutoff for comm_style tiled cannot exceed periodic box length
Self-explanatory. Self-explanatory.

View File

@ -35,7 +35,7 @@ enum{TYPE,RADIUS};
ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) : ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), Compute(lmp, narg, arg),
vlocal(nullptr), alocal(nullptr), indices(nullptr), pack_choice(nullptr) vlocal(NULL), alocal(NULL), indices(NULL), pack_choice(NULL)
{ {
if (narg < 4) error->all(FLERR,"Illegal compute property/local command"); if (narg < 4) error->all(FLERR,"Illegal compute property/local command");
@ -233,7 +233,7 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) :
// error check // error check
if (atom->molecular == Atom::TEMPLATE && (kindflag == BOND || kindflag == ANGLE || if (atom->molecular == 2 && (kindflag == BOND || kindflag == ANGLE ||
kindflag == DIHEDRAL || kindflag == IMPROPER)) kindflag == DIHEDRAL || kindflag == IMPROPER))
error->all(FLERR,"Compute property/local does not (yet) work " error->all(FLERR,"Compute property/local does not (yet) work "
"with atom_style template"); "with atom_style template");
@ -254,8 +254,8 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Compute property/local requires atom attribute radius"); error->all(FLERR,"Compute property/local requires atom attribute radius");
nmax = 0; nmax = 0;
vlocal = nullptr; vlocal = NULL;
alocal = nullptr; alocal = NULL;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -273,7 +273,7 @@ ComputePropertyLocal::~ComputePropertyLocal()
void ComputePropertyLocal::init() void ComputePropertyLocal::init()
{ {
if (kindflag == NEIGH || kindflag == PAIR) { if (kindflag == NEIGH || kindflag == PAIR) {
if (force->pair == nullptr) if (force->pair == NULL)
error->all(FLERR,"No pair style is defined for compute property/local"); error->all(FLERR,"No pair style is defined for compute property/local");
if (force->pair->single_enable == 0) if (force->pair->single_enable == 0)
error->all(FLERR,"Pair style does not support compute property/local"); error->all(FLERR,"Pair style does not support compute property/local");

View File

@ -367,9 +367,24 @@ void Info::command(int narg, char **arg)
if (comm->mode == 1) { if (comm->mode == 1) {
fputs("Communication mode = multi\n",out); fputs("Communication mode = multi\n",out);
double cut; double cut;
for (int i=0; i < neighbor->ncollections; ++i) {
if (comm->cutusermulti) cut = comm->cutusermulti[i];
else cut = 0.0;
for (int j=0; j < neighbor->ncollections; ++j) {
cut = MAX(cut,sqrt(neighbor->cutcollectionsq[i][j]));
}
if (comm->cutusermulti) cut = MAX(cut,comm->cutusermulti[i]);
fmt::print(out,"Communication cutoff for collection {} = {:.8}\n", i, cut);
}
}
if (comm->mode == 2) {
fputs("Communication mode = multi/old\n",out);
double cut;
for (int i=1; i <= atom->ntypes && neighbor->cuttype; ++i) { for (int i=1; i <= atom->ntypes && neighbor->cuttype; ++i) {
cut = neighbor->cuttype[i]; cut = neighbor->cuttype[i];
if (comm->cutusermulti) cut = MAX(cut,comm->cutusermulti[i]); if (comm->cutusermultiold) cut = MAX(cut,comm->cutusermultiold[i]);
fmt::print(out,"Communication cutoff for type {} = {:.8}\n", i, cut); fmt::print(out,"Communication cutoff for type {} = {:.8}\n", i, cut);
} }
} }

View File

@ -31,6 +31,19 @@ NBin::NBin(LAMMPS *lmp) : Pointers(lmp)
bins = nullptr; bins = nullptr;
atom2bin = nullptr; atom2bin = nullptr;
nbinx_multi = nullptr; nbiny_multi = nullptr; nbinz_multi = nullptr;
mbins_multi = nullptr;
mbinx_multi = nullptr; mbiny_multi = nullptr, mbinz_multi = nullptr;
mbinxlo_multi = nullptr;
mbinylo_multi = nullptr;
mbinzlo_multi = nullptr;
binsizex_multi = nullptr; binsizey_multi = nullptr; binsizez_multi = nullptr;
bininvx_multi = nullptr; bininvy_multi = nullptr; bininvz_multi = nullptr;
binhead_multi = nullptr;
maxbins_multi = nullptr;
maxcollections = 0;
neighbor->last_setup_bins = -1; neighbor->last_setup_bins = -1;
// geometry settings // geometry settings
@ -48,6 +61,33 @@ NBin::~NBin()
memory->destroy(binhead); memory->destroy(binhead);
memory->destroy(bins); memory->destroy(bins);
memory->destroy(atom2bin); memory->destroy(atom2bin);
if (!binhead_multi) return;
memory->destroy(nbinx_multi);
memory->destroy(nbiny_multi);
memory->destroy(nbinz_multi);
memory->destroy(mbins_multi);
memory->destroy(mbinx_multi);
memory->destroy(mbiny_multi);
memory->destroy(mbinz_multi);
memory->destroy(mbinxlo_multi);
memory->destroy(mbinylo_multi);
memory->destroy(mbinzlo_multi);
memory->destroy(binsizex_multi);
memory->destroy(binsizey_multi);
memory->destroy(binsizez_multi);
memory->destroy(bininvx_multi);
memory->destroy(bininvy_multi);
memory->destroy(bininvz_multi);
for (int n = 0; n < maxcollections; n++) {
memory->destroy(binhead_multi[n]);
}
delete [] binhead_multi;
memory->destroy(maxbins_multi);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -72,38 +112,16 @@ void NBin::copy_neighbor_info()
bboxlo = neighbor->bboxlo; bboxlo = neighbor->bboxlo;
bboxhi = neighbor->bboxhi; bboxhi = neighbor->bboxhi;
ncollections = neighbor->ncollections;
cutcollectionsq = neighbor->cutcollectionsq;
// overwrite Neighbor cutoff with custom value set by requestor // overwrite Neighbor cutoff with custom value set by requestor
// only works for style = BIN (checked by Neighbor class) // only works for style = BIN (checked by Neighbor class)
if (cutoff_custom > 0.0) cutneighmax = cutoff_custom; if (cutoff_custom > 0.0) cutneighmax = cutoff_custom;
} }
/* ----------------------------------------------------------------------
setup for bin_atoms()
------------------------------------------------------------------------- */
void NBin::bin_atoms_setup(int nall)
{
// binhead = per-bin vector, mbins in length
// add 1 bin for USER-INTEL package
if (mbins > maxbin) {
maxbin = mbins;
memory->destroy(binhead);
memory->create(binhead,maxbin,"neigh:binhead");
}
// bins and atom2bin = per-atom vectors
// for both local and ghost atoms
if (nall > maxatom) {
maxatom = nall;
memory->destroy(bins);
memory->create(bins,maxatom,"neigh:bins");
memory->destroy(atom2bin);
memory->create(atom2bin,maxatom,"neigh:atom2bin");
}
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
convert atom coords into local bin # convert atom coords into local bin #
@ -151,12 +169,47 @@ int NBin::coord2bin(double *x)
return (iz-mbinzlo)*mbiny*mbinx + (iy-mbinylo)*mbinx + (ix-mbinxlo); return (iz-mbinzlo)*mbiny*mbinx + (iy-mbinylo)*mbinx + (ix-mbinxlo);
} }
/* ---------------------------------------------------------------------- */
double NBin::memory_usage() /* ----------------------------------------------------------------------
convert atom coords into local bin # for a particular collection
------------------------------------------------------------------------- */
int NBin::coord2bin_multi(double *x, int ic)
{ {
double bytes = 0; int ix,iy,iz;
bytes += (double)maxbin*sizeof(int); int ibin;
bytes += (double)2*maxatom*sizeof(int);
return bytes; if (!std::isfinite(x[0]) || !std::isfinite(x[1]) || !std::isfinite(x[2]))
error->one(FLERR,"Non-numeric positions - simulation unstable");
if (x[0] >= bboxhi[0])
ix = static_cast<int> ((x[0]-bboxhi[0])*bininvx_multi[ic]) + nbinx_multi[ic];
else if (x[0] >= bboxlo[0]) {
ix = static_cast<int> ((x[0]-bboxlo[0])*bininvx_multi[ic]);
ix = MIN(ix,nbinx_multi[ic]-1);
} else
ix = static_cast<int> ((x[0]-bboxlo[0])*bininvx_multi[ic]) - 1;
if (x[1] >= bboxhi[1])
iy = static_cast<int> ((x[1]-bboxhi[1])*bininvy_multi[ic]) + nbiny_multi[ic];
else if (x[1] >= bboxlo[1]) {
iy = static_cast<int> ((x[1]-bboxlo[1])*bininvy_multi[ic]);
iy = MIN(iy,nbiny_multi[ic]-1);
} else
iy = static_cast<int> ((x[1]-bboxlo[1])*bininvy_multi[ic]) - 1;
if (x[2] >= bboxhi[2])
iz = static_cast<int> ((x[2]-bboxhi[2])*bininvz_multi[ic]) + nbinz_multi[ic];
else if (x[2] >= bboxlo[2]) {
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz_multi[ic]);
iz = MIN(iz,nbinz_multi[ic]-1);
} else
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz_multi[ic]) - 1;
ibin = (iz-mbinzlo_multi[ic])*mbiny_multi[ic]*mbinx_multi[ic]
+ (iy-mbinylo_multi[ic])*mbinx_multi[ic]
+ (ix-mbinxlo_multi[ic]);
return ibin;
} }

View File

@ -22,6 +22,9 @@ class NBin : protected Pointers {
public: public:
int istyle; // 1-N index into binnames int istyle; // 1-N index into binnames
bigint last_bin; // last timestep atoms were binned bigint last_bin; // last timestep atoms were binned
double cutoff_custom; // cutoff set by requestor
// Variables for NBinStandard
int nbinx,nbiny,nbinz; // # of global bins int nbinx,nbiny,nbinz; // # of global bins
int mbins; // # of local bins and offset on this proc int mbins; // # of local bins and offset on this proc
@ -35,17 +38,26 @@ class NBin : protected Pointers {
int *bins; // index of next atom in same bin int *bins; // index of next atom in same bin
int *atom2bin; // bin assignment for each atom (local+ghost) int *atom2bin; // bin assignment for each atom (local+ghost)
double cutoff_custom; // cutoff set by requestor // Analogues for NBinMultimulti
int *nbinx_multi, *nbiny_multi, *nbinz_multi;
int *mbins_multi;
int *mbinx_multi, *mbiny_multi, *mbinz_multi;
int *mbinxlo_multi, *mbinylo_multi, *mbinzlo_multi;
double *binsizex_multi, *binsizey_multi, *binsizez_multi;
double *bininvx_multi, *bininvy_multi, *bininvz_multi;
int **binhead_multi;
NBin(class LAMMPS *); NBin(class LAMMPS *);
~NBin(); ~NBin();
void post_constructor(class NeighRequest *); void post_constructor(class NeighRequest *);
virtual void copy_neighbor_info(); virtual void copy_neighbor_info();
virtual void bin_atoms_setup(int);
double memory_usage();
virtual void bin_atoms_setup(int) = 0;
virtual void setup_bins(int) = 0; virtual void setup_bins(int) = 0;
virtual void bin_atoms() = 0; virtual void bin_atoms() = 0;
virtual double memory_usage() {return 0.0;}
// Kokkos package // Kokkos package
@ -61,18 +73,28 @@ class NBin : protected Pointers {
int binsizeflag; int binsizeflag;
double binsize_user; double binsize_user;
double *bboxlo,*bboxhi; double *bboxlo,*bboxhi;
int ncollections;
double **cutcollectionsq;
// data common to all NBin variants // data common to all NBin variants
int dimension; int dimension;
int triclinic; int triclinic;
int maxbin; // size of binhead array // data for standard NBin
int maxatom; // size of bins array int maxatom; // size of bins array
int maxbin; // size of binhead array
// data for multi NBin
int maxcollections; // size of multi arrays
int * maxbins_multi; // size of 2nd dimension of binhead_multi array
// methods // methods
int coord2bin(double *); int coord2bin(double *);
int coord2bin_multi(double *, int);
}; };
} }

349
src/nbin_multi.cpp Normal file
View File

@ -0,0 +1,349 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "nbin_multi.h"
#include "neighbor.h"
#include "atom.h"
#include "group.h"
#include "domain.h"
#include "comm.h"
#include "update.h"
#include "error.h"
#include "memory.h"
using namespace LAMMPS_NS;
#define SMALL 1.0e-6
#define CUT2BIN_RATIO 100
/* ---------------------------------------------------------------------- */
NBinMulti::NBinMulti(LAMMPS *lmp) : NBin(lmp) {}
/* ----------------------------------------------------------------------
setup for bin_atoms()
------------------------------------------------------------------------- */
void NBinMulti::bin_atoms_setup(int nall)
{
// binhead_multi[n] = per-bin vector mbins in length mbins_multi[n]
for (int n = 0; n < maxcollections; n++) {
if (mbins_multi[n] > maxbins_multi[n]) {
maxbins_multi[n] = mbins_multi[n];
memory->destroy(binhead_multi[n]);
memory->create(binhead_multi[n], mbins_multi[n], "neigh:mbins_multi");
}
}
// bins and atom2bin = per-atom vectors
// for both local and ghost atoms
// for multi, bins and atom2bin correspond to different binlists
if (nall > maxatom) {
maxatom = nall;
memory->destroy(bins);
memory->create(bins,maxatom,"neigh:bins");
memory->destroy(atom2bin);
memory->create(atom2bin,maxatom,"neigh:atom2bin");
}
}
/* ----------------------------------------------------------------------
setup neighbor binning geometry
bin numbering in each dimension is global:
0 = 0.0 to binsize, 1 = binsize to 2*binsize, etc
nbin-1,nbin,etc = bbox-binsize to bbox, bbox to bbox+binsize, etc
-1,-2,etc = -binsize to 0.0, -2*binsize to -binsize, etc
code will work for any binsize
since next(xyz) and stencil extend as far as necessary
binsize = 1/2 of cutoff is roughly optimal
for orthogonal boxes:
a dim must be filled exactly by integer # of bins
in periodic, procs on both sides of PBC must see same bin boundary
in non-periodic, coord2bin() still assumes this by use of nbin xyz
for triclinic boxes:
tilted simulation box cannot contain integer # of bins
stencil & neigh list built differently to account for this
mbinlo_multi = lowest global bin any of my ghost atoms could fall into for each collection
mbinhi_multi = highest global bin any of my ghost atoms could fall into for each collection
mbin_multi = number of bins I need in a dimension for each collection
------------------------------------------------------------------------- */
void NBinMulti::setup_bins(int /*style*/)
{
int n;
// Initialize arrays
if (ncollections > maxcollections) {
// Clear any/all memory for existing groupings
for (n = 0; n < maxcollections; n++)
memory->destroy(binhead_multi[n]);
delete [] binhead_multi;
maxcollections = ncollections;
binhead_multi = new int*[maxcollections]();
memory->destroy(nbinx_multi);
memory->destroy(nbiny_multi);
memory->destroy(nbinz_multi);
memory->create(nbinx_multi, maxcollections, "neigh:nbinx_multi");
memory->create(nbiny_multi, maxcollections, "neigh:nbiny_multi");
memory->create(nbinz_multi, maxcollections, "neigh:nbinz_multi");
memory->destroy(mbins_multi);
memory->destroy(mbinx_multi);
memory->destroy(mbiny_multi);
memory->destroy(mbinz_multi);
memory->create(mbins_multi, maxcollections, "neigh:mbins_multi");
memory->create(mbinx_multi, maxcollections, "neigh:mbinx_multi");
memory->create(mbiny_multi, maxcollections, "neigh:mbiny_multi");
memory->create(mbinz_multi, maxcollections, "neigh:mbinz_multi");
memory->destroy(mbinxlo_multi);
memory->destroy(mbinylo_multi);
memory->destroy(mbinzlo_multi);
memory->create(mbinxlo_multi, maxcollections, "neigh:mbinxlo_multi");
memory->create(mbinylo_multi, maxcollections, "neigh:mbinylo_multi");
memory->create(mbinzlo_multi, maxcollections, "neigh:mbinzlo_multi");
memory->destroy(binsizex_multi);
memory->destroy(binsizey_multi);
memory->destroy(binsizez_multi);
memory->create(binsizex_multi, maxcollections, "neigh:binsizex_multi");
memory->create(binsizey_multi, maxcollections, "neigh:binsizey_multi");
memory->create(binsizez_multi, maxcollections, "neigh:binsizez_multi");
memory->destroy(bininvx_multi);
memory->destroy(bininvy_multi);
memory->destroy(bininvz_multi);
memory->create(bininvx_multi, maxcollections, "neigh:bininvx_multi");
memory->create(bininvy_multi, maxcollections, "neigh:bininvy_multi");
memory->create(bininvz_multi, maxcollections, "neigh:bininvz_multi");
memory->destroy(maxbins_multi);
memory->create(maxbins_multi, maxcollections, "neigh:maxbins_multi");
// ensure reallocation occurs in bin_atoms_setup()
for (n = 0; n < maxcollections; n++) {
maxbins_multi[n] = 0;
}
maxatom = 0;
}
// Identify smallest collection
int icollectionmin = 0;
for (n = 0; n < ncollections; n++)
if (cutcollectionsq[n][n] < cutcollectionsq[icollectionmin][icollectionmin])
icollectionmin = n;
// bbox = size of bbox of entire domain
// bsubbox lo/hi = bounding box of my subdomain extended by comm->cutghost
// for triclinic:
// bbox bounds all 8 corners of tilted box
// subdomain is in lamda coords
// include dimension-dependent extension via comm->cutghost
// domain->bbox() converts lamda extent to box coords and computes bbox
double bbox[3],bsubboxlo[3],bsubboxhi[3];
double *cutghost = comm->cutghost;
if (triclinic == 0) {
bsubboxlo[0] = domain->sublo[0] - cutghost[0];
bsubboxlo[1] = domain->sublo[1] - cutghost[1];
bsubboxlo[2] = domain->sublo[2] - cutghost[2];
bsubboxhi[0] = domain->subhi[0] + cutghost[0];
bsubboxhi[1] = domain->subhi[1] + cutghost[1];
bsubboxhi[2] = domain->subhi[2] + cutghost[2];
} else {
double lo[3],hi[3];
lo[0] = domain->sublo_lamda[0] - cutghost[0];
lo[1] = domain->sublo_lamda[1] - cutghost[1];
lo[2] = domain->sublo_lamda[2] - cutghost[2];
hi[0] = domain->subhi_lamda[0] + cutghost[0];
hi[1] = domain->subhi_lamda[1] + cutghost[1];
hi[2] = domain->subhi_lamda[2] + cutghost[2];
domain->bbox(lo,hi,bsubboxlo,bsubboxhi);
}
bbox[0] = bboxhi[0] - bboxlo[0];
bbox[1] = bboxhi[1] - bboxlo[1];
bbox[2] = bboxhi[2] - bboxlo[2];
// For each grouping...
double binsize_optimal, binsizeinv, coord;
int mbinxhi,mbinyhi,mbinzhi;
for (n = 0; n < ncollections; n++) {
// binsize_user only relates to smallest collection
// optimal bin size is roughly 1/2 the collection-collection cutoff
// special case of all cutoffs = 0.0, binsize = box size
if (n == icollectionmin && binsizeflag) binsize_optimal = binsize_user;
else binsize_optimal = 0.5*sqrt(cutcollectionsq[n][n]);
if (binsize_optimal == 0.0) binsize_optimal = bbox[0];
binsizeinv = 1.0/binsize_optimal;
// test for too many global bins in any dimension due to huge global domain
if (bbox[0]*binsizeinv > MAXSMALLINT || bbox[1]*binsizeinv > MAXSMALLINT ||
bbox[2]*binsizeinv > MAXSMALLINT)
error->all(FLERR,"Domain too large for neighbor bins");
// create actual bins
// always have one bin even if cutoff > bbox
// for 2d, nbinz_multi[n] = 1
nbinx_multi[n] = static_cast<int> (bbox[0]*binsizeinv);
nbiny_multi[n] = static_cast<int> (bbox[1]*binsizeinv);
if (dimension == 3) nbinz_multi[n] = static_cast<int> (bbox[2]*binsizeinv);
else nbinz_multi[n] = 1;
if (nbinx_multi[n] == 0) nbinx_multi[n] = 1;
if (nbiny_multi[n] == 0) nbiny_multi[n] = 1;
if (nbinz_multi[n] == 0) nbinz_multi[n] = 1;
// compute actual bin size for nbins to fit into box exactly
// error if actual bin size << cutoff, since will create a zillion bins
// this happens when nbin = 1 and box size << cutoff
// typically due to non-periodic, flat system in a particular dim
// in that extreme case, cannot use multi, should use NSQ not BIN neighbor style
binsizex_multi[n] = bbox[0]/nbinx_multi[n];
binsizey_multi[n] = bbox[1]/nbiny_multi[n];
binsizez_multi[n] = bbox[2]/nbinz_multi[n];
bininvx_multi[n] = 1.0 / binsizex_multi[n];
bininvy_multi[n] = 1.0 / binsizey_multi[n];
bininvz_multi[n] = 1.0 / binsizez_multi[n];
if (binsize_optimal*bininvx_multi[n] > CUT2BIN_RATIO ||
binsize_optimal*bininvy_multi[n] > CUT2BIN_RATIO)
error->all(FLERR,"Cannot use neighbor bins - box size << cutoff");
if ((dimension == 3) && (binsize_optimal*bininvz_multi[n] > CUT2BIN_RATIO))
error->all(FLERR,"Cannot use neighbor bins - box size << cutoff");
// mbinlo/hi = lowest and highest global bins my ghost atoms could be in
// coord = lowest and highest values of coords for my ghost atoms
// static_cast(-1.5) = -1, so subract additional -1
// add in SMALL for round-off safety
coord = bsubboxlo[0] - SMALL*bbox[0];
mbinxlo_multi[n] = static_cast<int> ((coord-bboxlo[0])*bininvx_multi[n]);
if (coord < bboxlo[0]) mbinxlo_multi[n] = mbinxlo_multi[n] - 1;
coord = bsubboxhi[0] + SMALL*bbox[0];
mbinxhi = static_cast<int> ((coord-bboxlo[0])*bininvx_multi[n]);
coord = bsubboxlo[1] - SMALL*bbox[1];
mbinylo_multi[n] = static_cast<int> ((coord-bboxlo[1])*bininvy_multi[n]);
if (coord < bboxlo[1]) mbinylo_multi[n] = mbinylo_multi[n] - 1;
coord = bsubboxhi[1] + SMALL*bbox[1];
mbinyhi = static_cast<int> ((coord-bboxlo[1])*bininvy_multi[n]);
if (dimension == 3) {
coord = bsubboxlo[2] - SMALL*bbox[2];
mbinzlo_multi[n] = static_cast<int> ((coord-bboxlo[2])*bininvz_multi[n]);
if (coord < bboxlo[2]) mbinzlo_multi[n] = mbinzlo_multi[n] - 1;
coord = bsubboxhi[2] + SMALL*bbox[2];
mbinzhi = static_cast<int> ((coord-bboxlo[2])*bininvz_multi[n]);
}
// extend bins by 1 to insure stencil extent is included
// for 2d, only 1 bin in z
mbinxlo_multi[n] = mbinxlo_multi[n] - 1;
mbinxhi = mbinxhi + 1;
mbinx_multi[n] = mbinxhi - mbinxlo_multi[n] + 1;
mbinylo_multi[n] = mbinylo_multi[n] - 1;
mbinyhi = mbinyhi + 1;
mbiny_multi[n] = mbinyhi - mbinylo_multi[n] + 1;
if (dimension == 3) {
mbinzlo_multi[n] = mbinzlo_multi[n] - 1;
mbinzhi = mbinzhi + 1;
} else mbinzlo_multi[n] = mbinzhi = 0;
mbinz_multi[n] = mbinzhi - mbinzlo_multi[n] + 1;
bigint bbin = ((bigint) mbinx_multi[n])
* ((bigint) mbiny_multi[n]) * ((bigint) mbinz_multi[n]) + 1;
if (bbin > MAXSMALLINT) error->one(FLERR,"Too many neighbor bins");
mbins_multi[n] = bbin;
}
}
/* ----------------------------------------------------------------------
bin owned and ghost atoms by type
------------------------------------------------------------------------- */
void NBinMulti::bin_atoms()
{
int i,ibin,n;
last_bin = update->ntimestep;
for (n = 0; n < ncollections; n++) {
for (i = 0; i < mbins_multi[n]; i++) binhead_multi[n][i] = -1;
}
// bin in reverse order so linked list will be in forward order
// also puts ghost atoms at end of list, which is necessary
int *collection = neighbor->collection;
double **x = atom->x;
int *mask = atom->mask;
int nlocal = atom->nlocal;
int nall = nlocal + atom->nghost;
if (includegroup) {
int bitmask = group->bitmask[includegroup];
for (i = nall-1; i >= nlocal; i--) {
if (mask[i] & bitmask) {
n = collection[i];
ibin = coord2bin_multi(x[i], n);
atom2bin[i] = ibin;
bins[i] = binhead_multi[n][ibin];
binhead_multi[n][ibin] = i;
}
}
for (i = atom->nfirst-1; i >= 0; i--) {
n = collection[i];
ibin = coord2bin_multi(x[i], n);
atom2bin[i] = ibin;
bins[i] = binhead_multi[n][ibin];
binhead_multi[n][ibin] = i;
}
} else {
for (i = nall-1; i >= 0; i--) {
n = collection[i];
ibin = coord2bin_multi(x[i], n);
atom2bin[i] = ibin;
bins[i] = binhead_multi[n][ibin];
binhead_multi[n][ibin] = i;
}
}
}
/* ---------------------------------------------------------------------- */
double NBinMulti::memory_usage()
{
double bytes = 0;
for (int m = 0; m < maxcollections; m++)
bytes += (double)maxbins_multi[m]*sizeof(int);
bytes += (double)2*maxatom*sizeof(int);
return bytes;
}

63
src/nbin_multi.h Normal file
View File

@ -0,0 +1,63 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NBIN_CLASS
NBinStyle(multi,
NBinMulti,
NB_MULTI)
#else
#ifndef LMP_NBIN_MULTI_H
#define LMP_NBIN_MULTI_H
#include "nbin.h"
namespace LAMMPS_NS {
class NBinMulti : public NBin {
public:
NBinMulti(class LAMMPS *);
~NBinMulti() {}
void bin_atoms_setup(int);
void setup_bins(int);
void bin_atoms();
double memory_usage();
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Domain too large for neighbor bins
UNDOCUMENTED
E: Cannot use neighbor bins - box size << cutoff
UNDOCUMENTED
E: Too many neighbor bins
UNDOCUMENTED
E Non-numeric positions - simulation unstable
UNDOCUMENTED
*/

View File

@ -19,6 +19,7 @@
#include "comm.h" #include "comm.h"
#include "update.h" #include "update.h"
#include "error.h" #include "error.h"
#include "memory.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -29,6 +30,33 @@ using namespace LAMMPS_NS;
NBinStandard::NBinStandard(LAMMPS *lmp) : NBin(lmp) {} NBinStandard::NBinStandard(LAMMPS *lmp) : NBin(lmp) {}
/* ----------------------------------------------------------------------
setup for bin_atoms()
------------------------------------------------------------------------- */
void NBinStandard::bin_atoms_setup(int nall)
{
// binhead = per-bin vector, mbins in length
// add 1 bin for USER-INTEL package
if (mbins > maxbin) {
maxbin = mbins;
memory->destroy(binhead);
memory->create(binhead,maxbin,"neigh:binhead");
}
// bins and atom2bin = per-atom vectors
// for both local and ghost atoms
if (nall > maxatom) {
maxatom = nall;
memory->destroy(bins);
memory->create(bins,maxatom,"neigh:bins");
memory->destroy(atom2bin);
memory->create(atom2bin,maxatom,"neigh:atom2bin");
}
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
setup neighbor binning geometry setup neighbor binning geometry
bin numbering in each dimension is global: bin numbering in each dimension is global:
@ -87,7 +115,7 @@ void NBinStandard::setup_bins(int style)
// optimal bin size is roughly 1/2 the cutoff // optimal bin size is roughly 1/2 the cutoff
// for BIN style, binsize = 1/2 of max neighbor cutoff // for BIN style, binsize = 1/2 of max neighbor cutoff
// for MULTI style, binsize = 1/2 of min neighbor cutoff // for MULTI_OLD style, binsize = 1/2 of min neighbor cutoff
// special case of all cutoffs = 0.0, binsize = box size // special case of all cutoffs = 0.0, binsize = box size
double binsize_optimal; double binsize_optimal;
@ -230,3 +258,13 @@ void NBinStandard::bin_atoms()
} }
} }
} }
/* ---------------------------------------------------------------------- */
double NBinStandard::memory_usage()
{
double bytes = 0;
bytes += (double)maxbin*sizeof(int);
bytes += (double)2*maxatom*sizeof(int);
return bytes;
}

View File

@ -15,7 +15,7 @@
NBinStyle(standard, NBinStyle(standard,
NBinStandard, NBinStandard,
0) NB_STANDARD)
#else #else
@ -30,8 +30,10 @@ class NBinStandard : public NBin {
public: public:
NBinStandard(class LAMMPS *); NBinStandard(class LAMMPS *);
~NBinStandard() {} ~NBinStandard() {}
void bin_atoms_setup(int);
void setup_bins(int); void setup_bins(int);
void bin_atoms(); void bin_atoms();
double memory_usage();
}; };
} }

View File

@ -13,6 +13,7 @@
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
Contributing author (triclinic and multi-neigh) : Pieter in 't Veld (SNL) Contributing author (triclinic and multi-neigh) : Pieter in 't Veld (SNL)
Contributing author (improved multi-neigh) : Joel Clemmer (SNL)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "neighbor.h" #include "neighbor.h"
@ -43,6 +44,7 @@
#include "style_npair.h" #include "style_npair.h"
#include "style_nstencil.h" #include "style_nstencil.h"
#include "style_ntopo.h" #include "style_ntopo.h"
#include "tokenizer.h"
#include "update.h" #include "update.h"
#include <cmath> #include <cmath>
@ -53,13 +55,14 @@ using namespace NeighConst;
#define RQDELTA 1 #define RQDELTA 1
#define EXDELTA 1 #define EXDELTA 1
#define DELTA_PERATOM 64
#define BIG 1.0e20 #define BIG 1.0e20
enum{NONE,ALL,PARTIAL,TEMPLATE}; enum{NONE,ALL,PARTIAL,TEMPLATE};
static const char cite_neigh_multi[] = static const char cite_neigh_multi_old[] =
"neighbor multi command:\n\n" "neighbor multi/old command: doi:10.1016/j.cpc.2008.03.005\n\n"
"@Article{Intveld08,\n" "@Article{Intveld08,\n"
" author = {P.{\\,}J.~in{\\,}'t~Veld and S.{\\,}J.~Plimpton" " author = {P.{\\,}J.~in{\\,}'t~Veld and S.{\\,}J.~Plimpton"
" and G.{\\,}S.~Grest},\n" " and G.{\\,}S.~Grest},\n"
@ -71,6 +74,31 @@ static const char cite_neigh_multi[] =
" pages = {320--329}\n" " pages = {320--329}\n"
"}\n\n"; "}\n\n";
static const char cite_neigh_multi[] =
"neighbor multi command: doi:10.1016/j.cpc.2008.03.005, doi:10.1007/s40571-020-00361-2\n\n"
"@Article{Intveld08,\n"
" author = {P.{\\,}J.~in{\\,}'t~Veld and S.{\\,}J.~Plimpton"
" and G.{\\,}S.~Grest},\n"
" title = {Accurate and Efficient Methods for Modeling Colloidal\n"
" Mixtures in an Explicit Solvent using Molecular Dynamics},\n"
" journal = {Comp.~Phys.~Comm.},\n"
" year = 2008,\n"
" volume = 179,\n"
" pages = {320--329}\n"
"}\n\n"
"@article{Stratford2018,\n"
" author = {Stratford, Kevin and Shire, Tom and Hanley, Kevin},\n"
" title = {Implementation of multi-level contact detection in LAMMPS},\n"
" year = {2018}\n"
"}\n\n"
"@article{Shire2020,\n"
" author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin},\n"
" title = {DEM simulations of polydisperse media: efficient contact\n"
" detection applied to investigate the quasi-static limit},\n"
" journal = {Computational Particle Mechanics},\n"
" year = {2020}\n"
"}\n\n";
//#define NEIGH_LIST_DEBUG 1 //#define NEIGH_LIST_DEBUG 1
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -168,6 +196,16 @@ pairclass(nullptr), pairnames(nullptr), pairmasks(nullptr)
nex_mol = maxex_mol = 0; nex_mol = maxex_mol = 0;
ex_mol_group = ex_mol_bit = ex_mol_intra = nullptr; ex_mol_group = ex_mol_bit = ex_mol_intra = nullptr;
// Multi data
type2collection = nullptr;
collection2cut = nullptr;
collection = nullptr;
cutcollectionsq = nullptr;
custom_collection_flag = 0;
interval_collection_flag = 0;
nmax_collection = 0;
// Kokkos setting // Kokkos setting
copymode = 0; copymode = 0;
@ -233,6 +271,11 @@ Neighbor::~Neighbor()
memory->destroy(ex_mol_group); memory->destroy(ex_mol_group);
delete [] ex_mol_bit; delete [] ex_mol_bit;
memory->destroy(ex_mol_intra); memory->destroy(ex_mol_intra);
memory->destroy(type2collection);
memory->destroy(collection2cut);
memory->destroy(collection);
memory->destroy(cutcollectionsq);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -316,6 +359,101 @@ void Neighbor::init()
} }
cutneighmaxsq = cutneighmax * cutneighmax; cutneighmaxsq = cutneighmax * cutneighmax;
// Define cutoffs for multi
if (style == Neighbor::MULTI) {
int icollection, jcollection;
// If collections not yet defined, create default map using types
if (not custom_collection_flag) {
ncollections = n;
interval_collection_flag = 0;
if (not type2collection)
memory->create(type2collection,n+1,"neigh:type2collection");
for (i = 1; i <= n; i++)
type2collection[i] = i-1;
}
memory->grow(cutcollectionsq, ncollections, ncollections, "neigh:cutcollectionsq");
// 3 possible ways of defining collections
// 1) Types are used to define collections
// Each collection loops through its owned types, and uses cutneighsq to calculate its cutoff
// 2) Collections are defined by intervals, point particles
// Types are first sorted into collections based on cutneighsq[i][i]
// Each collection loops through its owned types, and uses cutneighsq to calculate its cutoff
// 3) Collections are defined by intervals, finite particles
//
// Define collection cutoffs
for (i = 0; i < ncollections; i++)
for (j = 0; j < ncollections; j++)
cutcollectionsq[i][j] = 0.0;
if (not interval_collection_flag) {
finite_cut_flag = 0;
for (i = 1; i <= n; i++){
icollection = type2collection[i];
for (j = 1; j <= n; j++){
jcollection = type2collection[j];
if (cutneighsq[i][j] > cutcollectionsq[icollection][jcollection]) {
cutcollectionsq[icollection][jcollection] = cutneighsq[i][j];
cutcollectionsq[jcollection][icollection] = cutneighsq[i][j];
}
}
}
} else {
if (force->pair->finitecutflag) {
finite_cut_flag = 1;
// If cutoffs depend on finite atom sizes, use radii of intervals to find cutoffs
double ri, rj, tmp;
for (i = 0; i < ncollections; i++){
ri = collection2cut[i]*0.5;
for (j = 0; j < ncollections; j++){
rj = collection2cut[j]*0.5;
tmp = force->pair->radii2cut(ri, rj) + skin;
cutcollectionsq[i][j] = tmp*tmp;
}
}
} else {
finite_cut_flag = 0;
// Map types to collections
if (not type2collection)
memory->create(type2collection,n+1,"neigh:type2collection");
for (i = 1; i <= n; i++)
type2collection[i] = -1;
double cuttmp;
for (i = 1; i <= n; i++){
// Remove skin added to cutneighsq
cuttmp = sqrt(cutneighsq[i][i]) - skin;
for (icollection = 0; icollection < ncollections; icollection ++){
if (collection2cut[icollection] >= cuttmp) {
type2collection[i] = icollection;
break;
}
}
if (type2collection[i] == -1)
error->all(FLERR, "Pair cutoff exceeds interval cutoffs for multi");
}
// Define cutoffs
for (i = 1; i <= n; i++){
icollection = type2collection[i];
for (j = 1; j <= n; j++){
jcollection = type2collection[j];
if (cutneighsq[i][j] > cutcollectionsq[icollection][jcollection]) {
cutcollectionsq[icollection][jcollection] = cutneighsq[i][j];
cutcollectionsq[jcollection][icollection] = cutneighsq[i][j];
}
}
}
}
}
}
// rRESPA cutoffs // rRESPA cutoffs
int respa = 0; int respa = 0;
@ -1621,6 +1759,13 @@ int Neighbor::choose_bin(NeighRequest *rq)
if (!rq->kokkos_device != !(mask & NB_KOKKOS_DEVICE)) continue; if (!rq->kokkos_device != !(mask & NB_KOKKOS_DEVICE)) continue;
if (!rq->kokkos_host != !(mask & NB_KOKKOS_HOST)) continue; if (!rq->kokkos_host != !(mask & NB_KOKKOS_HOST)) continue;
// multi neighbor style require multi bin style
if (style == Neighbor::MULTI) {
if (!(mask & NB_MULTI)) continue;
} else {
if (!(mask & NB_STANDARD)) continue;
}
return i+1; return i+1;
} }
@ -1653,9 +1798,14 @@ int Neighbor::choose_stencil(NeighRequest *rq)
else if (rq->newton == 1) newtflag = 1; else if (rq->newton == 1) newtflag = 1;
else if (rq->newton == 2) newtflag = 0; else if (rq->newton == 2) newtflag = 0;
//printf("STENCIL RQ FLAGS: hff %d %d n %d g %d s %d newtflag %d\n", // request a full stencil if building full neighbor list or newton is off
int fullflag = 0;
if (rq->full) fullflag = 1;
if (!newtflag) fullflag = 1;
//printf("STENCIL RQ FLAGS: hff %d %d n %d g %d s %d newtflag %d fullflag %d\n",
// rq->half,rq->full,rq->newton,rq->ghost,rq->ssa, // rq->half,rq->full,rq->newton,rq->ghost,rq->ssa,
// newtflag); // newtflag, fullflag);
// use request and system settings to match exactly one NStencil class mask // use request and system settings to match exactly one NStencil class mask
// checks are bitwise using NeighConst bit masks // checks are bitwise using NeighConst bit masks
@ -1665,24 +1815,15 @@ int Neighbor::choose_stencil(NeighRequest *rq)
for (int i = 0; i < nsclass; i++) { for (int i = 0; i < nsclass; i++) {
mask = stencilmasks[i]; mask = stencilmasks[i];
//printf("III %d: half %d full %d newton %d newtoff %d ghost %d ssa %d\n", //printf("III %d: half %d full %d ghost %d ssa %d\n",
// i,mask & NS_HALF,mask & NS_FULL,mask & NS_NEWTON, // i,mask & NS_HALF,mask & NS_FULL,mask & NS_GHOST,mask & NS_SSA);
// mask & NS_NEWTOFF,mask & NS_GHOST,mask & NS_SSA);
// exactly one of half or full is set and must match // exactly one of half or full is set and must match
if (rq->half) { if (fullflag) {
if (!(mask & NS_HALF)) continue;
} else if (rq->full) {
if (!(mask & NS_FULL)) continue; if (!(mask & NS_FULL)) continue;
} } else {
if (!(mask & NS_HALF)) continue;
// newtflag is on or off and must match
if (newtflag) {
if (!(mask & NS_NEWTON)) continue;
} else if (!newtflag) {
if (!(mask & NS_NEWTOFF)) continue;
} }
// require match of these request flags and mask bits // require match of these request flags and mask bits
@ -1691,10 +1832,12 @@ int Neighbor::choose_stencil(NeighRequest *rq)
if (!rq->ghost != !(mask & NS_GHOST)) continue; if (!rq->ghost != !(mask & NS_GHOST)) continue;
if (!rq->ssa != !(mask & NS_SSA)) continue; if (!rq->ssa != !(mask & NS_SSA)) continue;
// neighbor style is BIN or MULTI and must match // neighbor style is one of BIN, MULTI_OLD, or MULTI and must match
if (style == Neighbor::BIN) { if (style == Neighbor::BIN) {
if (!(mask & NS_BIN)) continue; if (!(mask & NS_BIN)) continue;
} else if (style == Neighbor::MULTI_OLD) {
if (!(mask & NS_MULTI_OLD)) continue;
} else if (style == Neighbor::MULTI) { } else if (style == Neighbor::MULTI) {
if (!(mask & NS_MULTI)) continue; if (!(mask & NS_MULTI)) continue;
} }
@ -1826,12 +1969,14 @@ int Neighbor::choose_pair(NeighRequest *rq)
if (!rq->halffull != !(mask & NP_HALF_FULL)) continue; if (!rq->halffull != !(mask & NP_HALF_FULL)) continue;
if (!rq->off2on != !(mask & NP_OFF2ON)) continue; if (!rq->off2on != !(mask & NP_OFF2ON)) continue;
// neighbor style is one of NSQ,BIN,MULTI and must match // neighbor style is one of NSQ, BIN, MULTI_OLD, or MULTI and must match
if (style == Neighbor::NSQ) { if (style == Neighbor::NSQ) {
if (!(mask & NP_NSQ)) continue; if (!(mask & NP_NSQ)) continue;
} else if (style == Neighbor::BIN) { } else if (style == Neighbor::BIN) {
if (!(mask & NP_BIN)) continue; if (!(mask & NP_BIN)) continue;
} else if (style == Neighbor::MULTI_OLD) {
if (!(mask & NP_MULTI_OLD)) continue;
} else if (style == Neighbor::MULTI) { } else if (style == Neighbor::MULTI) {
if (!(mask & NP_MULTI)) continue; if (!(mask & NP_MULTI)) continue;
} }
@ -2030,6 +2175,8 @@ void Neighbor::build(int topoflag)
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
int nall = nlocal + atom->nghost; int nall = nlocal + atom->nghost;
// rebuild collection array from scratch
if (style == Neighbor::MULTI) build_collection(0);
// check that using special bond flags will not overflow neigh lists // check that using special bond flags will not overflow neigh lists
@ -2202,9 +2349,13 @@ void Neighbor::set(int narg, char **arg)
if (strcmp(arg[1],"nsq") == 0) style = Neighbor::NSQ; if (strcmp(arg[1],"nsq") == 0) style = Neighbor::NSQ;
else if (strcmp(arg[1],"bin") == 0) style = Neighbor::BIN; else if (strcmp(arg[1],"bin") == 0) style = Neighbor::BIN;
else if (strcmp(arg[1],"multi") == 0) style = Neighbor::MULTI; else if (strcmp(arg[1],"multi") == 0) {
style = Neighbor::MULTI;
ncollections = atom->ntypes;
} else if (strcmp(arg[1],"multi/old") == 0) style = Neighbor::MULTI_OLD;
else error->all(FLERR,"Illegal neighbor command"); else error->all(FLERR,"Illegal neighbor command");
if (style == Neighbor::MULTI_OLD && lmp->citeme) lmp->citeme->add(cite_neigh_multi_old);
if (style == Neighbor::MULTI && lmp->citeme) lmp->citeme->add(cite_neigh_multi); if (style == Neighbor::MULTI && lmp->citeme) lmp->citeme->add(cite_neigh_multi);
} }
@ -2351,7 +2502,97 @@ void Neighbor::modify_params(int narg, char **arg)
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal neigh_modify command"); } else error->all(FLERR,"Illegal neigh_modify command");
} else if (strcmp(arg[iarg],"collection/interval") == 0) {
if (style != Neighbor::MULTI)
error->all(FLERR,"Cannot use collection/interval command without multi setting");
if (iarg+2 > narg)
error->all(FLERR,"Invalid collection/interval command");
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (ncollections < 1)
error->all(FLERR,"Invalid collection/interval command");
if (iarg+1+ncollections > narg)
error->all(FLERR,"Invalid collection/interval command");
int i;
// Invalidate old user cutoffs
comm->ncollections_cutoff = 0;
interval_collection_flag = 1;
custom_collection_flag = 1;
memory->grow(collection2cut,ncollections,"neigh:collection2cut");
// Set upper cutoff for each collection
double cut_interval;
for (i = 0; i < ncollections; i++){
cut_interval = utils::numeric(FLERR,arg[iarg+2+i],false,lmp);
collection2cut[i] = cut_interval;
if (i != 0)
if (collection2cut[i-1] >= collection2cut[i])
error->all(FLERR,"Nonsequential interval cutoffs in collection/interval setting");
}
iarg += 2 + ncollections;
} else if (strcmp(arg[iarg],"collection/type") == 0) {
if (style != Neighbor::MULTI)
error->all(FLERR,"Cannot use collection/type command without multi setting");
if (iarg+2 > narg)
error->all(FLERR,"Invalid collection/type command");
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (ncollections < 1)
error->all(FLERR,"Invalid collection/interval command");
if (iarg+1+ncollections > narg)
error->all(FLERR,"Invalid collection/type command");
int ntypes = atom->ntypes;
int n, nlo, nhi, i, j, k;
// Invalidate old user cutoffs
comm->ncollections_cutoff = 0;
interval_collection_flag = 0;
custom_collection_flag = 1;
if (not type2collection)
memory->create(type2collection,ntypes+1,"neigh:type2collection");
// Erase previous mapping
for (i = 1; i <= ntypes; i++)
type2collection[i] = -1;
// For each custom range, define mapping for types in interval
int nfield;
char *str;
for (i = 0; i < ncollections; i++){
n = strlen(arg[iarg+2+i]) + 1;
str = new char[n];
strcpy(str,arg[iarg+2+i]);
std::vector<std::string> words = Tokenizer(str, ",").as_vector();
nfield = words.size();
for (j = 0; j < nfield; j++) {
const char * field = words[j].c_str();
utils::bounds(FLERR,field,1,ntypes,nlo,nhi,error);
for (k = nlo; k <= nhi; k++) {
if (type2collection[k] != -1)
error->all(FLERR,"Type specified more than once in collection/type commnd");
type2collection[k] = i;
}
}
delete [] str;
}
// Check for undefined atom type
for (i = 1; i <= ntypes; i++){
if (type2collection[i] == -1) {
error->all(FLERR,"Type missing in collection/type commnd");
}
}
iarg += 2 + ncollections;
} else error->all(FLERR,"Illegal neigh_modify command"); } else error->all(FLERR,"Illegal neigh_modify command");
} }
} }
@ -2406,6 +2647,59 @@ int Neighbor::exclude_setting()
return exclude; return exclude;
} }
/* ----------------------------------------------------------------------
check if any of the old requested neighbor lists are full
------------------------------------------------------------------------- */
int Neighbor::any_full()
{
int any_full = 0;
for (int i = 0; i < old_nrequest; i++) {
if (old_requests[i]->full) any_full = 1;
}
return any_full;
}
/* ----------------------------------------------------------------------
populate collection array for multi starting at the index istart
------------------------------------------------------------------------- */
void Neighbor::build_collection(int istart)
{
if (style != Neighbor::MULTI)
error->all(FLERR, "Cannot define atom collections without neighbor style multi");
int nmax = atom->nlocal+atom->nghost;
if (nmax > nmax_collection) {
nmax_collection = nmax+DELTA_PERATOM;
memory->grow(collection, nmax_collection, "neigh:collection");
}
if (finite_cut_flag) {
double cut;
int icollection;
for (int i = istart; i < nmax; i++){
cut = force->pair->atom2cut(i);
collection[i] = -1;
for (icollection = 0; icollection < ncollections; icollection++){
if (collection2cut[icollection] >= cut) {
collection[i] = icollection;
break;
}
}
if (collection[i] == -1)
error->one(FLERR, "Atom cutoff exceeds interval cutoffs for multi");
}
} else {
int *type = atom->type;
for (int i = istart; i < nmax; i++){
collection[i] = type2collection[type[i]];
}
}
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
return # of bytes of allocated memory return # of bytes of allocated memory
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -20,8 +20,8 @@ namespace LAMMPS_NS {
class Neighbor : protected Pointers { class Neighbor : protected Pointers {
public: public:
enum{NSQ,BIN,MULTI}; enum{NSQ,BIN,MULTI_OLD,MULTI};
int style; // 0,1,2 = nsq, bin, multi int style; // 0,1,2,3 = nsq, bin, multi/old, multi
int every; // build every this many steps int every; // build every this many steps
int delay; // delay build for this many steps int delay; // delay build for this many steps
int dist_check; // 0 = always build, 1 = only if 1/2 dist int dist_check; // 0 = always build, 1 = only if 1/2 dist
@ -102,6 +102,18 @@ class Neighbor : protected Pointers {
int nimproperlist; // list of impropers to compute int nimproperlist; // list of impropers to compute
int **improperlist; int **improperlist;
// optional type grouping for multi
int custom_collection_flag; // 1 if custom collections are defined for multi
int interval_collection_flag; // 1 if custom collections use intervals
int finite_cut_flag; // 1 if multi considers finite atom size
int ncollections; // # of custom collections
int nmax_collection; // maximum atoms stored in collection array
int *type2collection; // ntype array mapping types to custom collections
double *collection2cut; // ncollection array with upper bounds on cutoff intervals
double **cutcollectionsq; // cutoffs for each combination of collections
int *collection; // local per-atom array to store collection id
// public methods // public methods
Neighbor(class LAMMPS *); Neighbor(class LAMMPS *);
@ -123,6 +135,8 @@ class Neighbor : protected Pointers {
void exclusion_group_group_delete(int, int); // rm a group-group exclusion void exclusion_group_group_delete(int, int); // rm a group-group exclusion
int exclude_setting(); // return exclude value to accelerator pkg int exclude_setting(); // return exclude value to accelerator pkg
class NeighRequest *find_request(void *); // find a neighbor request class NeighRequest *find_request(void *); // find a neighbor request
int any_full(); // Check if any old requests had full neighbor lists
void build_collection(int); // build peratom collection array starting at the given index
double memory_usage(); double memory_usage();
@ -240,7 +254,9 @@ namespace NeighConst {
NB_INTEL = 1<<0, NB_INTEL = 1<<0,
NB_KOKKOS_DEVICE = 1<<1, NB_KOKKOS_DEVICE = 1<<1,
NB_KOKKOS_HOST = 1<<2, NB_KOKKOS_HOST = 1<<2,
NB_SSA = 1<<3 NB_SSA = 1<<3,
NB_STANDARD = 1<<4,
NB_MULTI = 1<<5
}; };
enum { enum {
@ -250,12 +266,11 @@ namespace NeighConst {
NS_FULL = 1<<3, NS_FULL = 1<<3,
NS_2D = 1<<4, NS_2D = 1<<4,
NS_3D = 1<<5, NS_3D = 1<<5,
NS_NEWTON = 1<<6, NS_ORTHO = 1<<6,
NS_NEWTOFF = 1<<7, NS_TRI = 1<<7,
NS_ORTHO = 1<<8, NS_GHOST = 1<<8,
NS_TRI = 1<<9, NS_SSA = 1<<9,
NS_GHOST = 1<<10, NS_MULTI_OLD = 1<<10
NS_SSA = 1<<11
}; };
enum { enum {
@ -283,7 +298,8 @@ namespace NeighConst {
NP_COPY = 1<<21, NP_COPY = 1<<21,
NP_SKIP = 1<<22, NP_SKIP = 1<<22,
NP_HALF_FULL = 1<<23, NP_HALF_FULL = 1<<23,
NP_OFF2ON = 1<<24 NP_OFF2ON = 1<<24,
NP_MULTI_OLD = 1<<25
}; };
} }

View File

@ -95,6 +95,11 @@ void NPair::copy_neighbor_info()
special_flag = neighbor->special_flag; special_flag = neighbor->special_flag;
// multi info
ncollections = neighbor->ncollections;
cutcollectionsq = neighbor->cutcollectionsq;
// overwrite per-type Neighbor cutoffs with custom value set by requestor // overwrite per-type Neighbor cutoffs with custom value set by requestor
// only works for style = BIN (checked by Neighbor class) // only works for style = BIN (checked by Neighbor class)
@ -134,6 +139,23 @@ void NPair::copy_bin_info()
atom2bin = nb->atom2bin; atom2bin = nb->atom2bin;
bins = nb->bins; bins = nb->bins;
binhead = nb->binhead; binhead = nb->binhead;
nbinx_multi = nb->nbinx_multi;
nbiny_multi = nb->nbiny_multi;
nbinz_multi = nb->nbinz_multi;
mbins_multi = nb->mbins_multi;
mbinx_multi = nb->mbinx_multi;
mbiny_multi = nb->mbiny_multi;
mbinz_multi = nb->mbinz_multi;
mbinxlo_multi = nb->mbinxlo_multi;
mbinylo_multi = nb->mbinylo_multi;
mbinzlo_multi = nb->mbinzlo_multi;
bininvx_multi = nb->bininvx_multi;
bininvy_multi = nb->bininvy_multi;
bininvz_multi = nb->bininvz_multi;
binhead_multi = nb->binhead_multi;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -145,9 +167,12 @@ void NPair::copy_stencil_info()
nstencil = ns->nstencil; nstencil = ns->nstencil;
stencil = ns->stencil; stencil = ns->stencil;
stencilxyz = ns->stencilxyz; stencilxyz = ns->stencilxyz;
nstencil_multi_old = ns->nstencil_multi_old;
stencil_multi_old = ns->stencil_multi_old;
distsq_multi_old = ns->distsq_multi_old;
nstencil_multi = ns->nstencil_multi; nstencil_multi = ns->nstencil_multi;
stencil_multi = ns->stencil_multi; stencil_multi = ns->stencil_multi;
distsq_multi = ns->distsq_multi;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -160,7 +185,6 @@ void NPair::build_setup()
if (ns) copy_stencil_info(); if (ns) copy_stencil_info();
// set here, since build_setup() always called before build() // set here, since build_setup() always called before build()
last_build = update->ntimestep; last_build = update->ntimestep;
} }
@ -241,3 +265,46 @@ int NPair::coord2bin(double *x, int &ix, int &iy, int &iz)
return iz*mbiny*mbinx + iy*mbinx + ix; return iz*mbiny*mbinx + iy*mbinx + ix;
} }
/* ----------------------------------------------------------------------
multi version of coord2bin for a given collection
------------------------------------------------------------------------- */
int NPair::coord2bin(double *x, int ic)
{
int ix,iy,iz;
int ibin;
if (!std::isfinite(x[0]) || !std::isfinite(x[1]) || !std::isfinite(x[2]))
error->one(FLERR,"Non-numeric positions - simulation unstable");
if (x[0] >= bboxhi[0])
ix = static_cast<int> ((x[0]-bboxhi[0])*bininvx_multi[ic]) + nbinx_multi[ic];
else if (x[0] >= bboxlo[0]) {
ix = static_cast<int> ((x[0]-bboxlo[0])*bininvx_multi[ic]);
ix = MIN(ix,nbinx_multi[ic]-1);
} else
ix = static_cast<int> ((x[0]-bboxlo[0])*bininvx_multi[ic]) - 1;
if (x[1] >= bboxhi[1])
iy = static_cast<int> ((x[1]-bboxhi[1])*bininvy_multi[ic]) + nbiny_multi[ic];
else if (x[1] >= bboxlo[1]) {
iy = static_cast<int> ((x[1]-bboxlo[1])*bininvy_multi[ic]);
iy = MIN(iy,nbiny_multi[ic]-1);
} else
iy = static_cast<int> ((x[1]-bboxlo[1])*bininvy_multi[ic]) - 1;
if (x[2] >= bboxhi[2])
iz = static_cast<int> ((x[2]-bboxhi[2])*bininvz_multi[ic]) + nbinz_multi[ic];
else if (x[2] >= bboxlo[2]) {
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz_multi[ic]);
iz = MIN(iz,nbinz_multi[ic]-1);
} else
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz_multi[ic]) - 1;
ix -= mbinxlo_multi[ic];
iy -= mbinylo_multi[ic];
iz -= mbinzlo_multi[ic];
ibin = iz*mbiny_multi[ic]*mbinx_multi[ic] + iy*mbinx_multi[ic] + ix;
return ibin;
}

View File

@ -48,6 +48,8 @@ class NPair : protected Pointers {
double cut_middle_sq; double cut_middle_sq;
double cut_middle_inside_sq; double cut_middle_inside_sq;
double *bboxlo,*bboxhi; double *bboxlo,*bboxhi;
int ncollections;
double **cutcollectionsq;
// exclusion data from Neighbor class // exclusion data from Neighbor class
@ -79,14 +81,24 @@ class NPair : protected Pointers {
int *atom2bin,*bins; int *atom2bin,*bins;
int *binhead; int *binhead;
int *nbinx_multi, *nbiny_multi, *nbinz_multi;
int *mbins_multi;
int *mbinx_multi, *mbiny_multi, *mbinz_multi;
int *mbinxlo_multi, *mbinylo_multi, *mbinzlo_multi;
double *bininvx_multi, *bininvy_multi, *bininvz_multi;
int **binhead_multi;
// data from NStencil class // data from NStencil class
int nstencil; int nstencil;
int *stencil; int *stencil;
int **stencilxyz; int **stencilxyz;
int *nstencil_multi; int *nstencil_multi_old;
int **stencil_multi; int **stencil_multi_old;
double **distsq_multi; double **distsq_multi_old;
int ** nstencil_multi;
int *** stencil_multi;
// data common to all NPair variants // data common to all NPair variants
@ -102,6 +114,9 @@ class NPair : protected Pointers {
int coord2bin(double *); // mapping atom coord to a bin int coord2bin(double *); // mapping atom coord to a bin
int coord2bin(double *, int &, int &, int&); // ditto int coord2bin(double *, int &, int &, int&); // ditto
int coord2bin(double *, int); // mapping atom coord to group bin
// find_special: determine if atom j is in special list of atom i // find_special: determine if atom j is in special list of atom i
// if it is not, return 0 // if it is not, return 0
// if it is and special flag is 0 (both coeffs are 0.0), return -1 // if it is and special flag is 0 (both coeffs are 0.0), return -1

View File

@ -12,13 +12,15 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_full_multi.h" #include "npair_full_multi.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
#include "molecule.h"
#include "domain.h" #include "domain.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -28,18 +30,19 @@ NPairFullMulti::NPairFullMulti(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binned neighbor list construction for all neighbors binned neighbor list construction for all neighbors
multi-type stencil is itype dependent and is distance checked multi stencil is icollection-jcollection dependent
every neighbor pair appears in list of both atoms i and j every neighbor pair appears in list of both atoms i and j
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NPairFullMulti::build(NeighList *list) void NPairFullMulti::build(NeighList *list)
{ {
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
tagint tagprev; tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -67,8 +70,8 @@ void NPairFullMulti::build(NeighList *list)
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
n = 0; n = 0;
neighptr = ipage->vget(); neighptr = ipage->vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
@ -78,43 +81,51 @@ void NPairFullMulti::build(NeighList *list)
tagprev = tag[i] - iatom - 1; tagprev = tag[i] - iatom - 1;
} }
// loop over all atoms in other bins in stencil, including self
// skip if i,j neighbor cutoff is less than bin distance
// skip i = j
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (i == j) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if(icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { // loop over all atoms in surrounding bins in stencil including self
if (molecular != Atom::ATOMIC) { // skip i = j
if (!moltemplate) // use full stencil for all collection combinations
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0) s = stencil_multi[icollection][jcollection];
which = find_special(onemols[imol]->special[iatom], ns = nstencil_multi[icollection][jcollection];
onemols[imol]->nspecial[iatom],
tag[j]-tagprev); for (k = 0; k < ns; k++) {
else which = 0; js = binhead_multi[jcollection][jbin + s[k]];
if (which == 0) neighptr[n++] = j; for (j = js; j >= 0; j = bins[j]) {
else if (domain->minimum_image_check(delx,dely,delz)) if (i == j) continue;
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); jtype = type[j];
} else neighptr[n++] = j; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
}
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
} }
} }

View File

@ -0,0 +1,132 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "npair_full_multi_old.h"
#include "atom.h"
#include "atom_vec.h"
#include "domain.h"
#include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairFullMultiOld::NPairFullMultiOld(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction for all neighbors
multi-type stencil is itype dependent and is distance checked
every neighbor pair appears in list of both atoms i and j
------------------------------------------------------------------------- */
void NPairFullMultiOld::build(NeighList *list)
{
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
tagint *tag = atom->tag;
tagint *molecule = atom->molecule;
tagint **special = atom->special;
int **nspecial = atom->nspecial;
int nlocal = atom->nlocal;
if (includegroup) nlocal = atom->nfirst;
int *molindex = atom->molindex;
int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols;
if (molecular == Atom::TEMPLATE) moltemplate = 1;
else moltemplate = 0;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
MyPage<int> *ipage = list->ipage;
int inum = 0;
ipage->reset();
for (i = 0; i < nlocal; i++) {
n = 0;
neighptr = ipage->vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
if (moltemplate) {
imol = molindex[i];
iatom = molatom[i];
tagprev = tag[i] - iatom - 1;
}
// loop over all atoms in other bins in stencil, including self
// skip if i,j neighbor cutoff is less than bin distance
// skip i = j
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (i == j) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage->vgot(n);
if (ipage->status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
list->inum = inum;
list->gnum = 0;
}

View File

@ -11,26 +11,26 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#ifdef NSTENCIL_CLASS #ifdef NPAIR_CLASS
NStencilStyle(half/bin/3d/newtoff, NPairStyle(full/multi/old,
NStencilHalfBin3dNewtoff, NPairFullMultiOld,
NS_HALF | NS_BIN | NS_3D | NS_NEWTOFF | NS_ORTHO | NS_TRI) NP_FULL | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI)
#else #else
#ifndef LMP_NSTENCIL_HALF_BIN_3D_NEWTOFF_H #ifndef LMP_NPAIR_FULL_MULTI_OLD_H
#define LMP_NSTENCIL_HALF_BIN_3D_NEWTOFF_H #define LMP_NPAIR_FULL_MULTI_OLD_H
#include "nstencil.h" #include "npair.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class NStencilHalfBin3dNewtoff : public NStencil { class NPairFullMultiOld : public NPair {
public: public:
NStencilHalfBin3dNewtoff(class LAMMPS *); NPairFullMultiOld(class LAMMPS *);
~NStencilHalfBin3dNewtoff() {} ~NPairFullMultiOld() {}
void create(); void build(class NeighList *);
}; };
} }
@ -40,4 +40,8 @@ class NStencilHalfBin3dNewtoff : public NStencil {
/* ERROR/WARNING messages: /* ERROR/WARNING messages:
E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/ */

View File

@ -12,13 +12,15 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_multi_newtoff.h" #include "npair_half_multi_newtoff.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
#include "molecule.h"
#include "domain.h" #include "domain.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -28,20 +30,21 @@ NPairHalfMultiNewtoff::NPairHalfMultiNewtoff(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binned neighbor list construction with partial Newton's 3rd law binned neighbor list construction with partial Newton's 3rd law
multi stencil is icollection-jcollection dependent
each owned atom i checks own bin and other bins in stencil each owned atom i checks own bin and other bins in stencil
multi-type stencil is itype dependent and is distance checked
pair stored once if i,j are both owned and i < j pair stored once if i,j are both owned and i < j
pair stored by me if j is ghost (also stored by proc owning j) pair stored by me if j is ghost (also stored by proc owning j)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NPairHalfMultiNewtoff::build(NeighList *list) void NPairHalfMultiNewtoff::build(NeighList *list)
{ {
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
tagint tagprev; tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -69,8 +72,8 @@ void NPairHalfMultiNewtoff::build(NeighList *list)
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
n = 0; n = 0;
neighptr = ipage->vget(); neighptr = ipage->vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
@ -80,44 +83,52 @@ void NPairHalfMultiNewtoff::build(NeighList *list)
tagprev = tag[i] - iatom - 1; tagprev = tag[i] - iatom - 1;
} }
// loop over all atoms in other bins in stencil including self
// only store pair if i < j
// skip if i,j neighbor cutoff is less than bin distance
// stores own/own pairs only once
// stores own/ghost pairs on both procs
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if (icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { // loop over all atoms in other bins in stencil including self
if (molecular != Atom::ATOMIC) { // only store pair if i < j
if (!moltemplate) // stores own/own pairs only once
which = find_special(special[i],nspecial[i],tag[j]); // stores own/ghost pairs on both procs
else if (imol >= 0) // use full stencil for all collection combinations
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom], s = stencil_multi[icollection][jcollection];
tag[j]-tagprev); ns = nstencil_multi[icollection][jcollection];
else which = 0;
if (which == 0) neighptr[n++] = j; for (k = 0; k < ns; k++) {
else if (domain->minimum_image_check(delx,dely,delz)) js = binhead_multi[jcollection][jbin + s[k]];
neighptr[n++] = j; for (j = js; j >= 0; j = bins[j]) {
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); if (j <= i) continue;
} else neighptr[n++] = j;
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
} }
} }
} }

View File

@ -12,13 +12,15 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_multi_newton.h" #include "npair_half_multi_newton.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
#include "molecule.h"
#include "domain.h" #include "domain.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -28,19 +30,20 @@ NPairHalfMultiNewton::NPairHalfMultiNewton(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binned neighbor list construction with full Newton's 3rd law binned neighbor list construction with full Newton's 3rd law
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in Newton stencil each owned atom i checks its own bin and other bins in Newton stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor every pair stored exactly once by some processor
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NPairHalfMultiNewton::build(NeighList *list) void NPairHalfMultiNewton::build(NeighList *list)
{ {
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
tagint tagprev; tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -54,7 +57,7 @@ void NPairHalfMultiNewton::build(NeighList *list)
int *molindex = atom->molindex; int *molindex = atom->molindex;
int *molatom = atom->molatom; int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols; Molecule **onemols = atom->avec->onemols;
if (molecular == Atom::TEMPLATE) moltemplate = 1; if (molecular == 2) moltemplate = 1;
else moltemplate = 0; else moltemplate = 0;
int *ilist = list->ilist; int *ilist = list->ilist;
@ -68,8 +71,8 @@ void NPairHalfMultiNewton::build(NeighList *list)
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
n = 0; n = 0;
neighptr = ipage->vget(); neighptr = ipage->vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
@ -79,80 +82,103 @@ void NPairHalfMultiNewton::build(NeighList *list)
tagprev = tag[i] - iatom - 1; tagprev = tag[i] - iatom - 1;
} }
// loop over rest of atoms in i's bin, ghosts are at end of linked list
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = bins[i]; j >= 0; j = bins[j]) {
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
// loop over all atoms in other bins in stencil, store every pair
// skip if i,j neighbor cutoff is less than bin distance
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if(icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { // if same size: uses half stencil so check central bin
if (molecular != Atom::ATOMIC) { if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]); if (icollection == jcollection) js = bins[i];
else if (imol >= 0) else js = binhead_multi[jcollection][jbin];
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom], // if same collection,
tag[j]-tagprev); // if j is owned atom, store it, since j is beyond i in linked list
else which = 0; // if j is ghost, only store if j coords are "above and to the right" of i
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz)) // if different collections,
neighptr[n++] = j; // if j is owned atom, store it if j > i
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); // if j is ghost, only store if j coords are "above and to the right" of i
} else neighptr[n++] = j;
} for (j = js; j >= 0; j = bins[j]) {
if((icollection != jcollection) && (j < i)) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
} }
// for all collections, loop over all atoms in other bins in stencil, store every pair
// stencil is empty if i larger than j
// stencil is half if i same size as j
// stencil is full if i smaller than j
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
} }
ilist[inum++] = i; ilist[inum++] = i;

View File

@ -40,8 +40,4 @@ class NPairHalfMultiNewton : public NPair {
/* ERROR/WARNING messages: /* ERROR/WARNING messages:
E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/ */

View File

@ -12,13 +12,15 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_multi_newton_tri.h" #include "npair_half_multi_newton_tri.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
#include "molecule.h"
#include "domain.h" #include "domain.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -28,19 +30,20 @@ NPairHalfMultiNewtonTri::NPairHalfMultiNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
binned neighbor list construction with Newton's 3rd law for triclinic binned neighbor list construction with Newton's 3rd law for triclinic
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in triclinic stencil each owned atom i checks its own bin and other bins in triclinic stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor every pair stored exactly once by some processor
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NPairHalfMultiNewtonTri::build(NeighList *list) void NPairHalfMultiNewtonTri::build(NeighList *list)
{ {
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
tagint tagprev; tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
int *type = atom->type; int *type = atom->type;
int *mask = atom->mask; int *mask = atom->mask;
@ -54,7 +57,7 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
int *molindex = atom->molindex; int *molindex = atom->molindex;
int *molatom = atom->molatom; int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols; Molecule **onemols = atom->avec->onemols;
if (molecular == Atom::TEMPLATE) moltemplate = 1; if (molecular == 2) moltemplate = 1;
else moltemplate = 0; else moltemplate = 0;
int *ilist = list->ilist; int *ilist = list->ilist;
@ -68,8 +71,8 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
n = 0; n = 0;
neighptr = ipage->vget(); neighptr = ipage->vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
@ -79,55 +82,68 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
tagprev = tag[i] - iatom - 1; tagprev = tag[i] - iatom - 1;
} }
// loop over all atoms in bins, including self, in stencil
// skip if i,j neighbor cutoff is less than bin distance
// bins below self are excluded from stencil
// pairs for atoms j "below" i are excluded
// below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype]; // loop through stencils for all collections
cutsq = cutneighsq[itype]; for (jcollection = 0; jcollection < ncollections; jcollection++) {
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) { // if same collection use own bin
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) { if (icollection == jcollection) jbin = ibin;
jtype = type[j]; else jbin = coord2bin(x[i], jcollection);
if (cutsq[jtype] < distsq[k]) continue;
if (x[j][2] < ztmp) continue; // loop over all atoms in bins in stencil
if (x[j][2] == ztmp) { // stencil is empty if i larger than j
if (x[j][1] < ytmp) continue; // stencil is half if i same size as j
if (x[j][1] == ytmp) { // stencil is full if i smaller than j
if (x[j][0] < xtmp) continue; // if half: pairs for atoms j "below" i are excluded
if (x[j][0] == xtmp && j <= i) continue; // below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
// if same size (same collection), use half stencil
if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp) {
if (x[j][0] < xtmp) continue;
if (x[j][0] == xtmp && j <= i) continue;
}
}
} }
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0]; delx = xtmp - x[j][0];
dely = ytmp - x[j][1]; dely = ytmp - x[j][1];
delz = ztmp - x[j][2]; delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) { if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) { if (molecular != Atom::ATOMIC) {
if (!moltemplate) if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]); which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0) else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom], which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom], onemols[imol]->nspecial[iatom],
tag[j]-tagprev); tag[j]-tagprev);
else which = 0; else which = 0;
if (which == 0) neighptr[n++] = j; if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz)) else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j; neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j; } else neighptr[n++] = j;
} }
} }
}
} }
ilist[inum++] = i; ilist[inum++] = i;

View File

@ -40,8 +40,4 @@ class NPairHalfMultiNewtonTri : public NPair {
/* ERROR/WARNING messages: /* ERROR/WARNING messages:
E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/ */

View File

@ -0,0 +1,135 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "npair_half_multi_old_newtoff.h"
#include "atom.h"
#include "atom_vec.h"
#include "domain.h"
#include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfMultiOldNewtoff::NPairHalfMultiOldNewtoff(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with partial Newton's 3rd law
each owned atom i checks own bin and other bins in stencil
multi-type stencil is itype dependent and is distance checked
pair stored once if i,j are both owned and i < j
pair stored by me if j is ghost (also stored by proc owning j)
------------------------------------------------------------------------- */
void NPairHalfMultiOldNewtoff::build(NeighList *list)
{
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
tagint *tag = atom->tag;
tagint *molecule = atom->molecule;
tagint **special = atom->special;
int **nspecial = atom->nspecial;
int nlocal = atom->nlocal;
if (includegroup) nlocal = atom->nfirst;
int *molindex = atom->molindex;
int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols;
if (molecular == Atom::TEMPLATE) moltemplate = 1;
else moltemplate = 0;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
MyPage<int> *ipage = list->ipage;
int inum = 0;
ipage->reset();
for (i = 0; i < nlocal; i++) {
n = 0;
neighptr = ipage->vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
if (moltemplate) {
imol = molindex[i];
iatom = molatom[i];
tagprev = tag[i] - iatom - 1;
}
// loop over all atoms in other bins in stencil including self
// only store pair if i < j
// skip if i,j neighbor cutoff is less than bin distance
// stores own/own pairs only once
// stores own/ghost pairs on both procs
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage->vgot(n);
if (ipage->status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
list->inum = inum;
}

View File

@ -0,0 +1,47 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/multi/old/newtoff,
NPairHalfMultiOldNewtoff,
NP_HALF | NP_MULTI_OLD | NP_NEWTOFF | NP_ORTHO | NP_TRI)
#else
#ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTOFF_H
#define LMP_NPAIR_HALF_MULTI_OLD_NEWTOFF_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfMultiOldNewtoff : public NPair {
public:
NPairHalfMultiOldNewtoff(class LAMMPS *);
~NPairHalfMultiOldNewtoff() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/

View File

@ -0,0 +1,168 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "npair_half_multi_old_newton.h"
#include "atom.h"
#include "atom_vec.h"
#include "domain.h"
#include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfMultiOldNewton::NPairHalfMultiOldNewton(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with full Newton's 3rd law
each owned atom i checks its own bin and other bins in Newton stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor
------------------------------------------------------------------------- */
void NPairHalfMultiOldNewton::build(NeighList *list)
{
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
tagint *tag = atom->tag;
tagint *molecule = atom->molecule;
tagint **special = atom->special;
int **nspecial = atom->nspecial;
int nlocal = atom->nlocal;
if (includegroup) nlocal = atom->nfirst;
int *molindex = atom->molindex;
int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols;
if (molecular == Atom::TEMPLATE) moltemplate = 1;
else moltemplate = 0;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
MyPage<int> *ipage = list->ipage;
int inum = 0;
ipage->reset();
for (i = 0; i < nlocal; i++) {
n = 0;
neighptr = ipage->vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
if (moltemplate) {
imol = molindex[i];
iatom = molatom[i];
tagprev = tag[i] - iatom - 1;
}
// loop over rest of atoms in i's bin, ghosts are at end of linked list
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = bins[i]; j >= 0; j = bins[j]) {
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
// loop over all atoms in other bins in stencil, store every pair
// skip if i,j neighbor cutoff is less than bin distance
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage->vgot(n);
if (ipage->status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
list->inum = inum;
}

View File

@ -0,0 +1,47 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/multi/old/newton,
NPairHalfMultiOldNewton,
NP_HALF | NP_MULTI_OLD | NP_NEWTON | NP_ORTHO)
#else
#ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTON_H
#define LMP_NPAIR_HALF_MULTI_OLD_NEWTON_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfMultiOldNewton : public NPair {
public:
NPairHalfMultiOldNewton(class LAMMPS *);
~NPairHalfMultiOldNewton() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/

View File

@ -0,0 +1,143 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "npair_half_multi_old_newton_tri.h"
#include "atom.h"
#include "atom_vec.h"
#include "domain.h"
#include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfMultiOldNewtonTri::NPairHalfMultiOldNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with Newton's 3rd law for triclinic
each owned atom i checks its own bin and other bins in triclinic stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor
------------------------------------------------------------------------- */
void NPairHalfMultiOldNewtonTri::build(NeighList *list)
{
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
int *type = atom->type;
int *mask = atom->mask;
tagint *tag = atom->tag;
tagint *molecule = atom->molecule;
tagint **special = atom->special;
int **nspecial = atom->nspecial;
int nlocal = atom->nlocal;
if (includegroup) nlocal = atom->nfirst;
int *molindex = atom->molindex;
int *molatom = atom->molatom;
Molecule **onemols = atom->avec->onemols;
if (molecular == Atom::TEMPLATE) moltemplate = 1;
else moltemplate = 0;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
MyPage<int> *ipage = list->ipage;
int inum = 0;
ipage->reset();
for (i = 0; i < nlocal; i++) {
n = 0;
neighptr = ipage->vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
if (moltemplate) {
imol = molindex[i];
iatom = molatom[i];
tagprev = tag[i] - iatom - 1;
}
// loop over all atoms in bins, including self, in stencil
// skip if i,j neighbor cutoff is less than bin distance
// bins below self are excluded from stencil
// pairs for atoms j "below" i are excluded
// below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp) {
if (x[j][0] < xtmp) continue;
if (x[j][0] == xtmp && j <= i) continue;
}
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq <= cutneighsq[itype][jtype]) {
if (molecular != Atom::ATOMIC) {
if (!moltemplate)
which = find_special(special[i],nspecial[i],tag[j]);
else if (imol >= 0)
which = find_special(onemols[imol]->special[iatom],
onemols[imol]->nspecial[iatom],
tag[j]-tagprev);
else which = 0;
if (which == 0) neighptr[n++] = j;
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage->vgot(n);
if (ipage->status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
list->inum = inum;
}

View File

@ -0,0 +1,47 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/multi/old/newton/tri,
NPairHalfMultiOldNewtonTri,
NP_HALF | NP_MULTI_OLD | NP_NEWTON | NP_TRI)
#else
#ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTON_TRI_H
#define LMP_NPAIR_HALF_MULTI_OLD_NEWTON_TRI_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfMultiOldNewtonTri : public NPair {
public:
NPairHalfMultiOldNewtonTri(class LAMMPS *);
~NPairHalfMultiOldNewtonTri() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/

View File

@ -5,17 +5,19 @@
Copyright (2003) Sandia Corporation. Under the terms of Contract Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under es certain rights in this software. This software is distributed under
the GNU General Public License. the GNU General Public License.
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include <string.h>
#include "npair_half_size_multi_newtoff.h" #include "npair_half_size_multi_newtoff.h"
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include "my_page.h" #include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -27,20 +29,21 @@ NPairHalfSizeMultiNewtoff::NPairHalfSizeMultiNewtoff(LAMMPS *lmp) : NPair(lmp) {
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
size particles size particles
binned neighbor list construction with partial Newton's 3rd law binned neighbor list construction with partial Newton's 3rd law
multi stencil is icollection-jcollection dependent
each owned atom i checks own bin and other bins in stencil each owned atom i checks own bin and other bins in stencil
multi-type stencil is itype dependent and is distance checked
pair stored once if i,j are both owned and i < j pair stored once if i,j are both owned and i < j
pair stored by me if j is ghost (also stored by proc owning j) pair stored by me if j is ghost (also stored by proc owning j)
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NPairHalfSizeMultiNewtoff::build(NeighList *list) void NPairHalfSizeMultiNewtoff::build(NeighList *list)
{ {
int i,j,k,n,itype,jtype,ibin,ns; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq; double radi,radsum,cutdistsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq; int js;
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
double *radius = atom->radius; double *radius = atom->radius;
int *type = atom->type; int *type = atom->type;
@ -63,45 +66,53 @@ void NPairHalfSizeMultiNewtoff::build(NeighList *list)
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
n = 0; n = 0;
neighptr = ipage->vget(); neighptr = ipage->vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
radi = radius[i]; radi = radius[i];
// loop over all atoms in other bins in stencil including self
// only store pair if i < j
// skip if i,j neighbor cutoff is less than bin distance
// stores own/own pairs only once
// stores own/ghost pairs on both procs
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if (icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) { // loop over all atoms in other bins in stencil including self
if (history && rsq < radsum*radsum) // only store pair if i < j
neighptr[n++] = j ^ mask_history; // stores own/own pairs only once
else // stores own/ghost pairs on both procs
neighptr[n++] = j; // use full stencil for all collection combinations
}
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
} }
} }

View File

@ -43,4 +43,5 @@ class NPairHalfSizeMultiNewtoff : public NPair {
E: Neighbor list overflow, boost neigh_modify one E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED UNDOCUMENTED
*/ */

View File

@ -16,6 +16,7 @@
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include "my_page.h" #include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -27,19 +28,19 @@ NPairHalfSizeMultiNewton::NPairHalfSizeMultiNewton(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
size particles size particles
binned neighbor list construction with full Newton's 3rd law binned neighbor list construction with full Newton's 3rd law
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in Newton stencil each owned atom i checks its own bin and other bins in Newton stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor every pair stored exactly once by some processor
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NPairHalfSizeMultiNewton::build(NeighList *list) void NPairHalfSizeMultiNewton::build(NeighList *list)
{ {
int i,j,k,n,itype,jtype,ibin,ns; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns,js;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq; double radi,radsum,cutdistsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq;
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
double *radius = atom->radius; double *radius = atom->radius;
int *type = atom->type; int *type = atom->type;
@ -62,73 +63,96 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
n = 0; n = 0;
neighptr = ipage->vget(); neighptr = ipage->vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
radi = radius[i]; radi = radius[i];
// loop over rest of atoms in i's bin, ghosts are at end of linked list
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = bins[i]; j >= 0; j = bins[j]) {
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
// loop over all atoms in other bins in stencil, store every pair
// skip if i,j neighbor cutoff is less than bin distance
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; // loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
delx = xtmp - x[j][0]; // if same collection use own bin
dely = ytmp - x[j][1]; if (icollection == jcollection) jbin = ibin;
delz = ztmp - x[j][2]; else jbin = coord2bin(x[i], jcollection);
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) { // if same size: uses half stencil so check central bin
if (history && rsq < radsum*radsum) if (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
neighptr[n++] = j ^ mask_history;
else if (icollection == jcollection) js = bins[i];
neighptr[n++] = j; else js = binhead_multi[jcollection][jbin];
// if same collection,
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
// if different collections,
// if j is owned atom, store it if j > i
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = js; j >= 0; j = bins[j]) {
if ((icollection != jcollection) && (j < i)) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
} }
} }
// for all collections, loop over all atoms in other bins in stencil, store every pair
// stencil is empty if i larger than j
// stencil is half if i same size as j
// stencil is full if i smaller than j
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
}
} }
ilist[inum++] = i; ilist[inum++] = i;

View File

@ -43,4 +43,5 @@ class NPairHalfSizeMultiNewton : public NPair {
E: Neighbor list overflow, boost neigh_modify one E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED UNDOCUMENTED
*/ */

View File

@ -16,6 +16,7 @@
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include "my_page.h" #include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h" #include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -25,20 +26,21 @@ using namespace LAMMPS_NS;
NPairHalfSizeMultiNewtonTri::NPairHalfSizeMultiNewtonTri(LAMMPS *lmp) : NPair(lmp) {} NPairHalfSizeMultiNewtonTri::NPairHalfSizeMultiNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
size particles
binned neighbor list construction with Newton's 3rd law for triclinic binned neighbor list construction with Newton's 3rd law for triclinic
multi stencil is icollection-jcollection dependent
each owned atom i checks its own bin and other bins in triclinic stencil each owned atom i checks its own bin and other bins in triclinic stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor every pair stored exactly once by some processor
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NPairHalfSizeMultiNewtonTri::build(NeighList *list) void NPairHalfSizeMultiNewtonTri::build(NeighList *list)
{ {
int i,j,k,n,itype,jtype,ibin,ns; int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns,js;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq; double radi,radsum,cutdistsq;
int *neighptr,*s; int *neighptr,*s;
double *cutsq,*distsq;
int *collection = neighbor->collection;
double **x = atom->x; double **x = atom->x;
double *radius = atom->radius; double *radius = atom->radius;
int *type = atom->type; int *type = atom->type;
@ -61,56 +63,68 @@ void NPairHalfSizeMultiNewtonTri::build(NeighList *list)
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
n = 0; n = 0;
neighptr = ipage->vget(); neighptr = ipage->vget();
itype = type[i]; itype = type[i];
icollection = collection[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];
ztmp = x[i][2]; ztmp = x[i][2];
radi = radius[i]; radi = radius[i];
// loop over all atoms in bins, including self, in stencil
// skip if i,j neighbor cutoff is less than bin distance
// bins below self are excluded from stencil
// pairs for atoms j "below" i are excluded
// below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
ibin = atom2bin[i]; ibin = atom2bin[i];
s = stencil_multi[itype];
distsq = distsq_multi[itype]; // loop through stencils for all collections
cutsq = cutneighsq[itype]; for (jcollection = 0; jcollection < ncollections; jcollection++) {
ns = nstencil_multi[itype];
for (k = 0; k < ns; k++) { // if same collection use own bin
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) { if (icollection == jcollection) jbin = ibin;
jtype = type[j]; else jbin = coord2bin(x[i], jcollection);
if (cutsq[jtype] < distsq[k]) continue;
if (x[j][2] < ztmp) continue; // loop over all atoms in bins in stencil
if (x[j][2] == ztmp) { // stencil is empty if i larger than j
if (x[j][1] < ytmp) continue; // stencil is half if i same size as j
if (x[j][1] == ytmp) { // stencil is full if i smaller than j
if (x[j][0] < xtmp) continue; // if half: pairs for atoms j "below" i are excluded
if (x[j][0] == xtmp && j <= i) continue; // below = lower z or (equal z and lower y) or (equal zy and lower x)
// (equal zyx and j <= i)
// latter excludes self-self interaction but allows superposed atoms
s = stencil_multi[icollection][jcollection];
ns = nstencil_multi[icollection][jcollection];
for (k = 0; k < ns; k++) {
js = binhead_multi[jcollection][jbin + s[k]];
for (j = js; j >= 0; j = bins[j]) {
// if same size (same collection), use half stencil
if (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp) {
if (x[j][0] < xtmp) continue;
if (x[j][0] == xtmp && j <= i) continue;
}
}
} }
}
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0]; delx = xtmp - x[j][0];
dely = ytmp - x[j][1]; dely = ytmp - x[j][1];
delz = ztmp - x[j][2]; delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz; rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j]; radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin); cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) { if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum) if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history; neighptr[n++] = j ^ mask_history;
else else
neighptr[n++] = j; neighptr[n++] = j;
} }
} }
}
} }
ilist[inum++] = i; ilist[inum++] = i;

View File

@ -43,4 +43,5 @@ class NPairHalfSizeMultiNewtonTri : public NPair {
E: Neighbor list overflow, boost neigh_modify one E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED UNDOCUMENTED
*/ */

View File

@ -0,0 +1,118 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "npair_half_size_multi_old_newtoff.h"
#include "atom.h"
#include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfSizeMultiOldNewtoff::NPairHalfSizeMultiOldNewtoff(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with partial Newton's 3rd law
each owned atom i checks own bin and other bins in stencil
multi-type stencil is itype dependent and is distance checked
pair stored once if i,j are both owned and i < j
pair stored by me if j is ghost (also stored by proc owning j)
------------------------------------------------------------------------- */
void NPairHalfSizeMultiOldNewtoff::build(NeighList *list)
{
int i,j,k,n,itype,jtype,ibin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
double *radius = atom->radius;
int *type = atom->type;
int *mask = atom->mask;
tagint *molecule = atom->molecule;
int nlocal = atom->nlocal;
if (includegroup) nlocal = atom->nfirst;
int history = list->history;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
MyPage<int> *ipage = list->ipage;
int mask_history = 3 << SBBITS;
int inum = 0;
ipage->reset();
for (i = 0; i < nlocal; i++) {
n = 0;
neighptr = ipage->vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
radi = radius[i];
// loop over all atoms in other bins in stencil including self
// only store pair if i < j
// skip if i,j neighbor cutoff is less than bin distance
// stores own/own pairs only once
// stores own/ghost pairs on both procs
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
if (j <= i) continue;
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage->vgot(n);
if (ipage->status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
list->inum = inum;
}

View File

@ -0,0 +1,46 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef NPAIR_CLASS
NPairStyle(half/size/multi/old/newtoff,
NPairHalfSizeMultiOldNewtoff,
NP_HALF | NP_SIZE | NP_MULTI_OLD | NP_NEWTOFF | NP_ORTHO | NP_TRI)
#else
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTOFF_H
#define LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTOFF_H
#include "npair.h"
namespace LAMMPS_NS {
class NPairHalfSizeMultiOldNewtoff : public NPair {
public:
NPairHalfSizeMultiOldNewtoff(class LAMMPS *);
~NPairHalfSizeMultiOldNewtoff() {}
void build(class NeighList *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/

View File

@ -0,0 +1,144 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://lammps.sandia.gov/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "npair_half_size_multi_old_newton.h"
#include "atom.h"
#include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfSizeMultiOldNewton::NPairHalfSizeMultiOldNewton(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with full Newton's 3rd law
each owned atom i checks its own bin and other bins in Newton stencil
multi-type stencil is itype dependent and is distance checked
every pair stored exactly once by some processor
------------------------------------------------------------------------- */
void NPairHalfSizeMultiOldNewton::build(NeighList *list)
{
int i,j,k,n,itype,jtype,ibin,ns;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
double radi,radsum,cutdistsq;
int *neighptr,*s;
double *cutsq,*distsq;
double **x = atom->x;
double *radius = atom->radius;
int *type = atom->type;
int *mask = atom->mask;
tagint *molecule = atom->molecule;
int nlocal = atom->nlocal;
if (includegroup) nlocal = atom->nfirst;
int history = list->history;
int *ilist = list->ilist;
int *numneigh = list->numneigh;
int **firstneigh = list->firstneigh;
MyPage<int> *ipage = list->ipage;
int mask_history = 3 << SBBITS;
int inum = 0;
ipage->reset();
for (i = 0; i < nlocal; i++) {
n = 0;
neighptr = ipage->vget();
itype = type[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
radi = radius[i];
// loop over rest of atoms in i's bin, ghosts are at end of linked list
// if j is owned atom, store it, since j is beyond i in linked list
// if j is ghost, only store if j coords are "above and to the right" of i
for (j = bins[i]; j >= 0; j = bins[j]) {
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
if (x[j][1] < ytmp) continue;
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
}
}
jtype = type[j];
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
// loop over all atoms in other bins in stencil, store every pair
// skip if i,j neighbor cutoff is less than bin distance
ibin = atom2bin[i];
s = stencil_multi_old[itype];
distsq = distsq_multi_old[itype];
cutsq = cutneighsq[itype];
ns = nstencil_multi_old[itype];
for (k = 0; k < ns; k++) {
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
jtype = type[j];
if (cutsq[jtype] < distsq[k]) continue;
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;
ipage->vgot(n);
if (ipage->status())
error->one(FLERR,"Neighbor list overflow, boost neigh_modify one");
}
list->inum = inum;
}

Some files were not shown because too many files have changed in this diff Show More