Skip to content

Commit 878345a

Browse files
committed
corrected hard sphere potential
1 parent 4a8014b commit 878345a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/source/chapters/chapter1.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ Copy the following lines into *potentials.py*:
8686
return 4 * epsilon * ((sigma / r) ** 12 - (sigma / r) ** 6)
8787
elif potential_type == "Hard-Sphere":
8888
if derivative:
89-
raise ValueError("Derivative is not defined for Hard-Sphere potential.")
89+
# Derivative is not defined for Hard-Sphere potential.
90+
# --> return 0
91+
return np.zeros(len(r))
9092
else:
91-
return np.where(r < sigma, 0, 1000)
93+
return np.where(r > sigma, 0, 1000)
9294
else:
9395
raise ValueError(f"Unknown potential type: {potential_type}")
9496

0 commit comments

Comments
 (0)