Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/source/chapters/chapter1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Copy the following lines into *potentials.py*:

.. code-block:: python

import numpy as np

def potentials(potential_type, epsilon, sigma, r, derivative=False):
if potential_type == "Lennard-Jones":
if derivative:
Expand All @@ -84,9 +86,11 @@ Copy the following lines into *potentials.py*:
return 4 * epsilon * ((sigma / r) ** 12 - (sigma / r) ** 6)
elif potential_type == "Hard-Sphere":
if derivative:
raise ValueError("Derivative is not defined for Hard-Sphere potential.")
# Derivative is not defined for Hard-Sphere potential.
# --> return 0
return np.zeros(len(r))
else:
return 1000 if r < sigma else 0
return np.where(r > sigma, 0, 1000)
else:
raise ValueError(f"Unknown potential type: {potential_type}")

Expand Down
6 changes: 3 additions & 3 deletions docs/source/chapters/chapter4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ following *run()* method to the *MinimizeEnergy* class:
# First, meevaluate the initial energy and max force
self.update_neighbor_lists() # Rebuild neighbor list, if necessary
self.update_cross_coefficients() # Recalculate the cross coefficients, if necessary
if self.step == 0: # At the first step, Epot/MaxF do not exists yet, calculate them both
init_Epot = self.compute_potential()
forces, init_MaxF = self.compute_force()
# Compute Epot/MaxF/force
init_Epot = self.compute_potential()
forces, init_MaxF = self.compute_force()
# Save the current atom positions
init_positions = copy.deepcopy(self.atoms_positions)
# Move the atoms in the opposite direction of the maximum force
Expand Down
2 changes: 1 addition & 1 deletion docs/source/chapters/chapter5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ a LAMMPS dump format, and can be read by molecular dynamics softwares like VMD.
f.write("ITEM: NUMBER OF ATOMS\n")
f.write(str(code.total_number_atoms) + "\n")
f.write("ITEM: BOX BOUNDS pp pp pp\n")
for dim in np.arange(code.dimensions):
for dim in np.arange(3):
f.write(str(box_boundaries[dim][0]) + " "
+ str(box_boundaries[dim][1]) + "\n")
cpt = 1
Expand Down