diff -Naur lammps-1Jul09/doc/fix_heat.html lammps-2Jul09/doc/fix_heat.html --- lammps-1Jul09/doc/fix_heat.html 2007-10-10 16:28:11.000000000 -0600 +++ lammps-2Jul09/doc/fix_heat.html 2009-06-30 11:12:19.000000000 -0600 @@ -63,11 +63,17 @@

No information about this fix is written to binary restart files. None of the fix_modify options -are relevant to this fix. No global scalar or vector or per-atom -quantities are stored by this fix for access by various output -commands. No parameter of this fix can be -used with the start/stop keywords of the run command. -This fix is not invoked during energy minimization. +are relevant to this fix. +

+

This fix computes a scalar which can be accessed by various output +commands. This scalar is the most recent +value by which velocites were scaled. The scalar value calculated by +this fix is "intensive", meaning it does not scale with the number of +atoms in the simulation. +

+

No parameter of this fix can be used with the start/stop keywords of +the run command. This fix is not invoked during energy +minimization.

Restrictions: none

diff -Naur lammps-1Jul09/doc/fix_heat.txt lammps-2Jul09/doc/fix_heat.txt --- lammps-1Jul09/doc/fix_heat.txt 2007-10-10 16:28:11.000000000 -0600 +++ lammps-2Jul09/doc/fix_heat.txt 2009-06-30 11:12:19.000000000 -0600 @@ -60,11 +60,17 @@ No information about this fix is written to "binary restart files"_restart.html. None of the "fix_modify"_fix_modify.html options -are relevant to this fix. No global scalar or vector or per-atom -quantities are stored by this fix for access by various "output -commands"_Section_howto.html#4_15. No parameter of this fix can be -used with the {start/stop} keywords of the "run"_run.html command. -This fix is not invoked during "energy minimization"_minimize.html. +are relevant to this fix. + +This fix computes a scalar which can be accessed by various "output +commands"_Section_howto.html#4_15. This scalar is the most recent +value by which velocites were scaled. The scalar value calculated by +this fix is "intensive", meaning it does not scale with the number of +atoms in the simulation. + +No parameter of this fix can be used with the {start/stop} keywords of +the "run"_run.html command. This fix is not invoked during "energy +minimization"_minimize.html. [Restrictions:] none diff -Naur lammps-1Jul09/src/fix_heat.cpp lammps-2Jul09/src/fix_heat.cpp --- lammps-1Jul09/src/fix_heat.cpp 2008-05-27 08:04:12.000000000 -0600 +++ lammps-2Jul09/src/fix_heat.cpp 2009-06-30 11:14:22.000000000 -0600 @@ -34,6 +34,10 @@ { if (narg < 4) error->all("Illegal fix heat command"); + scalar_flag = 1; + scalar_vector_freq = 1; + extscalar = 0; + nevery = atoi(arg[3]); if (nevery <= 0) error->all("Illegal fix heat command"); @@ -43,6 +47,8 @@ // cannot have 0 atoms in group if (group->count(igroup) == 0.0) error->all("Fix heat group has no atoms"); + + scale = 1.0; } /* ---------------------------------------------------------------------- */ @@ -76,16 +82,23 @@ double vcmsq = vcm[0]*vcm[0] + vcm[1]*vcm[1] + vcm[2]*vcm[2]; double escale = (ke + heat - 0.5*vcmsq*masstotal)/(ke - 0.5*vcmsq*masstotal); if (escale < 0.0) error->all("Fix heat kinetic energy went negative"); - double r = sqrt(escale); + scale = sqrt(escale); - vsub[0] = (r-1.0) * vcm[0]; - vsub[1] = (r-1.0) * vcm[1]; - vsub[2] = (r-1.0) * vcm[2]; + vsub[0] = (scale-1.0) * vcm[0]; + vsub[1] = (scale-1.0) * vcm[1]; + vsub[2] = (scale-1.0) * vcm[2]; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - v[i][0] = r*v[i][0] - vsub[0]; - v[i][1] = r*v[i][1] - vsub[1]; - v[i][2] = r*v[i][2] - vsub[2]; + v[i][0] = scale*v[i][0] - vsub[0]; + v[i][1] = scale*v[i][1] - vsub[1]; + v[i][2] = scale*v[i][2] - vsub[2]; } } + +/* ---------------------------------------------------------------------- */ + +double FixHeat::compute_scalar() +{ + return scale; +} diff -Naur lammps-1Jul09/src/fix_heat.h lammps-2Jul09/src/fix_heat.h --- lammps-1Jul09/src/fix_heat.h 2007-04-20 13:03:20.000000000 -0600 +++ lammps-2Jul09/src/fix_heat.h 2009-06-30 11:14:22.000000000 -0600 @@ -24,10 +24,12 @@ int setmask(); void init(); void end_of_step(); + double compute_scalar(); private: double heat; double masstotal; + double scale; }; }