sync with GH

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15592 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
sjplimp
2016-09-16 19:21:34 +00:00
parent ed532358ad
commit 484122b8b6
9 changed files with 233 additions and 295 deletions

View File

@ -137,6 +137,9 @@ int colvarmodule::parse_config(std::string &conf)
cvm::log("Collective variables module (re)initialized.\n"); cvm::log("Collective variables module (re)initialized.\n");
cvm::log(cvm::line_marker); cvm::log(cvm::line_marker);
// update any necessary proxy data
proxy->setup();
if (cv_traj_os.is_open()) { if (cv_traj_os.is_open()) {
// configuration might have changed, better redo the labels // configuration might have changed, better redo the labels
write_traj_label(cv_traj_os); write_traj_label(cv_traj_os);

View File

@ -4,7 +4,7 @@
#define COLVARMODULE_H #define COLVARMODULE_H
#ifndef COLVARS_VERSION #ifndef COLVARS_VERSION
#define COLVARS_VERSION "2016-09-03" #define COLVARS_VERSION "2016-09-14"
#endif #endif
#ifndef COLVARS_DEBUG #ifndef COLVARS_DEBUG

File diff suppressed because one or more lines are too long

View File

@ -436,6 +436,42 @@ class Atom2D(Atom):
self.lmp.eval("fy[%d]" % self.index)) self.lmp.eval("fy[%d]" % self.index))
def get_thermo_data(output):
""" traverse output of runs and extract thermo data columns """
if isinstance(output, str):
lines = output.splitlines()
else:
lines = output
runs = []
columns = []
in_run = False
for line in lines:
if line.startswith("Memory usage per processor"):
in_run = True
elif in_run and len(columns) == 0:
# first line after memory usage are column names
columns = line.split()
current_run = {}
for col in columns:
current_run[col] = []
elif line.startswith("Loop time of "):
in_run = False
columns = None
thermo_data = namedtuple('ThermoData', list(current_run.keys()))(*list(current_run.values()))
r = {'thermo' : thermo_data }
runs.append(namedtuple('Run', list(r.keys()))(*list(r.values())))
elif in_run and len(columns) > 0:
values = [float(x) for x in line.split()]
for i, col in enumerate(columns):
current_run[col].append(values[i])
return runs
class PyLammps(object): class PyLammps(object):
""" """
More Python-like wrapper for LAMMPS (e.g., for iPython) More Python-like wrapper for LAMMPS (e.g., for iPython)
@ -454,6 +490,8 @@ class PyLammps(object):
else: else:
self.lmp = lammps(name=name,cmdargs=cmdargs,ptr=None,comm=comm) self.lmp = lammps(name=name,cmdargs=cmdargs,ptr=None,comm=comm)
print("LAMMPS output is captured by PyLammps wrapper") print("LAMMPS output is captured by PyLammps wrapper")
self._cmd_history = []
self.runs = []
def __del__(self): def __del__(self):
if self.lmp: self.lmp.close() if self.lmp: self.lmp.close()
@ -469,8 +507,26 @@ class PyLammps(object):
def file(self,file): def file(self,file):
self.lmp.file(file) self.lmp.file(file)
def write_script(self,filename):
""" Write LAMMPS script file containing all commands executed up until now """
with open(filename, "w") as f:
for cmd in self._cmd_history:
f.write("%s\n" % cmd)
def command(self,cmd): def command(self,cmd):
self.lmp.command(cmd) self.lmp.command(cmd)
self._cmd_history.append(cmd)
def run(self, *args, **kwargs):
output = self.__getattr__('run')(*args, **kwargs)
self.runs += get_thermo_data(output)
return output
@property
def last_run(self):
if len(self.runs) > 0:
return self.runs[-1]
return None
@property @property
def atoms(self): def atoms(self):
@ -643,7 +699,7 @@ class PyLammps(object):
cmd_args = [name] + [str(x) for x in args] cmd_args = [name] + [str(x) for x in args]
with OutputCapture() as capture: with OutputCapture() as capture:
self.lmp.command(' '.join(cmd_args)) self.command(' '.join(cmd_args))
output = capture.output output = capture.output
if 'verbose' in kwargs and kwargs['verbose']: if 'verbose' in kwargs and kwargs['verbose']:

View File

@ -35,12 +35,13 @@ using namespace LAMMPS_NS;
#define MAXLINE 1024 #define MAXLINE 1024
enum{FCC,BCC,HCP,DIM,DIAMOND,B1,C11,L12,B2}; enum{FCC,BCC,HCP,DIM,DIAMOND,B1,C11,L12,B2};
int nkeywords = 21; static const int nkeywords = 21;
const char *keywords[] = {"Ec","alpha","rho0","delta","lattce", static const char *keywords[] = {
"attrac","repuls","nn2","Cmin","Cmax","rc","delr", "Ec","alpha","rho0","delta","lattce",
"augt1","gsmooth_factor","re","ialloy", "attrac","repuls","nn2","Cmin","Cmax","rc","delr",
"mixture_ref_t","erose_form","zbl", "augt1","gsmooth_factor","re","ialloy",
"emb_lin_neg","bkgd_dyn"}; "mixture_ref_t","erose_form","zbl",
"emb_lin_neg","bkgd_dyn"};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -26,7 +26,7 @@ libclasses = ("atc","awpmd","colvars","cuda","gpu","h5md",
buildclasses = ("intel","kokkos") buildclasses = ("intel","kokkos")
makeclasses = ("cc","flags","mpi","fft","jpg","png") makeclasses = ("cc","flags","mpi","fft","jpg","png")
setargs = ("gzip","#gzip","ffmpeg","#ffmpeg","smallbig","bigbig","smallsmall") setargs = ("gzip","#gzip","ffmpeg","#ffmpeg","smallbig","bigbig","smallsmall","exceptions","#exceptions")
actionargs = ("lib-all","file","clean","exe") actionargs = ("lib-all","file","clean","exe")
gpubuildflag = 0 gpubuildflag = 0
@ -459,6 +459,8 @@ class Actions(object):
make.delvar("LMP_INC","-DLAMMPS_SMALLBIG") make.delvar("LMP_INC","-DLAMMPS_SMALLBIG")
make.delvar("LMP_INC","-DLAMMPS_BIGBIG") make.delvar("LMP_INC","-DLAMMPS_BIGBIG")
make.addvar("LMP_INC","-DLAMMPS_SMALLSMALL") make.addvar("LMP_INC","-DLAMMPS_SMALLSMALL")
elif one == "exceptions": make.addvar("LMP_INC","-DLAMMPS_EXCEPTIONS")
elif one == "#exception": make.delvar("LMP_INC","-DLAMMPS_EXCEPTIONS")
# add FFT, JPG, PNG settings # add FFT, JPG, PNG settings
@ -809,7 +811,7 @@ class Packages(object):
original = {} original = {}
tmp = "cd %s; make ps" % dir.src tmp = "cd %s; make ps" % dir.src
output = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode() output = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode().split('\n')
pattern = "Installed\s+(\w+): package (\S+)" pattern = "Installed\s+(\w+): package (\S+)"
for line in output: for line in output:
m = re.search(pattern,line) m = re.search(pattern,line)
@ -966,13 +968,14 @@ class Settings(object):
def help(self): def help(self):
return """ return """
-s set1 set2 ... -s set1 set2 ...
possible settings = gzip #gzip ffmpeg #ffmpeg smallbig bigbig smallsmall possible settings = gzip #gzip ffmpeg #ffmpeg smallbig bigbig smallsmall exceptions #exceptions
alter LAMMPS ifdef settings in Makefile.auto alter LAMMPS ifdef settings in Makefile.auto
only happens if new Makefile.auto is created by use of "file" action only happens if new Makefile.auto is created by use of "file" action
gzip and #gzip turn on/off LAMMPS_GZIP setting gzip and #gzip turn on/off LAMMPS_GZIP setting
ffmpeg and #ffmpeg turn on/off LAMMPS_FFMPEG setting ffmpeg and #ffmpeg turn on/off LAMMPS_FFMPEG setting
smallbig, bigbig, smallsmall turn on LAMMPS_SMALLBIG, etc smallbig, bigbig, smallsmall turn on LAMMPS_SMALLBIG, etc
and turn off other two and turn off other two
exceptions and #exceptions turn on/off LAMMPS_EXCEPTIONS setting
""" """
def check(self): def check(self):

View File

@ -31,6 +31,8 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static int warn_single = 0;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
PairLJSFDipoleSF::PairLJSFDipoleSF(LAMMPS *lmp) : Pair(lmp) PairLJSFDipoleSF::PairLJSFDipoleSF(LAMMPS *lmp) : Pair(lmp)
@ -87,7 +89,6 @@ void PairLJSFDipoleSF::compute(int eflag, int vflag)
double **torque = atom->torque; double **torque = atom->torque;
int *type = atom->type; int *type = atom->type;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
// The global scaling parameters aren't used anymore
double *special_coul = force->special_coul; double *special_coul = force->special_coul;
double *special_lj = force->special_lj; double *special_lj = force->special_lj;
int newton_pair = force->newton_pair; int newton_pair = force->newton_pair;
@ -355,7 +356,7 @@ void PairLJSFDipoleSF::settings(int narg, char **arg)
void PairLJSFDipoleSF::coeff(int narg, char **arg) void PairLJSFDipoleSF::coeff(int narg, char **arg)
{ {
if (narg < 4 || narg > 7) if (narg < 4 || narg > 8)
error->all(FLERR,"Incorrect args for pair coefficients"); error->all(FLERR,"Incorrect args for pair coefficients");
if (!allocated) allocate(); if (!allocated) allocate();
@ -366,13 +367,27 @@ void PairLJSFDipoleSF::coeff(int narg, char **arg)
double epsilon_one = force->numeric(FLERR,arg[2]); double epsilon_one = force->numeric(FLERR,arg[2]);
double sigma_one = force->numeric(FLERR,arg[3]); double sigma_one = force->numeric(FLERR,arg[3]);
double scale_one = 1.0;
if (narg >= 5) scale_one = force->numeric(FLERR,arg[4]);
double cut_lj_one = cut_lj_global; double cut_lj_one = cut_lj_global;
double cut_coul_one = cut_coul_global; double cut_coul_one = cut_coul_global;
if (narg >= 6) cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[5]); double scale_one = 1.0;
if (narg == 7) cut_coul_one = force->numeric(FLERR,arg[6]); int iarg = 4;
if ((narg > iarg) && (strcmp(arg[iarg],"scale") != 0)) {
cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[iarg]);
++iarg;
}
if ((narg > iarg) && (strcmp(arg[iarg],"scale") != 0)) {
cut_coul_one = force->numeric(FLERR,arg[iarg]);
++iarg;
}
if (narg > iarg) {
if (strcmp(arg[iarg],"scale") == 0) {
scale_one = force->numeric(FLERR,arg[iarg+1]);
iarg += 2;
} else error->all(FLERR,"Incorrect args for pair coefficients");
}
if (iarg != narg)
error->all(FLERR,"Incorrect args for pair coefficients");
int count = 0; int count = 0;
for (int i = ilo; i <= ihi; i++) { for (int i = ilo; i <= ihi; i++) {
@ -532,6 +547,12 @@ double PairLJSFDipoleSF::single(int i, int j, int itype, int jtype, double rsq,
double *q = atom->q; double *q = atom->q;
double **mu = atom->mu; double **mu = atom->mu;
if (!warn_single) {
warn_single = 1;
if (comm->me == 0) {
error->warning(FLERR,"Single method for lj/sf/dipole/sf does not compute forces");
}
}
qtmp = q[i]; qtmp = q[i];
xtmp = x[i][0]; xtmp = x[i][0];
ytmp = x[i][1]; ytmp = x[i][1];

View File

@ -247,7 +247,7 @@ void PairLJSFDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr)
// total force // total force
fq = factor_coul*qqrd2e; fq = factor_coul*qqrd2e*scale[itype][jtype];
fx = fq*forcecoulx + delx*forcelj; fx = fq*forcecoulx + delx*forcelj;
fy = fq*forcecouly + dely*forcelj; fy = fq*forcecouly + dely*forcelj;
fz = fq*forcecoulz + delz*forcelj; fz = fq*forcecoulz + delz*forcelj;
@ -272,7 +272,7 @@ void PairLJSFDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr)
if (EFLAG) { if (EFLAG) {
if (rsq < cut_coulsq[itype][jtype]) { if (rsq < cut_coulsq[itype][jtype]) {
ecoul = (1.0-sqrt(rsq)/sqrt(cut_coulsq[itype][jtype])); ecoul = (1.0-sqrt(rsq/cut_coulsq[itype][jtype]));
ecoul *= ecoul; ecoul *= ecoul;
ecoul *= qtmp * q[j] * rinv; ecoul *= qtmp * q[j] * rinv;
if (mu[i].w > 0.0 && mu[j].w > 0.0) if (mu[i].w > 0.0 && mu[j].w > 0.0)
@ -281,7 +281,7 @@ void PairLJSFDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr)
ecoul += -q[j] * r3inv * pqfac * pidotr; ecoul += -q[j] * r3inv * pqfac * pidotr;
if (mu[j].w > 0.0 && qtmp != 0.0) if (mu[j].w > 0.0 && qtmp != 0.0)
ecoul += qtmp * r3inv * qpfac * pjdotr; ecoul += qtmp * r3inv * qpfac * pjdotr;
ecoul *= factor_coul*qqrd2e; ecoul *= factor_coul*qqrd2e*scale[itype][jtype];
} else ecoul = 0.0; } else ecoul = 0.0;
if (rsq < cut_ljsq[itype][jtype]) { if (rsq < cut_ljsq[itype][jtype]) {

View File

@ -49,7 +49,12 @@ double FixTempCSVR::gamdev(const int ia)
x=1.0; x=1.0;
for (j=1; j<=ia; j++) for (j=1; j<=ia; j++)
x *= random->uniform(); x *= random->uniform();
x = -log(x);
// make certain, that -log() doesn't overflow.
if (x < 2.2250759805e-308)
x = 708.4;
else
x = -log(x);
} else { } else {
restart: restart:
do { do {