Skip to content

Commit

Permalink
remove count_hydrogen_sites()
Browse files Browse the repository at this point in the history
it was too specific, instead of it use
 has_hydrogen() -> bool
or
 Selection sel("[H,D]");
 count_atom_sites(..., sel);
  • Loading branch information
wojdyr committed Sep 16, 2024
1 parent 86b6020 commit 94be5c6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
11 changes: 0 additions & 11 deletions include/gemmi/calculate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ template<> inline bool has_hydrogen(const Atom& atom) {
return atom.is_hydrogen();
}

/// deprecated, use has_hydrogen() or count_atom_sites(..., Selection("[H,D]")
template<class T> size_t count_hydrogen_sites(const T& obj) {
size_t sum = 0;
for (const auto& child : obj.children())
sum += count_hydrogen_sites(child);
return sum;
}
template<> inline size_t count_hydrogen_sites(const Atom& atom) {
return (size_t) atom.is_hydrogen();
}

template<class T> size_t count_atom_sites(const T& obj, const Selection* sel=nullptr) {
size_t sum = 0;
if (!sel || sel->matches(obj))
Expand Down
2 changes: 0 additions & 2 deletions python/mol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ void add_mol(nb::module_& m) {
.def("remove_ligands_and_waters", remove_ligands_and_waters<Model>)
.def("has_hydrogen", &has_hydrogen<Model>)
.def("count_atom_sites", &count_atom_sites<Model>, nb::arg("sel")=nb::none())
// deprecated, use has_hydrogen() or count_atom_sites(Selection('[H,D]'))
.def("count_hydrogen_sites", &count_hydrogen_sites<Model>)
.def("count_occupancies", &count_occupancies<Model>, nb::arg("sel")=nb::none())
.def("calculate_mass", &calculate_mass<Model>)
.def("calculate_center_of_mass", [](const Model& self) {
Expand Down

0 comments on commit 94be5c6

Please sign in to comment.