Skip to content

Commit

Permalink
TST: Fixed test for issue #30
Browse files Browse the repository at this point in the history
  • Loading branch information
pastewka committed May 27, 2020
1 parent 65cb486 commit f541da6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/neighbor_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,24 @@ def test_partial_pbc_small_cell(self):

def test_floating_point_issue(self):
calc = Tersoff()
a1 = Atoms('Si4C4', positions=np.array([[-4.41173839e-52, 0.00000000e+00, 0.00000000e+00],
[-4.41173839e-52, 2.26371743e+00, 2.26371743e+00],
[ 2.26371743e+00, 0.00000000e+00, 2.26371743e+00],
[ 2.26371743e+00, 2.26371743e+00, 0.00000000e+00],
[ 1.13185872e+00, 1.13185872e+00, 1.13185872e+00],
[ 1.13185872e+00, 3.39557615e+00, 3.39557615e+00],
[ 3.39557615e+00, 1.13185872e+00, 3.39557615e+00],
[ 3.39557615e+00, 3.39557615e+00, 1.13185872e+00]]),
a1 = ase.Atoms('Si4C4', positions=np.array([[-4.41173839e-52, 0.00000000e+00, 0.00000000e+00],
[-4.41173839e-52, 2.26371743e+00, 2.26371743e+00],
[ 2.26371743e+00, 0.00000000e+00, 2.26371743e+00],
[ 2.26371743e+00, 2.26371743e+00, 0.00000000e+00],
[ 1.13185872e+00, 1.13185872e+00, 1.13185872e+00],
[ 1.13185872e+00, 3.39557615e+00, 3.39557615e+00],
[ 3.39557615e+00, 1.13185872e+00, 3.39557615e+00],
[ 3.39557615e+00, 3.39557615e+00, 1.13185872e+00]]),
cell=[4.527434867899659, 4.527434867899659, 4.527434867899659], pbc=True)

a1.calc = calc
a1.get_potential_energy()
self.assertTrue((calc.nl.get_coordination_numbers(calc.particles, 3.0) == 4).all())

a2 = a1.copy()
a2.calc = calc
a2.set_scaled_positions(a2.get_scaled_positions())
a2.get_potential_energy()
self.assertTrue((calc.nl.get_coordination_numbers(calc.particles, 3.0) == 4).all())

###
Expand Down

0 comments on commit f541da6

Please sign in to comment.