Skip to content

Commit f88d45c

Browse files
authored
clip values returned by get_cos() to remmove rounding errors (#139)
1 parent 51bdd73 commit f88d45c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

qstack/qml/slatm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_cos(a, b, c):
136136
"""
137137
v1 = r[a] - r[b]
138138
v2 = r[c] - r[b]
139-
return v1 @ v2 / (dist[a,b] * dist[b,c])
139+
return np.clip(v1 @ v2 / (dist[a,b] * dist[b,c]), -1, 1)
140140

141141
theta1 = np.pi + theta0
142142
ngrid = int((theta1+theta0)/dgrid) + 1

0 commit comments

Comments
 (0)