diff --git a/doc/thermo_style.txt b/doc/thermo_style.txt index 8e1ceb49dc..93a3758d34 100644 --- a/doc/thermo_style.txt +++ b/doc/thermo_style.txt @@ -18,7 +18,7 @@ args = list of arguments for a particular style :l {multi} args = none {granular} args = none {custom} args = list of attributes - possible attributes = step, atoms, cpu, temp, press, pe, ke, etotal, + possible attributes = step, atoms, cpu, temp, press, pe, ke, etotal, enthalpy evdwl, ecoul, epair, ebond, eangle, edihed, eimp, emol, elong, etail, vol, lx, ly, lz, pxx, pyy, pzz, pxy, pxz, pyz gke, grot, tave, pave, eave, peave, t_ID @@ -29,6 +29,7 @@ args = list of arguments for a particular style :l press = pressure pe = total potential energy ke = kinetic energy + enthalpy = enthalpy, pe + press*vol etotal = total energy (pe + ke) evdwl = VanderWaal pairwise energy ecoul = Coulombic pairwise energy diff --git a/src/thermo.cpp b/src/thermo.cpp index 74fb9dd924..f09405e0d3 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -45,6 +45,7 @@ // gke, grot (granular trans-ke and rotational-ke) // tave, pave, eave, peave (time-averaged quantities) // t_ID (user-defined temperatures) +// enthalpy // customize by adding a DEFINE to this list @@ -664,6 +665,8 @@ void Thermo::parse_fields(char *str) addfield("E_ave",&Thermo::compute_eave,FLOAT); } else if (strcmp(word,"peave") == 0) { addfield("PE_ave",&Thermo::compute_peave,FLOAT); + } else if (strcmp(word,"enthalpy") == 0) { + addfield("Enthalpy",&Thermo::compute_enthalpy,FLOAT); // user-defined temperature (t_ID) // only 1st 8 chars of ID are passed to addfield @@ -754,6 +757,7 @@ int Thermo::compute_value(char *word, double *answer) else if (strcmp(word,"erot") == 0) compute_erot(); else if (strcmp(word,"gke") == 0) compute_gke(); else if (strcmp(word,"grot") == 0) compute_grot(); + else if (strcmp(word,"enthalpy") == 0) compute_enthalpy(); else if (strncmp(word,"t_",2) == 0) { int tempwhich; for (tempwhich = 0; tempwhich < force->ntemp; tempwhich++) @@ -1253,3 +1257,19 @@ void Thermo::compute_fix() dvalue = fixvalues[fixprint[ifix_print++]]; if (normflag) dvalue /= natoms; } + +/* ---------------------------------------------------------------------- */ + +void Thermo::compute_enthalpy() +{ + double etmp,vtmp,ptmp; + compute_etotal(); + etmp = dvalue; + compute_vol(); + vtmp = dvalue; + if (normflag) vtmp /= natoms; + compute_press(); + ptmp = dvalue; + dvalue = etmp+ptmp*vtmp/(force->nktv2p); +} + diff --git a/src/thermo.h b/src/thermo.h index b2dee57df6..277adc3d1e 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -128,6 +128,7 @@ class Thermo : public LAMMPS { void compute_eave(); void compute_peave(); void compute_t_id(); + void compute_enthalpy(); }; #endif