Skip to content

Commit

Permalink
Work on compute_bonds method.
Browse files Browse the repository at this point in the history
  • Loading branch information
yakutovicha committed Nov 7, 2023
1 parent 942539f commit ef69ba0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aiidalab_widgets_base/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,21 +611,21 @@ def compute_bonds(self, structure, radius=1.0, color="element", povray=False):

cutoff = neighborlist.natural_cutoffs(structure, mult=1.09)
bonds = []

if len(structure) > 1:
ii, jj, distances = neighborlist.neighbor_list(
"ijD", structure, cutoff, self_interaction=False
)
for id1, id2, d_mic in zip(ii, jj, distances):
for id1, id2, bond_length in zip(ii, jj, distances):
i = structure[id1]
j = structure[id2]

v1 = np.array([i.x, i.y, i.z])
mic_vector = d_mic
if povray:
bond = vapory.Cylinder(
v1,
v1
+ mic_vector
+ bond_length
* Radius[i.symbol]
/ (Radius[i.symbol] + Radius[j.symbol]),
0.2,
Expand All @@ -645,7 +645,7 @@ def compute_bonds(self, structure, radius=1.0, color="element", povray=False):
tuple(
(
v1
+ mic_vector
+ bond_length
* Radius[i.symbol]
/ (Radius[i.symbol] + Radius[j.symbol])
).tolist()
Expand Down

0 comments on commit ef69ba0

Please sign in to comment.