-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump_yaml.py
More file actions
66 lines (58 loc) · 2.17 KB
/
Copy pathdump_yaml.py
File metadata and controls
66 lines (58 loc) · 2.17 KB
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
# -*- coding: utf-8 -*-
import os
import yaml
from arguments import args
from SCF_calc import (n_occ, n_vir, reduced_occ, reduced_vir, ex_rest_occ, ex_rest_vir,
a_x, alpha, beta, basename,
kernel_t, A_size, ip_name, calc_name)
def fill_dictionary(dict, icost, pcost, wall_time, N_itr, N_mv,
initial_solution, final_solution, difference, overlap):
'''
information generated by the calculation
'''
dict['initial guess time'] = icost
dict['precondition time'] = pcost
dict['wall time'] = wall_time
dict['N_itr'] = N_itr
dict['N_mv'] = N_mv
dict['initial solution'] = initial_solution
dict['final solution'] = final_solution
dict['initial-final difference'] = difference
dict['initial-final overlap'] = overlap
return dict
def dump_yaml(dict, option):
i_name, p_name = ip_name[option]
print('Initia guess ', i_name)
print('Preconditioner', p_name)
if args.outfilename == '':
args.outfilename = 'i_' + i_name + '_p_' + p_name
'''
general information before the calculation starts
'''
dict['initial_guess'] = i_name
dict['preconditioner'] = p_name
dict['molecule'] = basename
dict['method'] = args.method
dict['functional'] = args.functional
dict['threshold'] = args.conv_tolerance
dict['SCF time'] = kernel_t
dict['sTDA_ax'] = a_x
dict['sTDA_alpha'] = alpha
dict['sTDA_beta'] = beta
dict['virtual truncation tol'] = args.truncate_virtual
dict['A matrix size'] = A_size
dict['n_occ'] = n_occ
dict['n_vir'] = n_vir
dict['reduced_occ'] = reduced_occ
dict['reduced_vir'] = reduced_vir
dict['ex_reduced_occ'] = ex_rest_occ
dict['ex_reduced_vir'] = ex_rest_vir
dict['N_states'] = args.nstates
dict['initial guess threshold'] = args.initial_TOL
dict['preconditioner threshold'] = args.precond_TOL
dict['dynamic polarizability wavelength'] = args.dpolar_omega
curpath = os.getcwd()
yamlpath = os.path.join(curpath,
basename + '_' + calc_name + '_' + args.outfilename + '.yaml')
with open(yamlpath, "w", encoding="utf-8") as f:
yaml.dump(dict, f)