Merge branch 'master' into fep

This commit is contained in:
Agilio Padua
2021-03-08 23:21:11 +01:00
22 changed files with 2315 additions and 2288 deletions

View File

@ -1,6 +1,6 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@ -301,9 +301,8 @@ one line to give the program's name and an idea of what it does.
Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of

View File

@ -26,7 +26,14 @@ find_package(Git)
# by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "default install path" FORCE )
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "Default install path" FORCE)
endif()
# If enabled, no need to use LD_LIBRARY_PATH / DYLD_LIBRARY_PATH when installed
option(LAMMPS_INSTALL_RPATH "Set runtime path for shared libraries linked to LAMMPS binaries" OFF)
if (LAMMPS_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
endif()
# Cmake modules/macros are in a subdirectory to keep this file cleaner

View File

@ -526,6 +526,20 @@ you want to copy files to is protected.
make # perform make after CMake command
make install # perform the installation into prefix
During the installation process CMake will by default remove any runtime
path settings for loading shared libraries. Because of this you may
have to set or modify the ``LD_LIBRARY_PATH`` (or ``DYLD_LIBRARY_PATH``)
environment variable, if you are installing LAMMPS into a non-system
location and/or are linking to libraries in a non-system location that
depend on such runtime path settings.
As an alternative you may set the CMake variable ``LAMMPS_INSTALL_RPATH``
to ``on`` and then the runtime paths for any linked shared libraries
and the library installation folder for the LAMMPS library will be
embedded and thus the requirement to set environment variables is avoided.
The ``off`` setting is usually preferred for packaged binaries or when
setting up environment modules, the ``on`` setting is more convenient
for installing software into a non-system or personal folder.
.. tab:: Traditional make
There is no "install" option in the ``src/Makefile`` for LAMMPS.

View File

@ -296,6 +296,8 @@ Some common CMake variables
- Description
* - ``CMAKE_INSTALL_PREFIX``
- root directory of install location for ``make install`` (default: ``$HOME/.local``)
* - ``LAMMPS_INSTALL_RPATH``
- set or remove runtime path setting from binaries for ``make install`` (default: ``off``)
* - ``CMAKE_BUILD_TYPE``
- controls compilation options:
one of ``RelWithDebInfo`` (default), ``Release``, ``Debug``, ``MinSizeRel``

View File

@ -13,7 +13,7 @@ Syntax
* N = # of atom types to use in this simulation
* region-ID = ID of region to use as simulation domain
* zero or more keyword/value pairs may be appended
* keyword = *bond/types* or *angle/types* or *dihedral/types* or *improper/types* or *extra/bond/per/atom* or *extra/angle/per/atom* or *extra/dihedral/per/atom* or *extra/improper/per/atom*
* keyword = *bond/types* or *angle/types* or *dihedral/types* or *improper/types* or *extra/bond/per/atom* or *extra/angle/per/atom* or *extra/dihedral/per/atom* or *extra/improper/per/atom* or *extra/special/per/atom*
.. parsed-literal::

View File

@ -26,7 +26,7 @@ Masses
7 12.0112
8 1.00797
Pair Coeffs # lj/class2/coul/long
Pair Coeffs # hybrid
1 lj/class2/coul/long 0.054 4.01
2 lj/class2/coul/long 0.054 4.01

View File

@ -12,7 +12,7 @@ improper_style class2
pair_modify mix sixthpower tail yes
special_bonds lj/coul 0 0 1
read_data data.init_conf_without_heptane
read_data data.init_conf_with_heptane
pair_coeff 1 6 lj/class2/coul/long/soft 0.054 4.01 0.0
pair_coeff 2 6 lj/class2/coul/long/soft 0.054 4.01 0.0
@ -47,7 +47,7 @@ fix ADAPT all adapt/fep 10 &
atom charge 8 v_q3 &
after yes
thermo_style custom step spcpu temp press vol etotal pe v_lambda v_q1 v_q2 v_q3
thermo_style custom step temp press vol etotal pe v_lambda v_q1 v_q2 v_q3
thermo_modify line one
thermo 100

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ Masses
7 12.0112
8 1.00797
Pair Coeffs # lj/class2/coul/long
Pair Coeffs # hybrid
1 lj/class2/coul/long 0.054 4.01
2 lj/class2/coul/long 0.054 4.01

View File

@ -47,7 +47,7 @@ fix ADAPT all adapt/fep 10 &
atom charge 8 v_q3 &
after yes
thermo_style custom step spcpu temp press vol etotal pe v_lambda v_q1 v_q2 v_q3
thermo_style custom step temp press vol etotal pe v_lambda v_q1 v_q2 v_q3
thermo_modify line one
thermo 100

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -121,18 +121,16 @@ class lammps(object):
lib_ext = ".so"
if not self.lib:
try:
if not name:
self.lib = CDLL(join(modpath,"liblammps" + lib_ext),RTLD_GLOBAL)
if name:
libpath = join(modpath,"liblammps_%s" % name + lib_ext)
else:
libpath = join(modpath,"liblammps" + lib_ext)
if not os.path.isfile(libpath):
if name:
libpath = "liblammps_%s" % name + lib_ext
else:
self.lib = CDLL(join(modpath,"liblammps_%s" % name + lib_ext),
RTLD_GLOBAL)
except:
if not name:
self.lib = CDLL("liblammps" + lib_ext,RTLD_GLOBAL)
else:
self.lib = CDLL("liblammps_%s" % name + lib_ext,RTLD_GLOBAL)
libpath = "liblammps" + lib_ext
self.lib = CDLL(libpath,RTLD_GLOBAL)
# declare all argument and return types for all library methods here.
# exceptions are where the arguments depend on certain conditions and

View File

@ -371,6 +371,14 @@ void FixPour::init()
}
}
/* ---------------------------------------------------------------------- */
void FixPour::setup_pre_exchange()
{
if (ninserted < ninsert) next_reneighbor = update->ntimestep + 1;
else next_reneighbor = 0;
}
/* ----------------------------------------------------------------------
perform particle insertion
------------------------------------------------------------------------- */

View File

@ -30,6 +30,7 @@ class FixPour : public Fix {
~FixPour();
int setmask();
void init();
void setup_pre_exchange();
void pre_exchange();
void reset_dt();
void *extract(const char *, int &);
@ -63,7 +64,8 @@ class FixPour : public Fix {
int me,nprocs;
int *recvcounts,*displs;
int nfreq,nfirst,ninserted,nper;
int nfreq,ninserted,nper;
bigint nfirst;
double lo_current,hi_current;
tagint maxtag_all,maxmol_all;
class RanPark *random,*random2;

View File

@ -292,6 +292,14 @@ void FixDeposit::init()
}
}
/* ---------------------------------------------------------------------- */
void FixDeposit::setup_pre_exchange()
{
if (ninserted < ninsert) next_reneighbor = update->ntimestep+1;
else next_reneighbor = 0;
}
/* ----------------------------------------------------------------------
perform particle insertion
------------------------------------------------------------------------- */
@ -833,7 +841,7 @@ void FixDeposit::write_restart(FILE *fp)
double list[5];
list[n++] = random->state();
list[n++] = ninserted;
list[n++] = nfirst;
list[n++] = ubuf(nfirst).d;
list[n++] = ubuf(next_reneighbor).d;
list[n++] = ubuf(update->ntimestep).d;
@ -853,12 +861,12 @@ void FixDeposit::restart(char *buf)
int n = 0;
double *list = (double *) buf;
seed = static_cast<int> (list[n++]);
ninserted = static_cast<int> (list[n++]);
nfirst = static_cast<int> (list[n++]);
next_reneighbor = (bigint) ubuf(list[n++]).i;
seed = static_cast<int>(list[n++]);
ninserted = static_cast<int>(list[n++]);
nfirst = static_cast<bigint>(ubuf(list[n++]).i);
next_reneighbor = static_cast<bigint>(ubuf(list[n++]).i);
bigint ntimestep_restart = (bigint) ubuf(list[n++]).i;
bigint ntimestep_restart = static_cast<bigint>(ubuf(list[n++]).i);
if (ntimestep_restart != update->ntimestep)
error->all(FLERR,"Must not reset timestep when restarting this fix");

View File

@ -30,6 +30,7 @@ class FixDeposit : public Fix {
~FixDeposit();
int setmask();
void init();
void setup_pre_exchange();
void pre_exchange();
void write_restart(FILE *);
void restart(char *);
@ -54,7 +55,8 @@ class FixDeposit : public Fix {
class Fix *fixrigid,*fixshake;
double oneradius;
int nfirst,ninserted;
int ninserted;
bigint nfirst;
tagint maxtag_all,maxmol_all;
class RanPark *random;

View File

@ -49,14 +49,19 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) {
python->init();
// add current directory to PYTHONPATH
PyObject * py_path = PySys_GetObject((char *)"path");
PyGILState_STATE gstate = PyGILState_Ensure();
PyObject *py_path = PySys_GetObject((char *)"path");
PyList_Append(py_path, PY_STRING_FROM_STRING("."));
// if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well
const char * potentials_path = getenv("LAMMPS_POTENTIALS");
// if LAMMPS_POTENTIALS environment variable is set,
// add it to PYTHONPATH as well
const char *potentials_path = getenv("LAMMPS_POTENTIALS");
if (potentials_path != nullptr) {
PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path));
}
PyGILState_Release(gstate);
}
/* ---------------------------------------------------------------------- */

View File

@ -59,16 +59,19 @@ void ImbalanceTime::compute(double *weight)
// cost = CPU time for relevant timers since last invocation
// localwt = weight assigned to each owned atom
// just return if no time yet tallied
// we 0.1 seconds as a minimum time to avoid computation of bogus
// load balancing weights due to limited timer resolution/precision
double cost = -last;
cost += timer->get_wall(Timer::PAIR);
cost += timer->get_wall(Timer::NEIGH);
cost += timer->get_wall(Timer::BOND);
cost += timer->get_wall(Timer::KSPACE);
cost += 0.1;
double maxcost;
MPI_Allreduce(&cost,&maxcost,1,MPI_DOUBLE,MPI_MAX,world);
if (maxcost <= 0.0) return;
if (maxcost <= 0.1) return;
int nlocal = atom->nlocal;
double localwt = 0.0;

View File

@ -64,9 +64,15 @@ int main(int argc, char **argv)
exit(1);
}
#else
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
lammps->input->file();
delete lammps;
try {
LAMMPS *lammps = new LAMMPS(argc,argv,MPI_COMM_WORLD);
lammps->input->file();
delete lammps;
} catch(fmt::format_error &fe) {
fprintf(stderr,"fmt::format_error: %s\n", fe.what());
MPI_Abort(MPI_COMM_WORLD, 1);
exit(1);
}
#endif
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();

View File

@ -414,6 +414,9 @@ void utils::bounds(const char *file, int line, const std::string &str,
}
if (error) {
if ((nlo <= 0) || (nhi <=0))
error->all(file,line,fmt::format("Invalid range string: {}",str));
if (nlo < nmin)
error->all(file,line,fmt::format("Numeric index {} is out of bounds"
"({}-{})",nlo,nmin,nmax));
@ -688,7 +691,7 @@ std::string utils::utf8_subst(const std::string &line)
out += ' ', i += 2;
}
// UTF-8 4-byte character
} else if ((in[i] & 0xe8U) == 0xf0U) {
} else if ((in[i] & 0xf8U) == 0xf0U) {
if ((i+3) < len) {
;
}