3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-22 20:34:38 +01:00

[py3] Run port_to_triqs3 script

This commit is contained in:
Nils Wentzell 2020-05-27 11:30:24 -04:00
parent 21532641a2
commit 97c5cad66e
32 changed files with 79 additions and 79 deletions

View File

@ -1,8 +1,8 @@
def application_pytriqs_import(name,*args,**kwargs): def application_triqs_import(name,*args,**kwargs):
if name.startswith('@package_name@'): if name.startswith('@package_name@'):
name = name[len('@package_name@')+1:] name = name[len('@package_name@')+1:]
return builtin_import(name,*args,**kwargs) return builtin_import(name,*args,**kwargs)
import builtins import builtins
builtins.__import__, builtin_import = application_pytriqs_import, builtins.__import__ builtins.__import__, builtin_import = application_triqs_import, builtins.__import__

View File

@ -37,7 +37,7 @@ class::
Note that all routines available in :class:`SumkDFT <dft.sumk_dft.SumkDFT>` are also available here. Note that all routines available in :class:`SumkDFT <dft.sumk_dft.SumkDFT>` are also available here.
If required, we have to load and initialise the real-frequency self energy. Most conveniently, If required, we have to load and initialise the real-frequency self energy. Most conveniently,
you have your self energy already stored as a real-frequency :class:`BlockGf <pytriqs.gf.BlockGf>` object you have your self energy already stored as a real-frequency :class:`BlockGf <triqs.gf.BlockGf>` object
in a hdf5 file:: in a hdf5 file::
with HDFArchive('case.h5', 'r') as ar: with HDFArchive('case.h5', 'r') as ar:
@ -45,10 +45,10 @@ in a hdf5 file::
You may also have your self energy stored in text files. For this case the :ref:`TRIQS <triqslibs:welcome>` library offers You may also have your self energy stored in text files. For this case the :ref:`TRIQS <triqslibs:welcome>` library offers
the function :meth:`read_gf_from_txt`, which is able to load the data from text files of one Green function block the function :meth:`read_gf_from_txt`, which is able to load the data from text files of one Green function block
into a real-frequency :class:`ReFreqGf <pytriqs.gf.ReFreqGf>` object. Loading each block separately and into a real-frequency :class:`ReFreqGf <triqs.gf.ReFreqGf>` object. Loading each block separately and
building up a :class:´BlockGf <pytriqs.gf.BlockGf>´ is done with:: building up a :class:´BlockGf <triqs.gf.BlockGf>´ is done with::
from pytriqs.gf.tools import * from triqs.gf.tools import *
# get block names # get block names
n_list = [n for n,nl in SK.gf_struct_solver[0].iteritems()] n_list = [n for n,nl in SK.gf_struct_solver[0].iteritems()]
# load sigma for each block - in this example sigma is composed of 1x1 blocks # load sigma for each block - in this example sigma is composed of 1x1 blocks

View File

@ -80,8 +80,8 @@ for :emphasis:`use_dc_formula` are:
At the end of the calculation, we can save the Green function and self energy into a file:: At the end of the calculation, we can save the Green function and self energy into a file::
from pytriqs.archive import HDFArchive from h5 import HDFArchive
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
if mpi.is_master_node(): if mpi.is_master_node():
ar = HDFArchive("YourDFTDMFTcalculation.h5",'w') ar = HDFArchive("YourDFTDMFTcalculation.h5",'w')
ar["G"] = S.G_iw ar["G"] = S.G_iw

View File

@ -96,7 +96,7 @@ In order to run DFT+DMFT calculations within Hubbard-I we need the corresponding
with the CT-QMC solver (see :ref:`singleshot`), however there are also some differences. First with the CT-QMC solver (see :ref:`singleshot`), however there are also some differences. First
difference is that we import the Hubbard-I solver by:: difference is that we import the Hubbard-I solver by::
from pytriqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver from triqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver
The Hubbard-I solver is very fast and we do not need to take into account the DFT block structure The Hubbard-I solver is very fast and we do not need to take into account the DFT block structure
or use any approximation for the *U*-matrix. We load and convert the :program:`dmftproj` output or use any approximation for the *U*-matrix. We load and convert the :program:`dmftproj` output

View File

@ -1,6 +1,6 @@
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.converters.wien2k_converter import * from triqs_dft_tools.converters.wien2k_converter import *
from pytriqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver from triqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver
import os import os
dft_filename = os.getcwd().rpartition('/')[2] dft_filename = os.getcwd().rpartition('/')[2]

View File

@ -1,6 +1,6 @@
from triqs_dft_tools.sumk_dft_tools import * from triqs_dft_tools.sumk_dft_tools import *
from triqs_dft_tools.converters.wien2k_converter import * from triqs_dft_tools.converters.wien2k_converter import *
from pytriqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver from triqs.applications.impurity_solvers.hubbard_I.hubbard_solver import Solver
# Creates the data directory, cd into it: # Creates the data directory, cd into it:
#Prepare_Run_Directory(DirectoryName = "Ce-Gamma") #Prepare_Run_Directory(DirectoryName = "Ce-Gamma")

View File

@ -1,12 +1,12 @@
from itertools import * from itertools import *
import numpy as np import numpy as np
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from h5 import * from h5 import *
from pytriqs.gf import * from triqs.gf import *
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.sumk_dft_tools import * from triqs_dft_tools.sumk_dft_tools import *
from pytriqs.operators.util.hamiltonians import * from triqs.operators.util.hamiltonians import *
from pytriqs.operators.util.U_matrix import * from triqs.operators.util.U_matrix import *
from triqs_cthyb import * from triqs_cthyb import *
import warnings import warnings
warnings.filterwarnings("ignore", category=FutureWarning) warnings.filterwarnings("ignore", category=FutureWarning)

View File

@ -1,8 +1,8 @@
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from pytriqs.operators.util import * from triqs.operators.util import *
from h5 import HDFArchive from h5 import HDFArchive
from triqs_cthyb import * from triqs_cthyb import *
from pytriqs.gf import * from triqs.gf import *
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.converters.wien2k_converter import * from triqs_dft_tools.converters.wien2k_converter import *

View File

@ -1,4 +1,4 @@
from pytriqs.gf import * from triqs.gf import *
from h5 import * from h5 import *
from triqs_maxent import * from triqs_maxent import *
@ -43,7 +43,7 @@ for orb in orbs:
# you may be interested in the details of the line analyzer: # you may be interested in the details of the line analyzer:
# from pytriqs.plot.mpl_interface import oplot # from triqs.plot.mpl_interface import oplot
#plt.figure(2) #plt.figure(2)
#result.analyzer_results['LineFitAnalyzer'].plot_linefit() #result.analyzer_results['LineFitAnalyzer'].plot_linefit()
#plt.savefig('ana'+str(orb[0])+'.pdf',fmt='pdf') #plt.savefig('ana'+str(orb[0])+'.pdf',fmt='pdf')

View File

@ -1,13 +1,13 @@
from itertools import * from itertools import *
import numpy as np import numpy as np
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from h5 import * from h5 import *
from pytriqs.gf import * from triqs.gf import *
import sys, pytriqs.version as triqs_version import sys, triqs.version as triqs_version
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.sumk_dft_tools import * from triqs_dft_tools.sumk_dft_tools import *
from pytriqs.operators.util.hamiltonians import * from triqs.operators.util.hamiltonians import *
from pytriqs.operators.util.U_matrix import * from triqs.operators.util.U_matrix import *
from triqs_cthyb import * from triqs_cthyb import *
import triqs_cthyb.version as cthyb_version import triqs_cthyb.version as cthyb_version
import triqs_dft_tools.version as dft_tools_version import triqs_dft_tools.version as dft_tools_version

View File

@ -1,13 +1,13 @@
from itertools import * from itertools import *
import numpy as np import numpy as np
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from h5 import * from h5 import *
from pytriqs.gf import * from triqs.gf import *
import sys, pytriqs.version as triqs_version import sys, triqs.version as triqs_version
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.sumk_dft_tools import * from triqs_dft_tools.sumk_dft_tools import *
from pytriqs.operators.util.hamiltonians import * from triqs.operators.util.hamiltonians import *
from pytriqs.operators.util.U_matrix import * from triqs.operators.util.U_matrix import *
from triqs_cthyb import * from triqs_cthyb import *
import triqs_cthyb.version as cthyb_version import triqs_cthyb.version as cthyb_version
import triqs_dft_tools.version as dft_tools_version import triqs_dft_tools.version as dft_tools_version

View File

@ -77,11 +77,11 @@ Loading modules
First, we load the necessary modules:: First, we load the necessary modules::
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from pytriqs.gf import * from triqs.gf import *
from pytriqs.archive import HDFArchive from h5 import HDFArchive
from pytriqs.operators.util import * from triqs.operators.util import *
from triqs_cthyb import * from triqs_cthyb import *
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
The last two lines load the modules for the construction of the The last two lines load the modules for the construction of the
:ref:`CTHYB solver <triqscthyb:welcome>`. :ref:`CTHYB solver <triqscthyb:welcome>`.
@ -271,7 +271,7 @@ and perform only one DMFT iteration. The resulting self energy can be tail fitte
Sigma_iw_fit << tail_fit(S.Sigma_iw, fit_max_moment = 4, fit_min_n = 40, fit_max_n = 160)[0] Sigma_iw_fit << tail_fit(S.Sigma_iw, fit_max_moment = 4, fit_min_n = 40, fit_max_n = 160)[0]
Plot the self energy and adjust the tail fit parameters such that you obtain a Plot the self energy and adjust the tail fit parameters such that you obtain a
proper fit. The :meth:`fit_tail function <pytriqs.gf.tools.tail_fit>` is part proper fit. The :meth:`fit_tail function <triqs.gf.tools.tail_fit>` is part
of the :ref:`TRIQS <triqslibs:welcome>` library. of the :ref:`TRIQS <triqslibs:welcome>` library.
For a self energy which is going to zero for :math:`i\omega \rightarrow 0` our suggestion is For a self energy which is going to zero for :math:`i\omega \rightarrow 0` our suggestion is

View File

@ -1,8 +1,8 @@
import copy import copy
import numpy as np import numpy as np
from pytriqs.gf import GfImFreq, BlockGf from triqs.gf import GfImFreq, BlockGf
from ast import literal_eval from ast import literal_eval
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from warnings import warn from warnings import warn
class BlockStructure(object): class BlockStructure(object):

View File

@ -19,7 +19,7 @@
# TRIQS. If not, see <http://www.gnu.org/licenses/>. # TRIQS. If not, see <http://www.gnu.org/licenses/>.
# #
########################################################################## ##########################################################################
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
class ConverterTools: class ConverterTools:

View File

@ -23,7 +23,7 @@
from types import * from types import *
import numpy import numpy
from h5 import * from h5 import *
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from math import sqrt from math import sqrt
from .converter_tools import * from .converter_tools import *

View File

@ -30,7 +30,7 @@ import re
import time import time
import signal import signal
import sys import sys
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from . import converter from . import converter
from shutil import copyfile from shutil import copyfile

View File

@ -22,10 +22,10 @@
from types import * from types import *
import numpy import numpy
import pytriqs.utility.dichotomy as dichotomy import triqs.utility.dichotomy as dichotomy
from pytriqs.gf import * from triqs.gf import *
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from pytriqs.utility.comparison_tests import assert_arrays_are_close from triqs.utility.comparison_tests import assert_arrays_are_close
from h5 import * from h5 import *
from .symmetry import * from .symmetry import *
from .block_structure import BlockStructure from .block_structure import BlockStructure
@ -36,7 +36,7 @@ from scipy.optimize import minimize
class SumkDFT(object): class SumkDFT(object):
"""This class provides a general SumK method for combining ab-initio code and pytriqs.""" """This class provides a general SumK method for combining ab-initio code and triqs."""
def __init__(self, hdf_file, h_field=0.0, use_dft_blocks=False, def __init__(self, hdf_file, h_field=0.0, use_dft_blocks=False,
dft_data='dft_input', symmcorr_data='dft_symmcorr_input', parproj_data='dft_parproj_input', dft_data='dft_input', symmcorr_data='dft_symmcorr_input', parproj_data='dft_parproj_input',

View File

@ -21,8 +21,8 @@
import sys import sys
from types import * from types import *
import numpy import numpy
from pytriqs.gf import * from triqs.gf import *
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from .symmetry import * from .symmetry import *
from .sumk_dft import SumkDFT from .sumk_dft import SumkDFT
from scipy.integrate import * from scipy.integrate import *

View File

@ -23,9 +23,9 @@
import copy import copy
import numpy import numpy
from types import * from types import *
from pytriqs.gf import * from triqs.gf import *
from h5 import * from h5 import *
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
class Symmetry: class Symmetry:

View File

@ -1,8 +1,8 @@
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.converters import Wien2kConverter from triqs_dft_tools.converters import Wien2kConverter
from pytriqs.gf import * from triqs.gf import *
from h5 import * from h5 import *
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
import numpy import numpy
import copy import copy

View File

@ -1,8 +1,8 @@
from pytriqs.gf import * from triqs.gf import *
from triqs_dft_tools.sumk_dft import SumkDFT from triqs_dft_tools.sumk_dft import SumkDFT
from scipy.linalg import expm from scipy.linalg import expm
import numpy as np import numpy as np
from pytriqs.utility.comparison_tests import assert_gfs_are_close, assert_arrays_are_close, assert_block_gfs_are_close from triqs.utility.comparison_tests import assert_gfs_are_close, assert_arrays_are_close, assert_block_gfs_are_close
from h5 import * from h5 import *
import itertools import itertools

View File

@ -1,7 +1,7 @@
from pytriqs.gf import * from triqs.gf import *
from triqs_dft_tools.sumk_dft import SumkDFT from triqs_dft_tools.sumk_dft import SumkDFT
import numpy as np import numpy as np
from pytriqs.utility.comparison_tests import assert_block_gfs_are_close from triqs.utility.comparison_tests import assert_block_gfs_are_close
# here we test the SK.analyse_block_structure_from_gf function # here we test the SK.analyse_block_structure_from_gf function
# with GfReFreq, GfReTime # with GfReFreq, GfReTime

View File

@ -1,7 +1,7 @@
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
from pytriqs.gf import * from triqs.gf import *
from pytriqs.utility.comparison_tests import assert_block_gfs_are_close from triqs.utility.comparison_tests import assert_block_gfs_are_close
from triqs_dft_tools.block_structure import BlockStructure from triqs_dft_tools.block_structure import BlockStructure
SK = SumkDFT('blockstructure.in.h5',use_dft_blocks=True) SK = SumkDFT('blockstructure.in.h5',use_dft_blocks=True)

View File

@ -22,8 +22,8 @@
from h5 import * from h5 import *
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from triqs_dft_tools.converters import * from triqs_dft_tools.converters import *

View File

@ -5,7 +5,7 @@ Module defining a custom TestCase with extra functionality.
import unittest import unittest
import numpy as np import numpy as np
import difflib import difflib
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
class MyTestCase(unittest.TestCase): class MyTestCase(unittest.TestCase):
""" """

View File

@ -5,7 +5,7 @@ Module defining a custom TestCase with extra functionality.
import unittest import unittest
import numpy as np import numpy as np
import difflib import difflib
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
class MyTestCase(unittest.TestCase): class MyTestCase(unittest.TestCase):
""" """

View File

@ -20,10 +20,10 @@
################################################################################ ################################################################################
from h5 import * from h5 import *
from pytriqs.gf import * from triqs.gf import *
from pytriqs.gf.tools import * from triqs.gf.tools import *
from triqs_dft_tools.sumk_dft_tools import * from triqs_dft_tools.sumk_dft_tools import *
from pytriqs.utility.comparison_tests import * from triqs.utility.comparison_tests import *
import numpy as np import numpy as np
# Read self energy from hdf file # Read self energy from hdf file

View File

@ -20,12 +20,12 @@
################################################################################ ################################################################################
from h5 import * from h5 import *
from pytriqs.gf import * from triqs.gf import *
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.converters.wien2k_converter import * from triqs_dft_tools.converters.wien2k_converter import *
from pytriqs.operators.util import set_operator_structure from triqs.operators.util import set_operator_structure
from pytriqs.utility.comparison_tests import * from triqs.utility.comparison_tests import *
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
# Basic input parameters # Basic input parameters
beta = 40 beta = 40

View File

@ -23,8 +23,8 @@ from numpy import *
from triqs_dft_tools.converters.wien2k_converter import * from triqs_dft_tools.converters.wien2k_converter import *
from triqs_dft_tools.sumk_dft import * from triqs_dft_tools.sumk_dft import *
from triqs_dft_tools.sumk_dft_tools import * from triqs_dft_tools.sumk_dft_tools import *
from pytriqs.utility.comparison_tests import * from triqs.utility.comparison_tests import *
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
beta = 40 beta = 40

View File

@ -22,9 +22,9 @@
from h5 import * from h5 import *
from triqs_dft_tools.sumk_dft_tools import SumkDFTTools from triqs_dft_tools.sumk_dft_tools import SumkDFTTools
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from pytriqs.utility.comparison_tests import * from triqs.utility.comparison_tests import *
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
SK = SumkDFTTools(hdf_file = 'SrVO3.h5') SK = SumkDFTTools(hdf_file = 'SrVO3.h5')

View File

@ -23,8 +23,8 @@
from triqs_dft_tools.converters import * from triqs_dft_tools.converters import *
from h5 import * from h5 import *
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
Converter = Wannier90Converter(seedname='LaVO3-Pnma',hdf_filename='w90_convert.out.h5') Converter = Wannier90Converter(seedname='LaVO3-Pnma',hdf_filename='w90_convert.out.h5')

View File

@ -20,9 +20,9 @@
################################################################################ ################################################################################
from h5 import * from h5 import *
from pytriqs.utility.comparison_tests import * from triqs.utility.comparison_tests import *
from pytriqs.utility.h5diff import h5diff from triqs.utility.h5diff import h5diff
import pytriqs.utility.mpi as mpi import triqs.utility.mpi as mpi
from triqs_dft_tools.converters import Wien2kConverter from triqs_dft_tools.converters import Wien2kConverter