fix gcmc updates from Aidan, trimming of output for replica commands

This commit is contained in:
Steve Plimpton
2017-04-11 08:35:09 -06:00
parent 76fd936972
commit 49dd9449b8
21 changed files with 363 additions and 234 deletions

View File

@ -455,8 +455,7 @@ and related PPPM operations are somewhat insensitive to floating point
truncation errors and thus do not always need to be performed in
double precision. Using the -DFFT_SINGLE setting trades off a little
accuracy for reduced memory use and parallel communication costs for
transposing 3d FFT data. Note that single precision FFTs have only
been tested with the FFTW3, FFTW2, MKL, and KISS FFT options.
transposing 3d FFT data.
Step 7 :h6

View File

@ -75,7 +75,7 @@ Lennard-Jones 12/6) given by
:c,image(Eqs/pair_buck.jpg)
where rho is an ionic-pair dependent length parameter, and Rc is the
cutoff on both terms.
cutoff on both terms.
The styles with {coul/cut} or {coul/long} or {coul/msm} add a
Coulombic term as described for the "lj/cut"_pair_lj.html pair styles.
@ -120,6 +120,9 @@ cutoff (distance units)
cutoff2 (distance units) :ul
The second coefficient, rho, must be greater than zero.
The coefficients A, rho, and C can be written as analytical expressions
of epsilon and sigma, in analogy to the Lennard-Jones potential
"(Khrapak)"_#Khrapak.
The latter 2 coefficients are optional. If not specified, the global
A,C and Coulombic cutoffs are used. If only one cutoff is specified,
@ -127,7 +130,6 @@ it is used as the cutoff for both A,C and Coulombic interactions for
this type pair. If both coefficients are specified, they are used as
the A,C and Coulombic cutoffs for this type pair. You cannot specify
2 cutoffs for style {buck}, since it has no Coulombic terms.
For {buck/coul/long} only the LJ cutoff can be specified since a
Coulombic cutoff cannot be specified for an individual I,J type pair.
All type pairs use the same global Coulombic cutoff specified in the
@ -194,3 +196,6 @@ only enabled if LAMMPS was built with that package. See the
"pair_coeff"_pair_coeff.html, "pair_style born"_pair_born.html
[Default:] none
:link(Khrapak)
[(Khrapak)] Khrapak, Chaudhuri, and Morfill, J Chem Phys, 134, 054120 (2011).

116
lib/voronoi/Install.py Normal file
View File

@ -0,0 +1,116 @@
#!/usr/bin/env python
# install.py tool to download, unpack, build, and link to the Voro++ library
# used to automate the steps described in the README file in this dir
import sys,os,re,urllib,commands
# help message
help = """
Syntax: install.py -v version -g gdir [gname] -b bdir -l ldir
specify one or more options, order does not matter
gdir,bdir,ldir can be paths relative to lib/latte, full paths, or contain ~
-v = version of Voro++ to download and build
default = voro++-0.4.6 (current as of Jan 2015)
-g = grab (download) from math.lbl.gov/voro++ website
unpack tarfile in gdir to produce version dir (e.g. voro++-0.4.6)
if optional gname specified, rename version dir to gname within gdir
-b = build Voro++, bdir = Voro++ home directory
note that bdir must include the version suffix unless renamed
-l = create 2 softlinks (includelink,liblink)
in lib/voronoi to src dir of ldir = Voro++ home directory
note that ldir must include the version suffix unless renamed
"""
# settings
version = "voro++-0.4.6"
url = "http://math.lbl.gov/voro++/download/dir/%s.tar.gz" % version
# print error message or help
def error(str=None):
if not str: print help
else: print "ERROR",str
sys.exit()
# expand to full path name
# process leading '~' or relative path
def fullpath(path):
return os.path.abspath(os.path.expanduser(path))
# parse args
args = sys.argv[1:]
nargs = len(args)
if nargs == 0: error()
grabflag = 0
buildflag = 0
linkflag = 0
iarg = 0
while iarg < nargs:
if args[iarg] == "-v":
if iarg+2 > nargs: error()
version = args[iarg+1]
iarg += 2
elif args[iarg] == "-g":
if iarg+2 > nargs: error()
grabflag = 1
grabdir = args[iarg+1]
grabname = None
if iarg+2 < nargs and args[iarg+2][0] != '-':
grabname = args[iarg+2]
iarg += 1
iarg += 2
elif args[iarg] == "-b":
if iarg+2 > nargs: error()
buildflag = 1
builddir = args[iarg+1]
iarg += 2
elif args[iarg] == "-l":
if iarg+2 > nargs: error()
linkflag = 1
linkdir = args[iarg+1]
iarg += 2
else: error()
# download and unpack Voro++ tarball
if grabflag:
print "Downloading Voro++ ..."
grabdir = fullpath(grabdir)
if not os.path.isdir(grabdir): error("Grab directory does not exist")
urllib.urlretrieve(url,"%s/%s.tar.gz" % (grabdir,version))
print "Unpacking Voro++ tarball ..."
tardir = "%s/%s" % (grabdir,version)
if os.path.exists(tardir): commands.getoutput("rm -rf %s" % tardir)
cmd = "cd %s; tar zxvf %s.tar.gz" % (grabdir,version)
txt = commands.getoutput(cmd)
print tardir,grabdir,grabname
if grabname: os.rename(tardir,"%s/%s" % (grabdir,grabname))
# build Voro++
if buildflag:
print "Building Voro++ ..."
cmd = "cd %s; make" % builddir
txt = commands.getoutput(cmd)
print txt
# create 2 links in lib/voronoi to Voro++ src dir
if linkflag:
print "Creating links to Voro++ include and lib files"
if os.path.isfile("includelink") or os.path.islink("includelink"):
os.remove("includelink")
if os.path.isfile("liblink") or os.path.islink("liblink"):
os.remove("liblink")
cmd = "ln -s %s/src includelink" % linkdir
commands.getoutput(cmd)
cmd = "ln -s %s/src liblink" % linkdir
commands.getoutput(cmd)

View File

@ -9,8 +9,8 @@ Laboratory.
-----------------
You must perform the following steps yourself, or you can use the
install.py Python script to automate any or all steps of the process.
Type "python install.py" for instructions.
Install.py Python script to automate any or all steps of the process.
Type "python Install.py" for instructions.
1. Download Voro++ at http://math.lbl.gov/voro++/download
either as a tarball or via SVN, and unpack the

View File

@ -1,163 +0,0 @@
#!usr/local/python
# install.py tool to download, unpack, build, and link to the Voro++ library
# used to automate the steps described in the README file in this dir
import sys,os,re,urllib,commands
help = """
Syntax: install.py -d dir -v version -g -b -i installdir -l incdir libdir
specify one or more options, order does not matter
-d = dir to download tarball to, unpack tarball in, perform build in
dir will be created if it doesn't exist (only last level)
default = this dir
-v = version of Voro++ to download and work with
default = voro++-0.4.6 (current as of Jan 2015)
-g = download (grab) tarball from
http://math.lbl.gov/voro++/download/dir/version
-b = build Voro++ by invoking "make" in its home dir
no default
-i = install Voro++ by invoking "make install" in its home dir
installdir arg is optional:
if not specified, installs at PREFIX defined in config.mk file
if specified, will overwrite PREFIX and install there
if PREFIX starts with /usr, will invoke "sudo make install"
-l = create two links to incdir and libdir
incdir and libdir are optional (specify neither or both):
if specified, includelink and liblink are to those two dirs
these are dirs where Voro++ include files and lib file are
if not specified and no install, links are to Voro++ src dir
if not specified and install performed,
links are to include and lib dirs under PREFIX
"""
def error():
print help
sys.exit()
# parse args
args = sys.argv
if len(args) == 1: error()
dir = "."
version = "voro++-0.4.6"
grabflag = 0
buildflag = 0
installflag = 0
linkflag = 0
iarg = 1
while iarg < len(args):
if args[iarg] == "-d":
if iarg+2 > len(args): error()
dir = args[iarg+1]
iarg += 2
elif args[iarg] == "-v":
if iarg+2 > len(args): error()
version = args[iarg+1]
iarg += 2
elif args[iarg] == "-g":
grabflag = 1
iarg += 1
elif args[iarg] == "-b":
buildflag = 1
iarg += 1
elif args[iarg] == "-i":
installflag = 1
if iarg+1 == len(args) or args[iarg+1][0] == '-':
installdir = ""
iarg += 1
else:
if iarg+2 > len(args): error()
installdir = args[iarg+1]
iarg += 2
elif args[iarg] == "-l":
linkflag = 1
if iarg+1 == len(args) or args[iarg+1][0] == '-' or \
iarg+2 == len(args) or args[iarg+2][0] == '-':
includedir = libdir = ""
iarg += 1
else:
if iarg+3 > len(args): error()
includedir = args[iarg+1]
libdir = args[iarg+2]
iarg += 3
else: error()
dir = os.path.abspath(dir)
url = "http://math.lbl.gov/voro++/download/dir/%s.tar.gz" % version
# create dir if does not exist
if not os.path.isdir(dir):
if os.path.isfile(dir):
print "ERROR: Dir already exists as file"
sys.exit()
os.mkdir(dir)
if not os.path.isdir(dir):
print "ERROR: Unable to create dir"
sys.exit()
# download and unpack tarball
if grabflag:
print "Downloading Voro++ tarball ..."
urllib.urlretrieve(url,"%s/%s.tar.gz" % (dir,version))
print "Unpacking Voro++ tarball ..."
cmd = "cd %s; tar zxvf %s.tar.gz" % (dir,version)
txt = commands.getoutput(cmd)
# build Voro++ in its dir
if buildflag:
print "Building Voro++ ..."
cmd = "cd %s/%s; make" % (dir,version)
txt = commands.getoutput(cmd)
print txt
# install Voro++
# if installdir set, overwrite PREFIX var in its config.mk file
# if PREFIX var starts with /usr, invoke sudo make install, else make install
if installflag:
print "Installing Voro++ ..."
if installdir:
txt = open("%s/%s/config.mk" % (dir,version),'r').read()
txt = re.sub("PREFIX=.*?\n","PREFIX=%s\n" % installdir,txt)
open("%s/%s/config.mk" % (dir,version),'w').write(txt)
print "TXT:",txt
txt = open("%s/%s/config.mk" % (dir,version),'r').read()
var = re.findall("PREFIX=.*?\n",txt)
prefix = var[0].split('=')[1].strip()
if prefix.startswith("/usr"):
cmd = "cd %s/%s; sudo make install" % (dir,version)
else:
cmd = "cd %s/%s; make install" % (dir,version)
txt = commands.getoutput(cmd)
print txt
# create links in this dir to Voro++ include and lib files
if linkflag:
print "Creating links to Voro++ include and lib files"
if os.path.isfile("includelink") or os.path.islink("includelink"):
os.remove("includelink")
if os.path.isfile("liblink") or os.path.islink("liblink"):
os.remove("liblink")
if includedir:
cmd = "ln -s %s includelink" % includedir
txt = commands.getoutput(cmd)
cmd = "ln -s %s liblink" % linkdir
txt = commands.getoutput(cmd)
elif not installflag:
cmd = "ln -s %s/%s/src includelink" % (dir,version)
txt = commands.getoutput(cmd)
cmd = "ln -s %s/%s/src liblink" % (dir,version)
txt = commands.getoutput(cmd)
else:
cmd = "ln -s %s/include includelink" % prefix
txt = commands.getoutput(cmd)
cmd = "ln -s %s/lib liblink" % prefix
txt = commands.getoutput(cmd)

View File

@ -60,7 +60,7 @@ using namespace MathConst;
// this must be lower than MAXENERGYSIGNAL
// by a large amount, so that it is still
// less than total energy when negative
// energy changes are added to MAXENERGYSIGNAL
// energy contributions are added to MAXENERGYSIGNAL
#define MAXENERGYTEST 1.0e50
@ -701,6 +701,9 @@ void FixGCMC::pre_exchange()
if (full_flag) {
energy_stored = energy_full();
if (overlap_flag && energy_stored > MAXENERGYTEST)
error->warning(FLERR,"Energy of old configuration in "
"fix gcmc is > MAXENERGYTEST.");
if (mode == MOLECULE) {
for (int i = 0; i < ncycles; i++) {
@ -778,6 +781,9 @@ void FixGCMC::attempt_atomic_translation()
if (i >= 0) {
double **x = atom->x;
double energy_before = energy(i,ngcmc_type,-1,x[i]);
if (overlap_flag && energy_before > MAXENERGYTEST)
error->warning(FLERR,"Energy of old configuration in "
"fix gcmc is > MAXENERGYTEST.");
double rsq = 1.1;
double rx,ry,rz;
rx = ry = rz = 0.0;
@ -998,6 +1004,9 @@ void FixGCMC::attempt_molecule_translation()
if (translation_molecule == -1) return;
double energy_before_sum = molecule_energy(translation_molecule);
if (overlap_flag && energy_before_sum > MAXENERGYTEST)
error->warning(FLERR,"Energy of old configuration in "
"fix gcmc is > MAXENERGYTEST.");
double **x = atom->x;
double rx,ry,rz;
@ -1095,6 +1104,9 @@ void FixGCMC::attempt_molecule_rotation()
if (rotation_molecule == -1) return;
double energy_before_sum = molecule_energy(rotation_molecule);
if (overlap_flag && energy_before_sum > MAXENERGYTEST)
error->warning(FLERR,"Energy of old configuration in "
"fix gcmc is > MAXENERGYTEST.");
int nlocal = atom->nlocal;
int *mask = atom->mask;
@ -2170,6 +2182,8 @@ double FixGCMC::molecule_energy(tagint gas_molecule_id)
double FixGCMC::energy_full()
{
int imolecule;
if (triclinic) domain->x2lamda(atom->nlocal);
domain->pbc();
comm->exchange();
@ -2185,14 +2199,15 @@ double FixGCMC::energy_full()
// return signal value for energy
if (overlap_flag) {
int overlaptestall;
int overlaptest = 0;
double delx,dely,delz,rsq;
double **x = atom->x;
tagint *molecule = atom->molecule;
int nall = atom->nlocal + atom->nghost;
for (int i = 0; i < atom->nlocal; i++) {
int imolecule = molecule[i];
if (mode == MOLECULE) imolecule = molecule[i];
for (int j = i+1; j < nall; j++) {
if (mode == MOLECULE)
if (imolecule == molecule[j]) continue;
@ -2201,11 +2216,18 @@ double FixGCMC::energy_full()
delz = x[i][2] - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
if (rsq < overlap_cutoff) return MAXENERGYSIGNAL;
if (rsq < overlap_cutoff) {
overlaptest = 1;
break;
}
}
if (overlaptest) break;
}
MPI_Allreduce(&overlaptest, &overlaptestall, 1,
MPI_INT, MPI_MAX, world);
if (overlaptestall) return MAXENERGYSIGNAL;
}
// clear forces so they don't accumulate over multiple
// calls within fix gcmc timestep, e.g. for fix shake

View File

@ -106,7 +106,7 @@ class FixGCMC : public Fix {
double xlo,xhi,ylo,yhi,zlo,zhi;
double region_xlo,region_xhi,region_ylo,region_yhi,region_zlo,region_zhi;
double region_volume;
double energy_stored;
double energy_stored; // full energy of old/current configuration
double *sublo,*subhi;
int *local_gas_list;
double **cutsq;
@ -214,9 +214,14 @@ W: Fix gcmc using full_energy option
Fix gcmc has automatically turned on the full_energy option since it
is required for systems like the one specified by the user. User input
included one or more of the following: kspace, triclinic, a hybrid
pair style, an eam pair style, or no "single" function for the pair
style.
included one or more of the following: kspace, a hybrid
pair style, an eam pair style, tail correction,
or no "single" function for the pair style.
W: Energy of old configuration in fix gcmc is > MAXENERGYTEST.
This probably means that a pair of atoms are closer than the
overlap cutoff distance for keyword overlap_cutoff.
E: Invalid atom type in fix gcmc command

View File

@ -43,6 +43,15 @@ endif
# Package variables
# PACKAGE = standard packages
# PACKUSER = user packagse
# PACKLIB = all packages that require an additional lib
# PACKSYS = subset that reqiure a common system library
# PACKINT = subset that require an internal (provided) library
# PACKEXT = subset that require an external (downloaded) library
# PACKLIB = PACKSYS + PACKING + PACKEXT
# PACKSCRIPT = libs under lammps/lib that have an Install.py script
PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \
granular kim kokkos kspace manybody mc meam misc molecule \
mpiio mscg opt peri poems \
@ -55,10 +64,21 @@ PACKUSER = user-atc user-awpmd user-cg-cmm user-cgdna user-colvars \
user-quip user-reaxc user-smd user-smtbq user-sph user-tally \
user-vtk
PACKLIB = compress gpu kim kokkos meam mpiio mscg poems python reax voronoi \
user-atc user-awpmd user-colvars user-h5md user-lb user-molfile \
PACKLIB = compress gpu kim kokkos meam mpiio mscg poems \
python reax voronoi \
user-atc user-awpmd user-colvars user-h5md user-molfile \
user-nc-dump user-qmmm user-quip user-smd user-vtk
PACKSYS = compress mpiio python
PACKINT = gpu kokkos meam poems reax user-atc user-awpmd user-colvars
PACKEXT = kim mscg voronoi \
user-h5md user-molfile user-nc-dump user-qmmm user-quip \
user-smd user-vtk
PACKSCRIPT = voronoi
PACKALL = $(PACKAGE) $(PACKUSER)
PACKAGEUC = $(shell echo $(PACKAGE) | tr a-z A-Z)
@ -66,6 +86,7 @@ PACKUSERUC = $(shell echo $(PACKUSER) | tr a-z A-Z)
YESDIR = $(shell echo $(@:yes-%=%) | tr a-z A-Z)
NODIR = $(shell echo $(@:no-%=%) | tr a-z A-Z)
LIBDIR = $(shell echo $(@:lib-%=%))
# List of all targets
@ -75,9 +96,9 @@ help:
@echo 'make clean-machine delete object files for one machine'
@echo 'make mpi-stubs build dummy MPI library in STUBS'
@echo 'make install-python install LAMMPS wrapper in Python'
@echo 'make tar create lmp_src.tar.gz of src dir and packages'
@echo 'make tar create lmp_src.tar.gz for src dir and packages'
@echo ''
@echo 'make package list available packages'
@echo 'make package list available packages and their dependencies'
@echo 'make package-status (ps) status of all packages'
@echo 'make yes-package install a single pgk in src dir'
@echo 'make no-package remove a single pkg from src dir'
@ -87,11 +108,16 @@ help:
@echo 'make no-standard (no-std) remove all standard pkgs'
@echo 'make yes-user install all user pkgs'
@echo 'make no-user remove all user pkgs'
@echo 'make no-lib remove all pkgs with external libs'
@echo 'make yes-lib install all pkgs with libs (incldued or ext)'
@echo 'make no-lib remove all pkgs with libs (included or ext)'
@echo 'make yes-ext install all pkgs with external libs'
@echo 'make no-ext remove all pkgs with external libs'
@echo ''
@echo 'make package-update (pu) replace src files with updated package files'
@echo 'make package-overwrite replace package files with src files'
@echo 'make package-diff (pd) diff src files against package files'
@echo ''
@echo 'make lib-package download/build/install a package library'
@echo 'make purge purge obsolete copies of source files'
@echo ''
@echo 'make machine build LAMMPS for machine'
@ -221,6 +247,13 @@ package:
@echo ''
@echo 'User-contributed packages:' $(PACKUSER)
@echo ''
@echo 'Packages that need system libraries:' $(PACKSYS)
@echo ''
@echo 'Packages that need provided libraries:' $(PACKINT)
@echo ''
@echo 'Packages that need external libraries:' $(PACKEXT)
@echo ''
@echo 'make package list available packages'
@echo 'make package list available packages'
@echo 'make package-status (ps) status of all packages'
@echo 'make yes-package install a single pgk in src dir'
@ -229,13 +262,18 @@ package:
@echo 'make no-all remove all pkgs from src dir'
@echo 'make yes-standard (yes-std) install all standard pkgs'
@echo 'make no-standard (no-srd) remove all standard pkgs'
@echo ''
@echo 'make yes-user install all user pkgs'
@echo 'make no-user remove all user pkgs'
@echo 'make no-lib remove all pkgs with external libs'
@echo 'make yes-lib install all pkgs with libs (included or ext)'
@echo 'make no-lib remove all pkgs with libs (included or ext)'
@echo 'make yes-ext install all pkgs with external libs'
@echo 'make no-ext remove all pkgs with external libs'
@echo ''
@echo 'make package-update (pu) replace src files with package files'
@echo 'make package-overwrite replace package files with src files'
@echo 'make package-diff (pd) diff src files against package file'
@echo ''
@echo 'make lib-package download/build/install a package library'
yes-all:
@for p in $(PACKALL); do $(MAKE) yes-$$p; done
@ -255,9 +293,18 @@ yes-user:
no-user:
@for p in $(PACKUSER); do $(MAKE) no-$$p; done
yes-lib:
@for p in $(PACKLIB); do $(MAKE) yes-$$p; done
no-lib:
@for p in $(PACKLIB); do $(MAKE) no-$$p; done
yes-ext:
@for p in $(PACKEXT); do $(MAKE) yes-$$p; done
no-ext:
@for p in $(PACKEXT); do $(MAKE) no-$$p; done
yes-%:
@if [ ! -e Makefile.package ]; \
then cp Makefile.package.empty Makefile.package; fi
@ -288,6 +335,16 @@ no-%:
$(SHELL) Depend.sh $(NODIR) 0; \
fi;
# download/build/install a package library
lib-%:
@if [ ! -e ../lib/$(LIBDIR)/Install.py ]; then \
echo "Install script for lib $(@:lib-%=%) does not exist"; \
else \
echo "Installing lib for package $(@:lib-%=%)"; \
cd ../lib/$(LIBDIR); python Install.py $(args); \
fi;
# status = list src files that differ from package files
# update = replace src files with newer package files
# overwrite = overwrite package files with newer src files

View File

@ -84,7 +84,7 @@ void ComputeEventDisplace::init()
}
/* ----------------------------------------------------------------------
return non-zero if an atom has moved > displace_dist since last event
return non-zero if any atom has moved > displace_dist since last event
------------------------------------------------------------------------- */
double ComputeEventDisplace::compute_scalar()
@ -145,6 +145,62 @@ double ComputeEventDisplace::compute_scalar()
return scalar;
}
/* ----------------------------------------------------------------------
return count of atoms that have moved > displace_dist since last event
------------------------------------------------------------------------- */
int ComputeEventDisplace::all_events()
{
invoked_scalar = update->ntimestep;
if (id_event == NULL) return 0.0;
int event = 0;
double **xevent = fix_event->array_atom;
double **x = atom->x;
int *mask = atom->mask;
imageint *image = atom->image;
int nlocal = atom->nlocal;
double *h = domain->h;
double xprd = domain->xprd;
double yprd = domain->yprd;
double zprd = domain->zprd;
int xbox,ybox,zbox;
double dx,dy,dz,rsq;
if (triclinic == 0) {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xevent[i][0];
dy = x[i][1] + ybox*yprd - xevent[i][1];
dz = x[i][2] + zbox*zprd - xevent[i][2];
rsq = dx*dx + dy*dy + dz*dz;
if (rsq >= displace_distsq) event++;
}
} else {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox - xevent[i][0];
dy = x[i][1] + h[1]*ybox + h[3]*zbox - xevent[i][1];
dz = x[i][2] + h[2]*zbox - xevent[i][2];
rsq = dx*dx + dy*dy + dz*dz;
if (rsq >= displace_distsq) event++;
}
}
int allevents;
MPI_Allreduce(&event,&allevents,1,MPI_INT,MPI_SUM,world);
return allevents;
}
/* ---------------------------------------------------------------------- */

View File

@ -30,8 +30,11 @@ class ComputeEventDisplace : public Compute {
~ComputeEventDisplace();
void init();
double compute_scalar();
int all_events();
void reset_extra_compute_fix(const char *);
private:
int triclinic;
double displace_distsq;

View File

@ -130,7 +130,7 @@ void Finish::end(int flag)
atom->natoms);
if (logfile) fprintf(logfile,fmt1,time_loop,ntasks,update->nsteps,
atom->natoms);
// Gromacs/NAMD-style performance metric for suitable unit settings
if ( timeflag && !minflag && !prdflag && !tadflag &&
@ -144,7 +144,7 @@ void Finish::end(int flag)
double one_fs = force->femtosecond;
double t_step = ((double) time_loop) / ((double) update->nsteps);
double step_t = 1.0/t_step;
if (strcmp(update->unit_style,"lj") == 0) {
double tau_day = 24.0*3600.0 / t_step * update->dt / one_fs;
const char perf[] = "Performance: %.3f tau/day, %.3f timesteps/s\n";
@ -161,26 +161,28 @@ void Finish::end(int flag)
}
// CPU use on MPI tasks and OpenMP threads
if (lmp->kokkos) {
const char fmt2[] =
"%.1f%% CPU use with %d MPI tasks x %d OpenMP threads\n";
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs,
lmp->kokkos->num_threads);
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs,
lmp->kokkos->num_threads);
} else {
if (timeflag) {
if (lmp->kokkos) {
const char fmt2[] =
"%.1f%% CPU use with %d MPI tasks x %d OpenMP threads\n";
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs,
lmp->kokkos->num_threads);
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs,
lmp->kokkos->num_threads);
} else {
#if defined(_OPENMP)
const char fmt2[] =
"%.1f%% CPU use with %d MPI tasks x %d OpenMP threads\n";
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs,nthreads);
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs,nthreads);
const char fmt2[] =
"%.1f%% CPU use with %d MPI tasks x %d OpenMP threads\n";
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs,nthreads);
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs,nthreads);
#else
const char fmt2[] =
"%.1f%% CPU use with %d MPI tasks x no OpenMP threads\n";
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs);
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs);
const char fmt2[] =
"%.1f%% CPU use with %d MPI tasks x no OpenMP threads\n";
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs);
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs);
#endif
}
}
}
}

View File

@ -23,7 +23,7 @@ class Integrate : protected Pointers {
Integrate(class LAMMPS *, int, char **);
virtual ~Integrate();
virtual void init();
virtual void setup() = 0;
virtual void setup(int flag=1) = 0;
virtual void setup_minimal(int) = 0;
virtual void run(int) = 0;
virtual void cleanup() {}

View File

@ -180,13 +180,15 @@ void Min::init()
setup before run
------------------------------------------------------------------------- */
void Min::setup()
void Min::setup(int flag)
{
if (comm->me == 0 && screen) {
fprintf(screen,"Setting up %s style minimization ...\n",
update->minimize_style);
fprintf(screen," Unit style : %s\n", update->unit_style);
timer->print_timeout(screen);
if (flag) {
fprintf(screen," Unit style : %s\n", update->unit_style);
timer->print_timeout(screen);
}
}
update->setupflag = 1;
@ -294,7 +296,7 @@ void Min::setup()
requestor[m]->min_xf_get(m);
modify->setup(vflag);
output->setup();
output->setup(flag);
update->setupflag = 0;
// stats for initial thermo output

View File

@ -31,7 +31,7 @@ class Min : protected Pointers {
Min(class LAMMPS *);
virtual ~Min();
virtual void init();
void setup();
void setup(int flag=1);
void setup_minimal(int);
void run(int);
void cleanup();

View File

@ -652,6 +652,21 @@ void Output::delete_dump(char *id)
ndump--;
}
/* ----------------------------------------------------------------------
find a dump by ID
return index of dump or -1 if not found
------------------------------------------------------------------------- */
int Output::find_dump(const char *id)
{
if (id == NULL) return -1;
int idump;
for (idump = 0; idump < ndump; idump++)
if (strcmp(id,dump[idump]->id) == 0) break;
if (idump == ndump) return -1;
return idump;
}
/* ----------------------------------------------------------------------
set thermo output frequency from input script
------------------------------------------------------------------------- */

View File

@ -76,6 +76,7 @@ class Output : protected Pointers {
void add_dump(int, char **); // add a Dump to Dump list
void modify_dump(int, char **); // modify a Dump
void delete_dump(char *); // delete a Dump from Dump list
int find_dump(const char *); // find a Dump ID
void set_thermo(int, char **); // set thermo output freqquency
void create_thermo(int, char **); // create a thermo style

View File

@ -398,24 +398,27 @@ void Respa::init()
setup before run
------------------------------------------------------------------------- */
void Respa::setup()
void Respa::setup(int flag)
{
if (comm->me == 0 && screen) {
fprintf(screen,"Setting up r-RESPA run ...\n");
fprintf(screen," Unit style : %s\n", update->unit_style);
fprintf(screen," Current step : " BIGINT_FORMAT "\n", update->ntimestep);
fprintf(screen," Time steps :");
for (int ilevel=0; ilevel < nlevels; ++ilevel)
fprintf(screen," %d:%g",ilevel+1, step[ilevel]);
fprintf(screen,"\n r-RESPA fixes :");
for (int l=0; l < modify->n_post_force_respa; ++l) {
Fix *f = modify->fix[modify->list_post_force_respa[l]];
if (f->respa_level >= 0)
fprintf(screen," %d:%s[%s]",
MIN(f->respa_level+1,nlevels),f->style,f->id);
if (flag) {
fprintf(screen," Unit style : %s\n", update->unit_style);
fprintf(screen," Current step : " BIGINT_FORMAT "\n",
update->ntimestep);
fprintf(screen," Time steps :");
for (int ilevel=0; ilevel < nlevels; ++ilevel)
fprintf(screen," %d:%g",ilevel+1, step[ilevel]);
fprintf(screen,"\n r-RESPA fixes :");
for (int l=0; l < modify->n_post_force_respa; ++l) {
Fix *f = modify->fix[modify->list_post_force_respa[l]];
if (f->respa_level >= 0)
fprintf(screen," %d:%s[%s]",
MIN(f->respa_level+1,nlevels),f->style,f->id);
}
fprintf(screen,"\n");
timer->print_timeout(screen);
}
fprintf(screen,"\n");
timer->print_timeout(screen);
}
update->setupflag = 1;
@ -482,7 +485,7 @@ void Respa::setup()
sum_flevel_f();
modify->setup(vflag);
output->setup();
output->setup(flag);
update->setupflag = 0;
}

View File

@ -48,7 +48,7 @@ class Respa : public Integrate {
Respa(class LAMMPS *, int, char **);
virtual ~Respa();
virtual void init();
virtual void setup();
virtual void setup(int flag=1);
virtual void setup_minimal(int);
virtual void run(int);
virtual void cleanup();

View File

@ -85,14 +85,17 @@ void Verlet::init()
setup before run
------------------------------------------------------------------------- */
void Verlet::setup()
void Verlet::setup(int flag)
{
if (comm->me == 0 && screen) {
fprintf(screen,"Setting up Verlet run ...\n");
fprintf(screen," Unit style : %s\n", update->unit_style);
fprintf(screen," Current step : " BIGINT_FORMAT "\n", update->ntimestep);
fprintf(screen," Time step : %g\n", update->dt);
timer->print_timeout(screen);
if (flag) {
fprintf(screen," Unit style : %s\n", update->unit_style);
fprintf(screen," Current step : " BIGINT_FORMAT "\n",
update->ntimestep);
fprintf(screen," Time step : %g\n", update->dt);
timer->print_timeout(screen);
}
}
if (lmp->kokkos)
@ -148,7 +151,7 @@ void Verlet::setup()
if (force->newton) comm->reverse_comm();
modify->setup(vflag);
output->setup();
output->setup(flag);
update->setupflag = 0;
}

View File

@ -29,7 +29,7 @@ class Verlet : public Integrate {
Verlet(class LAMMPS *, int, char **);
virtual ~Verlet() {}
virtual void init();
virtual void setup();
virtual void setup(int flag=1);
virtual void setup_minimal(int);
virtual void run(int);
void cleanup();

View File

@ -297,6 +297,9 @@ void WriteRestart::write(char *file)
// communication buffer for my atom info
// max_size = largest buffer needed by any proc
// NOTE: are assuming size_restart() returns 32-bit int
// for a huge one-proc problem, nlocal could be 32-bit
// but nlocal * doubles-peratom could oveflow
int max_size;
int send_size = atom->avec->size_restart();