Commit 09544d06 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

bugfix for compute pressure/grem: must make a copy of argument strings

parent 20daf824
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -34,11 +34,19 @@ using namespace LAMMPS_NS;
ComputePressureGrem::ComputePressureGrem(LAMMPS *lmp, int narg, char **arg) :
  ComputePressure(lmp, narg-1, arg)
{
  fix_grem = arg[narg-1];
  int len = strlen(arg[narg-1])+1;
  fix_grem = new char[len];
  strcpy(fix_grem,arg[narg-1]);
}

/* ---------------------------------------------------------------------- */

ComputePressureGrem::~ComputePressureGrem()
{
  delete [] fix_grem;
}
/* ---------------------------------------------------------------------- */

void ComputePressureGrem::init()
{
  ComputePressure::init();
@@ -70,8 +78,8 @@ double ComputePressureGrem::compute_scalar()
  double t;
  if (keflag) {
    if (temperature->invoked_scalar != update->ntimestep)
      t = temperature->compute_scalar() * (*scale_grem);
    else t = temperature->scalar * (*scale_grem);
      t = temperature->compute_scalar() / (*scale_grem);
    else t = temperature->scalar / (*scale_grem);
  }

  if (dimension == 3) {
@@ -119,7 +127,7 @@ void ComputePressureGrem::compute_vector()
    ke_tensor = temperature->vector;
  }
  for (int i = 0; i < 6; i++)
    ke_tensor[i] *= *scale_grem;
    ke_tensor[i] /= *scale_grem;

  if (dimension == 3) {
    inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd);
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class ComputePressureGrem : public ComputePressure {
 public:
  ComputePressureGrem(class LAMMPS *, int, char **);
  virtual ~ComputePressureGrem() {};
  virtual ~ComputePressureGrem();
  virtual void init();
  virtual double compute_scalar();
  virtual void compute_vector();