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