Index: modlib/modeller/automodel/loopmodel.py =================================================================== --- modlib/modeller/automodel/loopmodel.py (revision 8489) +++ modlib/modeller/automodel/loopmodel.py (working copy) @@ -15,7 +15,6 @@ inimodel = None loop_potential = None _defined_indices = None - _defined_selection = None def __init__(self, env, sequence, alnfile=None, knowns=[], inimodel=None, deviation=None, library_schedule=None, csrfile=None, @@ -92,9 +91,9 @@ atom_files=filename) return aln - def _check_for_added_atoms(self, loop_selection): + def _check_for_added_atoms(self, loop_selection, defined_selection): # Atoms in the loop region always count as defined - s = self._defined_selection | loop_selection + s = defined_selection | loop_selection # Note that we store atom indices rather than a selection object, # since selection objects cannot be sent across the network correctly # to slaves when building models in parallel. @@ -138,15 +137,17 @@ self.transfer_xyz(aln) self.seq_id = seq_id - if self._defined_selection is None \ - and not self.loop.write_selection_only: - self._defined_selection = selection(self).only_defined() + if not self.loop.write_selection_only: + defined_selection = selection(self).only_defined() + else: + defined_selection = None # Fill in any missing atoms using internal coordinates self.build(build_method='INTERNAL_COORDINATES', initialize_xyz=False) self.res_num_from(model(self.env, file=filename), aln) self.special_patches(aln) + return defined_selection def build_seq(self, filename, num): """Build all loop models for a given starting model""" @@ -160,10 +161,10 @@ self.group_restraints = self.loop_potential aln = self.read_loop_alignment(filename) - self.create_loop_topology(aln, filename) + defined_selection = self.create_loop_topology(aln, filename) atmsel = self._check_select_loop_atoms() if not self.loop.write_selection_only: - self._check_for_added_atoms(atmsel) + self._check_for_added_atoms(atmsel, defined_selection) self.loop_restraints(atmsel, aln) # Select corresponding restraints only: