9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2025-02-16 05:34:04 +01:00

resolved merge conflicts

This commit is contained in:
Kevin Gasperich 2020-09-01 11:43:27 -05:00
commit e028e0dd11
168 changed files with 25777 additions and 1221 deletions

10
REPLACE
View File

@ -126,7 +126,6 @@ qp_name H_S2_u_0_bielec_nstates_openmp_work_3 -r H_S2_u_0_two_e_nstates_openmp_w
qp_name H_S2_u_0_bielec_nstates_openmp_work_4 -r H_S2_u_0_two_e_nstates_openmp_work_4
qp_name H_S2_u_0_bielec_nstates_openmp_work_$N_int
qp_name H_S2_u_0_bielec_nstates_openmp_work_$N_int -r "H_S2_u_0_two_e_nstates_openmp_work_$N_int"
qp_name H_S2_u_0_bielec_nstates_openmp_work_$N_int #-r "H_S2_u_0_two_e_nstates_openmp_work_$N_int"
qp_name H_S2_u_0_bielec_nstates_openmp_work -r H_S2_u_0_two_e_nstates_openmp_work
qp_name H_S2_u_0_bielec_nstates_openmp_work_ -r H_S2_u_0_two_e_nstates_openmp_work_
qp_name i_H_j_bielec -r i_H_j_two_e
@ -227,6 +226,7 @@ qp_name ref_bitmask_e_n_energy -r ref_bitmask_n_e_energy
qp_name read_ao_integrals_e_n -r read_ao_integrals_n_e
qp_name write_ao_integrals_e_n -r write_ao_integrals_n_e
qp_name psi_energy_bielec -r psi_energy_two_e
qp_name read_ao_integrals_e_n -r read_ao_integrals_n_e
qp_name read_ao_integrals --rename="read_ao_two_e_integrals"
qp_name read_ao_integrals --rename=read_ao_two_e_integrals
qp_name read_mo_integrals_erf -r read_mo_two_e_integrals_erf
@ -253,3 +253,11 @@ qp_name ezfio_set_mo_one_e_ints_mo_integrals_e_n -r ezfio_set_mo_one_e_ints_mo_i
qp_name ezfio_has_mo_one_e_ints_mo_integrals_e_n -r ezfio_has_mo_one_e_ints_mo_integrals_n_e
qp_name ezfio_has_mo_one_e_ints_io_mo_integrals_e_n -r ezfio_has_mo_one_e_ints_io_mo_integrals_n_e
qp_name ezfio_get_mo_one_e_ints_io_mo_integrals_e_n -r ezfio_get_mo_one_e_ints_io_mo_integrals_n_e
qp_name ao_ortho_canonical_coef_inv_complex -r ao_ortho_cano_coef_inv_cplx
qp_name fock_operator_closed_shell_ref_bitmask -r fock_op_cshell_ref_bitmask
qp_name fock_operator_closed_shell_ref_bitmask_complex -r fock_op_cshell_ref_bitmask_cplx
qp_name ao_ortho_canonical_coef_inv -r ao_ortho_cano_coef_inv
qp_name ao_ortho_cano_to_ao_complex -r ao_ortho_cano_to_ao_cplx
qp_name ao_ortho_lowdin_nucl_elec_integrals_complex -r ao_ortho_lowdin_n_e_ints_cplx
qp_name ao_ortho_canonical_nucl_elec_integrals_complex -r ao_ortho_cano_n_e_ints_cplx
qp_name ao_ortho_canonical_nucl_elec_integrals -r ao_ortho_cano_n_e_ints

548
bin/qp_convert_h5_to_ezfio Executable file
View File

@ -0,0 +1,548 @@
#!/usr/bin/env python3
"""
convert hdf5 output (e.g. from PySCF) to ezfio
Usage:
qp_convert_h5_to_ezfio [-o EZFIO_DIR] FILE
Options:
-o --output=EZFIO_DIR Produced directory
by default is FILE.ezfio
"""
from ezfio import ezfio
import h5py
import sys
import numpy as np
import os
from docopt import docopt
#fname = sys.argv[1]
#qph5name = sys.argv[2]
def get_full_path(file_path):
file_path = os.path.expanduser(file_path)
file_path = os.path.expandvars(file_path)
# file_path = os.path.abspath(file_path)
return file_path
def convert_mol(filename,qph5path):
ezfio.set_file(filename)
ezfio.set_nuclei_is_complex(False)
with h5py.File(qph5path,'r') as qph5:
nucl_num = qph5['nuclei'].attrs['nucl_num']
ao_num = qph5['ao_basis'].attrs['ao_num']
mo_num = qph5['mo_basis'].attrs['mo_num']
elec_alpha_num = qph5['electrons'].attrs['elec_alpha_num']
elec_beta_num = qph5['electrons'].attrs['elec_beta_num']
ezfio.set_nuclei_nucl_num(nucl_num)
ezfio.set_ao_basis_ao_num(ao_num)
ezfio.set_mo_basis_mo_num(mo_num)
ezfio.electrons_elec_alpha_num = elec_alpha_num
ezfio.electrons_elec_beta_num = elec_beta_num
##ao_num = mo_num
##Important !
#import math
#nelec_per_kpt = num_elec // n_kpts
#nelec_alpha_per_kpt = int(math.ceil(nelec_per_kpt / 2.))
#nelec_beta_per_kpt = int(math.floor(nelec_per_kpt / 2.))
#
#ezfio.electrons_elec_alpha_num = int(nelec_alpha_per_kpt * n_kpts)
#ezfio.electrons_elec_beta_num = int(nelec_beta_per_kpt * n_kpts)
#ezfio.electrons_elec_alpha_num = int(math.ceil(num_elec / 2.))
#ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.))
#ezfio.set_utils_num_kpts(n_kpts)
#ezfio.set_integrals_bielec_df_num(n_aux)
#(old)Important
#ezfio.set_nuclei_nucl_num(nucl_num)
#ezfio.set_nuclei_nucl_charge([0.]*nucl_num)
#ezfio.set_nuclei_nucl_coord( [ [0.], [0.], [0.] ]*nucl_num )
#ezfio.set_nuclei_nucl_label( ['He'] * nucl_num )
with h5py.File(qph5path,'r') as qph5:
nucl_charge=qph5['nuclei/nucl_charge'][()].tolist()
nucl_coord=qph5['nuclei/nucl_coord'][()].T.tolist()
nucl_label=qph5['nuclei/nucl_label'][()].tolist()
nuclear_repulsion = qph5['nuclei'].attrs['nuclear_repulsion']
ezfio.set_nuclei_nucl_charge(nucl_charge)
ezfio.set_nuclei_nucl_coord(nucl_coord)
if isinstance(nucl_label[0],bytes):
nucl_label = list(map(lambda x:x.decode(),nucl_label))
ezfio.set_nuclei_nucl_label(nucl_label)
ezfio.set_nuclei_io_nuclear_repulsion('Read')
ezfio.set_nuclei_nuclear_repulsion(nuclear_repulsion)
##########################################
# #
# Basis #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
do_pseudo = qph5['pseudo'].attrs['do_pseudo']
ezfio.set_pseudo_do_pseudo(do_pseudo)
if (do_pseudo):
ezfio.set_pseudo_pseudo_lmax(qph5['pseudo'].attrs['pseudo_lmax'])
ezfio.set_pseudo_pseudo_klocmax(qph5['pseudo'].attrs['pseudo_klocmax'])
ezfio.set_pseudo_pseudo_kmax(qph5['pseudo'].attrs['pseudo_kmax'])
ezfio.set_pseudo_nucl_charge_remove(qph5['pseudo/nucl_charge_remove'][()].tolist())
ezfio.set_pseudo_pseudo_n_k(qph5['pseudo/pseudo_n_k'][()].tolist())
ezfio.set_pseudo_pseudo_n_kl(qph5['pseudo/pseudo_n_kl'][()].tolist())
ezfio.set_pseudo_pseudo_v_k(qph5['pseudo/pseudo_v_k'][()].tolist())
ezfio.set_pseudo_pseudo_v_kl(qph5['pseudo/pseudo_v_kl'][()].tolist())
ezfio.set_pseudo_pseudo_dz_k(qph5['pseudo/pseudo_dz_k'][()].tolist())
ezfio.set_pseudo_pseudo_dz_kl(qph5['pseudo/pseudo_dz_kl'][()].tolist())
##########################################
# #
# Basis #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
#coeftmp = qph5['ao_basis/ao_coef'][()]
#expotmp = qph5['ao_basis/ao_expo'][()]
ezfio.set_ao_basis_ao_basis(qph5['ao_basis'].attrs['ao_basis'])
ezfio.set_ao_basis_ao_nucl(qph5['ao_basis/ao_nucl'][()].tolist())
ezfio.set_ao_basis_ao_prim_num(qph5['ao_basis/ao_prim_num'][()].tolist())
ezfio.set_ao_basis_ao_power(qph5['ao_basis/ao_power'][()].tolist())
ezfio.set_ao_basis_ao_coef(qph5['ao_basis/ao_coef'][()].tolist())
ezfio.set_ao_basis_ao_expo(qph5['ao_basis/ao_expo'][()].tolist())
##########################################
# #
# MO Coef #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
mo_coef = qph5['mo_basis/mo_coef'][()].tolist()
ezfio.set_mo_basis_mo_coef(mo_coef)
#maybe fix qp so we don't need this?
#ezfio.set_mo_basis_mo_coef([[i for i in range(mo_num)] * ao_num])
return
def convert_kpts(filename,qph5path):
ezfio.set_file(filename)
ezfio.set_nuclei_is_complex(True)
with h5py.File(qph5path,'r') as qph5:
kpt_num = qph5['nuclei'].attrs['kpt_num']
nucl_num = qph5['nuclei'].attrs['nucl_num']
ao_num = qph5['ao_basis'].attrs['ao_num']
mo_num = qph5['mo_basis'].attrs['mo_num']
elec_alpha_num = qph5['electrons'].attrs['elec_alpha_num']
elec_beta_num = qph5['electrons'].attrs['elec_beta_num']
ezfio.set_nuclei_kpt_num(kpt_num)
kpt_pair_num = (kpt_num*kpt_num + kpt_num)//2
ezfio.set_nuclei_kpt_pair_num(kpt_pair_num)
# don't multiply nuclei by kpt_num
# work in k-space, not in equivalent supercell
nucl_num_per_kpt = nucl_num
ezfio.set_nuclei_nucl_num(nucl_num_per_kpt)
# these are totals (kpt_num * num_per_kpt)
# need to change if we want to truncate orbital space within pyscf
ezfio.set_ao_basis_ao_num(ao_num)
ezfio.set_mo_basis_mo_num(mo_num)
ezfio.set_ao_basis_ao_num_per_kpt(ao_num//kpt_num)
ezfio.set_mo_basis_mo_num_per_kpt(mo_num//kpt_num)
ezfio.electrons_elec_alpha_num = elec_alpha_num
ezfio.electrons_elec_beta_num = elec_beta_num
##ao_num = mo_num
##Important !
#import math
#nelec_per_kpt = num_elec // n_kpts
#nelec_alpha_per_kpt = int(math.ceil(nelec_per_kpt / 2.))
#nelec_beta_per_kpt = int(math.floor(nelec_per_kpt / 2.))
#
#ezfio.electrons_elec_alpha_num = int(nelec_alpha_per_kpt * n_kpts)
#ezfio.electrons_elec_beta_num = int(nelec_beta_per_kpt * n_kpts)
#ezfio.electrons_elec_alpha_num = int(math.ceil(num_elec / 2.))
#ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.))
#ezfio.set_utils_num_kpts(n_kpts)
#ezfio.set_integrals_bielec_df_num(n_aux)
#(old)Important
#ezfio.set_nuclei_nucl_num(nucl_num)
#ezfio.set_nuclei_nucl_charge([0.]*nucl_num)
#ezfio.set_nuclei_nucl_coord( [ [0.], [0.], [0.] ]*nucl_num )
#ezfio.set_nuclei_nucl_label( ['He'] * nucl_num )
with h5py.File(qph5path,'r') as qph5:
nucl_charge=qph5['nuclei/nucl_charge'][()].tolist()
nucl_coord=qph5['nuclei/nucl_coord'][()].T.tolist()
nucl_label=qph5['nuclei/nucl_label'][()].tolist()
nuclear_repulsion = qph5['nuclei'].attrs['nuclear_repulsion']
ezfio.set_nuclei_nucl_charge(nucl_charge)
ezfio.set_nuclei_nucl_coord(nucl_coord)
if isinstance(nucl_label[0],bytes):
nucl_label = list(map(lambda x:x.decode(),nucl_label))
ezfio.set_nuclei_nucl_label(nucl_label)
ezfio.set_nuclei_io_nuclear_repulsion('Read')
ezfio.set_nuclei_nuclear_repulsion(nuclear_repulsion)
##########################################
# #
# Basis #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
ezfio.set_ao_basis_ao_basis(qph5['ao_basis'].attrs['ao_basis'])
ezfio.set_ao_basis_ao_nucl(qph5['ao_basis/ao_nucl'][()].tolist())
#Just need one (can clean this up later)
ao_prim_num_max = 5
d = [ [0] *ao_prim_num_max]*ao_num
ezfio.set_ao_basis_ao_prim_num([ao_prim_num_max]*ao_num)
ezfio.set_ao_basis_ao_power(d)
ezfio.set_ao_basis_ao_coef(d)
ezfio.set_ao_basis_ao_expo(d)
##########################################
# #
# MO Coef #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
mo_coef_kpts = qph5['mo_basis/mo_coef_kpts'][()].tolist()
mo_coef_cplx = qph5['mo_basis/mo_coef_complex'][()].tolist()
ezfio.set_mo_basis_mo_coef_kpts(mo_coef_kpts)
ezfio.set_mo_basis_mo_coef_complex(mo_coef_cplx)
#maybe fix qp so we don't need this?
#ezfio.set_mo_basis_mo_coef([[i for i in range(mo_num)] * ao_num])
##########################################
# #
# Integrals Mono #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
if 'ao_one_e_ints' in qph5.keys():
kin_ao_reim=qph5['ao_one_e_ints/ao_integrals_kinetic_kpts'][()].tolist()
ovlp_ao_reim=qph5['ao_one_e_ints/ao_integrals_overlap_kpts'][()].tolist()
ne_ao_reim=qph5['ao_one_e_ints/ao_integrals_n_e_kpts'][()].tolist()
ezfio.set_ao_one_e_ints_ao_integrals_kinetic_kpts(kin_ao_reim)
ezfio.set_ao_one_e_ints_ao_integrals_overlap_kpts(ovlp_ao_reim)
ezfio.set_ao_one_e_ints_ao_integrals_n_e_kpts(ne_ao_reim)
ezfio.set_ao_one_e_ints_io_ao_integrals_kinetic('Read')
ezfio.set_ao_one_e_ints_io_ao_integrals_overlap('Read')
ezfio.set_ao_one_e_ints_io_ao_integrals_n_e('Read')
with h5py.File(qph5path,'r') as qph5:
if 'mo_one_e_ints' in qph5.keys():
kin_mo_reim=qph5['mo_one_e_ints/mo_integrals_kinetic_kpts'][()].tolist()
ovlp_mo_reim=qph5['mo_one_e_ints/mo_integrals_overlap_kpts'][()].tolist()
ne_mo_reim=qph5['mo_one_e_ints/mo_integrals_n_e_kpts'][()].tolist()
ezfio.set_mo_one_e_ints_mo_integrals_kinetic_kpts(kin_mo_reim)
ezfio.set_mo_one_e_ints_mo_integrals_overlap_kpts(ovlp_mo_reim)
#ezfio.set_mo_one_e_ints_mo_integrals_n_e_complex(ne_mo_reim)
ezfio.set_mo_one_e_ints_mo_integrals_n_e_kpts(ne_mo_reim)
ezfio.set_mo_one_e_ints_io_mo_integrals_kinetic('Read')
ezfio.set_mo_one_e_ints_io_mo_integrals_overlap('Read')
#ezfio.set_mo_one_e_ints_io_mo_integrals_n_e('Read')
ezfio.set_mo_one_e_ints_io_mo_integrals_n_e('Read')
##########################################
# #
# k-points #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
kconserv = qph5['nuclei/kconserv'][()].tolist()
ezfio.set_nuclei_kconserv(kconserv)
ezfio.set_nuclei_io_kconserv('Read')
##########################################
# #
# Integrals Bi #
# #
##########################################
# should this be in ao_basis? ao_two_e_ints?
with h5py.File(qph5path,'r') as qph5:
if 'ao_two_e_ints' in qph5.keys():
df_num = qph5['ao_two_e_ints'].attrs['df_num']
ezfio.set_ao_two_e_ints_df_num(df_num)
if 'df_ao_integrals' in qph5['ao_two_e_ints'].keys():
# dfao_re0=qph5['ao_two_e_ints/df_ao_integrals_real'][()].transpose((3,2,1,0))
# dfao_im0=qph5['ao_two_e_ints/df_ao_integrals_imag'][()].transpose((3,2,1,0))
# dfao_cmplx0 = np.stack((dfao_re0,dfao_im0),axis=-1).tolist()
# ezfio.set_ao_two_e_ints_df_ao_integrals_complex(dfao_cmplx0)
dfao_reim=qph5['ao_two_e_ints/df_ao_integrals'][()].tolist()
ezfio.set_ao_two_e_ints_df_ao_integrals_complex(dfao_reim)
ezfio.set_ao_two_e_ints_io_df_ao_integrals('Read')
if 'mo_two_e_ints' in qph5.keys():
df_num = qph5['ao_two_e_ints'].attrs['df_num']
ezfio.set_ao_two_e_ints_df_num(df_num)
# dfmo_re0=qph5['mo_two_e_ints/df_mo_integrals_real'][()].transpose((3,2,1,0))
# dfmo_im0=qph5['mo_two_e_ints/df_mo_integrals_imag'][()].transpose((3,2,1,0))
# dfmo_cmplx0 = np.stack((dfmo_re0,dfmo_im0),axis=-1).tolist()
# ezfio.set_mo_two_e_ints_df_mo_integrals_complex(dfmo_cmplx0)
dfmo_reim=qph5['mo_two_e_ints/df_mo_integrals'][()].tolist()
ezfio.set_mo_two_e_ints_df_mo_integrals_complex(dfmo_reim)
ezfio.set_mo_two_e_ints_io_df_mo_integrals('Read')
return
def convert_cplx(filename,qph5path):
ezfio.set_file(filename)
ezfio.set_nuclei_is_complex(True)
with h5py.File(qph5path,'r') as qph5:
kpt_num = qph5['nuclei'].attrs['kpt_num']
nucl_num = qph5['nuclei'].attrs['nucl_num']
ao_num = qph5['ao_basis'].attrs['ao_num']
mo_num = qph5['mo_basis'].attrs['mo_num']
elec_alpha_num = qph5['electrons'].attrs['elec_alpha_num']
elec_beta_num = qph5['electrons'].attrs['elec_beta_num']
ezfio.set_nuclei_kpt_num(kpt_num)
kpt_pair_num = (kpt_num*kpt_num + kpt_num)//2
ezfio.set_nuclei_kpt_pair_num(kpt_pair_num)
# don't multiply nuclei by kpt_num
# work in k-space, not in equivalent supercell
nucl_num_per_kpt = nucl_num
ezfio.set_nuclei_nucl_num(nucl_num_per_kpt)
# these are totals (kpt_num * num_per_kpt)
# need to change if we want to truncate orbital space within pyscf
ezfio.set_ao_basis_ao_num(ao_num)
ezfio.set_mo_basis_mo_num(mo_num)
ezfio.electrons_elec_alpha_num = elec_alpha_num
ezfio.electrons_elec_beta_num = elec_beta_num
##ao_num = mo_num
##Important !
#import math
#nelec_per_kpt = num_elec // n_kpts
#nelec_alpha_per_kpt = int(math.ceil(nelec_per_kpt / 2.))
#nelec_beta_per_kpt = int(math.floor(nelec_per_kpt / 2.))
#
#ezfio.electrons_elec_alpha_num = int(nelec_alpha_per_kpt * n_kpts)
#ezfio.electrons_elec_beta_num = int(nelec_beta_per_kpt * n_kpts)
#ezfio.electrons_elec_alpha_num = int(math.ceil(num_elec / 2.))
#ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.))
#ezfio.set_utils_num_kpts(n_kpts)
#ezfio.set_integrals_bielec_df_num(n_aux)
#(old)Important
#ezfio.set_nuclei_nucl_num(nucl_num)
#ezfio.set_nuclei_nucl_charge([0.]*nucl_num)
#ezfio.set_nuclei_nucl_coord( [ [0.], [0.], [0.] ]*nucl_num )
#ezfio.set_nuclei_nucl_label( ['He'] * nucl_num )
with h5py.File(qph5path,'r') as qph5:
nucl_charge=qph5['nuclei/nucl_charge'][()].tolist()
nucl_coord=qph5['nuclei/nucl_coord'][()].T.tolist()
nucl_label=qph5['nuclei/nucl_label'][()].tolist()
nuclear_repulsion = qph5['nuclei'].attrs['nuclear_repulsion']
ezfio.set_nuclei_nucl_charge(nucl_charge)
ezfio.set_nuclei_nucl_coord(nucl_coord)
if isinstance(nucl_label[0],bytes):
nucl_label = list(map(lambda x:x.decode(),nucl_label))
ezfio.set_nuclei_nucl_label(nucl_label)
ezfio.set_nuclei_io_nuclear_repulsion('Read')
ezfio.set_nuclei_nuclear_repulsion(nuclear_repulsion)
##########################################
# #
# Basis #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
ezfio.set_ao_basis_ao_basis(qph5['ao_basis'].attrs['ao_basis'])
ezfio.set_ao_basis_ao_nucl(qph5['ao_basis/ao_nucl'][()].tolist())
#Just need one (can clean this up later)
ao_prim_num_max = 5
d = [ [0] *ao_prim_num_max]*ao_num
ezfio.set_ao_basis_ao_prim_num([ao_prim_num_max]*ao_num)
ezfio.set_ao_basis_ao_power(d)
ezfio.set_ao_basis_ao_coef(d)
ezfio.set_ao_basis_ao_expo(d)
##########################################
# #
# MO Coef #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
mo_coef_reim = qph5['mo_basis/mo_coef_complex'][()].tolist()
ezfio.set_mo_basis_mo_coef_complex(mo_coef_reim)
#maybe fix qp so we don't need this?
#ezfio.set_mo_basis_mo_coef([[i for i in range(mo_num)] * ao_num])
##########################################
# #
# Integrals Mono #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
if 'ao_one_e_ints' in qph5.keys():
kin_ao_reim=qph5['ao_one_e_ints/ao_integrals_kinetic'][()].tolist()
ovlp_ao_reim=qph5['ao_one_e_ints/ao_integrals_overlap'][()].tolist()
ne_ao_reim=qph5['ao_one_e_ints/ao_integrals_n_e'][()].tolist()
ezfio.set_ao_one_e_ints_ao_integrals_kinetic_complex(kin_ao_reim)
ezfio.set_ao_one_e_ints_ao_integrals_overlap_complex(ovlp_ao_reim)
ezfio.set_ao_one_e_ints_ao_integrals_n_e_complex(ne_ao_reim)
ezfio.set_ao_one_e_ints_io_ao_integrals_kinetic('Read')
ezfio.set_ao_one_e_ints_io_ao_integrals_overlap('Read')
ezfio.set_ao_one_e_ints_io_ao_integrals_n_e('Read')
with h5py.File(qph5path,'r') as qph5:
if 'mo_one_e_ints' in qph5.keys():
kin_mo_reim=qph5['mo_one_e_ints/mo_integrals_kinetic'][()].tolist()
#ovlp_mo_reim=qph5['mo_one_e_ints/mo_integrals_overlap'][()].tolist()
ne_mo_reim=qph5['mo_one_e_ints/mo_integrals_n_e'][()].tolist()
ezfio.set_mo_one_e_ints_mo_integrals_kinetic_complex(kin_mo_reim)
#ezfio.set_mo_one_e_ints_mo_integrals_overlap_complex(ovlp_mo_reim)
#ezfio.set_mo_one_e_ints_mo_integrals_n_e_complex(ne_mo_reim)
ezfio.set_mo_one_e_ints_mo_integrals_n_e_complex(ne_mo_reim)
ezfio.set_mo_one_e_ints_io_mo_integrals_kinetic('Read')
#ezfio.set_mo_one_e_ints_io_mo_integrals_overlap('Read')
#ezfio.set_mo_one_e_ints_io_mo_integrals_n_e('Read')
ezfio.set_mo_one_e_ints_io_mo_integrals_n_e('Read')
##########################################
# #
# k-points #
# #
##########################################
with h5py.File(qph5path,'r') as qph5:
kconserv = qph5['nuclei/kconserv'][()].tolist()
ezfio.set_nuclei_kconserv(kconserv)
ezfio.set_nuclei_io_kconserv('Read')
##########################################
# #
# Integrals Bi #
# #
##########################################
# should this be in ao_basis? ao_two_e_ints?
with h5py.File(qph5path,'r') as qph5:
if 'ao_two_e_ints' in qph5.keys():
df_num = qph5['ao_two_e_ints'].attrs['df_num']
ezfio.set_ao_two_e_ints_df_num(df_num)
if 'df_ao_integrals' in qph5['ao_two_e_ints'].keys():
# dfao_re0=qph5['ao_two_e_ints/df_ao_integrals_real'][()].transpose((3,2,1,0))
# dfao_im0=qph5['ao_two_e_ints/df_ao_integrals_imag'][()].transpose((3,2,1,0))
# dfao_cmplx0 = np.stack((dfao_re0,dfao_im0),axis=-1).tolist()
# ezfio.set_ao_two_e_ints_df_ao_integrals_complex(dfao_cmplx0)
dfao_reim=qph5['ao_two_e_ints/df_ao_integrals'][()].tolist()
ezfio.set_ao_two_e_ints_df_ao_integrals_complex(dfao_reim)
ezfio.set_ao_two_e_ints_io_df_ao_integrals('Read')
if 'mo_two_e_ints' in qph5.keys():
df_num = qph5['ao_two_e_ints'].attrs['df_num']
ezfio.set_ao_two_e_ints_df_num(df_num)
# dfmo_re0=qph5['mo_two_e_ints/df_mo_integrals_real'][()].transpose((3,2,1,0))
# dfmo_im0=qph5['mo_two_e_ints/df_mo_integrals_imag'][()].transpose((3,2,1,0))
# dfmo_cmplx0 = np.stack((dfmo_re0,dfmo_im0),axis=-1).tolist()
# ezfio.set_mo_two_e_ints_df_mo_integrals_complex(dfmo_cmplx0)
dfmo_reim=qph5['mo_two_e_ints/df_mo_integrals'][()].tolist()
ezfio.set_mo_two_e_ints_df_mo_integrals_complex(dfmo_reim)
ezfio.set_mo_two_e_ints_io_df_mo_integrals('Read')
return
if __name__ == '__main__':
ARGUMENTS = docopt(__doc__)
FILE = get_full_path(ARGUMENTS['FILE'])
if ARGUMENTS["--output"]:
EZFIO_FILE = get_full_path(ARGUMENTS["--output"])
else:
EZFIO_FILE = "{0}.ezfio".format(FILE)
with h5py.File(FILE,'r') as qph5:
do_kpts = ('kconserv' in qph5['nuclei'].keys())
if (do_kpts):
print("converting HDF5 to EZFIO for periodic system")
convert_kpts(EZFIO_FILE,FILE)
else:
print("converting HDF5 to EZFIO for molecular system")
convert_mol(EZFIO_FILE,FILE)
# sys.stdout.flush()
# if os.system("qp_run save_ortho_mos "+EZFIO_FILE) != 0:
# print("""Warning: You need to run
#
# qp run save_ortho_mos
#
#to be sure your MOs will be orthogonal, which is not the case when
#the MOs are read from output files (not enough precision in output).""")

View File

@ -89,6 +89,7 @@ def write_ezfio(res, filename):
# W r i t e #
# ~#~#~#~#~ #
ezfio.set_nuclei_is_complex(False)
ezfio.set_nuclei_nucl_num(len(res.geometry))
ezfio.set_nuclei_nucl_charge(charge)

1
configure vendored
View File

@ -365,7 +365,6 @@ EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file bse.tar.gz
pip install -e basis_set_exchange-*
EOF
elif [[ ${PACKAGE} = zlib ]] ; then
download ${ZLIB_URL} "${QP_ROOT}"/external/zlib.tar.gz

View File

@ -37,7 +37,9 @@ end = struct
} [@@deriving sexp]
;;
let get_default = Qpackage.get_ezfio_default "determinants";;
let get_default = Qpackage.get_ezfio_default "determinants"
let is_complex = lazy (Ezfio.get_nuclei_is_complex () )
let read_n_int () =
if not (Ezfio.has_determinants_n_int()) then
@ -48,12 +50,12 @@ end = struct
;
Ezfio.get_determinants_n_int ()
|> N_int_number.of_int
;;
let write_n_int n =
N_int_number.to_int n
|> Ezfio.set_determinants_n_int
;;
let read_bit_kind () =
@ -64,12 +66,12 @@ end = struct
;
Ezfio.get_determinants_bit_kind ()
|> Bit_kind.of_int
;;
let write_bit_kind b =
Bit_kind.to_int b
|> Ezfio.set_determinants_bit_kind
;;
let read_n_det () =
if not (Ezfio.has_determinants_n_det ()) then
@ -77,7 +79,7 @@ end = struct
;
Ezfio.get_determinants_n_det ()
|> Det_number.of_int
;;
let read_n_det_qp_edit () =
if not (Ezfio.has_determinants_n_det_qp_edit ()) then
@ -87,18 +89,18 @@ end = struct
end;
Ezfio.get_determinants_n_det_qp_edit ()
|> Det_number.of_int
;;
let write_n_det n =
Det_number.to_int n
|> Ezfio.set_determinants_n_det
;;
let write_n_det_qp_edit n =
let n_det = read_n_det () |> Det_number.to_int in
min n_det (Det_number.to_int n)
|> Ezfio.set_determinants_n_det_qp_edit
;;
let read_n_states () =
if not (Ezfio.has_determinants_n_states ()) then
@ -106,7 +108,7 @@ end = struct
;
Ezfio.get_determinants_n_states ()
|> States_number.of_int
;;
let write_n_states n =
let n_states =
@ -130,7 +132,7 @@ end = struct
Ezfio.ezfio_array_of_list ~rank:1 ~dim:[| n_states |] ~data
|> Ezfio.set_determinants_state_average_weight
end
;;
let write_state_average_weight data =
let n_states =
@ -143,7 +145,7 @@ end = struct
in
Ezfio.ezfio_array_of_list ~rank:1 ~dim:[| n_states |] ~data
|> Ezfio.set_determinants_state_average_weight
;;
let read_state_average_weight () =
let n_states =
@ -171,7 +173,7 @@ end = struct
|> Array.map Positive_float.of_float
in
(write_state_average_weight data; data)
;;
let read_expected_s2 () =
if not (Ezfio.has_determinants_expected_s2 ()) then
@ -186,12 +188,12 @@ end = struct
;
Ezfio.get_determinants_expected_s2 ()
|> Positive_float.of_float
;;
let write_expected_s2 s2 =
Positive_float.to_float s2
|> Ezfio.set_determinants_expected_s2
;;
let read_psi_coef ~read_only () =
if not (Ezfio.has_determinants_psi_coef ()) then
@ -200,19 +202,36 @@ end = struct
read_n_states ()
|> States_number.to_int
in
Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| 1 ; n_states |]
~data:(List.init n_states (fun i -> if (i=0) then 1. else 0. ))
(
if Lazy.force is_complex then
Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| 1 ; n_states |]
~data:(List.init (2*n_states) (fun i -> if (i=0) then 1. else 0. ))
|> Ezfio.set_determinants_psi_coef
else
Ezfio.ezfio_array_of_list ~rank:3 ~dim:[| 2 ; 1 ; n_states |]
~data:(List.init n_states (fun i -> if (i=0) then 1. else 0. ))
|> Ezfio.set_determinants_psi_coef_complex
)
end;
begin
if read_only then
Ezfio.get_determinants_psi_coef_qp_edit ()
begin
if Lazy.force is_complex then
Ezfio.get_determinants_psi_coef_complex_qp_edit ()
else
Ezfio.get_determinants_psi_coef_qp_edit ()
end
else
Ezfio.get_determinants_psi_coef ()
begin
if Lazy.force is_complex then
Ezfio.get_determinants_psi_coef_complex ()
else
Ezfio.get_determinants_psi_coef ()
end
end
|> Ezfio.flattened_ezfio
|> Array.map Det_coef.of_float
;;
let write_psi_coef ~n_det ~n_states c =
let n_det = Det_number.to_int n_det
@ -222,12 +241,23 @@ end = struct
and n_states =
States_number.to_int n_states
in
let r =
Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| n_det ; n_states |] ~data:c
in
Ezfio.set_determinants_psi_coef r;
Ezfio.set_determinants_psi_coef_qp_edit r
;;
if Lazy.force is_complex then
begin
let r =
Ezfio.ezfio_array_of_list ~rank:3 ~dim:[| 2 ; n_det ; n_states |] ~data:c
in
Ezfio.set_determinants_psi_coef_complex r;
Ezfio.set_determinants_psi_coef_complex_qp_edit r
end
else
begin
let r =
Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| n_det ; n_states |] ~data:c
in
Ezfio.set_determinants_psi_coef r;
Ezfio.set_determinants_psi_coef_qp_edit r
end
let read_psi_det ~read_only () =
@ -276,7 +306,7 @@ end = struct
|> Array.map (Determinant.of_int64_array
~n_int:(N_int_number.of_int n_int)
~alpha:n_alpha ~beta:n_beta )
;;
let write_psi_det ~n_int ~n_det d =
let data = Array.to_list d
@ -288,7 +318,7 @@ end = struct
in
Ezfio.set_determinants_psi_det r;
Ezfio.set_determinants_psi_det_qp_edit r
;;
let read ?(full=true) () =
@ -316,7 +346,7 @@ end = struct
else
(* No molecular orbitals, so no determinants *)
None
;;
let write ?(force=false)
{ n_int ;
@ -341,7 +371,7 @@ end = struct
write_psi_det ~n_int:n_int ~n_det:n_det psi_det
end;
write_state_average_weight state_average_weight
;;
let to_rst b =
@ -557,10 +587,8 @@ psi_det = %s
in
Generic_input_of_rst.evaluate_sexp t_of_sexp s
;;
let update_ndet n_det_new =
Printf.printf "Reducing n_det to %d\n" (Det_number.to_int n_det_new);
@ -596,7 +624,7 @@ psi_det = %s
{ det with n_det = (Det_number.of_int n_det_new) }
in
write ~force:true new_det
;;
let extract_state istate =
Printf.printf "Extracting state %d\n" (States_number.to_int istate);
@ -628,7 +656,7 @@ psi_det = %s
{ det with n_states = (States_number.of_int 1) }
in
write ~force:true new_det
;;
let extract_states range =
Printf.printf "Extracting states %s\n" (Range.to_string range);
@ -673,7 +701,7 @@ psi_det = %s
{ det with n_states = (States_number.of_int @@ List.length sorted_list) }
in
write ~force:true new_det
;;
end

View File

@ -2,7 +2,6 @@ open Qptypes
open Qputils
open Sexplib.Std
module Mo_basis : sig
type t =
{ mo_num : MO_number.t ;
@ -10,7 +9,6 @@ module Mo_basis : sig
mo_class : MO_class.t array;
mo_occ : MO_occ.t array;
mo_coef : (MO_coef.t array) array;
mo_coef_imag : (MO_coef.t array) array option;
ao_md5 : MD5.t;
} [@@deriving sexp]
val read : unit -> t option
@ -25,11 +23,13 @@ end = struct
mo_class : MO_class.t array;
mo_occ : MO_occ.t array;
mo_coef : (MO_coef.t array) array;
mo_coef_imag : (MO_coef.t array) array option;
ao_md5 : MD5.t;
} [@@deriving sexp]
let get_default = Qpackage.get_ezfio_default "mo_basis"
let is_complex = lazy (Ezfio.get_nuclei_is_complex () )
let read_mo_label () =
if not (Ezfio.has_mo_basis_mo_label ()) then
Ezfio.set_mo_basis_mo_label "None"
@ -43,14 +43,7 @@ end = struct
mo_coef = Array.map (fun mo ->
Array.init (Array.length mo)
(fun i -> mo.(ordering.(i)))
) b.mo_coef ;
mo_coef_imag =
match b.mo_coef_imag with
| None -> None
| Some x -> Some ( Array.map (fun mo ->
Array.init (Array.length mo)
(fun i -> mo.(ordering.(i)))
) x )
) b.mo_coef
}
let read_ao_md5 () =
@ -69,7 +62,10 @@ end = struct
|> MD5.of_string
in
if (ao_md5 <> result) then
failwith "The current MOs don't correspond to the current AOs.";
begin
Printf.eprintf ":%s:\n:%s:\n%!" (MD5.to_string ao_md5) (MD5.to_string result);
failwith "The current MOs don't correspond to the current AOs."
end;
result
@ -77,7 +73,7 @@ end = struct
let elec_alpha_num =
Ezfio.get_electrons_elec_alpha_num ()
in
let result =
let result =
Ezfio.get_mo_basis_mo_num ()
in
if result < elec_alpha_num then
@ -120,29 +116,21 @@ end = struct
let read_mo_coef () =
let a = Ezfio.get_mo_basis_mo_coef ()
|> Ezfio.flattened_ezfio
|> Array.map MO_coef.of_float
let a =
(
if Lazy.force is_complex then
Ezfio.get_mo_basis_mo_coef_complex ()
else
Ezfio.get_mo_basis_mo_coef ()
)
|> Ezfio.flattened_ezfio
|> Array.map MO_coef.of_float
in
let mo_num = read_mo_num () |> MO_number.to_int in
let ao_num = (Array.length a)/mo_num in
Array.init mo_num (fun j ->
Array.sub a (j*ao_num) (ao_num)
)
let read_mo_coef_imag () =
if Ezfio.has_mo_basis_mo_coef_imag () then
let a =
Ezfio.get_mo_basis_mo_coef_imag ()
|> Ezfio.flattened_ezfio
|> Array.map MO_coef.of_float
in
let mo_num = read_mo_num () |> MO_number.to_int in
let ao_num = (Array.length a)/mo_num in
Some (Array.init mo_num (fun j ->
Array.sub a (j*ao_num) (ao_num)
) )
else None
Array.init mo_num (fun j ->
Array.sub a (j*ao_num) (ao_num)
)
let read () =
@ -153,7 +141,6 @@ end = struct
mo_class = read_mo_class ();
mo_occ = read_mo_occ ();
mo_coef = read_mo_coef ();
mo_coef_imag = read_mo_coef_imag ();
ao_md5 = read_ao_md5 ();
}
else
@ -161,7 +148,6 @@ end = struct
let mo_coef_to_string mo_coef =
(*TODO : add imaginary part here *)
let ao_num = Array.length mo_coef.(0)
and mo_num = Array.length mo_coef in
let rec print_five imin imax =
@ -247,7 +233,6 @@ MO coefficients ::
let to_string b =
(*TODO : add imaginary part here *)
Printf.sprintf "
mo_label = \"%s\"
mo_num = %s
@ -262,7 +247,7 @@ mo_coef = %s
(b.mo_occ |> Array.to_list |> list_map
(MO_occ.to_string) |> String.concat ", " )
(b.mo_coef |> Array.map
(fun x-> Array.map MO_coef.to_string x |>
(fun x-> Array.map MO_coef.to_string x |>
Array.to_list |> String.concat "," ) |>
Array.to_list |> String.concat "\n" )
@ -300,40 +285,30 @@ mo_coef = %s
let write_mo_coef a =
let mo_num = Array.length a in
let ao_num = Array.length a.(0) in
let ao_num =
let x = Array.length a.(0) in
if Lazy.force is_complex then x/2 else x
in
let data =
Array.map (fun mo -> Array.map MO_coef.to_float mo
|> Array.to_list) a
|> Array.to_list
|> List.concat
in Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| ao_num ; mo_num |] ~data
|> Ezfio.set_mo_basis_mo_coef
in
if Lazy.force is_complex then
(Ezfio.ezfio_array_of_list ~rank:3 ~dim:[| 2 ; ao_num ; mo_num |] ~data
|> Ezfio.set_mo_basis_mo_coef_complex )
else
(Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| ao_num ; mo_num |] ~data
|> Ezfio.set_mo_basis_mo_coef )
let write_mo_coef_imag a =
match a with
| None -> ()
| Some a ->
begin
let mo_num = Array.length a in
let ao_num = Array.length a.(0) in
let data =
Array.map (fun mo -> Array.map MO_coef.to_float mo
|> Array.to_list) a
|> Array.to_list
|> List.concat
in Ezfio.ezfio_array_of_list ~rank:2 ~dim:[| ao_num ; mo_num |] ~data
|> Ezfio.set_mo_basis_mo_coef_imag
end
let write
let write
{ mo_num : MO_number.t ;
mo_label : MO_label.t;
mo_class : MO_class.t array;
mo_occ : MO_occ.t array;
mo_coef : (MO_coef.t array) array;
mo_coef_imag : (MO_coef.t array) array option;
ao_md5 : MD5.t;
} =
write_mo_num mo_num;
@ -341,7 +316,6 @@ mo_coef = %s
write_mo_class mo_class;
write_mo_occ mo_occ;
write_mo_coef mo_coef;
write_mo_coef_imag mo_coef_imag;
write_md5 ao_md5

View File

@ -166,6 +166,7 @@ let input_ezfio = "
let untouched = "
module MO_guess : sig
type t [@@deriving sexp]
val to_string : t -> string

View File

@ -130,9 +130,15 @@ class H_apply(object):
!$OMP END PARALLEL
call dsort(H_jj,iorder,N_det)
do k=1,N_states
psi_coef(iorder(k),k) = 1.d0
enddo
if (is_complex) then
do k=1,N_states
psi_coef_complex(iorder(k),k) = (1.d0,0.d0)
enddo
else
do k=1,N_states
psi_coef(iorder(k),k) = 1.d0
enddo
endif
deallocate(H_jj,iorder)
"""
@ -141,7 +147,11 @@ class H_apply(object):
if (s2_eig) then
call make_s2_eigenfunction
endif
SOFT_TOUCH psi_det psi_coef N_det
if (is_complex) then
SOFT_TOUCH psi_det psi_coef_complex N_det
else
SOFT_TOUCH psi_det psi_coef N_det
endif
"""
s["printout_now"] = """write(6,*) &
100.*float(i_generator)/float(N_det_generators), '% in ', wall_1-wall_0, 's'"""

View File

@ -67,3 +67,8 @@ doc: Use normalized primitive functions
interface: ezfio, provider
default: true
[ao_num_per_kpt]
type: integer
doc: Max number of |AOs| per kpt
interface: ezfio, provider

View File

@ -0,0 +1,23 @@
!BEGIN_PROVIDER [ integer, ao_num_per_kpt ]
! implicit none
! BEGIN_DOC
! ! number of aos per kpt.
! END_DOC
! ao_num_per_kpt = ao_num/kpt_num
!END_PROVIDER
subroutine get_kpt_idx_ao(idx_full,k,i)
implicit none
BEGIN_DOC
! idx_full is ao index in full range (up to ao_num)
! k is index of the k-point for this ao
! i is index of this ao within k-point k
! this assumes that all kpts have the same number of aos
END_DOC
integer, intent(in) :: idx_full
integer, intent(out) :: i,k
i = mod(idx_full-1,ao_num_per_kpt)+1
k = (idx_full-1)/ao_num_per_kpt+1
ASSERT (k <= kpt_num)
end

View File

@ -4,10 +4,16 @@ doc: Nucleus-electron integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_integrals_n_e_imag]
[ao_integrals_n_e_complex]
type: double precision
doc: Imaginary part of the nucleus-electron integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
doc: Complex nucleus-electron integrals in |AO| basis set
size: (2,ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_integrals_n_e_kpts]
type: double precision
doc: Complex nucleus-electron integrals in |AO| basis set
size: (2,ao_basis.ao_num_per_kpt,ao_basis.ao_num_per_kpt,nuclei.kpt_num)
interface: ezfio
[io_ao_integrals_n_e]
@ -23,10 +29,16 @@ doc: Kinetic energy integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_integrals_kinetic_imag]
[ao_integrals_kinetic_complex]
type: double precision
doc: Imaginary part of the kinetic energy integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
doc: Complex kinetic energy integrals in |AO| basis set
size: (2,ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_integrals_kinetic_kpts]
type: double precision
doc: Complex kinetic energy integrals in |AO| basis set
size: (2,ao_basis.ao_num_per_kpt,ao_basis.ao_num_per_kpt,nuclei.kpt_num)
interface: ezfio
[io_ao_integrals_kinetic]
@ -42,10 +54,16 @@ doc: Pseudopotential integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_integrals_pseudo_imag]
[ao_integrals_pseudo_complex]
type: double precision
doc: Imaginary part of the pseudopotential integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
doc: Complex pseudopotential integrals in |AO| basis set
size: (2,ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_integrals_pseudo_kpts]
type: double precision
doc: Complex pseudopotential integrals in |AO| basis set
size: (2,ao_basis.ao_num_per_kpt,ao_basis.ao_num_per_kpt,nuclei.kpt_num)
interface: ezfio
[io_ao_integrals_pseudo]
@ -61,10 +79,16 @@ doc: Overlap integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_integrals_overlap_imag]
[ao_integrals_overlap_complex]
type: double precision
doc: Imaginary part of the overlap integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
doc: Complex overlap integrals in |AO| basis set
size: (2,ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_integrals_overlap_kpts]
type: double precision
doc: Complex overlap integrals in |AO| basis set
size: (2,ao_basis.ao_num_per_kpt,ao_basis.ao_num_per_kpt,nuclei.kpt_num)
interface: ezfio
[io_ao_integrals_overlap]
@ -80,10 +104,16 @@ doc: Combined integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_one_e_integrals_imag]
[ao_one_e_integrals_complex]
type: double precision
doc: Imaginary part of the combined integrals in |AO| basis set
size: (ao_basis.ao_num,ao_basis.ao_num)
doc: Complex combined integrals in |AO| basis set
size: (2,ao_basis.ao_num,ao_basis.ao_num)
interface: ezfio
[ao_one_e_integrals_kpts]
type: double precision
doc: Complex combined integrals in |AO| basis set
size: (2,ao_basis.ao_num_per_kpt,ao_basis.ao_num_per_kpt,nuclei.kpt_num)
interface: ezfio
[io_ao_one_e_integrals]

View File

@ -5,7 +5,10 @@
BEGIN_DOC
! One-electron Hamiltonian in the |AO| basis.
END_DOC
if (is_complex) then
print*,"you shouldn't be here for complex",irp_here
stop -1
endif
IF (read_ao_one_e_integrals) THEN
call ezfio_get_ao_one_e_ints_ao_one_e_integrals(ao_one_e_integrals)
ELSE
@ -24,24 +27,85 @@
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_one_e_integrals_imag,(ao_num,ao_num)]
!BEGIN_PROVIDER [ double precision, ao_one_e_integrals_imag,(ao_num,ao_num)]
! implicit none
! integer :: i,j,n,l
! BEGIN_DOC
! ! One-electron Hamiltonian in the |AO| basis.
! END_DOC
!
! IF (read_ao_one_e_integrals) THEN
! call ezfio_get_ao_one_e_ints_ao_one_e_integrals_imag(ao_one_e_integrals_imag)
! ELSE
! ao_one_e_integrals_imag = ao_integrals_n_e_imag + ao_kinetic_integrals_imag
!
! IF (DO_PSEUDO) THEN
! ao_one_e_integrals_imag += ao_pseudo_integrals_imag
! ENDIF
! ENDIF
!
! IF (write_ao_one_e_integrals) THEN
! call ezfio_set_ao_one_e_ints_ao_one_e_integrals_imag(ao_one_e_integrals_imag)
! print *, 'AO one-e integrals written to disk'
! ENDIF
!
!END_PROVIDER
BEGIN_PROVIDER [ complex*16, ao_one_e_integrals_complex,(ao_num,ao_num)]
&BEGIN_PROVIDER [ double precision, ao_one_e_integrals_diag_complex,(ao_num)]
implicit none
integer :: i,j,n,l
BEGIN_DOC
! One-electron Hamiltonian in the |AO| basis.
END_DOC
IF (read_ao_one_e_integrals) THEN
call ezfio_get_ao_one_e_ints_ao_one_e_integrals(ao_one_e_integrals_imag)
call ezfio_get_ao_one_e_ints_ao_one_e_integrals_complex(ao_one_e_integrals_complex)
ELSE
print *, irp_here, ': Not yet implemented'
stop -1
ao_one_e_integrals_complex = ao_integrals_n_e_complex + ao_kinetic_integrals_complex
IF (DO_PSEUDO) THEN
ao_one_e_integrals_complex += ao_pseudo_integrals_complex
ENDIF
ENDIF
DO j = 1, ao_num
ao_one_e_integrals_diag_complex(j) = dble(ao_one_e_integrals_complex(j,j))
ENDDO
IF (write_ao_one_e_integrals) THEN
call ezfio_set_ao_one_e_ints_ao_one_e_integrals(ao_one_e_integrals_imag)
call ezfio_set_ao_one_e_ints_ao_one_e_integrals_complex(ao_one_e_integrals_complex)
print *, 'AO one-e integrals written to disk'
ENDIF
END_PROVIDER
BEGIN_PROVIDER [ complex*16, ao_one_e_integrals_kpts,(ao_num_per_kpt,ao_num_per_kpt,kpt_num)]
&BEGIN_PROVIDER [ double precision, ao_one_e_integrals_diag_kpts,(ao_num_per_kpt,kpt_num)]
implicit none
integer :: j,k
BEGIN_DOC
! One-electron Hamiltonian in the |AO| basis.
END_DOC
if (read_ao_one_e_integrals) then
call ezfio_get_ao_one_e_ints_ao_one_e_integrals_kpts(ao_one_e_integrals_kpts)
else
ao_one_e_integrals_kpts = ao_integrals_n_e_kpts + ao_kinetic_integrals_kpts
if (do_pseudo) then
ao_one_e_integrals_kpts += ao_pseudo_integrals_kpts
endif
endif
do k = 1, kpt_num
do j = 1, ao_num_per_kpt
ao_one_e_integrals_diag_kpts(j,k) = dble(ao_one_e_integrals_kpts(j,j,k))
enddo
enddo
if (write_ao_one_e_integrals) then
call ezfio_set_ao_one_e_ints_ao_one_e_integrals_kpts(ao_one_e_integrals_kpts)
print *, 'AO one-e integrals written to disk'
endif
END_PROVIDER

View File

@ -84,13 +84,13 @@ END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_ortho_canonical_coef_inv, (ao_num,ao_num)]
BEGIN_PROVIDER [ double precision, ao_ortho_cano_coef_inv, (ao_num,ao_num)]
implicit none
BEGIN_DOC
! ao_ortho_canonical_coef^(-1)
END_DOC
call get_inverse(ao_ortho_canonical_coef,size(ao_ortho_canonical_coef,1),&
ao_num, ao_ortho_canonical_coef_inv, size(ao_ortho_canonical_coef_inv,1))
ao_num, ao_ortho_cano_coef_inv, size(ao_ortho_cano_coef_inv,1))
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_ortho_canonical_coef, (ao_num,ao_num)]

View File

@ -0,0 +1,121 @@
!todo: add kpts
BEGIN_PROVIDER [ complex*16, ao_cart_to_sphe_coef_complex, (ao_num,ao_cart_to_sphe_num) ]
implicit none
BEGIN_DOC
! complex version of ao_cart_to_sphe_coef
END_DOC
call zlacp2('A',ao_num,ao_cart_to_sphe_num, &
ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), &
ao_cart_to_sphe_coef_complex,size(ao_cart_to_sphe_coef_complex,1))
END_PROVIDER
BEGIN_PROVIDER [ complex*16, ao_cart_to_sphe_overlap_complex, (ao_cart_to_sphe_num,ao_cart_to_sphe_num) ]
implicit none
BEGIN_DOC
! AO overlap matrix in the spherical basis set
END_DOC
complex*16, allocatable :: S(:,:)
allocate (S(ao_cart_to_sphe_num,ao_num))
call zgemm('T','N',ao_cart_to_sphe_num,ao_num,ao_num, (1.d0,0.d0), &
ao_cart_to_sphe_coef_complex,size(ao_cart_to_sphe_coef_complex,1), &
ao_overlap_complex,size(ao_overlap_complex,1), (0.d0,0.d0), &
S, size(S,1))
call zgemm('N','N',ao_cart_to_sphe_num,ao_cart_to_sphe_num,ao_num, (1.d0,0.d0), &
S, size(S,1), &
ao_cart_to_sphe_coef_complex,size(ao_cart_to_sphe_coef_complex,1), (0.d0,0.d0), &
ao_cart_to_sphe_overlap_complex,size(ao_cart_to_sphe_overlap_complex,1))
deallocate(S)
END_PROVIDER
BEGIN_PROVIDER [ complex*16, ao_ortho_cano_coef_inv_cplx, (ao_num,ao_num)]
implicit none
BEGIN_DOC
! ao_ortho_canonical_coef_complex^(-1)
END_DOC
call get_inverse_complex(ao_ortho_canonical_coef_complex,size(ao_ortho_canonical_coef_complex,1),&
ao_num, ao_ortho_cano_coef_inv_cplx, size(ao_ortho_cano_coef_inv_cplx,1))
END_PROVIDER
BEGIN_PROVIDER [ complex*16, ao_ortho_canonical_coef_complex, (ao_num,ao_num)]
&BEGIN_PROVIDER [ integer, ao_ortho_canonical_num_complex ]
implicit none
BEGIN_DOC
! TODO: ao_ortho_canonical_num_complex should be the same as the real version
! maybe if the providers weren't linked we could avoid making a complex one?
! matrix of the coefficients of the mos generated by the
! orthonormalization by the S^{-1/2} canonical transformation of the aos
! ao_ortho_canonical_coef(i,j) = coefficient of the ith ao on the jth ao_ortho_canonical orbital
END_DOC
integer :: i
ao_ortho_canonical_coef_complex = (0.d0,0.d0)
do i=1,ao_num
ao_ortho_canonical_coef_complex(i,i) = (1.d0,0.d0)
enddo
!call ortho_lowdin(ao_overlap,size(ao_overlap,1),ao_num,ao_ortho_canonical_coef,size(ao_ortho_canonical_coef,1),ao_num)
!ao_ortho_canonical_num=ao_num
!return
if (ao_cartesian) then