From d17c0325d423e97fce379fa33a17a9ee72505e06 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Mon, 12 May 2014 15:08:14 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11969 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- lib/colvars/colvar.cpp | 7 ++++++- lib/colvars/colvaratoms.cpp | 6 +++--- lib/colvars/colvarbias.cpp | 4 ++-- lib/colvars/colvarbias_meta.cpp | 8 ++++---- lib/colvars/colvarcomp.cpp | 8 ++++---- lib/colvars/colvargrid.h | 10 ++++----- lib/colvars/colvarmodule.cpp | 35 ++++++++++++++++++++++++++++++++ lib/colvars/colvarmodule.h | 36 +-------------------------------- lib/colvars/colvarparse.cpp | 2 +- 9 files changed, 61 insertions(+), 55 deletions(-) diff --git a/lib/colvars/colvar.cpp b/lib/colvars/colvar.cpp index e07ddbcc5d..8838f55442 100644 --- a/lib/colvars/colvar.cpp +++ b/lib/colvars/colvar.cpp @@ -591,11 +591,12 @@ void colvar::enable (colvar::task const &t) } break; - case task_output_value: case task_runave: case task_corrfunc: case task_ntot: + case task_langevin: + case task_output_energy: break; case task_gradients: @@ -612,6 +613,7 @@ void colvar::enable (colvar::task const &t) build_atom_list(); } break; + } @@ -660,6 +662,9 @@ void colvar::disable (colvar::task const &t) case task_lower_wall: case task_upper_wall: case task_ntot: + case task_langevin: + case task_output_energy: + case task_collect_gradients: break; } diff --git a/lib/colvars/colvaratoms.cpp b/lib/colvars/colvaratoms.cpp index c211168ff2..421d67b08c 100644 --- a/lib/colvars/colvaratoms.cpp +++ b/lib/colvars/colvaratoms.cpp @@ -14,8 +14,8 @@ cvm::atom_group::atom_group (std::string const &conf, char const *key) : b_center (false), b_rotate (false), b_user_defined_fit (false), - ref_pos_group (NULL), b_fit_gradients (false), + ref_pos_group (NULL), noforce (false) { cvm::log ("Defining atom group \""+ @@ -27,7 +27,7 @@ cvm::atom_group::atom_group (std::string const &conf, cvm::atom_group::atom_group (std::vector const &atoms) : b_dummy (false), b_center (false), b_rotate (false), - ref_pos_group (NULL), b_fit_gradients (false), + b_fit_gradients (false), ref_pos_group (NULL), noforce (false) { this->reserve (atoms.size()); @@ -44,7 +44,7 @@ cvm::atom_group::atom_group (std::vector const &atoms) cvm::atom_group::atom_group() : b_dummy (false), b_center (false), b_rotate (false), - ref_pos_group (NULL), b_fit_gradients (false), + b_fit_gradients (false), ref_pos_group (NULL), noforce (false) { total_mass = 0.0; diff --git a/lib/colvars/colvarbias.cpp b/lib/colvars/colvarbias.cpp index 993cb3cd59..18d9f5b964 100644 --- a/lib/colvars/colvarbias.cpp +++ b/lib/colvars/colvarbias.cpp @@ -121,8 +121,8 @@ std::ostream & colvarbias::write_traj (std::ostream &os) colvarbias_harmonic::colvarbias_harmonic (std::string const &conf, char const *key) : colvarbias (conf, key), - target_nsteps (0), - target_nstages (0) + target_nstages (0), + target_nsteps (0) { get_keyval (conf, "forceConstant", force_k, 1.0); for (size_t i = 0; i < colvars.size(); i++) { diff --git a/lib/colvars/colvarbias_meta.cpp b/lib/colvars/colvarbias_meta.cpp index 8e8650e730..cbdd2c20f6 100644 --- a/lib/colvars/colvarbias_meta.cpp +++ b/lib/colvars/colvarbias_meta.cpp @@ -25,16 +25,16 @@ colvarbias_meta::colvarbias_meta() : colvarbias(), - state_file_step (0), - new_hills_begin (hills.end()) + new_hills_begin (hills.end()), + state_file_step (0) { } colvarbias_meta::colvarbias_meta (std::string const &conf, char const *key) : colvarbias (conf, key), - state_file_step (0), - new_hills_begin (hills.end()) + new_hills_begin (hills.end()), + state_file_step (0) { if (cvm::n_abf_biases > 0) cvm::log ("Warning: running ABF and metadynamics together is not recommended unless applyBias is off for ABF.\n"); diff --git a/lib/colvars/colvarcomp.cpp b/lib/colvars/colvarcomp.cpp index 316454e8ef..f509d8fcc3 100644 --- a/lib/colvars/colvarcomp.cpp +++ b/lib/colvars/colvarcomp.cpp @@ -8,18 +8,18 @@ colvar::cvc::cvc() : sup_coeff (1.0), sup_np (1), b_periodic (false), - b_debug_gradients (false), b_inverse_gradients (false), - b_Jacobian_derivative (false) + b_Jacobian_derivative (false), + b_debug_gradients (false) {} colvar::cvc::cvc (std::string const &conf) : sup_coeff (1.0), sup_np (1), b_periodic (false), - b_debug_gradients (false), b_inverse_gradients (false), - b_Jacobian_derivative (false) + b_Jacobian_derivative (false), + b_debug_gradients (false) { if (cvm::debug()) cvm::log ("Initializing cvc base object.\n"); diff --git a/lib/colvars/colvargrid.h b/lib/colvars/colvargrid.h index fd2365da45..1095e0b845 100644 --- a/lib/colvars/colvargrid.h +++ b/lib/colvars/colvargrid.h @@ -173,19 +173,19 @@ public: /// \brief "Almost copy-constructor": only copies configuration /// parameters from another grid, but doesn't reallocate stuff; /// create() must be called after that; - colvar_grid (colvar_grid const &g) : has_data (false), - nd (g.nd), + colvar_grid (colvar_grid const &g) : nd (g.nd), nx (g.nx), mult (g.mult), + data(), cv (g.cv), + actual_value (g.actual_value), lower_boundaries (g.lower_boundaries), upper_boundaries (g.upper_boundaries), + periodic (g.periodic), hard_lower_boundaries (g.hard_lower_boundaries), hard_upper_boundaries (g.hard_upper_boundaries), - periodic (g.periodic), widths (g.widths), - actual_value (g.actual_value), - data() + has_data (false) { save_delimiters = false; } diff --git a/lib/colvars/colvarmodule.cpp b/lib/colvars/colvarmodule.cpp index 122cd01a5f..ec92617259 100644 --- a/lib/colvars/colvarmodule.cpp +++ b/lib/colvars/colvarmodule.cpp @@ -815,6 +815,41 @@ void cvm::read_index_file (char const *filename) } + +void cvm::load_atoms (char const *file_name, + std::vector &atoms, + std::string const &pdb_field, + double const pdb_field_value) +{ + proxy->load_atoms (file_name, atoms, pdb_field, pdb_field_value); +} + +void cvm::load_coords (char const *file_name, + std::vector &pos, + const std::vector &indices, + std::string const &pdb_field, + double const pdb_field_value) +{ + // Differentiate between PDB and XYZ files + // for XYZ files, use CVM internal parser + // otherwise call proxy function for PDB + + std::string const ext (strlen(file_name) > 4 ? (file_name + (strlen(file_name) - 4)) : file_name); + if (colvarparse::to_lower_cppstr (ext) == std::string (".xyz")) { + if ( pdb_field.size() > 0 ) { + cvm::fatal_error ("Error: PDB column may not be specified for XYZ coordinate file.\n"); + } + cvm::load_coords_xyz (file_name, pos, indices); + } else { + proxy->load_coords (file_name, pos, indices, pdb_field, pdb_field_value); + } +} + +void cvm::backup_file (char const *filename) +{ + proxy->backup_file (filename); +} + void cvm::load_coords_xyz (char const *filename, std::vector &pos, const std::vector &indices) diff --git a/lib/colvars/colvarmodule.h b/lib/colvars/colvarmodule.h index 47af4822c6..fc9872e9bf 100644 --- a/lib/colvars/colvarmodule.h +++ b/lib/colvars/colvarmodule.h @@ -2,7 +2,7 @@ #define COLVARMODULE_H #ifndef COLVARS_VERSION -#define COLVARS_VERSION "2013-12-13" +#define COLVARS_VERSION "2014-05-08" #endif #ifndef COLVARS_DEBUG @@ -483,40 +483,6 @@ inline cvm::real cvm::position_dist2 (cvm::atom_pos const &pos1, return proxy->position_dist2 (pos1, pos2); } -inline void cvm::load_atoms (char const *file_name, - std::vector &atoms, - std::string const &pdb_field, - double const pdb_field_value) -{ - proxy->load_atoms (file_name, atoms, pdb_field, pdb_field_value); -} - -inline void cvm::load_coords (char const *file_name, - std::vector &pos, - const std::vector &indices, - std::string const &pdb_field, - double const pdb_field_value) -{ - // Differentiate between PDB and XYZ files - // for XYZ files, use CVM internal parser - // otherwise call proxy function for PDB - - char const *ext = strlen(file_name) > 4 ? file_name + (strlen(file_name) - 4) : file_name; - if ( !strncmp(ext, ".xyz", 4) || !strncmp(ext, ".XYZ", 4) ) { - if ( pdb_field.size() > 0 ) { - cvm::fatal_error ("Error: PDB column may not be specified for XYZ coordinate file.\n"); - } - cvm::load_coords_xyz (file_name, pos, indices); - } else { - proxy->load_coords (file_name, pos, indices, pdb_field, pdb_field_value); - } -} - -inline void cvm::backup_file (char const *filename) -{ - proxy->backup_file (filename); -} - inline cvm::real cvm::rand_gaussian (void) { return proxy->rand_gaussian(); diff --git a/lib/colvars/colvarparse.cpp b/lib/colvars/colvarparse.cpp index 2e62072f34..5ccaf98294 100644 --- a/lib/colvars/colvarparse.cpp +++ b/lib/colvars/colvarparse.cpp @@ -595,7 +595,7 @@ std::istream & operator>> (std::istream &is, colvarparse::read_block const &rb) size_t brace_count = 1; std::string line; while (colvarparse::getline_nocomments (is, line)) { - size_t br = 0, br_old; + size_t br = 0, br_old = 0; while ( (br = line.find_first_of ("{}", br)) != std::string::npos) { if (line[br] == '{') brace_count++; if (line[br] == '}') brace_count--;