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 diff = std::abs((cvs[i]->GetValue() - (
centers_[i]+eps)) / ((cvs[i]->GetValue() + (eps +
centers_[i]))/2.0));
50 diff = std::abs((cvs[i]->GetValue() - (
centers_[i])) / ((cvs[i]->GetValue() + (
centers_[i]))/2.0));
95 for(
size_t i = 0; i < cvs.size(); i++)
99 auto& grad = cv->GetGradient();
105 for(
size_t j = 0; j < forces.size(); j++)
107 for(
int k = 0; k < forces[j].size(); k++)
109 forces[j][k] -= (double)D*grad[j][k];
118 for(
auto& force: forces)
147 for(
size_t i = 0; i < cvs.size(); i++)
155 auto& grad = cv->GetGradient();
161 for(
size_t j = 0; j < forces.size(); j++)
163 for(
int k = 0; k < forces[j].size(); k++)
165 forces[j][k] -= (double)D*grad[j][k];
184 for(
auto& force: forces)
211 for(
size_t i = 0; i <
cv_drift_.size(); i++)
220 for(
auto& force: forces)
258 for(
size_t i = 0; i <
cv_drift_.size(); i++)
269 for(
size_t i = 0; i <
centers_.size(); i++)
275 std::vector<double> lcv0, ucv0;
double distance(const std::vector< double > &x, const std::vector< double > &y) const
Helper function for calculating distances.
Collective variable manager.
unsigned int initialize_steps_
Total number of MD steps for initialization 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.
std::vector< CollectiveVariable * > CVList
List of Collective Variables.
std::vector< std::vector< double > > prev_velocities_
Store velocities for starting trajectories.
int initialized
Flag for whether a system is initialized at a given iteration.
Class containing a snapshot of the current simulation in time.
void GatherNeighbors(std::vector< double > *lcv0, std::vector< double > *ucv0)
Gather neighbors over MPI.
std::vector< double > centers_
CV starting location values.
uint iteration_
The global method iteration.
std::vector< double > cv_drift_
Drift of CVs for one iteration.
unsigned int swarm_length_
Length of unrestrained trajectories.
bool sampling_started
Flag for determing whether to perform initialization or not.
std::vector< double > SerializePositions()
Return the serialized positions across all local cores.
void PostIntegration(Snapshot *snapshot, const class CVManager &cvmanager) override
Post-integration hook.
mxx::comm world_
Global MPI communicator.
bool CheckEnd(const CVList &CV)
Check if method reached one of the exit criteria.
bool snapshot_stored
Flag for whether a snapshot was stored in the umbrella sampling.
std::vector< int > SerializeIDs()
Return the serialized positions across all local cores.
int GetLocalIndex(int id) const
Gets the local atom index corresponding to an atom ID.
std::vector< std::vector< int > > prev_IDs_
Store atom IDs for starting trajectories.
unsigned int number_trajectories_
Number of trajectories per swarm.
void UpdateWorldString(const CVList &cvs)
Update the world string over MPI.
const Label & GetAtomIDs() const
Access the atom IDs.
void StringReparam(double alpha_star)
Reparameterize the string.
unsigned int harvest_length_
Length to run before harvesting a trajectory for unrestrained sampling.
unsigned int restrained_steps_
Total number of restrained MD steps for one iteration.
std::vector< CollectiveVariable * > GetCVs(const std::vector< uint > &mask=std::vector< uint >()) const
Get CV iterator.
void PrintString(const CVList &CV)
Prints the CV positions to file.
unsigned int iterator_
The local method iterator.
std::vector< double > cvspring_
Vector of spring constants.
unsigned int unrestrained_steps_
Total number of unrestrained MD steps for one iteration.
std::vector< uint > cvmask_
Mask which identifies which CVs to act on.
unsigned int index_
For indexing trajectory vectors.
std::vector< double > SerializeVelocities()
Return the serialized velocities across all local cores.
const std::vector< Vector3 > & GetVelocities() const
Access the particle velocities.
const std::vector< Vector3 > & GetForces() const
Access the per-particle forces.
const std::vector< Vector3 > & GetPositions() const
Access the particle positions.
std::vector< std::vector< double > > prev_positions_
Store positions for starting trajectories.
void StringUpdate()
Updates the positions of the string.