sync with GH
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15634 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -105,8 +105,8 @@ web site.
|
|||||||
|
|
||||||
If you uncomment the "dump image"_dump_image.html line(s) in the input
|
If you uncomment the "dump image"_dump_image.html line(s) in the input
|
||||||
script a series of JPG images will be produced by the run (assuming
|
script a series of JPG images will be produced by the run (assuming
|
||||||
you built LAMMPS with JPG support; see "Section start
|
you built LAMMPS with JPG support; see "Section
|
||||||
2.2"_Section_start.html for details). These can be viewed
|
2.2"_Section_start.html#start_2 for details). These can be viewed
|
||||||
individually or turned into a movie or animated by tools like
|
individually or turned into a movie or animated by tools like
|
||||||
ImageMagick or QuickTime or various Windows-based tools. See the
|
ImageMagick or QuickTime or various Windows-based tools. See the
|
||||||
"dump image"_dump_image.html doc page for more details. E.g. this
|
"dump image"_dump_image.html doc page for more details. E.g. this
|
||||||
@ -136,5 +136,5 @@ The USER directory has a large number of sub-directories which
|
|||||||
correspond by name to a USER package. They contain scripts that
|
correspond by name to a USER package. They contain scripts that
|
||||||
illustrate how to use the command(s) provided in that package. Many
|
illustrate how to use the command(s) provided in that package. Many
|
||||||
of the sub-directories have their own README files which give further
|
of the sub-directories have their own README files which give further
|
||||||
instructions. See the "Section packages"_Section_packages.html doc
|
instructions. See the "Section 4"_Section_packages.html doc
|
||||||
page for more info on specific USER packages.
|
page for more info on specific USER packages.
|
||||||
|
|||||||
@ -71,16 +71,16 @@ Package, Description, Author(s), Doc page, Example, Library
|
|||||||
"COMPRESS"_#COMPRESS, I/O compression, Axel Kohlmeyer (Temple U), "dump */gz"_dump.html, -, -
|
"COMPRESS"_#COMPRESS, I/O compression, Axel Kohlmeyer (Temple U), "dump */gz"_dump.html, -, -
|
||||||
"CORESHELL"_#CORESHELL, adiabatic core/shell model, Hendrik Heenen (Technical U of Munich), "Section 6.6.25"_Section_howto.html#howto_25, coreshell, -
|
"CORESHELL"_#CORESHELL, adiabatic core/shell model, Hendrik Heenen (Technical U of Munich), "Section 6.6.25"_Section_howto.html#howto_25, coreshell, -
|
||||||
"DIPOLE"_#DIPOLE, point dipole particles, -, "pair_style dipole/cut"_pair_dipole.html, dipole, -
|
"DIPOLE"_#DIPOLE, point dipole particles, -, "pair_style dipole/cut"_pair_dipole.html, dipole, -
|
||||||
"GPU"_#GPU, GPU-enabled styles, Mike Brown (ORNL), "Section accelerate"_accelerate_gpu.html, gpu, lib/gpu
|
"GPU"_#GPU, GPU-enabled styles, Mike Brown (ORNL), "Section 5.3.1"_accelerate_gpu.html, gpu, lib/gpu
|
||||||
"GRANULAR"_#GRANULAR, granular systems, -, "Section 6.6.6"_Section_howto.html#howto_6, pour, -
|
"GRANULAR"_#GRANULAR, granular systems, -, "Section 6.6.6"_Section_howto.html#howto_6, pour, -
|
||||||
"KIM"_#KIM, openKIM potentials, Smirichinski & Elliot & Tadmor (3), "pair_style kim"_pair_kim.html, kim, KIM
|
"KIM"_#KIM, openKIM potentials, Smirichinski & Elliot & Tadmor (3), "pair_style kim"_pair_kim.html, kim, KIM
|
||||||
"KOKKOS"_#KOKKOS, Kokkos-enabled styles, Trott & Moore (4), "Section 5"_accelerate_kokkos.html, kokkos, lib/kokkos
|
"KOKKOS"_#KOKKOS, Kokkos-enabled styles, Trott & Moore (4), "Section 5.3.3"_accelerate_kokkos.html, kokkos, lib/kokkos
|
||||||
"KSPACE"_#KSPACE, long-range Coulombic solvers, -, "kspace_style"_kspace_style.html, peptide, -
|
"KSPACE"_#KSPACE, long-range Coulombic solvers, -, "kspace_style"_kspace_style.html, peptide, -
|
||||||
"MANYBODY"_#MANYBODY, many-body potentials, -, "pair_style tersoff"_pair_tersoff.html, shear, -
|
"MANYBODY"_#MANYBODY, many-body potentials, -, "pair_style tersoff"_pair_tersoff.html, shear, -
|
||||||
"MEAM"_#MEAM, modified EAM potential, Greg Wagner (Sandia), "pair_style meam"_pair_meam.html, meam, lib/meam
|
"MEAM"_#MEAM, modified EAM potential, Greg Wagner (Sandia), "pair_style meam"_pair_meam.html, meam, lib/meam
|
||||||
"MC"_#MC, Monte Carlo options, -, "fix gcmc"_fix_gcmc.html, -, -
|
"MC"_#MC, Monte Carlo options, -, "fix gcmc"_fix_gcmc.html, -, -
|
||||||
"MOLECULE"_#MOLECULE, molecular system force fields, -, "Section 6.6.3"_Section_howto.html#howto_3, peptide, -
|
"MOLECULE"_#MOLECULE, molecular system force fields, -, "Section 6.6.3"_Section_howto.html#howto_3, peptide, -
|
||||||
"OPT"_#OPT, optimized pair styles, Fischer & Richie & Natoli (2), "Section accelerate"_accelerate_opt.html, -, -
|
"OPT"_#OPT, optimized pair styles, Fischer & Richie & Natoli (2), "Section 5.3.5"_accelerate_opt.html, -, -
|
||||||
"PERI"_#PERI, Peridynamics models, Mike Parks (Sandia), "pair_style peri"_pair_peri.html, peri, -
|
"PERI"_#PERI, Peridynamics models, Mike Parks (Sandia), "pair_style peri"_pair_peri.html, peri, -
|
||||||
"POEMS"_#POEMS, coupled rigid body motion, Rudra Mukherjee (JPL), "fix poems"_fix_poems.html, rigid, lib/poems
|
"POEMS"_#POEMS, coupled rigid body motion, Rudra Mukherjee (JPL), "fix poems"_fix_poems.html, rigid, lib/poems
|
||||||
"PYTHON"_#PYTHON, embed Python code in an input script, -, "python"_python.html, python, lib/python
|
"PYTHON"_#PYTHON, embed Python code in an input script, -, "python"_python.html, python, lib/python
|
||||||
@ -127,7 +127,6 @@ of the LAMMPS distribution. See the lib/package/README file for info
|
|||||||
on how to build the library. If it is not listed as lib/package, then
|
on how to build the library. If it is not listed as lib/package, then
|
||||||
it is a third-party library not included in the LAMMPS distribution.
|
it is a third-party library not included in the LAMMPS distribution.
|
||||||
See details on all of this below for individual packages.
|
See details on all of this below for individual packages.
|
||||||
p.s.: are we ever going to get commit messages from you? ;-)
|
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
@ -150,7 +149,7 @@ make machine :pre
|
|||||||
|
|
||||||
Make.py -p ^asphere -a machine :pre
|
Make.py -p ^asphere -a machine :pre
|
||||||
|
|
||||||
Supporting info: "Section howto 6.14"_Section_howto.html#howto_14,
|
Supporting info: "Section 6.14"_Section_howto.html#howto_14,
|
||||||
"pair_style gayberne"_pair_gayberne.html, "pair_style
|
"pair_style gayberne"_pair_gayberne.html, "pair_style
|
||||||
resquared"_pair_resquared.html,
|
resquared"_pair_resquared.html,
|
||||||
"doc/PDF/pair_gayberne_extra.pdf"_PDF/pair_gayberne_extra.pdf,
|
"doc/PDF/pair_gayberne_extra.pdf"_PDF/pair_gayberne_extra.pdf,
|
||||||
@ -279,9 +278,8 @@ Contents: Compute and pair styles that implement the adiabatic
|
|||||||
core/shell model for polarizability. The compute temp/cs command
|
core/shell model for polarizability. The compute temp/cs command
|
||||||
measures the temperature of a system with core/shell particles. The
|
measures the temperature of a system with core/shell particles. The
|
||||||
pair styles augment Born, Buckingham, and Lennard-Jones styles with
|
pair styles augment Born, Buckingham, and Lennard-Jones styles with
|
||||||
core/shell capabilities. See "Section howto
|
core/shell capabilities. See "Section 6.26"_Section_howto.html#howto_26
|
||||||
6.26"_Section_howto.html#howto_26 for an overview of how to use the
|
for an overview of how to use the package.
|
||||||
package.
|
|
||||||
|
|
||||||
To install via make or Make.py:
|
To install via make or Make.py:
|
||||||
|
|
||||||
@ -297,8 +295,8 @@ make machine :pre
|
|||||||
|
|
||||||
Make.py -p ^coreshell -a machine :pre
|
Make.py -p ^coreshell -a machine :pre
|
||||||
|
|
||||||
Supporting info: "Section howto
|
Supporting info: "Section 6.26"_Section_howto.html#howto_26,
|
||||||
6.26"_Section_howto.html#howto_26, "compute temp/cs"_compute_temp_cs.html,
|
"compute temp/cs"_compute_temp_cs.html,
|
||||||
"pair_style born/coul/long/cs"_pair_cs.html, "pair_style
|
"pair_style born/coul/long/cs"_pair_cs.html, "pair_style
|
||||||
buck/coul/long/cs"_pair_cs.html, pair_style
|
buck/coul/long/cs"_pair_cs.html, pair_style
|
||||||
lj/cut/coul/long/cs"_pair_lj.html, examples/coreshell
|
lj/cut/coul/long/cs"_pair_lj.html, examples/coreshell
|
||||||
@ -335,7 +333,7 @@ GPU package :link(GPU),h5
|
|||||||
|
|
||||||
Contents: Dozens of pair styles and a version of the PPPM long-range
|
Contents: Dozens of pair styles and a version of the PPPM long-range
|
||||||
Coulombic solver for NVIDIA GPUs. All of them have a "gpu" in their
|
Coulombic solver for NVIDIA GPUs. All of them have a "gpu" in their
|
||||||
style name. "Section accelerate gpu"_accelerate_gpu.html gives
|
style name. "Section 5.3.1"_accelerate_gpu.html gives
|
||||||
details of what hardware and Cuda software is required on your system,
|
details of what hardware and Cuda software is required on your system,
|
||||||
and how to build and use this package. See the KOKKOS package, which
|
and how to build and use this package. See the KOKKOS package, which
|
||||||
also has GPU-enabled styles.
|
also has GPU-enabled styles.
|
||||||
@ -380,10 +378,11 @@ make machine :pre
|
|||||||
|
|
||||||
Make.py -p ^gpu -a machine :pre
|
Make.py -p ^gpu -a machine :pre
|
||||||
|
|
||||||
Supporting info: src/GPU/README, lib/gpu/README, "Section
|
Supporting info: src/GPU/README, lib/gpu/README,
|
||||||
acclerate"_Section_accelerate.html, "Section accelerate
|
"Section 5.3"_Section_accelerate.html#acc_3,
|
||||||
gpu"_accelerate_gpu.html, Pair Styles section of "Section commands
|
"Section 5.3.1"_accelerate_gpu.html,
|
||||||
3.5"_Section_commands.html#cmd_5 for any pair style listed with a (g),
|
Pair Styles section of "Section 3.5"_Section_commands.html#cmd_5
|
||||||
|
for any pair style listed with a (g),
|
||||||
"kspace_style"_kspace_style.html, "package gpu"_package.html,
|
"kspace_style"_kspace_style.html, "package gpu"_package.html,
|
||||||
examples/accelerate, bench/FERMI, bench/KEPLER
|
examples/accelerate, bench/FERMI, bench/KEPLER
|
||||||
|
|
||||||
@ -409,7 +408,7 @@ make machine :pre
|
|||||||
|
|
||||||
Make.py -p ^granular -a machine :pre
|
Make.py -p ^granular -a machine :pre
|
||||||
|
|
||||||
Supporting info: "Section howto 6.6"_Section_howto.html#howto_6, "fix
|
Supporting info: "Section 6.6"_Section_howto.html#howto_6, "fix
|
||||||
pour"_fix_pour.html, "fix wall/gran"_fix_wall_gran.html, "pair_style
|
pour"_fix_pour.html, "fix wall/gran"_fix_wall_gran.html, "pair_style
|
||||||
gran/hooke"_pair_gran.html, "pair_style
|
gran/hooke"_pair_gran.html, "pair_style
|
||||||
gran/hertz/history"_pair_gran.html, examples/pour, bench/in.chute
|
gran/hertz/history"_pair_gran.html, examples/pour, bench/in.chute
|
||||||
@ -453,7 +452,7 @@ Contents: Dozens of atom, pair, bond, angle, dihedral, improper styles
|
|||||||
which run with the Kokkos library to provide optimization for
|
which run with the Kokkos library to provide optimization for
|
||||||
multicore CPUs (via OpenMP), NVIDIA GPUs, or the Intel Xeon Phi (in
|
multicore CPUs (via OpenMP), NVIDIA GPUs, or the Intel Xeon Phi (in
|
||||||
native mode). All of them have a "kk" in their style name. "Section
|
native mode). All of them have a "kk" in their style name. "Section
|
||||||
accelerate kokkos"_accelerate_kokkos.html gives details of what
|
5.3.3"_accelerate_kokkos.html gives details of what
|
||||||
hardware and software is required on your system, and how to build and
|
hardware and software is required on your system, and how to build and
|
||||||
use this package. See the GPU, OPT, USER-INTEL, USER-OMP packages,
|
use this package. See the GPU, OPT, USER-INTEL, USER-OMP packages,
|
||||||
which also provide optimizations for the same range of hardware.
|
which also provide optimizations for the same range of hardware.
|
||||||
@ -473,9 +472,8 @@ the KOKKOS_ARCH setting in Makefile.kokkos_cuda), Or, as illustrated
|
|||||||
below, you can use the Make.py script with its "-kokkos" option to
|
below, you can use the Make.py script with its "-kokkos" option to
|
||||||
choose which hardware to build for. Type "python src/Make.py -h
|
choose which hardware to build for. Type "python src/Make.py -h
|
||||||
-kokkos" to see the details. If these methods do not work on your
|
-kokkos" to see the details. If these methods do not work on your
|
||||||
system, you will need to read the "Section accelerate
|
system, you will need to read the "Section 5.3.3"_accelerate_kokkos.html
|
||||||
kokkos"_accelerate_kokkos.html doc page for details of what
|
doc page for details of what Makefile.machine settings are needed.
|
||||||
Makefile.machine settings are needed.
|
|
||||||
|
|
||||||
To install via make or Make.py for each of 3 hardware options:
|
To install via make or Make.py for each of 3 hardware options:
|
||||||
|
|
||||||
@ -495,11 +493,11 @@ make machine :pre
|
|||||||
|
|
||||||
Make.py -p ^kokkos -a machine :pre
|
Make.py -p ^kokkos -a machine :pre
|
||||||
|
|
||||||
Supporting info: src/KOKKOS/README, lib/kokkos/README, "Section
|
Supporting info: src/KOKKOS/README, lib/kokkos/README,
|
||||||
acclerate"_Section_accelerate.html, "Section accelerate
|
"Section 5.3"_Section_accelerate.html#acc_3,
|
||||||
kokkos"_accelerate_kokkos.html, Pair Styles section of "Section
|
"Section 5.3.3"_accelerate_kokkos.html,
|
||||||
commands 3.5"_Section_commands.html#cmd_5 for any pair style listed
|
Pair Styles section of "Section 3.5"_Section_commands.html#cmd_5
|
||||||
with a (k), "package kokkos"_package.html,
|
for any pair style listed with a (k), "package kokkos"_package.html,
|
||||||
examples/accelerate, bench/FERMI, bench/KEPLER
|
examples/accelerate, bench/FERMI, bench/KEPLER
|
||||||
|
|
||||||
:line
|
:line
|
||||||
@ -514,7 +512,7 @@ particle-mesh (PPPM), and multilevel summation method (MSM) solvers.
|
|||||||
Building with the KSPACE package requires a 1d FFT library be present
|
Building with the KSPACE package requires a 1d FFT library be present
|
||||||
on your system for use by the PPPM solvers. This can be the KISS FFT
|
on your system for use by the PPPM solvers. This can be the KISS FFT
|
||||||
library provided with LAMMPS, or 3rd party libraries like FFTW or a
|
library provided with LAMMPS, or 3rd party libraries like FFTW or a
|
||||||
vendor-supplied FFT library. See step 6 of "Section start
|
vendor-supplied FFT library. See step 6 of "Section
|
||||||
2.2.2"_Section_start.html#start_2_2 of the manual for details of how
|
2.2.2"_Section_start.html#start_2_2 of the manual for details of how
|
||||||
to select different FFT options in your machine Makefile. The Make.py
|
to select different FFT options in your machine Makefile. The Make.py
|
||||||
tool has an "-fft" option which can insert these settings into your
|
tool has an "-fft" option which can insert these settings into your
|
||||||
@ -536,12 +534,13 @@ make machine :pre
|
|||||||
Make.py -p ^kspace -a machine :pre
|
Make.py -p ^kspace -a machine :pre
|
||||||
|
|
||||||
Supporting info: "kspace_style"_kspace_style.html,
|
Supporting info: "kspace_style"_kspace_style.html,
|
||||||
"doc/PDF/kspace.pdf"_PDF/kspace.pdf, "Section howto
|
"doc/PDF/kspace.pdf"_PDF/kspace.pdf,
|
||||||
6.7"_Section_howto.html#howto_7, "Section howto
|
"Section 6.7"_Section_howto.html#howto_7,
|
||||||
6.8"_Section_howto.html#howto_8, "Section howto
|
"Section 6.8"_Section_howto.html#howto_8,
|
||||||
6.9"_Section_howto.html#howto_9, "pair_style coul"_pair_coul.html,
|
"Section 6.9"_Section_howto.html#howto_9,
|
||||||
other pair style command doc pages which have "long" or "msm" in their
|
"pair_style coul"_pair_coul.html, other pair style command doc pages
|
||||||
style name, examples/peptide, bench/in.rhodo
|
which have "long" or "msm" in their style name,
|
||||||
|
examples/peptide, bench/in.rhodo
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
@ -568,7 +567,7 @@ Make.py -p ^manybody -a machine :pre
|
|||||||
|
|
||||||
Supporting info:
|
Supporting info:
|
||||||
|
|
||||||
Examples: Pair Styles section of "Section commands
|
Examples: Pair Styles section of "Section
|
||||||
3.5"_Section_commands.html#cmd_5, examples/comb, examples/eim,
|
3.5"_Section_commands.html#cmd_5, examples/comb, examples/eim,
|
||||||
examples/nb3d, examples/vashishta
|
examples/nb3d, examples/vashishta
|
||||||
|
|
||||||
@ -700,9 +699,9 @@ Supporting info:"atom_style"_atom_style.html,
|
|||||||
"dihedral_style"_dihedral_style.html,
|
"dihedral_style"_dihedral_style.html,
|
||||||
"improper_style"_improper_style.html, "pair_style
|
"improper_style"_improper_style.html, "pair_style
|
||||||
hbond/dreiding/lj"_pair_hbond_dreiding.html, "pair_style
|
hbond/dreiding/lj"_pair_hbond_dreiding.html, "pair_style
|
||||||
lj/charmm/coul/charmm"_pair_charmm.html, "Section howto
|
lj/charmm/coul/charmm"_pair_charmm.html,
|
||||||
6.3"_Section_howto.html#howto_3, examples/micelle, examples/peptide,
|
"Section 6.3"_Section_howto.html#howto_3,
|
||||||
bench/in.chain, bench/in.rhodo
|
examples/micelle, examples/peptide, bench/in.chain, bench/in.rhodo
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
@ -738,7 +737,7 @@ OPT package :link(OPT),h5
|
|||||||
Contents: A handful of pair styles with an "opt" in their style name
|
Contents: A handful of pair styles with an "opt" in their style name
|
||||||
which are optimized for improved CPU performance on single or multiple
|
which are optimized for improved CPU performance on single or multiple
|
||||||
cores. These include EAM, LJ, CHARMM, and Morse potentials. "Section
|
cores. These include EAM, LJ, CHARMM, and Morse potentials. "Section
|
||||||
accelerate opt"_accelerate_opt.html gives details of how to build and
|
5.3.5"_accelerate_opt.html gives details of how to build and
|
||||||
use this package. See the KOKKOS, USER-INTEL, and USER-OMP packages,
|
use this package. See the KOKKOS, USER-INTEL, and USER-OMP packages,
|
||||||
which also have styles optimized for CPU performance.
|
which also have styles optimized for CPU performance.
|
||||||
|
|
||||||
@ -763,10 +762,10 @@ make machine :pre
|
|||||||
|
|
||||||
Make.py -p ^opt -a machine :pre
|
Make.py -p ^opt -a machine :pre
|
||||||
|
|
||||||
Supporting info: "Section acclerate"_Section_accelerate.html, "Section
|
Supporting info: "Section 5.3"_Section_accelerate.html#acc_3,
|
||||||
accelerate opt"_accelerate_opt.html, Pair Styles section of "Section
|
"Section 5.3.5"_accelerate_opt.html, Pair Styles section of
|
||||||
commands 3.5"_Section_commands.html#cmd_5 for any pair style listed
|
"Section 3.5"_Section_commands.html#cmd_5 for any pair style
|
||||||
with an (o), examples/accelerate, bench/KEPLER
|
listed with an (t), examples/accelerate, bench/KEPLER
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
@ -845,14 +844,14 @@ PYTHON package :link(PYTHON),h5
|
|||||||
|
|
||||||
Contents: A "python"_python.html command which allow you to execute
|
Contents: A "python"_python.html command which allow you to execute
|
||||||
Python code from a LAMMPS input script. The code can be in a separate
|
Python code from a LAMMPS input script. The code can be in a separate
|
||||||
file or embedded in the input script itself. See "Section python
|
file or embedded in the input script itself. See "Section
|
||||||
11.2"_Section_python.html" for an overview of using Python from
|
11.2"_Section_python.html#py-2 for an overview of using Python from
|
||||||
LAMMPS and for other ways to use LAMMPS and Python together.
|
LAMMPS and for other ways to use LAMMPS and Python together.
|
||||||
|
|
||||||
Building with the PYTHON package assumes you have a Python shared
|
Building with the PYTHON package assumes you have a Python shared
|
||||||
library available on your system, which needs to be a Python 2
|
library available on your system, which needs to be a Python 2
|
||||||
version, 2.6 or later. Python 3 is not supported. The build uses the
|
version, 2.6 or later. Python 3 is not yet supported. The build uses
|
||||||
contents of the lib/python/Makefile.lammps file to find all the Python
|
the contents of the lib/python/Makefile.lammps file to find all the Python
|
||||||
files required in the build/link process. See the lib/python/README
|
files required in the build/link process. See the lib/python/README
|
||||||
file if the settings in that file do not work on your system. Note
|
file if the settings in that file do not work on your system. Note
|
||||||
that the Make.py script has a "-python" option to allow an alternate
|
that the Make.py script has a "-python" option to allow an alternate
|
||||||
@ -950,7 +949,7 @@ REPLICA package :link(REPLICA),h5
|
|||||||
Contents: A collection of multi-replica methods that are used by
|
Contents: A collection of multi-replica methods that are used by
|
||||||
invoking multiple instances (replicas) of LAMMPS
|
invoking multiple instances (replicas) of LAMMPS
|
||||||
simulations. Communication between individual replicas is performed in
|
simulations. Communication between individual replicas is performed in
|
||||||
different ways by the different methods. See "Section howto
|
different ways by the different methods. See "Section
|
||||||
6.5"_Section_howto.html#howto_5 for an overview of how to run
|
6.5"_Section_howto.html#howto_5 for an overview of how to run
|
||||||
multi-replica simulations in LAMMPS. Multi-replica methods included
|
multi-replica simulations in LAMMPS. Multi-replica methods included
|
||||||
in the package are nudged elastic band (NEB), parallel replica
|
in the package are nudged elastic band (NEB), parallel replica
|
||||||
@ -973,7 +972,7 @@ make machine :pre
|
|||||||
|
|
||||||
Make.py -p ^replica -a machine :pre
|
Make.py -p ^replica -a machine :pre
|
||||||
|
|
||||||
Supporting info: "Section howto 6.5"_Section_howto.html#howto_5,
|
Supporting info: "Section 6.5"_Section_howto.html#howto_5,
|
||||||
"neb"_neb.html, "prd"_prd.html, "tad"_tad.html, "temper"_temper.html,
|
"neb"_neb.html, "prd"_prd.html, "tad"_tad.html, "temper"_temper.html,
|
||||||
"run_style verlet/split"_run_style.html, examples/neb, examples/prd,
|
"run_style verlet/split"_run_style.html, examples/neb, examples/prd,
|
||||||
examples/tad
|
examples/tad
|
||||||
@ -1148,13 +1147,13 @@ Package, Description, Author(s), Doc page, Example, Pic/movie, Library
|
|||||||
"USER-EFF"_#USER-EFF, electron force field, Andres Jaramillo-Botero (Caltech), "pair_style eff/cut"_pair_eff.html, USER/eff, "eff"_eff, -
|
"USER-EFF"_#USER-EFF, electron force field, Andres Jaramillo-Botero (Caltech), "pair_style eff/cut"_pair_eff.html, USER/eff, "eff"_eff, -
|
||||||
"USER-FEP"_#USER-FEP, free energy perturbation, Agilio Padua (U Blaise Pascal Clermont-Ferrand), "compute fep"_compute_fep.html, USER/fep, -, -
|
"USER-FEP"_#USER-FEP, free energy perturbation, Agilio Padua (U Blaise Pascal Clermont-Ferrand), "compute fep"_compute_fep.html, USER/fep, -, -
|
||||||
"USER-H5MD"_#USER-H5MD, dump output via HDF5, Pierre de Buyl (KU Leuven), "dump h5md"_dump_h5md.html, -, -, lib/h5md
|
"USER-H5MD"_#USER-H5MD, dump output via HDF5, Pierre de Buyl (KU Leuven), "dump h5md"_dump_h5md.html, -, -, lib/h5md
|
||||||
"USER-INTEL"_#USER-INTEL, Vectorized CPU and Intel(R) coprocessor styles, W. Michael Brown (Intel), "Section accelerate"_accelerate_intel.html, examples/intel, -, -
|
"USER-INTEL"_#USER-INTEL, Vectorized CPU and Intel(R) coprocessor styles, W. Michael Brown (Intel), "Section 5.3.2"_accelerate_intel.html, examples/intel, -, -
|
||||||
"USER-LB"_#USER-LB, Lattice Boltzmann fluid, Colin Denniston (U Western Ontario), "fix lb/fluid"_fix_lb_fluid.html, USER/lb, -, -
|
"USER-LB"_#USER-LB, Lattice Boltzmann fluid, Colin Denniston (U Western Ontario), "fix lb/fluid"_fix_lb_fluid.html, USER/lb, -, -
|
||||||
"USER-MGPT"_#USER-MGPT, fast MGPT multi-ion potentials, Tomas Oppelstrup & John Moriarty (LLNL), "pair_style mgpt"_pair_mgpt.html, USER/mgpt, -, -
|
"USER-MGPT"_#USER-MGPT, fast MGPT multi-ion potentials, Tomas Oppelstrup & John Moriarty (LLNL), "pair_style mgpt"_pair_mgpt.html, USER/mgpt, -, -
|
||||||
"USER-MISC"_#USER-MISC, single-file contributions, USER-MISC/README, USER-MISC/README, -, -, -
|
"USER-MISC"_#USER-MISC, single-file contributions, USER-MISC/README, USER-MISC/README, -, -, -
|
||||||
"USER-MANIFOLD"_#USER-MANIFOLD, motion on 2d surface, Stefan Paquay (Eindhoven U of Technology), "fix manifoldforce"_fix_manifoldforce.html, USER/manifold, "manifold"_manifold, -
|
"USER-MANIFOLD"_#USER-MANIFOLD, motion on 2d surface, Stefan Paquay (Eindhoven U of Technology), "fix manifoldforce"_fix_manifoldforce.html, USER/manifold, "manifold"_manifold, -
|
||||||
"USER-MOLFILE"_#USER-MOLFILE, "VMD"_VMD molfile plug-ins, Axel Kohlmeyer (Temple U), "dump molfile"_dump_molfile.html, -, -, VMD-MOLFILE
|
"USER-MOLFILE"_#USER-MOLFILE, "VMD"_VMD molfile plug-ins, Axel Kohlmeyer (Temple U), "dump molfile"_dump_molfile.html, -, -, VMD-MOLFILE
|
||||||
"USER-OMP"_#USER-OMP, OpenMP threaded styles, Axel Kohlmeyer (Temple U), "Section accelerate"_accelerate_omp.html, -, -, -
|
"USER-OMP"_#USER-OMP, OpenMP threaded styles, Axel Kohlmeyer (Temple U), "Section 5.3.4"_accelerate_omp.html, -, -, -
|
||||||
"USER-PHONON"_#USER-PHONON, phonon dynamical matrix, Ling-Ti Kong (Shanghai Jiao Tong U), "fix phonon"_fix_phonon.html, USER/phonon, -, -
|
"USER-PHONON"_#USER-PHONON, phonon dynamical matrix, Ling-Ti Kong (Shanghai Jiao Tong U), "fix phonon"_fix_phonon.html, USER/phonon, -, -
|
||||||
"USER-QMMM"_#USER-QMMM, QM/MM coupling, Axel Kohlmeyer (Temple U), "fix qmmm"_fix_qmmm.html, USER/qmmm, -, lib/qmmm
|
"USER-QMMM"_#USER-QMMM, QM/MM coupling, Axel Kohlmeyer (Temple U), "fix qmmm"_fix_qmmm.html, USER/qmmm, -, lib/qmmm
|
||||||
"USER-QTB"_#USER-QTB, quantum nuclear effects, Yuan Shen (Stanford), "fix qtb"_fix_qtb.html "fix qbmsst"_fix_qbmsst.html, qtb, -, -
|
"USER-QTB"_#USER-QTB, quantum nuclear effects, Yuan Shen (Stanford), "fix qtb"_fix_qtb.html "fix qbmsst"_fix_qbmsst.html, qtb, -, -
|
||||||
@ -1353,12 +1352,12 @@ USER-DRUDE package :link(USER-DRUDE),h5
|
|||||||
|
|
||||||
Contents: This package contains methods for simulating polarizable
|
Contents: This package contains methods for simulating polarizable
|
||||||
systems using thermalized Drude oscillators. It has computes, fixes,
|
systems using thermalized Drude oscillators. It has computes, fixes,
|
||||||
and pair styles for this purpose. See "Section howto
|
and pair styles for this purpose. See "Section
|
||||||
6.27"_Section_howto.html#howto_27 for an overview of how to use the
|
6.27"_Section_howto.html#howto_27 for an overview of how to use the
|
||||||
package. See src/USER-DRUDE/README for additional details. There are
|
package. See src/USER-DRUDE/README for additional details. There are
|
||||||
auxiliary tools for using this package in tools/drude.
|
auxiliary tools for using this package in tools/drude.
|
||||||
|
|
||||||
Supporting info: "Section howto 6.27"_Section_howto.html#howto_27,
|
Supporting info: "Section 6.27"_Section_howto.html#howto_27,
|
||||||
src/USER-DRUDE/README, "fix drude"_fix_drude.html, "fix
|
src/USER-DRUDE/README, "fix drude"_fix_drude.html, "fix
|
||||||
drude/transform/*"_fix_drude_transform.html, "compute
|
drude/transform/*"_fix_drude_transform.html, "compute
|
||||||
temp/drude"_compute_temp_drude.html, "pair thole"_pair_thole.html,
|
temp/drude"_compute_temp_drude.html, "pair thole"_pair_thole.html,
|
||||||
@ -1432,7 +1431,7 @@ USER-INTEL package :link(USER-INTEL),h5
|
|||||||
Contents: Dozens of pair, bond, angle, dihedral, and improper styles
|
Contents: Dozens of pair, bond, angle, dihedral, and improper styles
|
||||||
that are optimized for Intel CPUs and the Intel Xeon Phi (in offload
|
that are optimized for Intel CPUs and the Intel Xeon Phi (in offload
|
||||||
mode). All of them have an "intel" in their style name. "Section
|
mode). All of them have an "intel" in their style name. "Section
|
||||||
accelerate intel"_accelerate_intel.html gives details of what hardware
|
5.3.2"_accelerate_intel.html gives details of what hardware
|
||||||
and compilers are required on your system, and how to build and use
|
and compilers are required on your system, and how to build and use
|
||||||
this package. Also see src/USER-INTEL/README for more details. See
|
this package. Also see src/USER-INTEL/README for more details. See
|
||||||
the KOKKOS, OPT, and USER-OMP packages, which also have CPU and
|
the KOKKOS, OPT, and USER-OMP packages, which also have CPU and
|
||||||
@ -1440,7 +1439,7 @@ Phi-enabled styles.
|
|||||||
|
|
||||||
Supporting info: examples/accelerate, src/USER-INTEL/TEST
|
Supporting info: examples/accelerate, src/USER-INTEL/TEST
|
||||||
|
|
||||||
"Section 5"_Section_accelerate.html#acc_3
|
"Section 5.3"_Section_accelerate.html#acc_3
|
||||||
|
|
||||||
Author: Mike Brown at Intel (michael.w.brown at intel.com). Contact
|
Author: Mike Brown at Intel (michael.w.brown at intel.com). Contact
|
||||||
him directly if you have questions.
|
him directly if you have questions.
|
||||||
@ -1532,7 +1531,7 @@ More information about each feature can be found by reading its doc
|
|||||||
page in the LAMMPS doc directory. The doc page which lists all LAMMPS
|
page in the LAMMPS doc directory. The doc page which lists all LAMMPS
|
||||||
input script commands is as follows:
|
input script commands is as follows:
|
||||||
|
|
||||||
"Section 3"_Section_commands.html#cmd_5
|
"Section 3.5"_Section_commands.html#cmd_5
|
||||||
|
|
||||||
User-contributed features are listed at the bottom of the fix,
|
User-contributed features are listed at the bottom of the fix,
|
||||||
compute, pair, etc sections.
|
compute, pair, etc sections.
|
||||||
@ -1609,7 +1608,7 @@ styles, and fix styles.
|
|||||||
|
|
||||||
See this section of the manual to get started:
|
See this section of the manual to get started:
|
||||||
|
|
||||||
"Section 5"_Section_accelerate.html#acc_3
|
"Section 5.3"_Section_accelerate.html#acc_3
|
||||||
|
|
||||||
The person who created this package is Axel Kohlmeyer at Temple U
|
The person who created this package is Axel Kohlmeyer at Temple U
|
||||||
(akohlmey at gmail.com). Contact him directly if you have questions.
|
(akohlmey at gmail.com). Contact him directly if you have questions.
|
||||||
|
|||||||
@ -51,7 +51,7 @@ of these 5 problems on 1 or 4 cores of Linux desktop. The bench/FERMI
|
|||||||
and bench/KEPLER dirs have input files and scripts and instructions
|
and bench/KEPLER dirs have input files and scripts and instructions
|
||||||
for running the same (or similar) problems using OpenMP or GPU or Xeon
|
for running the same (or similar) problems using OpenMP or GPU or Xeon
|
||||||
Phi acceleration options. See the README files in those dirs and the
|
Phi acceleration options. See the README files in those dirs and the
|
||||||
"Section accelerate"_Section_accelerate.html doc pages for
|
"Section 5.3"_Section_accelerate.html#acc_3 doc pages for
|
||||||
instructions on how to build LAMMPS and run on that kind of hardware.
|
instructions on how to build LAMMPS and run on that kind of hardware.
|
||||||
|
|
||||||
The bench/POTENTIALS directory has input files which correspond to the
|
The bench/POTENTIALS directory has input files which correspond to the
|
||||||
|
|||||||
@ -21,7 +21,6 @@ experienced users.
|
|||||||
2.8 "Screen output"_#start_8
|
2.8 "Screen output"_#start_8
|
||||||
2.9 "Tips for users of previous versions"_#start_9 :all(b)
|
2.9 "Tips for users of previous versions"_#start_9 :all(b)
|
||||||
|
|
||||||
:line
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
2.1 What's in the LAMMPS distribution :h4,link(start_1)
|
2.1 What's in the LAMMPS distribution :h4,link(start_1)
|
||||||
@ -70,12 +69,12 @@ launch a LAMMPS Windows executable on a Windows box.
|
|||||||
|
|
||||||
This section has the following sub-sections:
|
This section has the following sub-sections:
|
||||||
|
|
||||||
"Read this first"_#start_2_1
|
2.2.1 "Read this first"_#start_2_1
|
||||||
"Steps to build a LAMMPS executable"_#start_2_2
|
2.2.1 "Steps to build a LAMMPS executable"_#start_2_2
|
||||||
"Common errors that can occur when making LAMMPS"_#start_2_3
|
2.2.3 "Common errors that can occur when making LAMMPS"_#start_2_3
|
||||||
"Additional build tips"_#start_2_4
|
2.2.4 "Additional build tips"_#start_2_4
|
||||||
"Building for a Mac"_#start_2_5
|
2.2.5 "Building for a Mac"_#start_2_5
|
||||||
"Building for Windows"_#start_2_6 :ul
|
2.2.6 "Building for Windows"_#start_2_6 :all(b)
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
@ -559,8 +558,7 @@ Typing "make clean-all" or "make clean-machine" will delete *.o object
|
|||||||
files created when LAMMPS is built, for either all builds or for a
|
files created when LAMMPS is built, for either all builds or for a
|
||||||
particular machine.
|
particular machine.
|
||||||
|
|
||||||
Changing the LAMMPS size limits via -DLAMMPS_SMALLBIG or
|
Changing the LAMMPS size limits via -DLAMMPS_SMALLBIG or -DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL :h6
|
||||||
-DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL :h6
|
|
||||||
|
|
||||||
As explained above, any of these 3 settings can be specified on the
|
As explained above, any of these 3 settings can be specified on the
|
||||||
LMP_INC line in your low-level src/MAKE/Makefile.foo.
|
LMP_INC line in your low-level src/MAKE/Makefile.foo.
|
||||||
@ -612,7 +610,7 @@ neighbor lists and would run very slowly in terms of CPU secs/timestep.
|
|||||||
|
|
||||||
Building for a Mac :h5,link(start_2_5)
|
Building for a Mac :h5,link(start_2_5)
|
||||||
|
|
||||||
OS X is BSD Unix, so it should just work. See the
|
OS X is a derivative of BSD Unix, so it should just work. See the
|
||||||
src/MAKE/MACHINES/Makefile.mac and Makefile.mac_mpi files.
|
src/MAKE/MACHINES/Makefile.mac and Makefile.mac_mpi files.
|
||||||
|
|
||||||
:line
|
:line
|
||||||
@ -637,9 +635,9 @@ happy to distribute contributed instructions and modifications, but
|
|||||||
we cannot provide support for those.
|
we cannot provide support for those.
|
||||||
|
|
||||||
With the so-called "Anniversary Update" to Windows 10, there is a
|
With the so-called "Anniversary Update" to Windows 10, there is a
|
||||||
Ubuntu subsystem available for Windows, that can be installed and
|
Ubuntu Linux subsystem available for Windows, that can be installed
|
||||||
then it can be used to compile/install LAMMPS as if you are running
|
and then used to compile/install LAMMPS as if you are running on a
|
||||||
on a Ubuntu Linux system.
|
Ubuntu Linux system instead of Windows.
|
||||||
|
|
||||||
As an alternative, you can download "daily builds" (and some older
|
As an alternative, you can download "daily builds" (and some older
|
||||||
versions) of the installer packages from
|
versions) of the installer packages from
|
||||||
@ -654,10 +652,10 @@ many examples, but no source code.
|
|||||||
|
|
||||||
This section has the following sub-sections:
|
This section has the following sub-sections:
|
||||||
|
|
||||||
"Package basics"_#start_3_1
|
2.3.1 "Package basics"_#start_3_1
|
||||||
"Including/excluding packages"_#start_3_2
|
2.3.2 "Including/excluding packages"_#start_3_2
|
||||||
"Packages that require extra libraries"_#start_3_3
|
2.3.3 "Packages that require extra libraries"_#start_3_3
|
||||||
"Packages that require Makefile.machine settings"_#start_3_4 :ul
|
2.3.4 "Packages that require Makefile.machine settings"_#start_3_4 :all(b)
|
||||||
|
|
||||||
Note that the following "Section 2.4"_#start_4 describes the Make.py
|
Note that the following "Section 2.4"_#start_4 describes the Make.py
|
||||||
tool which can be used to install/un-install packages and build the
|
tool which can be used to install/un-install packages and build the
|
||||||
@ -673,7 +671,7 @@ are always included, plus optional packages. Packages are groups of
|
|||||||
files that enable a specific set of features. For example, force
|
files that enable a specific set of features. For example, force
|
||||||
fields for molecular systems or granular systems are in packages.
|
fields for molecular systems or granular systems are in packages.
|
||||||
|
|
||||||
"Section packages"_Section_packages.html in the manual has details
|
"Section 4"_Section_packages.html in the manual has details
|
||||||
about all the packages, including specific instructions for building
|
about all the packages, including specific instructions for building
|
||||||
LAMMPS with each package, which are covered in a more general manner
|
LAMMPS with each package, which are covered in a more general manner
|
||||||
below.
|
below.
|
||||||
@ -727,15 +725,15 @@ before building LAMMPS. From the src directory, this is typically as
|
|||||||
simple as:
|
simple as:
|
||||||
|
|
||||||
make yes-colloid
|
make yes-colloid
|
||||||
make g++ :pre
|
make mpi :pre
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
make no-manybody
|
make no-manybody
|
||||||
make g++ :pre
|
make mpi :pre
|
||||||
|
|
||||||
NOTE: You should NOT include/exclude packages and build LAMMPS in a
|
NOTE: You should NOT include/exclude packages and build LAMMPS in a
|
||||||
single make command using multiple targets, e.g. make yes-colloid g++.
|
single make command using multiple targets, e.g. make yes-colloid mpi.
|
||||||
This is because the make procedure creates a list of source files that
|
This is because the make procedure creates a list of source files that
|
||||||
will be out-of-date for the build if the package configuration changes
|
will be out-of-date for the build if the package configuration changes
|
||||||
within the same command.
|
within the same command.
|
||||||
@ -826,7 +824,7 @@ where to find them.
|
|||||||
For libraries with provided code, the sub-directory README file
|
For libraries with provided code, the sub-directory README file
|
||||||
(e.g. lib/atc/README) has instructions on how to build that library.
|
(e.g. lib/atc/README) has instructions on how to build that library.
|
||||||
This information is also summarized in "Section
|
This information is also summarized in "Section
|
||||||
packages"_Section_packages.html. Typically this is done by typing
|
4"_Section_packages.html. Typically this is done by typing
|
||||||
something like:
|
something like:
|
||||||
|
|
||||||
make -f Makefile.g++ :pre
|
make -f Makefile.g++ :pre
|
||||||
@ -885,17 +883,17 @@ A few packages require specific settings in Makefile.machine, to
|
|||||||
either build or use the package effectively. These are the
|
either build or use the package effectively. These are the
|
||||||
USER-INTEL, KOKKOS, USER-OMP, and OPT packages, used for accelerating
|
USER-INTEL, KOKKOS, USER-OMP, and OPT packages, used for accelerating
|
||||||
code performance on CPUs or other hardware, as discussed in "Section
|
code performance on CPUs or other hardware, as discussed in "Section
|
||||||
acclerate"_Section_accelerate.html.
|
5.3"_Section_accelerate.html#acc_3.
|
||||||
|
|
||||||
A summary of what Makefile.machine changes are needed for each of
|
A summary of what Makefile.machine changes are needed for each of
|
||||||
these packages is given in "Section packages"_Section_packages.html.
|
these packages is given in "Section 4"_Section_packages.html.
|
||||||
The details are given on the doc pages that describe each of these
|
The details are given on the doc pages that describe each of these
|
||||||
accelerator packages in detail:
|
accelerator packages in detail:
|
||||||
|
|
||||||
"USER-INTEL package"_accelerate_intel.html
|
5.3.1 "USER-INTEL package"_accelerate_intel.html
|
||||||
"KOKKOS package"_accelerate_kokkos.html
|
5.3.3 "KOKKOS package"_accelerate_kokkos.html
|
||||||
"USER-OMP package"_accelerate_omp.html
|
5.3.4 "USER-OMP package"_accelerate_omp.html
|
||||||
"OPT package"_accelerate_opt.html :ul
|
5.3.5 "OPT package"_accelerate_opt.html :all(b)
|
||||||
|
|
||||||
You can also look at the following machine Makefiles in
|
You can also look at the following machine Makefiles in
|
||||||
src/MAKE/OPTIONS, which include the changes. Note that the USER-INTEL
|
src/MAKE/OPTIONS, which include the changes. Note that the USER-INTEL
|
||||||
@ -1367,7 +1365,7 @@ Note that the keywords do not use a leading minus sign. I.e. the
|
|||||||
keyword is "t", not "-t". Also note that each of the keywords has a
|
keyword is "t", not "-t". Also note that each of the keywords has a
|
||||||
default setting. Example of when to use these options and what
|
default setting. Example of when to use these options and what
|
||||||
settings to use on different platforms is given in "Section
|
settings to use on different platforms is given in "Section
|
||||||
5.8"_Section_accelerate.html#acc_3.
|
5.3"_Section_accelerate.html#acc_3.
|
||||||
|
|
||||||
d or device
|
d or device
|
||||||
g or gpus
|
g or gpus
|
||||||
|
|||||||
@ -156,19 +156,25 @@ CPU-only (run all-MPI or with OpenMP threading):
|
|||||||
|
|
||||||
cd lammps/src
|
cd lammps/src
|
||||||
make yes-kokkos
|
make yes-kokkos
|
||||||
make g++ KOKKOS_DEVICES=OpenMP :pre
|
make kokkos_omp :pre
|
||||||
|
|
||||||
Intel Xeon Phi:
|
CPU-only (only MPI, no threading):
|
||||||
|
|
||||||
cd lammps/src
|
cd lammps/src
|
||||||
make yes-kokkos
|
make yes-kokkos
|
||||||
make g++ KOKKOS_DEVICES=OpenMP KOKKOS_ARCH=KNC :pre
|
make kokkos_mpi :pre
|
||||||
|
|
||||||
CPUs and GPUs:
|
Intel Xeon Phi (Intel Compiler, Intel MPI):
|
||||||
|
|
||||||
cd lammps/src
|
cd lammps/src
|
||||||
make yes-kokkos
|
make yes-kokkos
|
||||||
make cuda KOKKOS_DEVICES=Cuda :pre
|
make kokkos_phi :pre
|
||||||
|
|
||||||
|
CPUs and GPUs (with MPICH):
|
||||||
|
|
||||||
|
cd lammps/src
|
||||||
|
make yes-kokkos
|
||||||
|
make kokkos_cuda_mpich :pre
|
||||||
|
|
||||||
These examples set the KOKKOS-specific OMP, MIC, CUDA variables on the
|
These examples set the KOKKOS-specific OMP, MIC, CUDA variables on the
|
||||||
make command line which requires a GNU-compatible make command. Try
|
make command line which requires a GNU-compatible make command. Try
|
||||||
@ -180,26 +186,6 @@ first two examples above, then you *must* perform a "make clean-all"
|
|||||||
or "make clean-machine" before each build. This is to force all the
|
or "make clean-machine" before each build. This is to force all the
|
||||||
KOKKOS-dependent files to be re-compiled with the new options.
|
KOKKOS-dependent files to be re-compiled with the new options.
|
||||||
|
|
||||||
You can also hardwire these make variables in the specified machine
|
|
||||||
makefile, e.g. src/MAKE/Makefile.g++ in the first two examples above,
|
|
||||||
with a line like:
|
|
||||||
|
|
||||||
KOKKOS_ARCH = KNC :pre
|
|
||||||
|
|
||||||
Note that if you build LAMMPS multiple times in this manner, using
|
|
||||||
different KOKKOS options (defined in different machine makefiles), you
|
|
||||||
do not have to worry about doing a "clean" in between. This is
|
|
||||||
because the targets will be different.
|
|
||||||
|
|
||||||
NOTE: The 3rd example above for a GPU, uses a different machine
|
|
||||||
makefile, in this case src/MAKE/Makefile.cuda, which is included in
|
|
||||||
the LAMMPS distribution. To build the KOKKOS package for a GPU, this
|
|
||||||
makefile must use the NVIDA "nvcc" compiler. And it must have a
|
|
||||||
KOKKOS_ARCH setting that is appropriate for your NVIDIA hardware and
|
|
||||||
installed software. Typical values for KOKKOS_ARCH are given below,
|
|
||||||
as well as other settings that must be included in the machine
|
|
||||||
makefile, if you create your own.
|
|
||||||
|
|
||||||
NOTE: Currently, there are no precision options with the KOKKOS
|
NOTE: Currently, there are no precision options with the KOKKOS
|
||||||
package. All compilation and computation is performed in double
|
package. All compilation and computation is performed in double
|
||||||
precision.
|
precision.
|
||||||
@ -246,7 +232,7 @@ used if running with KOKKOS_DEVICES=Pthreads for pthreads. It is not
|
|||||||
necessary for KOKKOS_DEVICES=OpenMP for OpenMP, because OpenMP
|
necessary for KOKKOS_DEVICES=OpenMP for OpenMP, because OpenMP
|
||||||
provides alternative methods via environment variables for binding
|
provides alternative methods via environment variables for binding
|
||||||
threads to hardware cores. More info on binding threads to cores is
|
threads to hardware cores. More info on binding threads to cores is
|
||||||
given in "this section"_Section_accelerate.html#acc_3.
|
given in "Section 5.3"_Section_accelerate.html#acc_3.
|
||||||
|
|
||||||
KOKKOS_ARCH=KNC enables compiler switches needed when compling for an
|
KOKKOS_ARCH=KNC enables compiler switches needed when compling for an
|
||||||
Intel Phi processor.
|
Intel Phi processor.
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
"Return to Section accelerate overview"_Section_accelerate.html
|
"Return to Section 5 overview"_Section_accelerate.html
|
||||||
|
|
||||||
5.3.4 USER-OMP package :h5
|
5.3.4 USER-OMP package :h5
|
||||||
|
|
||||||
@ -103,8 +103,8 @@ USER-OMP style (in serial or parallel) with a single thread per MPI
|
|||||||
task, versus running standard LAMMPS with its standard un-accelerated
|
task, versus running standard LAMMPS with its standard un-accelerated
|
||||||
styles (in serial or all-MPI parallelization with 1 task/core). This
|
styles (in serial or all-MPI parallelization with 1 task/core). This
|
||||||
is because many of the USER-OMP styles contain similar optimizations
|
is because many of the USER-OMP styles contain similar optimizations
|
||||||
to those used in the OPT package, described in "Section accelerate
|
to those used in the OPT package, described in "Section
|
||||||
5.3.6"_accelerate_opt.html.
|
5.3.5"_accelerate_opt.html.
|
||||||
|
|
||||||
With multiple threads/task, the optimal choice of number of MPI
|
With multiple threads/task, the optimal choice of number of MPI
|
||||||
tasks/node and OpenMP threads/task can vary a lot and should always be
|
tasks/node and OpenMP threads/task can vary a lot and should always be
|
||||||
|
|||||||
@ -35,7 +35,12 @@ group/group"_compute_group_group.html only that the data is
|
|||||||
accumulated directly during the non-bonded force computation. The
|
accumulated directly during the non-bonded force computation. The
|
||||||
computes {force/tally}, {pe/tally}, {stress/tally}, and
|
computes {force/tally}, {pe/tally}, {stress/tally}, and
|
||||||
{heat/flux/tally} are primarily provided as example how to program
|
{heat/flux/tally} are primarily provided as example how to program
|
||||||
additional, more sophisticated computes using the tally mechanism.
|
additional, more sophisticated computes using the tally callback
|
||||||
|
mechanism. Compute {pe/mol/tally} is one such style, that can
|
||||||
|
- through using this mechanism - separately tally intermolecular
|
||||||
|
and intramolecular energies. Something that would otherwise be
|
||||||
|
impossible without integrating this as a core functionality into
|
||||||
|
the based classes of LAMMPS.
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
@ -56,7 +61,7 @@ atom scalar (the contributions of the single atom to the global
|
|||||||
scalar). Compute {pe/mol/tally} calculates a global 4-element vector
|
scalar). Compute {pe/mol/tally} calculates a global 4-element vector
|
||||||
containing (in this order): {evdwl} and {ecoul} for intramolecular pairs
|
containing (in this order): {evdwl} and {ecoul} for intramolecular pairs
|
||||||
and {evdwl} and {ecoul} for intermolecular pairs. Since molecules are
|
and {evdwl} and {ecoul} for intermolecular pairs. Since molecules are
|
||||||
identified my their molecule IDs, the partitioning does not have to be
|
identified by their molecule IDs, the partitioning does not have to be
|
||||||
related to molecules, but the energies are tallied into the respective
|
related to molecules, but the energies are tallied into the respective
|
||||||
slots depending on whether the molecule IDs of a pair are the same or
|
slots depending on whether the molecule IDs of a pair are the same or
|
||||||
different. Compute {force/tally} calculates a global scalar (the force
|
different. Compute {force/tally} calculates a global scalar (the force
|
||||||
|
|||||||
@ -328,8 +328,8 @@ bonds and colors.
|
|||||||
|
|
||||||
Note that {atom}, {custom}, {dcd}, {xtc}, and {xyz} style dump files
|
Note that {atom}, {custom}, {dcd}, {xtc}, and {xyz} style dump files
|
||||||
can be read directly by "VMD"_http://www.ks.uiuc.edu/Research/vmd, a
|
can be read directly by "VMD"_http://www.ks.uiuc.edu/Research/vmd, a
|
||||||
popular molecular viewing program. See "Section
|
popular molecular viewing program. See
|
||||||
tools"_Section_tools.html#vmd of the manual and the
|
"Section 9"_Section_tools.html#vmd of the manual and the
|
||||||
tools/lmp2vmd/README.txt file for more information about support in
|
tools/lmp2vmd/README.txt file for more information about support in
|
||||||
VMD for reading and visualizing LAMMPS dump files.
|
VMD for reading and visualizing LAMMPS dump files.
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ Using MPI-IO requires two steps. First, build LAMMPS with its MPIIO
|
|||||||
package installed, e.g.
|
package installed, e.g.
|
||||||
|
|
||||||
make yes-mpiio # installs the MPIIO package
|
make yes-mpiio # installs the MPIIO package
|
||||||
make g++ # build LAMMPS for your platform :pre
|
make mpi # build LAMMPS for your platform :pre
|
||||||
|
|
||||||
Second, use a dump filename which contains ".mpiio". Note that it
|
Second, use a dump filename which contains ".mpiio". Note that it
|
||||||
does not have to end in ".mpiio", just contain those characters.
|
does not have to end in ".mpiio", just contain those characters.
|
||||||
@ -531,7 +531,7 @@ so that each value is 0.0 to 1.0. If the simulation box is triclinic
|
|||||||
(tilted), then all atom coords will still be between 0.0 and 1.0.
|
(tilted), then all atom coords will still be between 0.0 and 1.0.
|
||||||
I.e. actual unscaled (x,y,z) = xs*A + ys*B + zs*C, where (A,B,C) are
|
I.e. actual unscaled (x,y,z) = xs*A + ys*B + zs*C, where (A,B,C) are
|
||||||
the non-orthogonal vectors of the simulation box edges, as discussed
|
the non-orthogonal vectors of the simulation box edges, as discussed
|
||||||
in "Section howto 6.12"_Section_howto.html#howto_12.
|
in "Section 6.12"_Section_howto.html#howto_12.
|
||||||
|
|
||||||
Use {xu}, {yu}, {zu} if you want the coordinates "unwrapped" by the
|
Use {xu}, {yu}, {zu} if you want the coordinates "unwrapped" by the
|
||||||
image flags for each atom. Unwrapped means that if the atom has
|
image flags for each atom. Unwrapped means that if the atom has
|
||||||
|
|||||||
@ -34,7 +34,7 @@ to one or more files every N timesteps in one of several formats.
|
|||||||
Only information for atoms in the specified group is dumped. This
|
Only information for atoms in the specified group is dumped. This
|
||||||
specific dump style uses molfile plugins that are bundled with the
|
specific dump style uses molfile plugins that are bundled with the
|
||||||
"VMD"_http://www.ks.uiuc.edu/Research/vmd molecular visualization and
|
"VMD"_http://www.ks.uiuc.edu/Research/vmd molecular visualization and
|
||||||
analysis program. See "Section tools"_Section_tools.html#vmd of the
|
analysis program. See "Section 9"_Section_tools.html#vmd of the
|
||||||
manual and the tools/lmp2vmd/README.txt file for more information
|
manual and the tools/lmp2vmd/README.txt file for more information
|
||||||
about support in VMD for reading and visualizing native LAMMPS dump
|
about support in VMD for reading and visualizing native LAMMPS dump
|
||||||
files.
|
files.
|
||||||
|
|||||||
@ -99,8 +99,8 @@ center-of-mass fixed during the thermodynamic integration. A nonzero
|
|||||||
total velocity will result in divergences during the integration due
|
total velocity will result in divergences during the integration due
|
||||||
to the fact that the atoms are 'attached' to their equilibrium
|
to the fact that the atoms are 'attached' to their equilibrium
|
||||||
positions by the Einstein crystal. Check the option {zero} of "fix
|
positions by the Einstein crystal. Check the option {zero} of "fix
|
||||||
langevin"_fix_langevin_html and "velocity"_velocity.html. The use of
|
langevin"_fix_langevin.html and "velocity"_velocity.html. The use of
|
||||||
the Nose-Hoover thermostat ("fix nvt"_fix_nvt.html) is {NOT}
|
the Nose-Hoover thermostat ("fix nvt"_fix_nh.html) is {NOT}
|
||||||
recommended due to its well documented issues with the canonical
|
recommended due to its well documented issues with the canonical
|
||||||
sampling of harmonic degrees of freedom (notice that the {chain}
|
sampling of harmonic degrees of freedom (notice that the {chain}
|
||||||
option will {NOT} solve this problem). The Langevin thermostat ("fix
|
option will {NOT} solve this problem). The Langevin thermostat ("fix
|
||||||
|
|||||||
@ -138,7 +138,6 @@ Fixes :h1
|
|||||||
fix_temp_rescale_eff
|
fix_temp_rescale_eff
|
||||||
fix_tfmc
|
fix_tfmc
|
||||||
fix_thermal_conductivity
|
fix_thermal_conductivity
|
||||||
fix_ti_rs
|
|
||||||
fix_ti_spring
|
fix_ti_spring
|
||||||
fix_tmd
|
fix_tmd
|
||||||
fix_ttm
|
fix_ttm
|
||||||
|
|||||||
@ -142,7 +142,7 @@ the style options are set, either to default values or to specified
|
|||||||
settings. I.e. settings from previous invocations do not persist
|
settings. I.e. settings from previous invocations do not persist
|
||||||
across multiple invocations.
|
across multiple invocations.
|
||||||
|
|
||||||
See the "Section Accelerate"_Section_accelerate.html section of the
|
See the "Section 5.3"_Section_accelerate.html#acc_3 section of the
|
||||||
manual for more details about using the various accelerator packages
|
manual for more details about using the various accelerator packages
|
||||||
for speeding up LAMMPS simulations.
|
for speeding up LAMMPS simulations.
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ solvent simulations of salt ions "(Lenart)"_#Lenart and of surfactants
|
|||||||
"(Jusufi)"_#Jusufi. In these instances the Gaussian potential mimics
|
"(Jusufi)"_#Jusufi. In these instances the Gaussian potential mimics
|
||||||
the hydration barrier between a pair of particles. The hydration
|
the hydration barrier between a pair of particles. The hydration
|
||||||
barrier is located at r_mh and has a width of sigma_h. The prefactor
|
barrier is located at r_mh and has a width of sigma_h. The prefactor
|
||||||
determines the hight of the potential barrier.
|
determines the height of the potential barrier.
|
||||||
|
|
||||||
The following coefficients must be defined for each pair of atom types
|
The following coefficients must be defined for each pair of atom types
|
||||||
via the "pair_coeff"_pair_coeff.html command as in the example above,
|
via the "pair_coeff"_pair_coeff.html command as in the example above,
|
||||||
@ -73,9 +73,11 @@ commands:
|
|||||||
|
|
||||||
H (energy * distance units)
|
H (energy * distance units)
|
||||||
r_mh (distance units)
|
r_mh (distance units)
|
||||||
sigma_h (distance units) :ul
|
sigma_h (distance units)
|
||||||
|
cutoff (distance units) :ul
|
||||||
|
|
||||||
The global cutoff (r_c) specified in the pair_style command is used.
|
The last coefficient is optional. If not specified, the global cutoff
|
||||||
|
is used.
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@ be passed to various commands as arguments, so that the variable is
|
|||||||
evaluated during a simulation run.
|
evaluated during a simulation run.
|
||||||
|
|
||||||
A broader overview of how Python can be used with LAMMPS is
|
A broader overview of how Python can be used with LAMMPS is
|
||||||
given in "Section python"_Section_python.html. There is an
|
given in "Section 11"_Section_python.html. There is an
|
||||||
examples/python directory which illustrates use of the python
|
examples/python directory which illustrates use of the python
|
||||||
command.
|
command.
|
||||||
|
|
||||||
|
|||||||
@ -124,7 +124,7 @@ MPI-IO requires two steps. First, build LAMMPS with its MPIIO package
|
|||||||
installed, e.g.
|
installed, e.g.
|
||||||
|
|
||||||
make yes-mpiio # installs the MPIIO package
|
make yes-mpiio # installs the MPIIO package
|
||||||
make g++ # build LAMMPS for your platform :pre
|
make mpi # build LAMMPS for your platform :pre
|
||||||
|
|
||||||
Second, use a restart filename which contains ".mpiio". Note that it
|
Second, use a restart filename which contains ".mpiio". Note that it
|
||||||
does not have to end in ".mpiio", just contain those characters.
|
does not have to end in ".mpiio", just contain those characters.
|
||||||
|
|||||||
@ -186,7 +186,7 @@ functions, and include "thermo_style"_thermo_style.html command
|
|||||||
keywords for the simulation box parameters and timestep and elapsed
|
keywords for the simulation box parameters and timestep and elapsed
|
||||||
time. Thus it is easy to specify a time-dependent radius.
|
time. Thus it is easy to specify a time-dependent radius.
|
||||||
|
|
||||||
See "Section_howto 12"_Section_howto.html#howto_12 of the doc pages
|
See "Section 6.12"_Section_howto.html#howto_12 of the doc pages
|
||||||
for a geometric description of triclinic boxes, as defined by LAMMPS,
|
for a geometric description of triclinic boxes, as defined by LAMMPS,
|
||||||
and how to transform these parameters to and from other commonly used
|
and how to transform these parameters to and from other commonly used
|
||||||
triclinic representations.
|
triclinic representations.
|
||||||
@ -361,7 +361,7 @@ sub-regions can be defined with the {open} keyword.
|
|||||||
Styles with a {kk} suffix are functionally the same as the
|
Styles with a {kk} suffix are functionally the same as the
|
||||||
corresponding style without the suffix. They have been optimized to
|
corresponding style without the suffix. They have been optimized to
|
||||||
run faster, depending on your available hardware, as discussed in
|
run faster, depending on your available hardware, as discussed in
|
||||||
"Section_accelerate"_Section_accelerate.html of the manual. The
|
"Section 5"_Section_accelerate.html of the manual. The
|
||||||
accelerated styles take the same arguments and should produce the same
|
accelerated styles take the same arguments and should produce the same
|
||||||
results, except for round-off and precision issues.
|
results, except for round-off and precision issues.
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ by including their suffix, or you can use the "-suffix command-line
|
|||||||
switch"_Section_start.html#start_7 when you invoke LAMMPS, or you can
|
switch"_Section_start.html#start_7 when you invoke LAMMPS, or you can
|
||||||
use the "suffix"_suffix.html command in your input script.
|
use the "suffix"_suffix.html command in your input script.
|
||||||
|
|
||||||
See "Section_accelerate"_Section_accelerate.html of the manual for
|
See "Section 5"_Section_accelerate.html of the manual for
|
||||||
more instructions on how to use the accelerated styles effectively.
|
more instructions on how to use the accelerated styles effectively.
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|||||||
@ -82,7 +82,7 @@ versions 2.0 and above. Using MPI-IO requires two steps. First,
|
|||||||
build LAMMPS with its MPIIO package installed, e.g.
|
build LAMMPS with its MPIIO package installed, e.g.
|
||||||
|
|
||||||
make yes-mpiio # installs the MPIIO package
|
make yes-mpiio # installs the MPIIO package
|
||||||
make g++ # build LAMMPS for your platform :pre
|
make mpi # build LAMMPS for your platform :pre
|
||||||
|
|
||||||
Second, use a restart filename which contains ".mpiio". Note that it
|
Second, use a restart filename which contains ".mpiio". Note that it
|
||||||
does not have to end in ".mpiio", just contain those characters.
|
does not have to end in ".mpiio", just contain those characters.
|
||||||
|
|||||||
@ -1121,7 +1121,7 @@ with a leading $ sign (e.g. $x or $\{abc\}) versus with a leading "v_"
|
|||||||
(e.g. v_x or v_abc). The former can be used in any input script
|
(e.g. v_x or v_abc). The former can be used in any input script
|
||||||
command, including a variable command. The input script parser
|
command, including a variable command. The input script parser
|
||||||
evaluates the reference variable immediately and substitutes its value
|
evaluates the reference variable immediately and substitutes its value
|
||||||
into the command. As explained in "Section commands
|
into the command. As explained in "Section
|
||||||
3.2"_Section_commands.html#cmd_2 for "Parsing rules", you can also use
|
3.2"_Section_commands.html#cmd_2 for "Parsing rules", you can also use
|
||||||
un-named "immediate" variables for this purpose. For example, a
|
un-named "immediate" variables for this purpose. For example, a
|
||||||
string like this $((xlo+xhi)/2+sqrt(v_area)) in an input script
|
string like this $((xlo+xhi)/2+sqrt(v_area)) in an input script
|
||||||
|
|||||||
@ -139,7 +139,7 @@ if rot = yes, the angular momentum is zeroed.
|
|||||||
If specified, the {temp} keyword is used by {create} and {scale} to
|
If specified, the {temp} keyword is used by {create} and {scale} to
|
||||||
specify a "compute"_compute.html that calculates temperature in a
|
specify a "compute"_compute.html that calculates temperature in a
|
||||||
desired way, e.g. by first subtracting out a velocity bias, as
|
desired way, e.g. by first subtracting out a velocity bias, as
|
||||||
discussed in "Section howto 16"_Section_howto.html#howto_15 of the doc
|
discussed in "Section 6.16"_Section_howto.html#howto_16 of the doc
|
||||||
pages. If this keyword is not specified, {create} and {scale}
|
pages. If this keyword is not specified, {create} and {scale}
|
||||||
calculate temperature using a compute that is defined internally as
|
calculate temperature using a compute that is defined internally as
|
||||||
follows:
|
follows:
|
||||||
@ -161,8 +161,8 @@ The {bias} keyword with a {yes} setting is used by {create} and
|
|||||||
If the temperature compute also calculates a velocity bias, the the
|
If the temperature compute also calculates a velocity bias, the the
|
||||||
bias is subtracted from atom velocities before the {create} and
|
bias is subtracted from atom velocities before the {create} and
|
||||||
{scale} operations are performed. After the operations, the bias is
|
{scale} operations are performed. After the operations, the bias is
|
||||||
added back to the atom velocities. See "Section howto
|
added back to the atom velocities. See "Section
|
||||||
16"_Section_howto.html#howto_15 of the doc pages for more discussion
|
6.16"_Section_howto.html#howto_16 of the doc pages for more discussion
|
||||||
of temperature computes with biases. Note that the velocity bias is
|
of temperature computes with biases. Note that the velocity bias is
|
||||||
only applied to atoms in the temperature compute specified with the
|
only applied to atoms in the temperature compute specified with the
|
||||||
{temp} keyword.
|
{temp} keyword.
|
||||||
|
|||||||
@ -55,7 +55,7 @@ versions 2.0 and above. Using MPI-IO requires two steps. First,
|
|||||||
build LAMMPS with its MPIIO package installed, e.g.
|
build LAMMPS with its MPIIO package installed, e.g.
|
||||||
|
|
||||||
make yes-mpiio # installs the MPIIO package
|
make yes-mpiio # installs the MPIIO package
|
||||||
make g++ # build LAMMPS for your platform :pre
|
make mpi # build LAMMPS for your platform :pre
|
||||||
|
|
||||||
Second, use a restart filename which contains ".mpiio". Note that it
|
Second, use a restart filename which contains ".mpiio". Note that it
|
||||||
does not have to end in ".mpiio", just contain those characters.
|
does not have to end in ".mpiio", just contain those characters.
|
||||||
|
|||||||
@ -28,6 +28,15 @@ import os
|
|||||||
import select
|
import select
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
class MPIAbortException(Exception):
|
||||||
|
def __init__(self, message):
|
||||||
|
self.message = message
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return repr(self.message)
|
||||||
|
|
||||||
|
|
||||||
class lammps(object):
|
class lammps(object):
|
||||||
# detect if Python is using version of mpi4py that can pass a communicator
|
# detect if Python is using version of mpi4py that can pass a communicator
|
||||||
|
|
||||||
@ -43,6 +52,7 @@ class lammps(object):
|
|||||||
# create instance of LAMMPS
|
# create instance of LAMMPS
|
||||||
|
|
||||||
def __init__(self,name="",cmdargs=None,ptr=None,comm=None):
|
def __init__(self,name="",cmdargs=None,ptr=None,comm=None):
|
||||||
|
self.comm = comm
|
||||||
|
|
||||||
# determine module location
|
# determine module location
|
||||||
|
|
||||||
@ -150,10 +160,14 @@ class lammps(object):
|
|||||||
if cmd: cmd = cmd.encode()
|
if cmd: cmd = cmd.encode()
|
||||||
self.lib.lammps_command(self.lmp,cmd)
|
self.lib.lammps_command(self.lmp,cmd)
|
||||||
|
|
||||||
if self.lib.lammps_has_error(self.lmp):
|
if self.uses_exceptions and self.lib.lammps_has_error(self.lmp):
|
||||||
sb = create_string_buffer(100)
|
sb = create_string_buffer(100)
|
||||||
self.lib.lammps_get_last_error_message(self.lmp, sb, 100)
|
error_type = self.lib.lammps_get_last_error_message(self.lmp, sb, 100)
|
||||||
raise Exception(sb.value.decode().strip())
|
error_msg = sb.value.decode().strip()
|
||||||
|
|
||||||
|
if error_type == 2:
|
||||||
|
raise MPIAbortException(error_msg)
|
||||||
|
raise Exception(error_msg)
|
||||||
|
|
||||||
def extract_global(self,name,type):
|
def extract_global(self,name,type):
|
||||||
if name: name = name.encode()
|
if name: name = name.encode()
|
||||||
@ -286,6 +300,14 @@ class lammps(object):
|
|||||||
if name: name = name.encode()
|
if name: name = name.encode()
|
||||||
self.lib.lammps_scatter_atoms(self.lmp,name,type,count,data)
|
self.lib.lammps_scatter_atoms(self.lmp,name,type,count,data)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def uses_exceptions(self):
|
||||||
|
try:
|
||||||
|
if self.lib.lammps_has_error:
|
||||||
|
return True
|
||||||
|
except(AttributeError):
|
||||||
|
return False
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public:
|
|||||||
void init_style();
|
void init_style();
|
||||||
double single(int, int, int, int, double, double, double, double &);
|
double single(int, int, int, int, double, double, double, double &);
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
|
void *extract(const char *, int &) { return NULL; }
|
||||||
|
|
||||||
int pack_forward_comm(int, int *, double *, int, int *);
|
int pack_forward_comm(int, int *, double *, int, int *);
|
||||||
void unpack_forward_comm(int, int, double *);
|
void unpack_forward_comm(int, int, double *);
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public:
|
|||||||
void init_style();
|
void init_style();
|
||||||
double single(int, int, int, int, double, double, double, double &);
|
double single(int, int, int, int, double, double, double, double &);
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
|
void *extract(const char *, int &) { return NULL; }
|
||||||
|
|
||||||
int pack_forward_comm(int, int *, double *, int, int *);
|
int pack_forward_comm(int, int *, double *, int, int *);
|
||||||
void unpack_forward_comm(int, int, double *);
|
void unpack_forward_comm(int, int, double *);
|
||||||
|
|||||||
@ -34,6 +34,7 @@ class PairEAMGPU : public PairEAM {
|
|||||||
void init_style();
|
void init_style();
|
||||||
double single(int, int, int, int, double, double, double, double &);
|
double single(int, int, int, int, double, double, double, double &);
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
|
void *extract(const char *, int &) { return NULL; }
|
||||||
|
|
||||||
int pack_forward_comm(int, int *, double *, int, int *);
|
int pack_forward_comm(int, int *, double *, int, int *);
|
||||||
void unpack_forward_comm(int, int, double *);
|
void unpack_forward_comm(int, int, double *);
|
||||||
|
|||||||
@ -61,6 +61,7 @@ class PairEAMAlloyKokkos : public PairEAM {
|
|||||||
virtual ~PairEAMAlloyKokkos();
|
virtual ~PairEAMAlloyKokkos();
|
||||||
virtual void compute(int, int);
|
virtual void compute(int, int);
|
||||||
void init_style();
|
void init_style();
|
||||||
|
void *extract(const char *, int &) { return NULL; }
|
||||||
void coeff(int, char **);
|
void coeff(int, char **);
|
||||||
|
|
||||||
KOKKOS_INLINE_FUNCTION
|
KOKKOS_INLINE_FUNCTION
|
||||||
|
|||||||
@ -61,6 +61,7 @@ class PairEAMFSKokkos : public PairEAM {
|
|||||||
virtual ~PairEAMFSKokkos();
|
virtual ~PairEAMFSKokkos();
|
||||||
virtual void compute(int, int);
|
virtual void compute(int, int);
|
||||||
void init_style();
|
void init_style();
|
||||||
|
void *extract(const char *, int &) { return NULL; }
|
||||||
void coeff(int, char **);
|
void coeff(int, char **);
|
||||||
|
|
||||||
KOKKOS_INLINE_FUNCTION
|
KOKKOS_INLINE_FUNCTION
|
||||||
|
|||||||
@ -59,6 +59,7 @@ class PairEAMKokkos : public PairEAM {
|
|||||||
virtual ~PairEAMKokkos();
|
virtual ~PairEAMKokkos();
|
||||||
virtual void compute(int, int);
|
virtual void compute(int, int);
|
||||||
void init_style();
|
void init_style();
|
||||||
|
void *extract(const char *, int &) { return NULL; }
|
||||||
|
|
||||||
KOKKOS_INLINE_FUNCTION
|
KOKKOS_INLINE_FUNCTION
|
||||||
void operator()(TagPairEAMPackForwardComm, const int&) const;
|
void operator()(TagPairEAMPackForwardComm, const int&) const;
|
||||||
|
|||||||
@ -54,6 +54,7 @@ PairEAM::PairEAM(LAMMPS *lmp) : Pair(lmp)
|
|||||||
frho = NULL;
|
frho = NULL;
|
||||||
rhor = NULL;
|
rhor = NULL;
|
||||||
z2r = NULL;
|
z2r = NULL;
|
||||||
|
scale = NULL;
|
||||||
|
|
||||||
frho_spline = NULL;
|
frho_spline = NULL;
|
||||||
rhor_spline = NULL;
|
rhor_spline = NULL;
|
||||||
@ -232,6 +233,7 @@ void PairEAM::compute(int eflag, int vflag)
|
|||||||
if (eflag) {
|
if (eflag) {
|
||||||
phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
||||||
if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
|
if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
|
||||||
|
phi *= scale[type[i]][type[i]];
|
||||||
if (eflag_global) eng_vdwl += phi;
|
if (eflag_global) eng_vdwl += phi;
|
||||||
if (eflag_atom) eatom[i] += phi;
|
if (eflag_atom) eatom[i] += phi;
|
||||||
}
|
}
|
||||||
@ -306,7 +308,7 @@ void PairEAM::compute(int eflag, int vflag)
|
|||||||
f[j][2] -= delz*fpair;
|
f[j][2] -= delz*fpair;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eflag) evdwl = phi;
|
if (eflag) evdwl = scale[itype][jtype]*phi;
|
||||||
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
if (evflag) ev_tally(i,j,nlocal,newton_pair,
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
evdwl,0.0,fpair,delx,dely,delz);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class PairEAM : public Pair {
|
|||||||
void init_style();
|
void init_style();
|
||||||
double init_one(int, int);
|
double init_one(int, int);
|
||||||
double single(int, int, int, int, double, double, double, double &);
|
double single(int, int, int, int, double, double, double, double &);
|
||||||
void *extract(const char *, int &);
|
virtual void *extract(const char *, int &);
|
||||||
|
|
||||||
virtual int pack_forward_comm(int, int *, double *, int, int *);
|
virtual int pack_forward_comm(int, int *, double *, int, int *);
|
||||||
virtual void unpack_forward_comm(int, int, double *);
|
virtual void unpack_forward_comm(int, int, double *);
|
||||||
|
|||||||
@ -247,6 +247,7 @@ void PairEAMOpt::eval()
|
|||||||
if (EFLAG) {
|
if (EFLAG) {
|
||||||
double phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
double phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
||||||
if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
|
if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
|
||||||
|
phi *= scale[type[i]][type[i]];
|
||||||
if (eflag_global) eng_vdwl += phi;
|
if (eflag_global) eng_vdwl += phi;
|
||||||
if (eflag_atom) eatom[i] += phi;
|
if (eflag_atom) eatom[i] += phi;
|
||||||
}
|
}
|
||||||
@ -273,6 +274,7 @@ void PairEAMOpt::eval()
|
|||||||
double tmpfz = 0.0;
|
double tmpfz = 0.0;
|
||||||
|
|
||||||
fast_gamma_t* _noalias tabssi = &tabss[itype1*ntypes*nr];
|
fast_gamma_t* _noalias tabssi = &tabss[itype1*ntypes*nr];
|
||||||
|
double* _noalias scale_i = scale[itype1+1]+1;
|
||||||
|
|
||||||
for (jj = 0; jj < jnum; jj++) {
|
for (jj = 0; jj < jnum; jj++) {
|
||||||
j = jlist[jj];
|
j = jlist[jj];
|
||||||
@ -316,12 +318,13 @@ void PairEAMOpt::eval()
|
|||||||
// psip needs both fp[i] and fp[j] terms since r_ij appears in two
|
// psip needs both fp[i] and fp[j] terms since r_ij appears in two
|
||||||
// terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji)
|
// terms of embed eng: Fi(sum rho_ij) and Fj(sum rho_ji)
|
||||||
// hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip
|
// hence embed' = Fi(sum rho_ij) rhojp + Fj(sum rho_ji) rhoip
|
||||||
|
// scale factor can be applied by thermodynamic integration
|
||||||
|
|
||||||
double recip = 1.0/r;
|
double recip = 1.0/r;
|
||||||
double phi = z2*recip;
|
double phi = z2*recip;
|
||||||
double phip = z2p*recip - phi*recip;
|
double phip = z2p*recip - phi*recip;
|
||||||
double psip = fp[i]*rhojp + fp[j]*rhoip + phip;
|
double psip = fp[i]*rhojp + fp[j]*rhoip + phip;
|
||||||
double fpair = -psip*recip;
|
double fpair = -scale_i[jtype]*psip*recip;
|
||||||
|
|
||||||
tmpfx += delx*fpair;
|
tmpfx += delx*fpair;
|
||||||
tmpfy += dely*fpair;
|
tmpfy += dely*fpair;
|
||||||
@ -332,7 +335,7 @@ void PairEAMOpt::eval()
|
|||||||
ff[j].z -= delz*fpair;
|
ff[j].z -= delz*fpair;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFLAG) evdwl = phi;
|
if (EFLAG) evdwl = scale_i[jtype]*phi;
|
||||||
|
|
||||||
if (EVFLAG) ev_tally(i,j,nlocal,NEWTON_PAIR,
|
if (EVFLAG) ev_tally(i,j,nlocal,NEWTON_PAIR,
|
||||||
evdwl,0.0,fpair,delx,dely,delz);
|
evdwl,0.0,fpair,delx,dely,delz);
|
||||||
|
|||||||
@ -49,6 +49,8 @@ public:
|
|||||||
/// Reports the memory usage of this pair style to LAMMPS.
|
/// Reports the memory usage of this pair style to LAMMPS.
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
|
|
||||||
|
void *extract(const char *, int &) { return NULL; }
|
||||||
|
|
||||||
/// Parses the coefficients of the h polynomial from the end of the EAM file.
|
/// Parses the coefficients of the h polynomial from the end of the EAM file.
|
||||||
void read_h_coeff(char* filename);
|
void read_h_coeff(char* filename);
|
||||||
|
|
||||||
|
|||||||
@ -203,7 +203,7 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
|
|||||||
if (EFLAG) {
|
if (EFLAG) {
|
||||||
phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
phi = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
||||||
if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
|
if (rho[i] > rhomax) phi += fp[i] * (rho[i]-rhomax);
|
||||||
e_tally_thr(this, i, i, nlocal, NEWTON_PAIR, phi, 0.0, thr);
|
e_tally_thr(this, i, i, nlocal, NEWTON_PAIR, scale[type[i]][type[i]]*phi, 0.0, thr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +230,7 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
|
|||||||
ztmp = x[i].z;
|
ztmp = x[i].z;
|
||||||
itype = type[i];
|
itype = type[i];
|
||||||
fxtmp = fytmp = fztmp = 0.0;
|
fxtmp = fytmp = fztmp = 0.0;
|
||||||
|
const double * _noalias const scale_i = scale[itype];
|
||||||
|
|
||||||
jlist = firstneigh[i];
|
jlist = firstneigh[i];
|
||||||
jnum = numneigh[i];
|
jnum = numneigh[i];
|
||||||
@ -274,7 +275,7 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
|
|||||||
phi = z2*recip;
|
phi = z2*recip;
|
||||||
phip = z2p*recip - phi*recip;
|
phip = z2p*recip - phi*recip;
|
||||||
psip = fp[i]*rhojp + fp[j]*rhoip + phip;
|
psip = fp[i]*rhojp + fp[j]*rhoip + phip;
|
||||||
fpair = -psip*recip;
|
fpair = -scale_i[jtype]*psip*recip;
|
||||||
|
|
||||||
fxtmp += delx*fpair;
|
fxtmp += delx*fpair;
|
||||||
fytmp += dely*fpair;
|
fytmp += dely*fpair;
|
||||||
@ -285,7 +286,7 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr)
|
|||||||
f[j].z -= delz*fpair;
|
f[j].z -= delz*fpair;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFLAG) evdwl = phi;
|
if (EFLAG) evdwl = scale_i[jtype]*phi;
|
||||||
if (EVFLAG) ev_tally_thr(this, i,j,nlocal,NEWTON_PAIR,
|
if (EVFLAG) ev_tally_thr(this, i,j,nlocal,NEWTON_PAIR,
|
||||||
evdwl,0.0,fpair,delx,dely,delz,thr);
|
evdwl,0.0,fpair,delx,dely,delz,thr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,12 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
Error::Error(LAMMPS *lmp) : Pointers(lmp), last_error_message(NULL) {}
|
Error::Error(LAMMPS *lmp) : Pointers(lmp) {
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
|
last_error_message = NULL;
|
||||||
|
last_error_type = ERROR_NONE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
called by all procs in universe
|
called by all procs in universe
|
||||||
@ -198,6 +203,7 @@ void Error::done(int status)
|
|||||||
exit(status);
|
exit(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
return the last error message reported by LAMMPS (only used if
|
return the last error message reported by LAMMPS (only used if
|
||||||
compiled with -DLAMMPS_EXCEPTIONS)
|
compiled with -DLAMMPS_EXCEPTIONS)
|
||||||
@ -208,13 +214,22 @@ char * Error::get_last_error() const
|
|||||||
return last_error_message;
|
return last_error_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
set the last error message (only used if compiled with
|
return the type of the last error reported by LAMMPS (only used if
|
||||||
-DLAMMPS_EXCEPTIONS)
|
compiled with -DLAMMPS_EXCEPTIONS)
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Error::set_last_error(const char * msg)
|
ErrorType Error::get_last_error_type() const
|
||||||
|
{
|
||||||
|
return last_error_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
set the last error message and error type
|
||||||
|
(only used if compiled with -DLAMMPS_EXCEPTIONS)
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Error::set_last_error(const char * msg, ErrorType type)
|
||||||
{
|
{
|
||||||
delete [] last_error_message;
|
delete [] last_error_message;
|
||||||
|
|
||||||
@ -224,4 +239,6 @@ void Error::set_last_error(const char * msg)
|
|||||||
} else {
|
} else {
|
||||||
last_error_message = NULL;
|
last_error_message = NULL;
|
||||||
}
|
}
|
||||||
|
last_error_type = type;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
46
src/error.h
46
src/error.h
@ -15,41 +15,14 @@
|
|||||||
#define LMP_ERROR_H
|
#define LMP_ERROR_H
|
||||||
|
|
||||||
#include "pointers.h"
|
#include "pointers.h"
|
||||||
#include <string>
|
|
||||||
#include <exception>
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
|
#include "exceptions.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class LAMMPSException : public std::exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
std::string message;
|
|
||||||
|
|
||||||
LAMMPSException(std::string msg) : message(msg) {
|
|
||||||
}
|
|
||||||
|
|
||||||
~LAMMPSException() throw() {
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual const char * what() const throw() {
|
|
||||||
return message.c_str();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class LAMMPSAbortException : public LAMMPSException {
|
|
||||||
public:
|
|
||||||
MPI_Comm universe;
|
|
||||||
|
|
||||||
LAMMPSAbortException(std::string msg, MPI_Comm universe) :
|
|
||||||
LAMMPSException(msg),
|
|
||||||
universe(universe)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class Error : protected Pointers {
|
class Error : protected Pointers {
|
||||||
char * last_error_message;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Error(class LAMMPS *);
|
Error(class LAMMPS *);
|
||||||
|
|
||||||
@ -63,8 +36,15 @@ class Error : protected Pointers {
|
|||||||
void message(const char *, int, const char *, int = 1);
|
void message(const char *, int, const char *, int = 1);
|
||||||
void done(int = 0); // 1 would be fully backwards compatible
|
void done(int = 0); // 1 would be fully backwards compatible
|
||||||
|
|
||||||
char * get_last_error() const;
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
void set_last_error(const char * msg);
|
char * get_last_error() const;
|
||||||
|
ErrorType get_last_error_type() const;
|
||||||
|
void set_last_error(const char * msg, ErrorType type = ERROR_NORMAL);
|
||||||
|
|
||||||
|
private:
|
||||||
|
char * last_error_message;
|
||||||
|
ErrorType last_error_type;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
58
src/exceptions.h
Normal file
58
src/exceptions.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LMP_EXCEPTIONS_H
|
||||||
|
#define LMP_EXCEPTIONS_H
|
||||||
|
|
||||||
|
#include <mpi.h>
|
||||||
|
#include <string>
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class LAMMPSException : public std::exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::string message;
|
||||||
|
|
||||||
|
LAMMPSException(std::string msg) : message(msg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
~LAMMPSException() throw() {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const char * what() const throw() {
|
||||||
|
return message.c_str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class LAMMPSAbortException : public LAMMPSException {
|
||||||
|
public:
|
||||||
|
MPI_Comm universe;
|
||||||
|
|
||||||
|
LAMMPSAbortException(std::string msg, MPI_Comm universe) :
|
||||||
|
LAMMPSException(msg),
|
||||||
|
universe(universe)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ErrorType {
|
||||||
|
ERROR_NONE = 0,
|
||||||
|
ERROR_NORMAL = 1,
|
||||||
|
ERROR_ABORT = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -139,7 +139,7 @@ void Fix::modify_params(int narg, char **arg)
|
|||||||
} else if (strcmp(arg[iarg],"respa") == 0) {
|
} else if (strcmp(arg[iarg],"respa") == 0) {
|
||||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
|
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
|
||||||
if (!respa_level_support) error->all(FLERR,"Illegal fix_modify command");
|
if (!respa_level_support) error->all(FLERR,"Illegal fix_modify command");
|
||||||
int lvl = force->inumeric(FLERR,arg[1]);
|
int lvl = force->inumeric(FLERR,arg[iarg+1]);
|
||||||
if (lvl < 0) error->all(FLERR,"Illegal fix_modify command");
|
if (lvl < 0) error->all(FLERR,"Illegal fix_modify command");
|
||||||
respa_level = lvl-1;
|
respa_level = lvl-1;
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|||||||
@ -321,7 +321,7 @@ void FixAdapt::init()
|
|||||||
delete[] psuffix;
|
delete[] psuffix;
|
||||||
}
|
}
|
||||||
if (ad->pair == NULL) ad->pair = force->pair_match(pstyle,1,nsub);
|
if (ad->pair == NULL) ad->pair = force->pair_match(pstyle,1,nsub);
|
||||||
if (ad->pair == NULL)
|
if (ad->pair == NULL)
|
||||||
error->all(FLERR,"Fix adapt pair style does not exist");
|
error->all(FLERR,"Fix adapt pair style does not exist");
|
||||||
|
|
||||||
void *ptr = ad->pair->extract(ad->pparam,ad->pdim);
|
void *ptr = ad->pair->extract(ad->pparam,ad->pdim);
|
||||||
|
|||||||
557
src/library.cpp
557
src/library.cpp
@ -38,6 +38,45 @@
|
|||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Utility macros for optional code path which captures all exceptions
|
||||||
|
and stores the last error message. These assume there is a variable lmp
|
||||||
|
which is a pointer to the current LAMMPS instance.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
BEGIN_CAPTURE
|
||||||
|
{
|
||||||
|
// code paths which might throw exception
|
||||||
|
...
|
||||||
|
}
|
||||||
|
END_CAPTURE
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
|
#define BEGIN_CAPTURE \
|
||||||
|
Error * error = lmp->error; \
|
||||||
|
try
|
||||||
|
|
||||||
|
#define END_CAPTURE \
|
||||||
|
catch(LAMMPSAbortException & ae) { \
|
||||||
|
int nprocs = 0; \
|
||||||
|
MPI_Comm_size(ae.universe, &nprocs ); \
|
||||||
|
\
|
||||||
|
if (nprocs > 1) { \
|
||||||
|
error->set_last_error(ae.message.c_str(), ERROR_ABORT); \
|
||||||
|
} else { \
|
||||||
|
error->set_last_error(ae.message.c_str(), ERROR_NORMAL); \
|
||||||
|
} \
|
||||||
|
} catch(LAMMPSException & e) { \
|
||||||
|
error->set_last_error(e.message.c_str(), ERROR_NORMAL); \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define BEGIN_CAPTURE
|
||||||
|
#define END_CAPTURE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
create an instance of LAMMPS and return pointer to it
|
create an instance of LAMMPS and return pointer to it
|
||||||
pass in command-line args and MPI communicator to run on
|
pass in command-line args and MPI communicator to run on
|
||||||
@ -45,8 +84,20 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
void lammps_open(int argc, char **argv, MPI_Comm communicator, void **ptr)
|
void lammps_open(int argc, char **argv, MPI_Comm communicator, void **ptr)
|
||||||
{
|
{
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LAMMPS *lmp = new LAMMPS(argc,argv,communicator);
|
||||||
|
*ptr = (void *) lmp;
|
||||||
|
}
|
||||||
|
catch(LAMMPSException & e) {
|
||||||
|
fprintf(stderr, "LAMMPS Exception: %s", e.message.c_str());
|
||||||
|
*ptr = (void*) NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
LAMMPS *lmp = new LAMMPS(argc,argv,communicator);
|
LAMMPS *lmp = new LAMMPS(argc,argv,communicator);
|
||||||
*ptr = (void *) lmp;
|
*ptr = (void *) lmp;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -68,8 +119,20 @@ void lammps_open_no_mpi(int argc, char **argv, void **ptr)
|
|||||||
|
|
||||||
MPI_Comm communicator = MPI_COMM_WORLD;
|
MPI_Comm communicator = MPI_COMM_WORLD;
|
||||||
|
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LAMMPS *lmp = new LAMMPS(argc,argv,communicator);
|
||||||
|
*ptr = (void *) lmp;
|
||||||
|
}
|
||||||
|
catch(LAMMPSException & e) {
|
||||||
|
fprintf(stderr, "LAMMPS Exception: %s", e.message.c_str());
|
||||||
|
*ptr = (void*) NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
LAMMPS *lmp = new LAMMPS(argc,argv,communicator);
|
LAMMPS *lmp = new LAMMPS(argc,argv,communicator);
|
||||||
*ptr = (void *) lmp;
|
*ptr = (void *) lmp;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -99,7 +162,12 @@ int lammps_version(void *ptr)
|
|||||||
void lammps_file(void *ptr, char *str)
|
void lammps_file(void *ptr, char *str)
|
||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
lmp->input->file(str);
|
|
||||||
|
BEGIN_CAPTURE
|
||||||
|
{
|
||||||
|
lmp->input->file(str);
|
||||||
|
}
|
||||||
|
END_CAPTURE
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -108,15 +176,16 @@ void lammps_file(void *ptr, char *str)
|
|||||||
|
|
||||||
char *lammps_command(void *ptr, char *str)
|
char *lammps_command(void *ptr, char *str)
|
||||||
{
|
{
|
||||||
LAMMPS * lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
Error * error = lmp->error;
|
char * result = NULL;
|
||||||
|
|
||||||
try {
|
BEGIN_CAPTURE
|
||||||
return lmp->input->one(str);
|
{
|
||||||
} catch(LAMMPSException & e) {
|
result = lmp->input->one(str);
|
||||||
error->set_last_error(e.message.c_str());
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
END_CAPTURE
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -215,58 +284,62 @@ void *lammps_extract_compute(void *ptr, char *id, int style, int type)
|
|||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
|
|
||||||
int icompute = lmp->modify->find_compute(id);
|
BEGIN_CAPTURE
|
||||||
if (icompute < 0) return NULL;
|
{
|
||||||
Compute *compute = lmp->modify->compute[icompute];
|
int icompute = lmp->modify->find_compute(id);
|
||||||
|
if (icompute < 0) return NULL;
|
||||||
|
Compute *compute = lmp->modify->compute[icompute];
|
||||||
|
|
||||||
if (style == 0) {
|
if (style == 0) {
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
if (!compute->scalar_flag) return NULL;
|
if (!compute->scalar_flag) return NULL;
|
||||||
if (compute->invoked_scalar != lmp->update->ntimestep)
|
if (compute->invoked_scalar != lmp->update->ntimestep)
|
||||||
compute->compute_scalar();
|
compute->compute_scalar();
|
||||||
return (void *) &compute->scalar;
|
return (void *) &compute->scalar;
|
||||||
|
}
|
||||||
|
if (type == 1) {
|
||||||
|
if (!compute->vector_flag) return NULL;
|
||||||
|
if (compute->invoked_vector != lmp->update->ntimestep)
|
||||||
|
compute->compute_vector();
|
||||||
|
return (void *) compute->vector;
|
||||||
|
}
|
||||||
|
if (type == 2) {
|
||||||
|
if (!compute->array_flag) return NULL;
|
||||||
|
if (compute->invoked_array != lmp->update->ntimestep)
|
||||||
|
compute->compute_array();
|
||||||
|
return (void *) compute->array;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (type == 1) {
|
|
||||||
if (!compute->vector_flag) return NULL;
|
if (style == 1) {
|
||||||
if (compute->invoked_vector != lmp->update->ntimestep)
|
if (!compute->peratom_flag) return NULL;
|
||||||
compute->compute_vector();
|
if (type == 1) {
|
||||||
return (void *) compute->vector;
|
if (compute->invoked_peratom != lmp->update->ntimestep)
|
||||||
|
compute->compute_peratom();
|
||||||
|
return (void *) compute->vector_atom;
|
||||||
|
}
|
||||||
|
if (type == 2) {
|
||||||
|
if (compute->invoked_peratom != lmp->update->ntimestep)
|
||||||
|
compute->compute_peratom();
|
||||||
|
return (void *) compute->array_atom;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (type == 2) {
|
|
||||||
if (!compute->array_flag) return NULL;
|
if (style == 2) {
|
||||||
if (compute->invoked_array != lmp->update->ntimestep)
|
if (!compute->local_flag) return NULL;
|
||||||
compute->compute_array();
|
if (type == 1) {
|
||||||
return (void *) compute->array;
|
if (compute->invoked_local != lmp->update->ntimestep)
|
||||||
}
|
compute->compute_local();
|
||||||
}
|
return (void *) compute->vector_local;
|
||||||
|
}
|
||||||
if (style == 1) {
|
if (type == 2) {
|
||||||
if (!compute->peratom_flag) return NULL;
|
if (compute->invoked_local != lmp->update->ntimestep)
|
||||||
if (type == 1) {
|
compute->compute_local();
|
||||||
if (compute->invoked_peratom != lmp->update->ntimestep)
|
return (void *) compute->array_local;
|
||||||
compute->compute_peratom();
|
}
|
||||||
return (void *) compute->vector_atom;
|
|
||||||
}
|
|
||||||
if (type == 2) {
|
|
||||||
if (compute->invoked_peratom != lmp->update->ntimestep)
|
|
||||||
compute->compute_peratom();
|
|
||||||
return (void *) compute->array_atom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (style == 2) {
|
|
||||||
if (!compute->local_flag) return NULL;
|
|
||||||
if (type == 1) {
|
|
||||||
if (compute->invoked_local != lmp->update->ntimestep)
|
|
||||||
compute->compute_local();
|
|
||||||
return (void *) compute->vector_local;
|
|
||||||
}
|
|
||||||
if (type == 2) {
|
|
||||||
if (compute->invoked_local != lmp->update->ntimestep)
|
|
||||||
compute->compute_local();
|
|
||||||
return (void *) compute->array_local;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
END_CAPTURE
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -300,40 +373,44 @@ void *lammps_extract_fix(void *ptr, char *id, int style, int type,
|
|||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
|
|
||||||
int ifix = lmp->modify->find_fix(id);
|
BEGIN_CAPTURE
|
||||||
if (ifix < 0) return NULL;
|
{
|
||||||
Fix *fix = lmp->modify->fix[ifix];
|
int ifix = lmp->modify->find_fix(id);
|
||||||
|
if (ifix < 0) return NULL;
|
||||||
|
Fix *fix = lmp->modify->fix[ifix];
|
||||||
|
|
||||||
if (style == 0) {
|
if (style == 0) {
|
||||||
double *dptr = (double *) malloc(sizeof(double));
|
double *dptr = (double *) malloc(sizeof(double));
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
if (!fix->scalar_flag) return NULL;
|
if (!fix->scalar_flag) return NULL;
|
||||||
*dptr = fix->compute_scalar();
|
*dptr = fix->compute_scalar();
|
||||||
return (void *) dptr;
|
return (void *) dptr;
|
||||||
|
}
|
||||||
|
if (type == 1) {
|
||||||
|
if (!fix->vector_flag) return NULL;
|
||||||
|
*dptr = fix->compute_vector(i);
|
||||||
|
return (void *) dptr;
|
||||||
|
}
|
||||||
|
if (type == 2) {
|
||||||
|
if (!fix->array_flag) return NULL;
|
||||||
|
*dptr = fix->compute_array(i,j);
|
||||||
|
return (void *) dptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (type == 1) {
|
|
||||||
if (!fix->vector_flag) return NULL;
|
if (style == 1) {
|
||||||
*dptr = fix->compute_vector(i);
|
if (!fix->peratom_flag) return NULL;
|
||||||
return (void *) dptr;
|
if (type == 1) return (void *) fix->vector_atom;
|
||||||
|
if (type == 2) return (void *) fix->array_atom;
|
||||||
}
|
}
|
||||||
if (type == 2) {
|
|
||||||
if (!fix->array_flag) return NULL;
|
if (style == 2) {
|
||||||
*dptr = fix->compute_array(i,j);
|
if (!fix->local_flag) return NULL;
|
||||||
return (void *) dptr;
|
if (type == 1) return (void *) fix->vector_local;
|
||||||
|
if (type == 2) return (void *) fix->array_local;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
END_CAPTURE
|
||||||
if (style == 1) {
|
|
||||||
if (!fix->peratom_flag) return NULL;
|
|
||||||
if (type == 1) return (void *) fix->vector_atom;
|
|
||||||
if (type == 2) return (void *) fix->array_atom;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (style == 2) {
|
|
||||||
if (!fix->local_flag) return NULL;
|
|
||||||
if (type == 1) return (void *) fix->vector_local;
|
|
||||||
if (type == 2) return (void *) fix->array_local;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -369,23 +446,27 @@ void *lammps_extract_variable(void *ptr, char *name, char *group)
|
|||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
|
|
||||||
int ivar = lmp->input->variable->find(name);
|
BEGIN_CAPTURE
|
||||||
if (ivar < 0) return NULL;
|
{
|
||||||
|
int ivar = lmp->input->variable->find(name);
|
||||||
|
if (ivar < 0) return NULL;
|
||||||
|
|
||||||
if (lmp->input->variable->equalstyle(ivar)) {
|
if (lmp->input->variable->equalstyle(ivar)) {
|
||||||
double *dptr = (double *) malloc(sizeof(double));
|
double *dptr = (double *) malloc(sizeof(double));
|
||||||
*dptr = lmp->input->variable->compute_equal(ivar);
|
*dptr = lmp->input->variable->compute_equal(ivar);
|
||||||
return (void *) dptr;
|
return (void *) dptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lmp->input->variable->atomstyle(ivar)) {
|
if (lmp->input->variable->atomstyle(ivar)) {
|
||||||
int igroup = lmp->group->find(group);
|
int igroup = lmp->group->find(group);
|
||||||
if (igroup < 0) return NULL;
|
if (igroup < 0) return NULL;
|
||||||
int nlocal = lmp->atom->nlocal;
|
int nlocal = lmp->atom->nlocal;
|
||||||
double *vector = (double *) malloc(nlocal*sizeof(double));
|
double *vector = (double *) malloc(nlocal*sizeof(double));
|
||||||
lmp->input->variable->compute_atom(ivar,igroup,vector,1,0);
|
lmp->input->variable->compute_atom(ivar,igroup,vector,1,0);
|
||||||
return (void *) vector;
|
return (void *) vector;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
END_CAPTURE
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -399,7 +480,14 @@ void *lammps_extract_variable(void *ptr, char *name, char *group)
|
|||||||
int lammps_set_variable(void *ptr, char *name, char *str)
|
int lammps_set_variable(void *ptr, char *name, char *str)
|
||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
int err = lmp->input->variable->set_string(name,str);
|
int err = -1;
|
||||||
|
|
||||||
|
BEGIN_CAPTURE
|
||||||
|
{
|
||||||
|
err = lmp->input->variable->set_string(name,str);
|
||||||
|
}
|
||||||
|
END_CAPTURE
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,9 +502,14 @@ int lammps_set_variable(void *ptr, char *name, char *str)
|
|||||||
double lammps_get_thermo(void *ptr, char *name)
|
double lammps_get_thermo(void *ptr, char *name)
|
||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
double dval;
|
double dval = 0.0;
|
||||||
|
|
||||||
|
BEGIN_CAPTURE
|
||||||
|
{
|
||||||
|
lmp->output->thermo->evaluate_keyword(name,&dval);
|
||||||
|
}
|
||||||
|
END_CAPTURE
|
||||||
|
|
||||||
lmp->output->thermo->evaluate_keyword(name,&dval);
|
|
||||||
return dval;
|
return dval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,79 +542,83 @@ void lammps_gather_atoms(void *ptr, char *name,
|
|||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
|
|
||||||
// error if tags are not defined or not consecutive
|
BEGIN_CAPTURE
|
||||||
|
{
|
||||||
|
// error if tags are not defined or not consecutive
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) flag = 1;
|
if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) flag = 1;
|
||||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (lmp->comm->me == 0)
|
if (lmp->comm->me == 0)
|
||||||
lmp->error->warning(FLERR,"Library error in lammps_gather_atoms");
|
lmp->error->warning(FLERR,"Library error in lammps_gather_atoms");
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int natoms = static_cast<int> (lmp->atom->natoms);
|
|
||||||
|
|
||||||
int i,j,offset;
|
|
||||||
void *vptr = lmp->atom->extract(name);
|
|
||||||
|
|
||||||
// copy = Natom length vector of per-atom values
|
|
||||||
// use atom ID to insert each atom's values into copy
|
|
||||||
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
|
|
||||||
|
|
||||||
if (type == 0) {
|
|
||||||
int *vector = NULL;
|
|
||||||
int **array = NULL;
|
|
||||||
if (count == 1) vector = (int *) vptr;
|
|
||||||
else array = (int **) vptr;
|
|
||||||
|
|
||||||
int *copy;
|
|
||||||
lmp->memory->create(copy,count*natoms,"lib/gather:copy");
|
|
||||||
for (i = 0; i < count*natoms; i++) copy[i] = 0;
|
|
||||||
|
|
||||||
tagint *tag = lmp->atom->tag;
|
|
||||||
int nlocal = lmp->atom->nlocal;
|
|
||||||
|
|
||||||
if (count == 1)
|
|
||||||
for (i = 0; i < nlocal; i++)
|
|
||||||
copy[tag[i]-1] = vector[i];
|
|
||||||
else
|
|
||||||
for (i = 0; i < nlocal; i++) {
|
|
||||||
offset = count*(tag[i]-1);
|
|
||||||
for (j = 0; j < count; j++)
|
|
||||||
copy[offset++] = array[i][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
MPI_Allreduce(copy,data,count*natoms,MPI_INT,MPI_SUM,lmp->world);
|
|
||||||
lmp->memory->destroy(copy);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
double *vector = NULL;
|
|
||||||
double **array = NULL;
|
|
||||||
if (count == 1) vector = (double *) vptr;
|
|
||||||
else array = (double **) vptr;
|
|
||||||
|
|
||||||
double *copy;
|
|
||||||
lmp->memory->create(copy,count*natoms,"lib/gather:copy");
|
|
||||||
for (i = 0; i < count*natoms; i++) copy[i] = 0.0;
|
|
||||||
|
|
||||||
tagint *tag = lmp->atom->tag;
|
|
||||||
int nlocal = lmp->atom->nlocal;
|
|
||||||
|
|
||||||
if (count == 1) {
|
|
||||||
for (i = 0; i < nlocal; i++)
|
|
||||||
copy[tag[i]-1] = vector[i];
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < nlocal; i++) {
|
|
||||||
offset = count*(tag[i]-1);
|
|
||||||
for (j = 0; j < count; j++)
|
|
||||||
copy[offset++] = array[i][j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MPI_Allreduce(copy,data,count*natoms,MPI_DOUBLE,MPI_SUM,lmp->world);
|
int natoms = static_cast<int> (lmp->atom->natoms);
|
||||||
lmp->memory->destroy(copy);
|
|
||||||
|
int i,j,offset;
|
||||||
|
void *vptr = lmp->atom->extract(name);
|
||||||
|
|
||||||
|
// copy = Natom length vector of per-atom values
|
||||||
|
// use atom ID to insert each atom's values into copy
|
||||||
|
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
|
||||||
|
|
||||||
|
if (type == 0) {
|
||||||
|
int *vector = NULL;
|
||||||
|
int **array = NULL;
|
||||||
|
if (count == 1) vector = (int *) vptr;
|
||||||
|
else array = (int **) vptr;
|
||||||
|
|
||||||
|
int *copy;
|
||||||
|
lmp->memory->create(copy,count*natoms,"lib/gather:copy");
|
||||||
|
for (i = 0; i < count*natoms; i++) copy[i] = 0;
|
||||||
|
|
||||||
|
tagint *tag = lmp->atom->tag;
|
||||||
|
int nlocal = lmp->atom->nlocal;
|
||||||
|
|
||||||
|
if (count == 1)
|
||||||
|
for (i = 0; i < nlocal; i++)
|
||||||
|
copy[tag[i]-1] = vector[i];
|
||||||
|
else
|
||||||
|
for (i = 0; i < nlocal; i++) {
|
||||||
|
offset = count*(tag[i]-1);
|
||||||
|
for (j = 0; j < count; j++)
|
||||||
|
copy[offset++] = array[i][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
MPI_Allreduce(copy,data,count*natoms,MPI_INT,MPI_SUM,lmp->world);
|
||||||
|
lmp->memory->destroy(copy);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
double *vector = NULL;
|
||||||
|
double **array = NULL;
|
||||||
|
if (count == 1) vector = (double *) vptr;
|
||||||
|
else array = (double **) vptr;
|
||||||
|
|
||||||
|
double *copy;
|
||||||
|
lmp->memory->create(copy,count*natoms,"lib/gather:copy");
|
||||||
|
for (i = 0; i < count*natoms; i++) copy[i] = 0.0;
|
||||||
|
|
||||||
|
tagint *tag = lmp->atom->tag;
|
||||||
|
int nlocal = lmp->atom->nlocal;
|
||||||
|
|
||||||
|
if (count == 1) {
|
||||||
|
for (i = 0; i < nlocal; i++)
|
||||||
|
copy[tag[i]-1] = vector[i];
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < nlocal; i++) {
|
||||||
|
offset = count*(tag[i]-1);
|
||||||
|
for (j = 0; j < count; j++)
|
||||||
|
copy[offset++] = array[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MPI_Allreduce(copy,data,count*natoms,MPI_DOUBLE,MPI_SUM,lmp->world);
|
||||||
|
lmp->memory->destroy(copy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
END_CAPTURE
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -538,69 +635,74 @@ void lammps_scatter_atoms(void *ptr, char *name,
|
|||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
|
|
||||||
// error if tags are not defined or not consecutive or no atom map
|
BEGIN_CAPTURE
|
||||||
|
{
|
||||||
|
// error if tags are not defined or not consecutive or no atom map
|
||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) flag = 1;
|
if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) flag = 1;
|
||||||
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
if (lmp->atom->natoms > MAXSMALLINT) flag = 1;
|
||||||
if (lmp->atom->map_style == 0) flag = 1;
|
if (lmp->atom->map_style == 0) flag = 1;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (lmp->comm->me == 0)
|
if (lmp->comm->me == 0)
|
||||||
lmp->error->warning(FLERR,"Library error in lammps_scatter_atoms");
|
lmp->error->warning(FLERR,"Library error in lammps_scatter_atoms");
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int natoms = static_cast<int> (lmp->atom->natoms);
|
|
||||||
|
|
||||||
int i,j,m,offset;
|
|
||||||
void *vptr = lmp->atom->extract(name);
|
|
||||||
|
|
||||||
// copy = Natom length vector of per-atom values
|
|
||||||
// use atom ID to insert each atom's values into copy
|
|
||||||
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
|
|
||||||
|
|
||||||
if (type == 0) {
|
|
||||||
int *vector = NULL;
|
|
||||||
int **array = NULL;
|
|
||||||
if (count == 1) vector = (int *) vptr;
|
|
||||||
else array = (int **) vptr;
|
|
||||||
int *dptr = (int *) data;
|
|
||||||
|
|
||||||
if (count == 1) {
|
|
||||||
for (i = 0; i < natoms; i++)
|
|
||||||
if ((m = lmp->atom->map(i+1)) >= 0)
|
|
||||||
vector[m] = dptr[i];
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < natoms; i++)
|
|
||||||
if ((m = lmp->atom->map(i+1)) >= 0) {
|
|
||||||
offset = count*i;
|
|
||||||
for (j = 0; j < count; j++)
|
|
||||||
array[m][j] = dptr[offset++];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
double *vector = NULL;
|
|
||||||
double **array = NULL;
|
|
||||||
if (count == 1) vector = (double *) vptr;
|
|
||||||
else array = (double **) vptr;
|
|
||||||
double *dptr = (double *) data;
|
|
||||||
|
|
||||||
if (count == 1) {
|
int natoms = static_cast<int> (lmp->atom->natoms);
|
||||||
for (i = 0; i < natoms; i++)
|
|
||||||
if ((m = lmp->atom->map(i+1)) >= 0)
|
int i,j,m,offset;
|
||||||
vector[m] = dptr[i];
|
void *vptr = lmp->atom->extract(name);
|
||||||
|
|
||||||
|
// copy = Natom length vector of per-atom values
|
||||||
|
// use atom ID to insert each atom's values into copy
|
||||||
|
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
|
||||||
|
|
||||||
|
if (type == 0) {
|
||||||
|
int *vector = NULL;
|
||||||
|
int **array = NULL;
|
||||||
|
if (count == 1) vector = (int *) vptr;
|
||||||
|
else array = (int **) vptr;
|
||||||
|
int *dptr = (int *) data;
|
||||||
|
|
||||||
|
if (count == 1) {
|
||||||
|
for (i = 0; i < natoms; i++)
|
||||||
|
if ((m = lmp->atom->map(i+1)) >= 0)
|
||||||
|
vector[m] = dptr[i];
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < natoms; i++)
|
||||||
|
if ((m = lmp->atom->map(i+1)) >= 0) {
|
||||||
|
offset = count*i;
|
||||||
|
for (j = 0; j < count; j++)
|
||||||
|
array[m][j] = dptr[offset++];
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < natoms; i++) {
|
double *vector = NULL;
|
||||||
if ((m = lmp->atom->map(i+1)) >= 0) {
|
double **array = NULL;
|
||||||
offset = count*i;
|
if (count == 1) vector = (double *) vptr;
|
||||||
for (j = 0; j < count; j++)
|
else array = (double **) vptr;
|
||||||
array[m][j] = dptr[offset++];
|
double *dptr = (double *) data;
|
||||||
|
|
||||||
|
if (count == 1) {
|
||||||
|
for (i = 0; i < natoms; i++)
|
||||||
|
if ((m = lmp->atom->map(i+1)) >= 0)
|
||||||
|
vector[m] = dptr[i];
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < natoms; i++) {
|
||||||
|
if ((m = lmp->atom->map(i+1)) >= 0) {
|
||||||
|
offset = count*i;
|
||||||
|
for (j = 0; j < count; j++)
|
||||||
|
array[m][j] = dptr[offset++];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
END_CAPTURE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
Check if a new error message
|
Check if a new error message
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
@ -613,6 +715,9 @@ int lammps_has_error(void *ptr) {
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
Copy the last error message of LAMMPS into a character buffer
|
Copy the last error message of LAMMPS into a character buffer
|
||||||
|
The return value encodes which type of error it is.
|
||||||
|
1 = normal error (recoverable)
|
||||||
|
2 = abort error (non-recoverable)
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int lammps_get_last_error_message(void *ptr, char * buffer, int buffer_size) {
|
int lammps_get_last_error_message(void *ptr, char * buffer, int buffer_size) {
|
||||||
@ -620,9 +725,11 @@ int lammps_get_last_error_message(void *ptr, char * buffer, int buffer_size) {
|
|||||||
Error * error = lmp->error;
|
Error * error = lmp->error;
|
||||||
|
|
||||||
if(error->get_last_error()) {
|
if(error->get_last_error()) {
|
||||||
|
int error_type = error->get_last_error_type();
|
||||||
strncpy(buffer, error->get_last_error(), buffer_size-1);
|
strncpy(buffer, error->get_last_error(), buffer_size-1);
|
||||||
error->set_last_error(NULL);
|
error->set_last_error(NULL, ERROR_NONE);
|
||||||
return 1;
|
return error_type;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@ -45,8 +45,10 @@ int lammps_get_natoms(void *);
|
|||||||
void lammps_gather_atoms(void *, char *, int, int, void *);
|
void lammps_gather_atoms(void *, char *, int, int, void *);
|
||||||
void lammps_scatter_atoms(void *, char *, int, int, void *);
|
void lammps_scatter_atoms(void *, char *, int, int, void *);
|
||||||
|
|
||||||
|
#ifdef LAMMPS_EXCEPTIONS
|
||||||
int lammps_has_error(void *);
|
int lammps_has_error(void *);
|
||||||
int lammps_get_last_error_message(void *, char *, int);
|
int lammps_get_last_error_message(void *, char *, int);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user