Skip to content

Commit

Permalink
Added 1e_socc to rasci_parser
Browse files Browse the repository at this point in the history
added RASCI-SOC example
  • Loading branch information
abelcarreras committed Feb 25, 2022
1 parent 50724d4 commit 60bf46c
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
86 changes: 86 additions & 0 deletions examples/soc_rasci.py
@@ -0,0 +1,86 @@
# Spin-orbit coupling calculation using TD-DFT and RASCI
from pyqchem.qchem_core import get_output_from_qchem
from pyqchem.qc_input import QchemInput
from pyqchem.structure import Structure
from pyqchem.parsers.parser_rasci import parser_rasci


molecule = Structure(coordinates=[[ 1.2452100000, 0.8399100000, 0.0000000000],
[ -0.0000000000, 0.0000000000, 0.0000000000],
[ -1.2452100000, 0.8399100000, -0.0000000000],
[ -0.0000000000, -0.6635500000, 0.8647500000],
[ 0.0000000000, -0.6635500000, -0.8647500000],
[ 1.6893340004, 1.1394772932, 0.9278761732],
[ 1.6893332483, 1.1394767859, -0.9278810935],
[ -1.1704700000, 1.9087200000, 0.0000000000],
[ -2.2082000000, 0.3702300000, 0.0000000000]],
symbols=['C', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H'],
charge=0,
multiplicity=3)


basis_name = 'cc-pVDZ'
qc_input_rasci = QchemInput(molecule,
jobtype='sp',
exchange='hf',
correlation='rasci',
unrestricted=False,
# thresh=14,
scf_convergence=8,
max_cis_cycles=100,
max_scf_cycles=100,
basis=basis_name,
ras_elec=6,
ras_act=5,
ras_occ=9,
ras_spin_mult=0,
ras_roots=4,
calc_soc=1,
n_frozen_core=0,
state_analysis=True,
set_iter=300,
)

output = get_output_from_qchem(qc_input_rasci,
processors=4,
force_recalculation=False,
parser=parser_rasci,
store_full_output=True,
)

# print calculation data
for i, state in enumerate(output['excited_states']):
print('Energy state {} ({}): {:18.12f} au'.format(i+1, state['multiplicity'], state['total_energy']))
print('Transition energy {:4.8} eV'.format(state['excitation_energy']))
print(' Alpha Beta Amplitude')
for j, conf in enumerate(state['configurations']):
try:
print(' {} {} {:8.3f}'.format(conf['origin'], conf['target'], conf['amplitude']))
except KeyError:
print(' {} {} {:8.3f}'.format(conf['alpha'], conf['beta'], conf['amplitude']))

n_states = len(output['excited_states'])

print('\n1-elec SOCC (cm-1) [states x states]')
print(' ' + ''.join(['{:^18}'.format(n) for n in range(1, n_states+1)]))
for i in range(1, n_states+1):
line = '{:3}'.format(i)
for j in range(1, n_states+1):
try:
line += '{:18.12f}'.format(output['interstate_properties'][(i, j)]['1e_socc'])
except KeyError:
line += ' - '
print(line)


print('\nmean-Field SOCC (cm-1) [states x states]')
print(' ' + ''.join(['{:^18}'.format(n) for n in range(1, n_states+1)]))
for i in range(1, n_states+1):
line = '{:3}'.format(i)
for j in range(1, n_states+1):
try:
line += '{:18.12f}'.format(output['interstate_properties'][(i, j)]['mf_socc'])
except KeyError:
line += ' - '
print(line)

1 change: 1 addition & 0 deletions pyqchem/parsers/parser_rasci.py
Expand Up @@ -285,6 +285,7 @@ def parser_rasci(output):
s_b = float(lines[i+1].split('=')[1].split()[0])
if '1-elec SOC matrix (cm-1)' in line:
pair_dict['1e_soc_mat'] = _read_soc_matrix(lines[i+1:], [int(2*s_b + 1), int(2*s_a+1)])
pair_dict['1e_socc'] = float(lines[i+2 + int(2*s_b + 1)].split()[-2:][0])
if '2e-SOMF Reduced matrix elements (cm-1)' in line:
r, c = lines[i+1].split()[-2:]
pair_dict['hso_l-'] = float(r) + float(c) * 1j
Expand Down

0 comments on commit 60bf46c

Please sign in to comment.