Skip to content

Commit d967001

Browse files
committed
maint: bond_completion with .close(..., ret_xyz=True) call
1 parent cf8bde5 commit d967001

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sisl/geometry.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,8 +2637,10 @@ def bond_completion(self, nbonds, atom=None, bond=None, idx=None):
26372637
for ia in selection:
26382638
iaZ = self.atoms[ia].Z
26392639
ria = PT.radius(iaZ)
2640-
idx = self.close(ia, R=(0.1, 0.1 + 2 * ria))[1]
2641-
if len(idx) == nbonds - 1:
2640+
idx = self.close(ia, R=(0.1, 0.1 + 2 * ria), ret_xyz=True)
2641+
# We just need second shell coordinates
2642+
xyz = idx[1][1]
2643+
if len(xyz) == nbonds - 1:
26422644
# Add one bond
26432645
if atom is None:
26442646
atom = Atom(iaZ, R=self.atoms[ia].R)
@@ -2647,9 +2649,7 @@ def bond_completion(self, nbonds, atom=None, bond=None, idx=None):
26472649
else:
26482650
bond_length = bond
26492651
# Compute bond vector
2650-
bvec = len(idx) * self.xyz[ia]
2651-
for jdx in idx:
2652-
bvec -= self.axyz(jdx)
2652+
bvec = len(xyz) * self.xyz[ia] - np.sum(xyz, axis=0)
26532653
bnorm = bvec.dot(bvec) ** .5
26542654
if bnorm > 0.1:
26552655
# only add to geometry if new position is away from ia-atom

0 commit comments

Comments
 (0)