Skip to content
Snippets Groups Projects
Commit 713b2af0 authored by sjplimp's avatar sjplimp Committed by GitHub
Browse files

Merge pull request #221 from akohlmey/collected-bugfixes

Collected bugfixes and small changes
parents 6eadd45c a752966e
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,7 @@ name. In this case, the variable will be evaluated each timestep, and ...@@ -54,7 +54,7 @@ name. In this case, the variable will be evaluated each timestep, and
its value used to determine the target temperature. its value used to determine the target temperature.
Equal-style variables can specify formulas with various mathematical Equal-style variables can specify formulas with various mathematical
functions, and include "thermo_style"_thermox_style.html command functions, and include "thermo_style"_thermo_style.html command
keywords for the simulation box parameters and timestep and elapsed keywords for the simulation box parameters and timestep and elapsed
time. Thus it is easy to specify a time-dependent temperature. time. Thus it is easy to specify a time-dependent temperature.
......
...@@ -85,6 +85,8 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : ...@@ -85,6 +85,8 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) :
FixWallGranRegion::~FixWallGranRegion() FixWallGranRegion::~FixWallGranRegion()
{ {
delete [] c2r; delete [] c2r;
delete [] region_style;
memory->destroy(ncontact); memory->destroy(ncontact);
memory->destroy(walls); memory->destroy(walls);
memory->destroy(shearmany); memory->destroy(shearmany);
......
...@@ -33,10 +33,6 @@ class FixDPDenergy : public Fix { ...@@ -33,10 +33,6 @@ class FixDPDenergy : public Fix {
virtual void final_integrate(); virtual void final_integrate();
protected: protected:
double dtv,dtf;
int mass_require;
int eos;
class PairDPDfdtEnergy *pairDPDE; class PairDPDfdtEnergy *pairDPDE;
}; };
......
...@@ -182,7 +182,7 @@ void FixHalt::end_of_step() ...@@ -182,7 +182,7 @@ void FixHalt::end_of_step()
void FixHalt::post_run() void FixHalt::post_run()
{ {
// continue halt -> subsequent runs are allowd // continue halt -> subsequent runs are allowed
if (eflag == CONTINUE) timer->reset_timeout(); if (eflag == CONTINUE) timer->reset_timeout();
} }
......
...@@ -174,34 +174,31 @@ int RegCone::inside(double x, double y, double z) ...@@ -174,34 +174,31 @@ int RegCone::inside(double x, double y, double z)
{ {
double del1,del2,dist; double del1,del2,dist;
double currentradius; double currentradius;
int inside;
if (axis == 'x') { if (axis == 'x') {
del1 = y - c1; del1 = y - c1;
del2 = z - c2; del2 = z - c2;
dist = sqrt(del1*del1 + del2*del2); dist = sqrt(del1*del1 + del2*del2);
currentradius = radiuslo + (x-lo)*(radiushi-radiuslo)/(hi-lo); currentradius = radiuslo + (x-lo)*(radiushi-radiuslo)/(hi-lo);
if (dist <= currentradius && x >= lo && x <= hi) inside = 1; if (dist <= currentradius && x >= lo && x <= hi) return 1;
else inside = 0; else return 0;
} } else if (axis == 'y') {
if (axis == 'y') {
del1 = x - c1; del1 = x - c1;
del2 = z - c2; del2 = z - c2;
dist = sqrt(del1*del1 + del2*del2); dist = sqrt(del1*del1 + del2*del2);
currentradius = radiuslo + (y-lo)*(radiushi-radiuslo)/(hi-lo); currentradius = radiuslo + (y-lo)*(radiushi-radiuslo)/(hi-lo);
if (dist <= currentradius && y >= lo && y <= hi) inside = 1; if (dist <= currentradius && y >= lo && y <= hi) return 1;
else inside = 0; else return 0;
} } else if (axis == 'z') {
if (axis == 'z') {
del1 = x - c1; del1 = x - c1;
del2 = y - c2; del2 = y - c2;
dist = sqrt(del1*del1 + del2*del2); dist = sqrt(del1*del1 + del2*del2);
currentradius = radiuslo + (z-lo)*(radiushi-radiuslo)/(hi-lo); currentradius = radiuslo + (z-lo)*(radiushi-radiuslo)/(hi-lo);
if (dist <= currentradius && z >= lo && z <= hi) inside = 1; if (dist <= currentradius && z >= lo && z <= hi) return 1;
else inside = 0; else return 0;
} }
return inside; return 0;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
...@@ -414,7 +411,7 @@ int RegCone::surface_exterior(double *x, double cutoff) ...@@ -414,7 +411,7 @@ int RegCone::surface_exterior(double *x, double cutoff)
// radius of curvature, only used for granular walls // radius of curvature, only used for granular walls
double crad = 0.0; crad = 0.0;
// x is far enough from cone that there is no contact // x is far enough from cone that there is no contact
// x is interior to cone // x is interior to cone
...@@ -478,6 +475,10 @@ int RegCone::surface_exterior(double *x, double cutoff) ...@@ -478,6 +475,10 @@ int RegCone::surface_exterior(double *x, double cutoff)
r = sqrt(del1*del1 + del2*del2); r = sqrt(del1*del1 + del2*del2);
currentradius = radiuslo + (x[1]-lo)*(radiushi-radiuslo)/(hi-lo); currentradius = radiuslo + (x[1]-lo)*(radiushi-radiuslo)/(hi-lo);
// radius of curvature, only used for granular walls
crad = 0.0;
// y is far enough from cone that there is no contact // y is far enough from cone that there is no contact
// y is interior to cone // y is interior to cone
...@@ -539,6 +540,10 @@ int RegCone::surface_exterior(double *x, double cutoff) ...@@ -539,6 +540,10 @@ int RegCone::surface_exterior(double *x, double cutoff)
r = sqrt(del1*del1 + del2*del2); r = sqrt(del1*del1 + del2*del2);
currentradius = radiuslo + (x[2]-lo)*(radiushi-radiuslo)/(hi-lo); currentradius = radiuslo + (x[2]-lo)*(radiushi-radiuslo)/(hi-lo);
// radius of curvature, only used for granular walls
crad = 0.0;
// z is far enough from cone that there is no contact // z is far enough from cone that there is no contact
// z is interior to cone // z is interior to cone
......
...@@ -67,7 +67,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : ...@@ -67,7 +67,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) :
shape_update(); shape_update();
} else { } else {
radius = force->numeric(FLERR,arg[5]); radius = force->numeric(FLERR,arg[5]);
if (axis == 'x') radius *= xscale; if (axis == 'x') radius *= yscale;
else radius *= xscale; else radius *= xscale;
rstyle = CONSTANT; rstyle = CONSTANT;
} }
...@@ -618,7 +618,7 @@ int RegCylinder::surface_exterior(double *x, double cutoff) ...@@ -618,7 +618,7 @@ int RegCylinder::surface_exterior(double *x, double cutoff)
dx = 0; dx = 0;
zp = x[2]; zp = x[2];
} }
d2 = d2prev = dr2 + dx*dx; d2prev = dr2 + dx*dx;
} }
// closest point on bottom cap // closest point on bottom cap
......
...@@ -95,10 +95,10 @@ Timer::Timer(LAMMPS *lmp) : Pointers(lmp) ...@@ -95,10 +95,10 @@ Timer::Timer(LAMMPS *lmp) : Pointers(lmp)
{ {
_level = NORMAL; _level = NORMAL;
_sync = OFF; _sync = OFF;
_timeout = -1.0; _timeout = -1;
_s_timeout = -1;
_checkfreq = 10; _checkfreq = 10;
_nextcheck = -1; _nextcheck = -1;
_laststep = -1;
this->_stamp(RESET); this->_stamp(RESET);
} }
...@@ -216,7 +216,7 @@ void Timer::set_wall(enum ttype which, double newtime) ...@@ -216,7 +216,7 @@ void Timer::set_wall(enum ttype which, double newtime)
void Timer::init_timeout() void Timer::init_timeout()
{ {
_laststep = -1; _s_timeout = _timeout;
if (_timeout < 0) if (_timeout < 0)
_nextcheck = -1; _nextcheck = -1;
else else
...@@ -249,14 +249,6 @@ void Timer::print_timeout(FILE *fp) ...@@ -249,14 +249,6 @@ void Timer::print_timeout(FILE *fp)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void Timer::force_timeout()
{
_timeout = 0.0;
_nextcheck = _laststep + 1;
}
/* ---------------------------------------------------------------------- */
bool Timer::_check_timeout() bool Timer::_check_timeout()
{ {
double walltime = MPI_Wtime() - timeout_start; double walltime = MPI_Wtime() - timeout_start;
......
...@@ -64,7 +64,10 @@ class Timer : protected Pointers { ...@@ -64,7 +64,10 @@ class Timer : protected Pointers {
void init_timeout(); void init_timeout();
// trigger enforced timeout // trigger enforced timeout
void force_timeout(); void force_timeout() { _timeout = 0.0; }
// restore original timeout setting after enforce timeout
void reset_timeout() { _timeout = _s_timeout; }
// get remaining time in seconds. 0.0 if inactive, negative if expired // get remaining time in seconds. 0.0 if inactive, negative if expired
double get_timeout_remain(); double get_timeout_remain();
...@@ -75,7 +78,7 @@ class Timer : protected Pointers { ...@@ -75,7 +78,7 @@ class Timer : protected Pointers {
// check for timeout. inline wrapper around internal // check for timeout. inline wrapper around internal
// function to reduce overhead in case there is no check. // function to reduce overhead in case there is no check.
bool check_timeout(int step) { bool check_timeout(int step) {
_laststep = step; if (_timeout == 0.0) return true;
if (_nextcheck != step) return false; if (_nextcheck != step) return false;
else return _check_timeout(); else return _check_timeout();
} }
...@@ -91,9 +94,9 @@ class Timer : protected Pointers { ...@@ -91,9 +94,9 @@ class Timer : protected Pointers {
int _level; // level of detail: off=0,loop=1,normal=2,full=3 int _level; // level of detail: off=0,loop=1,normal=2,full=3
int _sync; // if nonzero, synchronize tasks before setting the timer int _sync; // if nonzero, synchronize tasks before setting the timer
int _timeout; // max allowed wall time in seconds. infinity if negative int _timeout; // max allowed wall time in seconds. infinity if negative
int _s_timeout; // copy of timeout for restoring after a forced timeout
int _checkfreq; // frequency of timeout checking int _checkfreq; // frequency of timeout checking
int _nextcheck; // loop number of next timeout check int _nextcheck; // loop number of next timeout check
int _laststep; // loop number of last iteration
// update one specific timer array // update one specific timer array
void _stamp(enum ttype); void _stamp(enum ttype);
......
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