~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to src/fix_temp_berendsen.cpp

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2015-04-29 23:44:49 UTC
  • mfrom: (5.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150429234449-mbhy9utku6hp6oq8
Tags: 0~20150313.gitfa668e1-1
Upload into unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
  // Berendsen thermostat should be applied every step
43
43
 
 
44
  dynamic_group_allow = 1;
44
45
  nevery = 1;
45
46
  scalar_flag = 1;
46
47
  global_freq = nevery;
135
136
void FixTempBerendsen::end_of_step()
136
137
{
137
138
  double t_current = temperature->compute_scalar();
 
139
  double tdof = temperature->dof;
 
140
 
138
141
  if (t_current == 0.0)
139
142
    error->all(FLERR,
140
143
               "Computed temperature for fix temp/berendsen cannot be 0.0");
162
165
  //   OK to not test returned v = 0, since lamda is multiplied by v
163
166
 
164
167
  double lamda = sqrt(1.0 + update->dt/t_period*(t_target/t_current - 1.0));
165
 
  double efactor = 0.5 * force->boltz * temperature->dof;
 
168
  double efactor = 0.5 * force->boltz * tdof;
166
169
  energy += t_current * (1.0-lamda*lamda) * efactor;
167
170
 
168
171
  double **v = atom->v;