Skip to content
Snippets Groups Projects
Commit 23781d6e authored by Steven Strong's avatar Steven Strong Committed by Axel Kohlmeyer
Browse files

added respa to fix_flow_gauss, not fully understood yet

(cherry picked from commit 8d9737b04df5158d512b7708023af0b154899fa9)
parent e9fed809
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "citeme.h" #include "citeme.h"
#include "respa.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
...@@ -63,6 +64,8 @@ FixFlowGauss::FixFlowGauss(LAMMPS *lmp, int narg, char **arg) : ...@@ -63,6 +64,8 @@ FixFlowGauss::FixFlowGauss(LAMMPS *lmp, int narg, char **arg) :
extvector = 1; extvector = 1;
size_vector = 3; size_vector = 3;
global_freq = 1; //data available every timestep global_freq = 1; //data available every timestep
respa_level_support = 1;
ilevel_respa = 0; //default= innermost respa level
dimension = domain->dimension; dimension = domain->dimension;
...@@ -109,9 +112,23 @@ int FixFlowGauss::setmask() ...@@ -109,9 +112,23 @@ int FixFlowGauss::setmask()
int mask = 0; int mask = 0;
mask |= POST_FORCE; mask |= POST_FORCE;
mask |= THERMO_ENERGY; mask |= THERMO_ENERGY;
mask |= POST_FORCE_RESPA;
return mask; return mask;
} }
/* ---------------------------------------------------------------------- */
void FixFlowGauss::init()
{
//if respa level specified by fix_modify, then override default here
//if specified level too high, set to max level
if (strstr(update->integrate_style,"respa")) {
int max_respa = ((Respa *) update->integrate)->nlevels-1;
if (respa_level >= 0)
ilevel_respa = MIN(respa_level,max_respa);
}
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
setup is called after the initial evaluation of forces before a run, so we setup is called after the initial evaluation of forces before a run, so we
must remove the total force here too must remove the total force here too
...@@ -127,7 +144,13 @@ void FixFlowGauss::setup(int vflag) ...@@ -127,7 +144,13 @@ void FixFlowGauss::setup(int vflag)
if (mTot <= 0.0) if (mTot <= 0.0)
error->all(FLERR,"Invalid group mass in fix flow/gauss"); error->all(FLERR,"Invalid group mass in fix flow/gauss");
post_force(vflag); if (strstr(update->integrate_style,"verlet"))
post_force(vflag);
else {
((Respa *) update->integrate)->copy_flevel_f(ilevel_respa);
post_force_respa(vflag,ilevel_respa,0);
((Respa *) update->integrate)->copy_f_flevel(ilevel_respa);
}
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
...@@ -201,6 +224,11 @@ void FixFlowGauss::post_force(int vflag) ...@@ -201,6 +224,11 @@ void FixFlowGauss::post_force(int vflag)
} }
void FixFlowGauss::post_force_respa(int vflag, int ilevel, int iloop)
{
if (ilevel == ilevel_respa) post_force(vflag);
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
negative of work done by this fix negative of work done by this fix
This is only computed if requested, either with fix_modify energy yes, or with the energy keyword. Otherwise returns 0. This is only computed if requested, either with fix_modify energy yes, or with the energy keyword. Otherwise returns 0.
......
...@@ -30,10 +30,12 @@ FixStyle(flow/gauss,FixFlowGauss) ...@@ -30,10 +30,12 @@ FixStyle(flow/gauss,FixFlowGauss)
public: public:
FixFlowGauss(class LAMMPS *, int, char **); FixFlowGauss(class LAMMPS *, int, char **);
int setmask(); int setmask();
void init();
void setup(int);
void post_force(int);
void post_force_respa(int, int, int);
double compute_scalar(); double compute_scalar();
double compute_vector(int n); double compute_vector(int n);
void post_force(int);
void setup(int);
protected: protected:
int dimension; int dimension;
...@@ -44,6 +46,7 @@ FixStyle(flow/gauss,FixFlowGauss) ...@@ -44,6 +46,7 @@ FixStyle(flow/gauss,FixFlowGauss)
double pe_tot; //total added energy double pe_tot; //total added energy
double dt; //timestep double dt; //timestep
bool workflag; //if calculate work done by fix bool workflag; //if calculate work done by fix
int ilevel_respa;
}; };
......
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