Skip to content

Commit

Permalink
reinstate the deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
arm61 committed Dec 6, 2018
1 parent 5ef7ace commit 54a4792
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dist/
pylj/__pycache__/
pylj/tests/__pycache__/
pylj.egg-info/
examples/
pylj/comp.cpython-37m-darwin.so
49 changes: 49 additions & 0 deletions pylj/pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,55 @@ def second_law(f, m, d1, d2):
"""
return (f * d1 / d2) / m

def lennard_jones_energy(A, B, dr):
"""pairwise.lennard_jones_energy has been deprecated, please use
forcefields.lennard_jones instead
Calculate the energy of a pair of particles at a given distance.
Parameters
----------
A: float
The value of the A parameter for the Lennard-Jones potential.
B: float
The value of the B parameter for the Lennard-Jones potential.
dr: float
The distance between the two particles.
Returns
-------
float:
The potential energy between the two particles.
"""
print("pairwise.lennard_jones_energy has been deprecated, please use "
"forcefields.lennard_jones instead")
return A * np.power(dr, -12) - B * np.power(dr, -6)


def lennard_jones_force(A, B, dr):
"""pairwise.lennard_jones_energy has been deprecated, please use
forcefields.lennard_jones with force=True instead
Calculate the force between a pair of particles at a given distance.
Parameters
----------
A: float
The value of the A parameter for the Lennard-Jones potential.
B: float
The value of the B parameter for the Lennard-Jones potential.
dr: float
The distance between the two particles.
Returns
-------
float:
The force between the two particles.
"""
print("pairwise.lennard_jones_energy has been deprecated, please use "
"forcefields.lennard_jones with force=True instead")
return 12 * A * np.power(dr, -13) - 6 * B * np.power(dr, -7)


def compute_energy(particles, box_length, cut_off, constants, forcefield):
r"""Calculates the total energy of the simulation.
Expand Down

0 comments on commit 54a4792

Please sign in to comment.