Skip to content
Snippets Groups Projects
Commit c84a9dd4 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

add function to get the names of all building blocks present in a forcefield

parent 544f0992
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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")=""))
......
......@@ -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();
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment