initial version of AMOEBA/HIPPO force field files

This commit is contained in:
Steve Plimpton
2021-08-25 13:53:31 -06:00
parent 25d9d5dfff
commit b2b807f9b9
52 changed files with 59025 additions and 422 deletions

126
doc/src/Howto_amoeba.rst Normal file
View File

@ -0,0 +1,126 @@
AMOEBA and HIPPO force fields
=============================
The AMOEBA and HIPPO polarizable force fields were developed by Jay
Ponder's group at U Washington at St Louis. Their implementation in
LAMMPS was done using code provided by the Ponder group from their
`Tinker MD code <https://dasher.wustl.edu/tinker/>`_ written in F90.
NOTE: what version of AMOEBA and HIPPO does LAMMPS implement?
These force fields can be used when polarization effects are desired
in simulations of water, organic molecules, and biomolecules including
proteins, provided that parameterizations (force field files) are
available for the systems you are interested in. Files in the LAMMPS
potentials with a "amoeba" or "hippo" suffix can be used. The Tinker
distribution and website may have other such files.
Note that currently, HIPPO can only be used for water systems, but
HIPPO files for a variety of small organic and biomolecules are in
preparation by the Ponder group. They will be included in the LAMMPS
distribution when available.
The :doc:`pair_style amoeba <pair_amoeba>` doc page gives a brief
description of the AMOEBA and HIPPO force fields. Further details for
AMOEBA are in these papers: :ref:`(Ren) <amoeba-Ren>`, :ref:`(Shi)
<amoeba-Shi>`. Further details for HIPPO are in this paper:
:ref:`(Rackers) <amoeba-Rackers>`.
----------
To use the AMOEBA force field in LAMMPS you should use these commands
appropriately in your input script. The only change needed for a
HIPPO simulation is for the pair_style and pair_coeff commands.
See examples/amoeba for example input scripts.
.. code-block:: LAMMPS
units real # required
atom_style hybrid full amoeba
bond_style amoeba
angle_style amoeba
dihedral_style amoeba
fix amtype all property/atom i_amtype ghost yes # fix ID matches read_data command
fix amoeba1 all property/atom & # fix ID (amoeba12) does not matter
i_amgroup i_ired i_xaxis i_yaxis i_zaxis d_pval ghost yes
fix amoeba2 all property/atom i_polaxe
read_data filename fix amtype NULL "Tinker Types" # fix ID matches fix command
pair_coeff * * ../potentials/protein.prm.amoeba ../potentials/protein.key.amoeba # for AMOEBA
pair_coeff * * ../potentials/water.prm.hippo ../potentials/water.key.hippo # for HIPPO
special_bonds lj/coul 0.5 0.5 0.5 one/five yes
Both AMOEBA and HIPPO use amoeba for bond/angle/dihedral styles,
assuming the molecular system has bonds, angles, or dihedrals. These
style commands must be be used before the data file is read, as the
data file defines the coefficients for the various bond/angle/dihedral
types. The pair_style command can come after the read_data command,
as no pair coefficients are defined in the data file.
The :doc:`fix property/atom <fix_property_atom>` commands are required
to create per-atom data used by the AMOEBA/HIPPO force fields, some of
which is defined in the LAMMPS data file. The LAMMPS data file should
be produced as a pre-processing step by the tinker2lmp.py Python
script in tools/amoeba with a command like one of the following.
The tools/amoeba/README file has more details on using this tool.
.. code-block:: bash
% python tinker2lmp.py -xyz tinker.xyz -amoeba protein.prm.amoeba -data lmp.data # AMOEBA for non-periodic systems
% python tinker2lmp.py -xyz tinker.xyz -amoeba protein.prm.amoeba -data lmp.data -pbc 10.0 20.0 15.0 # AMOEBA for periodic systems
% python tinker2lmp.py -xyz tinker.xyz -hippo water.prm.hippo -data lmp.data # HIPPO for non-periodic systems
% python tinker2lmp.py -xyz tinker.xyz -hippo water.prm.hippo -data lmp.data -pbc 10.0 20.0 15.0 # HIPPO for periodic systems
Note that two input files are needed and a LAMMPS data file (lmp.data)
is produced. The data file will have information on Tinker atom types
and AMOEBA/HIPPO force field parameters for bonds, angles, and
dihedrals.
The first input is an XYZ file listing all the atoms in the
system.
NOTE: is this a Tinker-augmented-XYZ format or standard? In either
case, how do we suggest LAMMPS users come up with these files?
The second input is an AMOEBA or HIPPO PRM (force field) file. The
format of these files is defined by Tinker. A few such files are
provided in the LAMMPS potentials directory. Others may be available
in the Tinker distribution or from the Ponder group.
The pair_coeff command should specify the same PRM file, and
optionally a Tinker-format KEY file. See the :doc:`pair_style amoeba
<pair_amoeba>` doc page for more information about Tinker PRM and KEY
files.
Finally, the :doc:`special_bonds <special_bonds>` command is used to
set all LJ and Coulombic 1-2, 1-3, 1-4 weighting factors to non-zero
and non-unity values, and to generate a per-atom list of 1-5 neighbors
as well. This is to insure all bond-topology neighbors are included
in the neighbor lists used by AMOEBA/HIPPO. These force fields apply
their own custom weighting factors to all these terms, including the
1-5 neighbors.
----------
These command doc pages have additional details:
* :doc:`pair_style amoeba or hippo <pair_ameoba>`
* :doc:`bond_style amoeba <bond_amoeba>`
* :doc:`angle_style amoeba <angle_charmm>`
* :doc:`dihedral_style amoeba <dihedral_amoeba>`
* :doc:`fix property/atom <fix_property_atom>`
* :doc:`special_bonds <special_bonds>`
----------
.. _howto-Ren:
**(Ren)** Ren and Ponder, J Phys Chem B, 107, 5933 (2003).
.. _howto-Shi:
**(Shi)** Shi, Xiz, Znahg, Best, Wu, Ponder, Ren, J Chem Theory Comp,
9, 4046, 2013.
.. _howto-Rackers:
**(Rackers)** Rackers and Ponder, J Chem Phys, 150, 084104 (2010).

223
doc/src/pair_amoeba.rst Normal file
View File

@ -0,0 +1,223 @@
.. index:: pair_style amoeba
.. index:: pair_style hippo
pair_style amoeba command
=========================
pair_style hippo command
=========================
Syntax
""""""
.. code-block:: LAMMPS
pair_style style
* style = *amoeba* or *hippo*
Examples
""""""""
.. code-block:: LAMMPS
pair_style amoeba
pair_coeff * * protein.prm.amoeba protein.key.amoeba
.. code-block:: LAMMPS
pair_style hippo
pair_coeff * * water.prm.hippo water.key.hippo
Additional info
"""""""""""""""
doc:`Howto amoeba <howto_ameoba>`
doc:`bond_style amoeba <bond_amoeba>`
doc:`angle_style amoeba <angle_amoeba>`
doc:`dihedral_style amoeba <dihedral_amoeba>`
examples/amoeba
tools/amoeba
potentials/\*.prm.ameoba
potentials/\*.key.ameoba
potentials/\*.prm.hippo
potentials/\*.key.hippo
Description
"""""""""""
NOTE: edit this paragraph however you wish including adding or changing
citations (see bottom of this file)
The *amoeba* style computes the AMOEBA polarizeable field formulated
by Jay Ponder's group at U Washington at St Louis :ref:`(Ren)
<amoeba-Ren>`, :ref:`(Shi) <amoeba-Shi>`. The *hippo* style
computes the HIPPO polarizeable force field , an extension to AMOEBA,
formulated by Josh Rackers and collaborators in the Ponder group
:ref:`(Rackers) <amoeba-Rackers>`.
These force fields can be used when polarization effects are desired
in simulations of water, organic molecules, and biomolecules including
proteins, provided that parameterizations (force field files) are
available for the systems you are interested in. Files in the LAMMPS
potentials with a "amoeba" or "hippo" suffix can be used. The Tinker
distribution and website may have other such files.
NOTE: replace these LaTeX formulas with a list of AMOEBA and HIPPO
terms in some simple notation. If desired, a more detailed
mathematical expression for each term could also be included below
the initial 2 formulas.
The AMOEBA force field can be written as a collection of terms
.. math::
E = 4 \epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} -
\left(\frac{\sigma}{r}\right)^6 \right]
\qquad r < r_c
:math:`r_c` is the cutoff, blah is the dipole, etc
The HIPPO force field is similar but alters some of the terms
.. math::
E = 4 \epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} -
\left(\frac{\sigma}{r}\right)^6 \right]
\qquad r < r_c
:math:`r_c` is the cutoff, blah is the dipole, etc
NOTE: Add a sentence for each term to explain what physical effects
the FFs are encoding. E.g. The polar term iteratively computes an
induced dipole for each atom, then calculates dipole-dipole
interactions ...
See the AMOEBA and HIPPO papers for further details.
.. note::
The AMOEBA and HIPPO force fields compute long-range charge, dipole,
and quadrupole interactions (NOTE: also long-range dispersion?).
However, unlike other models with long-range interactions in LAMMPS,
this does not require use of a KSpace style via the
:doc:`kspace_style <kspace_style>` command. That is because for
AMOEBA and HIPPO the long-range computations are intertwined with
the pairwise compuations. So these pair style include both short-
and long-range computations. This means the energy and virial
computed by the pair style as well as the "Pair" timing reported by
LAMMPS will include the long-range components.
.. note::
As explained on the :doc:`Howto amoeba <howto_ameoba>` doc page, use
of these pair styles to run a simulation with the AMOEBA or HIPPO
force fields requires your input script to use the :doc:`atom_style
hybrid full amoeba <atom_style>` atom style, AMOEBA versions of
bond/angle/dihedral styles, the :doc:`special_bonds one/five
<special_bonds>` option, and the :doc:`fix property/atom one/five
<fix_property>` command to define several additional per-atom
properties. The latter requires a "Tinker Types" section be
included in the LAMMPS data file. This can be auto-generated using
the tools/amoeba/tinker2lmp.py Python script. See the :doc:`Howto
amoeba <howto_ameoba>` doc page and tools/amoeba/README file for
details on using that tool.
The implementation of the AMOEBA and HIPPO force fields in LAMMPS was
done using code provided by the Ponder group from their `Tinker MD
code <https://dasher.wustl.edu/tinker/>`_ written in F90.
NOTE: what version of AMOEBA and HIPPO does LAMMPS implement?
----------
Only a single pair_coeff command is used with either the *amoeba* and
*hippo* styles which specifies two Tinker files, a PRM and KEY file.
.. code-block:: LAMMPS
pair_coeff * * ../potentials/protein.prm.amoeba ../potentials/protein.key.amoeba
pair_coeff * * ../potentials/water.prm.hippo ../potentials/water.key.hippo
See examples of these files in the potentials directory.
The format of a PRM file is a collection of sections, each with
multiple lines. These are the sections which LAMMPS recognizes:
NOTE: need to list these, possibly there are some LAMMPS skips
or which need to be removed for LAMMPS to use the PRM file?
The format of a KEY file is a series of lines, with one parameter and
its value per line. These are the parameters which LAMMPS recognizes:
NOTE: need to list these, possibly there are some keywords LAMMPS skips
or which need to be removed for LAMMPS to use the KEY file?
NOTE: Any other info about PRM and KEY files we should explain
for LAMMPS users here?
----------
Mixing, shift, table, tail correction, restart, rRESPA info
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
These pair styles do not support the :doc:`pair_modify <pair_modify>`
mix, shift, table, and tail options.
These pair styles do not write their information to :doc:`binary
restart files <restart>`, since it is stored in potential files.
Thus, you need to re-specify the pair_style and pair_coeff commands in
an input script that reads a restart file.
These pair styles can only be used via the *pair* keyword of the
:doc:`run_style respa <run_style>` command. They do not support the
*inner*\ , *middle*\ , *outer* keywords.
----------
Restrictions
""""""""""""
These pair styles are part of the AMOEBA package. They are only
enabled if LAMMPS was built with that package. See the :doc:`Build
package <Build_package>` doc page for more info.
The AMOEBA and HIPPO potential (PRM) and KEY files provided with
LAMMPS in the potentials directory are Tinker files parameterized for
Tinker units. Their numeric parameters are converted by LAMMPS to its
real units :doc:`units <units>`. You can only use these pair styles
with real units.
These potentials do not yet calculate per-atom energy or virial
contributions.
----------
Related commands
""""""""""""""""
:doc:`atom_style amoeba <atom_style>`, `bond_style amoeba
:doc:<bond_amoeba>`, `angle_style amoeba <angle_amoeba>`,
:doc:`dihedral_style amoeba <dihedral_amoeba>`, `special_bonds
:doc:one/five <special_bonds>`
Default
"""""""
none
----------
.. _amoeba-Ren:
**(Ren)** Ren and Ponder, J Phys Chem B, 107, 5933 (2003).
.. _amoeba-Shi:
**(Shi)** Shi, Xiz, Znahg, Best, Wu, Ponder, Ren, J Chem Theory Comp,
9, 4046, 2013.
.. _amoeba-Rackers:
**(Rackers)** Rackers and Ponder, J Chem Phys, 150, 084104 (2010).

View File

@ -59,6 +59,7 @@ sub-directories:
accelerate: use of all the various accelerator packages accelerate: use of all the various accelerator packages
airebo: polyethylene with AIREBO potential airebo: polyethylene with AIREBO potential
amoeba: small water and bio models with AMOEBA and HIPPO potentials
atm: Axilrod-Teller-Muto potential atm: Axilrod-Teller-Muto potential
balance: dynamic load balancing, 2d system balance: dynamic load balancing, 2d system
body: body particles, 2d system body: body particles, 2d system

View File

@ -0,0 +1,17 @@
parameters ./amoeba.prm
verbose
neighbor-list
tau-temperature 1.0
tau-pressure 2.0
a-axis 54.99
b-axis 41.91
c-axis 41.91
vdw-cutoff 12.0
ewald
ewald-alpha 0.4
pewald-alpha 0.5
ewald-cutoff 7.0
#pme-grid 60 45 45
pme-grid 60 48 48
pme-order 5
polar-eps 0.00001

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
parameters ./amoeba.prm
digits 8
cutoff 10
taper 8
polar-eps 1e-5
usolve-diag 1.0

View File

@ -0,0 +1,159 @@
##############################
## ##
## Force Field Definition ##
## ##
##############################
forcefield AMOEBA-WATER-2003
bond-cubic -2.55
bond-quartic 3.793125
angle-cubic -0.014
angle-quartic 0.000056
angle-pentic -0.0000007
angle-sextic 0.000000022
opbendtype ALLINGER
opbend-cubic -0.014
opbend-quartic 0.000056
opbend-pentic -0.0000007
opbend-sextic 0.000000022
torsionunit 0.5
vdwtype BUFFERED-14-7
radiusrule CUBIC-MEAN
radiustype R-MIN
radiussize DIAMETER
epsilonrule HHG
dielectric 1.0
polarization MUTUAL
vdw-12-scale 0.0
vdw-13-scale 0.0
vdw-14-scale 1.0
vdw-15-scale 1.0
mpole-12-scale 0.0
mpole-13-scale 0.0
mpole-14-scale 0.4
#mpole-15-scale 0.8
polar-12-scale 0.0
polar-13-scale 0.0
polar-14-scale 1.0
polar-15-scale 1.0
polar-12-intra 0.0
polar-13-intra 0.0
polar-14-intra 0.5
polar-15-intra 1.0
direct-11-scale 0.0
direct-12-scale 1.0
direct-13-scale 1.0
direct-14-scale 1.0
mutual-11-scale 1.0
mutual-12-scale 1.0
mutual-13-scale 1.0
mutual-14-scale 1.0
#############################
## ##
## Literature References ##
## ##
#############################
P. Ren and J. W. Ponder, "A Polarizable Atomic Multipole Water Model
for Molecular Mechanics Simulation", J. Phys. Chem. B, 107, 5933-5947
(2003)
Y. Kong, "Multipole Electrostatic Methods for Protein Modeling with
Reaction Field Treatment", Ph.D. thesis, DBBS Program in Molecular
Biophysics, Washington University, St. Louis, August, 1997 [available
online from http://dasher.wustl.edu/ponder/]
alternative valence parameters to match symmetric and antisymmetric
stretch frequencies by David Semrouni, Ecole Polytechnique, Paris
#############################
## ##
## Atom Type Definitions ##
## ##
#############################
atom 1 1 O "AMOEBA Water O" 8 15.995 2
atom 2 2 H "AMOEBA Water H" 1 1.008 1
################################
## ##
## Van der Waals Parameters ##
## ##
################################
vdw 1 3.4050 0.1100
vdw 2 2.6550 0.0135 0.910
##################################
## ##
## Bond Stretching Parameters ##
## ##
##################################
#bond 1 2 529.60 0.9572 !! original AMOEBA water
bond 1 2 556.85 0.9572
################################
## ##
## Angle Bending Parameters ##
## ##
################################
#angle 2 1 2 34.05 108.50 !! original AMOEBA water
angle 2 1 2 48.70 108.50
###############################
## ##
## Urey-Bradley Parameters ##
## ##
###############################
#ureybrad 2 1 2 38.25 1.5537 !! original AMOEBA water
ureybrad 2 1 2 -7.60 1.5537
###################################
## ##
## Atomic Multipole Parameters ##
## ##
###################################
multipole 1 -2 -2 -0.51966
0.00000 0.00000 0.14279
0.37928
0.00000 -0.41809
0.00000 0.00000 0.03881
multipole 2 1 2 0.25983
-0.03859 0.00000 -0.05818
-0.03673
0.00000 -0.10739
-0.00203 0.00000 0.14412
########################################
## ##
## Dipole Polarizability Parameters ##
## ##
########################################
polarize 1 0.837 0.390 2
polarize 2 0.496 0.390 1

31673
examples/amoeba/data.ubiquitin Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
LAMMPS data file created from Tinker water_dimer.xyz and water03.prm files
6 atoms
4 bonds
2 angles
2 atom types
1 bond types
1 angle types
-1.463996 0.933234 xlo xhi
-0.756549 0.75612 ylo yhi
-0.009705 2.935934 zlo zhi
Masses
1 15.995
2 1.008
Atoms
1 1 1 0 -0.024616 -0.001154 -0.003748
2 1 2 0 -0.244211 -0.000666 0.933978
3 1 2 0 0.932234 -0.000406 -0.008705
4 2 1 0 -0.892721 0.000120 2.773674
5 2 2 0 -1.462996 0.755120 2.933870
6 2 2 0 -1.461809 -0.755549 2.934934
Bonds
1 1 1 2
2 1 1 3
3 1 4 5
4 1 4 6
Angles
1 1 2 1 3
2 1 5 4 6
Bond Coeffs
1 556.85 0.9572
Angle Coeffs
1 48.70 108.50
Tinker Types
1 1 1
2 2 1
3 2 1
4 1 2
5 2 2
6 2 2

View File

@ -0,0 +1,54 @@
LAMMPS data file created from Tinker water_dimer.xyz and water19.prm files
6 atoms
4 bonds
2 angles
2 atom types
1 bond types
1 angle types
-1.463996 0.933234 xlo xhi
-0.756549 0.75612 ylo yhi
-0.009705 2.935934 zlo zhi
Masses
1 15.999
2 1.008
Atoms
1 1 1 0 -0.024616 -0.001154 -0.003748
2 1 2 0 -0.244211 -0.000666 0.933978
3 1 2 0 0.932234 -0.000406 -0.008705
4 2 1 0 -0.892721 0.000120 2.773674
5 2 2 0 -1.462996 0.755120 2.933870
6 2 2 0 -1.461809 -0.755549 2.934934
Bonds
1 1 1 2
2 1 1 3
3 1 4 5
4 1 4 6
Angles
1 1 2 1 3
2 1 5 4 6
Bond Coeffs
1 556.85 0.9572
Angle Coeffs
1 48.70 107.70
Tinker Types
1 1 1
2 2 1
3 2 1
4 1 2
5 2 2
6 2 2

View File

@ -0,0 +1,90 @@
LAMMPS data file created from Tinker water_hexamer.xyz and water03.prm files
18 atoms
12 bonds
6 angles
2 atom types
1 bond types
1 angle types
-2.517835 2.675716 xlo xhi
-1.523041 2.01883 ylo yhi
-1.734766 2.220847 zlo zhi
Masses
1 15.995
2 1.008
Atoms
1 1 1 0 -1.502169 -0.191359 1.434927
2 1 2 0 -0.601054 -0.596972 1.553718
3 1 2 0 -2.006698 -0.422327 2.219847
4 2 1 0 -1.744575 -0.382348 -1.309144
5 2 2 0 -1.888941 -0.479653 -0.347624
6 2 2 0 -2.516835 -0.766765 -1.733766
7 3 1 0 -0.560409 2.017830 -0.121984
8 3 2 0 -0.947720 1.533567 0.625228
9 3 2 0 -0.989831 1.592736 -0.877419
10 4 1 0 0.964803 -1.165765 1.439987
11 4 2 0 0.979557 -1.522041 0.527833
12 4 2 0 1.542224 -0.393692 1.344373
13 5 1 0 0.974705 -1.401503 -1.335970
14 5 2 0 0.065161 -1.118951 -1.522886
15 5 2 0 1.470709 -0.570933 -1.277710
16 6 1 0 2.002280 1.057824 -0.124502
17 6 2 0 1.141637 1.532266 -0.140121
18 6 2 0 2.674716 1.735342 -0.237995
Bonds
1 1 1 2
2 1 1 3
3 1 4 5
4 1 4 6
5 1 7 8
6 1 7 9
7 1 10 11
8 1 10 12
9 1 13 14
10 1 13 15
11 1 16 17
12 1 16 18
Angles
1 1 2 1 3
2 1 5 4 6
3 1 8 7 9
4 1 11 10 12
5 1 14 13 15
6 1 17 16 18
Bond Coeffs
1 556.85 0.9572
Angle Coeffs
1 48.70 108.50
Tinker Types
1 1 1
2 2 1
3 2 1
4 1 2
5 2 2
6 2 2
7 1 3
8 2 3
9 2 3
10 1 4
11 2 4
12 2 4
13 1 5
14 2 5
15 2 5
16 1 6
17 2 6
18 2 6

View File

@ -0,0 +1,90 @@
LAMMPS data file created from Tinker water_hexamer.xyz and water19.prm files
18 atoms
12 bonds
6 angles
2 atom types
1 bond types
1 angle types
-2.517835 2.675716 xlo xhi
-1.523041 2.01883 ylo yhi
-1.734766 2.220847 zlo zhi
Masses
1 15.999
2 1.008
Atoms
1 1 1 0 -1.502169 -0.191359 1.434927
2 1 2 0 -0.601054 -0.596972 1.553718
3 1 2 0 -2.006698 -0.422327 2.219847
4 2 1 0 -1.744575 -0.382348 -1.309144
5 2 2 0 -1.888941 -0.479653 -0.347624
6 2 2 0 -2.516835 -0.766765 -1.733766
7 3 1 0 -0.560409 2.017830 -0.121984
8 3 2 0 -0.947720 1.533567 0.625228
9 3 2 0 -0.989831 1.592736 -0.877419
10 4 1 0 0.964803 -1.165765 1.439987
11 4 2 0 0.979557 -1.522041 0.527833
12 4 2 0 1.542224 -0.393692 1.344373
13 5 1 0 0.974705 -1.401503 -1.335970
14 5 2 0 0.065161 -1.118951 -1.522886
15 5 2 0 1.470709 -0.570933 -1.277710
16 6 1 0 2.002280 1.057824 -0.124502
17 6 2 0 1.141637 1.532266 -0.140121
18 6 2 0 2.674716 1.735342 -0.237995
Bonds
1 1 1 2
2 1 1 3
3 1 4 5
4 1 4 6
5 1 7 8
6 1 7 9
7 1 10 11
8 1 10 12
9 1 13 14
10 1 13 15
11 1 16 17
12 1 16 18
Angles
1 1 2 1 3
2 1 5 4 6
3 1 8 7 9
4 1 11 10 12
5 1 14 13 15
6 1 17 16 18
Bond Coeffs
1 556.85 0.9572
Angle Coeffs
1 48.70 107.70
Tinker Types
1 1 1
2 2 1
3 2 1
4 1 2
5 2 2
6 2 2
7 1 3
8 2 3
9 2 3
10 1 4
11 2 4
12 2 4
13 1 5
14 2 5
15 2 5
16 1 6
17 2 6
18 2 6

View File

@ -0,0 +1,9 @@
parameters ./hippo.prm
digits 8
cutoff 10
taper 8
polar-eps 1e-5
usolve-diag 1.0

View File

@ -0,0 +1,319 @@
##############################
## ##
## Force Field Definition ##
## ##
##############################
forcefield HIPPO-WATER-2019
bond-cubic -2.55
bond-quartic 3.793125
angle-cubic -0.014
angle-quartic 0.000056
angle-pentic -0.0000007
angle-sextic 0.000000022
opbendtype ALLINGER
opbend-cubic -0.014
opbend-quartic 0.000056
opbend-pentic -0.0000007
opbend-sextic 0.000000022
torsionunit 0.5
dielectric 1.0
polarization MUTUAL
rep-12-scale 0.0
rep-13-scale 0.0
rep-14-scale 1.0
rep-15-scale 1.0
disp-12-scale 0.0
disp-13-scale 0.0
disp-14-scale 0.4
#disp-15-scale 0.8
mpole-12-scale 0.0
mpole-13-scale 0.0
mpole-14-scale 0.4
#mpole-15-scale 0.8
polar-12-scale 0.0
polar-13-scale 0.0
polar-14-scale 1.0
polar-15-scale 1.0
polar-12-intra 0.0
polar-13-intra 0.0
polar-14-intra 0.5
polar-15-intra 1.0
direct-11-scale 0.0
direct-12-scale 1.0
direct-13-scale 1.0
direct-14-scale 1.0
mutual-11-scale 1.0
mutual-12-scale 1.0
mutual-13-scale 1.0
mutual-14-scale 1.0
induce-12-scale 0.2
induce-13-scale 1.0
induce-14-scale 1.0
induce-15-scale 1.0
#############################
## ##
## Literature References ##
## ##
#############################
This is a preliminary parameter set for water based on the HIPPO
(Hydrogen-like Intermolecular Polarizable Potential) force field.
It uses terms describing charge penetration, damped dispersion, and
anisotropic repulsion as per the papers below. The parameters are as
of 13 May 2019 and are from Roseane dos Reis Silva and Josh Rackers
in the Ponder lab at Washington University. These parameter values
are under development and are subject to change.
J. A. Rackers, Q. Wang, C. Liu, J.-P. Piquemal, P. Ren and J. W. Ponder,
An Optimized Charge Penetration Model for Use with the AMOEBA Force Field,
Physical Chemistry Chemical Physics, 19, 276-291 (2017)
J. A. Rackers, C. Liu, P. Ren and J. W. Ponder, A Physically Grounded
Damped Dispersion Model with Particle Mesh Ewald Summation, Journal
of Chemical Physics, 149, 084115 (2018)
J. A. Rackers and J. W. Ponder, Classical Pauli Repulsion: An Anisotropic,
Atomic Multipole Model, Journal of Chemical Physics, 150, 084104 (2019)
#############################
## ##
## Atom Type Definitions ##
## ##
#############################
atom 1 1 O "HIPPO Water O" 8 15.999 2
atom 2 2 H "HIPPO Water H" 1 1.008 1
##################################
## ##
## Bond Stretching Parameters ##
## ##
##################################
bond 1 2 556.85 0.9572 !! all
################################
## ##
## Angle Bending Parameters ##
## ##
################################
#angle 2 1 2 48.70 108.50 !! orig
#angle 2 1 2 48.70 107.70 !! 13
#angle 2 1 2 48.70 107.70 !! 12
#angle 2 1 2 48.70 107.70 !! 16t-i2
#angle 2 1 2 48.70 107.70 !! 16t-i6
#angle 2 1 2 48.70 107.70 !! 17t-i3
angle 2 1 2 48.70 107.70 !! 17t-i6
##################################
## ##
## Pauli Repulsion Parameters ##
## ##
##################################
#repulsion 1 2.8478 4.6069 3.3353 !! orig
#repulsion 2 2.0560 4.8356 0.7423 !! orig
#repulsion 1 2.7716 4.4097 3.3789 !! 13
#repulsion 2 2.0410 4.8567 0.6592 !! 13
#repulsion 1 2.7875 4.4310 3.3914 !! 12
#repulsion 2 2.0510 4.8314 0.6557 !! 12
#repulsion 1 2.8604 4.5590 3.3554 !! t16-i2
#repulsion 2 2.0508 4.8497 0.7264 !! t16-i2
#repulsion 1 2.8618 4.4770 3.3790 !! t16-i6
#repulsion 2 2.0658 4.9052 0.6831 !! t16-i6
#repulsion 1 2.8644 4.4964 3.3594 !! t17-i3
#repulsion 2 2.0605 4.8965 0.6958 !! t17-i3
repulsion 1 2.8758 4.4394 3.3883 !! t17-i6
repulsion 2 2.0610 4.9367 0.6505 !! t17-i6
#############################
## ##
## Dispersion Parameters ##
## ##
#############################
#dispersion 1 16.4682 4.4288 !! orig
#dispersion 2 2.9470 4.9751 !! orig
#dispersion 1 17.0790 4.3977 !! 13
#dispersion 2 4.2262 4.9255 !! 13
#dispersion 1 17.0607 4.3872 !! 12
#dispersion 2 4.2382 4.9542 !! 12
#dispersion 1 16.6803 4.4470 !! t16-i2
#dispersion 2 3.4415 4.9267 !! t16-i2
#dispersion 1 16.7807 4.4427 !! t16-i6
#dispersion 2 3.8508 4.9261 !! t16-i6
#dispersion 1 16.6579 4.2763 !! t17-i3
#dispersion 2 3.2999 4.9597 !! t17-i3
dispersion 1 16.7190 4.3418 !! t17-i6
dispersion 2 3.4239 4.9577 !! t17-i6
###################################
## ##
## Atomic Multipole Parameters ##
## ##
###################################
!! orig
#multipole 1 -2 -2 -0.38280
0.00000 0.00000 0.05477
0.69866
0.00000 -0.60471
0.00000 0.00000 -0.09395
#multipole 2 1 2 0.19140
0.00000 0.00000 -0.20097
0.03881
0.00000 0.02214
0.00000 0.00000 -0.06095
!! 13
#multipole 1 -2 -2 -0.38296
0.00000 0.00000 0.05086
0.70053
0.00000 -0.61138
0.00000 0.00000 -0.08915
#multipole 2 1 2 0.19148
0.00000 0.00000 -0.20142
0.06672
0.00000 0.04168
0.01245 0.00000 -0.10840
!! 12
#multipole 1 -2 -2 -0.38468
0.00000 0.00000 0.05069
0.70076
0.00000 -0.61593
0.00000 0.00000 -0.08483
#multipole 2 1 2 0.19234
0.00000 0.00000 -0.20236
0.06136
0.00000 0.04166
0.00591 0.00000 -0.10302
!! t16-i2
#multipole 1 -2 -2 -0.38236
0.00000 0.00000 0.05488
0.69693
0.00000 -0.60514
0.00000 0.00000 -0.09179
#multipole 2 1 2 0.19118
0.00000 0.00000 -0.20081
0.04614
0.00000 0.02258
0.00000 0.00000 -0.07172
!! t16-i6
#multipole 1 -2 -2 -0.37854
0.00000 0.00000 0.05439
0.68442
0.00000 -0.61857
0.00000 0.00000 -0.06585
#multipole 2 1 2 0.18927
0.00000 0.00000 -0.19918
0.05839
0.00000 0.03699
0.00683 0.00000 -0.09538
!! t17-i3
#multipole 1 -2 -2 -0.37944
0.00000 0.00000 0.05496
0.69091
0.00000 -0.60566
0.00000 0.00000 -0.08525
#multipole 2 1 2 0.18972
0.00000 0.00000 -0.20057
0.05030
0.00000 0.03290
0.00187 0.00000 -0.08320
!! t17-i6
multipole 1 -2 -2 -0.37724
0.00000 0.00000 0.05410
0.68565
0.00000 -0.60559
0.00000 0.00000 -0.08006
multipole 2 1 2 0.18862
0.00000 0.00000 -0.19902
0.06206
0.00000 0.04341
0.00709 0.00000 -0.10547
#####################################
## ##
## Charge Penetration Parameters ##
## ##
#####################################
#chgpen 1 6.0000 4.4288 !! orig
#chgpen 2 1.0000 4.9751 !! orig
#chgpen 1 6.0000 4.3977 !! 13
#chgpen 2 1.0000 4.9255 !! 13
#chgpen 1 6.0000 4.3872 !! 12
#chgpen 2 1.0000 4.9542 !! 12
#chgpen 1 6.0000 4.4470 !! t16-i2
#chgpen 2 1.0000 4.9767 !! t16-i2
#chgpen 1 6.0000 4.4427 !! t16-i6
#chgpen 2 1.0000 4.9261 !! t16-i6
#chgpen 1 6.0000 4.3763 !! t17-i3
#chgpen 2 1.0000 4.9597 !! t17-i3
chgpen 1 6.0000 4.3418 !! t17-i6
chgpen 2 1.0000 4.9577 !! t17-i6
########################################
## ##
## Dipole Polarizability Parameters ##
## ##
########################################
#polarize 1 0.7482 2 !! orig
#polarize 2 0.3703 1 !! orig
#polarize 1 0.7448 2 !! 13
#polarize 2 0.3897 1 !! 13
#polarize 1 0.7442 2 !! 12
#polarize 2 0.3874 1 !! 12
#polarize 1 0.7499 2 !! t16-i2
#polarize 2 0.3706 1 !! t16-i2
#polarize 1 0.7403 2 !! t16-i6
#polarize 2 0.3774 1 !! t16-i6
#polarize 1 0.7416 2 !! t17-i3
#polarize 2 0.3670 1 !! t17-i3
polarize 1 0.7332 2 !! t17-i6
polarize 2 0.3691 1 !! t17-i6
##################################
## ##
## Charge Transfer Parameters ##
## ##
##################################
#chgtrn 1 3.5788 0.0000 !! orig
#chgtrn 2 0.0000 3.3292 !1 orig
#chgtrn 1 3.5856 0.0000 !! 13
#chgtrn 2 0.0000 3.3482 !! 13
#chgtrn 1 3.5867 0.0000 !! t16-i2
#chgtrn 2 0.0000 3.3105 !! t16-i2
#chgtrn 1 3.5812 0.0000 !! t16-i6
#chgtrn 2 0.0000 3.2909 !! t16-i6
#chgtrn 1 3.5762 0.0000 !! t17-i3
#chgtrn 2 0.0000 3.2881 !! t17-i3
chgtrn 1 3.5551 0.0000 !! t17-i6
chgtrn 2 0.0000 3.2812 !! t17-i6

View File

@ -0,0 +1,105 @@
# default cmd-line variable settings
variable a index ""
variable diff index 0
units real
boundary p p p
atom_modify sort 0 0.0
comm_modify cutoff 5.0
atom_style amoeba
special_bonds lj/coul 0.5 0.5 0.5 one/five yes
bond_style class2
angle_style amoeba
#dihedral_style nharmonic
dihedral_style none
# per-atom properties required by AMOEBA or HIPPO
fix amtype all property/atom i_amtype ghost yes
fix extra all property/atom &
i_amgroup i_ired i_xaxis i_yaxis i_zaxis d_pval ghost yes
fix extra2 all property/atom i_polaxe
read_data data.${struc}.angles fix amtype NULL "Tinker Types"
#read_data data.watersmall fix amtype NULL "Tinker Types"
#read_data data.water_hexamer fix amtype NULL "Tinker Types"
# insure all 1-2,1-3,1-4,1-5 are in Tinker neigh list
special_bonds lj/coul 0.5 0.5 0.5 one/five yes
# force field terms
# depends on 2 command-line variables
# ff = amoeba or hippo, a = args for pair_style
if "${ff} == amoeba" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba.prm amoeba.key"
if "${ff} == hippo" then &
"pair_style hippo $a" &
"pair_coeff * * hippo.prm hippo.key"
if "${ff} == amoeba_direct" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba_direct.prm amoeba_direct.key"
if "${ff} == hippo_direct" then &
"pair_style hippo $a" &
"pair_coeff * * hippo_direct.prm hippo_direct.key"
if "${ff} == amoeba_opt" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba.prm amoeba_opt.key"
if "${ff} == hippo_opt" then &
"pair_style hippo $a" &
"pair_coeff * * hippo.prm hippo_opt.key"
# optional turn off angle and dihedral
#angle_style none
dihedral_style none
# numeric difference of forces
#compute nd all pe
#fix nd all numdiff ${diff} 1.0e-5 nd
#variable dx atom abs(fx+f_nd[1])
#variable dy atom abs(fy+f_nd[2])
#variable dz atom abs(fz+f_nd[3])
#compute rd all reduce max v_dx v_dy v_dz
# setup force components this way so can dump them
fix fhal all store/state 0 fx fy fz
fix frepulse all store/state 0 fx fy fz
fix fdisp all store/state 0 fx fy fz
fix fpolar all store/state 0 fx fy fz
fix fmpole all store/state 0 fx fy fz
fix fqxfer all store/state 0 fx fy fz
dump 1 all custom 1 ${dumpfile} id type x y z fx fy fz &
# f_fhal[1] f_fhal[2] f_fhal[3] &
# f_fdisp[1] f_fdisp[2] f_fdisp[3] &
# f_frepulse[1] f_frepulse[2] f_frepulse[3] &
# f_fpolar[1] f_fpolar[2] f_fpolar[3] &
# f_fmpole[1] f_fmpole[2] f_fmpole[3] &
# f_fqxfer[1] f_fqxfer[2] f_fqxfer[3]
# f_nd[1] f_nd[2] f_nd[3]
dump_modify 1 format float "%20.16g" sort id
compute virial all pressure NULL virial
# thermo output
thermo_style custom step temp epair ebond eangle edihed eimp emol etotal press c_virial[*] #c_rd[*]
thermo_modify format float "%20.16g"
# 0-step run
run 0

View File

@ -0,0 +1,106 @@
# test of HIPPO water dimer system
# default cmd-line variable settings
variable a index ""
variable diff index 0
units real
atom_style full
boundary p p p
atom_modify sort 0 0.0
atom_style amoeba
special_bonds lj/coul 0.5 0.5 0.5 one/five yes
bond_style class2
angle_style amoeba
# per-atom properties required by AMOEBA or HIPPO
fix amtype all property/atom i_amtype ghost yes
fix extra all property/atom &
i_amgroup i_ired i_xaxis i_yaxis i_zaxis d_pval ghost yes
fix extra2 all property/atom i_polaxe
read_data data.${struc}.angles fix amtype NULL "Tinker Types"
#read_data data.watersmall fix amtype NULL "Tinker Types"
#read_data data.water_hexamer fix amtype NULL "Tinker Types"
# insure all 1-2,1-3,1-4 are in Tinker neigh list
special_bonds lj/coul 0.5 0.5 0.5
# force field terms
# depends on 2 command-line variables
# ff = amoeba or hippo, a = args for pair_style
if "${ff} == amoeba" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba.prm amoeba.key"
if "${ff} == hippo" then &
"pair_style hippo $a" &
"pair_coeff * * hippo.prm hippo.key"
if "${ff} == amoeba_direct" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba_direct.prm amoeba_direct.key"
if "${ff} == hippo_direct" then &
"pair_style hippo $a" &
"pair_coeff * * hippo_direct.prm hippo_direct.key"
if "${ff} == amoeba_opt" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba.prm amoeba_opt.key"
if "${ff} == hippo_opt" then &
"pair_style hippo $a" &
"pair_coeff * * hippo.prm hippo_opt.key"
# turn off bond/angle interactions for now
#bond_style none
#angle_style none
# numeric difference of forces
#compute nd all pe
#fix nd all numdiff ${diff} 1.0e-5 nd
#variable dx atom abs(fx+f_nd[1])
#variable dy atom abs(fy+f_nd[2])
#variable dz atom abs(fz+f_nd[3])
#compute rd all reduce max v_dx v_dy v_dz
# setup force components this way so can dump them
fix fhal all store/state 0 fx fy fz
fix frepulse all store/state 0 fx fy fz
fix fdisp all store/state 0 fx fy fz
fix fpolar all store/state 0 fx fy fz
fix fmpole all store/state 0 fx fy fz
fix fqxfer all store/state 0 fx fy fz
dump 1 all custom 1 ${dumpfile} id type x y z fx fy fz &
# f_fhal[1] f_fhal[2] f_fhal[3] &
# f_fdisp[1] f_fdisp[2] f_fdisp[3] &
# f_frepulse[1] f_frepulse[2] f_frepulse[3] &
# f_fpolar[1] f_fpolar[2] f_fpolar[3] &
# f_fmpole[1] f_fmpole[2] f_fmpole[3] &
# f_fqxfer[1] f_fqxfer[2] f_fqxfer[3] &
# f_nd[1] f_nd[2] f_nd[3]
dump_modify 1 format float "%15.10g" sort id
compute virial all pressure NULL virial
# thermo output
thermo_style custom step temp epair ebond eanble etotal press c_virial[*] #c_rd[*]
thermo_modify format float "%15.10g"
# 0-step run
run 0

View File

@ -0,0 +1,104 @@
# test of HIPPO water dimer system
# default cmd-line variable settings
variable a index ""
variable diff index 0
units real
atom_style full
boundary s s s
atom_style amoeba
special_bonds lj/coul 0.5 0.5 0.5 one/five yes
bond_style class2
angle_style amoeba
dihedral_style none
# per-atom properties required by AMOEBA or HIPPO
fix amtype all property/atom i_amtype ghost yes
fix extra all property/atom &
i_amgroup i_ired i_xaxis i_yaxis i_zaxis d_pval ghost yes
fix extra2 all property/atom i_polaxe
read_data data.${struc}.bonds fix amtype NULL "Tinker Types"
#read_data data.watersmall fix amtype NULL "Tinker Types"
#read_data data.water_hexamer fix amtype NULL "Tinker Types"
# insure all 1-2,1-3,1-4 are in Tinker neigh list
special_bonds lj/coul 0.5 0.5 0.5
# force field terms
# depends on 2 command-line variables
# ff = amoeba or hippo, a = args for pair_style
if "${ff} == amoeba" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba.prm amoeba.key"
if "${ff} == hippo" then &
"pair_style hippo $a" &
"pair_coeff * * hippo.prm hippo.key"
if "${ff} == amoeba_direct" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba_direct.prm amoeba_direct.key"
if "${ff} == hippo_direct" then &
"pair_style hippo $a" &
"pair_coeff * * hippo_direct.prm hippo_direct.key"
if "${ff} == amoeba_opt" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba.prm amoeba_opt.key"
if "${ff} == hippo_opt" then &
"pair_style hippo $a" &
"pair_coeff * * hippo.prm hippo_opt.key"
# turn off bond/angle interactions for now
#bond_style none
#angle_style none
# numeric difference of forces
#compute nd all pe
#fix nd all numdiff ${diff} 1.0e-5 nd
#variable dx atom abs(fx+f_nd[1])
#variable dy atom abs(fy+f_nd[2])
#variable dz atom abs(fz+f_nd[3])
#compute rd all reduce max v_dx v_dy v_dz
# setup force components this way so can dump them
fix fhal all store/state 0 fx fy fz
fix frepulse all store/state 0 fx fy fz
fix fdisp all store/state 0 fx fy fz
fix fpolar all store/state 0 fx fy fz
fix fmpole all store/state 0 fx fy fz
fix fqxfer all store/state 0 fx fy fz
dump 1 all custom 1 ${dumpfile} id type fx fy fz &
# f_fhal[1] f_fhal[2] f_fhal[3] &
# f_fdisp[1] f_fdisp[2] f_fdisp[3] &
# f_frepulse[1] f_frepulse[2] f_frepulse[3] &
# f_fpolar[1] f_fpolar[2] f_fpolar[3] &
# f_fmpole[1] f_fmpole[2] f_fmpole[3] &
# f_fqxfer[1] f_fqxfer[2] f_fqxfer[3] &
# f_nd[1] f_nd[2] f_nd[3]
dump_modify 1 format float "%15.10g" sort id
# thermo output
thermo_style custom step temp epair ebond eangle etotal press #c_rd[*]
thermo_modify format float "%15.10g"
# 0-step run
run 0

View File

@ -0,0 +1,103 @@
# test of HIPPO water dimer system
# default cmd-line variable settings
variable a index ""
variable diff index 0
units real
atom_style full
boundary s s s
atom_style amoeba
special_bonds lj/coul 0.5 0.5 0.5 one/five yes
bond_style harmonic
angle_style harmonic
# per-atom properties required by AMOEBA or HIPPO
fix amtype all property/atom i_amtype ghost yes
fix extra all property/atom &
i_amgroup i_ired i_xaxis i_yaxis i_zaxis d_pval ghost yes
fix extra2 all property/atom i_polaxe
read_data data.${struc} fix amtype NULL "Tinker Types"
#read_data data.watersmall fix amtype NULL "Tinker Types"
#read_data data.water_hexamer fix amtype NULL "Tinker Types"
# insure all 1-2,1-3,1-4 are in Tinker neigh list
special_bonds lj/coul 0.5 0.5 0.5
# force field terms
# depends on 2 command-line variables
# ff = amoeba or hippo, a = args for pair_style
if "${ff} == amoeba" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba.prm amoeba.key"
if "${ff} == hippo" then &
"pair_style hippo $a" &
"pair_coeff * * hippo.prm hippo.key"
if "${ff} == amoeba_direct" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba_direct.prm amoeba_direct.key"
if "${ff} == hippo_direct" then &
"pair_style hippo $a" &
"pair_coeff * * hippo_direct.prm hippo_direct.key"
if "${ff} == amoeba_opt" then &
"pair_style amoeba $a" &
"pair_coeff * * amoeba.prm amoeba_opt.key"
if "${ff} == hippo_opt" then &
"pair_style hippo $a" &
"pair_coeff * * hippo.prm hippo_opt.key"
# turn off bond/angle interactions for now
bond_style none
angle_style none
# numeric difference of forces
#compute nd all pe
#fix nd all numdiff ${diff} 1.0e-5 nd
#variable dx atom abs(fx+f_nd[1])
#variable dy atom abs(fy+f_nd[2])
#variable dz atom abs(fz+f_nd[3])
#compute rd all reduce max v_dx v_dy v_dz
# setup force components this way so can dump them
fix fhal all store/state 0 fx fy fz
fix frepulse all store/state 0 fx fy fz
fix fdisp all store/state 0 fx fy fz
fix fpolar all store/state 0 fx fy fz
fix fmpole all store/state 0 fx fy fz
fix fqxfer all store/state 0 fx fy fz
dump 1 all custom 1 ${dumpfile} id type x y z fx fy fz &
# f_fhal[1] f_fhal[2] f_fhal[3] &
# f_fdisp[1] f_fdisp[2] f_fdisp[3] &
# f_frepulse[1] f_frepulse[2] f_frepulse[3] &
# f_fpolar[1] f_fpolar[2] f_fpolar[3] &
# f_fmpole[1] f_fmpole[2] f_fmpole[3] &
# f_fqxfer[1] f_fqxfer[2] f_fqxfer[3] &
# f_nd[1] f_nd[2] f_nd[3]
dump_modify 1 format float "%15.10g" sort id
# thermo output
thermo_style custom step temp epair emol etotal press #c_rd[*]
thermo_modify format float "%15.10g"
# 0-step run
run 0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,649 @@
648 Water Cubic Box (18.643 Ang, 216 AMOEBA)
1 O 8.679662 7.087692 -0.696862 1 2 3
2 H 7.809455 6.755792 -0.382259 2 1
3 H 8.722232 6.814243 -1.617561 2 1
4 O -0.117313 8.244447 6.837616 1 5 6
5 H 0.216892 7.895445 6.050027 2 4
6 H 0.444268 7.826013 7.530196 2 4
7 O 8.379057 -0.092611 6.814631 1 8 9
8 H 9.340423 0.098069 6.734062 2 7
9 H 7.939619 0.573676 6.269838 2 7
10 O 6.589952 1.844323 -6.923167 1 11 12
11 H 5.885429 2.402305 -6.717934 2 10
12 H 6.181533 1.062747 -7.273678 2 10
13 O 7.146600 5.753582 2.331517 1 14 15
14 H 6.368123 6.126035 2.862678 2 13
15 H 7.025018 6.294645 1.518196 2 13
16 O -2.426581 -8.504195 -2.504834 1 17 18
17 H -1.692063 -8.368252 -3.058292 2 16
18 H -2.793207 -7.602469 -2.403097 2 16
19 O -8.038375 -3.605589 2.303691 1 20 21
20 H -8.113753 -4.248127 3.018494 2 19
21 H -7.619392 -2.863004 2.709622 2 19
22 O -1.480631 8.244085 -8.272215 1 23 24
23 H -2.090204 8.687978 -7.676996 2 22
24 H -0.700878 8.823325 -8.322213 2 22
25 O -3.741962 -2.777830 -2.326319 1 26 27
26 H -4.620456 -2.444778 -2.390519 2 25
27 H -3.728921 -3.160952 -1.433101 2 25
28 O -6.467812 -5.265942 0.408263 1 29 30
29 H -6.585076 -4.796537 -0.413008 2 28
30 H -7.021252 -4.752640 1.007958 2 28
31 O 9.273577 5.342431 4.055460 1 32 33
32 H 8.645939 5.466500 4.837640 2 31
33 H 8.741774 5.686149 3.302820 2 31
34 O 1.830160 4.276731 -6.993499 1 35 36
35 H 1.703275 5.223773 -6.703852 2 34
36 H 2.408113 3.853447 -6.383339 2 34
37 O 1.964382 6.832988 8.373101 1 38 39
38 H 2.496135 7.215781 9.056298 2 37
39 H 1.811283 5.905846 8.573539 2 37
40 O 5.405568 4.388994 7.932737 1 41 42
41 H 5.537380 3.438955 7.781311 2 40
42 H 4.755156 4.734908 7.290617 2 40
43 O 3.229998 2.928417 -1.090650 1 44 45
44 H 3.931090 3.198265 -1.702769 2 43
45 H 3.004438 3.708969 -0.493266 2 43
46 O 7.462400 5.262829 6.131170 1 47 48
47 H 8.025650 5.588493 6.881770 2 46
48 H 6.935076 4.455766 6.325405 2 46
49 O -8.864042 7.023845 -6.659632 1 50 51
50 H -8.370939 6.372557 -7.141895 2 49
51 H -9.489800 7.315873 -7.293125 2 49
52 O -4.526299 3.549989 8.030031 1 53 54
53 H -5.169770 4.224127 7.731323 2 52
54 H -4.262096 3.801892 8.884875 2 52
55 O 4.823286 -1.386218 4.038464 1 56 57
56 H 5.493155 -0.669965 4.013081 2 55
57 H 4.187463 -1.101832 3.338433 2 55
58 O -2.151150 -2.017060 -8.593685 1 59 60
59 H -2.475709 -2.320356 -7.783564 2 58
60 H -2.650484 -2.434614 -9.307384 2 58
61 O 1.944893 4.933226 0.497910 1 62 63
62 H 2.553221 5.263352 1.205303 2 61
63 H 2.082534 5.590999 -0.202171 2 61
64 O -6.827006 -5.285917 -2.371899 1 65 66
65 H -7.405873 -6.022738 -2.075913 2 64
66 H -6.398443 -5.453726 -3.235054 2 64
67 O -8.538047 -7.577917 -1.688532 1 68 69
68 H -8.075591 -8.448260 -1.513455 2 67
69 H -9.389507 -7.836271 -2.051835 2 67
70 O -6.916556 -1.100882 -5.168782 1 71 72
71 H -6.365888 -1.659366 -5.746210 2 70
72 H -6.538885 -0.249374 -5.325993 2 70
73 O 6.330290 -9.323893 -6.416630 1 74 75
74 H 7.026026 -9.680578 -7.007727 2 73
75 H 6.812488 -8.683594 -5.925799 2 73
76 O -2.424345 -5.918126 2.701855 1 77 78
77 H -1.613829 -5.486394 2.503024 2 76
78 H -3.144797 -5.307275 2.618121 2 76
79 O 0.637202 -6.080457 5.849135 1 80 81
80 H 0.892312 -6.092342 4.907709 2 79
81 H -0.339074 -5.838972 5.853292 2 79
82 O 5.199216 -2.264918 -0.138343 1 83 84
83 H 5.802838 -2.788698 -0.697536 2 82
84 H 5.670340 -1.679393 0.462296 2 82
85 O 0.510145 7.629450 4.054500 1 86 87
86 H -0.071135 8.146563 3.452959 2 85
87 H 1.464962 7.740819 3.669172 2 85
88 O 3.146724 8.895843 6.526257 1 89 90
89 H 3.506091 8.599906 7.352942 2 88
90 H 2.145729 8.929622 6.682029 2 88
91 O 7.308541 -8.339335 -2.471342 1 92 93
92 H 6.562127 -8.180601 -3.062803 2 91
93 H 6.993025 -8.364954 -1.531235 2 91
94 O -7.530792 1.069683 4.989387 1 95 96
95 H -7.565406 1.971422 4.648636 2 94
96 H -7.938250 0.433547 4.370266 2 94
97 O 4.452035 2.700609 -5.437815 1 98 99
98 H 4.603326 3.058652 -4.551590 2 97
99 H 4.386453 1.737004 -5.180419 2 97
100 O 8.427922 -8.619286 1.784691 1 101 102
101 H 8.340498 -8.005342 2.536225 2 100
102 H 8.496720 -9.530562 2.174667 2 100
103 O -8.109456 1.753830 -3.096997 1 104 105
104 H -7.245287 1.827177 -2.721417 2 103
105 H -8.082178 1.783171 -4.059329 2 103
106 O 2.776933 -5.701955 7.748213 1 107 108
107 H 3.287974 -5.069688 7.233816 2 106
108 H 1.987041 -5.817355 7.200131 2 106
109 O 3.635171 -6.953519 5.339628 1 110 111
110 H 3.353851 -7.592789 6.031367 2 109
111 H 2.875801 -6.787975 4.740576 2 109
112 O 6.888027 -4.169023 -1.800190 1 113 114
113 H 7.559735 -4.813701 -2.004669 2 112
114 H 6.603805 -3.759237 -2.626496 2 112
115 O -4.470837 -4.105640 3.415362 1 116 117
116 H -4.991607 -3.358538 3.140956 2 115
117 H -4.791764 -4.392214 4.254387 2 115
118 O 8.282263 -0.462068 -2.560579 1 119 120
119 H 8.776769 -1.293641 -2.335945 2 118
120 H 8.760297 0.384816 -2.651128 2 118
121 O 4.737236 1.616430 4.901115 1 122 123
122 H 3.969692 2.168368 5.152631 2 121
123 H 5.184651 2.148403 4.154746 2 121
124 O -3.497332 -5.781436 -2.202713 1 125 126
125 H -4.038857 -5.773824 -1.381680 2 124
126 H -4.152970 -6.012265 -2.829379 2 124
127 O -2.863989 -0.259334 -1.857006 1 128 129
128 H -2.132201 -0.027953 -1.174211 2 127
129 H -2.873625 -1.224425 -1.874253 2 127
130 O 1.138300 1.133100 -2.085899 1 131 132
131 H 1.965506 1.503520 -1.725316 2 130
132 H 0.420521 1.534440 -1.551356 2 130
133 O -0.561328 4.590705 -2.780017 1 134 135
134 H -0.061173 3.919356 -3.294128 2 133
135 H -0.082763 4.733898 -1.955602 2 133
136 O -6.423002 -1.705204 -2.528225 1 137 138
137 H -7.233989 -1.949552 -1.975418 2 136
138 H -6.678416 -1.321413 -3.351278 2 136
139 O -2.772100 2.552210 -0.672282 1 140 141
140 H -2.907489 3.483552 -0.385605 2 139
141 H -2.977127 2.592348 -1.635820 2 139
142 O 6.708678 -4.852016 -8.379280 1 143 144
143 H 6.593474 -5.094964 -7.447187 2 142
144 H 6.582524 -5.591596 -8.966502 2 142
145 O -8.497001 -0.440284 2.803721 1 146 147
146 H -8.422350 0.331961 2.183451 2 145
147 H -9.377295 -0.756160 2.677026 2 145
148 O 2.975383 -0.894970 6.060783 1 149 150
149 H 2.093991 -0.995700 5.670129 2 148
150 H 3.458832 -0.759248 5.263958 2 148
151 O -6.085023 -1.629620 7.970284 1 152 153
152 H -6.685848 -2.391830 7.820849 2 151
153 H -6.177296 -1.190584 8.835912 2 151
154 O -3.763523 -3.356777 8.285436 1 155 156
155 H -4.660650 -3.029414 8.406662 2 154
156 H -3.411834 -3.178947 7.431180 2 154
157 O -1.100120 -0.320162 0.375372 1 158 159
158 H -0.527013 -1.012183 0.128652 2 157
159 H -0.673226 0.288559 0.934677 2 157
160 O 0.910209 -8.271802 1.411429 1 161 162
161 H 0.158544 -8.759532 1.870895 2 160
162 H 0.565924 -7.546113 0.944383 2 160
163 O 1.554065 -6.468033 3.310872 1 164 165
164 H 1.362455 -7.162802 2.722340 2 163
165 H 1.616233 -5.622409 2.872854 2 163
166 O 0.543127 -1.388652 4.886094 1 167 168
167 H 0.110320 -0.665826 5.311239 2 166
168 H 0.420366 -2.216367 5.267301 2 166
169 O 1.100526 1.019490 -9.255318 1 170 171
170 H 1.460815 0.575286 -8.484128 2 169
171 H 0.265613 0.594128 -9.297750 2 169
172 O -1.842348 2.327827 -5.355326 1 173 174
173 H -1.572941 2.573139 -6.288125 2 172
174 H -2.216679 1.439934 -5.361006 2 172
175 O 2.452307 -2.814686 -6.448759 1 176 177
176 H 2.862295 -3.091668 -5.589336 2 175
177 H 2.913920 -3.262923 -7.181510 2 175
178 O -2.207998 -3.112007 5.945795 1 179 180
179 H -1.262203 -3.125339 6.205467 2 178
180 H -2.228269 -2.421858 5.220629 2 178
181 O 5.845471 5.020556 -6.836491 1 182 183
182 H 5.557986 5.913737 -6.753889 2 181
183 H 5.089998 4.459153 -6.661079 2 181
184 O -3.421643 4.865553 0.731755 1 185 186
185 H -3.965419 4.458452 1.478214 2 184
186 H -3.973445 4.958338 -0.044430 2 184
187 O -2.302950 -2.349717 2.112168 1 188 189
188 H -2.576438 -1.873492 2.873191 2 187
189 H -1.882868 -1.715106 1.503782 2 187
190 O 0.305885 4.878766 3.791182 1 191 192
191 H 0.299338 5.855407 4.097578 2 190
192 H 1.169911 4.563497 4.030616 2 190
193 O 2.925008 -3.664845 -3.607450 1 194 195
194 H 3.015896 -3.916618 -2.644267 2 193
195 H 2.353923 -2.889459 -3.518284 2 193
196 O 1.111505 -4.070255 -9.085693 1 197 198
197 H 2.084905 -4.227348 -9.180249 2 196
198 H 0.897072 -4.902218 -8.740523 2 196
199 O -4.992929 -1.974219 -7.099668 1 200 201
200 H -5.173269 -1.186309 -7.673625 2 199
201 H -5.070893 -2.753273 -7.658821 2 199
202 O 4.730983 1.478420 0.720986 1 203 204
203 H 4.271686 1.988265 0.034225 2 202
204 H 4.117413 0.788607 1.061818 2 202
205 O 1.421583 -0.176666 -6.729105 1 206 207
206 H 1.217660 0.394331 -5.978213 2 205
207 H 1.948444 -0.877988 -6.400659 2 205
208 O -7.093223 -8.541193 4.116187 1 209 210
209 H -7.074252 -8.047477 3.242159 2 208
210 H -6.153142 -8.537148 4.455550 2 208
211 O 8.382540 -6.460958 3.765735 1 212 213
212 H 9.258625 -6.141972 4.060763 2 211
213 H 7.637364 -6.217910 4.407852 2 211
214 O -4.320241 4.037137 3.297092 1 215 216
215 H -3.750151 4.141786 4.105470 2 214
216 H -5.172925 4.455578 3.488906 2 214
217 O 5.581877 1.781994 7.505132 1 218 219
218 H 5.017196 1.139584 8.120950 2 217
219 H 5.330781 1.591217 6.595286 2 217
220 O -0.734443 1.125031 4.884666 1 221 222
221 H -0.239224 1.540322 4.142070 2 220
222 H -0.961628 1.783437 5.554548 2 220
223 O 6.831005 -9.249970 4.497165 1 224 225
224 H 6.836746 -9.068011 5.427146 2 223
225 H 7.668067 -9.652510 4.249957 2 223
226 O 2.714055 -3.677581 1.962003 1 227 228
227 H 3.333432 -3.851775 2.663540 2 226
228 H 3.095021 -3.978526 1.102566 2 226
229 O -1.364034 -5.762724 -5.514747 1 230 231
230 H -2.238584 -5.409106 -5.314718 2 229
231 H -0.948185 -4.908428 -5.559580 2 229
232 O -3.623435 -8.061229 1.383141 1 233 234
233 H -3.132847 -7.446722 1.857906 2 232
234 H -4.307943 -7.546630 0.933298 2 232
235 O 5.717894 6.958376 4.528556 1 236 237
236 H 5.852657 7.879846 4.341790 2 235
237 H 6.443636 6.708413 5.135144 2 235
238 O 8.121415 8.262619 -8.483986 1 239 240
239 H 8.585190 8.939651 -8.974230 2 238
240 H 7.560207 7.748539 -9.044644 2 238
241 O -5.111889 -0.352865 5.807903 1 242 243
242 H -5.940048 0.102298 5.569630 2 241
243 H -5.349104 -1.014090 6.507582 2 241
244 O 0.327324 2.563438 0.113251 1 245 246
245 H -0.633994 2.522136 -0.069385 2 244
246 H 0.724331 3.482989 0.160564 2 244
247 O -6.003367 -7.683112 -8.874252 1 248 249
248 H -6.987751 -7.912403 -8.892689 2 247
249 H -5.699015 -8.504722 -8.558813 2 247
250 O 0.789377 -6.357883 -7.563043 1 251 252
251 H -0.151101 -6.341313 -7.440906 2 250
252 H 1.090881 -5.879281 -6.770796 2 250
253 O 5.045666 7.219298 -5.151826 1 254 255
254 H 5.598994 7.846492 -5.618276 2 253
255 H 5.480466 6.978976 -4.337211 2 253
256 O 1.286092 6.990271 -6.806004 1 257 258
257 H 0.481329 7.140371 -7.345224 2 256
258 H 1.716012 7.791024 -6.762706 2 256
259 O -3.198783 -9.175883 -6.334156 1 260 261
260 H -3.032721 -8.198157 -6.198635 2 259
261 H -3.084774 -9.539992 -5.434969 2 259
262 O -2.002554 -5.668583 5.440781 1 263 264
263 H -2.347493 -4.756386 5.542471 2 262
264 H -2.133027 -6.049986 4.540349 2 262
265 O 6.174952 -8.574733 0.210584 1 266 267
266 H 5.358389 -8.191902 0.557392 2 265
267 H 6.760918 -8.561710 0.943985 2 265
268 O -6.278610 6.057339 4.042358 1 269 270
269 H -6.169211 6.708022 3.383078 2 268
270 H -7.221766 5.771239 4.032205 2 268
271 O 0.124733 -5.816398 0.203961 1 272 273
272 H 0.029974 -5.049468 0.786871 2 271
273 H -0.458026 -5.646677 -0.555312 2 271
274 O 3.839311 -0.064469 8.619720 1 275 276
275 H 3.586253 -0.282978 7.705313 2 274
276 H 3.079936 0.282626 9.065559 2 274
277 O 7.375986 -1.368885 4.452411 1 278 279
278 H 8.024931 -0.682735 4.768078 2 277
279 H 7.477247 -1.279372 3.493009 2 277
280 O 9.209092 -1.611532 -6.423337 1 281 282
281 H 9.487648 -2.470973 -6.800897 2 280
282 H 9.998917 -1.354277 -5.866779 2 280
283 O -5.314625 -5.613762 7.941745 1 284 285
284 H -5.589748 -6.389969 8.478078 2 283
285 H -4.444519 -5.357513 8.149460 2 283
286 O -3.655884 2.941259 -3.295211 1 287 288
287 H -4.418712 2.528163 -3.712668 2 286
288 H -2.937568 3.025005 -3.971189 2 286
289 O -8.786626 -3.149090 -1.640379 1 290 291
290 H -8.441651 -4.011755 -1.901885 2 289
291 H -9.285717 -3.276173 -0.834535 2 289
292 O -7.358188 8.239942 -2.093781 1 293 294
293 H -7.811518 7.751233 -2.768278 2 292
294 H -6.892430 7.625331 -1.541437 2 292
295 O 3.770974 -0.453172 -1.931225 1 296 297
296 H 4.245757 -0.966218 -1.286114 2 295
297 H 3.797803 0.441972 -1.542180 2 295
298 O 2.205813 4.098894 8.958738 1 299 300
299 H 3.001973 3.555440 8.746430 2 298
300 H 2.103639 4.243668 9.940011 2 298
301 O -8.723398 -8.284874 -8.890692 1 302 303
302 H -9.298972 -7.537539 -9.239127 2 301
303 H -8.772683 -8.361037 -7.925940 2 301
304 O -8.908952 0.807167 -7.785764 1 305 306
305 H -9.061230 -0.061912 -7.422589 2 304
306 H -9.534219 1.030144 -8.475490 2 304
307 O 9.182207 -3.418263 -8.430667 1 308 309
308 H 9.046738 -2.558299 -8.879898 2 307
309 H 8.390804 -3.958734 -8.701949 2 307
310 O 1.003162 9.279867 -8.313986 1 311 312
311 H 1.167271 10.190392 -8.070619 2 310
312 H 1.849962 8.761188 -8.493178 2 310
313 O -1.842572 4.893383 8.198130 1 314 315
314 H -2.468210 5.316242 8.833179 2 313
315 H -1.155294 4.389410 8.716281 2 313
316 O -4.005055 -3.953707 0.402347 1 317 318
317 H -3.682148 -3.305443 1.058769 2 316
318 H -4.738199 -4.452434 0.841144 2 316
319 O 3.511815 -7.590537 -9.004707 1 320 321
320 H 3.415066 -7.281286 -8.094635 2 319
321 H 3.251550 -6.835442 -9.579171 2 319
322 O -7.614136 -7.773463 1.262079 1 323 324
323 H -7.489497 -6.927033 0.753779 2 322
324 H -8.528840 -8.050689 1.164710 2 322
325 O -5.419143 7.061880 -5.745275 1 326 327
326 H -4.504905 6.840455 -5.750772 2 325
327 H -5.895918 6.221393 -5.676189 2 325
328 O -9.017162 1.888781 0.937813 1 329 330
329 H -9.868157 2.115056 0.623903 2 328
330 H -8.466599 1.708818 0.191067 2 328
331 O -8.037596 -5.106016 4.750802 1 332 333
332 H -7.322228 -5.707104 5.043673 2 331
333 H -8.230169 -4.481051 5.475067 2 331
334 O -4.390546 1.691502 -7.756245 1 335 336
335 H -3.558844 1.264966 -7.996466 2 334
336 H -4.136121 2.629917 -7.760619 2 334
337 O -3.975194 -6.218233 -6.927330 1 338 339
338 H -3.085645 -6.066352 -7.325296 2 337
339 H -4.640815 -6.676349 -7.524295 2 337
340 O 8.240648 5.082183 -8.857912 1 341 342
341 H 7.453645 5.101728 -8.259448 2 340
342 H 8.368223 4.228825 -9.227974 2 340
343 O 1.598931 -1.829796 -0.316752 1 344 345
344 H 1.992252 -1.475465 -1.149815 2 343
345 H 1.726926 -2.749881 -0.397199 2 343
346 O 1.433819 -1.386702 -3.304673 1 347 348
347 H 1.323094 -0.486757 -3.067110 2 346
348 H 0.623143 -1.802016 -3.264828 2 346
349 O 3.735991 5.554990 6.219603 1 350 351
350 H 3.320916 6.265941 6.761937 2 349
351 H 4.195666 6.053207 5.526652 2 349
352 O -6.285976 -9.228132 -4.460410 1 353 354
353 H -5.683885 -10.005163 -4.740870 2 352
354 H -6.707036 -9.488426 -3.608438 2 352
355 O 4.036200 -3.378299 6.905724 1 356 357
356 H 3.457441 -2.618106 6.794504 2 355
357 H 4.929409 -2.991177 6.666963 2 355
358 O 0.606517 8.561279 -3.782406 1 359 360
359 H 0.498099 9.526035 -3.699299 2 358
360 H 1.288545 8.500162 -4.475972 2 358
361 O -5.666717 8.368298 -8.299623 1 362 363
362 H -4.926661 7.904359 -8.744783 2 361
363 H -5.742748 8.095703 -7.389592 2 361
364 O -3.344692 7.636718 3.475830 1 365 366
365 H -4.140634 7.105012 3.296472 2 364
366 H -3.350797 7.470949 4.433350 2 364
367 O -1.322186 6.638182 0.028906 1 368 369
368 H -1.895088 6.054034 0.554933 2 367
369 H -1.928852 7.271511 -0.442137 2 367
370 O 8.793551 6.925450 7.841717 1 371 372
371 H 9.639675 7.325848 7.850680 2 370
372 H 8.776882 6.398711 8.674036 2 370
373 O -6.322101 0.607808 1.174099 1 374 375
374 H -5.647986 1.150825 1.588348 2 373
375 H -5.852992 -0.060471 0.660730 2 373
376 O 5.685139 -3.546046 -4.128549 1 377 378
377 H 4.727966 -3.473549 -4.165755 2 376
378 H 6.024761 -2.749532 -4.610993 2 376
379 O 3.821999 6.538527 1.678030 1 380 381
380 H 3.549684 7.331168 1.175762 2 379
381 H 3.816423 6.788603 2.602522 2 379
382 O 3.892622 -7.034239 -6.415978 1 383 384
383 H 4.720509 -6.539827 -6.295004 2 382
384 H 3.262810 -6.550918 -5.890370 2 382
385 O 5.454437 3.881722 -2.767521 1 386 387
386 H 5.906266 3.240489 -3.272250 2 385
387 H 6.116652 4.657253 -2.669082 2 385
388 O -4.179373 -8.326009 4.395005 1 389 390
389 H -3.737878 -8.754475 5.134173 2 388
390 H -3.934584 -8.825320 3.534465 2 388
391 O 7.949488 -1.353498 9.244688 1 392 393
392 H 7.234465 -1.100736 9.869694 2 391
393 H 8.010855 -0.754076 8.476271 2 391
394 O 4.498603 -4.219267 3.963173 1 395 396
395 H 4.895226 -3.311215 4.147093 2 394
396 H 4.802371 -4.871698 4.671292 2 394
397 O -4.307250 7.384668 -2.879462 1 398 399
398 H -3.402854 7.237543 -3.252031 2 397
399 H -4.143231 7.834459 -2.019767 2 397
400 O 2.868752 -0.418389 1.909340 1 401 402
401 H 2.544472 -0.880398 1.179279 2 400
402 H 2.082841 -0.227627 2.457964 2 400
403 O 7.961389 1.611971 4.525253 1 404 405
404 H 7.498497 1.833174 3.728113 2 403
405 H 8.841880 2.050996 4.576281 2 403
406 O 2.692467 -4.517946 -0.884665 1 407 408
407 H 1.789435 -4.835617 -0.587396 2 406
408 H 3.330887 -5.126025 -0.474679 2 406
409 O 0.711797 1.680547 -4.780435 1 410 411
410 H 0.854596 1.567911 -3.850059 2 409
411 H -0.187286 1.868256 -4.936632 2 409
412 O 4.558200 -0.044434 -4.673875 1 413 414
413 H 5.376141 -0.551202 -4.913295 2 412
414 H 4.409600 -0.197728 -3.739555 2 412
415 O 7.109730 0.453475 -0.268844 1 416 417
416 H 6.996444 0.098599 -1.119484 2 415
417 H 6.343115 1.050849 -0.110689 2 415
418 O -2.549577 -0.200852 -4.492507 1 419 420
419 H -3.199039 -0.856439 -4.888752 2 418
420 H -2.605120 -0.151501 -3.534000 2 418
421 O -8.527353 4.524174 -2.347408 1 422 423
422 H -7.662213 4.342466 -2.104852 2 421
423 H -8.794374 3.696793 -2.795740 2 421
424 O -2.820431 -0.700478 4.413266 1 425 426
425 H -2.088343 -0.069797 4.530521 2 424
426 H -3.535913 -0.413547 5.069151 2 424
427 O 6.924598 -1.285634 -4.901833 1 428 429
428 H 7.496477 -0.831510 -4.206076 2 427
429 H 7.527035 -1.446676 -5.677236 2 427
430 O -5.353763 6.572088 6.734366 1 431 432
431 H -4.428432 6.663173 6.834862 2 430
432 H -5.603600 6.385787 5.822425 2 430
433 O 7.661597 2.386104 9.175259 1 434 435
434 H 7.321694 2.395921 10.055536 2 433
435 H 6.959141 2.102200 8.533079 2 433
436 O -3.496590 -3.765912 -4.994838 1 437 438
437 H -3.612181 -3.620689 -4.036115 2 436
438 H -4.323649 -3.527816 -5.463213 2 436
439 O -9.351953 8.343146 3.704719 1 440 441
440 H -8.465363 8.758592 3.736785 2 439
441 H -9.159223 7.399420 3.880808 2 439
442 O -0.957571 -5.174275 -2.190170 1 443 444
443 H -1.907345 -5.209294 -2.303164 2 442
444 H -0.758582 -4.314608 -2.636469 2 442
445 O 5.048831 -7.988284 2.587515 1 446 447
446 H 5.870168 -8.296198 3.043816 2 445
447 H 4.551970 -7.498875 3.229280 2 445
448 O 3.705658 8.368298 -8.304931 1 449 450
449 H 3.860607 9.297256 -8.425405 2 448
450 H 3.866516 8.146007 -7.371475 2 448
451 O -2.535134 7.116414 6.338590 1 452 453
452 H -1.918884 7.705593 6.804078 2 451
453 H -1.975225 6.330832 6.121365 2 451
454 O -3.440263 7.005018 9.111704 1 455 456
455 H -2.633953 7.421761 9.465848 2 454
456 H -3.654896 7.513753 8.256470 2 454
457 O 6.452501 -5.478051 -5.722874 1 458 459
458 H 7.297698 -5.914122 -5.586895 2 457
459 H 6.253267 -4.919338 -4.937095 2 457
460 O -6.528475 4.497861 -5.573636 1 461 462
461 H -6.257840 4.684056 -4.656222 2 460
462 H -7.247764 3.931701 -5.623068 2 460
463 O -7.310706 8.183648 7.852201 1 464 465
464 H -6.552879 7.735013 7.436342 2 463
465 H -6.877865 8.451022 8.686616 2 463
466 O -1.476441 -7.867001 7.421787 1 467 468
467 H -0.852398 -8.570669 7.084405 2 466
468 H -1.363740 -7.190554 6.737331 2 466
469 O 5.228019 -0.495870 -7.592953 1 470 471
470 H 4.737616 -0.538139 -6.742036 2 469
471 H 4.625354 -0.901329 -8.269022 2 469
472 O 7.566531 -1.006734 1.808213 1 473 474
473 H 7.657411 -1.866188 1.428564 2 472
474 H 7.358547 -0.388051 1.139943 2 472
475 O 1.850924 -5.717449 -5.035416 1 476 477
476 H 1.721040 -6.227449 -4.217213 2 475
477 H 2.199319 -4.856378 -4.692892 2 475
478 O -8.904325 6.791585 -3.842866 1 479 480
479 H -8.690637 5.952112 -3.490118 2 478
480 H -8.676001 6.844077 -4.770651 2 478
481 O -3.434304 4.397198 -7.863568 1 482 483
482 H -2.634777 3.892027 -7.779256 2 481
483 H -3.432847 5.161485 -7.310788 2 481
484 O -7.446738 6.124823 0.150068 1 485 486
485 H -7.404893 5.207959 0.481504 2 484
486 H -8.405563 6.215466 -0.024439 2 484
487 O 0.195330 -7.307128 -3.501714 1 488 489
488 H -0.240912 -6.769004 -4.243655 2 487
489 H -0.194915 -6.981989 -2.679860 2 487
490 O 7.068819 9.130323 7.260588 1 491 492
491 H 6.559855 8.400987 7.699406 2 490
492 H 7.972497 8.829223 7.213747 2 490
493 O -0.185218 -3.192290 -6.289346 1 494 495
494 H 0.776651 -3.073203 -6.391948 2 493
495 H -0.497426 -2.964088 -7.170893 2 493
496 O -2.073630 4.369672 5.251074 1 497 498
497 H -1.868638 3.811508 6.060261 2 496
498 H -1.253174 4.326708 4.781680 2 496
499 O -0.855003 3.069108 -7.935226 1 500 501
500 H 0.075758 3.132202 -7.617253 2 499
501 H -1.009845 2.207487 -8.320426 2 499
502 O -6.328833 0.064083 -8.467228 1 503 504
503 H -7.268416 0.384648 -8.383978 2 502
504 H -5.825246 0.919304 -8.320175 2 502
505 O -8.276352 -8.809851 -6.344910 1 506 507
506 H -7.541457 -8.792368 -5.688031 2 505
507 H -8.510208 -9.731116 -6.353248 2 505
508 O 0.463654 2.826776 7.018388 1 509 510
509 H 0.875324 3.588447 7.482107 2 508
510 H 0.770257 2.126646 7.583650 2 508
511 O 0.478371 -3.407198 6.910039 1 512 513
512 H 0.585298 -2.996750 7.756467 2 511
513 H 0.556531 -4.390636 7.183527 2 511
514 O -1.689559 7.002511 -3.303561 1 515 516
515 H -1.009152 7.635432 -3.553133 2 514
516 H -1.333699 6.195680 -2.919485 2 514
517 O 9.000097 -6.227871 8.137681 1 518 519
518 H 9.373858 -6.821152 7.497417 2 517
519 H 8.024020 -6.011019 8.033727 2 517
520 O 1.272378 1.954065 3.058033 1 521 522
521 H 1.260842 2.615112 2.341207 2 520
522 H 1.890312 2.223439 3.732934 2 520
523 O 4.139066 -3.527427 -9.022609 1 524 525
524 H 4.070028 -3.499117 -9.985525 2 523
525 H 4.960292 -3.942364 -8.778433 2 523
526 O 7.176276 2.178662 -4.075940 1 527 528
527 H 6.995275 1.684022 -4.873223 2 526
528 H 7.621313 2.984315 -4.393994 2 526
529 O -0.034836 -3.929919 2.148095 1 530 531
530 H 0.838003 -3.513346 2.259663 2 529
531 H -0.654999 -3.288581 2.426748 2 529
532 O -8.701616 2.795237 -5.700842 1 533 534
533 H -8.848959 2.145603 -6.420186 2 532
534 H -9.464654 3.362988 -5.610379 2 532
535 O 2.804444 8.909551 -5.635389 1 536 537
536 H 3.063615 9.805993 -5.770957 2 535
537 H 3.512196 8.486179 -5.165468 2 535
538 O 3.236002 8.357402 3.636639 1 539 540
539 H 3.450854 9.071799 3.073263 2 538
540 H 3.476445 8.586691 4.607935 2 538
541 O 5.628532 7.185941 8.510937 1 542 543
542 H 5.467837 6.318153 8.138885 2 541
543 H 4.964153 7.477925 9.150467 2 541
544 O -3.767261 1.260390 2.017681 1 545 546
545 H -3.707734 2.019520 2.565591 2 544
546 H -3.364602 1.609935 1.212351 2 544
547 O 8.228917 -3.441761 0.850139 1 548 549
548 H 9.022130 -3.709208 1.334881 2 547
549 H 7.553662 -3.976731 1.276651 2 547
550 O -3.004292 1.345869 7.236734 1 551 552
551 H -3.715311 0.724731 6.912689 2 550
552 H -3.525684 2.111901 7.538936 2 550
553 O 4.901423 -5.547141 -0.119795 1 554 555
554 H 5.327550 -5.560969 0.769770 2 553
555 H 5.447642 -4.930752 -0.617088 2 553
556 O -3.306210 8.469477 -0.495057 1 557 558
557 H -2.836855 9.122642 -1.080706 2 556
558 H -3.311215 8.916887 0.353875 2 556
559 O -6.572180 3.018421 -0.262079 1 560 561
560 H -6.711444 2.659956 0.606460 2 559
561 H -6.040782 2.473886 -0.843542 2 559
562 O -5.429147 -5.967833 5.177682 1 563 564
563 H -4.896648 -6.608203 4.692534 2 562
564 H -5.386594 -6.130690 6.117931 2 562
565 O 6.054430 7.035601 0.031519 1 566 567
566 H 5.939348 7.951184 -0.141094 2 565
567 H 5.390949 6.866654 0.702638 2 565
568 O -0.890229 -2.615376 -3.621726 1 569 570
569 H -1.695442 -2.097314 -3.537976 2 568
570 H -0.895128 -2.637531 -4.561712 2 568
571 O -5.446979 0.994907 -2.106714 1 572 573
572 H -4.494883 0.997912 -1.881595 2 571
573 H -5.759736 0.094199 -1.919247 2 571
574 O -7.517688 -4.078340 7.202707 1 575 576
575 H -8.242348 -4.324693 7.729813 2 574
576 H -6.924399 -4.817453 7.269430 2 574
577 O -1.134884 8.628488 2.081069 1 578 579
578 H -1.962897 8.634713 2.554947 2 577
579 H -1.119731 7.882422 1.516003 2 577
580 O -6.288317 8.011683 2.022129 1 581 582
581 H -6.404647 8.858198 1.546109 2 580
582 H -6.669138 7.315199 1.482614 2 580
583 O -6.766934 -4.026505 -8.306645 1 584 585
584 H -6.542552 -4.855702 -8.828363 2 583
585 H -7.743726 -3.954163 -8.170031 2 583
586 O 6.895244 7.052113 -3.031289 1 587 588
587 H 7.810039 7.265357 -3.330751 2 586
588 H 6.666757 7.541675 -2.202178 2 586
589 O 8.003260 4.735929 -5.168656 1 590 591
590 H 7.233375 4.730204 -5.685772 2 589
591 H 8.406708 5.629580 -5.300038 2 589
592 O -5.230160 -6.461196 -4.390836 1 593 594
593 H -5.701559 -7.313756 -4.377348 2 592
594 H -4.855545 -6.327970 -5.273444 2 592
595 O -3.803496 -9.221115 7.305476 1 596 597
596 H -2.934288 -8.877999 7.425047 2 595
597 H -4.416066 -8.566250 7.573191 2 595
598 O -5.990438 -1.574415 3.072521 1 599 600
599 H -5.805447 -1.119293 3.933731 2 598
600 H -6.651651 -0.947206 2.634773 2 598
601 O 1.155451 7.138377 -1.178317 1 602 603
602 H 0.330359 7.363227 -0.724568 2 601
603 H 1.055145 7.478676 -2.100793 2 601
604 O -5.886817 5.150957 -2.997276 1 605 606
605 H -5.191777 4.556623 -2.611465 2 604
606 H -5.401622 6.003350 -3.064194 2 604
607 O 2.539927 3.387568 4.976180 1 608 609
608 H 1.760904 3.182324 5.589217 2 607
609 H 2.841539 4.315465 5.278853 2 607
610 O 8.331859 -7.344673 -5.188191 1 611 612
611 H 8.424401 -7.586778 -4.198621 2 610
612 H 8.911675 -7.764424 -5.823267 2 610
613 O -5.774081 1.315144 -5.304553 1 614 615
614 H -5.222992 1.580336 -6.077077 2 613
615 H -6.219878 2.178441 -5.093360 2 613
616 O 6.340084 -4.926064 2.149626 1 617 618
617 H 5.639784 -4.766017 2.829591 2 616
618 H 6.883511 -5.598794 2.562820 2 616
619 O -2.722394 6.614441 -5.843805 1 620 621
620 H -2.332414 7.251953 -6.403722 2 619
621 H -2.221682 6.596615 -5.034993 2 619
622 O -1.813152 0.712824 -9.048176 1 623 624
623 H -1.763921 -0.271744 -8.916841 2 622
624 H -2.097796 0.860500 -9.970314 2 622
625 O 6.146244 -6.879929 8.376712 1 626 627
626 H 5.324465 -7.183905 8.841506 2 625
627 H 6.642264 -7.749945 8.201756 2 625
628 O 2.887544 8.612615 0.453821 1 629 630
629 H 2.452117 8.047637 -0.251289 2 628
630 H 2.348751 9.285636 0.895642 2 628
631 O -8.475558 -8.180718 6.501232 1 632 633
632 H -8.034310 -8.945692 6.891221 2 631
633 H -8.173606 -8.179435 5.569319 2 631
634 O 6.714205 -2.947903 6.551671 1 635 636
635 H 7.143284 -2.459194 7.270891 2 634
636 H 7.212365 -2.637046 5.791018 2 634
637 O 6.445003 -5.462306 5.577966 1 638 639
638 H 6.730099 -4.696457 6.073312 2 637
639 H 6.099428 -6.099736 6.222859 2 637
640 O -1.818761 -6.080111 -8.805420 1 641 642
641 H -1.644534 -6.777931 -9.477669 2 640
642 H -2.078582 -5.258591 -9.215838 2 640
643 O 6.037377 2.950576 2.863541 1 644 645
644 H 6.409766 3.757001 2.570754 2 643
645 H 5.577033 2.617474 2.090587 2 643
646 O -7.731645 3.337668 3.301121 1 647 648
647 H -8.345957 4.027222 3.589257 2 646
648 H -8.130328 2.845238 2.577949 2 646

View File

@ -0,0 +1,7 @@
6 Schaefer Water Dimer 1
1 O -0.024616 -0.001154 -0.003748 1 2 3
2 H -0.244211 -0.000666 0.933978 2 1
3 H 0.932234 -0.000406 -0.008705 2 1
4 O -0.892721 0.000120 2.773674 1 5 6
5 H -1.462996 0.755120 2.933870 2 4
6 H -1.461809 -0.755549 2.934934 2 4

View File

@ -0,0 +1,19 @@
18 TINKER Water Hexamer
1 O -1.502169 -0.191359 1.434927 1 2 3
2 H -0.601054 -0.596972 1.553718 2 1
3 H -2.006698 -0.422327 2.219847 2 1
4 O -1.744575 -0.382348 -1.309144 1 5 6
5 H -1.888941 -0.479653 -0.347624 2 4
6 H -2.516835 -0.766765 -1.733766 2 4
7 O -0.560409 2.017830 -0.121984 1 8 9
8 H -0.947720 1.533567 0.625228 2 7
9 H -0.989831 1.592736 -0.877419 2 7
10 O 0.964803 -1.165765 1.439987 1 11 12
11 H 0.979557 -1.522041 0.527833 2 10
12 H 1.542224 -0.393692 1.344373 2 10
13 O 0.974705 -1.401503 -1.335970 1 14 15
14 H 0.065161 -1.118951 -1.522886 2 13
15 H 1.470709 -0.570933 -1.277710 2 13
16 O 2.002280 1.057824 -0.124502 1 17 18
17 H 1.141637 1.532266 -0.140121 2 16
18 H 2.674716 1.735342 -0.237995 2 16

View File

@ -17,6 +17,7 @@
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "irregular.h" #include "irregular.h"
#include "pair.h"
#include "kspace.h" #include "kspace.h"
#include "memory.h" #include "memory.h"
@ -926,21 +927,31 @@ int GridComm::ghost_adjacent_tiled()
forward comm of my owned cells to other's ghost cells forward comm of my owned cells to other's ghost cells
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void GridComm::forward_comm_kspace(KSpace *kspace, int nper, int nbyte, int which, void GridComm::forward_comm(KSpace *kspace, int nper, int nbyte, int which,
void *buf1, void *buf2, MPI_Datatype datatype) void *buf1, void *buf2, MPI_Datatype datatype)
{ {
if (layout == REGULAR) if (layout == REGULAR)
forward_comm_kspace_regular(kspace,nper,nbyte,which,buf1,buf2,datatype); forward_comm_regular(kspace,nper,nbyte,which,buf1,buf2,datatype);
else else
forward_comm_kspace_tiled(kspace,nper,nbyte,which,buf1,buf2,datatype); forward_comm_tiled(kspace,nper,nbyte,which,buf1,buf2,datatype);
}
void GridComm::forward_comm(Pair *pair, int nper, int nbyte, int which,
void *buf1, void *buf2, MPI_Datatype datatype)
{
if (layout == REGULAR)
forward_comm_regular(pair,nper,nbyte,which,buf1,buf2,datatype);
else
forward_comm_tiled(pair,nper,nbyte,which,buf1,buf2,datatype);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
forward comm on regular grid of procs via list of swaps with 6 neighbor procs forward comm on regular grid of procs via list of swaps with 6 neighbor procs
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
template <class T>
void GridComm:: void GridComm::
forward_comm_kspace_regular(KSpace *kspace, int nper, int /*nbyte*/, int which, forward_comm_regular(T *caller, int nper, int /*nbyte*/, int which,
void *buf1, void *buf2, MPI_Datatype datatype) void *buf1, void *buf2, MPI_Datatype datatype)
{ {
int m; int m;
@ -948,9 +959,9 @@ forward_comm_kspace_regular(KSpace *kspace, int nper, int /*nbyte*/, int which,
for (m = 0; m < nswap; m++) { for (m = 0; m < nswap; m++) {
if (swap[m].sendproc == me) if (swap[m].sendproc == me)
kspace->pack_forward_grid(which,buf2,swap[m].npack,swap[m].packlist); caller->pack_forward_grid(which,buf2,swap[m].npack,swap[m].packlist);
else else
kspace->pack_forward_grid(which,buf1,swap[m].npack,swap[m].packlist); caller->pack_forward_grid(which,buf1,swap[m].npack,swap[m].packlist);
if (swap[m].sendproc != me) { if (swap[m].sendproc != me) {
if (swap[m].nunpack) MPI_Irecv(buf2,nper*swap[m].nunpack,datatype, if (swap[m].nunpack) MPI_Irecv(buf2,nper*swap[m].nunpack,datatype,
@ -960,7 +971,7 @@ forward_comm_kspace_regular(KSpace *kspace, int nper, int /*nbyte*/, int which,
if (swap[m].nunpack) MPI_Wait(&request,MPI_STATUS_IGNORE); if (swap[m].nunpack) MPI_Wait(&request,MPI_STATUS_IGNORE);
} }
kspace->unpack_forward_grid(which,buf2,swap[m].nunpack,swap[m].unpacklist); caller->unpack_forward_grid(which,buf2,swap[m].nunpack,swap[m].unpacklist);
} }
} }
@ -968,8 +979,9 @@ forward_comm_kspace_regular(KSpace *kspace, int nper, int /*nbyte*/, int which,
forward comm on tiled grid decomp via Send/Recv lists of each neighbor proc forward comm on tiled grid decomp via Send/Recv lists of each neighbor proc
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
template <class T>
void GridComm:: void GridComm::
forward_comm_kspace_tiled(KSpace *kspace, int nper, int nbyte, int which, forward_comm_tiled(T *caller, int nper, int nbyte, int which,
void *buf1, void *vbuf2, MPI_Datatype datatype) void *buf1, void *vbuf2, MPI_Datatype datatype)
{ {
int i,m,offset; int i,m,offset;
@ -987,15 +999,15 @@ forward_comm_kspace_tiled(KSpace *kspace, int nper, int nbyte, int which,
// perform all sends to other procs // perform all sends to other procs
for (m = 0; m < nsend; m++) { for (m = 0; m < nsend; m++) {
kspace->pack_forward_grid(which,buf1,send[m].npack,send[m].packlist); caller->pack_forward_grid(which,buf1,send[m].npack,send[m].packlist);
MPI_Send(buf1,nper*send[m].npack,datatype,send[m].proc,0,gridcomm); MPI_Send(buf1,nper*send[m].npack,datatype,send[m].proc,0,gridcomm);
} }
// perform all copies to self // perform all copies to self
for (m = 0; m < ncopy; m++) { for (m = 0; m < ncopy; m++) {
kspace->pack_forward_grid(which,buf1,copy[m].npack,copy[m].packlist); caller->pack_forward_grid(which,buf1,copy[m].npack,copy[m].packlist);
kspace->unpack_forward_grid(which,buf1,copy[m].nunpack,copy[m].unpacklist); caller->unpack_forward_grid(which,buf1,copy[m].nunpack,copy[m].unpacklist);
} }
// unpack all received data // unpack all received data
@ -1003,7 +1015,7 @@ forward_comm_kspace_tiled(KSpace *kspace, int nper, int nbyte, int which,
for (i = 0; i < nrecv; i++) { for (i = 0; i < nrecv; i++) {
MPI_Waitany(nrecv,requests,&m,MPI_STATUS_IGNORE); MPI_Waitany(nrecv,requests,&m,MPI_STATUS_IGNORE);
offset = nper * recv[m].offset * nbyte; offset = nper * recv[m].offset * nbyte;
kspace->unpack_forward_grid(which,(void *) &buf2[offset], caller->unpack_forward_grid(which,(void *) &buf2[offset],
recv[m].nunpack,recv[m].unpacklist); recv[m].nunpack,recv[m].unpacklist);
} }
} }
@ -1012,21 +1024,31 @@ forward_comm_kspace_tiled(KSpace *kspace, int nper, int nbyte, int which,
reverse comm of my ghost cells to sum to owner cells reverse comm of my ghost cells to sum to owner cells
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void GridComm::reverse_comm_kspace(KSpace *kspace, int nper, int nbyte, int which, void GridComm::reverse_comm(KSpace *kspace, int nper, int nbyte, int which,
void *buf1, void *buf2, MPI_Datatype datatype) void *buf1, void *buf2, MPI_Datatype datatype)
{ {
if (layout == REGULAR) if (layout == REGULAR)
reverse_comm_kspace_regular(kspace,nper,nbyte,which,buf1,buf2,datatype); reverse_comm_regular(kspace,nper,nbyte,which,buf1,buf2,datatype);
else else
reverse_comm_kspace_tiled(kspace,nper,nbyte,which,buf1,buf2,datatype); reverse_comm_tiled(kspace,nper,nbyte,which,buf1,buf2,datatype);
}
void GridComm::reverse_comm(Pair *pair, int nper, int nbyte, int which,
void *buf1, void *buf2, MPI_Datatype datatype)
{
if (layout == REGULAR)
reverse_comm_regular(pair,nper,nbyte,which,buf1,buf2,datatype);
else
reverse_comm_tiled(pair,nper,nbyte,which,buf1,buf2,datatype);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
reverse comm on regular grid of procs via list of swaps with 6 neighbor procs reverse comm on regular grid of procs via list of swaps with 6 neighbor procs
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
template <class T>
void GridComm:: void GridComm::
reverse_comm_kspace_regular(KSpace *kspace, int nper, int /*nbyte*/, int which, reverse_comm_regular(T *caller, int nper, int /*nbyte*/, int which,
void *buf1, void *buf2, MPI_Datatype datatype) void *buf1, void *buf2, MPI_Datatype datatype)
{ {
int m; int m;
@ -1034,9 +1056,9 @@ reverse_comm_kspace_regular(KSpace *kspace, int nper, int /*nbyte*/, int which,
for (m = nswap-1; m >= 0; m--) { for (m = nswap-1; m >= 0; m--) {
if (swap[m].recvproc == me) if (swap[m].recvproc == me)
kspace->pack_reverse_grid(which,buf2,swap[m].nunpack,swap[m].unpacklist); caller->pack_reverse_grid(which,buf2,swap[m].nunpack,swap[m].unpacklist);
else else
kspace->pack_reverse_grid(which,buf1,swap[m].nunpack,swap[m].unpacklist); caller->pack_reverse_grid(which,buf1,swap[m].nunpack,swap[m].unpacklist);
if (swap[m].recvproc != me) { if (swap[m].recvproc != me) {
if (swap[m].npack) MPI_Irecv(buf2,nper*swap[m].npack,datatype, if (swap[m].npack) MPI_Irecv(buf2,nper*swap[m].npack,datatype,
@ -1046,7 +1068,7 @@ reverse_comm_kspace_regular(KSpace *kspace, int nper, int /*nbyte*/, int which,
if (swap[m].npack) MPI_Wait(&request,MPI_STATUS_IGNORE); if (swap[m].npack) MPI_Wait(&request,MPI_STATUS_IGNORE);
} }
kspace->unpack_reverse_grid(which,buf2,swap[m].npack,swap[m].packlist); caller->unpack_reverse_grid(which,buf2,swap[m].npack,swap[m].packlist);
} }
} }
@ -1054,8 +1076,9 @@ reverse_comm_kspace_regular(KSpace *kspace, int nper, int /*nbyte*/, int which,
reverse comm on tiled grid decomp via Send/Recv lists of each neighbor proc reverse comm on tiled grid decomp via Send/Recv lists of each neighbor proc
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
template <class T>
void GridComm:: void GridComm::
reverse_comm_kspace_tiled(KSpace *kspace, int nper, int nbyte, int which, reverse_comm_tiled(T *caller, int nper, int nbyte, int which,
void *buf1, void *vbuf2, MPI_Datatype datatype) void *buf1, void *vbuf2, MPI_Datatype datatype)
{ {
int i,m,offset; int i,m,offset;
@ -1073,15 +1096,15 @@ reverse_comm_kspace_tiled(KSpace *kspace, int nper, int nbyte, int which,
// perform all sends to other procs // perform all sends to other procs
for (m = 0; m < nrecv; m++) { for (m = 0; m < nrecv; m++) {
kspace->pack_reverse_grid(which,buf1,recv[m].nunpack,recv[m].unpacklist); caller->pack_reverse_grid(which,buf1,recv[m].nunpack,recv[m].unpacklist);
MPI_Send(buf1,nper*recv[m].nunpack,datatype,recv[m].proc,0,gridcomm); MPI_Send(buf1,nper*recv[m].nunpack,datatype,recv[m].proc,0,gridcomm);
} }
// perform all copies to self // perform all copies to self
for (m = 0; m < ncopy; m++) { for (m = 0; m < ncopy; m++) {
kspace->pack_reverse_grid(which,buf1,copy[m].nunpack,copy[m].unpacklist); caller->pack_reverse_grid(which,buf1,copy[m].nunpack,copy[m].unpacklist);
kspace->unpack_reverse_grid(which,buf1,copy[m].npack,copy[m].packlist); caller->unpack_reverse_grid(which,buf1,copy[m].npack,copy[m].packlist);
} }
// unpack all received data // unpack all received data
@ -1089,7 +1112,7 @@ reverse_comm_kspace_tiled(KSpace *kspace, int nper, int nbyte, int which,
for (i = 0; i < nsend; i++) { for (i = 0; i < nsend; i++) {
MPI_Waitany(nsend,requests,&m,MPI_STATUS_IGNORE); MPI_Waitany(nsend,requests,&m,MPI_STATUS_IGNORE);
offset = nper * send[m].offset * nbyte; offset = nper * send[m].offset * nbyte;
kspace->unpack_reverse_grid(which,(void *) &buf2[offset], caller->unpack_reverse_grid(which,(void *) &buf2[offset],
send[m].npack,send[m].packlist); send[m].npack,send[m].packlist);
} }
} }

View File

@ -27,8 +27,11 @@ class GridComm : protected Pointers {
virtual ~GridComm(); virtual ~GridComm();
void setup(int &, int &); void setup(int &, int &);
int ghost_adjacent(); int ghost_adjacent();
void forward_comm_kspace(class KSpace *, int, int, int, void *, void *, MPI_Datatype);
void reverse_comm_kspace(class KSpace *, int, int, int, void *, void *, MPI_Datatype); void forward_comm(class KSpace *, int, int, int, void *, void *, MPI_Datatype);
void forward_comm(class Pair *, int, int, int, void *, void *, MPI_Datatype);
void reverse_comm(class KSpace *, int, int, int, void *, void *, MPI_Datatype);
void reverse_comm(class Pair *, int, int, int, void *, void *, MPI_Datatype);
protected: protected:
int me, nprocs; int me, nprocs;
@ -181,10 +184,14 @@ class GridComm : protected Pointers {
int ghost_adjacent_regular(); int ghost_adjacent_regular();
int ghost_adjacent_tiled(); int ghost_adjacent_tiled();
void forward_comm_kspace_regular(class KSpace *, int, int, int, void *, void *, MPI_Datatype); template <class T>
void forward_comm_kspace_tiled(class KSpace *, int, int, int, void *, void *, MPI_Datatype); void forward_comm_regular(T *, int, int, int, void *, void *, MPI_Datatype);
void reverse_comm_kspace_regular(class KSpace *, int, int, int, void *, void *, MPI_Datatype); template <class T>
void reverse_comm_kspace_tiled(class KSpace *, int, int, int, void *, void *, MPI_Datatype); void forward_comm_tiled(T *, int, int, int, void *, void *, MPI_Datatype);
template <class T>
void reverse_comm_regular(T *, int, int, int, void *, void *, MPI_Datatype);
template <class T>
void reverse_comm_tiled(T *, int, int, int, void *, void *, MPI_Datatype);
virtual void grow_swap(); virtual void grow_swap();
void grow_overlap(); void grow_overlap();

View File

@ -465,7 +465,7 @@ void MSM::compute(int eflag, int vflag)
// to fully sum contribution in their 3d grid // to fully sum contribution in their 3d grid
current_level = 0; current_level = 0;
gcall->reverse_comm_kspace(this,1,sizeof(double),REVERSE_RHO, gcall->reverse_comm(this,1,sizeof(double),REVERSE_RHO,
gcall_buf1,gcall_buf2,MPI_DOUBLE); gcall_buf1,gcall_buf2,MPI_DOUBLE);
// forward communicate charge density values to fill ghost grid points // forward communicate charge density values to fill ghost grid points
@ -474,7 +474,7 @@ void MSM::compute(int eflag, int vflag)
for (int n=0; n<=levels-2; n++) { for (int n=0; n<=levels-2; n++) {
if (!active_flag[n]) continue; if (!active_flag[n]) continue;
current_level = n; current_level = n;
gc[n]->forward_comm_kspace(this,1,sizeof(double),FORWARD_RHO, gc[n]->forward_comm(this,1,sizeof(double),FORWARD_RHO,
gc_buf1[n],gc_buf2[n],MPI_DOUBLE); gc_buf1[n],gc_buf2[n],MPI_DOUBLE);
direct(n); direct(n);
restriction(n); restriction(n);
@ -487,15 +487,15 @@ void MSM::compute(int eflag, int vflag)
if (domain->nonperiodic) { if (domain->nonperiodic) {
current_level = levels-1; current_level = levels-1;
gc[levels-1]-> gc[levels-1]->
forward_comm_kspace(this,1,sizeof(double),FORWARD_RHO, forward_comm(this,1,sizeof(double),FORWARD_RHO,
gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE); gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE);
direct_top(levels-1); direct_top(levels-1);
gc[levels-1]-> gc[levels-1]->
reverse_comm_kspace(this,1,sizeof(double),REVERSE_AD, reverse_comm(this,1,sizeof(double),REVERSE_AD,
gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE); gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE);
if (vflag_atom) if (vflag_atom)
gc[levels-1]-> gc[levels-1]->
reverse_comm_kspace(this,6,sizeof(double),REVERSE_AD_PERATOM, reverse_comm(this,6,sizeof(double),REVERSE_AD_PERATOM,
gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE); gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE);
} else { } else {
@ -506,7 +506,7 @@ void MSM::compute(int eflag, int vflag)
current_level = levels-1; current_level = levels-1;
if (vflag_atom) if (vflag_atom)
gc[levels-1]-> gc[levels-1]->
reverse_comm_kspace(this,6,sizeof(double),REVERSE_AD_PERATOM, reverse_comm(this,6,sizeof(double),REVERSE_AD_PERATOM,
gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE); gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE);
} }
} }
@ -519,13 +519,13 @@ void MSM::compute(int eflag, int vflag)
prolongation(n); prolongation(n);
current_level = n; current_level = n;
gc[n]->reverse_comm_kspace(this,1,sizeof(double),REVERSE_AD, gc[n]->reverse_comm(this,1,sizeof(double),REVERSE_AD,
gc_buf1[n],gc_buf2[n],MPI_DOUBLE); gc_buf1[n],gc_buf2[n],MPI_DOUBLE);
// extra per-atom virial communication // extra per-atom virial communication
if (vflag_atom) if (vflag_atom)
gc[n]->reverse_comm_kspace(this,6,sizeof(double),REVERSE_AD_PERATOM, gc[n]->reverse_comm(this,6,sizeof(double),REVERSE_AD_PERATOM,
gc_buf1[n],gc_buf2[n],MPI_DOUBLE); gc_buf1[n],gc_buf2[n],MPI_DOUBLE);
} }
@ -533,13 +533,13 @@ void MSM::compute(int eflag, int vflag)
// to fill ghost cells surrounding their 3d bricks // to fill ghost cells surrounding their 3d bricks
current_level = 0; current_level = 0;
gcall->forward_comm_kspace(this,1,sizeof(double),FORWARD_AD, gcall->forward_comm(this,1,sizeof(double),FORWARD_AD,
gcall_buf1,gcall_buf2,MPI_DOUBLE); gcall_buf1,gcall_buf2,MPI_DOUBLE);
// extra per-atom energy/virial communication // extra per-atom energy/virial communication
if (vflag_atom) if (vflag_atom)
gcall->forward_comm_kspace(this,6,sizeof(double),FORWARD_AD_PERATOM, gcall->forward_comm(this,6,sizeof(double),FORWARD_AD_PERATOM,
gcall_buf1,gcall_buf2,MPI_DOUBLE); gcall_buf1,gcall_buf2,MPI_DOUBLE);
// calculate the force on my particles (interpolation) // calculate the force on my particles (interpolation)

View File

@ -160,7 +160,7 @@ void MSMCG::compute(int eflag, int vflag)
// to fully sum contribution in their 3d grid // to fully sum contribution in their 3d grid
current_level = 0; current_level = 0;
gcall->reverse_comm_kspace(this,1,sizeof(double),REVERSE_RHO, gcall->reverse_comm(this,1,sizeof(double),REVERSE_RHO,
gcall_buf1,gcall_buf2,MPI_DOUBLE); gcall_buf1,gcall_buf2,MPI_DOUBLE);
// forward communicate charge density values to fill ghost grid points // forward communicate charge density values to fill ghost grid points
@ -169,8 +169,9 @@ void MSMCG::compute(int eflag, int vflag)
for (n=0; n<=levels-2; n++) { for (n=0; n<=levels-2; n++) {
if (!active_flag[n]) continue; if (!active_flag[n]) continue;
current_level = n; current_level = n;
gc[n]->forward_comm_kspace(this,1,sizeof(double),FORWARD_RHO, gc[n]->forward_comm(this,1,sizeof(double),FORWARD_RHO,
gc_buf1[n],gc_buf2[n],MPI_DOUBLE); gc_buf1[n],gc_buf2[n],MPI_DOUBLE);
direct(n); direct(n);
restriction(n); restriction(n);
} }
@ -182,15 +183,15 @@ void MSMCG::compute(int eflag, int vflag)
if (domain->nonperiodic) { if (domain->nonperiodic) {
current_level = levels-1; current_level = levels-1;
gc[levels-1]-> gc[levels-1]->
forward_comm_kspace(this,1,sizeof(double),FORWARD_RHO, forward_comm(this,1,sizeof(double),FORWARD_RHO,
gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE); gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE);
direct_top(levels-1); direct_top(levels-1);
gc[levels-1]-> gc[levels-1]->
reverse_comm_kspace(this,1,sizeof(double),REVERSE_AD, reverse_comm(this,1,sizeof(double),REVERSE_AD,
gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE); gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE);
if (vflag_atom) if (vflag_atom)
gc[levels-1]-> gc[levels-1]->
reverse_comm_kspace(this,6,sizeof(double),REVERSE_AD_PERATOM, reverse_comm(this,6,sizeof(double),REVERSE_AD_PERATOM,
gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE); gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE);
} else { } else {
@ -201,7 +202,7 @@ void MSMCG::compute(int eflag, int vflag)
current_level = levels-1; current_level = levels-1;
if (vflag_atom) if (vflag_atom)
gc[levels-1]-> gc[levels-1]->
reverse_comm_kspace(this,6,sizeof(double),REVERSE_AD_PERATOM, reverse_comm(this,6,sizeof(double),REVERSE_AD_PERATOM,
gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE); gc_buf1[levels-1],gc_buf2[levels-1],MPI_DOUBLE);
} }
} }
@ -214,13 +215,13 @@ void MSMCG::compute(int eflag, int vflag)
prolongation(n); prolongation(n);
current_level = n; current_level = n;
gc[n]->reverse_comm_kspace(this,1,sizeof(double),REVERSE_AD, gc[n]->reverse_comm(this,1,sizeof(double),REVERSE_AD,
gc_buf1[n],gc_buf2[n],MPI_DOUBLE); gc_buf1[n],gc_buf2[n],MPI_DOUBLE);
// extra per-atom virial communication // extra per-atom virial communication
if (vflag_atom) if (vflag_atom)
gc[n]->reverse_comm_kspace(this,6,sizeof(double),REVERSE_AD_PERATOM, gc[n]->reverse_comm(this,6,sizeof(double),REVERSE_AD_PERATOM,
gc_buf1[n],gc_buf2[n],MPI_DOUBLE); gc_buf1[n],gc_buf2[n],MPI_DOUBLE);
} }
@ -228,13 +229,13 @@ void MSMCG::compute(int eflag, int vflag)
// to fill ghost cells surrounding their 3d bricks // to fill ghost cells surrounding their 3d bricks
current_level = 0; current_level = 0;
gcall->forward_comm_kspace(this,1,sizeof(double),FORWARD_AD, gcall->forward_comm(this,1,sizeof(double),FORWARD_AD,
gcall_buf1,gcall_buf2,MPI_DOUBLE); gcall_buf1,gcall_buf2,MPI_DOUBLE);
// extra per-atom energy/virial communication // extra per-atom energy/virial communication
if (vflag_atom) if (vflag_atom)
gcall->forward_comm_kspace(this,6,sizeof(double),FORWARD_AD_PERATOM, gcall->forward_comm(this,6,sizeof(double),FORWARD_AD_PERATOM,
gcall_buf1,gcall_buf2,MPI_DOUBLE); gcall_buf1,gcall_buf2,MPI_DOUBLE);
// calculate the force on my particles (interpolation) // calculate the force on my particles (interpolation)

View File

@ -638,7 +638,7 @@ void PPPM::compute(int eflag, int vflag)
// to fully sum contribution in their 3d bricks // to fully sum contribution in their 3d bricks
// remap from 3d decomposition to FFT decomposition // remap from 3d decomposition to FFT decomposition
gc->reverse_comm_kspace(this,1,sizeof(FFT_SCALAR),REVERSE_RHO, gc->reverse_comm(this,1,sizeof(FFT_SCALAR),REVERSE_RHO,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
brick2fft(); brick2fft();
@ -653,20 +653,20 @@ void PPPM::compute(int eflag, int vflag)
// to fill ghost cells surrounding their 3d bricks // to fill ghost cells surrounding their 3d bricks
if (differentiation_flag == 1) if (differentiation_flag == 1)
gc->forward_comm_kspace(this,1,sizeof(FFT_SCALAR),FORWARD_AD, gc->forward_comm(this,1,sizeof(FFT_SCALAR),FORWARD_AD,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
else else
gc->forward_comm_kspace(this,3,sizeof(FFT_SCALAR),FORWARD_IK, gc->forward_comm(this,3,sizeof(FFT_SCALAR),FORWARD_IK,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
// extra per-atom energy/virial communication // extra per-atom energy/virial communication
if (evflag_atom) { if (evflag_atom) {
if (differentiation_flag == 1 && vflag_atom) if (differentiation_flag == 1 && vflag_atom)
gc->forward_comm_kspace(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM, gc->forward_comm(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
else if (differentiation_flag == 0) else if (differentiation_flag == 0)
gc->forward_comm_kspace(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM, gc->forward_comm(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
} }
@ -3119,7 +3119,7 @@ void PPPM::compute_group_group(int groupbit_A, int groupbit_B, int AA_flag)
density_brick = density_A_brick; density_brick = density_A_brick;
density_fft = density_A_fft; density_fft = density_A_fft;
gc->reverse_comm_kspace(this,1,sizeof(FFT_SCALAR),REVERSE_RHO, gc->reverse_comm(this,1,sizeof(FFT_SCALAR),REVERSE_RHO,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
brick2fft(); brick2fft();
@ -3128,7 +3128,7 @@ void PPPM::compute_group_group(int groupbit_A, int groupbit_B, int AA_flag)
density_brick = density_B_brick; density_brick = density_B_brick;
density_fft = density_B_fft; density_fft = density_B_fft;
gc->reverse_comm_kspace(this,1,sizeof(FFT_SCALAR),REVERSE_RHO, gc->reverse_comm(this,1,sizeof(FFT_SCALAR),REVERSE_RHO,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
brick2fft(); brick2fft();

View File

@ -177,7 +177,7 @@ void PPPMCG::compute(int eflag, int vflag)
// to fully sum contribution in their 3d bricks // to fully sum contribution in their 3d bricks
// remap from 3d decomposition to FFT decomposition // remap from 3d decomposition to FFT decomposition
gc->reverse_comm_kspace(this,1,sizeof(FFT_SCALAR),REVERSE_RHO, gc->reverse_comm(this,1,sizeof(FFT_SCALAR),REVERSE_RHO,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
brick2fft(); brick2fft();
@ -192,20 +192,20 @@ void PPPMCG::compute(int eflag, int vflag)
// to fill ghost cells surrounding their 3d bricks // to fill ghost cells surrounding their 3d bricks
if (differentiation_flag == 1) if (differentiation_flag == 1)
gc->forward_comm_kspace(this,1,sizeof(FFT_SCALAR),FORWARD_AD, gc->forward_comm(this,1,sizeof(FFT_SCALAR),FORWARD_AD,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
else else
gc->forward_comm_kspace(this,3,sizeof(FFT_SCALAR),FORWARD_IK, gc->forward_comm(this,3,sizeof(FFT_SCALAR),FORWARD_IK,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
// extra per-atom energy/virial communication // extra per-atom energy/virial communication
if (evflag_atom) { if (evflag_atom) {
if (differentiation_flag == 1 && vflag_atom) if (differentiation_flag == 1 && vflag_atom)
gc->forward_comm_kspace(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM, gc->forward_comm(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
else if (differentiation_flag == 0) else if (differentiation_flag == 0)
gc->forward_comm_kspace(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM, gc->forward_comm(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
} }

View File

@ -443,7 +443,7 @@ void PPPMDipole::compute(int eflag, int vflag)
// to fully sum contribution in their 3d bricks // to fully sum contribution in their 3d bricks
// remap from 3d decomposition to FFT decomposition // remap from 3d decomposition to FFT decomposition
gc_dipole->reverse_comm_kspace(this,3,sizeof(FFT_SCALAR),REVERSE_MU, gc_dipole->reverse_comm(this,3,sizeof(FFT_SCALAR),REVERSE_MU,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
brick2fft_dipole(); brick2fft_dipole();
@ -457,13 +457,13 @@ void PPPMDipole::compute(int eflag, int vflag)
// all procs communicate E-field values // all procs communicate E-field values
// to fill ghost cells surrounding their 3d bricks // to fill ghost cells surrounding their 3d bricks
gc_dipole->forward_comm_kspace(this,9,sizeof(FFT_SCALAR),FORWARD_MU, gc_dipole->forward_comm(this,9,sizeof(FFT_SCALAR),FORWARD_MU,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
// extra per-atom energy/virial communication // extra per-atom energy/virial communication
if (evflag_atom) if (evflag_atom)
gc_dipole->forward_comm_kspace(this,18,sizeof(FFT_SCALAR),FORWARD_MU_PERATOM, gc_dipole->forward_comm(this,18,sizeof(FFT_SCALAR),FORWARD_MU_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
// calculate the force on my particles // calculate the force on my particles

View File

@ -299,7 +299,7 @@ void PPPMDipoleSpin::compute(int eflag, int vflag)
// to fully sum contribution in their 3d bricks // to fully sum contribution in their 3d bricks
// remap from 3d decomposition to FFT decomposition // remap from 3d decomposition to FFT decomposition
gc_dipole->reverse_comm_kspace(this,3,sizeof(FFT_SCALAR),REVERSE_MU, gc_dipole->reverse_comm(this,3,sizeof(FFT_SCALAR),REVERSE_MU,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
brick2fft_dipole(); brick2fft_dipole();
@ -313,13 +313,13 @@ void PPPMDipoleSpin::compute(int eflag, int vflag)
// all procs communicate E-field values // all procs communicate E-field values
// to fill ghost cells surrounding their 3d bricks // to fill ghost cells surrounding their 3d bricks
gc_dipole->forward_comm_kspace(this,9,sizeof(FFT_SCALAR),FORWARD_MU, gc_dipole->forward_comm(this,9,sizeof(FFT_SCALAR),FORWARD_MU,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
// extra per-atom energy/virial communication // extra per-atom energy/virial communication
if (evflag_atom) if (evflag_atom)
gc->forward_comm_kspace(this,18,sizeof(FFT_SCALAR),FORWARD_MU_PERATOM, gc->forward_comm(this,18,sizeof(FFT_SCALAR),FORWARD_MU_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
// calculate the force on my particles // calculate the force on my particles

View File

@ -930,7 +930,7 @@ void PPPMDisp::compute(int eflag, int vflag)
make_rho_c(); make_rho_c();
gc->reverse_comm_kspace(this,1,sizeof(FFT_SCALAR),REVERSE_RHO, gc->reverse_comm(this,1,sizeof(FFT_SCALAR),REVERSE_RHO,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
brick2fft(nxlo_in,nylo_in,nzlo_in,nxhi_in,nyhi_in,nzhi_in, brick2fft(nxlo_in,nylo_in,nzlo_in,nxhi_in,nyhi_in,nzhi_in,
@ -945,13 +945,13 @@ void PPPMDisp::compute(int eflag, int vflag)
virial_1,vg,vg2, virial_1,vg,vg2,
u_brick,v0_brick,v1_brick,v2_brick,v3_brick,v4_brick,v5_brick); u_brick,v0_brick,v1_brick,v2_brick,v3_brick,v4_brick,v5_brick);
gc->forward_comm_kspace(this,1,sizeof(FFT_SCALAR),FORWARD_AD, gc->forward_comm(this,1,sizeof(FFT_SCALAR),FORWARD_AD,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
fieldforce_c_ad(); fieldforce_c_ad();
if (vflag_atom) if (vflag_atom)
gc->forward_comm_kspace(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM, gc->forward_comm(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
} else { } else {
@ -964,13 +964,13 @@ void PPPMDisp::compute(int eflag, int vflag)
vdx_brick,vdy_brick,vdz_brick,virial_1,vg,vg2, vdx_brick,vdy_brick,vdz_brick,virial_1,vg,vg2,
u_brick,v0_brick,v1_brick,v2_brick,v3_brick,v4_brick,v5_brick); u_brick,v0_brick,v1_brick,v2_brick,v3_brick,v4_brick,v5_brick);
gc->forward_comm_kspace(this,3,sizeof(FFT_SCALAR),FORWARD_IK, gc->forward_comm(this,3,sizeof(FFT_SCALAR),FORWARD_IK,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
fieldforce_c_ik(); fieldforce_c_ik();
if (evflag_atom) if (evflag_atom)
gc->forward_comm_kspace(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM, gc->forward_comm(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
} }
@ -988,7 +988,7 @@ void PPPMDisp::compute(int eflag, int vflag)
make_rho_g(); make_rho_g();
gc6->reverse_comm_kspace(this,1,sizeof(FFT_SCALAR),REVERSE_RHO_GEOM, gc6->reverse_comm(this,1,sizeof(FFT_SCALAR),REVERSE_RHO_GEOM,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
brick2fft(nxlo_in_6,nylo_in_6,nzlo_in_6,nxhi_in_6,nyhi_in_6,nzhi_in_6, brick2fft(nxlo_in_6,nylo_in_6,nzlo_in_6,nxhi_in_6,nyhi_in_6,nzhi_in_6,
@ -1004,13 +1004,13 @@ void PPPMDisp::compute(int eflag, int vflag)
u_brick_g,v0_brick_g,v1_brick_g,v2_brick_g, u_brick_g,v0_brick_g,v1_brick_g,v2_brick_g,
v3_brick_g,v4_brick_g,v5_brick_g); v3_brick_g,v4_brick_g,v5_brick_g);
gc6->forward_comm_kspace(this,1,sizeof(FFT_SCALAR),FORWARD_AD_GEOM, gc6->forward_comm(this,1,sizeof(FFT_SCALAR),FORWARD_AD_GEOM,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
fieldforce_g_ad(); fieldforce_g_ad();
if (vflag_atom) if (vflag_atom)
gc6->forward_comm_kspace(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM_GEOM, gc6->forward_comm(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM_GEOM,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
} else { } else {
@ -1024,13 +1024,13 @@ void PPPMDisp::compute(int eflag, int vflag)
u_brick_g,v0_brick_g,v1_brick_g,v2_brick_g, u_brick_g,v0_brick_g,v1_brick_g,v2_brick_g,
v3_brick_g,v4_brick_g,v5_brick_g); v3_brick_g,v4_brick_g,v5_brick_g);
gc6->forward_comm_kspace(this,3,sizeof(FFT_SCALAR),FORWARD_IK_GEOM, gc6->forward_comm(this,3,sizeof(FFT_SCALAR),FORWARD_IK_GEOM,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
fieldforce_g_ik(); fieldforce_g_ik();
if (evflag_atom) if (evflag_atom)
gc6->forward_comm_kspace(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM_GEOM, gc6->forward_comm(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM_GEOM,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
} }
@ -1048,7 +1048,7 @@ void PPPMDisp::compute(int eflag, int vflag)
make_rho_a(); make_rho_a();
gc6->reverse_comm_kspace(this,7,sizeof(FFT_SCALAR),REVERSE_RHO_ARITH, gc6->reverse_comm(this,7,sizeof(FFT_SCALAR),REVERSE_RHO_ARITH,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
brick2fft_a(); brick2fft_a();
@ -1078,13 +1078,13 @@ void PPPMDisp::compute(int eflag, int vflag)
u_brick_a4,v0_brick_a4,v1_brick_a4,v2_brick_a4, u_brick_a4,v0_brick_a4,v1_brick_a4,v2_brick_a4,
v3_brick_a4,v4_brick_a4,v5_brick_a4); v3_brick_a4,v4_brick_a4,v5_brick_a4);
gc6->forward_comm_kspace(this,7,sizeof(FFT_SCALAR),FORWARD_AD_ARITH, gc6->forward_comm(this,7,sizeof(FFT_SCALAR),FORWARD_AD_ARITH,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
fieldforce_a_ad(); fieldforce_a_ad();
if (evflag_atom) if (evflag_atom)
gc6->forward_comm_kspace(this,42,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM_ARITH, gc6->forward_comm(this,42,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM_ARITH,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
} else { } else {
@ -1119,13 +1119,13 @@ void PPPMDisp::compute(int eflag, int vflag)
u_brick_a4,v0_brick_a4,v1_brick_a4,v2_brick_a4, u_brick_a4,v0_brick_a4,v1_brick_a4,v2_brick_a4,
v3_brick_a4,v4_brick_a4,v5_brick_a4); v3_brick_a4,v4_brick_a4,v5_brick_a4);
gc6->forward_comm_kspace(this,21,sizeof(FFT_SCALAR),FORWARD_IK_ARITH, gc6->forward_comm(this,21,sizeof(FFT_SCALAR),FORWARD_IK_ARITH,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
fieldforce_a_ik(); fieldforce_a_ik();
if (evflag_atom) if (evflag_atom)
gc6->forward_comm_kspace(this,49,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM_ARITH, gc6->forward_comm(this,49,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM_ARITH,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
} }
@ -1143,7 +1143,7 @@ void PPPMDisp::compute(int eflag, int vflag)
make_rho_none(); make_rho_none();
gc6->reverse_comm_kspace(this,nsplit_alloc,sizeof(FFT_SCALAR),REVERSE_RHO_NONE, gc6->reverse_comm(this,nsplit_alloc,sizeof(FFT_SCALAR),REVERSE_RHO_NONE,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
brick2fft_none(); brick2fft_none();
@ -1158,14 +1158,14 @@ void PPPMDisp::compute(int eflag, int vflag)
n += 2; n += 2;
} }
gc6->forward_comm_kspace(this,1*nsplit_alloc,sizeof(FFT_SCALAR), gc6->forward_comm(this,1*nsplit_alloc,sizeof(FFT_SCALAR),
FORWARD_AD_NONE, FORWARD_AD_NONE,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
fieldforce_none_ad(); fieldforce_none_ad();
if (vflag_atom) if (vflag_atom)
gc6->forward_comm_kspace(this,6*nsplit_alloc,sizeof(FFT_SCALAR), gc6->forward_comm(this,6*nsplit_alloc,sizeof(FFT_SCALAR),
FORWARD_AD_PERATOM_NONE, FORWARD_AD_PERATOM_NONE,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
@ -1180,14 +1180,14 @@ void PPPMDisp::compute(int eflag, int vflag)
n += 2; n += 2;
} }
gc6->forward_comm_kspace(this,3*nsplit_alloc,sizeof(FFT_SCALAR), gc6->forward_comm(this,3*nsplit_alloc,sizeof(FFT_SCALAR),
FORWARD_IK_NONE, FORWARD_IK_NONE,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
fieldforce_none_ik(); fieldforce_none_ik();
if (evflag_atom) if (evflag_atom)
gc6->forward_comm_kspace(this,7*nsplit_alloc,sizeof(FFT_SCALAR), gc6->forward_comm(this,7*nsplit_alloc,sizeof(FFT_SCALAR),
FORWARD_IK_PERATOM_NONE, FORWARD_IK_PERATOM_NONE,
gc6_buf1,gc6_buf2,MPI_FFT_SCALAR); gc6_buf1,gc6_buf2,MPI_FFT_SCALAR);
} }

View File

@ -157,7 +157,7 @@ void PPPMStagger::compute(int eflag, int vflag)
// to fully sum contribution in their 3d bricks // to fully sum contribution in their 3d bricks
// remap from 3d decomposition to FFT decomposition // remap from 3d decomposition to FFT decomposition
gc->reverse_comm_kspace(this,1,sizeof(FFT_SCALAR),REVERSE_RHO, gc->reverse_comm(this,1,sizeof(FFT_SCALAR),REVERSE_RHO,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
brick2fft(); brick2fft();
@ -172,20 +172,20 @@ void PPPMStagger::compute(int eflag, int vflag)
// to fill ghost cells surrounding their 3d bricks // to fill ghost cells surrounding their 3d bricks
if (differentiation_flag == 1) if (differentiation_flag == 1)
gc->forward_comm_kspace(this,1,sizeof(FFT_SCALAR),FORWARD_AD, gc->forward_comm(this,1,sizeof(FFT_SCALAR),FORWARD_AD,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
else else
gc->forward_comm_kspace(this,3,sizeof(FFT_SCALAR),FORWARD_IK, gc->forward_comm(this,3,sizeof(FFT_SCALAR),FORWARD_IK,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
// extra per-atom energy/virial communication // extra per-atom energy/virial communication
if (evflag_atom) { if (evflag_atom) {
if (differentiation_flag == 1 && vflag_atom) if (differentiation_flag == 1 && vflag_atom)
gc->forward_comm_kspace(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM, gc->forward_comm(this,6,sizeof(FFT_SCALAR),FORWARD_AD_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
else if (differentiation_flag == 0) else if (differentiation_flag == 0)
gc->forward_comm_kspace(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM, gc->forward_comm(this,7,sizeof(FFT_SCALAR),FORWARD_IK_PERATOM,
gc_buf1,gc_buf2,MPI_FFT_SCALAR); gc_buf1,gc_buf2,MPI_FFT_SCALAR);
} }

View File

@ -49,6 +49,7 @@ endif
PACKAGE = \ PACKAGE = \
adios \ adios \
amoeba \
asphere \ asphere \
awpmd \ awpmd \
bocs \ bocs \

View File

@ -25,6 +25,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
#define FOURTH 0.25
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
Angle::Angle(LAMMPS *lmp) : Pointers(lmp) Angle::Angle(LAMMPS *lmp) : Pointers(lmp)
@ -221,30 +223,16 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
virial[4] += v[4]; virial[4] += v[4];
virial[5] += v[5]; virial[5] += v[5];
} else { } else {
if (i < nlocal) { double prefactor = 0.0;
virial[0] += THIRD*v[0]; if (i < nlocal) prefactor += 1.0;
virial[1] += THIRD*v[1]; if (j < nlocal) prefactor += 1.0;
virial[2] += THIRD*v[2]; if (k < nlocal) prefactor += 1.0;
virial[3] += THIRD*v[3]; virial[0] += prefactor*THIRD*v[0];
virial[4] += THIRD*v[4]; virial[1] += prefactor*THIRD*v[1];
virial[5] += THIRD*v[5]; virial[2] += prefactor*THIRD*v[2];
} virial[3] += prefactor*THIRD*v[3];
if (j < nlocal) { virial[4] += prefactor*THIRD*v[4];
virial[0] += THIRD*v[0]; virial[5] += prefactor*THIRD*v[5];
virial[1] += THIRD*v[1];
virial[2] += THIRD*v[2];
virial[3] += THIRD*v[3];
virial[4] += THIRD*v[4];
virial[5] += THIRD*v[5];
}
if (k < nlocal) {
virial[0] += THIRD*v[0];
virial[1] += THIRD*v[1];
virial[2] += THIRD*v[2];
virial[3] += THIRD*v[3];
virial[4] += THIRD*v[4];
virial[5] += THIRD*v[5];
}
} }
} }
@ -277,6 +265,7 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
} }
// per-atom centroid virial // per-atom centroid virial
if (cvflag_atom) { if (cvflag_atom) {
// r0 = (r1+r2+r3)/3 // r0 = (r1+r2+r3)/3
@ -303,6 +292,7 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
cvatom[i][7] += a1[2]*f1[0]; cvatom[i][7] += a1[2]*f1[0];
cvatom[i][8] += a1[2]*f1[1]; cvatom[i][8] += a1[2]*f1[1];
} }
if (newton_bond || j < nlocal) { if (newton_bond || j < nlocal) {
double a2[3]; double a2[3];
double f2[3]; double f2[3];
@ -326,6 +316,7 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
cvatom[j][7] += a2[2]*f2[0]; cvatom[j][7] += a2[2]*f2[0];
cvatom[j][8] += a2[2]*f2[1]; cvatom[j][8] += a2[2]*f2[1];
} }
if (newton_bond || k < nlocal) { if (newton_bond || k < nlocal) {
double a3[3]; double a3[3];
@ -347,6 +338,105 @@ void Angle::ev_tally(int i, int j, int k, int nlocal, int newton_bond,
} }
} }
/* ----------------------------------------------------------------------
tally energy and virial into global and per-atom accumulators
virial = r1F1 + r2F2 + r3F3 + r4F4
------------------------------------------------------------------------- */
void Angle::ev_tally4(int i, int j, int k, int m, int nlocal, int newton_bond,
double eangle,
double *f1, double *f2, double *f3, double *f4)
{
double eanglefourth,v[6];
if (eflag_either) {
if (eflag_global) {
if (newton_bond) energy += eangle;
else {
eanglefourth = FOURTH*eangle;
if (i < nlocal) energy += eanglefourth;
if (j < nlocal) energy += eanglefourth;
if (k < nlocal) energy += eanglefourth;
}
}
if (eflag_atom) {
eanglefourth = FOURTH*eangle;
if (newton_bond || i < nlocal) eatom[i] += eanglefourth;
if (newton_bond || j < nlocal) eatom[j] += eanglefourth;
if (newton_bond || k < nlocal) eatom[k] += eanglefourth;
if (newton_bond || m < nlocal) eatom[m] += eanglefourth;
}
}
if (vflag_either) {
double **x = atom->x;
v[0] = x[i][0]*f1[0] + x[j][0]*f2[0] + x[k][0]*f3[0] + x[m][0]*f4[0];
v[1] = x[i][1]*f1[1] + x[j][1]*f2[1] + x[k][1]*f3[1] + x[m][1]*f4[1];
v[2] = x[i][2]*f1[2] + x[j][2]*f2[2] + x[k][2]*f3[2] + x[m][2]*f4[2];
v[3] = x[i][0]*f1[1] + x[j][0]*f2[1] + x[k][0]*f3[1] + x[m][0]*f4[1];
v[4] = x[i][0]*f1[2] + x[j][0]*f2[2] + x[k][0]*f3[2] + x[m][0]*f4[2];
v[5] = x[i][1]*f1[2] + x[j][1]*f2[2] + x[k][1]*f3[2] + x[m][1]*f4[2];
if (vflag_global) {
if (newton_bond) {
virial[0] += v[0];
virial[1] += v[1];
virial[2] += v[2];
virial[3] += v[3];
virial[4] += v[4];
virial[5] += v[5];
} else {
double prefactor = 0.0;
if (i < nlocal) prefactor += 1.0;
if (j < nlocal) prefactor += 1.0;
if (k < nlocal) prefactor += 1.0;
if (m < nlocal) prefactor += 1.0;
virial[0] += prefactor*FOURTH*v[0];
virial[1] += prefactor*FOURTH*v[1];
virial[2] += prefactor*FOURTH*v[2];
virial[3] += prefactor*FOURTH*v[3];
virial[4] += prefactor*FOURTH*v[4];
virial[5] += prefactor*FOURTH*v[5];
}
}
if (vflag_atom) {
if (newton_bond || i < nlocal) {
vatom[i][0] += FOURTH*v[0];
vatom[i][1] += FOURTH*v[1];
vatom[i][2] += FOURTH*v[2];
vatom[i][3] += FOURTH*v[3];
vatom[i][4] += FOURTH*v[4];
vatom[i][5] += FOURTH*v[5];
}
if (newton_bond || j < nlocal) {
vatom[j][0] += FOURTH*v[0];
vatom[j][1] += FOURTH*v[1];
vatom[j][2] += FOURTH*v[2];
vatom[j][3] += FOURTH*v[3];
vatom[j][4] += FOURTH*v[4];
vatom[j][5] += FOURTH*v[5];
}
if (newton_bond || k < nlocal) {
vatom[k][0] += FOURTH*v[0];
vatom[k][1] += FOURTH*v[1];
vatom[k][2] += FOURTH*v[2];
vatom[k][3] += FOURTH*v[3];
vatom[k][4] += FOURTH*v[4];
vatom[k][5] += FOURTH*v[5];
}
if (newton_bond || m < nlocal) {
vatom[m][0] += FOURTH*v[0];
vatom[m][1] += FOURTH*v[1];
vatom[m][2] += FOURTH*v[2];
vatom[m][3] += FOURTH*v[3];
vatom[m][4] += FOURTH*v[4];
vatom[m][5] += FOURTH*v[5];
}
}
}
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double Angle::memory_usage() double Angle::memory_usage()

View File

@ -77,6 +77,7 @@ class Angle : protected Pointers {
void ev_setup(int, int, int alloc = 1); void ev_setup(int, int, int alloc = 1);
void ev_tally(int, int, int, int, int, double, double *, double *, double, double, double, double, void ev_tally(int, int, int, int, int, double, double *, double *, double, double, double, double,
double, double); double, double);
void ev_tally4(int, int, int, int, int, int, double, double *, double *, double *, double *);
}; };
} // namespace LAMMPS_NS } // namespace LAMMPS_NS

View File

@ -203,6 +203,12 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
rho = drho = esph = desph = cv = nullptr; rho = drho = esph = desph = cv = nullptr;
vest = nullptr; vest = nullptr;
// AMOEBA package
maxspecial15 = 1;
nspecial15 = nullptr;
special15 = nullptr;
// DIELECTRIC package // DIELECTRIC package
area = ed = em = epsilon = curvature = q_unscaled = nullptr; area = ed = em = epsilon = curvature = q_unscaled = nullptr;
@ -539,6 +545,11 @@ void Atom::peratom_create()
add_peratom("eff_plastic_strain_rate",&eff_plastic_strain_rate,DOUBLE,0); add_peratom("eff_plastic_strain_rate",&eff_plastic_strain_rate,DOUBLE,0);
add_peratom("damage",&damage,DOUBLE,0); add_peratom("damage",&damage,DOUBLE,0);
// AMOEBA package
add_peratom("nspecial15",&nspecial15,INT,0);
add_peratom_vary("special15",&special15,tagintsize,&maxspecial15,&nspecial15,0);
// DIELECTRIC package // DIELECTRIC package
add_peratom("area",&area,DOUBLE,0); add_peratom("area",&area,DOUBLE,0);
@ -654,6 +665,7 @@ void Atom::set_atomflag_defaults()
mesont_flag = 0; mesont_flag = 0;
contact_radius_flag = smd_data_9_flag = smd_stress_flag = 0; contact_radius_flag = smd_data_9_flag = smd_stress_flag = 0;
eff_plastic_strain_flag = eff_plastic_strain_rate_flag = 0; eff_plastic_strain_flag = eff_plastic_strain_rate_flag = 0;
nspecial15_flag = 0;
pdscale = 1.0; pdscale = 1.0;
} }

View File

@ -161,6 +161,12 @@ class Atom : protected Pointers {
double *rho, *drho, *esph, *desph, *cv; double *rho, *drho, *esph, *desph, *cv;
double **vest; double **vest;
// AMOEBA package
int *nspecial15; // # of 1-5 neighs
tagint **special15; // IDs of 1-5 neighs of each atom
int maxspecial15; // special15[nlocal][maxspecial15]
// DIELECTRIC package // DIELECTRIC package
double *area, *ed, *em, *epsilon, *curvature, *q_unscaled; double *area, *ed, *em, *epsilon, *curvature, *q_unscaled;
@ -198,6 +204,10 @@ class Atom : protected Pointers {
int contact_radius_flag, smd_data_9_flag, smd_stress_flag; int contact_radius_flag, smd_data_9_flag, smd_stress_flag;
int eff_plastic_strain_flag, eff_plastic_strain_rate_flag; int eff_plastic_strain_flag, eff_plastic_strain_rate_flag;
// AMOEBA package
int nspecial15_flag;
// Peridynamics scale factor, used by dump cfg // Peridynamics scale factor, used by dump cfg
double pdscale; double pdscale;

View File

@ -31,7 +31,7 @@ enum{MOLECULE,CHARGE,RMASS,IVEC,DVEC,IARRAY,DARRAY};
FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), Fix(lmp, narg, arg),
nvalue(0), style(nullptr), index(nullptr), astyle(nullptr) nvalue(0), styles(nullptr), index(nullptr), astyle(nullptr)
{ {
if (narg < 4) error->all(FLERR,"Illegal fix property/atom command"); if (narg < 4) error->all(FLERR,"Illegal fix property/atom command");
@ -40,7 +40,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
int iarg = 3; int iarg = 3;
nvalue = narg-iarg; nvalue = narg-iarg;
style = new int[nvalue]; styles = new int[nvalue];
cols = new int[nvalue]; cols = new int[nvalue];
index = new int[nvalue]; index = new int[nvalue];
@ -58,7 +58,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
"already has molecule attribute"); "already has molecule attribute");
if (molecule_flag) if (molecule_flag)
error->all(FLERR,"Fix property/atom cannot specify mol twice"); error->all(FLERR,"Fix property/atom cannot specify mol twice");
style[nvalue] = MOLECULE; styles[nvalue] = MOLECULE;
cols[nvalue] = 0; cols[nvalue] = 0;
atom->molecule_flag = molecule_flag = 1; atom->molecule_flag = molecule_flag = 1;
values_peratom++; values_peratom++;
@ -69,7 +69,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Fix property/atom q when atom_style already has charge attribute"); error->all(FLERR,"Fix property/atom q when atom_style already has charge attribute");
if (q_flag) if (q_flag)
error->all(FLERR,"Fix property/atom cannot specify q twice"); error->all(FLERR,"Fix property/atom cannot specify q twice");
style[nvalue] = CHARGE; styles[nvalue] = CHARGE;
cols[nvalue] = 0; cols[nvalue] = 0;
atom->q_flag = q_flag = 1; atom->q_flag = q_flag = 1;
values_peratom++; values_peratom++;
@ -80,7 +80,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Fix property/atom rmass when atom_style already has rmass attribute"); error->all(FLERR,"Fix property/atom rmass when atom_style already has rmass attribute");
if (rmass_flag) if (rmass_flag)
error->all(FLERR,"Fix property/atom cannot specify rmass twice"); error->all(FLERR,"Fix property/atom cannot specify rmass twice");
style[nvalue] = RMASS; styles[nvalue] = RMASS;
cols[nvalue] = 0; cols[nvalue] = 0;
atom->rmass_flag = rmass_flag = 1; atom->rmass_flag = rmass_flag = 1;
values_peratom++; values_peratom++;
@ -90,7 +90,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
// custom atom vector // custom atom vector
} else if (utils::strmatch(arg[iarg],"^i_")) { } else if (utils::strmatch(arg[iarg],"^i_")) {
style[nvalue] = IVEC; styles[nvalue] = IVEC;
int flag,ncols; int flag,ncols;
index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols); index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols);
if (index[nvalue] >= 0) if (index[nvalue] >= 0)
@ -102,7 +102,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
iarg++; iarg++;
} else if (utils::strmatch(arg[iarg],"^d_")) { } else if (utils::strmatch(arg[iarg],"^d_")) {
style[nvalue] = DVEC; styles[nvalue] = DVEC;
int flag,ncols; int flag,ncols;
index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols); index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols);
if (index[nvalue] >= 0) if (index[nvalue] >= 0)
@ -129,10 +129,10 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
if (arg[iarg][0] == 'i') { if (arg[iarg][0] == 'i') {
which = 0; which = 0;
style[nvalue] = IARRAY; styles[nvalue] = IARRAY;
} else { } else {
which = 1; which = 1;
style[nvalue] = DARRAY; styles[nvalue] = DARRAY;
} }
index[nvalue] = atom->add_custom(&arg[iarg][3],which,ncols); index[nvalue] = atom->add_custom(&arg[iarg][3],which,ncols);
cols[nvalue] = ncols; cols[nvalue] = ncols;
@ -165,9 +165,8 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) :
if (border == 0) { if (border == 0) {
int flag = 0; int flag = 0;
for (int i = 0; i < nvalue; i++) for (int i = 0; i < nvalue; i++)
if (style[i] == MOLECULE if (styles[i] == MOLECULE || styles[i] == CHARGE || styles[i] == RMASS)
|| style[i] == CHARGE flag = 1;
|| style[i] == RMASS) flag = 1;
if (flag && comm->me == 0) if (flag && comm->me == 0)
error->warning(FLERR,"Fix property/atom mol or charge or rmass " error->warning(FLERR,"Fix property/atom mol or charge or rmass "
"w/out ghost communication"); "w/out ghost communication");
@ -201,25 +200,25 @@ FixPropertyAtom::~FixPropertyAtom()
// set ptrs to a null pointer, so they no longer exist for Atom class // set ptrs to a null pointer, so they no longer exist for Atom class
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) { if (styles[nv] == MOLECULE) {
atom->molecule_flag = 0; atom->molecule_flag = 0;
memory->destroy(atom->molecule); memory->destroy(atom->molecule);
atom->molecule = nullptr; atom->molecule = nullptr;
} else if (style[nv] == CHARGE) { } else if (styles[nv] == CHARGE) {
atom->q_flag = 0; atom->q_flag = 0;
memory->destroy(atom->q); memory->destroy(atom->q);
atom->q = nullptr; atom->q = nullptr;
} else if (style[nv] == RMASS) { } else if (styles[nv] == RMASS) {
atom->rmass_flag = 0; atom->rmass_flag = 0;
memory->destroy(atom->rmass); memory->destroy(atom->rmass);
atom->rmass = nullptr; atom->rmass = nullptr;
} else if (style[nv] == IVEC) { } else if (styles[nv] == IVEC) {
atom->remove_custom(index[nv],0,cols[nv]); atom->remove_custom(index[nv],0,cols[nv]);
} else if (style[nv] == DVEC) { } else if (styles[nv] == DVEC) {
atom->remove_custom(index[nv],1,cols[nv]); atom->remove_custom(index[nv],1,cols[nv]);
} else if (style[nv] == IARRAY) { } else if (styles[nv] == IARRAY) {
atom->remove_custom(index[nv],0,cols[nv]); atom->remove_custom(index[nv],0,cols[nv]);
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
atom->remove_custom(index[nv],1,cols[nv]); atom->remove_custom(index[nv],1,cols[nv]);
} }
} }
@ -291,21 +290,21 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint
if ((m = atom->map(itag)) >= 0) { if ((m = atom->map(itag)) >= 0) {
for (j = 0; j < nvalue; j++) { for (j = 0; j < nvalue; j++) {
if (style[j] == MOLECULE) { if (styles[j] == MOLECULE) {
atom->molecule[m] = values.next_tagint(); atom->molecule[m] = values.next_tagint();
} else if (style[j] == CHARGE) { } else if (styles[j] == CHARGE) {
atom->q[m] = values.next_double(); atom->q[m] = values.next_double();
} else if (style[j] == RMASS) { } else if (styles[j] == RMASS) {
atom->rmass[m] = values.next_double(); atom->rmass[m] = values.next_double();
} else if (style[j] == IVEC) { } else if (styles[j] == IVEC) {
atom->ivector[index[j]][m] = values.next_int(); atom->ivector[index[j]][m] = values.next_int();
} else if (style[j] == DVEC) { } else if (styles[j] == DVEC) {
atom->dvector[index[j]][m] = values.next_double(); atom->dvector[index[j]][m] = values.next_double();
} else if (style[j] == IARRAY) { } else if (styles[j] == IARRAY) {
ncol = cols[j]; ncol = cols[j];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->iarray[index[j]][m][k] = values.next_int(); atom->iarray[index[j]][m][k] = values.next_int();
} else if (style[j] == DARRAY) { } else if (styles[j] == DARRAY) {
ncol = cols[j]; ncol = cols[j];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->darray[index[j]][m][k] = values.next_double(); atom->darray[index[j]][m][k] = values.next_double();
@ -365,34 +364,34 @@ void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf)
int icol = 1; int icol = 1;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) { if (styles[nv] == MOLECULE) {
tagint *molecule = atom->molecule; tagint *molecule = atom->molecule;
for (i = 0; i < nlocal; i++) buf[i][icol] = ubuf(molecule[i]).d; for (i = 0; i < nlocal; i++) buf[i][icol] = ubuf(molecule[i]).d;
icol++; icol++;
} else if (style[nv] == CHARGE) { } else if (styles[nv] == CHARGE) {
double *q = atom->q; double *q = atom->q;
for (i = 0; i < nlocal; i++) buf[i][icol] = q[i]; for (i = 0; i < nlocal; i++) buf[i][icol] = q[i];
icol++; icol++;
} else if (style[nv] == RMASS) { } else if (styles[nv] == RMASS) {
double *rmass = atom->rmass; double *rmass = atom->rmass;
for (i = 0; i < nlocal; i++) buf[i][icol] = rmass[i]; for (i = 0; i < nlocal; i++) buf[i][icol] = rmass[i];
icol++; icol++;
} else if (style[nv] == IVEC) { } else if (styles[nv] == IVEC) {
int *ivec = atom->ivector[index[nv]]; int *ivec = atom->ivector[index[nv]];
for (i = 0; i < nlocal; i++) buf[i][icol] = ubuf(ivec[i]).d; for (i = 0; i < nlocal; i++) buf[i][icol] = ubuf(ivec[i]).d;
icol++; icol++;
} else if (style[nv] == DVEC) { } else if (styles[nv] == DVEC) {
double *dvec = atom->dvector[index[nv]]; double *dvec = atom->dvector[index[nv]];
for (i = 0; i < nlocal; i++) buf[i][icol] = dvec[i]; for (i = 0; i < nlocal; i++) buf[i][icol] = dvec[i];
icol++; icol++;
} else if (style[nv] == IARRAY) { } else if (styles[nv] == IARRAY) {
int **iarray = atom->iarray[index[nv]]; int **iarray = atom->iarray[index[nv]];
ncol = cols[nv]; ncol = cols[nv];
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
buf[i][icol+k] = ubuf(iarray[i][k]).d; buf[i][icol+k] = ubuf(iarray[i][k]).d;
icol += ncol; icol += ncol;
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
double **darray = atom->darray[index[nv]]; double **darray = atom->darray[index[nv]];
ncol = cols[nv]; ncol = cols[nv];
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
@ -412,19 +411,19 @@ void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf)
void FixPropertyAtom::write_data_section_keyword(int /*mth*/, FILE *fp) void FixPropertyAtom::write_data_section_keyword(int /*mth*/, FILE *fp)
{ {
if (nvalue == 1 && style[0] == MOLECULE) fprintf(fp,"\nMolecules\n\n"); if (nvalue == 1 && styles[0] == MOLECULE) fprintf(fp,"\nMolecules\n\n");
else if (nvalue == 1 && style[0] == CHARGE) fprintf(fp,"\nCharges\n\n"); else if (nvalue == 1 && styles[0] == CHARGE) fprintf(fp,"\nCharges\n\n");
else { else {
fprintf(fp,"\n%s #",id); fprintf(fp,"\n%s #",id);
// write column hint as comment // write column hint as comment
for (int i = 0; i < nvalue; ++i) { for (int i = 0; i < nvalue; ++i) {
if (style[i] == MOLECULE) fputs(" mol",fp); if (styles[i] == MOLECULE) fputs(" mol",fp);
else if (style[i] == CHARGE) fputs(" q",fp); else if (styles[i] == CHARGE) fputs(" q",fp);
else if (style[i] == RMASS) fputs(" rmass",fp); else if (styles[i] == RMASS) fputs(" rmass",fp);
else if (style[i] == IVEC) fprintf(fp," i_%s", atom->ivname[index[i]]); else if (styles[i] == IVEC) fprintf(fp," i_%s", atom->ivname[index[i]]);
else if (style[i] == DVEC) fprintf(fp, " d_%s", atom->dvname[index[i]]); else if (styles[i] == DVEC) fprintf(fp, " d_%s", atom->dvname[index[i]]);
else if (style[i] == IARRAY) fprintf(fp, " i_%s", atom->ianame[index[i]]); else if (styles[i] == IARRAY) fprintf(fp, " i_%s", atom->ianame[index[i]]);
else if (style[i] == DARRAY) fprintf(fp, " d_%s", atom->daname[index[i]]); else if (styles[i] == DARRAY) fprintf(fp, " d_%s", atom->daname[index[i]]);
} }
fputs("\n\n",fp); fputs("\n\n",fp);
} }
@ -446,22 +445,22 @@ void FixPropertyAtom::write_data_section(int /*mth*/, FILE *fp,
fprintf(fp,TAGINT_FORMAT,(tagint) ubuf(buf[i][0]).i); fprintf(fp,TAGINT_FORMAT,(tagint) ubuf(buf[i][0]).i);
icol = 1; icol = 1;
for (nv = 0; nv < nvalue; nv++) { for (nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) if (styles[nv] == MOLECULE)
fprintf(fp," " TAGINT_FORMAT,(tagint) ubuf(buf[i][icol++]).i); fprintf(fp," " TAGINT_FORMAT,(tagint) ubuf(buf[i][icol++]).i);
else if (style[nv] == CHARGE) else if (styles[nv] == CHARGE)
fprintf(fp," %g",buf[i][icol++]); fprintf(fp," %g",buf[i][icol++]);
else if (style[nv] == RMASS) else if (styles[nv] == RMASS)
fprintf(fp," %g",buf[i][icol++]); fprintf(fp," %g",buf[i][icol++]);
else if (style[nv] == IVEC) else if (styles[nv] == IVEC)
fprintf(fp," %d",(int) ubuf(buf[i][icol++]).i); fprintf(fp," %d",(int) ubuf(buf[i][icol++]).i);
else if (style[nv] == DVEC) else if (styles[nv] == DVEC)
fprintf(fp," %g",buf[i][icol++]); fprintf(fp," %g",buf[i][icol++]);
else if (style[nv] == IARRAY) { else if (styles[nv] == IARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
fprintf(fp," %d",(int) ubuf(buf[i][icol+k]).i); fprintf(fp," %d",(int) ubuf(buf[i][icol+k]).i);
icol += ncol; icol += ncol;
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
fprintf(fp," %g",buf[i][icol+k]); fprintf(fp," %g",buf[i][icol+k]);
@ -480,13 +479,13 @@ double FixPropertyAtom::memory_usage()
{ {
double bytes = 0.0; double bytes = 0.0;
for (int m = 0; m < nvalue; m++) { for (int m = 0; m < nvalue; m++) {
if (style[m] == MOLECULE) bytes = atom->nmax * sizeof(tagint); if (styles[m] == MOLECULE) bytes = atom->nmax * sizeof(tagint);
else if (style[m] == CHARGE) bytes = atom->nmax * sizeof(double); else if (styles[m] == CHARGE) bytes = atom->nmax * sizeof(double);
else if (style[m] == RMASS) bytes = atom->nmax * sizeof(double); else if (styles[m] == RMASS) bytes = atom->nmax * sizeof(double);
else if (style[m] == IVEC) bytes = atom->nmax * sizeof(int); else if (styles[m] == IVEC) bytes = atom->nmax * sizeof(int);
else if (style[m] == DVEC) bytes = atom->nmax * sizeof(double); else if (styles[m] == DVEC) bytes = atom->nmax * sizeof(double);
else if (style[m] == IARRAY) bytes = atom->nmax * cols[m] * sizeof(int); else if (styles[m] == IARRAY) bytes = atom->nmax * cols[m] * sizeof(int);
else if (style[m] == DARRAY) bytes = atom->nmax * cols[m] * sizeof(double); else if (styles[m] == DARRAY) bytes = atom->nmax * cols[m] * sizeof(double);
} }
return bytes; return bytes;
} }
@ -501,31 +500,31 @@ double FixPropertyAtom::memory_usage()
void FixPropertyAtom::grow_arrays(int nmax) void FixPropertyAtom::grow_arrays(int nmax)
{ {
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) { if (styles[nv] == MOLECULE) {
memory->grow(atom->molecule,nmax,"atom:molecule"); memory->grow(atom->molecule,nmax,"atom:molecule");
size_t nbytes = (nmax-nmax_old) * sizeof(tagint); size_t nbytes = (nmax-nmax_old) * sizeof(tagint);
memset(&atom->molecule[nmax_old],0,nbytes); memset(&atom->molecule[nmax_old],0,nbytes);
} else if (style[nv] == CHARGE) { } else if (styles[nv] == CHARGE) {
memory->grow(atom->q,nmax,"atom:q"); memory->grow(atom->q,nmax,"atom:q");
size_t nbytes = (nmax-nmax_old) * sizeof(double); size_t nbytes = (nmax-nmax_old) * sizeof(double);
memset(&atom->q[nmax_old],0,nbytes); memset(&atom->q[nmax_old],0,nbytes);
} else if (style[nv] == RMASS) { } else if (styles[nv] == RMASS) {
memory->grow(atom->rmass,nmax,"atom:rmass"); memory->grow(atom->rmass,nmax,"atom:rmass");
size_t nbytes = (nmax-nmax_old) * sizeof(double); size_t nbytes = (nmax-nmax_old) * sizeof(double);
memset(&atom->rmass[nmax_old],0,nbytes); memset(&atom->rmass[nmax_old],0,nbytes);
} else if (style[nv] == IVEC) { } else if (styles[nv] == IVEC) {
memory->grow(atom->ivector[index[nv]],nmax,"atom:ivector"); memory->grow(atom->ivector[index[nv]],nmax,"atom:ivector");
size_t nbytes = (nmax-nmax_old) * sizeof(int); size_t nbytes = (nmax-nmax_old) * sizeof(int);
memset(&atom->ivector[index[nv]][nmax_old],0,nbytes); memset(&atom->ivector[index[nv]][nmax_old],0,nbytes);
} else if (style[nv] == DVEC) { } else if (styles[nv] == DVEC) {
memory->grow(atom->dvector[index[nv]],nmax,"atom:dvector"); memory->grow(atom->dvector[index[nv]],nmax,"atom:dvector");
size_t nbytes = (nmax-nmax_old) * sizeof(double); size_t nbytes = (nmax-nmax_old) * sizeof(double);
memset(&atom->dvector[index[nv]][nmax_old],0,nbytes); memset(&atom->dvector[index[nv]][nmax_old],0,nbytes);
} else if (style[nv] == IARRAY) { } else if (styles[nv] == IARRAY) {
memory->grow(atom->iarray[index[nv]],nmax,cols[nv],"atom:iarray"); memory->grow(atom->iarray[index[nv]],nmax,cols[nv],"atom:iarray");
size_t nbytes = (nmax-nmax_old) * cols[nv] * sizeof(int); size_t nbytes = (nmax-nmax_old) * cols[nv] * sizeof(int);
if (nbytes) memset(&atom->iarray[index[nv]][nmax_old][0],0,nbytes); if (nbytes) memset(&atom->iarray[index[nv]][nmax_old][0],0,nbytes);
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
memory->grow(atom->darray[index[nv]],nmax,cols[nv],"atom:darray"); memory->grow(atom->darray[index[nv]],nmax,cols[nv],"atom:darray");
size_t nbytes = (nmax-nmax_old) * cols[nv] * sizeof(double); size_t nbytes = (nmax-nmax_old) * cols[nv] * sizeof(double);
if (nbytes) memset(&atom->darray[index[nv]][nmax_old][0],0,nbytes); if (nbytes) memset(&atom->darray[index[nv]][nmax_old][0],0,nbytes);
@ -544,21 +543,21 @@ void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/)
int k,ncol; int k,ncol;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) if (styles[nv] == MOLECULE)
atom->molecule[j] = atom->molecule[i]; atom->molecule[j] = atom->molecule[i];
else if (style[nv] == CHARGE) else if (styles[nv] == CHARGE)
atom->q[j] = atom->q[i]; atom->q[j] = atom->q[i];
else if (style[nv] == RMASS) else if (styles[nv] == RMASS)
atom->rmass[j] = atom->rmass[i]; atom->rmass[j] = atom->rmass[i];
else if (style[nv] == IVEC) else if (styles[nv] == IVEC)
atom->ivector[index[nv]][j] = atom->ivector[index[nv]][i]; atom->ivector[index[nv]][j] = atom->ivector[index[nv]][i];
else if (style[nv] == DVEC) else if (styles[nv] == DVEC)
atom->dvector[index[nv]][j] = atom->dvector[index[nv]][i]; atom->dvector[index[nv]][j] = atom->dvector[index[nv]][i];
else if (style[nv] == IARRAY) { else if (styles[nv] == IARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->iarray[index[nv]][j][k] = atom->iarray[index[nv]][i][k]; atom->iarray[index[nv]][j][k] = atom->iarray[index[nv]][i][k];
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->darray[index[nv]][j][k] = atom->darray[index[nv]][i][k]; atom->darray[index[nv]][j][k] = atom->darray[index[nv]][i][k];
@ -576,37 +575,37 @@ int FixPropertyAtom::pack_border(int n, int *list, double *buf)
int m = 0; int m = 0;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) { if (styles[nv] == MOLECULE) {
tagint *molecule = atom->molecule; tagint *molecule = atom->molecule;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
buf[m++] = ubuf(molecule[j]).d; buf[m++] = ubuf(molecule[j]).d;
} }
} else if (style[nv] == CHARGE) { } else if (styles[nv] == CHARGE) {
double *q = atom->q; double *q = atom->q;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
buf[m++] = q[j]; buf[m++] = q[j];
} }
} else if (style[nv] == RMASS) { } else if (styles[nv] == RMASS) {
double *rmass = atom->rmass; double *rmass = atom->rmass;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
buf[m++] = rmass[j]; buf[m++] = rmass[j];
} }
} else if (style[nv] == IVEC) { } else if (styles[nv] == IVEC) {
int *ivector = atom->ivector[index[nv]]; int *ivector = atom->ivector[index[nv]];
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
buf[m++] = ubuf(ivector[j]).d; buf[m++] = ubuf(ivector[j]).d;
} }
} else if (style[nv] == DVEC) { } else if (styles[nv] == DVEC) {
double *dvector = atom->dvector[index[nv]]; double *dvector = atom->dvector[index[nv]];
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
buf[m++] = dvector[j]; buf[m++] = dvector[j];
} }
} else if (style[nv] == IARRAY) { } else if (styles[nv] == IARRAY) {
int **iarray = atom->iarray[index[nv]]; int **iarray = atom->iarray[index[nv]];
ncol = cols[nv]; ncol = cols[nv];
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -614,7 +613,7 @@ int FixPropertyAtom::pack_border(int n, int *list, double *buf)
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
buf[m++] = ubuf(iarray[j][k]).d; buf[m++] = ubuf(iarray[j][k]).d;
} }
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
double **darray = atom->darray[index[nv]]; double **darray = atom->darray[index[nv]];
ncol = cols[nv]; ncol = cols[nv];
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
@ -638,39 +637,39 @@ int FixPropertyAtom::unpack_border(int n, int first, double *buf)
int m = 0; int m = 0;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) { if (styles[nv] == MOLECULE) {
tagint *molecule = atom->molecule; tagint *molecule = atom->molecule;
last = first + n; last = first + n;
for (i = first; i < last; i++) for (i = first; i < last; i++)
molecule[i] = (tagint) ubuf(buf[m++]).i; molecule[i] = (tagint) ubuf(buf[m++]).i;
} else if (style[nv] == CHARGE) { } else if (styles[nv] == CHARGE) {
double *q = atom->q; double *q = atom->q;
last = first + n; last = first + n;
for (i = first; i < last; i++) for (i = first; i < last; i++)
q[i] = buf[m++]; q[i] = buf[m++];
} else if (style[nv] == RMASS) { } else if (styles[nv] == RMASS) {
double *rmass = atom->rmass; double *rmass = atom->rmass;
last = first + n; last = first + n;
for (i = first; i < last; i++) for (i = first; i < last; i++)
rmass[i] = buf[m++]; rmass[i] = buf[m++];
} else if (style[nv] == IVEC) { } else if (styles[nv] == IVEC) {
int *ivector = atom->ivector[index[nv]]; int *ivector = atom->ivector[index[nv]];
last = first + n; last = first + n;
for (i = first; i < last; i++) for (i = first; i < last; i++)
ivector[i] = (int) ubuf(buf[m++]).i; ivector[i] = (int) ubuf(buf[m++]).i;
} else if (style[nv] == DVEC) { } else if (styles[nv] == DVEC) {
double *dvector = atom->dvector[index[nv]]; double *dvector = atom->dvector[index[nv]];
last = first + n; last = first + n;
for (i = first; i < last; i++) for (i = first; i < last; i++)
dvector[i] = buf[m++]; dvector[i] = buf[m++];
} else if (style[nv] == IARRAY) { } else if (styles[nv] == IARRAY) {
int **iarray = atom->iarray[index[nv]]; int **iarray = atom->iarray[index[nv]];
ncol = cols[nv]; ncol = cols[nv];
last = first + n; last = first + n;
for (i = first; i < last; i++) for (i = first; i < last; i++)
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
iarray[i][k] = (int) ubuf(buf[m++]).i; iarray[i][k] = (int) ubuf(buf[m++]).i;
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
double **darray = atom->darray[index[nv]]; double **darray = atom->darray[index[nv]];
ncol = cols[nv]; ncol = cols[nv];
last = first + n; last = first + n;
@ -693,16 +692,16 @@ int FixPropertyAtom::pack_exchange(int i, double *buf)
int m = 0; int m = 0;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; if (styles[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d;
else if (style[nv] == CHARGE) buf[m++] = atom->q[i]; else if (styles[nv] == CHARGE) buf[m++] = atom->q[i];
else if (style[nv] == RMASS) buf[m++] = atom->rmass[i]; else if (styles[nv] == RMASS) buf[m++] = atom->rmass[i];
else if (style[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; else if (styles[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d;
else if (style[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; else if (styles[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i];
else if (style[nv] == IARRAY) { else if (styles[nv] == IARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d;
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
buf[m++] = atom->darray[index[nv]][i][k]; buf[m++] = atom->darray[index[nv]][i][k];
@ -722,21 +721,21 @@ int FixPropertyAtom::unpack_exchange(int nlocal, double *buf)
int m = 0; int m = 0;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) if (styles[nv] == MOLECULE)
atom->molecule[nlocal] = (tagint) ubuf(buf[m++]).i; atom->molecule[nlocal] = (tagint) ubuf(buf[m++]).i;
else if (style[nv] == CHARGE) else if (styles[nv] == CHARGE)
atom->q[nlocal] = buf[m++]; atom->q[nlocal] = buf[m++];
else if (style[nv] == RMASS) else if (styles[nv] == RMASS)
atom->rmass[nlocal] = buf[m++]; atom->rmass[nlocal] = buf[m++];
else if (style[nv] == IVEC) else if (styles[nv] == IVEC)
atom->ivector[index[nv]][nlocal] = (int) ubuf(buf[m++]).i; atom->ivector[index[nv]][nlocal] = (int) ubuf(buf[m++]).i;
else if (style[nv] == DVEC) else if (styles[nv] == DVEC)
atom->dvector[index[nv]][nlocal] = buf[m++]; atom->dvector[index[nv]][nlocal] = buf[m++];
else if (style[nv] == IARRAY) { else if (styles[nv] == IARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i; atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i;
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->darray[index[nv]][nlocal][k] = buf[m++]; atom->darray[index[nv]][nlocal][k] = buf[m++];
@ -760,16 +759,16 @@ int FixPropertyAtom::pack_restart(int i, double *buf)
int m = 1; int m = 1;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; if (styles[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d;
else if (style[nv] == CHARGE) buf[m++] = atom->q[i]; else if (styles[nv] == CHARGE) buf[m++] = atom->q[i];
else if (style[nv] == RMASS) buf[m++] = atom->rmass[i]; else if (styles[nv] == RMASS) buf[m++] = atom->rmass[i];
else if (style[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; else if (styles[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d;
else if (style[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; else if (styles[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i];
else if (style[nv] == IARRAY) { else if (styles[nv] == IARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d;
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
buf[m++] = atom->darray[index[nv]][i][k]; buf[m++] = atom->darray[index[nv]][i][k];
@ -796,21 +795,21 @@ void FixPropertyAtom::unpack_restart(int nlocal, int nth)
m++; m++;
for (int nv = 0; nv < nvalue; nv++) { for (int nv = 0; nv < nvalue; nv++) {
if (style[nv] == MOLECULE) if (styles[nv] == MOLECULE)
atom->molecule[nlocal] = (tagint) ubuf(extra[nlocal][m++]).i; atom->molecule[nlocal] = (tagint) ubuf(extra[nlocal][m++]).i;
else if (style[nv] == CHARGE) else if (styles[nv] == CHARGE)
atom->q[nlocal] = extra[nlocal][m++]; atom->q[nlocal] = extra[nlocal][m++];
else if (style[nv] == RMASS) else if (styles[nv] == RMASS)
atom->rmass[nlocal] = extra[nlocal][m++]; atom->rmass[nlocal] = extra[nlocal][m++];
else if (style[nv] == IVEC) else if (styles[nv] == IVEC)
atom->ivector[index[nv]][nlocal] = (int) ubuf(extra[nlocal][m++]).i; atom->ivector[index[nv]][nlocal] = (int) ubuf(extra[nlocal][m++]).i;
else if (style[nv] == DVEC) else if (styles[nv] == DVEC)
atom->dvector[index[nv]][nlocal] = extra[nlocal][m++]; atom->dvector[index[nv]][nlocal] = extra[nlocal][m++];
else if (style[nv] == IARRAY) { else if (styles[nv] == IARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->iarray[index[nv]][nlocal][k] = (int) ubuf(extra[nlocal][m++]).i; atom->iarray[index[nv]][nlocal][k] = (int) ubuf(extra[nlocal][m++]).i;
} else if (style[nv] == DARRAY) { } else if (styles[nv] == DARRAY) {
ncol = cols[nv]; ncol = cols[nv];
for (k = 0; k < ncol; k++) for (k = 0; k < ncol; k++)
atom->darray[index[nv]][nlocal][k] = extra[nlocal][m++]; atom->darray[index[nv]][nlocal][k] = extra[nlocal][m++];

View File

@ -53,7 +53,7 @@ class FixPropertyAtom : public Fix {
protected: protected:
int nvalue, border; int nvalue, border;
int molecule_flag, q_flag, rmass_flag; // flags for specific fields int molecule_flag, q_flag, rmass_flag; // flags for specific fields
int *style; // style of each value, see enum int *styles; // style of each value, see enum
int *index; // indices into atom custom data structs int *index; // indices into atom custom data structs
int *cols; // columns per value, for arrays int *cols; // columns per value, for arrays
char *astyle; // atom style at instantiation char *astyle; // atom style at instantiation

View File

@ -31,18 +31,17 @@ enum{UNKNOWN,GLOBAL,PERATOM};
FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
vstore(nullptr), astore(nullptr), rbuf(nullptr) vstore(nullptr), astore(nullptr), rbuf(nullptr)
{ {
if (narg != 6) error->all(FLERR,"Illegal fix store command"); if (narg != 6 && narg != 7) error->all(FLERR,"Illegal fix store command");
// 4th arg determines GLOBAL vs PERATOM values // 4th arg determines GLOBAL vs PERATOM values
// syntax: id group style global nrow ncol // global syntax: id group style global n1 n2
// Nrow by Ncol array of global values // N2 = 1 is vector, N2 > 1 is array, no tensor allowed (yet)
// Ncol = 1 is vector, Ncol > 1 is array // peratom syntax: id group style peratom 0/1 n1 n2 (n3), last arg optional
// syntax: id group style peratom 0/1 nvalues
// 0/1 flag = not-store or store peratom values in restart file // 0/1 flag = not-store or store peratom values in restart file
// N2 = 1 and no n3 is vector, N2 > 1 and no n3 is array, N3 = tensor
// nvalues = # of peratom values, N = 1 is vector, N > 1 is array // nvalues = # of peratom values, N = 1 is vector, N > 1 is array
disable = 0; disable = 0;
nvalues = vecflag = 0;
flavor = UNKNOWN; flavor = UNKNOWN;
if (strcmp(arg[3],"global") == 0) flavor = GLOBAL; if (strcmp(arg[3],"global") == 0) flavor = GLOBAL;
@ -52,35 +51,48 @@ vstore(nullptr), astore(nullptr), rbuf(nullptr)
// GLOBAL values are always written to restart file // GLOBAL values are always written to restart file
// PERATOM restart_peratom is set by caller // PERATOM restart_peratom is set by caller
vecflag = arrayflag = tensorflag = 0;
if (flavor == GLOBAL) { if (flavor == GLOBAL) {
restart_global = 1; restart_global = 1;
nrow = utils::inumeric(FLERR,arg[4],false,lmp); n1 = utils::inumeric(FLERR,arg[4],false,lmp);
ncol = utils::inumeric(FLERR,arg[5],false,lmp); n2 = utils::inumeric(FLERR,arg[5],false,lmp);
if (nrow <= 0 || ncol <= 0) if (narg == 7) error->all(FLERR,"Illegal fix store command");
error->all(FLERR,"Illegal fix store command"); if (n1 <= 0 || n2 <= 0) error->all(FLERR,"Illegal fix store command");
vecflag = 0; if (n2 == 1) vecflag = 1;
if (ncol == 1) vecflag = 1; else arrayflag = 1;
nrow = n1;
ncol = n2;
} }
if (flavor == PERATOM) { if (flavor == PERATOM) {
restart_peratom = utils::inumeric(FLERR,arg[4],false,lmp); restart_peratom = utils::inumeric(FLERR,arg[4],false,lmp);
nvalues = utils::inumeric(FLERR,arg[5],false,lmp); n2 = utils::inumeric(FLERR,arg[5],false,lmp);
if (restart_peratom < 0 or restart_peratom > 1 || nvalues <= 0) if (narg == 7) n3 = utils::inumeric(FLERR,arg[6],false,lmp);
else n3 = 1;
if (restart_peratom < 0 || restart_peratom > 1)
error->all(FLERR,"Illegal fix store command"); error->all(FLERR,"Illegal fix store command");
vecflag = 0; if (n2 <= 0 || n3 <= 0) error->all(FLERR,"Illegal fix store command");
if (nvalues == 1) vecflag = 1; if (n2 == 1 && narg == 6) vecflag = 1;
else if (narg == 6) arrayflag = 1;
else tensorflag = 1;
nvalues = n2*n3;
nbytes = n2*n3 * sizeof(double);
} }
vstore = nullptr; vstore = NULL;
astore = nullptr; astore = NULL;
tstore = NULL;
// allocate vector or array and restart buffer rbuf // allocate data struct and restart buffer rbuf
// for PERATOM, register with Atom class // for PERATOM, register with Atom class
if (flavor == GLOBAL) { if (flavor == GLOBAL) {
if (vecflag) memory->create(vstore,nrow,"fix/store:vstore"); if (vecflag) memory->create(vstore,n1,"fix/store:vstore");
else memory->create(astore,nrow,ncol,"fix/store:astore"); else if (arrayflag) memory->create(astore,n1,n2,"fix/store:astore");
memory->create(rbuf,nrow*ncol+2,"fix/store:rbuf"); memory->create(rbuf,n1*n2+2,"fix/store:rbuf");
} }
if (flavor == PERATOM) { if (flavor == PERATOM) {
grow_arrays(atom->nmax); grow_arrays(atom->nmax);
atom->add_callback(Atom::GROW); atom->add_callback(Atom::GROW);
@ -92,21 +104,31 @@ vstore(nullptr), astore(nullptr), rbuf(nullptr)
// PERATOM may be comm->exchanged before filled by caller // PERATOM may be comm->exchanged before filled by caller
if (flavor == GLOBAL) { if (flavor == GLOBAL) {
if (vecflag) if (vecflag) {
for (int i = 0; i < nrow; i++) vstore[i] = 0.0; for (int i = 0; i < n1; i++)
else vstore[i] = 0.0;
for (int i = 0; i < nrow; i++) } else if (arrayflag) {
for (int j = 0; j < ncol; j++) for (int i = 0; i < n1; i++)
for (int j = 0; j < n2; j++)
astore[i][j] = 0.0; astore[i][j] = 0.0;
} }
}
if (flavor == PERATOM) { if (flavor == PERATOM) {
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
if (vecflag) if (vecflag) {
for (int i = 0; i < nlocal; i++) vstore[i] = 0.0;
else
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
for (int j = 0; j < nvalues; j++) vstore[i] = 0.0;
} else if (arrayflag) {
for (int i = 0; i < nlocal; i++)
for (int j = 0; j < n2; j++)
astore[i][j] = 0.0; astore[i][j] = 0.0;
} else if (tensorflag) {
for (int i = 0; i < nlocal; i++)
for (int j = 0; j < n2; j++)
for (int k = 0; k < n3; k++)
tstore[i][j][k] = 0.0;
}
maxexchange = nvalues; maxexchange = nvalues;
} }
} }
@ -124,6 +146,7 @@ FixStore::~FixStore()
memory->destroy(vstore); memory->destroy(vstore);
memory->destroy(astore); memory->destroy(astore);
memory->destroy(tstore);
memory->destroy(rbuf); memory->destroy(rbuf);
} }
@ -141,7 +164,7 @@ int FixStore::setmask()
caller will do subsequent initialization caller will do subsequent initialization
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void FixStore::reset_global(int nrow_caller, int ncol_caller) void FixStore::reset_global(int n1_caller, int n2_caller)
{ {
memory->destroy(vstore); memory->destroy(vstore);
memory->destroy(astore); memory->destroy(astore);
@ -149,29 +172,31 @@ void FixStore::reset_global(int nrow_caller, int ncol_caller)
vstore = nullptr; vstore = nullptr;
astore = nullptr; astore = nullptr;
vecflag = 0; vecflag = arrayflag = 0;
if (ncol_caller == 1) vecflag = 1; if (n2_caller == 1) vecflag = 1;
nrow = nrow_caller; else arrayflag = 1;
ncol = ncol_caller;
if (vecflag) memory->create(vstore,nrow,"fix/store:vstore"); n1 = n1_caller;
else memory->create(astore,nrow,ncol,"fix/store:astore"); n2 = n2_caller;
memory->create(rbuf,nrow*ncol+2,"fix/store:rbuf"); if (vecflag) memory->create(vstore,n1,"fix/store:vstore");
else if (arrayflag) memory->create(astore,n1,n2,"fix/store:astore");
memory->create(rbuf,n1*n2+2,"fix/store:rbuf");
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
write global array to restart file write global vector/array to restart file
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void FixStore::write_restart(FILE *fp) void FixStore::write_restart(FILE *fp)
{ {
// fill rbuf with size and vec/array values // fill rbuf with size and vector/array values
rbuf[0] = nrow; rbuf[0] = n1;
rbuf[1] = ncol; rbuf[1] = n2;
if (vecflag) memcpy(&rbuf[2],vstore,sizeof(double)*nrow); if (vecflag) memcpy(&rbuf[2],vstore,n1*sizeof(double));
else memcpy(&rbuf[2],&astore[0][0],sizeof(double)*nrow*ncol); else if (arrayflag) memcpy(&rbuf[2],&astore[0][0],n1*n2*sizeof(double));
int n = nrow*ncol + 2; int n = n1*n2 + 2;
if (comm->me == 0) { if (comm->me == 0) {
int size = n * sizeof(double); int size = n * sizeof(double);
fwrite(&size,sizeof(int),1,fp); fwrite(&size,sizeof(int),1,fp);
@ -188,33 +213,34 @@ void FixStore::restart(char *buf)
// first 2 values in buf are vec/array sizes // first 2 values in buf are vec/array sizes
double *dbuf = (double *) buf; double *dbuf = (double *) buf;
int nrow_restart = dbuf[0]; int n1_restart = dbuf[0];
int ncol_restart = dbuf[1]; int n2_restart = dbuf[1];
// if size of vec/array has changed, // if size of vec/array has changed,
// means the restart file is setting size of vec or array and doing init // means the restart file is setting size of vec or array and doing init
// because caller did not know size at time this fix was instantiated // because caller did not know size at time this fix was instantiated
// reallocate vstore or astore accordingly // reallocate vstore or astore accordingly
if (nrow != nrow_restart || ncol != ncol_restart) { if (n1 != n1_restart || n2 != n2_restart) {
memory->destroy(vstore); memory->destroy(vstore);
memory->destroy(astore); memory->destroy(astore);
memory->destroy(rbuf); memory->destroy(rbuf);
vstore = nullptr; vstore = nullptr;
astore = nullptr; astore = nullptr;
vecflag = 0; vecflag = arrayflag = 0;
if (ncol_restart == 1) vecflag = 1; if (n2_restart == 1) vecflag = 1;
nrow = nrow_restart; else arrayflag = 1;
ncol = ncol_restart; n1 = n1_restart;
if (vecflag) memory->create(vstore,nrow,"fix/store:vstore"); n2 = n2_restart;
else memory->create(astore,nrow,ncol,"fix/store:astore"); if (vecflag) memory->create(vstore,n1,"fix/store:vstore");
memory->create(rbuf,nrow*ncol+2,"fix/store:rbuf"); else if (arrayflag) memory->create(astore,n1,n2,"fix/store:astore");
memory->create(rbuf,n1*n2+2,"fix/store:rbuf");
} }
int n = nrow*ncol; int n = n1*n2;
if (vecflag) memcpy(vstore,&dbuf[2],n*sizeof(double)); if (vecflag) memcpy(vstore,&dbuf[2],n*sizeof(double));
else memcpy(&astore[0][0],&dbuf[2],n*sizeof(double)); else if (arrayflag) memcpy(&astore[0][0],&dbuf[2],n*sizeof(double));
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -224,7 +250,8 @@ void FixStore::restart(char *buf)
void FixStore::grow_arrays(int nmax) void FixStore::grow_arrays(int nmax)
{ {
if (vecflag) memory->grow(vstore,nmax,"store:vstore"); if (vecflag) memory->grow(vstore,nmax,"store:vstore");
else memory->grow(astore,nmax,nvalues,"store:astore"); else if (arrayflag) memory->grow(astore,nmax,n2,"store:astore");
else if (tensorflag) memory->grow(tstore,nmax,n2,n3,"store:tstore");
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -235,10 +262,14 @@ void FixStore::copy_arrays(int i, int j, int /*delflag*/)
{ {
if (disable) return; if (disable) return;
if (vecflag) vstore[j] = vstore[i]; if (vecflag) {
else vstore[j] = vstore[i];
} else if (arrayflag) {
for (int m = 0; m < nvalues; m++) for (int m = 0; m < nvalues; m++)
astore[j][m] = astore[i][m]; astore[j][m] = astore[i][m];
} else if (tensorflag) {
memcpy(&tstore[j][0][0],&tstore[i][0][0],nbytes);
}
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -249,10 +280,15 @@ int FixStore::pack_exchange(int i, double *buf)
{ {
if (disable) return 0; if (disable) return 0;
if (vecflag) buf[0] = vstore[i]; if (vecflag) {
else buf[0] = vstore[i];
} else if (arrayflag) {
for (int m = 0; m < nvalues; m++) for (int m = 0; m < nvalues; m++)
buf[m] = astore[i][m]; buf[m] = astore[i][m];
} else if (tensorflag) {
memcpy(buf,&tstore[i][0][0],nbytes);
}
return nvalues; return nvalues;
} }
@ -264,10 +300,15 @@ int FixStore::unpack_exchange(int nlocal, double *buf)
{ {
if (disable) return 0; if (disable) return 0;
if (vecflag) vstore[nlocal] = buf[0]; if (vecflag) {
else vstore[nlocal] = buf[0];
} else if (arrayflag) {
for (int m = 0; m < nvalues; m++) for (int m = 0; m < nvalues; m++)
astore[nlocal][m] = buf[m]; astore[nlocal][m] = buf[m];
} else if (tensorflag) {
memcpy(&tstore[nlocal][0][0],buf,nbytes);
}
return nvalues; return nvalues;
} }
@ -284,10 +325,16 @@ int FixStore::pack_restart(int i, double *buf)
// pack buf[0] this way because other fixes unpack it // pack buf[0] this way because other fixes unpack it
buf[0] = nvalues+1; buf[0] = nvalues+1;
if (vecflag) buf[1] = vstore[i];
else if (vecflag) {
buf[1] = vstore[i];
} else if (arrayflag) {
for (int m = 0; m < nvalues; m++) for (int m = 0; m < nvalues; m++)
buf[m+1] = astore[i][m]; buf[m+1] = astore[i][m];
} else if (tensorflag) {
memcpy(&buf[1],&tstore[i][0][0],nbytes);
}
return nvalues+1; return nvalues+1;
} }
@ -308,10 +355,14 @@ void FixStore::unpack_restart(int nlocal, int nth)
for (int i = 0; i < nth; i++) m += static_cast<int> (extra[nlocal][m]); for (int i = 0; i < nth; i++) m += static_cast<int> (extra[nlocal][m]);
m++; m++;
if (vecflag) vstore[nlocal] = extra[nlocal][m]; if (vecflag) {
else vstore[nlocal] = extra[nlocal][m];
} else if (arrayflag) {
for (int i = 0; i < nvalues; i++) for (int i = 0; i < nvalues; i++)
astore[nlocal][i] = extra[nlocal][m++]; astore[nlocal][i] = extra[nlocal][m++];
} else if (tensorflag) {
memcpy(&tstore[nlocal][0][0],&extra[nlocal][m],nbytes);
}
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -335,13 +386,13 @@ int FixStore::size_restart(int /*nlocal*/)
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
memory usage of local atom-based array memory usage of global or peratom atom-based array
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double FixStore::memory_usage() double FixStore::memory_usage()
{ {
double bytes = 0.0; double bytes = 0.0;
if (flavor == GLOBAL) bytes += (double)nrow*ncol * sizeof(double); if (flavor == GLOBAL) bytes += n1*n2 * sizeof(double);
if (flavor == PERATOM) bytes += (double)atom->nmax*nvalues * sizeof(double); if (flavor == PERATOM) bytes += atom->nmax*n2*n3 * sizeof(double);
return bytes; return bytes;
} }

View File

@ -26,10 +26,10 @@ namespace LAMMPS_NS {
class FixStore : public Fix { class FixStore : public Fix {
public: public:
int nrow, ncol; // size of global data array int nrow,ncol; // copy of n1,n2 for GLOBAL array for classes to access
int nvalues; // number of per-atom values
double *vstore; // vector storage for GLOBAL or PERATOM double *vstore; // vector storage for GLOBAL or PERATOM
double **astore; // array storage for GLOBAL or PERATOM double **astore; // array storage for GLOBAL or PERATOM
double ***tstore; // tensor (3d array) storage for PERATOM
int disable; // 1 if operations (except grow) are currently disabled int disable; // 1 if operations (except grow) are currently disabled
FixStore(class LAMMPS *, int, char **); FixStore(class LAMMPS *, int, char **);
@ -54,8 +54,14 @@ class FixStore : public Fix {
private: private:
int flavor; // GLOBAL or PERATOM int flavor; // GLOBAL or PERATOM
int vecflag; // 1 if ncol=1 or nvalues=1 int vecflag; // 1 if ncol=1 or nvalues=1
int arrayflag; // 1 if a 2d array (vector per atom)
int tensorflag; // 1 if a 3d array (array per atom)
double *rbuf; // restart buffer for GLOBAL vec/array int n1,n2,n3; // size of 3d dims of data struct
int nvalues; // number of per-atom values
int nbytes; // number of per-atom bytes
double *rbuf; // restart buffer for GLOBAL vec/array/tensor
}; };
} // namespace LAMMPS_NS } // namespace LAMMPS_NS

View File

@ -47,6 +47,7 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp)
special_lj[1] = special_lj[2] = special_lj[3] = 0.0; special_lj[1] = special_lj[2] = special_lj[3] = 0.0;
special_coul[1] = special_coul[2] = special_coul[3] = 0.0; special_coul[1] = special_coul[2] = special_coul[3] = 0.0;
special_angle = special_dihedral = 0; special_angle = special_dihedral = 0;
special_onefive = 0;
special_extra = 0; special_extra = 0;
dielectric = 1.0; dielectric = 1.0;
@ -755,6 +756,7 @@ void Force::set_special(int narg, char **arg)
special_lj[1] = special_lj[2] = special_lj[3] = 0.0; special_lj[1] = special_lj[2] = special_lj[3] = 0.0;
special_coul[1] = special_coul[2] = special_coul[3] = 0.0; special_coul[1] = special_coul[2] = special_coul[3] = 0.0;
special_angle = special_dihedral = 0; special_angle = special_dihedral = 0;
special_onefive = 0;
int iarg = 0; int iarg = 0;
while (iarg < narg) { while (iarg < narg) {
@ -824,6 +826,15 @@ void Force::set_special(int narg, char **arg)
else if (strcmp(arg[iarg+1],"yes") == 0) special_dihedral = 1; else if (strcmp(arg[iarg+1],"yes") == 0) special_dihedral = 1;
else error->all(FLERR,"Illegal special_bonds command"); else error->all(FLERR,"Illegal special_bonds command");
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"one/five") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command");
if (strcmp(arg[iarg+1],"no") == 0) special_onefive = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) special_onefive = 1;
else error->all(FLERR,"Illegal special_bonds command");
if (special_onefive && atom->nspecial15_flag == 0)
error->all(FLERR,"Cannot set special_bonds one/five if "
"atom style does not support it");
iarg += 2;
} else error->all(FLERR,"Illegal special_bonds command"); } else error->all(FLERR,"Illegal special_bonds command");
} }

View File

@ -115,6 +115,7 @@ class Force : protected Pointers {
int special_dihedral; // 0 if defined dihedrals are ignored int special_dihedral; // 0 if defined dihedrals are ignored
// 1 if only weight 1,4 atoms if in a dihedral // 1 if only weight 1,4 atoms if in a dihedral
int special_extra; // extra space for added bonds int special_extra; // extra space for added bonds
int special_onefive; // 0 if 1-5 neighbors are not stored, 1 if yes
Force(class LAMMPS *); Force(class LAMMPS *);
~Force(); ~Force();

View File

@ -1815,6 +1815,7 @@ void Input::special_bonds()
double lj3 = force->special_lj[3]; double lj3 = force->special_lj[3];
double coul2 = force->special_coul[2]; double coul2 = force->special_coul[2];
double coul3 = force->special_coul[3]; double coul3 = force->special_coul[3];
int onefive = force->special_onefive;
int angle = force->special_angle; int angle = force->special_angle;
int dihedral = force->special_dihedral; int dihedral = force->special_dihedral;
@ -1825,6 +1826,7 @@ void Input::special_bonds()
if (domain->box_exist && atom->molecular == Atom::MOLECULAR) { if (domain->box_exist && atom->molecular == Atom::MOLECULAR) {
if (lj2 != force->special_lj[2] || lj3 != force->special_lj[3] || if (lj2 != force->special_lj[2] || lj3 != force->special_lj[3] ||
coul2 != force->special_coul[2] || coul3 != force->special_coul[3] || coul2 != force->special_coul[2] || coul3 != force->special_coul[3] ||
onefive != force->special_onefive ||
angle != force->special_angle || angle != force->special_angle ||
dihedral != force->special_dihedral) { dihedral != force->special_dihedral) {
Special special(lmp); Special special(lmp);

View File

@ -362,9 +362,9 @@ class Memory : protected Pointers {
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create a 3d array with create a 3d array with all 3 indices offset
1st index from n1lo to n1hi inclusive, 1st index from n1lo to n1hi inclusive
2nd index from n2lo to n2hi inclusive, 2nd index from n2lo to n2hi inclusive
3rd index from n3lo to n3hi inclusive 3rd index from n3lo to n3hi inclusive
cannot grow it cannot grow it
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -513,7 +513,7 @@ class Memory : protected Pointers {
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create a 4d array with indices create a 4d array with indices 2,3,4 offset
2nd index from n2lo to n2hi inclusive 2nd index from n2lo to n2hi inclusive
3rd index from n3lo to n3hi inclusive 3rd index from n3lo to n3hi inclusive
4th index from n4lo to n4hi inclusive 4th index from n4lo to n4hi inclusive
@ -546,7 +546,7 @@ class Memory : protected Pointers {
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
free a 4d array with indices 2,3, and 4 offset free a 4d array with indices 2,3,4 offset
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
template <typename TYPE> template <typename TYPE>
@ -560,6 +560,54 @@ class Memory : protected Pointers {
array = nullptr; array = nullptr;
} }
/* ----------------------------------------------------------------------
create a 4d array with indices 1,2,3 offset
1st index from n1lo to n2hi inclusive
2nd index from n3lo to n3hi inclusive
3rd index from n4lo to n4hi inclusive
cannot grow it
------------------------------------------------------------------------- */
template <typename TYPE>
TYPE ****create4d_offset_last(TYPE ****&array, int n1lo, int n1hi,
int n2lo, int n2hi, int n3lo, int n3hi, int n4,
const char *name)
{
int n1 = n1hi - n1lo + 1;
int n2 = n2hi - n2lo + 1;
int n3 = n3hi - n3lo + 1;
create(array,n1,n2,n3,n4,name);
bigint m = ((bigint) n1) * n2;
for (bigint i = 0; i < m; i++) array[0][i] -= n3lo;
for (int i = 0; i < n1; i++) array[i] -= n2lo;
array -= n1lo;
return array;
}
template <typename TYPE>
TYPE ****create4d_offset_last(TYPE *****& /*array*/, int /*n1lo*/, int /*n1hi*/,
int /*n2lo*/, int /*n2hi*/,
int /*n3lo*/, int /*n3hi*/, int /*n4*/,
const char *name)
{fail(name); return nullptr;}
/* ----------------------------------------------------------------------
free a 4d array with indices 1,2,3 offset
------------------------------------------------------------------------- */
template <typename TYPE>
void destroy4d_offset_last(TYPE ****&array,
int n1_offset, int n2_offset, int n3_offset)
{
if (array == nullptr) return;
sfree(&array[n1_offset][n2_offset][n3_offset][0]);
sfree(&array[n1_offset][n2_offset][n3_offset]);
sfree(&array[n1_offset][n2_offset]);
sfree(&array[n1_offset]);
array = nullptr;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create a 5d array create a 5d array
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -493,8 +493,8 @@ void Neighbor::init()
// flag = 0 if both LJ/Coulomb special values are 0.0 // flag = 0 if both LJ/Coulomb special values are 0.0
// flag = 1 if both LJ/Coulomb special values are 1.0 // flag = 1 if both LJ/Coulomb special values are 1.0
// flag = 2 otherwise or if KSpace solver is enabled // flag = 2 otherwise or if KSpace solver is enabled
// pairwise portion of KSpace solver uses all 1-2,1-3,1-4 neighbors // b/c pairwise portion of KSpace solver uses all 1-2,1-3,1-4 neighbors
// or selected Coulomb-approixmation pair styles require it // some Coulomb-approximation pair styles also require it (below)
if (force->special_lj[1] == 0.0 && force->special_coul[1] == 0.0) if (force->special_lj[1] == 0.0 && force->special_coul[1] == 0.0)
special_flag[1] = 0; special_flag[1] = 0;
@ -514,10 +514,10 @@ void Neighbor::init()
special_flag[3] = 1; special_flag[3] = 1;
else special_flag[3] = 2; else special_flag[3] = 2;
// We cannot remove special neighbors with kspace or kspace-like pair styles // cannot remove special neighbors with kspace or kspace-like pair styles
// as the exclusion needs to remove the full coulomb and not the damped interaction. // b/c exclusion needs to remove the full coulomb and not the damped interaction
// Special treatment is required for hybrid pair styles since Force::pair_match() // special treatment required for hybrid pair styles since Force::pair_match()
// will only return a non-null pointer if there is only one substyle of the kind. // will only return a non-NULL pointer if there is only one substyle of the kind
if (force->kspace) { if (force->kspace) {
special_flag[1] = special_flag[2] = special_flag[3] = 2; special_flag[1] = special_flag[2] = special_flag[3] = 2;
@ -526,7 +526,8 @@ void Neighbor::init()
if (ph) { if (ph) {
int flag=0; int flag=0;
for (int isub=0; isub < ph->nstyles; ++isub) { for (int isub=0; isub < ph->nstyles; ++isub) {
if (force->pair_match("coul/wolf",0,isub) if (force->pair_match("amoeba",0,isub)
|| force->pair_match("coul/wolf",0,isub)
|| force->pair_match("coul/dsf",0,isub) || force->pair_match("coul/dsf",0,isub)
|| force->pair_match("coul/exclude",0) || force->pair_match("coul/exclude",0)
|| force->pair_match("thole",0,isub)) || force->pair_match("thole",0,isub))
@ -535,7 +536,8 @@ void Neighbor::init()
if (flag) if (flag)
special_flag[1] = special_flag[2] = special_flag[3] = 2; special_flag[1] = special_flag[2] = special_flag[3] = 2;
} else { } else {
if (force->pair_match("coul/wolf",0) if (force->pair_match("amoeba",0)
|| force->pair_match("coul/wolf",0)
|| force->pair_match("coul/dsf",0) || force->pair_match("coul/dsf",0)
|| force->pair_match("coul/exclude",0) || force->pair_match("coul/exclude",0)
|| force->pair_match("thole",0)) || force->pair_match("thole",0))

View File

@ -190,6 +190,12 @@ class Pair : protected Pointers {
virtual void unpack_forward_comm(int, int, double *) {} virtual void unpack_forward_comm(int, int, double *) {}
virtual int pack_reverse_comm(int, int, double *) { return 0; } virtual int pack_reverse_comm(int, int, double *) { return 0; }
virtual void unpack_reverse_comm(int, int *, double *) {} virtual void unpack_reverse_comm(int, int *, double *) {}
virtual void pack_forward_grid(int, void *, int, int *) {}
virtual void unpack_forward_grid(int, void *, int, int *) {}
virtual void pack_reverse_grid(int, void *, int, int *) {}
virtual void unpack_reverse_grid(int, void *, int, int *) {}
virtual double memory_usage(); virtual double memory_usage();
void set_copymode(int value) { copymode = value; } void set_copymode(int value) { copymode = value; }

View File

@ -35,7 +35,7 @@ Special::Special(LAMMPS *lmp) : Pointers(lmp)
MPI_Comm_rank(world,&me); MPI_Comm_rank(world,&me);
MPI_Comm_size(world,&nprocs); MPI_Comm_size(world,&nprocs);
onetwo = onethree = onefour = nullptr; onetwo = onethree = onefour = onefive = NULL;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -45,12 +45,13 @@ Special::~Special()
memory->destroy(onetwo); memory->destroy(onetwo);
memory->destroy(onethree); memory->destroy(onethree);
memory->destroy(onefour); memory->destroy(onefour);
memory->destroy(onefive);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create 1-2, 1-3, 1-4 lists of topology neighbors create 1-2, 1-3, 1-4 lists of topology neighbors, 1-5 list is optional
store in onetwo, onethree, onefour for each atom store in onetwo, onethree, onefour, onefive for each atom
store 3 counters in nspecial[i] store first 3 counters in nspecial[i], and 4th in nspecial15[i]
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Special::build() void Special::build()
@ -69,9 +70,14 @@ void Special::build()
utils::logmesg(lmp,mesg); utils::logmesg(lmp,mesg);
} }
// set onefive_flag if special_bonds command set it
onefive_flag = force->special_onefive;
// initialize nspecial counters to 0 // initialize nspecial counters to 0
int **nspecial = atom->nspecial; int **nspecial = atom->nspecial;
int *nspecial15 = atom->nspecial15;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
@ -80,6 +86,10 @@ void Special::build()
nspecial[i][2] = 0; nspecial[i][2] = 0;
} }
if (onefive_flag) {
for (int i = 0; i < nlocal; i++) nspecial15[i] = 0;
}
// setup atomIDs and procowner vectors in rendezvous decomposition // setup atomIDs and procowner vectors in rendezvous decomposition
atom_owners(); atom_owners();
@ -96,8 +106,10 @@ void Special::build()
utils::logmesg(lmp,"{:>6} = max # of 1-2 neighbors\n",maxall); utils::logmesg(lmp,"{:>6} = max # of 1-2 neighbors\n",maxall);
// done if special_bond weights for 1-3, 1-4 are set to 1.0 // done if special_bond weights for 1-3, 1-4 are set to 1.0
// onefive_flag must also be off, else 1-4 is needed to create 1-5
if (force->special_lj[2] == 1.0 && force->special_coul[2] == 1.0 && if (!onefive_flag &&
force->special_lj[2] == 1.0 && force->special_coul[2] == 1.0 &&
force->special_lj[3] == 1.0 && force->special_coul[3] == 1.0) { force->special_lj[3] == 1.0 && force->special_coul[3] == 1.0) {
dedup(); dedup();
combine(); combine();
@ -119,8 +131,10 @@ void Special::build()
utils::logmesg(lmp,"{:>6} = max # of 1-3 neighbors\n",maxall); utils::logmesg(lmp,"{:>6} = max # of 1-3 neighbors\n",maxall);
// done if special_bond weights for 1-4 are set to 1.0 // done if special_bond weights for 1-4 are set to 1.0
// onefive_flag must also be off, else 1-4 is needed to create 1-5
if (force->special_lj[3] == 1.0 && force->special_coul[3] == 1.0) { if (!onefive_flag &&
force->special_lj[3] == 1.0 && force->special_coul[3] == 1.0) {
dedup(); dedup();
if (force->special_angle) angle_trim(); if (force->special_angle) angle_trim();
combine(); combine();
@ -141,7 +155,17 @@ void Special::build()
if (me == 0) if (me == 0)
utils::logmesg(lmp,"{:>6} = max # of 1-4 neighbors\n",maxall); utils::logmesg(lmp,"{:>6} = max # of 1-4 neighbors\n",maxall);
// finish processing the onetwo, onethree, onefour lists // optionally store 1-5 neighbors
// tally nspecial15[i] = # of 1-5 neighbors of atom i
// create onefive[i] = list of 1-5 neighbors for atom i
if (onefive_flag) {
onefive_build();
if (me == 0)
utils::logmesg(lmp,fmt::format("{:>6} = max # of 1-5 neighbors\n",maxall));
}
// finish processing the onetwo, onethree, onefour, onefive lists
dedup(); dedup();
if (force->special_angle) angle_trim(); if (force->special_angle) angle_trim();
@ -150,7 +174,6 @@ void Special::build()
fix_alteration(); fix_alteration();
memory->destroy(procowner); memory->destroy(procowner);
memory->destroy(atomIDs); memory->destroy(atomIDs);
timer_output(time1); timer_output(time1);
} }
@ -450,7 +473,7 @@ void Special::onefour_build()
// setup input buf to rendezvous comm // setup input buf to rendezvous comm
// datums = pairs of onethree and onetwo partners where onethree is unknown // datums = pairs of onethree and onetwo partners where onethree is unknown
// these pairs are onefour neighbors // these pairs are onefour neighbors
// datum = onetwo ID, onetwo ID // datum = onethree ID, onetwo ID
// owning proc for each datum = onethree ID % nprocs // owning proc for each datum = onethree ID % nprocs
nsend = 0; nsend = 0;
@ -521,8 +544,113 @@ void Special::onefour_build()
memory->sfree(outbuf); memory->sfree(outbuf);
} }
/* ----------------------------------------------------------------------
optional onefive build
uses rendezvous comm
------------------------------------------------------------------------- */
void Special::onefive_build()
{
int i,j,k,m,proc;
int **nspecial = atom->nspecial;
int *nspecial15 = atom->nspecial15;
int nlocal = atom->nlocal;
// nsend = # of my datums to send
int nsend = 0;
for (i = 0; i < nlocal; i++) {
for (j = 0; j < nspecial[i][2]; j++) {
m = atom->map(onefour[i][j]);
if (m < 0 || m >= nlocal) nsend += nspecial[i][0];
}
}
int *proclist;
memory->create(proclist,nsend,"special:proclist");
PairRvous *inbuf = (PairRvous *)
memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf");
// setup input buf to rendezvous comm
// datums = pairs of onefour and onetwo partners where onefour is unknown
// these pairs are onefive neighbors
// datum = onefour ID, onetwo ID
// owning proc for each datum = onefour ID % nprocs
nsend = 0;
for (i = 0; i < nlocal; i++) {
for (j = 0; j < nspecial[i][2]; j++) {
m = atom->map(onefour[i][j]);
if (m >= 0 && m < nlocal) continue;
proc = onefour[i][j] % nprocs;
for (k = 0; k < nspecial[i][0]; k++) {
proclist[nsend] = proc;
inbuf[nsend].atomID = onefour[i][j];
inbuf[nsend].partnerID = onetwo[i][k];
nsend++;
}
}
}
// perform rendezvous operation
char *buf;
int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous),
0,proclist,
rendezvous_pairs,0,buf,sizeof(PairRvous),
(void *) this);
PairRvous *outbuf = (PairRvous *) buf;
memory->destroy(proclist);
memory->sfree(inbuf);
// set nspecial15 and onefive for all owned atoms
// based on owned info plus rendezvous output info
// output datums = pairs of atoms that are 1-5 neighbors
for (i = 0; i < nlocal; i++) {
for (j = 0; j < nspecial[i][2]; j++) {
m = atom->map(onefour[i][j]);
if (m >= 0 && m < nlocal) nspecial15[m] += nspecial[i][0];
}
}
for (m = 0; m < nreturn; m++) {
i = atom->map(outbuf[m].atomID);
nspecial15[i]++;
}
int max = 0;
for (i = 0; i < nlocal; i++)
max = MAX(max,nspecial15[i]);
MPI_Allreduce(&max,&maxall,1,MPI_INT,MPI_MAX,world);
memory->create(onefive,nlocal,maxall,"special:onefive");
for (i = 0; i < nlocal; i++) nspecial15[i] = 0;
for (i = 0; i < nlocal; i++) {
for (j = 0; j < nspecial[i][2]; j++) {
m = atom->map(onefour[i][j]);
if (m < 0 || m >= nlocal) continue;
for (k = 0; k < nspecial[i][0]; k++) {
onefive[m][nspecial15[m]++] = onetwo[i][k];
}
}
}
for (m = 0; m < nreturn; m++) {
i = atom->map(outbuf[m].atomID);
onefive[i][nspecial15[i]++] = outbuf[m].partnerID;
}
memory->sfree(outbuf);
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
remove duplicates within each of onetwo, onethree, onefour individually remove duplicates within each of onetwo, onethree, onefour individually
also dedup onefive if enabled
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Special::dedup() void Special::dedup()
@ -536,15 +664,18 @@ void Special::dedup()
// use map to cull duplicates // use map to cull duplicates
// exclude original atom explicitly // exclude original atom explicitly
// adjust onetwo, onethree, onefour values to reflect removed duplicates // adjust onetwo, onethree, onefour, onefive values to remove duplicates
// must unset map for each atom // must unset map for each atom
int **nspecial = atom->nspecial; int **nspecial = atom->nspecial;
int *nspecial15 = atom->nspecial15;
tagint *tag = atom->tag; tagint *tag = atom->tag;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
int unique; int unique;
// dedup onetwo
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
unique = 0; unique = 0;
atom->map_one(tag[i],0); atom->map_one(tag[i],0);
@ -560,6 +691,8 @@ void Special::dedup()
for (j = 0; j < unique; j++) atom->map_one(onetwo[i][j],-1); for (j = 0; j < unique; j++) atom->map_one(onetwo[i][j],-1);
} }
// dedup onethree
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
unique = 0; unique = 0;
atom->map_one(tag[i],0); atom->map_one(tag[i],0);
@ -575,6 +708,8 @@ void Special::dedup()
for (j = 0; j < unique; j++) atom->map_one(onethree[i][j],-1); for (j = 0; j < unique; j++) atom->map_one(onethree[i][j],-1);
} }
// dedup onefour
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
unique = 0; unique = 0;
atom->map_one(tag[i],0); atom->map_one(tag[i],0);
@ -590,6 +725,25 @@ void Special::dedup()
for (j = 0; j < unique; j++) atom->map_one(onefour[i][j],-1); for (j = 0; j < unique; j++) atom->map_one(onefour[i][j],-1);
} }
// dedup onefive
if (onefive_flag) {
for (i = 0; i < nlocal; i++) {
unique = 0;
atom->map_one(tag[i],0);
for (j = 0; j < nspecial15[i]; j++) {
m = onefive[i][j];
if (atom->map(m) < 0) {
onefive[i][unique++] = m;
atom->map_one(m,0);
}
}
nspecial15[i] = unique;
atom->map_one(tag[i],-1);
for (j = 0; j < unique; j++) atom->map_one(onefive[i][j],-1);
}
}
// re-create map // re-create map
atom->map_init(0); atom->map_init(0);
@ -601,6 +755,7 @@ void Special::dedup()
concatenate onetwo, onethree, onefour into master atom->special list concatenate onetwo, onethree, onefour into master atom->special list
remove duplicates between 3 lists, leave dup in first list it appears in remove duplicates between 3 lists, leave dup in first list it appears in
convert nspecial[0], nspecial[1], nspecial[2] into cumulative counters convert nspecial[0], nspecial[1], nspecial[2] into cumulative counters
if 1-5 is enabled, reset nspecial15/special15 to remove dups with 1-2,1-3,1-4
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void Special::combine() void Special::combine()
@ -612,6 +767,7 @@ void Special::combine()
MPI_Comm_rank(world,&me); MPI_Comm_rank(world,&me);
int **nspecial = atom->nspecial; int **nspecial = atom->nspecial;
int *nspecial15 = atom->nspecial15;
tagint *tag = atom->tag; tagint *tag = atom->tag;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
@ -624,12 +780,14 @@ void Special::combine()
atom->map_clear(); atom->map_clear();
// unique = # of unique nspecial neighbors of one atom // unique = # of unique nspecial neighbors of one atom
// unique15 = ditto for 1-5 interactions
// cull duplicates using map to check for them // cull duplicates using map to check for them
// exclude original atom explicitly // exclude original atom explicitly
// must unset map for each atom // must unset map for each atom
int unique; int unique,unique15;
int maxspecial = 0; int maxspecial = 0;
int maxspecial15 = 0;
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
unique = 0; unique = 0;
@ -659,15 +817,30 @@ void Special::combine()
maxspecial = MAX(maxspecial,unique); maxspecial = MAX(maxspecial,unique);
if (onefive_flag) {
unique15 = 0;
for (j = 0; j < nspecial15[i]; j++) {
m = onefive[i][j];
if (atom->map(m) < 0) {
unique15++;
atom->map_one(m,0);
}
}
maxspecial15 = MAX(maxspecial15,unique15);
}
atom->map_one(tag[i],-1); atom->map_one(tag[i],-1);
for (j = 0; j < nspecial[i][0]; j++) atom->map_one(onetwo[i][j],-1); for (j = 0; j < nspecial[i][0]; j++) atom->map_one(onetwo[i][j],-1);
for (j = 0; j < nspecial[i][1]; j++) atom->map_one(onethree[i][j],-1); for (j = 0; j < nspecial[i][1]; j++) atom->map_one(onethree[i][j],-1);
for (j = 0; j < nspecial[i][2]; j++) atom->map_one(onefour[i][j],-1); for (j = 0; j < nspecial[i][2]; j++) atom->map_one(onefour[i][j],-1);
if (onefive_flag)
for (j = 0; j < nspecial15[i]; j++) atom->map_one(onefive[i][j],-1);
} }
// if atom->maxspecial has been updated before, make certain // if atom->maxspecial has been updated before,
// we do not reset it to a smaller value. Since atom->maxspecial // make certain it is not reset to a smaller value
// is initialized to 1, this ensures that it is larger than zero. // since atom->maxspecial is initialized to 1,
// this ensures that it stays larger than zero
maxspecial = MAX(atom->maxspecial,maxspecial); maxspecial = MAX(atom->maxspecial,maxspecial);
@ -702,12 +875,23 @@ void Special::combine()
memory->create(atom->special,atom->nmax,atom->maxspecial,"atom:special"); memory->create(atom->special,atom->nmax,atom->maxspecial,"atom:special");
} }
tagint **special = atom->special; // if 1-5 is enabled, similarly compute global maxspecial15 and reallocate
if (onefive_flag) {
maxspecial15 = MAX(atom->maxspecial15,maxspecial15);
MPI_Allreduce(&maxspecial15,&atom->maxspecial15,1,MPI_INT,MPI_MAX,world);
memory->destroy(atom->special15);
memory->create(atom->special15,atom->nmax,atom->maxspecial15,"atom:special15");
}
// ---------------------------------------------------- // ----------------------------------------------------
// fill special array with 1-2, 1-3, 1-4 neighs for each atom // fill special array with 1-2, 1-3, 1-4 neighs for each atom
// optionally fill special15 array with 1-5 neighs
// ---------------------------------------------------- // ----------------------------------------------------
tagint **special = atom->special;
tagint **special15 = atom->special15;
// again use map to cull duplicates // again use map to cull duplicates
// exclude original atom explicitly // exclude original atom explicitly
// adjust nspecial[i] values to reflect removed duplicates // adjust nspecial[i] values to reflect removed duplicates
@ -744,8 +928,22 @@ void Special::combine()
} }
nspecial[i][2] = unique; nspecial[i][2] = unique;
if (onefive_flag) {
unique15 = 0;
for (j = 0; j < nspecial15[i]; j++) {
m = onefive[i][j];
if (atom->map(m) < 0) {
special15[i][unique15++] = m;
atom->map_one(m,0);
}
}
nspecial15[i] = unique15;
}
atom->map_one(tag[i],-1); atom->map_one(tag[i],-1);
for (j = 0; j < nspecial[i][2]; j++) atom->map_one(special[i][j],-1); for (j = 0; j < nspecial[i][2]; j++) atom->map_one(special[i][j],-1);
if (onefive_flag)
for (j = 0; j < nspecial15[i]; j++) atom->map_one(special15[i][j],-1);
} }
// re-create map // re-create map

View File

@ -27,7 +27,8 @@ class Special : protected Pointers {
private: private:
int me, nprocs; int me, nprocs;
int maxall; int maxall;
tagint **onetwo, **onethree, **onefour; int onefive_flag;
tagint **onetwo,**onethree,**onefour,**onefive;
// data used by rendezvous callback methods // data used by rendezvous callback methods
@ -51,6 +52,7 @@ class Special : protected Pointers {
void onetwo_build_newton_off(); void onetwo_build_newton_off();
void onethree_build(); void onethree_build();
void onefour_build(); void onefour_build();
void onefive_build();
void dedup(); void dedup();
void angle_trim(); void angle_trim();

View File

@ -48,6 +48,7 @@ singularity Singularity container descriptions suitable for LAMMPS de
smd convert Smooth Mach Dynamics triangles to VTK smd convert Smooth Mach Dynamics triangles to VTK
spin perform a cubic polynomial interpolation of a GNEB MEP spin perform a cubic polynomial interpolation of a GNEB MEP
swig Interface file and demo scripts for SWIG wrappers for the LAMMPS C library interface swig Interface file and demo scripts for SWIG wrappers for the LAMMPS C library interface
tinker2lmp.py convert Tinker input files to LAMMPS input files
valgrind suppression files for use with valgrind's memcheck tool valgrind suppression files for use with valgrind's memcheck tool
vim add-ons to VIM editor for editing LAMMPS input scripts vim add-ons to VIM editor for editing LAMMPS input scripts
xmgrace a collection of scripts to generate xmgrace plots xmgrace a collection of scripts to generate xmgrace plots

913
tools/tinker2lmp.py Normal file
View File

@ -0,0 +1,913 @@
#!/bin/env python
# convert a Tinker XYZ file + PRM file to a LAMMPS data file
# Syntax: python tinker2lmp.py -switch args -switch args ...
# -xyz file = Tinker XYZ file name (required)
# -amoeba file = AMOEBA PRM force field file name (required, or hippo)
# -hippo file = HIPPO PRM force field file name (required, or amoeba)
# -data file = LAMMPS data file to output (required)
# -nopbc = non-periodic system (default)
# -pbc xhi yhi zhi = periodic system from 0 to hi in each dimension (optional)
import sys,os,math
path = os.environ["LAMMPS_PYTHON_TOOLS"]
sys.path.append(path)
from data import data
BIG = 1.0e20
DELTA = 0.001 # delta on LAMMPS shrink-wrap box size, in Angstroms
# ----------------------
# methods and classes
# ----------------------
# print an error message and exit
def error(txt=""):
if not txt:
print "Syntax: tinker2lmp.py -switch args ..."
print " -xyz file"
print " -amoeba file"
print " -hippo file"
print " -data file"
print " -nopbc"
print " -pbc xhi yhi zhi"
else: print "ERROR:",txt
sys.exit()
# read and store values from a Tinker xyz file
class XYZfile:
def __init__(self,file):
lines = open(file,'r').readlines()
natoms = int(lines[0].split()[0])
id = []
type = []
x = []
y = []
z = []
bonds = []
for line in lines[1:natoms+1]:
words = line.split()
id.append(int(words[0]))
x.append(words[2])
y.append(words[3])
z.append(words[4])
type.append(int(words[5]))
blist = words[6:]
blist = [int(one) for one in blist]
bonds.append(blist)
self.natoms = natoms
self.id = id
self.type = type
self.x = x
self.y = y
self.z = z
self.bonds = bonds
# triplet of atoms in an angle = atom 1,2,3
# atom2 is center atom
# nbonds = number of atoms which atom2 is bonded to
# hcount = # of H atoms which atom2 is bonded to, excluding atom1 and atom3
def angle_hbond_count(self,atom1,atom2,atom3,lmptype,lmpmass):
bondlist = self.bonds[atom2-1]
nbonds = len(bondlist)
hcount = 0
for bondID in bondlist:
if atom1 == bondID: continue
if atom3 == bondID: continue
massone = lmpmass[lmptype[bondID-1]-1]
if int(massone+0.5) == 1: hcount += 1
return nbonds,hcount
# read and store select values from a Tinker force field PRM file
# ntypes = # of Tinker types
# per-type values: class and mass
# scalar force field params in Force Field Definition section
# bond, angle, dihedral coeffs indexed by Tinker classes
class PRMfile:
def __init__(self,file):
lines = open(file,'r').readlines()
self.nlines = len(lines)
self.lines = lines
self.force_field_definition()
self.classes,self.masses = self.peratom()
self.polgroup = self.polarize()
self.bondparams = self.bonds()
self.angleparams = self.angles()
self.bondangleparams = self.bondangles()
self.torsionparams = self.torsions()
self.ntypes = len(self.masses)
def force_field_definition(self):
iline = self.find_section("Force Field Definition")
iline += 3
while iline < self.nlines:
words = self.lines[iline].split()
if len(words):
if words[0].startswith("###########"): break
if words[0] == "bond-cubic": self.bond_cubic = float(words[1])
elif words[0] == "bond-quartic": self.bond_quartic = float(words[1])
elif words[0] == "angle-cubic": self.angle_cubic = float(words[1])
elif words[0] == "angle-quartic": self.angle_quartic = float(words[1])
elif words[0] == "angle-pentic": self.angle_pentic = float(words[1])
elif words[0] == "angle-sextic": self.angle_sextic = float(words[1])
iline += 1
def peratom(self):
classes = []
masses = []
iline = self.find_section("Atom Type Definitions")
if iline < 0: return classes,masses
iline += 3
while iline < self.nlines:
words = self.lines[iline].split()
if len(words):
if words[0].startswith("###########"): break
# NOTE: assumes atom entries are numbered consecutively
if words[0] == "atom":
classes.append(int(words[2]))
masses.append(float(words[-2]))
iline += 1
return classes,masses
def polarize(self):
polgroup = []
iline = self.find_section("Dipole Polarizability Parameters")
if iline < 0: return polgroup
iline += 3
while iline < self.nlines:
words = self.lines[iline].split()
if len(words):
if words[0].startswith("###########"): break
# trim off any end-of-line comments
if "!!" in words: words = words[:words.index("!!")]
# NOTE: assumes polarize entries are numbered consecutively
if words[0] == "polarize":
if amoeba: bondtypes = words[4:]
if hippo: bondtypes = words[3:]
bondtypes = [int(one) for one in bondtypes]
polgroup.append(bondtypes)
iline += 1
return polgroup
# convert PRMfile params to LAMMPS bond_style class2 params
def bonds(self):
params = []
iline = self.find_section("Bond Stretching Parameters")
if iline < 0: return params
iline += 3
while iline < self.nlines:
words = self.lines[iline].split()
if len(words):
if words[0].startswith("###########"): break
if words[0] == "bond":
class1 = int(words[1])
class2 = int(words[2])
value1 = float(words[3])
value2 = float(words[4])
lmp1 = value2
lmp2 = value1
lmp3 = self.bond_cubic * value1
lmp4 = self.bond_quartic * value1
params.append((class1,class2,lmp1,lmp2,lmp3,lmp4))
iline += 1
return params
# convert PRMfile params to LAMMPS angle_style class2/p6 params
# line may have prefactor plus 1,2,3 angle0 params
# save prefactor/angle0 pairs as option 1,2,3
def angles(self):
r2d = 180.0 / math.pi
params = []
iline = self.find_section("Angle Bending Parameters")
if iline < 0: return params
iline += 3
while iline < self.nlines:
words = self.lines[iline].split()
if len(words):
if words[0].startswith("###########"): break
if words[0] == "angle" or words[0] == "anglep":
if words[0] == "angle": pflag = 0
if words[0] == "anglep": pflag = 1
class1 = int(words[1])
class2 = int(words[2])
class3 = int(words[3])
value1 = float(words[4])
value2 = float(words[5])
option1 = ()
option2 = ()
option3 = ()
lmp1 = value2
lmp2 = value1
lmp3 = self.angle_cubic * value1 * r2d
lmp4 = self.angle_quartic * value1 * r2d*r2d
lmp5 = self.angle_pentic * value1 * r2d*r2d*r2d
lmp6 = self.angle_sextic * value1 * r2d*r2d*r2d*r2d
option1 = (pflag,lmp1,lmp2,lmp3,lmp4,lmp5,lmp6)
if len(words) >= 7:
value3 = float(words[6])
lmp1 = value3
option2 = (pflag,lmp1,lmp2,lmp3,lmp4,lmp5,lmp6)
if len(words) == 8:
value4 = float(words[7])
lmp1 = value4
option3 = (pflag,lmp1,lmp2,lmp3,lmp4,lmp5,lmp6)
if not option2 and not option3:
params.append((class1,class2,class3,[option1]))
elif not option3:
params.append((class1,class2,class3,[option1,option2]))
else:
params.append((class1,class2,class3,[option1,option2,option3]))
iline += 1
return params
# convert PRMfile params to LAMMPS angle_style class2/p6 bondangle params
# lmp3,lmp4 = equilibrium bond lengths for 2 bonds in angle
# need to find these values in self.bondparams
# put them in a dictionary for efficient searching
def bondangles(self):
params = []
iline = self.find_section("Stretch Bend Parameters")
if iline < 0: return params
iline += 3
bdict = {}
for m,params in enumerate(self.bondparams):
bdict[(params[0],params[1])] = params[2]
while iline < self.nlines:
words = self.lines[iline].split()
if len(words):
if words[0].startswith("###########"): break
if words[0] == "strbnd":
class1 = int(words[1])
class2 = int(words[2])
class3 = int(words[3])
value1 = float(words[4])
value2 = float(words[5])
lmp1 = value1
lmp2 = value2
lmp3 = lmp4 = 0.0
if (class2,class1) in bdict: lmp3 = bdict[(class2,class1)]
if (class1,class2) in bdict: lmp3 = bdict[(class1,class2)]
if (class2,class3) in bdict: lmp4 = bdict[(class2,class3)]
if (class3,class2) in bdict: lmp4 = bdict[(class3,class2)]
if lmp3 == 0.0 or lmp4 == 0.0:
print "Bond in BondAngle term not found",class1,class2,class3
sys.exit()
params.append((class1,class2,class3,lmp1,lmp2,lmp3,lmp4))
iline += 1
return params
def torsions(self):
params = []
iline = self.find_section("Torsional Parameters")
if iline < 0: return params
iline += 3
while iline < self.nlines:
words = self.lines[iline].split()
if len(words):
if words[0].startswith("###########"): break
if words[0] == "torsion":
class1 = int(words[1])
class2 = int(words[2])
class3 = int(words[3])
class4 = int(words[4])
value1 = words[5]
value2 = words[6]
value3 = words[7]
value4 = words[8]
value5 = words[9]
value6 = words[10]
value7 = words[11]
value8 = words[12]
value9 = words[13]
params.append((class1,class2,class3,class4,
value1,value2,value3,value4,value5,
value6,value7,value8,value9))
iline += 1
return params
def find_section(self,txt):
txt = "## %s ##" % txt
for iline,line in enumerate(self.lines):
if txt in line: return iline
return -1
# ----------------------------------------
# main program
# ----------------------------------------
args = sys.argv[1:]
narg = len(args)
# process args
amoeba = hippo = 0
xyzfile = ""
prmfile = ""
datafile = ""
pbcflag = 0
iarg = 0
while iarg < narg:
if args[iarg] == "-xyz":
if iarg + 2 > narg: error()
xyzfile = args[iarg+1]
iarg += 2
elif args[iarg] == "-amoeba":
if iarg + 2 > narg: error()
amoeba = 1
prmfile = args[iarg+1]
iarg += 2
elif args[iarg] == "-hippo":
if iarg + 2 > narg: error()
hippo = 1
prmfile = args[iarg+1]
iarg += 2
elif args[iarg] == "-data":
if iarg + 2 > narg: error()
datafile = args[iarg+1]
iarg += 2
elif args[iarg] == "-nopbc":
pbcflag = 0
iarg += 1
elif args[iarg] == "-pbc":
if iarg + 4 > narg: error()
pbcflag = 1
xhi = float(args[iarg+1])
yhi = float(args[iarg+2])
zhi = float(args[iarg+3])
boxhi = [xhi,yhi,zhi]
iarg += 4
else: error()
# error check
if not xyzfile: error("xyzfile not specified")
if not prmfile: error("prmfile not specified")
if not datafile: error("datafile not specified")
# read Tinker xyz and prm files
xyz = XYZfile(xyzfile)
prm = PRMfile(prmfile)
# create LAMMPS box bounds based on pbcflag
natoms = xyz.natoms
x = xyz.x
y = xyz.y
z = xyz.z
if pbcflag:
boxlo = [0,0,0]
else:
xlo = ylo = zlo = BIG
xhi = yhi = zhi = -BIG
for i in xrange(natoms):
xlo = min(xlo,float(x[i]))
ylo = min(ylo,float(y[i]))
zlo = min(zlo,float(z[i]))
xhi = max(xhi,float(x[i]))
yhi = max(yhi,float(y[i]))
zhi = max(zhi,float(z[i]))
boxlo = [xlo-DELTA,ylo-DELTA,zlo-DELTA]
boxhi = [xhi+DELTA,yhi+DELTA,zhi+DELTA]
# ----------------------------------------
# create LAMMPS atom types for each unique Tinker per-type mass
# NOTE: maybe should assign LAMMPS types in a different way,
# e.g. one LAMMPS type for each used Tinker type
# ----------------------------------------
# ntypes = # of LAMMPS atoms types = unique Tinker masses
# lmptype = which LAMMPS type for each atom (1 to Ntypes)
# lmpmass = list of per-type masses
# ttype = list of Tinker types for each atom (1 to prm.ntypes)
# tink2lmp = mapping of Tinker types to LAMMPS types
natoms = xyz.natoms
ttype = xyz.type
tmasses = prm.masses
ntypes = 0
lmptype = []
lmpmass = []
tink2lmp = {}
for itype in ttype:
if itype not in tink2lmp:
mass = tmasses[itype-1]
if mass not in lmpmass:
ntypes += 1
lmpmass.append(mass)
jtype = ntypes
else: jtype = lmpmass.index(mass) + 1
tink2lmp[itype] = jtype
lmptype.append(tink2lmp[itype])
# ----------------------------------------
# identify molecules from Tinker bond connectivity
# ----------------------------------------
# molID = which molecule each atom is in (1 to Nmol)
# use stack to store IDs of atoms to recursively loop over
natoms = xyz.natoms
id = xyz.id
bonds = xyz.bonds
molID = natoms*[0]
nmol = 0
for i in id:
if molID[i-1] > 0: continue
nmol += 1
molID[i-1] = nmol
stack = [i]
while stack:
j = stack.pop()
for k in bonds[j-1]:
if molID[k-1] == 0:
molID[k-1] = nmol
stack.append(k)
# ----------------------------------------
# create lists of bonds, angles, dihedrals
# ----------------------------------------
# create blist = list of bonds
# avoid double counting by requiring atom1 < atom2
id = xyz.id
type = xyz.type
bonds = xyz.bonds
blist = []
for atom1 in id:
for atom2 in bonds[atom1-1]:
if atom1 < atom2:
blist.append((atom1,atom2))
# create alist = list of angles
# generate topology by double loop over bonds of center atom2
# avoid double counting by requiring atom1 < atom3
id = xyz.id
type = xyz.type
bonds = xyz.bonds
alist = []
for atom2 in id:
for atom1 in bonds[atom2-1]:
for atom3 in bonds[atom2-1]:
if atom3 == atom1: continue
if atom1 < atom3:
alist.append((atom1,atom2,atom3))
# create dlist = list of dihedrals
# generate topology via triple loop over neighbors of dihedral atom2
# double loop over bonds of atom2
# additional loop over bonds of atom3
# avoid double counting by requiring atom1 < atom3
id = xyz.id
type = xyz.type
bonds = xyz.bonds
dlist = []
for atom2 in id:
for atom1 in bonds[atom2-1]:
for atom3 in bonds[atom2-1]:
if atom3 == atom1: continue
for atom4 in bonds[atom3-1]:
if atom4 == atom2 or atom4 == atom1: continue
if atom1 < atom3:
dlist.append((atom1,atom2,atom3,atom4))
# ----------------------------------------
# create lists of bond/angle/dihedral types
# ----------------------------------------
# generate btype = LAMMPS type of each bond
# generate bparams = LAMMPS params for each bond type
# flags[i] = which LAMMPS bond type (1-N) the Ith Tinker PRM file bond is
# 0 = none
# convert prm.bondparams to a dictionary for efficient searching
# key = (class1,class2)
# value = (M,params) where M is index into prm.bondparams
id = xyz.id
type = xyz.type
classes = prm.classes
bdict = {}
for m,params in enumerate(prm.bondparams):
bdict[(params[0],params[1])] = (m,params)
flags = len(prm.bondparams)*[0]
btype = []
bparams = []
for atom1,atom2 in blist:
type1 = type[atom1-1]
type2 = type[atom2-1]
c1 = classes[type1-1]
c2 = classes[type2-1]
if (c1,c2) in bdict: m,params = bdict[(c1,c2)]
elif (c2,c1) in bdict: m,params = bdict[(c2,c1)]
else:
print "Bond not found",atom1,atom2,c1,c2
sys.exit()
if not flags[m]:
v1,v2,v3,v4 = params[2:]
bparams.append((v1,v2,v3,v4))
flags[m] = len(bparams)
btype.append(flags[m])
# generate atype = LAMMPS type of each angle
# generate aparams = LAMMPS params for each angle type
# generate baparams = LAMMPS bond-angle params for each angle type
# flags[i] = which LAMMPS angle type (1-N) the Tinker FF file angle I is
# 0 = none
# Tinker FF file angle entries can have 1, 2, or 3 options
# noptions = total # of Tinker FF file entries with options included
# convert prm.angleparams to a dictionary for efficient searching
# key = (class1,class2)
# value = (M,params) where M is index into prm.angleparams
id = xyz.id
type = xyz.type
classes = prm.classes
adict = {}
noptions = 0
for m,params in enumerate(prm.angleparams):
adict[(params[0],params[1],params[2])] = (noptions,params)
n = len(params[3])
noptions += n
flags = noptions*[0]
#baflags = len(baprm)*[0]
atype = []
aparams = []
baparams = []
#DEBUG
opcount = 0
for atom1,atom2,atom3 in alist:
type1 = type[atom1-1]
type2 = type[atom2-1]
type3 = type[atom3-1]
c1 = classes[type1-1]
c2 = classes[type2-1]
c3 = classes[type3-1]
if (c1,c2,c3) in adict or (c3,c2,c1) in adict:
if (c1,c2,c3) in adict: m,params = adict[(c1,c2,c3)]
if (c3,c2,c1) in adict: m,params = adict[(c3,c2,c1)]
# params is a sequence of 1 or 2 or 3 options
# which = which of 1,2,3 options this atom triplet matches
# for which = 2 or 3, increment m to index correct position in flags
# how match is determined:
# if 2 options:
# require atom2 have 3 bond partners, including atom1 and atom3
# option 1 if additional bond is not to an H atom
# option 2 if additional bond is to an H atom
# if 3 options:
# require atom2 have 4 bond partners, including atom1 and atom3
# option 1 if neither of 2 additional bonds is to an H atom
# option 2 if one of 2 additional bonds is to an H atom
# option 3 if both of 2 additional bonds is to an H atom
# DEBUG
debugflag = 0
if len(params[3]) == 1:
which = 1
elif len(params[3]) == 2:
nbonds,hcount = xyz.angle_hbond_count(atom1,atom2,atom3,lmptype,lmpmass)
if nbonds != 3:
print "Center angle atom has wrong bond count"
print " angle atom IDs:",atom1,atom2,atom3
print " angle atom classes:",c1,c2,c3
print " Tinker FF file param options:",len(params[3])
print " Nbonds and hydrogen count:",nbonds,hcount
#sys.exit() // NOTE: allow this for now
if hcount == 0: which = 1
elif hcount == 1:
which = 2
m += 1
print "3-bond angle"
print " angle atom IDs:",atom1,atom2,atom3
print " angle atom classes:",c1,c2,c3
print " Tinker FF file param options:",len(params[3])
print " Nbonds and hydrogen count:",nbonds,hcount
print " which:",which,m
# DEBUG
debugflag = 1
opcount += 1
elif len(params[3]) == 3:
nbonds,hcount = xyz.angle_hbond_count(atom1,atom2,atom3,lmptype,lmpmass)
if nbonds != 4:
print "Center angle atom has wrong bond count"
print " angle atom IDs:",atom1,atom2,atom3
print " angle atom classes:",c1,c2,c3
print " Tinker FF file param options:",len(params[3])
print " Nbonds and hydrogen count:",nbonds,hcount
#sys.exit() // NOTE: allow this for now
if hcount == 0: which = 1
elif hcount == 1:
which = 2
m += 1
elif hcount == 2:
which = 3
m += 2
print "4-bond angle"
print " angle atom IDs:",atom1,atom2,atom3
print " angle atom classes:",c1,c2,c3
print " Tinker FF file param options:",len(params[3])
print " Nbonds and hydrogen count:",nbonds,hcount
print " which:",which,m
# DEBUG
debugflag = 1
opcount += 1
else:
print "Angle not found",atom1,atom2,atom3,c1,c2,c3
sys.exit()
if not flags[m]:
pflag,v1,v2,v3,v4,v5,v6 = params[3][which-1]
# DEBUG single line
if debugflag: pflag = 2
aparams.append((pflag,v1,v2,v3,v4,v5,v6))
flags[m] = len(aparams)
atype.append(flags[m])
print "OPTION angles",opcount
# NOTE: baparams may need to be flipped if match is 3,2,1 instead of 1,2,3
# NOTE: mismatch between angle and bondangle params may not be handled right
# should be a new LAMMPS type if either angle or bondangle params do not match?
#for m,params in enumerate(baprm):
# c1,c2,c3,v1,v2,v3,v4 = params
# if (c1 == class1 and c2 == class2 and c3 == class3) or \
# (c1 == class3 and c2 == class2 and c3 == class1):
# found += 1
# if baflags[m]:
# continue
# #atype.append(baflags[m])
# else:
# baparams.append((v1,v2,v3,v4))
# baflags[m] = len(baparams)
# #atype.append(baflags[m])
# break
# if found != 1: print "Not found",atom1,atom2,atom3,class1,class2,class3
# generate dtype = LAMMPS type of each dihedral
# generate dparams = LAMMPS params for each dihedral type
# flags[i] = which LAMMPS dihedral type (1-N) the Tinker FF file dihedral I is
# 0 = none
# convert prm.torsionparams to a dictionary for efficient searching
# key = (class1,class2)
# value = (M,params) where M is index into prm.torsionparams
id = xyz.id
type = xyz.type
classes = prm.classes
ddict = {}
for m,params in enumerate(prm.torsionparams):
ddict[(params[0],params[1],params[2],params[3])] = (m,params)
flags = len(prm.torsionparams)*[0]
dtype = []
dparams = []
for atom1,atom2,atom3,atom4 in dlist:
type1 = type[atom1-1]
type2 = type[atom2-1]
type3 = type[atom3-1]
type4 = type[atom4-1]
c1 = classes[type1-1]
c2 = classes[type2-1]
c3 = classes[type3-1]
c4 = classes[type4-1]
if (c1,c2,c3,c4) in ddict: m,params = ddict[(c1,c2,c3,c4)]
elif (c4,c3,c2,c1) in ddict: m,params = ddict[(c4,c3,c2,c1)]
else:
print "Dihedral not found",atom1,atom2,atom3,atom4,c1,c2,c3,c4
sys.exit()
if not flags[m]:
v1,v2,v3,v4,v5,v6,v7,v8,v9 = params[4:]
dparams.append((v1,v2,v3,v4,v5,v6,v7,v8,v9))
flags[m] = len(dparams)
dtype.append(flags[m])
# ----------------------------------------
# assign each atom to a Tinker group
# NOTE: doing this inside LAMMPS now
# comment out unless need to test
# ----------------------------------------
# ngroup = # of groups
# tgroup[i] = groupID (1 to Ngroups) for each atom
# use stack to store IDs of atoms to recursively loop over
# do not set tgroup for an atom if already assigned to a group
# only add atoms J (bonded to M) to stack
# whose Tinker type is in polgroup list for atom M's Tinker type
#natoms = xyz.natoms
#id = xyz.id
#bonds = xyz.bonds
#ttype = xyz.type
#polgroup = prm.polgroup
#tgroup = natoms*[0]
#ngroups = 0
#for i in id:
# if tgroup[i-1] > 0: continue
#
# ngroups += 1
# groupID = ngroups
# stack = [i]
# while stack:
# m = stack.pop()
# if tgroup[m-1] > 0: continue
# tgroup[m-1] = groupID
# for j in bonds[m-1]:
# if tgroup[j-1] > 0: continue
# if ttype[j-1] not in polgroup[ttype[m-1]-1]: continue
# stack.append(j)
# ----------------------------------------
# write LAMMPS data file via Pizza.py data class
# ----------------------------------------
d = data()
natoms = xyz.natoms
id = xyz.id
x = xyz.x
y = xyz.y
z = xyz.z
ttype = xyz.type
nbonds = len(blist)
nangles = len(alist)
ndihedrals = len(dlist)
# data file header values
d.title = "LAMMPS data file created from Tinker %s and %s files\n" % \
(xyzfile,prmfile)
d.headers["atoms"] = natoms
d.headers["atom types"] = ntypes
d.headers["xlo xhi"] = (boxlo[0],boxhi[0])
d.headers["ylo yhi"] = (boxlo[1],boxhi[1])
d.headers["zlo zhi"] = (boxlo[2],boxhi[2])
# data file sections
lines = []
for i,mass in enumerate(lmpmass):
line = "%d %s" % (i+1,mass)
lines.append(line+'\n')
d.sections["Masses"] = lines
lines = []
for i,one in enumerate(id):
line = "%d %d %d %g %s %s %s" % (one,molID[i],lmptype[i],0.0,x[i],y[i],z[i])
lines.append(line+'\n')
d.sections["Atoms"] = lines
lines = []
for i,one in enumerate(ttype):
# comment out inclusion of Tinker group, now done by LAMMPS
#line = "%d %d %d" % (id[i],one,tgroup[i])
line = "%d %d" % (id[i],one)
lines.append(line+'\n')
d.sections["Tinker Types"] = lines
if nbonds:
d.headers["bonds"] = len(blist)
d.headers["bond types"] = len(bparams)
lines = []
for i,one in enumerate(bparams):
strone = [str(single) for single in one]
line = "%d %s" % (i+1,' '.join(strone))
lines.append(line+'\n')
d.sections["Bond Coeffs"] = lines
lines = []
for i,one in enumerate(blist):
line = "%d %d %d %d" % (i+1,btype[i],one[0],one[1])
lines.append(line+'\n')
d.sections["Bonds"] = lines
if nangles:
d.headers["angles"] = len(alist)
d.headers["angle types"] = len(aparams)
lines = []
for i,one in enumerate(aparams):
strone = [str(single) for single in one]
line = "%d %s" % (i+1,' '.join(strone))
lines.append(line+'\n')
d.sections["Angle Coeffs"] = lines
#lines = []
#for i,one in enumerate(aparams):
# line = "%d %g %g %g" % (i+1,0.0,0.0,0.0)
# lines.append(line+'\n')
#d.sections["BondBond Coeffs"] = lines
#lines = []
#for i,one in enumerate(aparams):
# line = "%d %g %g %g %g" % (i+1,0.0,0.0,0.0,0.0)
# lines.append(line+'\n')
# d.sections["BondAngle Coeffs"] = lines
lines = []
for i,one in enumerate(alist):
line = "%d %d %d %d %d" % (i+1,atype[i],one[0],one[1],one[2])
lines.append(line+'\n')
d.sections["Angles"] = lines
if ndihedrals:
d.headers["dihedrals"] = len(dlist)
d.headers["dihedral types"] = len(dparams)
lines = []
for i,one in enumerate(dparams):
line = "%d %s" % (i+1,' '.join(one))
lines.append(line+'\n')
d.sections["Dihedral Coeffs"] = lines
lines = []
for i,one in enumerate(dlist):
line = "%d %d %d %d %d %d" % (i+1,dtype[i],one[0],one[1],one[2],one[3])
lines.append(line+'\n')
d.sections["Dihedrals"] = lines
d.write(datafile)
# print stats to screen
print "Natoms =",natoms
print "Ntypes =",ntypes
print "Tinker XYZ types =",len(tink2lmp)
print "Tinker PRM types =",prm.ntypes
#print "Tinker groups =",ngroups
print "Nmol =",nmol
print "Nbonds =",len(blist)
print "Nangles =",len(alist)
print "Ndihedrals =",len(dlist)
print "Nbondtypes =",len(bparams)
print "Nangletypes =",len(aparams)
print "Ndihedraltypes =",len(dparams)