Ejemplo n.º 1
0
def test_pre_respack_so(request):
    org_dir = os.getcwd()
    os.chdir(request.fspath.dirname)

    dcore_pre("dmft.ini")
    h5diff("test.h5", "test_ref.h5")

    os.chdir(org_dir)
Ejemplo n.º 2
0
def test_pre_external(request):
    org_dir = os.getcwd()
    os.chdir(request.fspath.dirname)

    input_ini = "external.in"
    shutil.copy("external.h5.in", "external.h5")
    
    with open(input_ini, 'w') as f:
        print("[model]", file=f)
        print("lattice = external", file=f)
        print("seedname = external", file=f)
        print("kanamori = [(4.0,0.0,0.0)]", file=f)
    
    dcore_pre(input_ini)
    
    h5diff("external.h5", "external_ref.h5")

    os.chdir(org_dir)
Ejemplo n.º 3
0
def test_pre_wannier_so(request):
    org_dir = os.getcwd()
    os.chdir(request.fspath.dirname)

    with open("dmft.ini", 'w') as f:
        print("[model]", file=f)
        print("lattice = wannier90", file=f)
        print("seedname = chain", file=f)
        print("nelec = 5.0", file=f)
        print("ncor = 2", file=f)
        print("norb = 3, 4", file=f)
        print("kanamori = [(3.0, 2.0, 0.5), (5.0, 3.0, 1.0)]", file=f)
        print("spin_orbit = True", file=f)
        print("nk0 = 40", file=f)
        print("nk1 = 1", file=f)
        print("nk2 = 1", file=f)

    dcore_pre("dmft.ini")
    h5diff("chain.h5", "chain_ref.h5")
    os.chdir(org_dir)
Ejemplo n.º 4
0
def test_prepreset(request):
    org_dir = os.getcwd()
    os.chdir(request.fspath.dirname)

    for lattice in ['bethe', 'chain', 'square', 'cubic']:
        input_fname = 'stan_' + lattice + '.in'
        seedname = 'stan_test_' + lattice
        seedname_ref = 'stan_ref_' + lattice

        with open(input_fname, 'w') as f:
            print("[model]", file=f)
            print("t = 1.0", file=f)
            print("kanamori = [(4.0,0.0,0.0)]", file=f)
            print("lattice = ", lattice, file=f)
            print("seedname = " + seedname, file=f)

        dcore_pre(input_fname)

        h5diff(seedname + ".h5", seedname_ref + ".h5")

    os.chdir(org_dir)
Ejemplo n.º 5
0
def test_pre_wannier(request):
    org_dir = os.getcwd()
    os.chdir(request.fspath.dirname)

    with open("nis.ini", 'w') as f:
        print("[model]", file=f)
        print("lattice = wannier90", file=f)
        print("seedname = nis", file=f)
        print("nelec = 24.0", file=f)
        print("ncor = 2", file=f)
        print("norb = [5, 5]", file=f)
        print("interaction = slater_uj", file=f)
        print("slater_uj = [(2, 1.0, 0.0), (2, 1.0, 0.0)]", file=f)
        print("nk0 = 4", file=f)
        print("nk1 = 4", file=f)
        print("nk2 = 3", file=f)
        print("", file=f)
    
    dcore_pre("nis.ini")
    
    h5diff("nis.h5", "nis_ref.h5")

    os.chdir(org_dir)
Ejemplo n.º 6
0
def test_chain_hubbardI_so(request):
    org_dir = os.getcwd()
    os.chdir(request.fspath.dirname)
    seedname = 'test'
    dcore_pre('dmft.ini')
    dcore('dmft.ini')
    dcore_post('dmft.ini')

    data_files = glob.glob('./ref/*')

    for path in data_files:
        base_name = os.path.basename(path)
        print("base_nam,e ", base_name)
        if base_name == seedname + '.h5':
            h5diff(base_name, path)
        elif base_name == seedname + '.out.h5':
            h5diff(base_name, path, "dmft_out/Sigma_iw")
        elif not re.search('.dat$', base_name) is None:
            numdiff(base_name, path)
        else:
            raise RuntimeError("Uknown how to check " + base_name)

    os.chdir(org_dir)
Ejemplo n.º 7
0
        dcore_bse("sparse_fit.ini" + postfix)
        sys.stdout.flush()

        # interpolated data
        bse = h5BSE("dmft_bse.h5" + postfix)
        xloc_fit = bse.get(('X_loc', 0))

        # compare
        for key in xloc_fit:
            # for test
            print("distance:", numpy.linalg.norm(xloc_fit[key] - self.xloc_ref[key]))
            sys.stdout.flush()

            # compare
            numpy.testing.assert_allclose(xloc_fit[key], self.xloc_ref[key], atol=1e-2)
            # self.assertTrue(numpy.allclose(xloc_fit[key], self.xloc_ref[key], rtol=1e-2))
            sys.stdout.flush()

    def test_fit_Lambda100(self):
        self._fit_and_compare(".Lambda100")


if __name__ == '__main__':
    input_ini = "sparse_fit.ini.ref"
    dcore_pre(input_ini)
    dcore(input_ini)
    dcore_bse(input_ini)

    unittest.main()
Ejemplo n.º 8
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
from __future__ import print_function
from pytriqs.utility.h5diff import h5diff
from dcore.dcore_pre import dcore_pre
#
# Execute dcore_pre.py to generate test.h5
# Then Check the Diff of test.h5 and the reference output (stan_ref.h5))
#
with open("dmft.ini", 'w') as f:
    print("[model]", file=f)
    print("lattice = wannier90", file=f)
    print("seedname = chain", file=f)
    print("nelec = 5.0", file=f)
    print("ncor = 2", file=f)
    print("norb = 6, 8", file=f)
    print("kanamori = [(3.0, 2.0, 0.5), (5.0, 3.0, 1.0)]", file=f)
    print("spin_orbit = True", file=f)
    print("", file=f)
    print("[system]", file=f)
    print("nk0 = 40", file=f)
    print("nk1 = 1", file=f)
    print("nk2 = 1", file=f)

dcore_pre("dmft.ini")

h5diff("chain.h5", "chain_ref.h5")
Ejemplo n.º 9
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
from __future__ import print_function
from pytriqs.utility.h5diff import h5diff
from dcore.dcore_pre import dcore_pre
#
# Execute dcore_pre.py to generate test.h5
# Then Check the Diff of test.h5 and the reference output (stan_ref.h5))
#
with open("nis.ini", 'w') as f:
    print("[model]", file=f)
    print("lattice = wannier90", file=f)
    print("seedname = nis", file=f)
    print("nelec = 24.0", file=f)
    print("ncor = 2", file=f)
    print("norb = [5, 5]", file=f)
    print("interaction = slater_uj", file=f)
    print("slater_uj = [(2, 1.0, 0.0), (2, 1.0, 0.0)]", file=f)
    print("", file=f)
    print("[system]", file=f)
    print("nk0 = 4", file=f)
    print("nk1 = 4", file=f)
    print("nk2 = 3", file=f)

dcore_pre("nis.ini")

h5diff("nis.h5", "nis_ref.h5")
Ejemplo n.º 10
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
from __future__ import print_function
from dcore.dcore_pre import dcore_pre
from pytriqs.utility.h5diff import h5diff
#
# Execute dcore_pre.py to generate test.h5
# Then Check the Diff of test.h5 and the reference output (stan_ref.h5))
#
for lattice in ['bethe', 'chain', 'square', 'cubic']:
    input_fname = 'stan_' + lattice + '.in'
    seedname = 'stan_test_' + lattice
    seedname_ref = 'stan_ref_' + lattice

    with open(input_fname, 'w') as f:
        print("[model]", file=f)
        print("t = 1.0", file=f)
        print("kanamori = [(4.0,0.0,0.0)]", file=f)
        print("lattice = ", lattice, file=f)
        print("seedname = " + seedname, file=f)

    dcore_pre(input_fname)

    h5diff(seedname + ".h5", seedname_ref + ".h5")