Skip to content

Commit

Permalink
Close files, increase lpratio in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed Mar 24, 2017
1 parent f4afa7b commit 2bb95ac
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion abipy/core/skw.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,6 @@ def __init__(self, lpratio, kpts, eigens, fermie, nelect, cell, symrel, has_timr
de_kbs[:, ib, spin] = eigens[spin, 0:nkpt-1, ib] - eigens[spin, nkpt-1, ib]

# Solve all bands and spins at once
#call np.linalg.zhesv("U", nkpt-1, nband*nsppol, hmat, nkpt-1, ipiv, lmbs, nkpt-1, work, lwork, ierr)
try:
lmb_kbs = scipy.linalg.solve(hmat, np.reshape(de_kbs, (-1, nband * nsppol)),
sym_pos=True, lower=False, overwrite_a=True, overwrite_b=True, check_finite=False)
Expand Down
2 changes: 1 addition & 1 deletion abipy/dfpt/tests/test_phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def test_plot_functions(self):
fig = phbands_gridplot(phb_objects, titles=["phonons1", "phonons2"],
phdos_objects=phdos_objects, show=False)
assert fig is not None
phdos.close()


class PhbstFileTest(AbipyTest):
Expand Down Expand Up @@ -164,7 +165,6 @@ class InteratomicForceConstantsTest(AbipyTest):
@classmethod
def setUpClass(cls):
cls.ddb = DdbFile(os.path.join(test_dir, "AlAs_444_nobecs_DDB"))

cls.ifc = cls.ddb.anaget_ifc(ifcout=40, ngqpt=[4,4,4], verbose=1)

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion abipy/electrons/scr.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


class WGGFunction(object):
"""
r"""
Base class for two-point functions expressed in
reciprocal space i.e. a matrix $A_{G,G'}(q, \omega)$
Expand Down
7 changes: 5 additions & 2 deletions abipy/electrons/tests/test_ebands.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ def test_jdos(self):
with self.assertRaises(ValueError):
nscf_bands.get_ejdos(spin, 0, 4)

def test_ebands_skw_interpolation(self):
bands = ElectronBands.from_file(abidata.ref_file("si_scf_GSR.nc"))

# Test interpolate.
vertices_names=[((0.0, 0.0, 0.0), "G"), ((0.5, 0.5, 0.0), "M")]
r = bands.interpolate(lpratio=5, vertices_names=vertices_names, kmesh=[8, 8, 8], verbose=1)
vertices_names = [((0.0, 0.0, 0.0), "G"), ((0.5, 0.5, 0.0), "M")]
r = bands.interpolate(lpratio=10, vertices_names=vertices_names, kmesh=[8, 8, 8], verbose=1)
assert r.ebands_kpath is not None
assert r.ebands_kpath.kpoints.is_path
assert not r.ebands_kpath.kpoints.is_ibz
Expand Down
8 changes: 3 additions & 5 deletions abipy/iotools/tests/test_xsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_xsf_write_structure(self):
"""
tmp_file.seek(0)
self.assertMultiLineEqual(tmp_file.read(), xsf_string)
tmp_file.close()

def test_xsf_write_data(self):
"""Testing XSF file with datasets."""
Expand Down Expand Up @@ -86,6 +87,7 @@ def test_xsf_write_data(self):
xsf_write_data(tmp_file, self.mgb2, cplx_data, cplx_mode="re")
tmp_file.seek(0)
self.assertMultiLineEqual(tmp_file.read(), xsf_string)
tmp_file.close()

def test_bxsf_write(self):
tmp_file = tempfile.TemporaryFile(mode="w+")
Expand Down Expand Up @@ -141,8 +143,4 @@ def test_bxsf_write(self):
print(xsf_string)
self.maxDiff = None
self.assertMultiLineEqual(s, xsf_string)


if __name__ == "__main__":
import unittest
unittest.main()
tmp_file.close()

0 comments on commit 2bb95ac

Please sign in to comment.