Merge branch 'lammps:develop' into fortran-tinkering
This commit is contained in:
@ -14,6 +14,7 @@ letter abbreviation can be used:
|
||||
* :ref:`-m or -mpicolor <mpicolor>`
|
||||
* :ref:`-c or -cite <cite>`
|
||||
* :ref:`-nc or -nocite <nocite>`
|
||||
* :ref:`-nb or -nonbuf <nonbuf>`
|
||||
* :ref:`-pk or -package <package>`
|
||||
* :ref:`-p or -partition <partition>`
|
||||
* :ref:`-pl or -plog <plog>`
|
||||
@ -257,6 +258,24 @@ Disable generating a citation reminder (see above) at all.
|
||||
|
||||
----------
|
||||
|
||||
.. _nonbuf:
|
||||
|
||||
**-nonbuf**
|
||||
|
||||
Turn off buffering for screen and logfile output. For performance
|
||||
reasons, output to the screen and logfile is usually buffered, i.e.
|
||||
output is only written to a file if its buffer - typically 4096 bytes -
|
||||
has been filled. When LAMMPS crashes for some reason, however, that can
|
||||
mean that there is important output missing. With this flag the
|
||||
buffering can be turned off (only for screen and logfile output) and any
|
||||
output will be committed immediately. Note that when running in
|
||||
parallel with MPI, the screen output may still be buffered by the MPI
|
||||
library and this cannot be changed by LAMMPS. This flag should only be
|
||||
used for debugging and not for production simulations as the performance
|
||||
impact can be significant, especially for large parallel runs.
|
||||
|
||||
----------
|
||||
|
||||
.. _package:
|
||||
|
||||
**-package style args ....**
|
||||
|
||||
@ -1105,7 +1105,7 @@ contains !! Wrapper functions local to this module {{{1
|
||||
C_xy = xy
|
||||
C_xz = xz
|
||||
C_yz = yz
|
||||
call lammps_actual_reset_box (ptr, C_boxlo, C_boxhi, C_xy, C_xz, C_yz)
|
||||
call lammps_actual_reset_box (ptr, C_boxlo, C_boxhi, C_xy, C_yz, C_xz)
|
||||
end subroutine lammps_reset_box
|
||||
|
||||
! lammps_gather_atoms {{{2
|
||||
|
||||
@ -40,7 +40,7 @@ the dynamically-linkable library (liblammps_fortran.so).
|
||||
(2) Copy said library to your Fortran program's source directory or replace
|
||||
${LAMMPS_LIB} with its full path in the instructions below.
|
||||
(3) Compile (but don't link!) LAMMPS.F90. Example:
|
||||
mpif90 -c LAMMPS.f90
|
||||
mpifort -c LAMMPS.f90
|
||||
OR
|
||||
gfortran -c LAMMPS.F90
|
||||
NOTE: you may get a warning such as,
|
||||
@ -72,8 +72,8 @@ the dynamically-linkable library (liblammps_fortran.so).
|
||||
were part of the usual LAMMPS library interface (if you have the module
|
||||
file visible to the compiler, that is).
|
||||
(6) Compile (but don't link) your Fortran program. Example:
|
||||
mpif90 -c myfreeformatfile.f90
|
||||
mpif90 -c myfixedformatfile.f
|
||||
mpifort -c myfreeformatfile.f90
|
||||
mpifort -c myfixedformatfile.f
|
||||
OR
|
||||
gfortran -c myfreeformatfile.f90
|
||||
gfortran -c myfixedformatfile.f
|
||||
@ -83,12 +83,12 @@ the dynamically-linkable library (liblammps_fortran.so).
|
||||
IMPORTANT: If the Fortran module from part (3) is not in the current
|
||||
directory or in one searched by the compiler for module files, you will
|
||||
need to include that location via the -I flag to the compiler, like so:
|
||||
mpif90 -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90
|
||||
mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90
|
||||
|
||||
(7) Link everything together, including any libraries needed by LAMMPS (such
|
||||
as the C++ standard library, the C math library, the JPEG library, fftw,
|
||||
etc.) For example,
|
||||
mpif90 LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \
|
||||
mpifort LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \
|
||||
${LAMMPS_LIB} -lmpi_cxx -lstdc++ -lm
|
||||
OR
|
||||
gfortran LAMMPS.o LAMMPS-wrapper.o ${my_object_files} \
|
||||
@ -105,17 +105,17 @@ You should now have a working executable.
|
||||
(1) Compile LAMMPS as a dynamic library
|
||||
(make makeshlib && make -f Makefile.shlib [targetname]).
|
||||
(2) Compile, but don't link, LAMMPS.F90 using the -fPIC flag, such as
|
||||
mpif90 -fPIC -c LAMMPS.f90
|
||||
mpifort -fPIC -c LAMMPS.f90
|
||||
(3) Compile, but don't link, LAMMPS-wrapper.cpp in the same manner, e.g.
|
||||
mpicxx -fPIC -c LAMMPS-wrapper.cpp
|
||||
(4) Make the dynamic library, like so:
|
||||
mpif90 -fPIC -shared -o liblammps_fortran.so LAMMPS.o LAMMPS-wrapper.o
|
||||
mpifort -fPIC -shared -o liblammps_fortran.so LAMMPS.o LAMMPS-wrapper.o
|
||||
(5) Compile your program, such as,
|
||||
mpif90 -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90
|
||||
mpifort -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90
|
||||
where ${LAMMPS_SRC}/examples/COUPLE/fortran2 contains the .mod file from
|
||||
step (3)
|
||||
(6) Link everything together, such as
|
||||
mpif90 ${my_object_files} -L${LAMMPS_SRC} \
|
||||
mpifort ${my_object_files} -L${LAMMPS_SRC} \
|
||||
-L${LAMMPS_SRC}/examples/COUPLE/fortran2 -llammps_fortran \
|
||||
-llammps_openmpi -lmpi_cxx -lstdc++ -lm
|
||||
|
||||
|
||||
@ -1,66 +1,66 @@
|
||||
# 2d NEB surface simulation, hop from surface to become adatom
|
||||
|
||||
dimension 2
|
||||
boundary p s p
|
||||
dimension 2
|
||||
boundary p s p
|
||||
|
||||
atom_style atomic
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 5
|
||||
atom_modify map array sort 0 0.0
|
||||
atom_style atomic
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 5
|
||||
atom_modify map array sort 0 0.0
|
||||
|
||||
variable u uloop 20
|
||||
variable u uloop 20
|
||||
|
||||
# create geometry with flat surface
|
||||
|
||||
lattice hex 0.9
|
||||
region box block 0 20 0 10 -0.25 0.25
|
||||
lattice hex 0.9
|
||||
region box block 0 20 0 10 -0.25 0.25
|
||||
|
||||
#create_box 3 box
|
||||
#create_atoms 1 box
|
||||
#mass * 1.0
|
||||
#create_box 3 box
|
||||
#create_atoms 1 box
|
||||
#mass * 1.0
|
||||
#write_data initial.hop1
|
||||
|
||||
read_data initial.hop1
|
||||
|
||||
# LJ potentials
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0 2.5
|
||||
pair_modify shift yes
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0 2.5
|
||||
pair_modify shift yes
|
||||
|
||||
# initial minimization to relax surface
|
||||
|
||||
minimize 1.0e-6 1.0e-4 1000 10000
|
||||
reset_timestep 0
|
||||
minimize 1.0e-6 1.0e-4 1000 10000
|
||||
reset_timestep 0
|
||||
|
||||
# define groups
|
||||
|
||||
region 1 block INF INF INF 1.25 INF INF
|
||||
group lower region 1
|
||||
group mobile subtract all lower
|
||||
set group lower type 2
|
||||
region 1 block INF INF INF 1.25 INF INF
|
||||
group lower region 1
|
||||
group mobile subtract all lower
|
||||
set group lower type 2
|
||||
|
||||
timestep 0.05
|
||||
timestep 0.05
|
||||
|
||||
# group of NEB atoms - either block or single atom ID 412
|
||||
|
||||
region surround block 10 18 17 20 0 0 units box
|
||||
group nebatoms region surround
|
||||
#group nebatoms id 412
|
||||
set group nebatoms type 3
|
||||
group nonneb subtract all nebatoms
|
||||
region surround block 10 18 17 20 0 0 units box
|
||||
group nebatoms region surround
|
||||
#group nebatoms id 412
|
||||
set group nebatoms type 3
|
||||
group nonneb subtract all nebatoms
|
||||
|
||||
fix 1 lower setforce 0.0 0.0 0.0
|
||||
fix 2 nebatoms neb 1.0 parallel ideal
|
||||
fix 3 all enforce2d
|
||||
fix 1 lower setforce 0.0 0.0 0.0
|
||||
fix 2 nebatoms neb 1.0 parallel ideal
|
||||
fix 3 all enforce2d
|
||||
|
||||
thermo 100
|
||||
thermo 100
|
||||
|
||||
#dump 1 nebatoms atom 10 dump.neb.$u
|
||||
#dump 2 nonneb atom 10 dump.nonneb.$u
|
||||
#dump 1 nebatoms atom 10 dump.neb.$u
|
||||
#dump 2 nonneb atom 10 dump.nonneb.$u
|
||||
|
||||
# run NEB for 2000 steps or to force tolerance
|
||||
|
||||
min_style quickmin
|
||||
min_style quickmin
|
||||
|
||||
neb 0.0 0.1 1000 1000 100 final final.hop1
|
||||
neb 0.0 0.1 1000 1000 100 final final.hop1
|
||||
|
||||
@ -1,56 +1,56 @@
|
||||
# 2d NEB surface simulation, hop from surface to become adatom
|
||||
|
||||
dimension 2
|
||||
boundary p s p
|
||||
dimension 2
|
||||
boundary p s p
|
||||
|
||||
atom_style atomic
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 5
|
||||
atom_modify map array sort 0 0.0
|
||||
atom_style atomic
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 5
|
||||
atom_modify map array sort 0 0.0
|
||||
|
||||
variable u uloop 20
|
||||
variable u uloop 20
|
||||
|
||||
# create geometry with flat surface
|
||||
|
||||
lattice hex 0.9
|
||||
region box block 0 20 0 10 -0.25 0.25
|
||||
lattice hex 0.9
|
||||
region box block 0 20 0 10 -0.25 0.25
|
||||
|
||||
read_data initial.hop1.end
|
||||
|
||||
# LJ potentials
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0 2.5
|
||||
pair_modify shift yes
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0 2.5
|
||||
pair_modify shift yes
|
||||
|
||||
# define groups
|
||||
|
||||
region 1 block INF INF INF 1.25 INF INF
|
||||
group lower region 1
|
||||
group mobile subtract all lower
|
||||
set group lower type 2
|
||||
region 1 block INF INF INF 1.25 INF INF
|
||||
group lower region 1
|
||||
group mobile subtract all lower
|
||||
set group lower type 2
|
||||
|
||||
timestep 0.05
|
||||
timestep 0.05
|
||||
|
||||
# group of NEB atoms - either block or single atom ID 412
|
||||
|
||||
region surround block 10 18 17 20 0 0 units box
|
||||
group nebatoms region surround
|
||||
#group nebatoms id 412
|
||||
set group nebatoms type 3
|
||||
group nonneb subtract all nebatoms
|
||||
region surround block 10 18 17 20 0 0 units box
|
||||
group nebatoms region surround
|
||||
#group nebatoms id 412
|
||||
set group nebatoms type 3
|
||||
group nonneb subtract all nebatoms
|
||||
|
||||
fix 1 lower setforce 0.0 0.0 0.0
|
||||
fix 2 nebatoms neb 1.0 parallel ideal end first 1.0
|
||||
fix 3 all enforce2d
|
||||
fix 1 lower setforce 0.0 0.0 0.0
|
||||
fix 2 nebatoms neb 1.0 parallel ideal end first 1.0
|
||||
fix 3 all enforce2d
|
||||
|
||||
thermo 100
|
||||
thermo 100
|
||||
|
||||
#dump 1 nebatoms atom 10 dump.neb.$u
|
||||
#dump 2 nonneb atom 10 dump.nonneb.$u
|
||||
#dump 1 nebatoms atom 10 dump.neb.$u
|
||||
#dump 2 nonneb atom 10 dump.nonneb.$u
|
||||
|
||||
# run NEB for 2000 steps or to force tolerance
|
||||
|
||||
min_style quickmin
|
||||
min_style quickmin
|
||||
|
||||
neb 0.0 0.1 1000 1000 100 final final.hop1
|
||||
neb 0.0 0.1 1000 1000 100 final final.hop1
|
||||
|
||||
@ -1,68 +1,68 @@
|
||||
# 2d NEB surface simulation, hop of adatom on surface
|
||||
|
||||
dimension 2
|
||||
boundary p s p
|
||||
dimension 2
|
||||
boundary p s p
|
||||
|
||||
atom_style atomic
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 5
|
||||
atom_modify map array sort 0 0.0
|
||||
atom_style atomic
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 5
|
||||
atom_modify map array sort 0 0.0
|
||||
|
||||
variable u uloop 20
|
||||
variable u uloop 20
|
||||
|
||||
# create geometry with adatom
|
||||
|
||||
lattice hex 0.9
|
||||
region box block 0 20 0 11 -0.25 0.25
|
||||
region box1 block 0 20 0 10 -0.25 0.25
|
||||
lattice hex 0.9
|
||||
region box block 0 20 0 11 -0.25 0.25
|
||||
region box1 block 0 20 0 10 -0.25 0.25
|
||||
|
||||
#create_box 3 box
|
||||
#create_atoms 1 region box1
|
||||
#create_atoms 1 single 11.5 10.5 0
|
||||
#mass * 1.0
|
||||
#create_box 3 box
|
||||
#create_atoms 1 region box1
|
||||
#create_atoms 1 single 11.5 10.5 0
|
||||
#mass * 1.0
|
||||
#write_data initial.hop2
|
||||
|
||||
read_data initial.hop2
|
||||
|
||||
# LJ potentials
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0 2.5
|
||||
pair_modify shift yes
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff * * 1.0 1.0 2.5
|
||||
pair_modify shift yes
|
||||
|
||||
# initial minimization to relax surface
|
||||
|
||||
minimize 1.0e-6 1.0e-4 1000 10000
|
||||
reset_timestep 0
|
||||
minimize 1.0e-6 1.0e-4 1000 10000
|
||||
reset_timestep 0
|
||||
|
||||
# define groups
|
||||
|
||||
region 1 block INF INF INF 1.25 INF INF
|
||||
group lower region 1
|
||||
group mobile subtract all lower
|
||||
set group lower type 2
|
||||
region 1 block INF INF INF 1.25 INF INF
|
||||
group lower region 1
|
||||
group mobile subtract all lower
|
||||
set group lower type 2
|
||||
|
||||
timestep 0.05
|
||||
timestep 0.05
|
||||
|
||||
# group of NEB atoms - either block or single atom ID 421
|
||||
|
||||
region surround block 10 18 17 21 0 0 units box
|
||||
group nebatoms region surround
|
||||
#group nebatoms id 421
|
||||
set group nebatoms type 3
|
||||
group nonneb subtract all nebatoms
|
||||
region surround block 10 18 17 21 0 0 units box
|
||||
group nebatoms region surround
|
||||
#group nebatoms id 421
|
||||
set group nebatoms type 3
|
||||
group nonneb subtract all nebatoms
|
||||
|
||||
fix 1 lower setforce 0.0 0.0 0.0
|
||||
fix 2 nebatoms neb 1.0
|
||||
fix 3 all enforce2d
|
||||
fix 1 lower setforce 0.0 0.0 0.0
|
||||
fix 2 nebatoms neb 1.0
|
||||
fix 3 all enforce2d
|
||||
|
||||
thermo 100
|
||||
thermo 100
|
||||
|
||||
#dump 1 nebatoms atom 10 dump.neb.$u
|
||||
#dump 2 nonneb atom 10 dump.nonneb.$u
|
||||
#dump 1 nebatoms atom 10 dump.neb.$u
|
||||
#dump 2 nonneb atom 10 dump.nonneb.$u
|
||||
|
||||
# run NEB for 2000 steps or to force tolerance
|
||||
|
||||
min_style fire
|
||||
min_style fire
|
||||
|
||||
neb 0.0 0.05 1000 1000 100 final final.hop2
|
||||
neb 0.0 0.05 1000 1000 100 final final.hop2
|
||||
|
||||
@ -5,7 +5,7 @@ units metal
|
||||
atom_style atomic
|
||||
atom_modify map array
|
||||
boundary p p p
|
||||
atom_modify sort 0 0.0
|
||||
atom_modify sort 0 0.0
|
||||
|
||||
# coordination number cutoff
|
||||
|
||||
@ -45,7 +45,7 @@ group Si type 1
|
||||
group del id 300
|
||||
delete_atoms group del compress no
|
||||
group vacneigh id 174 175 301 304 306 331 337
|
||||
|
||||
|
||||
# choose potential
|
||||
|
||||
pair_style sw
|
||||
@ -53,26 +53,26 @@ pair_coeff * * Si.sw Si
|
||||
|
||||
# set up neb run
|
||||
|
||||
variable u uloop 20
|
||||
variable u uloop 20
|
||||
|
||||
# initial minimization to relax vacancy
|
||||
|
||||
displace_atoms all random 0.1 0.1 0.1 123456
|
||||
minimize 1.0e-6 1.0e-4 1000 10000
|
||||
|
||||
reset_timestep 0
|
||||
|
||||
# only output atoms near vacancy
|
||||
|
||||
#dump events vacneigh custom 1000 dump.neb.sivac.$u id type x y z
|
||||
|
||||
# initial minimization to relax vacancy
|
||||
fix 1 all neb 1.0
|
||||
|
||||
displace_atoms all random 0.1 0.1 0.1 123456
|
||||
minimize 1.0e-6 1.0e-4 1000 10000
|
||||
|
||||
reset_timestep 0
|
||||
|
||||
fix 1 all neb 1.0
|
||||
|
||||
thermo 100
|
||||
thermo 100
|
||||
|
||||
# run NEB for 2000 steps or to force tolerance
|
||||
|
||||
timestep 0.01
|
||||
min_style quickmin
|
||||
min_style quickmin
|
||||
|
||||
neb 0.0 0.01 100 100 10 final final.sivac
|
||||
neb 0.0 0.01 100 100 10 final final.sivac
|
||||
|
||||
@ -4,17 +4,29 @@
|
||||
# try to improperly start up a new interpreter.
|
||||
import sysconfig
|
||||
import ctypes
|
||||
library = sysconfig.get_config_vars('INSTSONAME')[0]
|
||||
import platform
|
||||
|
||||
py_ver = sysconfig.get_config_vars('VERSION')[0]
|
||||
OS_name = platform.system()
|
||||
|
||||
if OS_name == "Linux":
|
||||
SHLIB_SUFFIX = '.so'
|
||||
library = 'libpython' + py_ver + SHLIB_SUFFIX
|
||||
elif OS_name == "Darwin":
|
||||
SHLIB_SUFFIX = '.dylib'
|
||||
library = 'libpython' + py_ver + SHLIB_SUFFIX
|
||||
elif OS_name == "Windows":
|
||||
SHLIB_SUFFIX = '.dll'
|
||||
library = 'python' + py_ver + SHLIB_SUFFIX
|
||||
|
||||
try:
|
||||
pylib = ctypes.CDLL(library)
|
||||
except OSError as e:
|
||||
if pylib.endswith(".a"):
|
||||
pylib.strip(".a") + ".so"
|
||||
pylib = ctypes.CDLL(library)
|
||||
else:
|
||||
raise e
|
||||
except Exception as e:
|
||||
raise OSError("Unable to locate python shared library") from e
|
||||
|
||||
if not pylib.Py_IsInitialized():
|
||||
raise RuntimeError("This interpreter is not compatible with python-based mliap for LAMMPS.")
|
||||
|
||||
del sysconfig, ctypes, library, pylib
|
||||
|
||||
from .loader import load_model, activate_mliappy
|
||||
|
||||
@ -369,7 +369,8 @@ void PairAmoeba::induce()
|
||||
eps = DEBYE * sqrt(eps/atom->natoms);
|
||||
|
||||
if (eps < poleps) done = true;
|
||||
if (eps > epsold) done = true;
|
||||
// also commented out in induce.f of Tinker
|
||||
// if (eps > epsold) done = true;
|
||||
if (iter >= politer) done = true;
|
||||
|
||||
// apply a "peek" iteration to the mutual induced dipoles
|
||||
@ -390,7 +391,7 @@ void PairAmoeba::induce()
|
||||
// terminate the calculation if dipoles failed to converge
|
||||
// NOTE: could make this an error
|
||||
|
||||
if (iter >= maxiter || eps > epsold)
|
||||
if (iter >= politer || eps > epsold)
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,"AMOEBA induced dipoles did not converge");
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"d") == 0 || strcmp(arg[iarg],"device") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Invalid Kokkos command-line args");
|
||||
device = atoi(arg[iarg+1]);
|
||||
device = utils::inumeric(FLERR, arg[iarg+1], false, lmp);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"g") == 0 ||
|
||||
@ -125,11 +125,11 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||
error->all(FLERR,"GPUs are requested but Kokkos has not been compiled using a GPU-enabled backend");
|
||||
#endif
|
||||
if (iarg+2 > narg) error->all(FLERR,"Invalid Kokkos command-line args");
|
||||
ngpus = atoi(arg[iarg+1]);
|
||||
ngpus = utils::inumeric(FLERR, arg[iarg+1], false, lmp);
|
||||
|
||||
int skip_gpu = 9999;
|
||||
if (iarg+2 < narg && isdigit(arg[iarg+2][0])) {
|
||||
skip_gpu = atoi(arg[iarg+2]);
|
||||
skip_gpu = utils::inumeric(FLERR, arg[iarg+2], false, lmp);
|
||||
iarg++;
|
||||
}
|
||||
iarg += 2;
|
||||
@ -160,6 +160,12 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||
if (device >= skip_gpu) device++;
|
||||
set_flag = 1;
|
||||
}
|
||||
if ((str = getenv("PMI_LOCAL_RANK"))) {
|
||||
int local_rank = atoi(str);
|
||||
device = local_rank % ngpus;
|
||||
if (device >= skip_gpu) device++;
|
||||
set_flag = 1;
|
||||
}
|
||||
|
||||
if (ngpus > 1 && !set_flag)
|
||||
error->all(FLERR,"Could not determine local MPI rank for multiple "
|
||||
@ -167,7 +173,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||
|
||||
} else if (strcmp(arg[iarg],"t") == 0 ||
|
||||
strcmp(arg[iarg],"threads") == 0) {
|
||||
nthreads = atoi(arg[iarg+1]);
|
||||
nthreads = utils::inumeric(FLERR, arg[iarg+1], false, lmp);
|
||||
|
||||
if (nthreads <= 0)
|
||||
error->all(FLERR,"Invalid number of threads requested for Kokkos: must be 1 or greater");
|
||||
@ -176,19 +182,20 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||
|
||||
} else if (strcmp(arg[iarg],"n") == 0 ||
|
||||
strcmp(arg[iarg],"numa") == 0) {
|
||||
numa = atoi(arg[iarg+1]);
|
||||
numa = utils::inumeric(FLERR, arg[iarg+1], false, lmp);
|
||||
iarg += 2;
|
||||
|
||||
} else error->all(FLERR,"Invalid Kokkos command-line args");
|
||||
} else error->all(FLERR,"Invalid Kokkos command-line arg: {}", arg[iarg]);
|
||||
}
|
||||
|
||||
// Initialize Kokkos. However, we cannot change any
|
||||
// Kokkos library parameters after the first initalization
|
||||
|
||||
if (args.num_threads != -1) {
|
||||
if (args.num_threads != nthreads || args.num_numa != numa || args.device_id != device)
|
||||
if ((args.num_threads != nthreads) || (args.num_numa != numa) || (args.device_id != device))
|
||||
if (me == 0)
|
||||
error->warning(FLERR,"Kokkos package already initalized, cannot reinitialize with different parameters");
|
||||
error->warning(FLERR,"Kokkos package already initalized, "
|
||||
"cannot reinitialize with different parameters");
|
||||
nthreads = args.num_threads;
|
||||
numa = args.num_numa;
|
||||
device = args.device_id;
|
||||
@ -200,8 +207,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||
init_ngpus = ngpus;
|
||||
}
|
||||
|
||||
if (me == 0)
|
||||
utils::logmesg(lmp, " will use up to {} GPU(s) per node\n",ngpus);
|
||||
if (me == 0) utils::logmesg(lmp, " will use up to {} GPU(s) per node\n", ngpus);
|
||||
|
||||
#ifdef LMP_KOKKOS_GPU
|
||||
if (ngpus <= 0)
|
||||
|
||||
@ -68,7 +68,7 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) :
|
||||
pstyle[nvalues++] = DZ;
|
||||
else if (arg[iarg][0] == 'p') {
|
||||
int n = atoi(&arg[iarg][1]);
|
||||
if (n <= 0) error->all(FLERR, "Invalid keyword in compute pair/local command");
|
||||
if (n <= 0) error->all(FLERR, "Invalid keyword {} in compute pair/local command", arg[iarg]);
|
||||
pstyle[nvalues] = PN;
|
||||
pindex[nvalues++] = n - 1;
|
||||
|
||||
|
||||
@ -389,11 +389,11 @@ class uint128_fallback {
|
||||
hi_ += (lo_ < n ? 1 : 0);
|
||||
return *this;
|
||||
}
|
||||
#if FMT_HAS_BUILTIN(__builtin_addcll)
|
||||
#if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__)
|
||||
unsigned long long carry;
|
||||
lo_ = __builtin_addcll(lo_, n, 0, &carry);
|
||||
hi_ += carry;
|
||||
#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64)
|
||||
#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__)
|
||||
unsigned long long result;
|
||||
auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &result);
|
||||
lo_ = result;
|
||||
|
||||
@ -196,6 +196,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
||||
int citelogfile = CiteMe::VERBOSE;
|
||||
char *citefile = nullptr;
|
||||
int helpflag = 0;
|
||||
int nonbufflag = 0;
|
||||
|
||||
suffix = suffix2 = suffixp = nullptr;
|
||||
suffix_enable = 0;
|
||||
@ -298,6 +299,11 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
||||
citeflag = 0;
|
||||
iarg++;
|
||||
|
||||
} else if (strcmp(arg[iarg],"-nonbuf") == 0 ||
|
||||
strcmp(arg[iarg],"-nb") == 0) {
|
||||
nonbufflag = 1;
|
||||
iarg++;
|
||||
|
||||
} else if (strcmp(arg[iarg],"-package") == 0 ||
|
||||
strcmp(arg[iarg],"-pk") == 0) {
|
||||
if (iarg+2 > narg)
|
||||
@ -520,7 +526,6 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
||||
utils::flush_buffers(this);
|
||||
}
|
||||
|
||||
|
||||
// universe is one or more worlds, as setup by partition switch
|
||||
// split universe communicator into separate world communicators
|
||||
// set world screen, logfile, communicator, infile
|
||||
@ -587,6 +592,15 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
|
||||
}
|
||||
}
|
||||
|
||||
// make all screen and logfile output unbuffered for debugging crashes
|
||||
|
||||
if (nonbufflag) {
|
||||
if (universe->uscreen) setbuf(universe->uscreen, nullptr);
|
||||
if (universe->ulogfile) setbuf(universe->ulogfile, nullptr);
|
||||
if (screen) setbuf(screen, nullptr);
|
||||
if (logfile) setbuf(logfile, nullptr);
|
||||
}
|
||||
|
||||
// screen and logfile messages for universe and world
|
||||
|
||||
if ((universe->me == 0) && (!helpflag)) {
|
||||
|
||||
@ -179,8 +179,7 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields)
|
||||
|
||||
++nid;
|
||||
rv = sscanf(line,"%*s%lg%lg%lg", &myx, &myy, &myz);
|
||||
if (rv != 3)
|
||||
error->one(FLERR,"Dump file is incorrectly formatted");
|
||||
if (rv != 3) error->one(FLERR,"Dump file is incorrectly formatted");
|
||||
|
||||
// XXX: we could insert an element2type translation here
|
||||
// XXX: for now we flag unrecognized types as type 0,
|
||||
|
||||
@ -189,16 +189,26 @@ import sys, re, glob, types
|
||||
from os import popen
|
||||
from math import * # any function could be used by set()
|
||||
|
||||
try:
|
||||
import numpy as np
|
||||
oldnumeric = False
|
||||
except:
|
||||
import Numeric as np
|
||||
oldnumeric = True
|
||||
import numpy as np
|
||||
|
||||
try: from DEFAULTS import PIZZA_GUNZIP
|
||||
except: PIZZA_GUNZIP = "gunzip"
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# wrapper to convert old style comparision function to key function
|
||||
|
||||
def cmp2key(oldcmp):
|
||||
class keycmp:
|
||||
def __init__(self, obj, *args):
|
||||
self.obj = obj
|
||||
def __lt__(self, other):
|
||||
return oldcmp(self.obj,other.obj) < 0
|
||||
def __gt__(self, other):
|
||||
return oldcmp(self.obj,other.obj) > 0
|
||||
def __eq__(self, other):
|
||||
return oldcmp(self.obj,other.obj) == 0
|
||||
return keycmp
|
||||
|
||||
# Class definition
|
||||
|
||||
class dump:
|
||||
@ -260,7 +270,7 @@ class dump:
|
||||
|
||||
# sort entries by timestep, cull duplicates
|
||||
|
||||
self.snaps.sort(self.compare_time)
|
||||
self.snaps.sort(key=cmp2key(self.compare_time))
|
||||
self.cull()
|
||||
self.nsnaps = len(self.snaps)
|
||||
print("read %d snapshots" % self.nsnaps)
|
||||
@ -379,10 +389,7 @@ class dump:
|
||||
for i in range(1,snap.natoms):
|
||||
words += f.readline().decode().split()
|
||||
floats = map(float,words)
|
||||
if oldnumeric:
|
||||
atom_data = np.array(list(floats),np.Float)
|
||||
else:
|
||||
atom_data = np.array(list(floats),np.float)
|
||||
atom_data = np.array(list(floats),np.float)
|
||||
|
||||
snap.atoms = atom_data.reshape((snap.natoms, ncol))
|
||||
else:
|
||||
@ -858,8 +865,7 @@ class dump:
|
||||
self.map(ncol+1,str)
|
||||
for snap in self.snaps:
|
||||
atoms = snap.atoms
|
||||
if oldnumeric: newatoms = np.zeros((snap.natoms,ncol+1),np.Float)
|
||||
else: newatoms = np.zeros((snap.natoms,ncol+1),np.float)
|
||||
newatoms = np.zeros((snap.natoms,ncol+1),np.float)
|
||||
newatoms[:,0:ncol] = snap.atoms
|
||||
snap.atoms = newatoms
|
||||
|
||||
@ -1018,8 +1024,7 @@ class dump:
|
||||
|
||||
# convert values to int and absolute value since can be negative types
|
||||
|
||||
if oldnumeric: bondlist = np.zeros((nbonds,4),np.Int)
|
||||
else: bondlist = np.zeros((nbonds,4),np.int)
|
||||
bondlist = np.zeros((nbonds,4),np.int)
|
||||
ints = [abs(int(value)) for value in words]
|
||||
start = 0
|
||||
stop = 4
|
||||
|
||||
Reference in New Issue
Block a user