56 const unsigned int lprev,
57 const unsigned int nprev,
58 const unsigned int aprev):
59 l(l),n(n),a(a),lprev(lprev),nprev(nprev),aprev(aprev)
101 std::vector<unsigned int>
_M;
104 std::vector<unsigned int>
_A;
110 std::vector<double>
_P;
114 std::vector<unsigned int>
_S;
119 std::vector<unsigned int>
_N ;
129 bool initializeQueueFlag;
144 std::vector<std::vector<double>>
_pB;
247 const MPI_Comm& comm,
248 double ninterfaces, std::vector<double> interfaces,
249 unsigned int N0Target, std::vector<unsigned int> M,
250 bool initialFluxFlag,
bool saveTrajectories,
251 unsigned int currentInterface, std::string output_directory,
unsigned int frequency) :
263 initializeQueueFlag =
true;
295 bool errflag =
false;
308 std::cerr <<
"Error! The interfaces are poorly defined. They must be monotonically increasing or decreasing and cannot equal one another! Please fix this.\n";
310 std::cerr <<
interface << " ";
312 MPI_Abort(
world_, EXIT_FAILURE);
318 std::normal_distribution<double> distribution(0,1);
319 for (
unsigned int i = 0; i <
_N0Target ; i++)
367 const MPI_Comm& world,
368 const MPI_Comm& comm,
369 const std::string& path);
void ReconstructTrajectories(Snapshot *)
When simulation is finished, parse through the trajectories that reached B, and reconstruct the compl...
void PostSimulation(Snapshot *snapshot, const class CVManager &cvmanager) override
Post-simulation hook.
double _rate
rate constant
Collective variable manager.
FFSConfigID()
Empty Constructor.
std::vector< unsigned int > _M
std::vector< CollectiveVariable * > CVList
List of Collective Variables.
std::vector< unsigned int > _S
std::vector< unsigned int > _A
Number of attempts from interface i.
unsigned int _current_interface
Current Interface.
bool _pop_tried_but_empty_queue
std::vector< unsigned int > _N
Class containing a snapshot of the current simulation in time.
void CheckInitialStructure(const CVList &)
Function that checks the initial structure that user provides.
Interface for Method implementations.
void WriteFFSConfiguration(Snapshot *snapshot, FFSConfigID &ffsconfig, bool wassuccess)
Write a file corresponding to FFSConfigID from current snapshot.
ForwardFlux sampling method.
virtual void CheckForInterfaceCrossings(Snapshot *, const class CVManager &)=0
Function that checks if interfaces have been crossed (different for each FFS flavor) ...
double _cvvalue_previous
Previous cv position, used to determine if you've crossed an interface since last time...
unsigned int aprev
Previous Attempt number.
mxx::comm world_
Global MPI communicator.
uint iteration_
Method iteration counter/.
FFSConfigID(const unsigned int l, const unsigned int n, const unsigned int a, const unsigned int lprev, const unsigned int nprev, const unsigned int aprev)
Constructor.
void ComputeInitialFlux(Snapshot *, const CVList &)
Compute Initial Flux.
double _cvvalue
current cv position
bool HasReturnedToA(double)
Function checks if configuration has returned to A.
bool _initialFluxFlag
if 1 compute initial flux
virtual void InitializeQueue(Snapshot *, const CVList &)=0
Initialize the Queue.
unsigned int a
Attempt number.
void ComputeTransitionProbabilities()
Compute the probability of going from each lambda_i to lambda_{i+1}.
std::deque< FFSConfigID > FFSConfigIDQueue
virtual void PostIntegration(Snapshot *snapshot, const class CVManager &cvmanager)=0
Post-integration hook.
unsigned int lprev
Previous Interface number (i.e. traj I came from)
Nested class to store different FFS Config IDs.
void ComputeCommittorProbability(Snapshot *)
When simulation is finished, recursively parse through the trajectories that reached B or failed back...
void WriteInitialFlux()
Function to compute and write the initial flux.
unsigned int nprev
Previous Configuration Number.
std::ofstream _trajectory_file
file to which the current trajectory is written to
int HasCrossedInterface(double, double, unsigned int interface)
Function checks if configuration has crossed interface specified since the last check.
void ReadFFSConfiguration(Snapshot *, FFSConfigID &, bool)
Read a file corresponding to a FFSConfigID into current snapshot.
void AppendTrajectoryFile(Snapshot *, std::ofstream &)
std::string _output_directory
Directory of FFS output.
std::vector< double > _P
Flag to determine wheter fluxA0 should be calculated, seems not using this.
void FluxBruteForce(Snapshot *, const CVList &)
Compute the flux via brute force.
unsigned int _nfailure_total
double _fluxA0
Flux of trajectories out of state A. Denoted PhiA0 over h_A in Allen2009.
void PrintQueue()
Print the queue, useful for debugging.
unsigned int n
Configuration Number.
ForwardFlux(const MPI_Comm &world, const MPI_Comm &comm, double ninterfaces, std::vector< double > interfaces, unsigned int N0Target, std::vector< unsigned int > M, bool initialFluxFlag, bool saveTrajectories, unsigned int currentInterface, std::string output_directory, unsigned int frequency)
Constructor.
unsigned int _N0Target
Number of configurations to store at lambda0, target.
bool _saveTrajectories
should the FFS trajectories be saved
void PreSimulation(Snapshot *snapshot, const class CVManager &cvmanager) override
Pre-simulation hook.
std::default_random_engine _generator
random number generator
static ForwardFlux * Build(const Json::Value &json, const MPI_Comm &world, const MPI_Comm &comm, const std::string &path)
double _N0TotalSimTime
Total Simulation Time spent in accumulating \ _N0.
std::vector< double > _interfaces
FFS Interfaces.
void OpenTrajectoryFile(std::ofstream &)
Take the current config in snapshot and append it to the provided ofstream.
bool _interfaces_increase
Interfaces must monotonically increase (or decrease), this determines whether going to the 'next' int...
FFSConfigID myFFSConfigID
The current FFSConfigID of this MPI process.
unsigned int l
Interface number.
std::vector< FFSConfigID > Lambda0ConfigLibrary
Data structure that holds a Library N0 configurations at lambda0.
void PopQueueMPI(Snapshot *, const CVList &, unsigned)
Pop the queue, do MPI so that all procs maintain the same queue.
std::vector< std::vector< double > > _pB