Files
lammps/lib/colvars/colvarproxy_volmaps.cpp
Giacomo Fiorin 377c652a83 Update Colvars library to version 2023-05-01
This update consists exclusively of bugfixes or maintenance-related changes.

The following is a list of pull requests in the Colvars repository since the previous update to LAMMPS:

- 532 Add XYZ trajectory reading feature
  https://github.com/Colvars/colvars/pull/532 (@jhenin, @giacomofiorin)

- 531 Delete objects quietly, unless explicitly requested via script (including VMD)
  https://github.com/Colvars/colvars/pull/531 (@giacomofiorin)

- 530 Append newline to log and error messages if not already present
  https://github.com/Colvars/colvars/pull/530 (@giacomofiorin)

- 528 Forward-declare OpenMP lock
  https://github.com/Colvars/colvars/pull/528 (@giacomofiorin)

- 527 Remove unneeded STL container
  https://github.com/Colvars/colvars/pull/527 (@giacomofiorin)

- 526 Allow collecting configuration files and strings before setting up interface
  https://github.com/Colvars/colvars/pull/526 (@giacomofiorin, @jhenin)

- 523 Fallback to linearCombination when customFunction is missing in customColvar
  https://github.com/Colvars/colvars/pull/523 (@HanatoK, @giacomofiorin)

- 522 Use iostream::fail() to check for I/O error
  https://github.com/Colvars/colvars/pull/522 (@jhenin)

- 520 Fix ref count
  https://github.com/Colvars/colvars/pull/520 (@giacomofiorin)

- 513 Set target temperature through a common code path
  https://github.com/Colvars/colvars/pull/513 (@giacomofiorin, @jhenin)

- 509 Safer detection of Windows with recent Microsoft Visual Studio versions
  https://github.com/Colvars/colvars/pull/509 (@akohlmey)

- 508 Update LAMMPS patching method to reflect Lepton availability
  https://github.com/Colvars/colvars/pull/508 (@giacomofiorin)

- 497 Increase the precision of write_multicol
  https://github.com/Colvars/colvars/pull/497 (@HanatoK)

- 496 Only perform MTS automatic enable/disable for timeStepFactor > 1
  https://github.com/Colvars/colvars/pull/496 (@giacomofiorin)

- 493 Remove unused branch of quaternion input function
  https://github.com/Colvars/colvars/pull/493 (@giacomofiorin)

- 489 Ensure there are spaces between the fields in the header
  https://github.com/Colvars/colvars/pull/489 (@HanatoK)

- 487 Use map of output streams, and return references to its elements
  https://github.com/Colvars/colvars/pull/487 (@giacomofiorin, @jhenin)

- 486 Remember first step of moving restraint
  https://github.com/Colvars/colvars/pull/486 (@jhenin)

- 485 Add decoupling option for moving restraints
  https://github.com/Colvars/colvars/pull/485 (@jhenin)

- 483 Update Lepton via patching procedure
  https://github.com/Colvars/colvars/pull/483 (@giacomofiorin)

- 481 Make file-reading operations of input data abstractable
  https://github.com/Colvars/colvars/pull/481 (@giacomofiorin)

Authors: @akohlmey, @giacomofiorin, @HanatoK, @jhenin
2023-05-17 13:29:00 -04:00

135 lines
3.2 KiB
C++

// -*- c++ -*-
// This file is part of the Collective Variables module (Colvars).
// The original version of Colvars and its updates are located at:
// https://github.com/Colvars/colvars
// Please update all Colvars source files before making any changes.
// If you wish to distribute your changes, please submit them to the
// Colvars repository at GitHub.
#include "colvarmodule.h"
#include "colvarproxy_volmaps.h"
#include "colvarmodule_utils.h"
colvarproxy_volmaps::colvarproxy_volmaps()
{
volmaps_rms_applied_force_ = volmaps_max_applied_force_ = 0.0;
}
colvarproxy_volmaps::~colvarproxy_volmaps() {}
int colvarproxy_volmaps::volmaps_available()
{
return COLVARS_NOT_IMPLEMENTED;
}
int colvarproxy_volmaps::reset()
{
for (size_t i = 0; i < volmaps_ids.size(); i++) {
clear_volmap(i);
}
volmaps_ids.clear();
volmaps_refcount.clear();
volmaps_values.clear();
volmaps_new_colvar_forces.clear();
return COLVARS_OK;
}
int colvarproxy_volmaps::add_volmap_slot(int volmap_id)
{
volmaps_ids.push_back(volmap_id);
volmaps_refcount.push_back(1);
volmaps_values.push_back(0.0);
volmaps_new_colvar_forces.push_back(0.0);
return (volmaps_ids.size() - 1);
}
int colvarproxy_volmaps::check_volmap_by_id(int /* volmap_id */)
{
return cvm::error("Error: selecting volumetric maps is not available.\n",
COLVARS_NOT_IMPLEMENTED);
}
int colvarproxy_volmaps::check_volmap_by_name(const char * /* volmap_name */)
{
return cvm::error("Error: selecting volumetric maps by name is not "
"available.\n", COLVARS_NOT_IMPLEMENTED);
}
int colvarproxy_volmaps::init_volmap_by_name(char const * /* volmap_name */)
{
return -1;
}
int colvarproxy_volmaps::init_volmap_by_id(int /* volmap_id */)
{
return -1;
}
int colvarproxy_volmaps::init_volmap_by_name(std::string const &volmap_name)
{
return init_volmap_by_name(volmap_name.c_str());
}
int colvarproxy_volmaps::check_volmap_by_name(std::string const &volmap_name)
{
return check_volmap_by_name(volmap_name.c_str());
}
void colvarproxy_volmaps::clear_volmap(int index)
{
if (((size_t) index) >= volmaps_ids.size()) {
cvm::error("Error: trying to unrequest a volumetric map that was not "
"previously requested.\n", COLVARS_INPUT_ERROR);
}
if (volmaps_refcount[index] > 0) {
volmaps_refcount[index] -= 1;
}
}
int colvarproxy_volmaps::get_volmap_id_from_name(char const *volmap_name)
{
// Raise error
colvarproxy_volmaps::check_volmap_by_name(volmap_name);
return -1;
}
int colvarproxy_volmaps::compute_volmap(int /* flags */,
int /* volmap_id */,
cvm::atom_iter /* atom_begin */,
cvm::atom_iter /* atom_end */,
cvm::real * /* value */,
cvm::real * /* atom_field */)
{
return COLVARS_NOT_IMPLEMENTED;
}
void colvarproxy_volmaps::compute_rms_volmaps_applied_force()
{
volmaps_rms_applied_force_ =
compute_norm2_stats<cvm::real, 0, false>(volmaps_new_colvar_forces);
}
void colvarproxy_volmaps::compute_max_volmaps_applied_force()
{
volmaps_max_applied_force_ =
compute_norm2_stats<cvm::real, 1, false>(volmaps_new_colvar_forces);
}