Unverified Commit 3a0ae83c authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

apply simplifications to standard packages

parent a1c0b78a
Loading
Loading
Loading
Loading
+9 −22
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@


#include "fix_nph_asphere.h"
#include "fix_nph_asphere.h"
#include <cstring>
#include <cstring>
#include <string>
#include "modify.h"
#include "modify.h"
#include "error.h"
#include "error.h"


@@ -35,35 +36,21 @@ FixNPHAsphere::FixNPHAsphere(LAMMPS *lmp, int narg, char **arg) :
  // compute group = all since pressure is always global (group all)
  // compute group = all since pressure is always global (group all)
  // and thus its KE/temperature contribution should use group all
  // and thus its KE/temperature contribution should use group all


  int n = strlen(id) + 6;
  std::string tcmd = id + std::string("_temp");
  id_temp = new char[n];
  id_temp = new char[tcmd.size()+1];
  strcpy(id_temp,id);
  strcpy(id_temp,tcmd.c_str());
  strcat(id_temp,"_temp");


  char **newarg = new char*[3];
  modify->add_compute(tcmd + " all temp/asphere");
  newarg[0] = id_temp;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "temp/asphere";

  modify->add_compute(3,newarg);
  delete [] newarg;
  tcomputeflag = 1;
  tcomputeflag = 1;


  // create a new compute pressure style
  // create a new compute pressure style
  // id = fix-ID + press, compute group = all
  // id = fix-ID + press, compute group = all
  // pass id_temp as 4th arg to pressure constructor
  // pass id_temp as 4th arg to pressure constructor


  n = strlen(id) + 7;
  std::string pcmd = id + std::string("_press");
  id_press = new char[n];
  id_press = new char[pcmd.size()+1];
  strcpy(id_press,id);
  strcpy(id_press,pcmd.c_str());
  strcat(id_press,"_press");


  newarg = new char*[4];
  modify->add_compute(pcmd + " all pressure " + std::string(id_temp));
  newarg[0] = id_press;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "pressure";
  newarg[3] = id_temp;
  modify->add_compute(4,newarg);
  delete [] newarg;
  pcomputeflag = 1;
  pcomputeflag = 1;
}
}
+9 −22
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@


#include "fix_npt_asphere.h"
#include "fix_npt_asphere.h"
#include <cstring>
#include <cstring>
#include <string>
#include "modify.h"
#include "modify.h"
#include "error.h"
#include "error.h"


@@ -34,35 +35,21 @@ FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) :
  // compute group = all since pressure is always global (group all)
  // compute group = all since pressure is always global (group all)
  // and thus its KE/temperature contribution should use group all
  // and thus its KE/temperature contribution should use group all


  int n = strlen(id) + 6;
  std::string tcmd = id + std::string("_temp");
  id_temp = new char[n];
  id_temp = new char[tcmd.size()+1];
  strcpy(id_temp,id);
  strcpy(id_temp,tcmd.c_str());
  strcat(id_temp,"_temp");


  char **newarg = new char*[3];
  modify->add_compute(tcmd + " all temp/asphere");
  newarg[0] = id_temp;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "temp/asphere";

  modify->add_compute(3,newarg);
  delete [] newarg;
  tcomputeflag = 1;
  tcomputeflag = 1;


  // create a new compute pressure style
  // create a new compute pressure style
  // id = fix-ID + press, compute group = all
  // id = fix-ID + press, compute group = all
  // pass id_temp as 4th arg to pressure constructor
  // pass id_temp as 4th arg to pressure constructor


  n = strlen(id) + 7;
  std::string pcmd = id + std::string("_press");
  id_press = new char[n];
  id_press = new char[pcmd.size()+1];
  strcpy(id_press,id);
  strcpy(id_press,pcmd.c_str());
  strcat(id_press,"_press");


  newarg = new char*[4];
  modify->add_compute(pcmd + " all pressure " + std::string(id_temp));
  newarg[0] = id_press;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "pressure";
  newarg[3] = id_temp;
  modify->add_compute(4,newarg);
  delete [] newarg;
  pcomputeflag = 1;
  pcomputeflag = 1;
}
}
+7 −11
Original line number Original line Diff line number Diff line
@@ -13,9 +13,11 @@


#include "fix_nvt_asphere.h"
#include "fix_nvt_asphere.h"
#include <cstring>
#include <cstring>
#include <string>
#include "group.h"
#include "group.h"
#include "modify.h"
#include "modify.h"
#include "error.h"
#include "error.h"
#include "fmt/format.h"


using namespace LAMMPS_NS;
using namespace LAMMPS_NS;
using namespace FixConst;
using namespace FixConst;
@@ -33,17 +35,11 @@ FixNVTAsphere::FixNVTAsphere(LAMMPS *lmp, int narg, char **arg) :
  // create a new compute temp style
  // create a new compute temp style
  // id = fix-ID + temp
  // id = fix-ID + temp


  int n = strlen(id) + 6;
  std::string cmd = id + std::string("_temp");
  id_temp = new char[n];
  id_temp = new char[cmd.size()+1];
  strcpy(id_temp,id);
  strcpy(id_temp,cmd.c_str());
  strcat(id_temp,"_temp");


  char **newarg = new char*[3];
  cmd += fmt::format(" {} temp/asphere",group->names[igroup]);
  newarg[0] = id_temp;
  modify->add_compute(cmd);
  newarg[1] = group->names[igroup];
  newarg[2] = (char *) "temp/asphere";

  modify->add_compute(3,newarg);
  delete [] newarg;
  tcomputeflag = 1;
  tcomputeflag = 1;
}
}
+9 −22
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@


#include "fix_nph_body.h"
#include "fix_nph_body.h"
#include <cstring>
#include <cstring>
#include <string>
#include "modify.h"
#include "modify.h"
#include "error.h"
#include "error.h"


@@ -38,35 +39,21 @@ FixNPHBody::FixNPHBody(LAMMPS *lmp, int narg, char **arg) :
  // compute group = all since pressure is always global (group all)
  // compute group = all since pressure is always global (group all)
  // and thus its KE/temperature contribution should use group all
  // and thus its KE/temperature contribution should use group all


  int n = strlen(id) + 6;
  std::string tcmd = id + std::string("_temp");
  id_temp = new char[n];
  id_temp = new char[tcmd.size()+1];
  strcpy(id_temp,id);
  strcpy(id_temp,tcmd.c_str());
  strcat(id_temp,"_temp");


  char **newarg = new char*[3];
  modify->add_compute(tcmd + " all temp/body");
  newarg[0] = id_temp;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "temp/body";

  modify->add_compute(3,newarg);
  delete [] newarg;
  tcomputeflag = 1;
  tcomputeflag = 1;


  // create a new compute pressure style
  // create a new compute pressure style
  // id = fix-ID + press, compute group = all
  // id = fix-ID + press, compute group = all
  // pass id_temp as 4th arg to pressure constructor
  // pass id_temp as 4th arg to pressure constructor


  n = strlen(id) + 7;
  std::string pcmd = id + std::string("_press");
  id_press = new char[n];
  id_press = new char[pcmd.size()+1];
  strcpy(id_press,id);
  strcpy(id_press,pcmd.c_str());
  strcat(id_press,"_press");


  newarg = new char*[4];
  modify->add_compute(pcmd + " all pressure " + std::string(id_temp));
  newarg[0] = id_press;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "pressure";
  newarg[3] = id_temp;
  modify->add_compute(4,newarg);
  delete [] newarg;
  pcomputeflag = 1;
  pcomputeflag = 1;
}
}
+9 −22
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@


#include "fix_npt_body.h"
#include "fix_npt_body.h"
#include <cstring>
#include <cstring>
#include <string>
#include "modify.h"
#include "modify.h"
#include "error.h"
#include "error.h"


@@ -38,35 +39,21 @@ FixNPTBody::FixNPTBody(LAMMPS *lmp, int narg, char **arg) :
  // compute group = all since pressure is always global (group all)
  // compute group = all since pressure is always global (group all)
  // and thus its KE/temperature contribution should use group all
  // and thus its KE/temperature contribution should use group all


  int n = strlen(id) + 6;
  std::string tcmd = id + std::string("_temp");
  id_temp = new char[n];
  id_temp = new char[tcmd.size()+1];
  strcpy(id_temp,id);
  strcpy(id_temp,tcmd.c_str());
  strcat(id_temp,"_temp");


  char **newarg = new char*[3];
  modify->add_compute(tcmd + " all temp/body");
  newarg[0] = id_temp;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "temp/body";

  modify->add_compute(3,newarg);
  delete [] newarg;
  tcomputeflag = 1;
  tcomputeflag = 1;


  // create a new compute pressure style
  // create a new compute pressure style
  // id = fix-ID + press, compute group = all
  // id = fix-ID + press, compute group = all
  // pass id_temp as 4th arg to pressure constructor
  // pass id_temp as 4th arg to pressure constructor


  n = strlen(id) + 7;
  std::string pcmd = id + std::string("_press");
  id_press = new char[n];
  id_press = new char[pcmd.size()+1];
  strcpy(id_press,id);
  strcpy(id_press,pcmd.c_str());
  strcat(id_press,"_press");


  newarg = new char*[4];
  modify->add_compute(pcmd + " all pressure " + std::string(id_temp));
  newarg[0] = id_press;
  newarg[1] = (char *) "all";
  newarg[2] = (char *) "pressure";
  newarg[3] = id_temp;
  modify->add_compute(4,newarg);
  delete [] newarg;
  pcomputeflag = 1;
  pcomputeflag = 1;
}
}
Loading