diff --git a/src/thermo.cpp b/src/thermo.cpp index 79206fc51c..8498b8495b 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -46,7 +46,7 @@ using namespace MathConst; // customize a new keyword by adding to this list: -// step, elapsed, elaplong, dt, time, cpu, tpcpu, spcpu +// step, elapsed, elaplong, dt, time, cpu, tpcpu, spcpu, cpuremain // 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, @@ -657,6 +657,8 @@ void Thermo::parse_fields(char *str) addfield("T/CPU",&Thermo::compute_tpcpu,FLOAT); } else if (strcmp(word,"spcpu") == 0) { addfield("S/CPU",&Thermo::compute_spcpu,FLOAT); + } else if (strcmp(word,"cpuremain") == 0) { + addfield("CPULeft",&Thermo::compute_cpuremain,FLOAT); } else if (strcmp(word,"atoms") == 0) { addfield("Atoms",&Thermo::compute_atoms,BIGINT); @@ -1015,6 +1017,12 @@ int Thermo::evaluate_keyword(char *word, double *answer) "This variable thermo keyword cannot be used between runs"); compute_spcpu(); + } else if (strcmp(word,"cpuremain") == 0) { + if (update->whichflag == 0) + error->all(FLERR, + "This variable thermo keyword cannot be used between runs"); + compute_cpuremain(); + } else if (strcmp(word,"atoms") == 0) { compute_atoms(); dvalue = bivalue; @@ -1504,6 +1512,16 @@ void Thermo::compute_spcpu() /* ---------------------------------------------------------------------- */ +void Thermo::compute_cpuremain() +{ + if (firststep == 0) dvalue = 0.0; + else dvalue = timer->elapsed(TIME_LOOP) * + (update->laststep - update->ntimestep) / + (update->ntimestep - update->firststep); +} + +/* ---------------------------------------------------------------------- */ + void Thermo::compute_atoms() { bivalue = atom->natoms; diff --git a/src/thermo.h b/src/thermo.h index ed611f1b1c..026a3e1e3f 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -126,6 +126,7 @@ class Thermo : protected Pointers { void compute_cpu(); void compute_tpcpu(); void compute_spcpu(); + void compute_cpuremain(); void compute_atoms(); void compute_temp();