From 99b3fb882a789c1f73a5ea70d91dd137f69d4f10 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@stud.unibas.ch> Date: Mon, 11 Nov 2013 13:07:10 +0100 Subject: [PATCH] add delete bond functionality to editors --- modules/mol/base/pymod/export_editors.cc | 2 ++ modules/mol/base/src/editor_base.cc | 13 +++++++++++++ modules/mol/base/src/editor_base.hh | 14 ++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/modules/mol/base/pymod/export_editors.cc b/modules/mol/base/pymod/export_editors.cc index 6a659d286..cd7b326fd 100644 --- a/modules/mol/base/pymod/export_editors.cc +++ b/modules/mol/base/pymod/export_editors.cc @@ -243,6 +243,8 @@ void export_Editors() .def("DeleteResidue", &EditorBase::DeleteResidue) .def("DeleteChain", &EditorBase::DeleteChain) .def("DeleteAtom", &EditorBase::DeleteAtom) + .def("DeleteBond", &EditorBase::DeleteBond) + .def("DeleteBonds", &EditorBase::DeleteBonds) .def("InsertResidueBefore", &EditorBase::InsertResidueBefore) .def("InsertResidueAfter", &EditorBase::InsertResidueAfter) .def("AppendResidue", append_a) diff --git a/modules/mol/base/src/editor_base.cc b/modules/mol/base/src/editor_base.cc index 76e41f216..364ea0be0 100644 --- a/modules/mol/base/src/editor_base.cc +++ b/modules/mol/base/src/editor_base.cc @@ -193,6 +193,19 @@ void EditorBase::DeleteAtom(const AtomHandle& atom_handle) atom_handle.GetResidue().Impl()->DeleteAtom(atom_handle.Impl()); } +void EditorBase::DeleteBond(const BondHandle& bond) +{ + bond.GetFirst().Impl()->DeleteConnector(bond.Impl(),true); +} + +void EditorBase::DeleteBonds(const BondHandleList& bond_list) +{ + for(BondHandleList::const_iterator i = bond_list.begin(); + i != bond_list.end(); ++i){ + i->GetFirst().Impl()->DeleteConnector(i->Impl(),true); + } +} + void EditorBase::DeleteResidue(const ResidueHandle& residue_handle) { CheckHandleValidity(residue_handle); diff --git a/modules/mol/base/src/editor_base.hh b/modules/mol/base/src/editor_base.hh index 255390c29..a53391767 100644 --- a/modules/mol/base/src/editor_base.hh +++ b/modules/mol/base/src/editor_base.hh @@ -248,6 +248,20 @@ public: /// /// All associated torsions and bonds will be removed as well void DeleteAtoms(const AtomHandleList& atoms); + + /// \ brief Delete bond + /// + /// \param bond + /// Is the bond to remove. If no such bond exists, this method will + /// have no effect + void DeleteBond(const BondHandle& bond); + + /// \ brief Delete a set of bond + /// + /// \param bonds + /// bonds to remove. If no such bonds exist, this method will + /// have no effect + void DeleteBonds(const BondHandleList& bonds); /// \brief Add named torsion to entity TorsionHandle AddTorsion(const String& name, const AtomHandle& a1, -- GitLab