-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsplit_rasci.py
96 lines (78 loc) · 3.43 KB
/
split_rasci.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# splitting the calculation in Optimization + Reference + 2 x Post HF (RASCI)
from pyqchem import get_output_from_qchem, QchemInput
from pyqchem.parsers.parser_optimization import basic_optimization
from pyqchem.parsers.parser_rasci import parser_rasci
from pyqchem.structure import Structure
def print_formatted_data(parsed_data):
for i, state in enumerate(parsed_data['excited_states']):
print('\n - State {} -'.format(i + 1))
if i > 0:
print('Transition DM: ', state['transition_moment'])
print('Excitation energy: {:5.2f} eV'.format(state['excitation_energy']))
print(' Alpha Beta Amplitude')
for j, conf in enumerate(state['configurations']):
print(' {:^5} {:^4} {:8.3f}'.format(conf['alpha'], conf['beta'], conf['amplitude']))
# define molecule (H2O)
molecule = Structure(coordinates=[[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
[0.0, 0.0, -1.0]],
symbols=['O', 'H', 'H'],
charge=0,
multiplicity=1)
print('Initial structure')
print(molecule)
# optimize geometry
qc_input = QchemInput(molecule,
jobtype='opt',
exchange='hf',
basis='sto-3g',
geom_opt_tol_gradient=300,
geom_opt_tol_energy=100,
geom_opt_coords=-1,
geom_opt_tol_displacement=1200)
parsed_data = get_output_from_qchem(qc_input,
processors=4,
parser=basic_optimization)
opt_molecule = parsed_data['optimized_molecule']
print('Optimized structure')
print(opt_molecule)
# Compute the HF reference
qc_input = QchemInput(opt_molecule,
jobtype='sp',
exchange='hf',
basis='sto-3g',
)
data_ref, ee_reference = get_output_from_qchem(qc_input,
processors=4,
return_electronic_structure=True)
# Compute post HF (RASCI) skipping SCF
qc_input = QchemInput(opt_molecule,
jobtype='sp',
exchange='hf',
correlation='rasci',
max_scf_cycles=0,
basis=ee_reference['basis'],
scf_guess=ee_reference['coefficients'],
ras_roots=3,
ras_elec=2,
ras_act=2)
parsed_data = get_output_from_qchem(qc_input,
parser=parser_rasci,
processors=4)
print('\nRASCI states (Active space 1)\n' + '-'*31)
print_formatted_data(parsed_data)
qc_input = QchemInput(opt_molecule,
jobtype='sp',
exchange='hf',
correlation='rasci',
max_scf_cycles=0,
basis=ee_reference['basis'],
scf_guess=ee_reference['coefficients'],
ras_roots=3,
ras_elec=2,
ras_act=3)
parsed_data = get_output_from_qchem(qc_input,
parser=parser_rasci,
processors=4)
print('\nRASCI states (Active space 2)\n' + '-'*31)
print_formatted_data(parsed_data)