Skip to content

Commit

Permalink
Updated unitest
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcarreras committed Mar 3, 2017
1 parent 409291a commit 984296f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions unittest/GaN_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ def test_adp(self):
memmap=False)
self.calculation = dynaphopy.Quasiparticle(trajectory)


self.calculation.get_anisotropic_displacement_parameters()

positions_average = self.calculation.dynamic.average_positions(to_unit_cell=True).real
positions = self.structure.get_positions()
difference = positions - positions_average

norm = np.linalg.norm(self.structure.get_cell(), axis=0)
difference = np.mod(difference, norm)
division = np.divide(difference, norm)
multiples = np.divide(difference, norm)

self.assertLess(np.max(np.abs(division - np.round(division))), 1e-4)
self.assertLess(np.max(np.abs(multiples - np.round(multiples))), 1e-4)

def test_thermal_properties(self):
trajectory = io.initialize_from_hdf5_file('test_gan.h5',
Expand All @@ -72,7 +72,7 @@ def test_force_constants_self_consistency(self):
read_trajectory=False,
initial_cut=1,
final_cut=3000,
memmap=False)
memmap=True)
self.calculation = dynaphopy.Quasiparticle(trajectory)

self.calculation.select_power_spectra_algorithm(2)
Expand All @@ -81,7 +81,7 @@ def test_force_constants_self_consistency(self):
self.assertEqual(np.allclose(renormalized_force_constants, harmonic_force_constants, rtol=1, atol=1.e-2), True)

def __del__(self):
# os.remove('test_gan.h5')
os.remove('test_gan.h5')
print ('end')

if __name__ == '__main__':
Expand Down

0 comments on commit 984296f

Please sign in to comment.