![](https://secure.gravatar.com/avatar/cfe8857a24d561e8e700ab18e3ba7ec8.jpg?s=120&d=mm&r=g)
Keren Lasker wrote: > For some reason iterating over restraints like: > for(Restraints::iterator it = opt_mdl->get_restraints().begin(); > it != opt_mdl->get_restraints().end(); it++) { > }
Don't do that! At best, that's going to make a copy of your restraints vector, then iterate over that. (But since you call get_restraints twice, you're going to get two different copies, and the iteration probably won't work at all.) Instead, do:
for(Model::RestraintIterator it = opt_mdl->restraints_begin(); it != opt_mdl->restraints_end(); ++it) {
to iterate over the original vector.
Daniel added get_restraints() for the Python interface, but you shouldn't use it for C++ code. Eventually I will get rid of it entirely, and have the Python interface access the original vector (not a copy) as well.
Ben