21 #include "CVs/CVManager.h"
37 double threshold = 0.2;
38 const double eps = 0.0000000001;
42 for(
size_t i = 0; i < cvs.size(); i++)
46 if(std::abs(cvs[i]->GetValue()) <= threshold)
59 diff = std::abs((cvs[i]->GetValue() - (
centers_[i]))) / ((cvs[i]->GetValue() + (
centers_[i]))/2.0);
62 if(std::abs(diff) >= threshold)
108 for(
size_t i = 0; i < cvs.size(); i++)
112 auto& grad = cv->GetGradient();
118 for(
size_t j = 0; j < forces.size(); j++)
120 for(
int k = 0; k < forces[j].size(); k++)
122 forces[j][k] -= (double)D*grad[j][k];
131 for(
auto& force: forces)
161 for(
size_t i = 0; i < cvs.size(); i++)
169 auto& grad = cv->GetGradient();
175 for(
size_t j = 0; j < forces.size(); j++)
177 for(
int k = 0; k < forces[j].size(); k++)
179 forces[j][k] -= (double)D*grad[j][k];
198 for(
auto& force: forces)
225 for(
size_t i = 0; i <
cv_drift_.size(); i++)
234 for(
auto& force: forces)
272 for(
size_t i = 0; i <
cv_drift_.size(); i++)
283 for(
size_t i = 0; i <
centers_.size(); i++)
289 std::vector<double> lcv0, ucv0;
Collective variable manager.
CVList GetCVs(const std::vector< unsigned int > &mask=std::vector< unsigned int >()) const
Get CV iterator.
std::vector< unsigned int > cvmask_
Mask which identifies which CVs to act on.
mxx::comm world_
Global MPI communicator.
Class containing a snapshot of the current simulation in time.
std::vector< double > SerializeVelocities()
Return the serialized velocities across all local cores.
const std::vector< Vector3 > & GetForces() const
Access the per-particle forces.
std::vector< int > SerializeIDs()
Return the serialized IDs across all local cores.
int GetLocalIndex(int id) const
Gets the local atom index corresponding to an atom ID.
const std::vector< Vector3 > & GetPositions() const
Access the particle positions.
const std::vector< Vector3 > & GetVelocities() const
Access the particle velocities.
std::vector< double > SerializePositions()
Return the serialized positions across all local cores.
std::vector< double > cvspring_
Vector of spring constants.
void UpdateWorldString(const CVList &cvs)
Update the world string over MPI.
std::vector< std::vector< double > > prev_velocities_
Store velocities for starting trajectories.
std::vector< double > centers_
CV starting location values.
bool CheckEnd(const CVList &CV)
Check if method reached one of the exit criteria.
unsigned int iteration_
The global method iteration.
void PrintString(const CVList &CV)
Prints the CV positions to file.
double distance(const std::vector< double > &x, const std::vector< double > &y) const
Helper function for calculating distances.
void GatherNeighbors(std::vector< double > *lcv0, std::vector< double > *ucv0)
Gather neighbors over MPI.
std::vector< std::vector< double > > prev_positions_
Store positions for starting trajectories.
std::vector< std::vector< int > > prev_IDs_
Store atom IDs for starting trajectories.
unsigned int iterator_
The local method iterator.
void StringReparam(double alpha_star)
Reparameterize the string.
unsigned int harvest_length_
Length to run before harvesting a trajectory for unrestrained sampling.
void StringUpdate() override
Updates the positions of the string.
unsigned int index_
For indexing trajectory vectors.
unsigned int swarm_length_
Length of unrestrained trajectories.
bool sampling_started
Flag for determing whether to perform initialization or not.
int initialized
Flag for whether a system is initialized at a given iteration.
unsigned int restrained_steps_
Total number of restrained MD steps for one iteration.
bool original_initialized
Flag for whether a system was initialized before it checked whether other systems were.
bool CVInitialized(const CVList &cvs)
Helper function check if CVs are initialized correctly.
unsigned int unrestrained_steps_
Total number of unrestrained MD steps for one iteration.
bool snapshot_stored
Flag for whether a snapshot was stored in the umbrella sampling.
void PostIntegration(Snapshot *snapshot, const class CVManager &cvmanager) override
Method call post integration.
unsigned int number_trajectories_
Number of trajectories per swarm.
std::vector< double > cv_drift_
Drift of CVs for one iteration.
unsigned int initialize_steps_
Total number of MD steps for initialization for one iteration.
std::vector< CollectiveVariable * > CVList
List of Collective Variables.