update colvars library to 2016-06-23 version

This commit is contained in:
Axel Kohlmeyer
2016-06-27 11:33:10 -04:00
parent eba0376da3
commit f47a9e33e6
16 changed files with 353 additions and 166 deletions

View File

@ -6,10 +6,17 @@
/// Histogram "bias" constructor
colvarbias_histogram::colvarbias_histogram(std::string const &conf, char const *key)
: colvarbias(conf, key),
colvarbias_histogram::colvarbias_histogram(char const *key)
: colvarbias(key),
grid(NULL), out_name("")
{
}
int colvarbias_histogram::init(std::string const &conf)
{
colvarbias::init(conf);
size_t i;
get_keyval(conf, "outputFile", out_name, std::string(""));
@ -30,18 +37,18 @@ colvarbias_histogram::colvarbias_histogram(std::string const &conf, char const *
for (i = 0; i < colvars.size(); i++) { // should be all vector
if (colvars[i]->value().type() != colvarvalue::type_vector) {
cvm::error("Error: used gatherVectorColvars with non-vector colvar.\n", INPUT_ERROR);
return;
return INPUT_ERROR;
}
if (i == 0) {
colvar_array_size = colvars[i]->value().size();
if (colvar_array_size < 1) {
cvm::error("Error: vector variable has dimension less than one.\n", INPUT_ERROR);
return;
return INPUT_ERROR;
}
} else {
if (colvar_array_size != colvars[i]->value().size()) {
cvm::error("Error: trying to combine vector colvars of different lengths.\n", INPUT_ERROR);
return;
return INPUT_ERROR;
}
}
}
@ -49,7 +56,7 @@ colvarbias_histogram::colvarbias_histogram(std::string const &conf, char const *
for (i = 0; i < colvars.size(); i++) { // should be all scalar
if (colvars[i]->value().type() != colvarvalue::type_scalar) {
cvm::error("Error: only scalar colvars are supported when gatherVectorColvars is off.\n", INPUT_ERROR);
return;
return INPUT_ERROR;
}
}
}
@ -76,9 +83,10 @@ colvarbias_histogram::colvarbias_histogram(std::string const &conf, char const *
}
cvm::log("Finished histogram setup.\n");
return COLVARS_OK;
}
/// Destructor
colvarbias_histogram::~colvarbias_histogram()
{
if (grid) {
@ -90,7 +98,7 @@ colvarbias_histogram::~colvarbias_histogram()
cvm::n_histo_biases -= 1;
}
/// Update the grid
int colvarbias_histogram::update()
{
int error_code = COLVARS_OK;