[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-dev] active particles and their restraints



hi all (i.e. ben & daniel),

i tried to deactivate particles and optimize only selected parts of a model. when using the em restraint i observed an oddity: restraints are not evaluated, if ONE particle in the set is not active. i do not think this is a sensible thing, for example my em restraint was not evaluated at all... i attached a patch where a restraint is omitted only if ALL particles are inactive.
if you agree that it makes more sense, please commit it to imp.

best

frido

--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Friedrich Foerster                                            %
% Andrej Sali Lab                                               %
% University of California at San Francisco                     %
% MC 2552                                                       %
% Byers Hall Room 501                                           %
% 1700 4th Street                                               %
% San Francisco, CA 94158-2330, USA                             %
%                                                               %
% phone:  +1 (415) 514-4258                                     %
% fax:    +1 (415) 514-4231                                     %
%                                                               %
%   www.salilab.org/~frido                                      %
%                                                               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Index: kernel/src/Restraint.cpp
===================================================================
--- kernel/src/Restraint.cpp	(revision 349)
+++ kernel/src/Restraint.cpp	(working copy)
@@ -67,12 +67,12 @@
   IMP_assert(get_model() != NULL,
              "Add Restraint to Model before calling check_particles_active");
   are_particles_active_ = true;
+  int icount=0;
   for (size_t i = 0; i < particles_.size(); i++) {
-    if (!get_particle(i)->get_is_active()) {
-      are_particles_active_ = false;
-      return;
-    }
+    if (get_particle(i)->get_is_active()) icount = icount + 1;
   }
+  // return false only if ALL particles are deactivated in restraint
+  if (icount ==0 ) are_particles_active_ = false;
 }
 
 }  // namespace IMP