Further tweaked the flangevin issue

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14466 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
athomps
2016-01-21 18:16:07 +00:00
parent d13b2ecfc9
commit eebf110e02
2 changed files with 9 additions and 1 deletions

View File

@ -146,7 +146,13 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) :
temperature = NULL; temperature = NULL;
energy = 0.0; energy = 0.0;
// flangevin is unallocated until first call to setup()
// compute_scalar checks for this and returns 0.0
// if flangevin_allocated is not set
flangevin = NULL; flangevin = NULL;
flangevin_allocated = 0;
franprev = NULL; franprev = NULL;
tforce = NULL; tforce = NULL;
maxatom1 = maxatom2 = 0; maxatom1 = maxatom2 = 0;
@ -510,6 +516,7 @@ void FixLangevin::post_force_untemplated
maxatom1 = atom->nmax; maxatom1 = atom->nmax;
memory->create(flangevin,maxatom1,3,"langevin:flangevin"); memory->create(flangevin,maxatom1,3,"langevin:flangevin");
} }
flangevin_allocated = 1;
} }
if (Tp_BIAS) temperature->compute_scalar(); if (Tp_BIAS) temperature->compute_scalar();
@ -824,7 +831,7 @@ int FixLangevin::modify_param(int narg, char **arg)
double FixLangevin::compute_scalar() double FixLangevin::compute_scalar()
{ {
if (!tallyflag) return 0.0; if (!tallyflag || !flangevin_allocated) return 0.0;
// capture the very first energy transfer to thermal reservoir // capture the very first energy transfer to thermal reservoir

View File

@ -47,6 +47,7 @@ class FixLangevin : public Fix {
protected: protected:
int gjfflag,oflag,tallyflag,zeroflag,tbiasflag; int gjfflag,oflag,tallyflag,zeroflag,tbiasflag;
int flangevin_allocated;
double ascale; double ascale;
double t_start,t_stop,t_period,t_target; double t_start,t_stop,t_period,t_target;
double *gfactor1,*gfactor2,*ratio; double *gfactor1,*gfactor2,*ratio;