Unverified Commit 4cd0ea61 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

change source code format style to be more like other LAMMPS sources

parent 05a5ecd4
Loading
Loading
Loading
Loading
+122 −174
Original line number Diff line number Diff line
@@ -256,12 +256,10 @@ void PairGranular::compute(int eflag, int vflag)
          delta_pulloff = a*a/Reff - 2*sqrt(M_PI*coh*a/E);
          dist_pulloff = radsum-delta_pulloff;
          touchflag = (rsq < dist_pulloff*dist_pulloff);
        }
        else{
        } else {
          touchflag = (rsq < radsum*radsum);
        }
      }
      else{
      } else {
        touchflag = (rsq < radsum*radsum);
      }

@@ -272,8 +270,7 @@ void PairGranular::compute(int eflag, int vflag)
          history = &allhistory[size_history*jj];
          for (int k = 0; k < size_history; k++) history[k] = 0.0;
        }
      }
      else{
      } else {
        r = sqrt(rsq);
        rinv = 1.0/r;

@@ -330,8 +327,7 @@ void PairGranular::compute(int eflag, int vflag)
          a2 = a*a;
          knfac = normal_coeffs[itype][jtype][0]*a;
          Fne = knfac*a2/Reff - TWOPI*a2*sqrt(4*coh*E/(M_PI*a));
        }
        else{
        } else {
          knfac = E; //Hooke
          Fne = knfac*delta;
          a = sqrt(dR);
@@ -346,11 +342,9 @@ void PairGranular::compute(int eflag, int vflag)
        //Consider restricting Hooke to only have 'velocity' as an option for damping?
        if (damping_model[itype][jtype] == VELOCITY) {
          damp_normal = 1;
        }
        else if (damping_model[itype][jtype] == VISCOELASTIC){
        } else if (damping_model[itype][jtype] == VISCOELASTIC) {
          damp_normal = a*meff;
        }
        else if (damping_model[itype][jtype] == TSUJI){
        } else if (damping_model[itype][jtype] == TSUJI) {
          damp_normal = sqrt(meff*knfac);
        }

@@ -389,12 +383,10 @@ void PairGranular::compute(int eflag, int vflag)
        if (normal_model[itype][jtype] == JKR) {
          F_pulloff = 3*M_PI*coh*Reff;
          Fncrit = fabs(Fne + 2*F_pulloff);
        }
        else if (normal_model[itype][jtype] == DMT){
        } else if (normal_model[itype][jtype] == DMT) {
          F_pulloff = 4*M_PI*coh*Reff;
          Fncrit = fabs(Fne + 2*F_pulloff);
        }
        else{
        } else {
          Fncrit = fabs(Fntot);
        }

@@ -407,8 +399,7 @@ void PairGranular::compute(int eflag, int vflag)
        if (tangential_history) {
          if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN) {
            k_tangential *= a;
          }
          else if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE){
          } else if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) {
            k_tangential *= a;
            if (a < history[3]) { //On unloading, rescale the shear displacements
              double factor = a/history[3];
@@ -461,8 +452,7 @@ void PairGranular::compute(int eflag, int vflag)
              fs3 *= Fscrit/fs;
            } else fs1 = fs2 = fs3 = 0.0;
          }
        }
        else{ //Classic pair gran/hooke (no history)
        } else{ //Classic pair gran/hooke (no history)
          fs = meff*damp_tangential*vrel;
          if (vrel != 0.0) Ft = MIN(Fne,fs) / vrel;
          else Ft = 0.0;
@@ -546,8 +536,7 @@ void PairGranular::compute(int eflag, int vflag)
            k_twist = 0.5*k_tangential*a*a;; //eq 32 of Marshall paper
            damp_twist = 0.5*damp_tangential*a*a;
            mu_twist = TWOTHIRDS*a*tangential_coeffs[itype][jtype][2];
          }
          else{
          } else {
            k_twist = twist_coeffs[itype][jtype][0];
            damp_twist = twist_coeffs[itype][jtype][1];
            mu_twist = twist_coeffs[itype][jtype][2];
@@ -675,8 +664,7 @@ void PairGranular::settings(int narg, char **arg)
{
  if (narg == 1) {
    cutoff_global = force->numeric(FLERR,arg[0]);
  }
  else{
  } else {
    cutoff_global = -1; //Will be set based on particle sizes, model choice
  }

@@ -722,16 +710,14 @@ void PairGranular::coeff(int narg, char **arg)
      normal_coeffs_one[0] = force->numeric(FLERR,arg[iarg+1]); //kn
      normal_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); //damping
      iarg += 3;
    }
    else if (strcmp(arg[iarg], "hertz") == 0){
    } else if (strcmp(arg[iarg], "hertz") == 0) {
      int num_coeffs = 2;
      if (iarg + num_coeffs >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for Hertz option");
      normal_model_one = HERTZ;
      normal_coeffs_one[0] = force->numeric(FLERR,arg[iarg+1]); //kn
      normal_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); //damping
      iarg += num_coeffs+1;
    }
    else if (strcmp(arg[iarg], "hertz/material") == 0){
    } else if (strcmp(arg[iarg], "hertz/material") == 0) {
      int num_coeffs = 3;
      if (iarg + num_coeffs >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for Hertz/material option");
      normal_model_one = HERTZ_MATERIAL;
@@ -739,8 +725,7 @@ void PairGranular::coeff(int narg, char **arg)
      normal_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); //damping
      normal_coeffs_one[2] = force->numeric(FLERR,arg[iarg+3]); //Poisson's ratio
      iarg += num_coeffs+1;
    }
    else if (strcmp(arg[iarg], "dmt") == 0){
    } else if (strcmp(arg[iarg], "dmt") == 0) {
      if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for Hertz option");
      normal_model_one = DMT;
      normal_coeffs_one[0] = force->numeric(FLERR,arg[iarg+1]); //E
@@ -748,8 +733,7 @@ void PairGranular::coeff(int narg, char **arg)
      normal_coeffs_one[2] = force->numeric(FLERR,arg[iarg+3]); //Poisson's ratio
      normal_coeffs_one[3] = force->numeric(FLERR,arg[iarg+4]); //cohesion
      iarg += 5;
    }
    else if (strcmp(arg[iarg], "jkr") == 0){
    } else if (strcmp(arg[iarg], "jkr") == 0) {
      if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for JKR option");
      beyond_contact = 1;
      normal_model_one = JKR;
@@ -758,25 +742,20 @@ void PairGranular::coeff(int narg, char **arg)
      normal_coeffs_one[2] = force->numeric(FLERR,arg[iarg+3]); //Poisson's ratio
      normal_coeffs_one[3] = force->numeric(FLERR,arg[iarg+4]); //cohesion
      iarg += 5;
    }
    else if (strcmp(arg[iarg], "damping") == 0){
    } else if (strcmp(arg[iarg], "damping") == 0) {
      if (iarg+1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters provided for damping model");
      if (strcmp(arg[iarg+1], "velocity") == 0) {
        damping_model_one = VELOCITY;
        iarg += 1;
      }
      else if (strcmp(arg[iarg+1], "viscoelastic") == 0){
      } else if (strcmp(arg[iarg+1], "viscoelastic") == 0) {
        damping_model_one = VISCOELASTIC;
        iarg += 1;
      }
      else if (strcmp(arg[iarg+1], "tsuji") == 0){
      } else if (strcmp(arg[iarg+1], "tsuji") == 0) {
        damping_model_one = TSUJI;
        iarg += 1;
      }
      else error->all(FLERR, "Illegal pair_coeff command, unrecognized damping model");
      } else error->all(FLERR, "Illegal pair_coeff command, unrecognized damping model");
      iarg += 1;
    }
    else if (strcmp(arg[iarg], "tangential") == 0){
    } else if (strcmp(arg[iarg], "tangential") == 0) {
      if (iarg + 1 >= narg) error->all(FLERR,"Illegal pair_coeff command, must specify tangential model after 'tangential' keyword");
      if (strcmp(arg[iarg+1], "linear_nohistory") == 0) {
        if (iarg + 3 >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for tangential model");
@@ -785,8 +764,7 @@ void PairGranular::coeff(int narg, char **arg)
        tangential_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); //gammat
        tangential_coeffs_one[2] = force->numeric(FLERR,arg[iarg+3]); //friction coeff.
        iarg += 4;
      }
      else if ((strcmp(arg[iarg+1], "linear_history") == 0) ||
      } else if ((strcmp(arg[iarg+1], "linear_history") == 0) ||
               (strcmp(arg[iarg+1], "mindlin") == 0) ||
               (strcmp(arg[iarg+1], "mindlin_rescale") == 0)) {
        if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for tangential model");
@@ -800,25 +778,21 @@ void PairGranular::coeff(int narg, char **arg)
            error->all(FLERR, "NULL setting for Mindlin tangential stiffness requires a normal contact model that specifies material properties");
          }
          tangential_coeffs_one[0] = -1;
        }
        else{
        } else {
          tangential_coeffs_one[0] = force->numeric(FLERR,arg[iarg+2]); //kt
        }
        tangential_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); //gammat
        tangential_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); //friction coeff.
        iarg += 5;
      }
      else{
      } else {
        error->all(FLERR, "Illegal pair_coeff command, tangential model not recognized");
      }
    }
    else if (strcmp(arg[iarg], "rolling") == 0){
    } else if (strcmp(arg[iarg], "rolling") == 0) {
      if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters");
      if (strcmp(arg[iarg+1], "none") == 0) {
        roll_model_one = ROLL_NONE;
        iarg += 2;
      }
      else if (strcmp(arg[iarg+1], "sds") == 0){
      } else if (strcmp(arg[iarg+1], "sds") == 0) {
        if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for rolling model");
        roll_model_one = ROLL_SDS;
        roll_history = 1;
@@ -826,23 +800,19 @@ void PairGranular::coeff(int narg, char **arg)
        roll_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); //gammaR
        roll_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); //rolling friction coeff.
        iarg += 5;
      }
      else{
      } else {
        error->all(FLERR, "Illegal pair_coeff command, rolling friction model not recognized");
      }
    }
    else if (strcmp(arg[iarg], "twisting") == 0){
    } else if (strcmp(arg[iarg], "twisting") == 0) {
      if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters");
      if (strcmp(arg[iarg+1], "none") == 0) {
        twist_model_one = TWIST_NONE;
        iarg += 2;
      }
      else if (strcmp(arg[iarg+1], "marshall") == 0){
      } else if (strcmp(arg[iarg+1], "marshall") == 0) {
        twist_model_one = TWIST_MARSHALL;
        twist_history = 1;
        iarg += 2;
      }
      else if (strcmp(arg[iarg+1], "sds") == 0){
      } else if (strcmp(arg[iarg+1], "sds") == 0) {
        if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, not enough parameters provided for twist model");
          twist_model_one = TWIST_SDS;
          twist_history = 1;
@@ -850,16 +820,13 @@ void PairGranular::coeff(int narg, char **arg)
          twist_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); //gammat
          twist_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); //friction coeff.
          iarg += 5;
      }
      else{
      } else {
          error->all(FLERR, "Illegal pair_coeff command, twisting friction model not recognized");
      }
    }
    else if (strcmp(arg[iarg], "cutoff") == 0){
    } else if (strcmp(arg[iarg], "cutoff") == 0) {
      if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters");
      cutoff_one = force->numeric(FLERR,arg[iarg+1]);
    }
    else error->all(FLERR, "Illegal pair coeff command");
    } else error->all(FLERR, "Illegal pair coeff command");
  }

  //It is an error not to specify normal or tangential model
@@ -873,8 +840,7 @@ void PairGranular::coeff(int narg, char **arg)
    damp = 1.2728-4.2783*cor+11.087*pow(cor,2)-22.348*pow(cor,3)+
        27.467*pow(cor,4)-18.022*pow(cor,5)+
        4.8218*pow(cor,6);
  }
  else damp = normal_coeffs_one[1];
  } else damp = normal_coeffs_one[1];

  for (int i = ilo; i <= ihi; i++) {
    for (int j = MAX(jlo,i); j <= jhi; j++) {
@@ -884,8 +850,7 @@ void PairGranular::coeff(int narg, char **arg)
        Emod[i][j] = Emod[j][i] = normal_coeffs_one[0];
        poiss[i][j] = poiss[j][i] = normal_coeffs_one[2];
        normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = FOURTHIRDS*mix_stiffnessE(Emod[i][j], Emod[i][j], poiss[i][j], poiss[i][j]);
      }
      else{
      } else {
        normal_coeffs[i][j][0] = normal_coeffs[j][i][0] = normal_coeffs_one[0];
      }
      if ((normal_model_one == JKR) || (normal_model_one == DMT))
@@ -896,8 +861,7 @@ void PairGranular::coeff(int narg, char **arg)
      tangential_model[i][j] = tangential_model[j][i] = tangential_model_one;
      if (tangential_coeffs_one[0] == -1) {
        tangential_coeffs[i][j][0] = tangential_coeffs[j][i][0] = 8*mix_stiffnessG(Emod[i][j], Emod[i][j], poiss[i][j], poiss[i][j]);
      }
      else{
      } else {
        tangential_coeffs[i][j][0] = tangential_coeffs[j][i][0] = tangential_coeffs_one[0];
      }
      for (int k = 1; k < 3; k++)
@@ -957,8 +921,7 @@ void PairGranular::init_style()
    if (tangential_history) {
      if (roll_history) twist_history_index = 6;
      else twist_history_index = 3;
    }
    else{
    } else {
      if (roll_history) twist_history_index = 3;
      else twist_history_index = 0;
    }
@@ -1053,8 +1016,7 @@ void PairGranular::init_style()
    double radius_cut = radius[i];
    if (mask[i] & freeze_group_bit) {
      onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]],radius_cut);
    }
    else{
    } else {
      onerad_dynamic[type[i]] = MAX(onerad_dynamic[type[i]],radius_cut);
    }
  }
@@ -1143,8 +1105,7 @@ double PairGranular::init_one(int i, int j)
      if (normal_model[i][j] == JKR)
        pulloff = pulloff_distance(maxrad_dynamic[i], maxrad_frozen[j], i, j);
      cutoff = MAX(cutoff,maxrad_dynamic[i]+maxrad_frozen[j]+pulloff);
    }
    else { // radius info about either i or j does not exist (i.e. not present and not about to get poured; set to largest value to not interfere with neighbor list)
    } else { // radius info about either i or j does not exist (i.e. not present and not about to get poured; set to largest value to not interfere with neighbor list)
      double cutmax = 0.0;
      for (int k = 1; k <= atom->ntypes; k++) {
        cutmax = MAX(cutmax,2.0*maxrad_dynamic[k]);
@@ -1152,11 +1113,9 @@ double PairGranular::init_one(int i, int j)
      }
      cutoff = cutmax;
    }
  }
  else if (cutoff_type[i][j] > 0){
  } else if (cutoff_type[i][j] > 0) {
    cutoff = cutoff_type[i][j];
  }
  else if (cutoff_global > 0){
  } else if (cutoff_global > 0) {
    cutoff = cutoff_global;
  }

@@ -1293,10 +1252,7 @@ double PairGranular::single(int i, int j, int itype, int jtype,
    delta_pulloff = a*a/Reff - 2*sqrt(M_PI*coh*a/E);
    dist_pulloff = radsum+delta_pulloff;
    touchflag = (rsq <= dist_pulloff*dist_pulloff);
  }
  else{
    touchflag = (rsq <= radsum*radsum);
  }
  } else touchflag = (rsq <= radsum*radsum);

  if (!touchflag) {
    fforce = 0.0;
@@ -1392,8 +1348,7 @@ double PairGranular::single(int i, int j, int itype, int jtype,
    a2 = a*a;
    knfac = normal_coeffs[itype][jtype][0]*a;
    Fne = knfac*a2/Reff - TWOPI*a2*sqrt(4*coh*E/(M_PI*a));
  }
  else{
  } else {
    knfac = E;
    Fne = knfac*delta;
    a = sqrt(dR);
@@ -1407,11 +1362,9 @@ double PairGranular::single(int i, int j, int itype, int jtype,

  if (damping_model[itype][jtype] == VELOCITY) {
    damp_normal = normal_coeffs[itype][jtype][1];
  }
  else if (damping_model[itype][jtype] == VISCOELASTIC){
  } else if (damping_model[itype][jtype] == VISCOELASTIC) {
    damp_normal = normal_coeffs[itype][jtype][1]*a*meff;
  }
  else if (damping_model[itype][jtype] == TSUJI){
  } else if (damping_model[itype][jtype] == TSUJI) {
    damp_normal = normal_coeffs[itype][jtype][1]*sqrt(meff*knfac);
  }

@@ -1457,12 +1410,10 @@ double PairGranular::single(int i, int j, int itype, int jtype,
  if (normal_model[itype][jtype] == JKR) {
    F_pulloff = 3*M_PI*coh*Reff;
    Fncrit = fabs(Fne + 2*F_pulloff);
  }
  else if (normal_model[itype][jtype] == DMT){
  } else if (normal_model[itype][jtype] == DMT) {
    F_pulloff = 4*M_PI*coh*Reff;
    Fncrit = fabs(Fne + 2*F_pulloff);
  }
  else{
  } else {
    Fncrit = fabs(Fntot);
  }

@@ -1475,8 +1426,7 @@ double PairGranular::single(int i, int j, int itype, int jtype,
  if (tangential_history) {
    if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN) {
      k_tangential *= a;
    }
    else if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE){
    } else if (tangential_model[itype][jtype] == TANGENTIAL_MINDLIN_RESCALE) {
      k_tangential *= a;
      if (a < history[3]) { //On unloading, rescale the shear displacements
        double factor = a/history[3];
@@ -1507,8 +1457,7 @@ double PairGranular::single(int i, int j, int itype, int jtype,
        fs3 *= Fscrit/fs;
      } else fs1 = fs2 = fs3 = 0.0;
    }
  }
  else{ //Classic pair gran/hooke (no history)
  } else { //Classic pair gran/hooke (no history)
    fs = meff*damp_tangential*vrel;
    if (vrel != 0.0) Ft = MIN(Fne,fs) / vrel;
    else Ft = 0.0;
@@ -1571,8 +1520,7 @@ double PairGranular::single(int i, int j, int itype, int jtype,
      k_twist = 0.5*k_tangential*a*a;; //eq 32
      damp_twist = 0.5*damp_tangential*a*a;
      mu_twist = TWOTHIRDS*a*tangential_coeffs[itype][jtype][2];;
    }
    else{
    } else {
      k_twist = twist_coeffs[itype][jtype][0];
      damp_twist = twist_coeffs[itype][jtype][1];
      mu_twist = twist_coeffs[itype][jtype][2];