Commit a34506c4 authored by athomps's avatar athomps
Browse files

Added flag to make only fix_nphug use constant eta_mass

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@6944 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent d9a1ca64
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -36,9 +36,11 @@ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) :
  FixNH(lmp, narg, arg)
{

  // Prevent eta_mass from being updated every timestep
  // Prevent masses from being updated every timestep

  eta_mass_flag = 0;
  omega_mass_flag = 0;
  etap_mass_flag = 0;

  // extend vector of base-class computes

+37 −11
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
  deviatoric_flag = 0;
  nreset_h0 = 0;
  eta_mass_flag = 1;
  omega_mass_flag = 0;
  etap_mass_flag = 0;

  // turn on tilt factor scaling, whenever applicable

@@ -732,11 +734,6 @@ void FixNH::initial_integrate(int vflag)

  if (tstat_flag) {
    compute_temp_target();
    if (eta_mass_flag) { 
      eta_mass[0] = tdof * boltz * t_target / (t_freq*t_freq);
      for (int ich = 1; ich < mtchain; ich++)
	eta_mass[ich] = boltz * t_target / (t_freq*t_freq);
    }
    nhc_temp_integrate();
  }

@@ -833,11 +830,6 @@ void FixNH::initial_integrate_respa(int vflag, int ilevel, int iloop)

    if (tstat_flag) {
      compute_temp_target();
      if (eta_mass_flag) { 
	eta_mass[0] = tdof * boltz * t_target / (t_freq*t_freq);
	for (int ich = 1; ich < mtchain; ich++)
	  eta_mass[ich] = boltz * t_target / (t_freq*t_freq);
      }
      nhc_temp_integrate();
    }

@@ -1597,8 +1589,16 @@ void FixNH::nhc_temp_integrate()
{
  int ich;
  double expfac;

  double kecurrent = tdof * boltz * t_current;

  // Update masses, to preserve initial freq, if flag set

  if (eta_mass_flag) { 
    eta_mass[0] = tdof * boltz * t_target / (t_freq*t_freq);
    for (int ich = 1; ich < mtchain; ich++)
      eta_mass[ich] = boltz * t_target / (t_freq*t_freq);
  }

  eta_dotdot[0] = (kecurrent - ke_target)/eta_mass[0];

  double ncfac = 1.0/nc_tchain;
@@ -1658,6 +1658,32 @@ void FixNH::nhc_press_integrate()
  double kt = boltz * t_target;
  double lkt_press = kt;

  // Update masses, to preserve initial freq, if flag set

  if (omega_mass_flag) { 
    double nkt = atom->natoms * kt;
    for (int i = 0; i < 3; i++)
      if (p_flag[i])
	omega_mass[i] = nkt/(p_freq[i]*p_freq[i]);

    if (pstyle == TRICLINIC) {
      for (int i = 3; i < 6; i++)
	if (p_flag[i]) omega_mass[i] = nkt/(p_freq[i]*p_freq[i]);
    }
  }

  if (etap_mass_flag) { 
    if (mpchain) {
      etap_mass[0] = boltz * t_target / (p_freq_max*p_freq_max);
      for (int ich = 1; ich < mpchain; ich++)
	etap_mass[ich] = boltz * t_target / (p_freq_max*p_freq_max);
      for (int ich = 1; ich < mpchain; ich++)
	etap_dotdot[ich] = 
	  (etap_mass[ich-1]*etap_dot[ich-1]*etap_dot[ich-1] -
	   boltz * t_target) / etap_mass[ich];
    }
  }

  kecurrent = 0.0;
  for (i = 0; i < 3; i++)
    if (p_flag[i]) kecurrent += omega_mass[i]*omega_dot[i]*omega_dot[i];
+2 −0
Original line number Diff line number Diff line
@@ -105,6 +105,8 @@ class FixNH : public Fix {
  double mtk_term1,mtk_term2;      // Martyna-Tobias-Klein corrections

  int eta_mass_flag;               // 1 if eta_mass updated, 0 if not.
  int omega_mass_flag;             // 1 if omega_mass updated, 0 if not.
  int etap_mass_flag;              // 1 if etap_mass updated, 0 if not.

  int scaleyz;                     // 1 if yz scaled with lz 
  int scalexz;                     // 1 if xz scaled with lz