Fix BondMaker.put_atom_in_box

Was only populating 8 out of 14 necessary boxes.

Fixes https://github.com/jensengroup/propka/issues/97
This commit is contained in:
Thomas Holder
2020-12-02 08:15:59 +01:00
parent 45aa08a79c
commit cc8514e3dc

View File

@@ -392,14 +392,27 @@ class BondMaker:
z: box z-coordinates
atom: the atom to place in a box
"""
for box_x in [x, x+1]:
for box_y in [y, y+1]:
for box_z in [z, z+1]:
key = (box_x, box_y, box_z)
try:
self.boxes[key].append(atom)
except KeyError:
pass
for (dx, dy, dz) in [
(-1, -1, -1),
(-1, -1, 0),
(-1, -1, 1),
(-1, 0, -1),
(-1, 0, 0),
(-1, 0, 1),
(-1, 1, -1),
(-1, 1, 0),
(-1, 1, 1),
(0, -1, -1),
(0, -1, 0),
(0, -1, 1),
(0, 0, -1),
(0, 0, 0),
]:
key = (x + dx, y + dy, z + dz)
try:
self.boxes[key].append(atom)
except KeyError:
pass
@staticmethod
def has_bond(atom1, atom2):