SSAGES
0.1
A MetaDynamics Package
|
ForwardFlux sampling method. More...
#include <ForwardFlux.h>
Classes | |
class | FFSConfigID |
Nested class to store different FFS Config IDs. More... | |
Public Member Functions | |
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. More... | |
void | PreSimulation (Snapshot *snapshot, const class CVManager &cvmanager) override |
Pre-simulation hook. More... | |
virtual void | PostIntegration (Snapshot *snapshot, const class CVManager &cvmanager)=0 |
Post-integration hook. More... | |
void | PostSimulation (Snapshot *snapshot, const class CVManager &cvmanager) override |
Post-simulation hook. More... | |
![]() | |
Method (uint frequency, const MPI_Comm &world, const MPI_Comm &comm) | |
Constructor. More... | |
void | SetCVMask (const std::vector< uint > &mask) |
Sets the collective variable mask. | |
virtual | ~Method () |
Destructor. | |
![]() | |
EventListener (uint frequency) | |
Constructor. More... | |
uint | GetFrequency () const |
Get frequency of event listener. More... | |
virtual | ~EventListener () |
Destructor. | |
Static Public Member Functions | |
static ForwardFlux * | Build (const Json::Value &json, const MPI_Comm &world, const MPI_Comm &comm, const std::string &path) |
![]() | |
static Method * | BuildMethod (const Json::Value &json, const MPI_Comm &world, const MPI_Comm &comm, const std::string &path) |
Build a derived method from JSON node. More... | |
Protected Member Functions | |
void | CheckInitialStructure (const CVList &) |
Function that checks the initial structure that user provides. | |
void | WriteInitialFlux () |
Function to compute and write the initial flux. | |
void | AddNewIDsToQueue () |
bool | HasReturnedToA (double) |
Function checks if configuration has returned to A. | |
int | HasCrossedInterface (double, double, unsigned int interface) |
Function checks if configuration has crossed interface specified since the last check. More... | |
void | WriteFFSConfiguration (Snapshot *snapshot, FFSConfigID &ffsconfig, bool wassuccess) |
Write a file corresponding to FFSConfigID from current snapshot. | |
void | ReadFFSConfiguration (Snapshot *, FFSConfigID &, bool) |
Read a file corresponding to a FFSConfigID into current snapshot. | |
void | ComputeInitialFlux (Snapshot *, const CVList &) |
Compute Initial Flux. | |
virtual void | CheckForInterfaceCrossings (Snapshot *, const class CVManager &)=0 |
Function that checks if interfaces have been crossed (different for each FFS flavor) | |
virtual void | InitializeQueue (Snapshot *, const CVList &)=0 |
Initialize the Queue. | |
void | ComputeTransitionProbabilities () |
Compute the probability of going from each lambda_i to lambda_{i+1}. More... | |
void | PrintQueue () |
Print the queue, useful for debugging. | |
void | PopQueueMPI (Snapshot *, const CVList &, unsigned) |
Pop the queue, do MPI so that all procs maintain the same queue. | |
void | FluxBruteForce (Snapshot *, const CVList &) |
Compute the flux via brute force. More... | |
void | ReconstructTrajectories (Snapshot *) |
When simulation is finished, parse through the trajectories that reached B, and reconstruct the complete trajectory from where it started at A (lambda0) | |
void | ComputeCommittorProbability (Snapshot *) |
When simulation is finished, recursively parse through the trajectories that reached B or failed back to A and calculate the Commitor Probability of that state going to B (_pB) | |
void | AppendTrajectoryFile (Snapshot *, std::ofstream &) |
void | OpenTrajectoryFile (std::ofstream &) |
Take the current config in snapshot and append it to the provided ofstream. | |
Protected Attributes | |
double | _ninterfaces |
std::vector< double > | _interfaces |
FFS Interfaces. | |
bool | _interfaces_increase |
Interfaces must monotonically increase (or decrease), this determines whether going to the 'next' interface will be higher values of CV, or lower ones. | |
double | _cvvalue_previous |
Previous cv position, used to determine if you've crossed an interface since last time. | |
double | _cvvalue |
current cv position | |
double | _rate |
rate constant | |
std::vector< FFSConfigID > | Lambda0ConfigLibrary |
Data structure that holds a Library N0 configurations at lambda0. | |
double | _N0TotalSimTime |
Total Simulation Time spent in accumulating \ _N0. | |
unsigned int | _N0Target |
Number of configurations to store at lambda0, target. | |
double | _fluxA0 |
Flux of trajectories out of state A. Denoted PhiA0 over h_A in Allen2009. | |
std::vector< unsigned int > | _M |
std::vector< unsigned int > | _A |
Number of attempts from interface i. | |
std::vector< double > | _P |
Flag to determine wheter fluxA0 should be calculated, seems not using this. More... | |
std::vector< unsigned int > | _S |
std::vector< unsigned int > | _N |
bool | _pop_tried_but_empty_queue |
bool | _initialFluxFlag |
if 1 compute initial flux | |
bool | initializeQueueFlag |
FFSConfigID | myFFSConfigID |
The current FFSConfigID of this MPI process. | |
bool | _saveTrajectories |
should the FFS trajectories be saved | |
unsigned int | _nfailure_total |
std::vector< std::vector < double > > | _pB |
unsigned int | _current_interface |
Current Interface. | |
std::default_random_engine | _generator |
random number generator | |
std::deque< FFSConfigID > | FFSConfigIDQueue |
std::string | _output_directory |
Directory of FFS output. | |
std::ofstream | _trajectory_file |
file to which the current trajectory is written to | |
uint | iteration_ |
Method iteration counter/. | |
![]() | |
mxx::comm | world_ |
Global MPI communicator. | |
mxx::comm | comm_ |
Local MPI communicator. | |
std::vector< uint > | cvmask_ |
Mask which identifies which CVs to act on. | |
ForwardFlux sampling method.
The notation used here is drawn largely from Allen, Valeriani and Rein ten Wolde. J. Phys.: Condens. Matter (2009) 21:463102. We recommend referring to this review if the reader is unfamiliar with the method, or our variable naming conventions.
Definition at line 38 of file ForwardFlux.h.
|
inline |
Constructor.
world | MPI global communicator. |
comm | MPI local communicator. |
frequency | Frequency with which this method is invoked. |
Create instance of Forward Flux
Definition at line 246 of file ForwardFlux.h.
References _A, _initialFluxFlag, _interfaces, _interfaces_increase, _N, _N0Target, _N0TotalSimTime, _nfailure_total, _ninterfaces, _output_directory, _P, _pop_tried_but_empty_queue, _S, Lambda0ConfigLibrary, and SSAGES::Method::world_.
|
protected |
Function that adds new FFS configurations to the Queue Different FFS flavors can have differences in this method
|
protected |
Take the current config in snapshot and append it to the provided ofstream Current format is xyz style (including vx,vy,vz)
Definition at line 279 of file ForwardFlux.cpp.
References SSAGES::Snapshot::GetAtomIDs(), SSAGES::Snapshot::GetPositions(), and SSAGES::Snapshot::GetVelocities().
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings().
|
static |
Definition at line 629 of file ForwardFlux.cpp.
References Json::Requirement::GetErrors(), Json::Requirement::HasErrors(), Json::ObjectRequirement::Parse(), and Json::ObjectRequirement::Validate().
|
protected |
Compute the probability of going from each lambda_i to lambda_{i+1}.
Using number of successes and number of trials This will need to be different for each FFS flavor
Definition at line 214 of file ForwardFlux.cpp.
Compute the flux via brute force.
Eventually this should be a new class that inherits from ForwardFlux, but for the time being I'll just hard code it This function takes the configurations at lambda0 and run them until they reach B (lambdaN) or return to A
|
protected |
Function checks if configuration has crossed interface specified since the last check.
Simple function, given current and previous cv position, checks if interface i has been crossed. If crossed in positive direction, return +1, if crossed in negative direction return -1, if nothing crossed return 0
Definition at line 79 of file ForwardFlux.cpp.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings().
|
pure virtual |
Post-integration hook.
snapshot | Current simulation snapshot. |
cvmanager | Collective variable manager. |
Implements SSAGES::Method.
Implemented in SSAGES::DirectForwardFlux.
|
overridevirtual |
Post-simulation hook.
snapshot | Current simulation snapshot. |
cvmanager | Collective variable manager. |
Implements SSAGES::Method.
Definition at line 48 of file ForwardFlux.cpp.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings().
|
overridevirtual |
Pre-simulation hook.
snapshot | Current simulation snapshot. |
cvmanager | Collective variable manager. |
Implements SSAGES::Method.
Definition at line 39 of file ForwardFlux.cpp.
References SSAGES::CVManager::GetCVs().
|
protected |
Number of trials to attemt from each interface Note _M[0] sets the number of 'branches' for RBFFS and BGFFS?
Definition at line 101 of file ForwardFlux.h.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), and SSAGES::DirectForwardFlux::InitializeQueue().
|
protected |
Current number of configurations currently stored at interface i This is somewhat redundant since _N[i] == _S[i-1], but for clarity N[0] - current number of configurations collected at lambda0 (first interface)
Definition at line 119 of file ForwardFlux.h.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), ForwardFlux(), and SSAGES::DirectForwardFlux::InitializeQueue().
|
protected |
Counts the total number of failures eventually if I prune, will want this to be a vector, where it stores the number of failures at each interface however in the absence of pruning, a traj can only fail at lambda0, so this is just a scalar
Definition at line 140 of file ForwardFlux.h.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), and ForwardFlux().
|
protected |
Number of FFS interfaces note that _ninterfaces = n+1 where n is the interface defining B
Definition at line 70 of file ForwardFlux.h.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), and ForwardFlux().
|
protected |
Flag to determine wheter fluxA0 should be calculated, seems not using this.
Probability of going from lambda_{i} to lambda_{i+1}
Definition at line 110 of file ForwardFlux.h.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), and ForwardFlux().
|
protected |
commitor probability. The probability of a given configuration reaching B
Definition at line 144 of file ForwardFlux.h.
|
protected |
Keep track of jobs that have suceeded or failed but couldn't get reassigned a new task and must wait for the queue to get more jobs This could happen in DFFS once a job has finished but M[i] hasn't been reached (waiting on other jobs) If this is the case I call it a 'zombie job', since the job is running, but isnt doing anything useful. Its just burning cpu cycles waiting for the queue to repopulate
Definition at line 124 of file ForwardFlux.h.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), and ForwardFlux().
|
protected |
Number of successes from lambda_{i} to lambda_{i+1} (might need to be 2d vector if multiple branches are used (with RBFFS)
Definition at line 114 of file ForwardFlux.h.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), and ForwardFlux().
|
protected |
Queue When a given processor reaches an interface, it pulls a config from this Queue to figure out what it should do next This object should be syncronized between all FFS walkers (is walker the correct terminology here?) technically this is a double-ended queue, this was mostly for debugging to allow element access of the queue (which std::queue doesn't allow). I use it like a queue though.
Definition at line 157 of file ForwardFlux.h.
Referenced by SSAGES::DirectForwardFlux::CheckForInterfaceCrossings(), and SSAGES::DirectForwardFlux::InitializeQueue().