3
0
mirror of https://github.com/triqs/dft_tools synced 2024-07-04 18:36:05 +02:00

Allow for hdf filename that differs from dft data basename

This commit is contained in:
Priyanka Seth 2014-11-19 16:38:52 +01:00
parent 88f4105e5b
commit 84bd1ed655
3 changed files with 15 additions and 17 deletions

View File

@ -32,14 +32,14 @@ class HkConverter(ConverterTools):
Conversion from general H(k) file to an hdf5 file that can be used as input for the SumKDFT class.
"""
def __init__(self, hk_file, hdf_file, dft_subgrp = 'dft_input', symmcorr_subgrp = 'dft_symmcorr_input', repacking = False):
def __init__(self, hk_filename, hdf_filename, dft_subgrp = 'dft_input', symmcorr_subgrp = 'dft_symmcorr_input', repacking = False):
"""
Init of the class.
"""
assert type(hk_file)==StringType,"hk_file must be a filename"
self.hdf_file = hdf_file
self.dft_file = hk_file
assert type(hk_filename)==StringType,"HkConverter: hk_filename must be a filename."
self.hdf_file = hdf_filename
self.dft_file = hk_filename
self.dft_subgrp = dft_subgrp
self.symmcorr_subgrp = symmcorr_subgrp
self.fortran_to_replace = {'D':'E', '(':' ', ')':' ', ',':' '}
@ -152,8 +152,8 @@ class HkConverter(ConverterTools):
for isp in range(n_spin_blocs):
for ik in xrange(n_k) :
no = n_orbitals[ik,isp]
# IF TRUE, FIRST READ ALL REAL COMPONENTS OF ONE kPOINT, OTHERWISE TUPLE OF real,im
if (first_real_part_matrix):
if (first_real_part_matrix): # first read all real components for given k, then read imaginary parts
for i in xrange(no):
if (only_upper_triangle):
@ -172,7 +172,7 @@ class HkConverter(ConverterTools):
hopping[ik,isp,i,j] += R.next() * 1j
if ((only_upper_triangle)and(i!=j)): hopping[ik,isp,j,i] = hopping[ik,isp,i,j].conjugate()
else:
else: # read (real,im) tuple
for i in xrange(no):
if (only_upper_triangle):

View File

@ -31,7 +31,8 @@ class Wien2kConverter(ConverterTools):
Conversion from Wien2k output to an hdf5 file that can be used as input for the SumkDFT class.
"""
def __init__(self, filename, dft_subgrp = 'dft_input', symmcorr_subgrp = 'dft_symmcorr_input',
def __init__(self, filename, hdf_filename = None,
dft_subgrp = 'dft_input', symmcorr_subgrp = 'dft_symmcorr_input',
parproj_subgrp='dft_parproj_input', symmpar_subgrp='dft_symmpar_input',
bands_subgrp = 'dft_bands_input', repacking = False):
"""
@ -39,7 +40,8 @@ class Wien2kConverter(ConverterTools):
"""
assert type(filename)==StringType, "Please provide the DFT files' base name as a string."
self.hdf_file = filename+'.h5'
if hdf_filename is None: hdf_filename = filename
self.hdf_file = hdf_filename+'.h5'
self.dft_file = filename+'.ctqmcout'
self.symmcorr_file = filename+'.symqmc'
self.parproj_file = filename+'.parproj'
@ -58,7 +60,6 @@ class Wien2kConverter(ConverterTools):
ConverterTools.__repack(self)
def convert_dmft_input(self):
"""
Reads the input files, and stores the data in the HDFfile
@ -332,9 +333,7 @@ class Wien2kConverter(ConverterTools):
# Initialise P, here a double list of matrices:
proj_mat_pc = numpy.zeros([n_k,self.n_spin_blocs,self.n_shells,max(n_parproj),max(numpy.array(self.shells)[:,3]),max(n_orbitals)],numpy.complex_)
for ish in range(self.n_shells):
for ik in xrange(n_k):
for ir in range(n_parproj[ish]):
for isp in range(self.n_spin_blocs):
@ -362,7 +361,6 @@ class Wien2kConverter(ConverterTools):
del ar
def convert_symmetry_input(self, orbits, symm_file, symm_subgrp, SO, SP):
"""
Reads input for the symmetrisations from symm_file, which is case.sympar or case.symqmc.

View File

@ -24,6 +24,6 @@
from pytriqs.applications.dft.converters import *
from pytriqs.archive import *
Converter = HkConverter(hk_file='hk_convert_hamiltonian.hk',hdf_file='hk_convert.output.h5')
Converter = HkConverter(hk_filename='hk_convert_hamiltonian.hk',hdf_filename='hk_convert.output.h5')
Converter.convert_dmft_input()