Beispiel #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)
Beispiel #2
0
 def assertH5FileEqual(self, file1, file2):
     """
     Compares two files using difflib.
     Empty lines are ignored.
     Files are assumed to be relatively small;
     the data is truncated for files larger than MAX_SIZE bytes.
     """
     try:
         h5diff(file1, file2, precision=1e-6)
     except RuntimeError as err:
         if "FAILED" in err:
             return self.fail("Files '%s' and '%s' differ" % (file1, file2))
Beispiel #3
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)
Beispiel #4
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)
class test_2orb(unittest.TestCase):

    # Construct Parameters
    cp = {}
    cp["model"] = "2orb-UJ"
    cp["symtype"] = "QS"
    cp["mesh_max"] = 1.0
    cp["mesh_min"] = 1e-1
    cp["mesh_ratio"] = 1.1

    # Set up the Solver
    S = Solver(**cp)

    # Solve Parameters
    sp = {}
    sp["T"] = 1e-1
    sp["Lambda"] = 4.0
    sp["Nz"] = 1
    sp["Tmin"] = 0.5
    sp["keep"] = 2000
    sp["keepenergy"] = 10.0

    # Model Parameters
    mp = {}
    mp["U1"] = 1.0
    mp["U2"] = 0.9
    mp["eps1"] = -0.5
    mp["eps2"] = -0.4
    mp["U12"] = 0.1
    mp["J12"] = 0.05
    sp["model_parameters"] = mp

    # Low-level NRG Parameters
    np = {}
    np["bins"] = 50
    S.set_nrg_params(**np)

    # # Initialize hybridization function
    S.Delta_w['imp'][0,0] << 0.5 * SemiCircular(1.0)
    S.Delta_w['imp'][1,1] << 0.4 * SemiCircular(1.0)
    # Out-of-diagonal Delta is zero

    # Solve the impurity model
    S.solve(**sp)

    # # Store the Result
    with HDFArchive("3_2orb-UJ_QS.out.h5", 'w') as arch:
        arch["A_w"] = S.A_w
        arch["G_w"] = S.G_w
        arch["F_w"] = S.F_w
        arch["Sigma_w"] = S.Sigma_w

    # Compare against reference result
    h5diff("3_2orb-UJ_QS.out.h5", "3_2orb-UJ_QS.ref.h5")
Beispiel #6
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)
Beispiel #7
0
class test_SIAM(unittest.TestCase):

    # Construct Parameters
    cp = {}
    cp["model"] = "SIAM"
    cp["symtype"] = "QS"
    cp["mesh_max"] = 1.0
    cp["mesh_min"] = 1e-3
    cp["mesh_ratio"] = 1.1

    # Set up the Solver
    S = Solver(**cp)

    # Solve Parameters
    sp = {}
    sp["T"] = 1e-3
    sp["Lambda"] = 4.0
    sp["Nz"] = 4
    sp["Tmin"] = 1e-4
    sp["keep"] = 50
    sp["keepenergy"] = 6.0

    # Model Parameters
    mp = {}
    mp["U1"] = 0.5
    mp["eps1"] = -0.24
    sp["model_parameters"] = mp

    # Low-level NRG Parameters
    np = {}
    np["bins"] = 50
    S.set_nrg_params(**np)

    # # Initialize hybridization function
    S.Delta_w['imp'] << 0.1 * SemiCircular(1.0)

    # Solve the impurity model
    S.solve(**sp)

    if mpi.is_master_node():
      # Store the Result
      fnout = "MPI_SIAM_QS_np%i.out.h5" % mpi.size
      with HDFArchive(fnout, 'w') as arch:
        arch["A_w"] = S.A_w
        arch["G_w"] = S.G_w
        arch["F_w"] = S.F_w
        arch["Sigma_w"] = S.Sigma_w

      # Compare against reference result
      fnref = "MPI_SIAM_QS.ref.h5" # the same for all cases!
      h5diff(fnout, fnref)
Beispiel #8
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)
Beispiel #9
0
class test_SIAM(unittest.TestCase):

    # Construct Parameters
    cp = {}
    cp["model"] = "SIAM"
    cp["symtype"] = "QSZ"
    cp["mesh_max"] = 1.0
    cp["mesh_min"] = 1e-3
    cp["mesh_ratio"] = 1.1

    # Set up the Solver
    S = Solver(**cp)

    # Solve Parameters
    sp = {}
    sp["T"] = 1e-3
    sp["Lambda"] = 4.0
    sp["Nz"] = 2
    sp["Tmin"] = 1e-4
    sp["keep"] = 50
    sp["keepenergy"] = 6.0

    # Model Parameters
    mp = {}
    mp["U1"] = 0.5
    mp["eps1"] = -0.24
    mp["B1"] = -0.1
    sp["model_parameters"] = mp

    # Low-level NRG Parameters
    np = {}
    np["bins"] = 50
    S.set_nrg_params(**np)

    # # Initialize hybridization function
    S.Delta_w['up'] << 0.05 * SemiCircular(1.0)
    S.Delta_w['dn'] << 0.1 * SemiCircular(1.0)

    # Solve the impurity model
    S.solve(**sp)

    # # Store the Result
    with HDFArchive("2_SIAM_QSZ.out.h5", 'w') as arch:
        arch["A_w"] = S.A_w
        arch["G_w"] = S.G_w
        arch["F_w"] = S.F_w
        arch["Sigma_w"] = S.Sigma_w

    # Compare against reference result
    h5diff("2_SIAM_QSZ.out.h5", "2_SIAM_QSZ.ref.h5")
Beispiel #10
0
# Copyright (C) 2011 by M. Aichhorn, L. Pourovskii, V. Vildosola
#
# TRIQS is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# TRIQS 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
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

from h5 import *
from triqs.utility.comparison_tests import *
from triqs.utility.h5diff import h5diff
import triqs.utility.mpi as mpi

from triqs_dft_tools.converters import ElkConverter

Converter = ElkConverter(filename='Ba2YIrO6')
Converter.hdf_file = 'elk_convert.out.h5'
Converter.convert_dft_input()

if mpi.is_master_node():
    h5diff('elk_convert.out.h5', 'elk_convert.ref.h5')
Beispiel #11
0
from triqs.utility.comparison_tests import *
from triqs.utility.h5diff import h5diff

# Basic input parameters
beta = 40

# Init the SumK class
SK = SumkDFT(hdf_file='SrVO3.ref.h5', use_dft_blocks=True)

num_orbitals = SK.corr_shells[0]['dim']
l = SK.corr_shells[0]['l']
spin_names = ['down', 'up']
orb_names = ['%s' % i for i in range(num_orbitals)]
orb_hybridized = False

gf_struct = set_operator_structure(spin_names, orb_names, orb_hybridized)
glist = [GfImFreq(indices=inner, beta=beta) for block, inner in gf_struct]
Sigma_iw = BlockGf(name_list=[block for block, inner in gf_struct],
                   block_list=glist,
                   make_copies=False)

SK.set_Sigma([Sigma_iw])
Gloc = SK.extract_G_loc()

if mpi.is_master_node():
    with HDFArchive('srvo3_Gloc.out.h5', 'w') as ar:
        ar['Gloc'] = Gloc[0]

if mpi.is_master_node():
    h5diff("srvo3_Gloc.out.h5", "srvo3_Gloc.ref.h5")
Beispiel #12
0
from triqs.gf import *
from h5 import *
from numpy import zeros
import triqs.utility.mpi as mpi
from triqs.utility.h5diff import h5diff

from triqs_ctint import Solver

# Parameters
beta = 20.0
n_iw = 200;
U = 1.0
delta = 0.1;
n_cycles = 10000;

S = Solver(beta, n_iw)

# init the Green function
mu = 1.3 - U/2
eps0 = 0.2
S.G0_iw << inverse(iOmega_n + mu - 1.0 * inverse(iOmega_n - eps0))

S.solve(U, delta, n_cycles)

if mpi.is_master_node():
  A = HDFArchive("anderson.out.h5",'w')
  A['G'] = S.G_iw['up']

# -------- Compare ---------
h5diff("anderson.out.h5", "anderson.ref.h5")
Beispiel #13
0
# Copyright (C) 2011 by M. Aichhorn, L. Pourovskii, V. Vildosola
#
# TRIQS is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# TRIQS 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
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

from h5 import *
from triqs.utility.h5diff import h5diff
import triqs.utility.mpi as mpi

from triqs_dft_tools.converters import *

Converter = HkConverter(filename='hk_convert_hamiltonian.hk',
                        hdf_filename='hk_convert.out.h5')

Converter.convert_dft_input()

if mpi.is_master_node():
    h5diff("hk_convert.out.h5", "hk_convert.ref.h5")
Beispiel #14
0
# TRIQS is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# TRIQS 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
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

from h5 import *
from triqs.utility.comparison_tests import *
from triqs.utility.h5diff import h5diff 
import triqs.utility.mpi as mpi

from triqs_dft_tools.converters import Wien2kConverter

Converter = Wien2kConverter(filename='SrVO3')
Converter.hdf_file = 'wien2k_convert.out.h5'
Converter.convert_dft_input()

Converter.convert_parproj_input()

if mpi.is_master_node():
    h5diff('wien2k_convert.out.h5','wien2k_convert.ref.h5') 
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# TRIQS 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
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

from h5 import *
from triqs_dft_tools.sumk_dft_tools import SumkDFTTools
import triqs.utility.mpi as mpi
from triqs.utility.comparison_tests import *
from triqs.utility.h5diff import h5diff

SK = SumkDFTTools(hdf_file = 'SrVO3.ref.h5')

dm = SK.density_matrix(method = 'using_gf', beta = 40)
dm_pc = SK.partial_charges(beta=40,with_Sigma=False,with_dc=False)

with HDFArchive('sumkdft_basic.out.h5','w') as ar:
    ar['dm'] = dm
    ar['dm_pc'] = dm_pc

if mpi.is_master_node():
    h5diff('sumkdft_basic.out.h5','sumkdft_basic.ref.h5')
Beispiel #16
0
#
# You should have received a copy of the GNU General Public License along with
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

from triqs_dft_tools.converters import *
from h5 import *
from triqs.utility.h5diff import h5diff
import triqs.utility.mpi as mpi

# test rot_mat_type='hloc_diag'
Converter = Wannier90Converter(seedname='LaVO3-Pbnm',
                               hdf_filename='w90_convert_hloc_diag.out.h5',
                               rot_mat_type='hloc_diag')

Converter.convert_dft_input()

if mpi.is_master_node():
    h5diff("w90_convert_hloc_diag.out.h5", "w90_convert_hloc_diag.ref.h5")

# test rot_mat_type='wannier'
Converter = Wannier90Converter(seedname='LaVO3-Pnma',
                               hdf_filename='w90_convert_wannier.out.h5',
                               rot_mat_type='wannier')

Converter.convert_dft_input()

if mpi.is_master_node():
    h5diff("w90_convert_wannier.out.h5", "w90_convert_wannier.ref.h5")
Beispiel #17
0
    'h_int': h_int,
    'n_warmup_cycles': 100,
    'n_cycles': 5000,
    'length_cycle': 100
}
S.solve(**solve_params)

# -------- Save in archive ---------
if mpi.is_master_node():
    with HDFArchive("SIAM_Discrete_Bath.out.h5", 'w') as results:
        results["G_iw"] = S.G_iw
        results["G_tau"] = S.G_tau

from triqs.utility.h5diff import h5diff
if args.libcxx:
    h5diff("SIAM_Discrete_Bath.libcxx.ref.h5", "SIAM_Discrete_Bath.out.h5")
elif args.gccver_ge11:
    h5diff("SIAM_Discrete_Bath.gccver_ge11.ref.h5",
           "SIAM_Discrete_Bath.out.h5")
else:
    h5diff("SIAM_Discrete_Bath.ref.h5", "SIAM_Discrete_Bath.out.h5")

# ==== Construct the CTHYB solver using the Delta_tau + h_0 Interface ====
constr_params = {
    'beta': beta,
    'gf_struct': gf_struct,
    'n_iw': n_iw,
    'n_tau': 1000,
    'delta_interface': True
}
S = Solver(**constr_params)
SK.dc_imp = mpi.bcast(SK.dc_imp)
SK.set_Sigma([Sigma])

dos_wannier = SK.dos_wannier_basis(broadening=0.01,
                                   with_Sigma=True,
                                   with_dc=True,
                                   save_to_file=False)
dos_parproj = SK.dos_parproj_basis(broadening=0.01,
                                   with_Sigma=True,
                                   with_dc=True,
                                   save_to_file=False)
spaghetti = SK.spaghettis(broadening=0.01,
                          plot_shift=0.0,
                          plot_range=(-1, 1),
                          ishell=None,
                          save_to_file=False)

if mpi.is_master_node():

    # with HDFArchive('srvo3_spectral.ref.h5', 'a') as ar:
    #     ar['dos_wannier'] = dos_wannier
    #     ar['dos_parproj'] = dos_parproj
    #     ar['spaghetti'] = spaghetti

    with HDFArchive('srvo3_spectral.out.h5', 'a') as ar:
        ar['dos_wannier'] = dos_wannier
        ar['dos_parproj'] = dos_parproj
        ar['spaghetti'] = spaghetti

    h5diff('srvo3_spectral.out.h5', 'srvo3_spectral.ref.h5')
Beispiel #19
0
#
# Copyright (C) 2011 by M. Aichhorn, L. Pourovskii, V. Vildosola
#
# TRIQS is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# TRIQS 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
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

from triqs_dft_tools.converters import *
from h5 import *
from triqs.utility.h5diff import h5diff
import triqs.utility.mpi as mpi

Converter = Wannier90Converter(seedname='LaVO3-Pnma',
                               hdf_filename='w90_convert.out.h5')

Converter.convert_dft_input()

if mpi.is_master_node():
    h5diff("w90_convert.out.h5", "w90_convert.ref.h5")
Beispiel #20
0
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 dcore.dcore_pre import dcore_pre
from dcore.dcore import dcore
from dcore.dcore_bse import dcore_bse
from triqs.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))
#

input_ini = "square_2orb.ini"

dcore_pre(input_ini)
dcore(input_ini)
dcore_bse(input_ini)

h5diff("dmft_bse.h5", "dmft_bse.h5.ref")
    'n_warmup_cycles': 100,
    'n_cycles': 1000,
    'length_cycle': 100
}
S.solve(**solve_params)

# -------- Save in archive ---------
if mpi.is_master_node():
    with HDFArchive("2orb_Discrete_Bath.out.h5", 'w') as results:
        results["G_iw"] = S.G_iw
        results["G_tau"] = S.G_tau

from triqs.utility.h5diff import h5diff
if args.libcxx:
    h5diff("2orb_Discrete_Bath.libcxx.ref.h5",
           "2orb_Discrete_Bath.out.h5",
           precision=1.e-5)
elif args.gccver_ge11:
    h5diff("2orb_Discrete_Bath.gccver_ge11.ref.h5",
           "2orb_Discrete_Bath.out.h5",
           precision=1.e-5)
else:
    h5diff("2orb_Discrete_Bath.ref.h5",
           "2orb_Discrete_Bath.out.h5",
           precision=1.e-5)

# ==== Construct the CTHYB solver using the Delta_tau + h_0 Interface ====
constr_params = {
    'beta': beta,
    'gf_struct': gf_struct,
    'n_iw': n_iw,
Beispiel #22
0
from triqs.utility.h5diff import h5diff

beta = 40

Converter = Wien2kConverter(filename='SrVO3', repacking=True)
Converter.convert_dft_input()
Converter.convert_transport_input()

SK = SumkDFTTools(hdf_file='SrVO3.ref.h5', use_dft_blocks=True)

with HDFArchive('SrVO3_Sigma.h5', 'a') as ar:
    Sigma = ar['dmft_transp_input']['Sigma_w']
    SK.set_Sigma([Sigma])
    SK.chemical_potential = ar['dmft_transp_input']['chemical_potential']
    SK.dc_imp = ar['dmft_transp_input']['dc_imp']

SK.transport_distribution(directions=['xx'],
                          broadening=0.0,
                          energy_window=[-0.3, 0.3],
                          Om_mesh=[0.00, 0.02],
                          beta=beta,
                          with_Sigma=True)
#SK.save(['Gamma_w','Om_meshr','omega','directions'])
#SK.load(['Gamma_w','Om_meshr','omega','directions'])
SK.conductivity_and_seebeck(beta=beta)
SK.hdf_file = 'srvo3_transp.out.h5'
SK.save(['seebeck', 'optic_cond', 'kappa'])

if mpi.is_master_node():
    h5diff("srvo3_transp.out.h5", "srvo3_transp.ref.h5")