wavefunction_analysis.utils package

Submodules

wavefunction_analysis.utils.cg_coeffs module

clebsch_gordan_coeff_direct(j1, m1, j2, m2, j3, m3, sqrt=False)[source]

j3 is in {|j_1 - j_2|, dots, j_1 + j_2} m3 = m_1 + m_2 in {-J, -J+1, dots, J-1, J}

clebsch_gordan_coeff_recur(j1, m1, j2, m2)[source]

j3 is in {|j_1 - j_2|, dots, j_1 + j_2} m3 = m_1 + m_2 in {-J, -J+1, dots, J-1, J}

ladder_coeff(j, m, operator)[source]

j could be 0, pm 1/2, pm 1, pm 3/2, pm 2, etc m is in {-j, -j+1, dots, j-1, j} C_pm = sqrt(j (j + 1) - m (m pm 1)) = sqrt((j mp m) (j pm m + 1)) j`_pm |jm> = C_pm |j(mpm1)>`

print_cg_coeff(j1=0, m1=0, j2=0, m2=0, j3=0, m3=0, cg=0, header=False, ic=0)[source]

wavefunction_analysis.utils.chiral_geom module

run_gtensor(symbols, coords, charge=1, spin=1, functional='hf', basis='3-21g')[source]
spin_square_biortho(mf)[source]
swap_atoms_coords(coords, atoms_idx)[source]

change two atoms a, b positions from the center atom c

wavefunction_analysis.utils.fdiff module

change_matrix_phase_c(matrix0, matrix1)[source]
change_matrix_phase_rc(matrix0, matrix1)[source]
change_number_phase(num0, num1)[source]
change_wf_phase(C0, X0, Y0, C1, X1, Y1)[source]
class fdiff(norder=2, step_size=0.001, unit=1.0)[source]

Bases: object

property coeff
compute(fx, unit=1.0)[source]
get_d(ndim, idx)[source]
get_x(x0, idx)[source]

wavefunction_analysis.utils.get_cx module

wavefunction_analysis.utils.monitor_performance module

monitor_performance(func)[source]

decorator for monitoring memory of CPU (GPU) and timing of wall, CPU (GPU). use only as @monitor_performance above function definitions.

set_performance_log(debug=True, filename=None)[source]

turn on/off performance monitoring and optionally change the output destination for performance logs. - debug = True/False: enable/disable performance monitoring - filename = none: set log to stdout (default)

wavefunction_analysis.utils.ortho_basis module

get_ortho_basis(S, method='lowdin', eigen=False)[source]

S is symmetric overlap matrix of atomic basis L = S^(1/2) Z = S^(-1/2) S = L * L^T S^-1 = Z^T * Z inv = S^(-1)

get_ortho_basis_deriv(S, dS, method='lowdin', l_or_z='L', solver='iter')[source]

wavefunction_analysis.utils.print_matrix module

print_matrix(keyword, matrix, nwidth=6, nind=0, digits=[13, 8, 'f'], trans=False, dtype=<class 'float'>)[source]

wavefunction_analysis.utils.pyscf_parser module

build_atom(atmsym, coords)[source]
build_molecule(atom, basis, charge=0, spin=0, unit='angstrom', max_memory=60000, verbose=0)[source]
convert_string(string)[source]
final_print_energy(td, title='tddft', nwidth=6, iprint=0)[source]
find_oscillator_strength(td, nroots, nfrag=1)[source]
find_transition_dipole(td, nroots, nfrag=1)[source]
get_basis_info(mol)[source]
get_center_of_mass(mol, nfrag=1)[source]
get_frgm_idx(parameters)[source]
get_jobtype(parameters)[source]
get_photon_info(photon_key)[source]
get_rem_info(rem_keys)[source]
justify_photon_info(td, nroots, nstate='max_dipole', func='average', nwidth=10)[source]
parser(file_name)[source]
read_keyword_block(data)[source]
read_molecule(data)[source]
run_pyscf_dft(charge, spin, atom, basis, functional, nfrag=1, verbose=0, h=None, scf_method='RKS')[source]
run_pyscf_dft_tddft(charge, spin, atom, basis, functional, td_model, nroots, nfrag=1, verbose=0, debug=0, h=None, scf_method='RKS')[source]
run_pyscf_final(parameters)[source]
run_pyscf_tddft(mf, td_model, nroots, nfrag=1, verbose=0)[source]
run_pyscf_tdqed(mf, td, qed_model, cavity_model, key, nfrag=1)[source]

wavefunction_analysis.utils.read_files module

istype(data, dtype=<class 'float'>)[source]
read_array(filename, keyword=None, nline=0, ncol=4, nrange=[0, 4], dtype=<class 'float'>, same=True)[source]
read_matrix(filename, nrow, ncol, keyword, nwidth=6, nind=0, nskip=0, dtype=<class 'float'>)[source]
read_number(filename, keyword, n=-1, o=1, dtype=<class 'int'>)[source]

o takes 1 or -1 for the reading order when n>=0 when n == -1: o takes the begin and end indices ftype can be int, float, or simply string

read_time(filename)[source]

wavefunction_analysis.utils.sec_mole module

align_principal_axes(charges, coords)[source]
cal_dihedral_angle(vectors)[source]
get_center_property(weights, props, itype='charge', isotope_avg=True)[source]
get_charge_or_mass(symbols, itype='charge', isotope_avg=True)[source]
get_molecular_center(weights, coords, itype='charge', isotope_avg=True)[source]
get_moment_of_inertia(weights, coords, fix_sign=False)[source]

make sure to use coordinates in bohr

get_rotation_matrix(theta, axis='x')[source]

[cos -sin] [sin cos]

get_symbols_coords(geometry, string=False)[source]
read_geometries_standard(infile, screen='User input: 2 of 2')[source]
read_geometry(infile, probe=1)[source]
read_symbols_coords(infile, probe=1)[source]
rotate_molecule(coords0, axis, theta)[source]
standard_orientation(symbols, coords, tol=4)[source]
standard_orientation2(symbols, coords, var, tol=4)[source]

we need the intermediate translation and principal matrices

switch_atoms(geometry, atom_list)[source]
translate_molecule(symbols, coords, origin=None, itype='charge', isotope_avg=True)[source]
write_geometry(infile, geometry, energy=None, open_file_method='w')[source]
write_mol_info(infile, charge='0', multiplicity='1', open_file_method='w', itype=0)[source]

itype: 0 normal job; 1 second job; 2 fragment

write_mol_info_geometry(infile, charge='0', multiplicity='1', frgm=False, **kwargs)[source]
write_rem_info(infile, method='pbe0', basis='6-31g', open_file_method='a+')[source]
write_symbols_coords(infile, symbols, coords, energy=None, open_file_method='w')[source]

wavefunction_analysis.utils.sec_rem module

put_keys_kwargs_to_object(obj, key={}, **kwargs)[source]

put the individual keys in the dictionary first then use dictionary to assign the obj class attributes

put_keys_to_kwargs(key, **kwargs)[source]

put the values in key dict to kwargs dict

put_keys_to_object(obj, key)[source]

put all the keywords and values into the obj class

put_kwargs_to_keys(key={}, **kwargs)[source]

put all the individual keyword and value into the key dictionary

put_kwargs_to_object(obj, **kwargs)[source]

put all the keywords and values into the obj class

wavefunction_analysis.utils.unit_conversion module

convert_different_units(value, prop, index)[source]
convert_other_property(value, unit0='au')[source]
convert_property_to_energy(value, prop, index)[source]
convert_same_units(value, prop, index)[source]
convert_units(value, unit0='au', unit1='fs')[source]
default_unit_index(prop)[source]
find_properties(unit0='au', unit1='fs')[source]

wavefunction_analysis.utils.utils module

ishermitian(keyword, matrix, digits=[2, 13, 8, 'f'], debug=0)[source]
random_matrix(n=10, mean=0.0, width=0.1, func='uniform', sym=True, diag=True)[source]
swap_largest_to_diagonal(matrix)[source]

wavefunction_analysis.utils.wf_overlap module

assemble_amplitudes(xys, nocc, nroots=None, rpa=False, itype='r')[source]
cal_wf_overlap(Xm, Ym, Xn, Yn, Cm, Cn, S, itype='r')[source]
cal_wf_overlap_r(Xm, Ym, Xn, Yn, Cm, Cn, S)[source]
cal_wf_overlap_r0(Xm, Ym, Xn, Yn, Cm, Cn, S)[source]
cal_wf_overlap_sf(Xm, Ym, Xn, Yn, Cm, Cn, S, extype=0)[source]
cal_wf_overlap_u(Xm, Ym, Xn, Yn, Cm, Cn, S)[source]
change_phase(x0, y0, x1, y1, mo0, mo1, ovlp)[source]
sign_fixing(mat)[source]

refer Zhou, Subotnik JCTC 2020, 10.1021/acs.jctc.9b00952

Module contents