diff --git a/include/gemmi/polyheur.hpp b/include/gemmi/polyheur.hpp index 03ea05f5..387b879b 100644 --- a/include/gemmi/polyheur.hpp +++ b/include/gemmi/polyheur.hpp @@ -180,21 +180,7 @@ template<> inline void remove_ligands_and_waters(Chain& ch) { } // Trim to alanine. Returns true if trimmed, false if it's (likely) not AA. -inline bool trim_to_alanine(Residue& res) { - static const std::pair ala_atoms[6] = { - {"N", El::N}, {"CA", El::C}, {"C", El::C}, {"O", El::O}, {"CB", El::C}, - {"OXT", El::O} - }; - if (res.get_ca() == nullptr) - return false; - vector_remove_if(res.atoms, [](const Atom& a) { - for (const auto& name_el : ala_atoms) - if (a.name == name_el.first && a.element == name_el.second) - return false; - return true; - }); - return true; -} +GEMMI_DLL bool trim_to_alanine(Residue& res); inline void trim_to_alanine(Chain& chain) { for (Residue& res : chain.residues) diff --git a/src/polyheur.cpp b/src/polyheur.cpp index 333282ca..f9b4393c 100644 --- a/src/polyheur.cpp +++ b/src/polyheur.cpp @@ -309,6 +309,25 @@ char recommended_het_flag(const Residue& res) { return 'H'; } +bool trim_to_alanine(Residue& res) { + static const std::pair ala_atoms[6] = { + {"N", El::N}, {"CA", El::C}, {"C", El::C}, {"O", El::O}, {"CB", El::C}, + {"OXT", El::O} + }; + if (res.get_ca() == nullptr) + return false; + vector_remove_if(res.atoms, [](const Atom& a) { + for (const auto& name_el : ala_atoms) + if (a.name == name_el.first && a.element == name_el.second) + return false; + return true; + }); + // if non-standard polymer residue was mutated, update het_flag + if (res.entity_type == EntityType::Polymer && res.het_flag == 'H') + res.het_flag = 'A'; + return true; +} + void change_ccd_code(Structure& st, const std::string& old, const std::string& new_) { auto process = [&](ResidueId& rid) { if (rid.name == old)