Collected fixes and updates to Colvars library
This commit includes several fixes to moving restraints; also added is support for runtime integration of 2D and 3D PMFs from ABF. Mostly changes to existing member functions, with few additions in classes not directly accessible by LAMMPS. Also removed are calls to std::pow(), replaced by a copy of MathSpecial::powint(). Relevant commits in Colvars repository: 7307b5c 2017-12-14 Doc improvements [Giacomo Fiorin] 7f86f37 2017-12-14 Allow K-changing restraints computing accumulated work; fix staged-k TI estimator [Giacomo Fiorin] 7c1c175 2017-12-14 Fix 1D ABF trying to do pABF [Jérôme Hénin] b94aa7e 2017-11-16 Unify PMF output for 1D, 2D and 3D in ABF [Jérôme Hénin] 771a88f 2017-11-15 Poisson integration for all BC in 2d and 3d [Jérôme Hénin] 6af4d60 2017-12-01 Print message when issuing cv delete in VMD [Giacomo Fiorin] 4413972 2017-11-30 Check for homogeneous colvar to set it periodic [Jérôme Hénin] 95fe4b2 2017-11-06 Allow abf_integrate to start in bin with 1 sample [Jérôme Hénin] 06eea27 2017-10-23 Shorten a few constructs by using the power function [Giacomo Fiorin] 3165dfb 2017-10-20 Move includes of colvarproxy.h from headers to files [Giacomo Fiorin] 32a867b 2017-10-20 Add optimized powint function from LAMMPS headers [Giacomo Fiorin] 3ad070a 2017-10-20 Remove some unused includes, isolate calls to std::pow() [Giacomo Fiorin] 0aaf540 2017-10-20 Replace all calls to std::pow() where the exponent is not an integer [Giacomo Fiorin]
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
#include "colvaratoms.h"
|
||||
#include "colvarcomp.h"
|
||||
|
||||
|
||||
colvarmodule::colvarmodule(colvarproxy *proxy_in)
|
||||
{
|
||||
depth_s = 0;
|
||||
@ -417,10 +418,10 @@ int colvarmodule::parse_biases(std::string const &conf)
|
||||
"Please ensure that their forces do not counteract each other.\n");
|
||||
}
|
||||
|
||||
if (biases.size() || use_scripted_forces) {
|
||||
if (num_biases() || use_scripted_forces) {
|
||||
cvm::log(cvm::line_marker);
|
||||
cvm::log("Collective variables biases initialized, "+
|
||||
cvm::to_str(biases.size())+" in total.\n");
|
||||
cvm::to_str(num_biases())+" in total.\n");
|
||||
} else {
|
||||
if (!use_scripted_forces) {
|
||||
cvm::log("No collective variables biases were defined.\n");
|
||||
@ -431,12 +432,37 @@ int colvarmodule::parse_biases(std::string const &conf)
|
||||
}
|
||||
|
||||
|
||||
int colvarmodule::num_variables() const
|
||||
{
|
||||
return colvars.size();
|
||||
}
|
||||
|
||||
|
||||
int colvarmodule::num_variables_feature(int feature_id) const
|
||||
{
|
||||
size_t n = 0;
|
||||
for (std::vector<colvar *>::const_iterator cvi = colvars.begin();
|
||||
cvi != colvars.end();
|
||||
cvi++) {
|
||||
if ((*cvi)->is_enabled(feature_id)) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
int colvarmodule::num_biases() const
|
||||
{
|
||||
return biases.size();
|
||||
}
|
||||
|
||||
|
||||
int colvarmodule::num_biases_feature(int feature_id) const
|
||||
{
|
||||
colvarmodule *cv = cvm::main();
|
||||
size_t n = 0;
|
||||
for (std::vector<colvarbias *>::iterator bi = cv->biases.begin();
|
||||
bi != cv->biases.end();
|
||||
for (std::vector<colvarbias *>::const_iterator bi = biases.begin();
|
||||
bi != biases.end();
|
||||
bi++) {
|
||||
if ((*bi)->is_enabled(feature_id)) {
|
||||
n++;
|
||||
@ -448,10 +474,9 @@ int colvarmodule::num_biases_feature(int feature_id) const
|
||||
|
||||
int colvarmodule::num_biases_type(std::string const &type) const
|
||||
{
|
||||
colvarmodule *cv = cvm::main();
|
||||
size_t n = 0;
|
||||
for (std::vector<colvarbias *>::iterator bi = cv->biases.begin();
|
||||
bi != cv->biases.end();
|
||||
for (std::vector<colvarbias *>::const_iterator bi = biases.begin();
|
||||
bi != biases.end();
|
||||
bi++) {
|
||||
if ((*bi)->bias_type == type) {
|
||||
n++;
|
||||
@ -465,7 +490,7 @@ std::vector<std::string> const colvarmodule::time_dependent_biases() const
|
||||
{
|
||||
size_t i;
|
||||
std::vector<std::string> biases_names;
|
||||
for (i = 0; i < biases.size(); i++) {
|
||||
for (i = 0; i < num_biases(); i++) {
|
||||
if (biases[i]->is_enabled(colvardeps::f_cvb_apply_force) &&
|
||||
biases[i]->is_enabled(colvardeps::f_cvb_active) &&
|
||||
(biases[i]->is_enabled(colvardeps::f_cvb_history_dependent) ||
|
||||
@ -790,7 +815,7 @@ int colvarmodule::calc_biases()
|
||||
{
|
||||
// update the biases and communicate their forces to the collective
|
||||
// variables
|
||||
if (cvm::debug() && biases.size())
|
||||
if (cvm::debug() && num_biases())
|
||||
cvm::log("Updating collective variable biases.\n");
|
||||
|
||||
std::vector<colvarbias *>::iterator bi;
|
||||
@ -852,7 +877,7 @@ int colvarmodule::update_colvar_forces()
|
||||
std::vector<colvarbias *>::iterator bi;
|
||||
|
||||
// sum the forces from all biases for each collective variable
|
||||
if (cvm::debug() && biases.size())
|
||||
if (cvm::debug() && num_biases())
|
||||
cvm::log("Collecting forces from all biases.\n");
|
||||
cvm::increase_depth();
|
||||
for (bi = biases_active()->begin(); bi != biases_active()->end(); bi++) {
|
||||
@ -1073,8 +1098,6 @@ int colvarmodule::reset()
|
||||
|
||||
int colvarmodule::setup_input()
|
||||
{
|
||||
if (this->size() == 0) return cvm::get_error();
|
||||
|
||||
std::string restart_in_name("");
|
||||
|
||||
// read the restart configuration, if available
|
||||
@ -1107,14 +1130,12 @@ int colvarmodule::setup_input()
|
||||
}
|
||||
}
|
||||
|
||||
return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK);
|
||||
return cvm::get_error();
|
||||
}
|
||||
|
||||
|
||||
int colvarmodule::setup_output()
|
||||
{
|
||||
if (this->size() == 0) return cvm::get_error();
|
||||
|
||||
int error_code = COLVARS_OK;
|
||||
|
||||
// output state file (restart)
|
||||
@ -1123,7 +1144,8 @@ int colvarmodule::setup_output()
|
||||
std::string("");
|
||||
|
||||
if (restart_out_name.size()) {
|
||||
cvm::log("The restart output state file will be \""+restart_out_name+"\".\n");
|
||||
cvm::log("The restart output state file will be \""+
|
||||
restart_out_name+"\".\n");
|
||||
}
|
||||
|
||||
output_prefix() = proxy->output_prefix();
|
||||
@ -1154,7 +1176,7 @@ int colvarmodule::setup_output()
|
||||
set_error_bits(FILE_ERROR);
|
||||
}
|
||||
|
||||
return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK);
|
||||
return cvm::get_error();
|
||||
}
|
||||
|
||||
|
||||
@ -1738,6 +1760,89 @@ int cvm::load_coords_xyz(char const *filename,
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Wrappers to proxy functions: these may go in the future
|
||||
|
||||
cvm::real cvm::unit_angstrom()
|
||||
{
|
||||
return proxy->unit_angstrom();
|
||||
}
|
||||
|
||||
|
||||
cvm::real cvm::boltzmann()
|
||||
{
|
||||
return proxy->boltzmann();
|
||||
}
|
||||
|
||||
|
||||
cvm::real cvm::temperature()
|
||||
{
|
||||
return proxy->temperature();
|
||||
}
|
||||
|
||||
|
||||
cvm::real cvm::dt()
|
||||
{
|
||||
return proxy->dt();
|
||||
}
|
||||
|
||||
|
||||
void cvm::request_total_force()
|
||||
{
|
||||
proxy->request_total_force(true);
|
||||
}
|
||||
|
||||
cvm::rvector cvm::position_distance(atom_pos const &pos1,
|
||||
atom_pos const &pos2)
|
||||
{
|
||||
return proxy->position_distance(pos1, pos2);
|
||||
}
|
||||
|
||||
cvm::real cvm::position_dist2(cvm::atom_pos const &pos1,
|
||||
cvm::atom_pos const &pos2)
|
||||
{
|
||||
return proxy->position_dist2(pos1, pos2);
|
||||
}
|
||||
|
||||
cvm::real cvm::rand_gaussian(void)
|
||||
{
|
||||
return proxy->rand_gaussian();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool cvm::replica_enabled()
|
||||
{
|
||||
return proxy->replica_enabled();
|
||||
}
|
||||
|
||||
int cvm::replica_index()
|
||||
{
|
||||
return proxy->replica_index();
|
||||
}
|
||||
|
||||
int cvm::replica_num()
|
||||
{
|
||||
return proxy->replica_num();
|
||||
}
|
||||
|
||||
void cvm::replica_comm_barrier()
|
||||
{
|
||||
return proxy->replica_comm_barrier();
|
||||
}
|
||||
|
||||
int cvm::replica_comm_recv(char* msg_data, int buf_len, int src_rep)
|
||||
{
|
||||
return proxy->replica_comm_recv(msg_data,buf_len,src_rep);
|
||||
}
|
||||
|
||||
int cvm::replica_comm_send(char* msg_data, int msg_len, int dest_rep)
|
||||
{
|
||||
return proxy->replica_comm_send(msg_data,msg_len,dest_rep);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// shared pointer to the proxy object
|
||||
colvarproxy *colvarmodule::proxy = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user