Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -34,11 +34,19 @@ using namespace LAMMPS_NS; ...@@ -34,11 +34,19 @@ using namespace LAMMPS_NS;
ComputePressureGrem::ComputePressureGrem(LAMMPS *lmp, int narg, char **arg) : ComputePressureGrem::ComputePressureGrem(LAMMPS *lmp, int narg, char **arg) :
ComputePressure(lmp, narg-1, 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() void ComputePressureGrem::init()
{ {
ComputePressure::init(); ComputePressure::init();
...@@ -70,8 +78,8 @@ double ComputePressureGrem::compute_scalar() ...@@ -70,8 +78,8 @@ double ComputePressureGrem::compute_scalar()
double t; double t;
if (keflag) { if (keflag) {
if (temperature->invoked_scalar != update->ntimestep) if (temperature->invoked_scalar != update->ntimestep)
t = temperature->compute_scalar() * (*scale_grem); t = temperature->compute_scalar() / (*scale_grem);
else t = temperature->scalar * (*scale_grem); else t = temperature->scalar / (*scale_grem);
} }
if (dimension == 3) { if (dimension == 3) {
...@@ -119,7 +127,7 @@ void ComputePressureGrem::compute_vector() ...@@ -119,7 +127,7 @@ void ComputePressureGrem::compute_vector()
ke_tensor = temperature->vector; ke_tensor = temperature->vector;
} }
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
ke_tensor[i] *= *scale_grem; ke_tensor[i] /= *scale_grem;
if (dimension == 3) { if (dimension == 3) {
inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd); inv_volume = 1.0 / (domain->xprd * domain->yprd * domain->zprd);
......
...@@ -27,7 +27,7 @@ namespace LAMMPS_NS { ...@@ -27,7 +27,7 @@ namespace LAMMPS_NS {
class ComputePressureGrem : public ComputePressure { class ComputePressureGrem : public ComputePressure {
public: public:
ComputePressureGrem(class LAMMPS *, int, char **); ComputePressureGrem(class LAMMPS *, int, char **);
virtual ~ComputePressureGrem() {}; virtual ~ComputePressureGrem();
virtual void init(); virtual void init();
virtual double compute_scalar(); virtual double compute_scalar();
virtual void compute_vector(); virtual void compute_vector();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment