示例#1
0
def h5get_hs_rotation_representation_N(imp,
                                       f_inp="init_ga_info.h5",
                                       f_log="glog.h5",
                                       valences=None):
    '''
    Calculate the Hilbert space rotation representation of each valence block
    of impurity imp in the hilbert_space_rotations.h5 file.
    '''

    f = h5py.File(f_inp, 'r')
    # 0-based in python
    Lie_Jeven_params = f["/impurity_" + str(imp - 1) + "/Lie_Jeven"][...]
    Lie_Jodd_params = f["/impurity_" + str(imp - 1) + "/Lie_Jodd"][...]
    f.close()

    f = h5py.File(f_log, 'r')
    op_dict = h5get_local_operators(imp, f, ["Jx", "Jy", "Jz"])

    rho_nrow = f["/Impurity_" + str(imp) + "/RHO.nrow"][0]
    # one-based to zero-based
    ID_N_block = f["/Impurity_" + str(imp) + "/Sec_ID"][...] - 1
    VAL_N_block = f["/Impurity_" + str(imp) + "/Sec_VAL"][...]
    f.close()
    VAL_N_block = [int(val + 0.5) for val in VAL_N_block]
    if valences is None:
        valences = VAL_N_block

    f = h5py.File("hilbert_space_rotations.h5", 'a')
    base = op_dict["Jx"].shape[0] - rho_nrow

    for i, val in enumerate(VAL_N_block):
        if ID_N_block[i + 1] - ID_N_block[i] <= 0:
            continue
        if val not in valences:
            continue
        Jx = op_dict["Jx"][base + ID_N_block[i]:base + ID_N_block[i + 1],
                           base + ID_N_block[i]:base + ID_N_block[i + 1]]
        Jy = op_dict["Jy"][base + ID_N_block[i]:base + ID_N_block[i + 1],
                           base + ID_N_block[i]:base + ID_N_block[i + 1]]
        Jz = op_dict["Jz"][base + ID_N_block[i]:base + ID_N_block[i + 1],
                           base + ID_N_block[i]:base + ID_N_block[i + 1]]
        if abs(np.mod(val, 2)) > 1.e-4:
            Rpr = get_representation([Jx, Jy, Jz], Lie_Jodd_params)
        else:
            Rpr = get_representation([Jx, Jy, Jz], Lie_Jeven_params)

        f["Impurity_{}/val_block={}/dim_rotations".format(imp, val)] = \
                len(Rpr)

        for j, _R in enumerate(Rpr):
            _R = csr_matrix(_R)
            write_csr_matrix(
                f, "Impurity_{}/val_block={}/rotation_{}".format(imp, val, j),
                _R)
    f.close()
示例#2
0
文件: gatom.py 项目: henhans/CyGutz
 def set_one_particle_rotation_list(self):
     '''Setup the rotation matrix in the single-particle basis
     '''
     import pyglib.symm.atom_symm as atsym
     if self.Lie_Jodd_list is not None:
         sp_rotations_list = []
         for J, lies in it.izip(self.jgenerator_list, self.Lie_Jodd_list):
             if self.iso == 1:
                 J_ = [J1[::2, ::2] for J1 in J]
             else:
                 J_ = J
             sp_rotations_ = atsym.get_representation(J_, lies)
             if self.iso == 1:
                 sp_rotations = []
                 for sp_r_ in sp_rotations_:
                     sp_r = np.zeros_like(J[0])
                     sp_r[::2, ::2] = sp_r_
                     sp_r[1::2, 1::2] = sp_r[::2, ::2]
                     sp_rotations.append(sp_r)
             else:
                 sp_rotations = sp_rotations_
             sp_rotations_list.append(sp_rotations)
         self.sp_rotations_list = sp_rotations_list
     else:
         self.sp_rotations_list = None
示例#3
0
def get_lrot_op(lvec, lie_jeven_params, l='d', ival='1'):
    '''get the 3d rotation matrix representations
    in the Hilbert space with valence of ival,
    given the single particle space representation of the l-angular momentum
    operators and lie parameters.
    '''
    lops = get_lvec_op(lvec, l=l, ival=ival)
    from pyglib.symm.atom_symm import get_representation
    reps = get_representation(lops, lie_jeven_params)
    return reps
示例#4
0
from __future__ import print_function
import h5py, numpy
from pyglib.symm.angular_momentum_1p import get_L_vector_CH
from pyglib.symm.atom_symm import get_representation, get_product_table
from pyglib.math.matrix_util import sym_array

# d complex spherical Harmonics
L = get_L_vector_CH(2)

# get Lie parameters and one-particle dm of FeO to test
with h5py.File('data_complex_spherical_harmonics.h5', 'r') as f:
    lie_params = f['/lie_even_params'][()]

# rotations
R_list = get_representation(L, lie_params)

# check product table
ptable = get_product_table(R_list)
print('ptable\n', ptable)

# from vasp, in real sph_harm basis
# convert to <Ylm | \rho | Ylm'>
nks = numpy.loadtxt('dm_ldau.txt').T

print('nks.real in real_sph_harm basis:')
for row in nks:
    print(('{:10.4f}' * len(row)).format(*row.real))

print('nks.imag in real_sph_harm basis:')
for row in nks:
    print(('{:10.4f}' * len(row)).format(*row.imag))