mirror of
https://github.com/triqs/dft_tools
synced 2024-12-21 11:53:41 +01:00
[tests] Use new testing API
This commit is contained in:
parent
90dafa478a
commit
8652660115
@ -1,10 +1,15 @@
|
||||
# load triqs helper to set up tests
|
||||
find_package(TriqsTest)
|
||||
|
||||
FILE(COPY SrVO3.h5 SrVO3_Sigma.h5 SrVO3.pmat SrVO3.struct SrVO3.outputs SrVO3.oubwin SrVO3.ctqmcout SrVO3.symqmc SrVO3.sympar SrVO3.parproj hk_convert_hamiltonian.hk DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
triqs_add_test_hdf(wien2k_convert " -p 1.e-6" )
|
||||
triqs_add_test_hdf(hk_convert " -p 1.e-6" )
|
||||
triqs_add_test_hdf(sumkdft_basic " -d 1.e-6" )
|
||||
triqs_add_test_hdf(srvo3_Gloc " -d 1.e-6" )
|
||||
triqs_add_test_hdf(srvo3_transp " -d 1.e-6" )
|
||||
triqs_add_test_hdf(sigma_from_file " -d 1.e-6" )
|
||||
# Copy h5 files to binary dir
|
||||
FILE(GLOB all_h5_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h5)
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${all_h5_files} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
# Copy other files
|
||||
FILE(COPY SrVO3.pmat SrVO3.struct SrVO3.outputs SrVO3.oubwin SrVO3.ctqmcout SrVO3.symqmc SrVO3.sympar SrVO3.parproj hk_convert_hamiltonian.hk DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
triqs_add_python_test(wien2k_convert)
|
||||
triqs_add_python_test(hk_convert)
|
||||
triqs_add_python_test(sumkdft_basic)
|
||||
triqs_add_python_test(srvo3_Gloc)
|
||||
triqs_add_python_test(srvo3_transp)
|
||||
triqs_add_python_test(sigma_from_file)
|
||||
|
@ -23,7 +23,12 @@
|
||||
|
||||
from pytriqs.applications.dft.converters import *
|
||||
from pytriqs.archive import *
|
||||
from pytriqs.utility.h5diff import h5diff
|
||||
import pytriqs.utility.mpi as mpi
|
||||
|
||||
Converter = HkConverter(filename='hk_convert_hamiltonian.hk',hdf_filename='hk_convert.output.h5')
|
||||
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")
|
||||
|
@ -1,7 +1,29 @@
|
||||
################################################################################
|
||||
#
|
||||
# TRIQS: a Toolbox for Research in Interacting Quantum Systems
|
||||
#
|
||||
# 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 pytriqs.archive import *
|
||||
from pytriqs.gf.local import *
|
||||
from pytriqs.gf.local.tools import *
|
||||
from pytriqs.applications.dft.sumk_dft_tools import *
|
||||
from pytriqs.utility.comparison_tests import *
|
||||
import numpy as np
|
||||
|
||||
# Read self energy from hdf file
|
||||
@ -26,7 +48,7 @@ Sigma_txt = BlockGf(name_list = a_list, block_list = g_list, make_copies=False)
|
||||
|
||||
SK.set_Sigma([Sigma_txt])
|
||||
|
||||
SK.hdf_file = 'sigma_from_file.output.h5'
|
||||
SK.hdf_file = 'sigma_from_file.out.h5'
|
||||
SK.save(['Sigma_imp_w'])
|
||||
|
||||
if ((Sigma_txt - Sigma_hdf).real < 1e-6) & ((Sigma_txt - Sigma_hdf).imag < 1e-6):
|
||||
|
@ -24,6 +24,8 @@ from pytriqs.gf.local import *
|
||||
from pytriqs.applications.dft.sumk_dft import *
|
||||
from pytriqs.applications.dft.converters.wien2k_converter import *
|
||||
from pytriqs.operators.util import set_operator_structure
|
||||
from pytriqs.utility.comparison_tests import *
|
||||
from pytriqs.utility.h5diff import h5diff
|
||||
|
||||
# Basic input parameters
|
||||
beta = 40
|
||||
@ -42,8 +44,11 @@ glist = [ GfImFreq(indices=inner,beta=beta) for block,inner in gf_struct.iterite
|
||||
Sigma_iw = BlockGf(name_list = gf_struct.keys(), block_list = glist, make_copies = False)
|
||||
|
||||
SK.set_Sigma([Sigma_iw])
|
||||
Gloc=SK.extract_G_loc()
|
||||
Gloc = SK.extract_G_loc()
|
||||
|
||||
ar = HDFArchive('srvo3_Gloc.output.h5','w')
|
||||
ar['Gloc'] = Gloc[0]
|
||||
del ar
|
||||
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")
|
||||
|
@ -23,6 +23,8 @@ from numpy import *
|
||||
from pytriqs.applications.dft.converters.wien2k_converter import *
|
||||
from pytriqs.applications.dft.sumk_dft import *
|
||||
from pytriqs.applications.dft.sumk_dft_tools import *
|
||||
from pytriqs.utility.comparison_tests import *
|
||||
from pytriqs.utility.h5diff import h5diff
|
||||
|
||||
beta = 40
|
||||
|
||||
@ -43,6 +45,8 @@ SK.transport_distribution(directions=['xx'], broadening=0.0, energy_window=[-0.3
|
||||
#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.output.h5'
|
||||
SK.hdf_file = 'srvo3_transp.out.h5'
|
||||
SK.save(['seebeck','optic_cond'])
|
||||
|
||||
if mpi.is_master_node():
|
||||
h5diff("srvo3_transp.out.h5","srvo3_transp.ref.h5")
|
||||
|
@ -22,14 +22,18 @@
|
||||
|
||||
from pytriqs.archive import *
|
||||
from pytriqs.applications.dft.sumk_dft_tools import SumkDFTTools
|
||||
|
||||
import pytriqs.utility.mpi as mpi
|
||||
from pytriqs.utility.comparison_tests import *
|
||||
from pytriqs.utility.h5diff import h5diff
|
||||
|
||||
SK = SumkDFTTools(hdf_file = 'SrVO3.h5')
|
||||
|
||||
dm = SK.density_matrix(method = 'using_gf', beta = 40)
|
||||
dm_pc = SK.partial_charges(beta=40,with_Sigma=False,with_dc=False)
|
||||
|
||||
ar = HDFArchive('sumkdft_basic.output.h5','w')
|
||||
ar['dm'] = dm
|
||||
ar['dm_pc'] = dm_pc
|
||||
del ar
|
||||
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')
|
||||
|
@ -22,13 +22,15 @@
|
||||
|
||||
from pytriqs.archive import *
|
||||
from pytriqs.applications.dft.converters import Wien2kConverter
|
||||
|
||||
from pytriqs.utility.comparison_tests import *
|
||||
from pytriqs.utility.h5diff import h5diff
|
||||
import pytriqs.utility.mpi as mpi
|
||||
|
||||
Converter = Wien2kConverter(filename='SrVO3')
|
||||
Converter.hdf_file = 'wien2k_convert.output.h5'
|
||||
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')
|
||||
|
Loading…
Reference in New Issue
Block a user