Skip to content

Commit

Permalink
Only allow reusing components that are not already reusing other comp…
Browse files Browse the repository at this point in the history
…onents
  • Loading branch information
giacomofiorin committed Dec 19, 2023
1 parent fd433fe commit 9626bf3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/colvarcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ int colvar::cvc::setup()
ci->first + "\".\n",
COLVARS_INPUT_ERROR);
}
if (ci->second->is_enabled(f_cvc_reusing_cvcs)) {
error_code |= cvm::error(
"Error: component \"" + name + "\" is trying to reuse component \"" +
ci->second->qualified_name() +
"\", which is in turn reusing other components; only one indirection is allowed.\n",
COLVARS_INPUT_ERROR);
}
// TODO Handle this from the dependency system
if (is_enabled(f_cvc_gradient)) {
ci->second->enable(f_cvc_gradient);
Expand Down

0 comments on commit 9626bf3

Please sign in to comment.