mirror of https://github.com/abinit/abipy.git
Fix issue with unit tests for Xcrysden
This commit is contained in:
parent
55ab629b30
commit
678997fac2
2
TODO.rst
2
TODO.rst
|
@ -16,3 +16,5 @@ TODO List
|
|||
#. ecut is not reported in the GSR file.
|
||||
|
||||
#. Move unit conversion to NetcdfReader e.g reader.read_value(varname, unit=None)
|
||||
|
||||
#. Write new unit tests for Xcrysden and the other visualizers (move these tools to pymatgen?)
|
||||
|
|
|
@ -26,6 +26,12 @@ class AbipyTest(TestCase):
|
|||
def assert_equal(actual, desired, err_msg='', verbose=True):
|
||||
return nptu.assert_equal(actual, desired, err_msg=err_msg, verbose=verbose)
|
||||
|
||||
@staticmethod
|
||||
def which(program):
|
||||
"""Returns full path to a executable. None if not found or not executable."""
|
||||
from pymatgen.util.io_utils import which
|
||||
return which(program)
|
||||
|
||||
|
||||
class AbipyFileTest(AbipyTest):
|
||||
"""
|
||||
|
|
|
@ -35,9 +35,10 @@ class TestDensity(AbipyTest):
|
|||
self.assert_almost_equal(nelect_calc, nelect_file)
|
||||
self.assert_almost_equal(rhog_tot[0,0,0] * structure.volume, nelect_file)
|
||||
|
||||
# Export data in xsf format.
|
||||
visu = den.export(".xsf")
|
||||
self.assertTrue(callable(visu))
|
||||
if self.which("xcrysden") is not None:
|
||||
# Export data in xsf format.
|
||||
visu = den.export(".xsf")
|
||||
self.assertTrue(callable(visu))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -24,8 +24,9 @@ class TestStructure(AbipyTest):
|
|||
# Call pymatgen machinery to get the high-symmetry stars.
|
||||
print(structure.hsym_stars)
|
||||
|
||||
# Export data in Xcrysden format.
|
||||
structure.export(".xsf")
|
||||
if self.which("xcrysden") is not None:
|
||||
# Export data in Xcrysden format.
|
||||
structure.export(".xsf")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -37,7 +37,8 @@ class TestWFKFile(AbipyTest):
|
|||
same_ug = wave.gsphere.fromfftmesh(wave.mesh, ug_mesh)
|
||||
self.assert_almost_equal(wave.ug, same_ug)
|
||||
|
||||
wave.export_ur2(".xsf", structure)
|
||||
if self.which("xcrysden") is not None:
|
||||
wave.export_ur2(".xsf", structure)
|
||||
|
||||
#print wave.ug.shape, same_ug.shape
|
||||
#for idx, g in enumerate(wave.gvecs):
|
||||
|
|
Loading…
Reference in New Issue