Simplify bonded atom counting.
Addresses https://github.com/jensengroup/propka-3.1/pull/33#discussion_r429110880 and https://github.com/jensengroup/propka-3.1/pull/33#discussion_r429111421
This commit is contained in:
@@ -114,19 +114,12 @@ class Atom(object):
|
|||||||
def count_bonded_elements(self, element):
|
def count_bonded_elements(self, element):
|
||||||
"""Count number of bonded atoms with same element.
|
"""Count number of bonded atoms with same element.
|
||||||
|
|
||||||
TODO - this function is silly. It should just be the len() of the
|
|
||||||
array returned by get_bonded_elements()
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
element: element type for test.
|
element: element type for test.
|
||||||
Returns:
|
Returns:
|
||||||
number of bonded atoms.
|
number of bonded atoms.
|
||||||
"""
|
"""
|
||||||
res = 0
|
return len(self.get_bonded_elements(element))
|
||||||
for bonded_atom in self.bonded_atoms:
|
|
||||||
if element == bonded_atom.element:
|
|
||||||
res += 1
|
|
||||||
return res
|
|
||||||
|
|
||||||
def get_bonded_elements(self, element):
|
def get_bonded_elements(self, element):
|
||||||
"""Get bonded atoms with same element.
|
"""Get bonded atoms with same element.
|
||||||
|
|||||||
Reference in New Issue
Block a user