Commit c9b7a30e authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

remove static class members. some cosmetic changes

parent 4b988b8c
Loading
Loading
Loading
Loading
+38 −34
Original line number Diff line number Diff line
@@ -46,10 +46,6 @@ enum{NOBIAS,BIAS};
enum{NONE,XYZ,XY,YZ,XZ};
enum{ISO,ANISO,TRICLINIC};

int FixNH::restartPK;
int FixNH::restart_stored=0;
double FixNH::setPKinit[6];

/* ----------------------------------------------------------------------
   NVT,NPH,NPT integrators for improved Nose-Hoover equations of motion
 ---------------------------------------------------------------------- */
@@ -63,8 +59,6 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
{
  if (narg < 4) error->all(FLERR,"Illegal fix nvt/npt/nph command");

  usePK = 1;
  restart_global = 1;
  dynamic_group_allow = 1;
  time_integrate = 1;
  scalar_flag = 1;
@@ -73,6 +67,12 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
  extscalar = 1;
  extvector = 0;

  // for CauchyStat

  usePK = 1;
  restart_global = 1;
  restart_stored = 0;

  // default values

  pcouple = NONE;
@@ -2247,6 +2247,7 @@ void FixNH::compute_press_target()

  // CauchyStat: call CauchyStat to modify p_target[i] and p_hydro,
  // if CauchyStat enabled and pressure->vector computation has been initiated

  if ((usePK == 0) && (initRUN == 1)) CauchyStat();
  if (initRUN == 0) {
    for (int i=0; i < 6; i++) {
@@ -2254,7 +2255,9 @@ void FixNH::compute_press_target()
    }
  }

  initRUN=1; // when run is initialized tensor[] not available (pressure on cell wall)
  // when run is initialized tensor[] not available (pressure on cell wall)

  initRUN=1;

  // if deviatoric, recompute sigma each time p_target changes

@@ -2419,8 +2422,7 @@ void FixNH::CauchyStat_init()
      fprintf(screen,"Using the Cauchystat fix with alpha=%f\n",alpha);
      if (restartPK==1) {
        fprintf(screen,"   (this is a continuation fix)\n");
      }
      else {
      } else {
        fprintf(screen,"   (this is NOT a continuation fix)\n");
      }
    }
@@ -2428,19 +2430,19 @@ void FixNH::CauchyStat_init()
      fprintf(logfile,"Using the Cauchystat with alpha=%f\n",alpha);
      if (restartPK==1) {
        fprintf(logfile,"   this is a continuation run\n");
      }
      else {
      } else {
        fprintf(logfile,"   this is NOT a continuation run\n");
      }
    }
  }
  if(restartPK==1 && restart_stored==0) {

  if (restartPK==1 && restart_stored==0)
    error->all(FLERR,"Illegal cauchystat command.  Continuation run"
               " must follow a previously equilibrated Cauchystat run");
  }
  if(alpha<=0.0) {
    error->all(FLERR,"Illegal cauchystat command.  Alpha cannot be zero or negative");
  }

  if (alpha<=0.0)
    error->all(FLERR,"Illegal cauchystat command: "
               " Alpha cannot be zero or negative.");

  initRUN = 0;
  initPK = 1;
@@ -2600,6 +2602,7 @@ void FixNH::CauchyStat()
  p_hydro /= pdim;

  // save information for Cauchystat restart

  setPKinit[0] = setcauchy(1,1);
  setPKinit[1] = setcauchy(1,2);
  setPKinit[2] = setcauchy(1,3);
@@ -2621,8 +2624,6 @@ void FixNH::CauchyStat()

}



/* ----------------------------------------------------------------------
   CauchyStat_Step

@@ -2644,10 +2645,13 @@ void FixNH::CauchyStat()
   setPK(3,3)       :  PK stress tensor at the next time step
   ------------------------------------------------------------------------- */

void FixNH::CauchyStat_Step(bigint step, double (&F)[3][3], double (&Fi)[3][3], double (&Fdot)[3][3], double (&cauchy)[3][3], double (&setcauchy)[3][3], double (&setPK)[3][3], double volume, double volume0, double deltat, double alpha)
void FixNH::CauchyStat_Step(bigint step, double (&F)[3][3],
                            double (&Fi)[3][3], double (&Fdot)[3][3],
                            double (&cauchy)[3][3], double (&setcauchy)[3][3],
                            double (&setPK)[3][3], double volume,
                            double volume0, double deltat, double alpha)
{


  //macros to go from c to fortran style for arrays:
#define F(row,col) (F[(row-1)][(col-1)])
#define Fi(row,col) (Fi[(row-1)][(col-1)])
+25 −17
Original line number Diff line number Diff line
@@ -142,22 +142,30 @@ class FixNH : public Fix {

  // Implementation of CauchyStat
  double H0[3][3];      // shape matrix for the undeformed cell
  double h_old[6];               //previous time step shape matrix for the undeformed cell
  double h_old[6];      // previous time step shape matrix for
                        // the undeformed cell
  double invH0[3][3];   // inverse of H0;
  double CSvol0;        // volume of undeformed cell
  double setPK[3][3];            //current set values of the PK stress (this is modified until the cauchy stress converges)
  static double setPKinit[6];    // initialization value of setPK for continuation runs
  double setPK[3][3];   // current set values of the PK stress
                        // (this is modified until the cauchy
                        // stress converges)
  double setPKinit[6];  // initialization value of setPK for
                        // continuation runs
  double alpha;         // integration parameter for the cauchystat
  int initPK;                    // 1 if setPK needs to be initialized either from cauchy or restart, else 0
  int initPK;           // 1 if setPK needs to be initialized either
                        // from cauchy or restart, else 0
  int usePK;            // 0 if use CauchyStat else 1
  static int restartPK;          // Read PK stress from the previous step
  static int restart_stored;     // Read PK stress from the previous step
  int initRUN;                   // 0 if run not initialized (pressure->vector not computed yet), else 1 (pressure->vector available)

  virtual void CauchyStat_init();
  virtual void CauchyStat();
  virtual void CauchyStat_Step(bigint step, double (&F)[3][3], double (&Fi)[3][3], double (&Fdot)[3][3],
			  double (&cauchy)[3][3], double (&setcauchy)[3][3], double (&setPK)[3][3],
  int restartPK;        // Read PK stress from the previous run
  int restart_stored;   // values of PK stress from the previous step stored
  int initRUN;          // 0 if run not initialized
                        // (pressure->vector not computed yet),
                        // else 1 (pressure->vector available)

  void CauchyStat_init();
  void CauchyStat();
  void CauchyStat_Step(bigint step, double (&F)[3][3], double (&Fi)[3][3],
                       double (&Fdot)[3][3], double (&cauchy)[3][3],
                       double (&setcauchy)[3][3], double (&setPK)[3][3],
			  double volume, double volume0, double deltat, double alpha);

};