コード例 #1
0
ファイル: colvarbias_abf.cpp プロジェクト: jeffcomer/colvars
/// Give the gradient at a given bin index.
cvm::real colvarbias_abf::bin_gradient(int bin_index) {
  if (bin_index < 0 || bin_index >= bin_num()) {
    cvm::error("Error: Tried to get bin gradient from invalid bin index "+cvm::to_str(bin_index));
    return -1;
  }
  std::vector<int> ix(1,bin_index);
  return -gradients->value(ix)/samples->value(ix);
}
コード例 #2
0
/// Give the count at a given bin index.
int colvarbias_abf::bin_count(int bin_index) {
  if (bin_index < 0 || bin_index >= bin_num()) {
    cvm::error("Error: Tried to get bin count from invalid bin index "+cvm::to_str(bin_index));
    return -1;
  }
  std::vector<int> ix(1,(int)bin_index);
  return samples->value(ix);
}