diff --git a/src/RIGID/compute_rigid_local.cpp b/src/RIGID/compute_rigid_local.cpp index d26edb42ce..9760945192 100644 --- a/src/RIGID/compute_rigid_local.cpp +++ b/src/RIGID/compute_rigid_local.cpp @@ -87,9 +87,10 @@ ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Invalid keyword in compute rigid/local command"); } - nmax = 0; + ncount = nmax = 0; vector = NULL; array = NULL; + fixrigid = NULL; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index f485c4b7b4..246f7cc66f 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -64,6 +64,7 @@ enum { CONST, EQUAL }; // For treating the variables. static const char* cite_fix_nve_manifold_rattle = "fix nve/manifold/rattle command:\n\n" + "@article{paquay-2016,\n" " author = {Paquay, Stefan and Kusters, Remy},\n" " doi = {10.1016/j.bpj.2016.02.017},\n" " issn = {0006-3495},\n" diff --git a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp index c304a8718d..b0109d16f7 100644 --- a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp @@ -66,6 +66,7 @@ enum {NOBIAS,BIAS}; static const char* cite_fix_nvt_manifold_rattle = "fix nvt/manifold/rattle command:\n\n" + "@article{paquay-2016,\n" " author = {Paquay, Stefan and Kusters, Remy},\n" " doi = {10.1016/j.bpj.2016.02.017},\n" " issn = {0006-3495},\n" diff --git a/src/read_data.cpp b/src/read_data.cpp index debb7713c3..5e4cc2a00d 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -1705,6 +1705,8 @@ void ReadData::pairIJcoeffs() void ReadData::bondcoeffs() { + if (!nbondtypes) return; + char *next; char *buf = new char[nbondtypes*MAXLINE]; @@ -1727,6 +1729,8 @@ void ReadData::bondcoeffs() void ReadData::anglecoeffs(int which) { + if (!nangletypes) return; + char *next; char *buf = new char[nangletypes*MAXLINE]; @@ -1751,6 +1755,8 @@ void ReadData::anglecoeffs(int which) void ReadData::dihedralcoeffs(int which) { + if (!ndihedraltypes) return; + char *next; char *buf = new char[ndihedraltypes*MAXLINE]; @@ -1778,6 +1784,8 @@ void ReadData::dihedralcoeffs(int which) void ReadData::impropercoeffs(int which) { + if (!nimpropertypes) return; + char *next; char *buf = new char[nimpropertypes*MAXLINE]; diff --git a/src/thermo.cpp b/src/thermo.cpp index c610490f88..5127b91a89 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -55,7 +55,7 @@ using namespace MathConst; // customize a new keyword by adding to this list: -// step, elapsed, elaplong, dt, time, cpu, tpcpu, spcpu, cpuremain, part +// step, elapsed, elaplong, dt, time, cpu, tpcpu, spcpu, cpuremain, part, timeremain // atoms, temp, press, pe, ke, etotal, enthalpy // evdwl, ecoul, epair, ebond, eangle, edihed, eimp, emol, elong, etail // vol, density, lx, ly, lz, xlo, xhi, ylo, yhi, zlo, zhi, xy, xz, yz, @@ -672,6 +672,8 @@ void Thermo::parse_fields(char *str) addfield("CPULeft",&Thermo::compute_cpuremain,FLOAT); } else if (strcmp(word,"part") == 0) { addfield("Part",&Thermo::compute_part,INT); + } else if (strcmp(word,"timeremain") == 0) { + addfield("TimeoutLeft",&Thermo::compute_timeremain,FLOAT); } else if (strcmp(word,"atoms") == 0) { addfield("Atoms",&Thermo::compute_atoms,BIGINT); @@ -1069,6 +1071,10 @@ int Thermo::evaluate_keyword(char *word, double *answer) compute_part(); dvalue = ivalue; + } else if (strcmp(word,"timeremain") == 0) { + compute_timeremain(); + + } else if (strcmp(word,"atoms") == 0) { compute_atoms(); dvalue = bivalue; @@ -1598,6 +1604,13 @@ void Thermo::compute_part() /* ---------------------------------------------------------------------- */ +void Thermo::compute_timeremain() +{ + dvalue = timer->get_timeout_remain(); +} + +/* ---------------------------------------------------------------------- */ + void Thermo::compute_atoms() { bivalue = atom->natoms; diff --git a/src/thermo.h b/src/thermo.h index cbdbd875ac..c1fd3b756c 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -127,6 +127,7 @@ class Thermo : protected Pointers { void compute_spcpu(); void compute_cpuremain(); void compute_part(); + void compute_timeremain(); void compute_atoms(); void compute_temp(); diff --git a/src/timer.cpp b/src/timer.cpp index 165b6de64b..0615651206 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -263,6 +263,12 @@ bool Timer::_check_timeout() } } +/* ---------------------------------------------------------------------- */ +double Timer::get_timeout_remain() +{ + return (_timeout < 0.0) ? 0.0 : _timeout + timeout_start - MPI_Wtime(); +} + /* ---------------------------------------------------------------------- modify parameters of the Timer class ------------------------------------------------------------------------- */ diff --git a/src/timer.h b/src/timer.h index aec6dd7fa9..903a182128 100644 --- a/src/timer.h +++ b/src/timer.h @@ -66,6 +66,9 @@ class Timer : protected Pointers { // trigger enforced timeout void force_timeout() { _timeout = 0.0; }; + // get remaining time in seconds. 0.0 if inactive, negative if expired + double get_timeout_remain(); + // print timeout message void print_timeout(FILE *); diff --git a/src/write_data.cpp b/src/write_data.cpp index 5a67c1081e..d8b951dd8c 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -286,19 +286,19 @@ void WriteData::force_fields() force->pair->write_data_all(fp); } } - if (force->bond && force->bond->writedata) { + if (force->bond && force->bond->writedata && atom->nbondtypes) { fprintf(fp,"\nBond Coeffs # %s\n\n", force->bond_style); force->bond->write_data(fp); } - if (force->angle && force->angle->writedata) { + if (force->angle && force->angle->writedata && atom->nangletypes) { fprintf(fp,"\nAngle Coeffs # %s\n\n", force->angle_style); force->angle->write_data(fp); } - if (force->dihedral && force->dihedral->writedata) { + if (force->dihedral && force->dihedral->writedata && atom->ndihedraltypes) { fprintf(fp,"\nDihedral Coeffs # %s\n\n", force->dihedral_style); force->dihedral->write_data(fp); } - if (force->improper && force->improper->writedata) { + if (force->improper && force->improper->writedata && atom->nimpropertypes) { fprintf(fp,"\nImproper Coeffs # %s\n\n", force->improper_style); force->improper->write_data(fp); }