diff --git a/modules/mol/mm/doc/forcefield.rst b/modules/mol/mm/doc/forcefield.rst index 444ff0243e473a3c2d6ab82cd2ec7b4eed37aecf..dc21e30d2666ca6bdfa827c0505b7908c06edcce 100644 --- a/modules/mol/mm/doc/forcefield.rst +++ b/modules/mol/mm/doc/forcefield.rst @@ -664,6 +664,11 @@ The Forcefield Class :returns: :class:`BuildingBlock` for this name, invalid if it can't be found + .. method:: GetBuildingBlockNames() + + :returns: :class:`list` of all building block names present in that + forcefield + .. method:: GetBlockModifier(res_name) diff --git a/modules/mol/mm/pymod/export_forcefield.cc b/modules/mol/mm/pymod/export_forcefield.cc index 4a36a728e1e0f2dcf567f69953b82f2574443e70..82c74c6d7bb8ce615b8d7e9b55dcf67eae37d44c 100644 --- a/modules/mol/mm/pymod/export_forcefield.cc +++ b/modules/mol/mm/pymod/export_forcefield.cc @@ -47,6 +47,16 @@ boost::python::list WrapGetAtomRenamingRules(ost::mol::mm::ForcefieldPtr p, return result; } +boost::python::list WrapGetBuildingBlockNames(ost::mol::mm::ForcefieldPtr p) { + boost::python::list result; + std::vector<String> v_result = p->GetBuildingBlockNames(); + for(std::vector<String>::iterator it = v_result.begin(); + it != v_result.end(); ++it) { + result.append(*it); + } + return result; +} + } @@ -58,6 +68,7 @@ void export_Forcefield() .def("Save",&ost::mol::mm::Forcefield::Save,(arg("filename"))) .def("GetBuildingBlock",&ost::mol::mm::Forcefield::GetBuildingBlock,(arg("name"))) .def("GetBlockModifier",&ost::mol::mm::Forcefield::GetBlockModifier,(arg("name"))) + .def("GetBuildingBlockNames",&WrapGetBuildingBlockNames) .def("GetAtomType",&ost::mol::mm::Forcefield::GetAtomType,(arg("res_name"),arg("atom_name"))) .def("GetHydrogenConstructor",&ost::mol::mm::Forcefield::GetHydrogenConstructor,(arg("name"))) .def("GetNTerModifier",&ost::mol::mm::Forcefield::GetNTerModifier,(arg("residue_name"),arg("ter_name")="")) diff --git a/modules/mol/mm/src/forcefield.cc b/modules/mol/mm/src/forcefield.cc index af349dbbb5df877657d7c1c72214cc460748fe6c..c323277a79aa833616b4aa65b2566495fdeb9939 100644 --- a/modules/mol/mm/src/forcefield.cc +++ b/modules/mol/mm/src/forcefield.cc @@ -438,6 +438,17 @@ BuildingBlockPtr Forcefield::GetBuildingBlock(const String& name) const{ return p; } +std::vector<String> Forcefield::GetBuildingBlockNames() const { + + std::vector<String> return_vec; + for(boost::unordered_map<String,BuildingBlockPtr>::const_iterator i = + building_blocks_.begin(); i != building_blocks_.end(); ++i) { + return_vec.push_back(i->first); + } + + return return_vec; +} + BlockModifierPtr Forcefield::GetBlockModifier(const String& modifier_name) const{ boost::unordered_map<String,BlockModifierPtr>::const_iterator i = block_modifiers_.find(modifier_name); if(i == block_modifiers_.end()) return BlockModifierPtr(); diff --git a/modules/mol/mm/src/forcefield.hh b/modules/mol/mm/src/forcefield.hh index 2c19506204284d13e9d1ddca1718e1148dec02f1..6435226e00b7303b574b80c67775ba1488d203f5 100644 --- a/modules/mol/mm/src/forcefield.hh +++ b/modules/mol/mm/src/forcefield.hh @@ -82,6 +82,8 @@ public: BlockModifierPtr GetBlockModifier(const String& modifier_name) const; + std::vector<String> GetBuildingBlockNames() const; + String GetAtomType(const String& res_name, const String& atom_name) const; HydrogenConstructorPtr GetHydrogenConstructor(const String& name) const;