diff --git a/modelling/pymod/_pipeline.py b/modelling/pymod/_pipeline.py index b8aef45fe0a79a0c4756fb627b46abc90c3c3007..63117e0f62367bed22ce035066eea9c36268441b 100644 --- a/modelling/pymod/_pipeline.py +++ b/modelling/pymod/_pipeline.py @@ -371,8 +371,11 @@ def MinimizeModelEnergy(mhandle, max_iterations=12, max_iter_sd=20, # update model simulation_ent = _GetSimEntity(sim) - mhandle.model = mol.CreateEntityFromView(simulation_ent.Select("ele!=H"), - True) + new_model = mol.CreateEntityFromView(simulation_ent.Select("ele!=H"), True) + # transfer gaps before overwriting model + for gap in mhandle.gaps: + gap.Transfer(new_model.FindChain(gap.GetChainName())) + mhandle.model = new_model # return model with hydrogens return simulation_ent diff --git a/modelling/tests/test_pipeline.py b/modelling/tests/test_pipeline.py index 61c8f44d679b6532319678a591b710d92aa2828f..90471ecb22a126438e90936dbe154d12f3466af8 100644 --- a/modelling/tests/test_pipeline.py +++ b/modelling/tests/test_pipeline.py @@ -390,12 +390,27 @@ class PipelineTests(unittest.TestCase): # single chain mhandle = self.getRawModel() self.checkFinalModel(mhandle, exp_gaps=1, num_chains=1) + # repeat after sidechain reconstruction and MM + mhandle = self.getRawModel() + modelling.BuildSidechains(mhandle) + modelling.MinimizeModelEnergy(mhandle) + self.checkFinalModel(mhandle, exp_gaps=1, num_chains=1) # homo-dimer mhandle = self.getRawModelOligo("data/2aoh-1_cut") self.checkFinalModel(mhandle, exp_gaps=2, num_chains=2) + # repeat after sidechain reconstruction and MM + mhandle = self.getRawModelOligo("data/2aoh-1_cut") + modelling.BuildSidechains(mhandle) + modelling.MinimizeModelEnergy(mhandle) + self.checkFinalModel(mhandle, exp_gaps=2, num_chains=2) # hetero-dimer mhandle = self.getRawModelOligo("data/5d52-1_cut") self.checkFinalModel(mhandle, exp_gaps=2, num_chains=2) + # repeat after sidechain reconstruction and MM + mhandle = self.getRawModelOligo("data/5d52-1_cut") + modelling.BuildSidechains(mhandle) + modelling.MinimizeModelEnergy(mhandle) + self.checkFinalModel(mhandle, exp_gaps=2, num_chains=2) def testCheckFinalModelRingPunches(self): '''Check that we report models with ring punches.'''