pyctramer 0.2.6__tar.gz → 0.2.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyctramer-0.2.6 → pyctramer-0.2.9}/PKG-INFO +9 -3
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/AnalyzeQC.py +3 -4
- pyctramer-0.2.9/pyctramer/BuildMSH.py +203 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/ConstructFF.py +1 -1
- pyctramer-0.2.9/pyctramer/IMT.py +553 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/JobControl.py +137 -12
- pyctramer-0.2.9/pyctramer/MarcusAA.py +600 -0
- pyctramer-0.2.9/pyctramer/OmegaTuning.py +345 -0
- pyctramer-0.2.9/pyctramer/PyCTRAMER.py +73 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/RunMD.py +130 -2
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/SpinBoson.py +5 -2
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/SubmitQC.py +6 -3
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/Utilities.py +87 -2
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/pyctramer.py +2 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer.egg-info/PKG-INFO +9 -3
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer.egg-info/SOURCES.txt +4 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/setup.py +2 -2
- pyctramer-0.2.6/pyctramer/MarcusAA.py +0 -324
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/FGR.py +0 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer/__init__.py +0 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer.egg-info/dependency_links.txt +0 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/pyctramer.egg-info/top_level.txt +0 -0
- {pyctramer-0.2.6 → pyctramer-0.2.9}/setup.cfg +0 -0
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pyctramer
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: Python package for Charge Transfer Rate from Atomistic Molecular dynamics, Electronic structure, and Rate theory
|
|
5
5
|
Home-page: https://www.github.com/ctramer/PyCTRAMER
|
|
6
6
|
Author: Zengkui Liu, Dominikus Brian, and Xiang Sun
|
|
7
|
-
Author-email:
|
|
7
|
+
Author-email: zs2945@nyu.edu
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
+
Dynamic: author
|
|
10
|
+
Dynamic: author-email
|
|
11
|
+
Dynamic: description
|
|
12
|
+
Dynamic: description-content-type
|
|
13
|
+
Dynamic: home-page
|
|
14
|
+
Dynamic: summary
|
|
9
15
|
|
|
10
16
|
Python package for Charge Transfer Rate from Atomistic Molecular dynamics, Electronic structure, and Rate theory
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from .Utilities import *
|
|
1
|
+
from .Utilities import *
|
|
2
2
|
import os
|
|
3
|
-
import numpy as np
|
|
3
|
+
import numpy as np
|
|
4
4
|
|
|
5
5
|
def run_step2(i, job_control, dict_of_simulation):
|
|
6
|
-
#print(arrow_str,"Started Step 2: AnalyzeQC")
|
|
7
6
|
project = dict_of_simulation['project']
|
|
8
7
|
work_dir = dict_of_simulation['work_dir']
|
|
9
8
|
caseid = job_control[i]['caseid']
|
|
@@ -94,7 +93,7 @@ def analyzeQC(template_dir,running_dir,QC_method,basis_set,testing_str,D_range,B
|
|
|
94
93
|
sed_inplace(submitQC_file,"omega=","omega=114514")
|
|
95
94
|
# sed_inplace(submitQC_file,"OMEGA", "!OMEGA")
|
|
96
95
|
else:
|
|
97
|
-
sed_inplace(submitQC_file,"omega=","omega="+RSH_omega)
|
|
96
|
+
sed_inplace(submitQC_file,"omega=","omega="+str(RSH_omega))
|
|
98
97
|
|
|
99
98
|
if TD_approx == "TDA":
|
|
100
99
|
TD_approx = "True"
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import math
|
|
2
|
+
import numpy as np
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
import matplotlib
|
|
6
|
+
import matplotlib.pyplot as plt
|
|
7
|
+
from matplotlib import ticker
|
|
8
|
+
import matplotlib.ticker as plticker
|
|
9
|
+
|
|
10
|
+
import os, glob, sys, io, contextlib, time
|
|
11
|
+
from .Utilities import *
|
|
12
|
+
|
|
13
|
+
kT2au = 3.16681156e-6
|
|
14
|
+
ps2au = 41341.373335
|
|
15
|
+
au2s = 4.1341374575751E+16
|
|
16
|
+
kcal2ev = 0.0433641043
|
|
17
|
+
kcal2au = 0.00159360144
|
|
18
|
+
au2eV = 27.211386246
|
|
19
|
+
cm2au = 4.55633525e-6
|
|
20
|
+
|
|
21
|
+
class _DualWriter:
|
|
22
|
+
def __init__(self, *streams):
|
|
23
|
+
self.streams = streams
|
|
24
|
+
def write(self, data):
|
|
25
|
+
for s in self.streams:
|
|
26
|
+
s.write(data)
|
|
27
|
+
s.flush()
|
|
28
|
+
def flush(self):
|
|
29
|
+
for s in self.streams:
|
|
30
|
+
s.flush()
|
|
31
|
+
|
|
32
|
+
def MSH(i, job_control, dict_of_simulation, job_info):
|
|
33
|
+
job_index = i
|
|
34
|
+
work_dir = dict_of_simulation['work_dir']
|
|
35
|
+
propagate_state = dict_of_simulation['MD_traj_state']
|
|
36
|
+
project = dict_of_simulation['project']
|
|
37
|
+
caseid = dict_of_simulation['caseid']
|
|
38
|
+
case_dir = work_dir + '/' + project + "_" + caseid
|
|
39
|
+
qc_dir, md_dir = get_folder_path(case_dir)
|
|
40
|
+
MD_dyn_state = dict_of_simulation['MD_traj_state']
|
|
41
|
+
temp = float(dict_of_simulation['MD_temperature'])
|
|
42
|
+
traj_dir = md_dir + '/Traj_' + MD_dyn_state + '/'
|
|
43
|
+
kT = temp * kT2au
|
|
44
|
+
state_set = set()
|
|
45
|
+
state_ordered = []
|
|
46
|
+
for info in job_info:
|
|
47
|
+
for state_name in info['State_list']:
|
|
48
|
+
if state_name not in state_set:
|
|
49
|
+
state_ordered.append(state_name)
|
|
50
|
+
state_set.add(state_name)
|
|
51
|
+
|
|
52
|
+
state_list_str = "'" + ' '.join(state_ordered) + "'"
|
|
53
|
+
states_of_interests = state_ordered.copy()
|
|
54
|
+
#states_of_interests = ['LE', 'CT1', 'CT2', 'GR']
|
|
55
|
+
N_states = len(states_of_interests)
|
|
56
|
+
N_subspace = N_states - 1
|
|
57
|
+
N_transition_pair = round((N_states - 1) * N_states / 2)
|
|
58
|
+
ene_trajs = []
|
|
59
|
+
max_iter_SBM = 1000
|
|
60
|
+
tol_w_SBM = 1e-8
|
|
61
|
+
DFT_DT = 5e-3 * ps2au #
|
|
62
|
+
|
|
63
|
+
# read-in energy trajectories in eV unit
|
|
64
|
+
for ind, state in enumerate(states_of_interests):
|
|
65
|
+
file = traj_dir + project + '_' + caseid + "_Ecorrected_" + state + "_TRAJ_" + propagate_state + "_NVE.dat"
|
|
66
|
+
ene_trajs.append(np.loadtxt(file))
|
|
67
|
+
|
|
68
|
+
sbm_files = sorted(glob.glob(os.path.join(work_dir, "SBMLECT*.dat")))
|
|
69
|
+
if not sbm_files:
|
|
70
|
+
raise FileNotFoundError(f"Can't {work_dir} SBMLECT*.dat")
|
|
71
|
+
|
|
72
|
+
for sbm_file in sbm_files:
|
|
73
|
+
print('file name:'+ sbm_file)
|
|
74
|
+
sbmparam = np.loadtxt(sbm_file)
|
|
75
|
+
spin_boson_mode = np.shape(sbmparam)[0]
|
|
76
|
+
w_sb = sbmparam[:, 1]
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
_buf = io.StringIO()
|
|
81
|
+
_dual = _DualWriter(sys.stdout, _buf)
|
|
82
|
+
|
|
83
|
+
with contextlib.redirect_stdout(_dual):
|
|
84
|
+
# calculate Er among pairs
|
|
85
|
+
## calculate theta
|
|
86
|
+
Ers = []
|
|
87
|
+
for f in range(2, N_states + 1):
|
|
88
|
+
ene_state_i = ene_trajs[f - 1]
|
|
89
|
+
for j in range(1, f):
|
|
90
|
+
ene_state_j = ene_trajs[j - 1]
|
|
91
|
+
gap_ij = (ene_state_i - ene_state_j) / au2eV
|
|
92
|
+
# print(np.average(gap_ij))
|
|
93
|
+
Er_ij = np.std(gap_ij) ** 2 * 0.5 / kT
|
|
94
|
+
Ers.append(Er_ij * au2eV)
|
|
95
|
+
print('Er between', states_of_interests[f - 1], 'and', states_of_interests[j - 1], '=', Er_ij * au2eV, 'eV')
|
|
96
|
+
|
|
97
|
+
# calculate poly-hydron in N_subspace subspaces
|
|
98
|
+
a = np.sqrt(2. / spin_boson_mode) / w_sb
|
|
99
|
+
|
|
100
|
+
theta_count = (N_states - 1) * (N_states - 2) / 2
|
|
101
|
+
cos_theta = []
|
|
102
|
+
sin_theta = []
|
|
103
|
+
if (theta_count) > 0:
|
|
104
|
+
# doing nothing
|
|
105
|
+
theta_count = round(theta_count)
|
|
106
|
+
else:
|
|
107
|
+
print('ERROR: You are asking for a spin-boson model, Multi-State Harmonic (MSH) model reduces to SBM in a two-state case.')
|
|
108
|
+
|
|
109
|
+
for k in np.arange(3, N_states + 1, 1):
|
|
110
|
+
# print(k)
|
|
111
|
+
for j in np.arange(2, k):
|
|
112
|
+
Er_index_1j = round((j - 1) * (j - 2) / 2 + 1 - 1)
|
|
113
|
+
Er_index_1k = round((k - 1) * (k - 2) / 2 + 1 - 1)
|
|
114
|
+
Er_index_jk = round((k - 1) * (k - 2) / 2 + j - 1)
|
|
115
|
+
theta_jk = round((k - 2) * (k - 3) / 2 + j - 2)
|
|
116
|
+
print(Er_index_1j, Er_index_1k, Er_index_jk, 'stateindex', j, k, states_of_interests[j - 1], states_of_interests[k - 1])
|
|
117
|
+
cos_thetaa = 0.5 * (abs(Ers[Er_index_1j]) + abs(Ers[Er_index_1k]) - abs(Ers[Er_index_jk])) / np.sqrt(abs(Ers[Er_index_1j]) * abs(Ers[Er_index_1k]))
|
|
118
|
+
sin_thetaa = np.sqrt(1 - cos_thetaa * cos_thetaa)
|
|
119
|
+
|
|
120
|
+
thetaa = np.arccos(np.clip(cos_thetaa, -1.0, 1.0)) / np.pi * 180.
|
|
121
|
+
print('cos(theta) between state', states_of_interests[j - 1], 'and', states_of_interests[k - 1], "is", cos_thetaa, 'corresponding to theta=', thetaa, 'degree')
|
|
122
|
+
cos_theta.append(cos_thetaa)
|
|
123
|
+
sin_theta.append(sin_thetaa)
|
|
124
|
+
|
|
125
|
+
## calculate theta_prime
|
|
126
|
+
theta_prime_count = (N_states - 2) * (N_states - 3) / 2
|
|
127
|
+
cos_theta_prime = []
|
|
128
|
+
sin_theta_prime = []
|
|
129
|
+
theta_prime_count = round(theta_prime_count)
|
|
130
|
+
for k in np.arange(4, N_states + 1):
|
|
131
|
+
for j in np.arange(3, k):
|
|
132
|
+
numerator = 0
|
|
133
|
+
denumerator = 1
|
|
134
|
+
theta_2j = round((j - 2) * (j - 3) / 2 + 2 - 2)
|
|
135
|
+
theta_2k = round((k - 2) * (k - 3) / 2 + 2 - 2)
|
|
136
|
+
theta_jk = round((k - 2) * (k - 3) / 2 + j - 2)
|
|
137
|
+
denumerator = sin_theta[theta_2j] * sin_theta[theta_2k]
|
|
138
|
+
numerator = cos_theta[theta_jk] - cos_theta[theta_2j] * cos_theta[theta_2k]
|
|
139
|
+
# print(numerator,denumerator)
|
|
140
|
+
temp_sum = 0
|
|
141
|
+
for f in range(3, j):
|
|
142
|
+
temp_prod = 1.
|
|
143
|
+
for l in range(3, f + 1):
|
|
144
|
+
theta_prime_lj = round((j - 3) * (j - 4) / 2 + l - 3)
|
|
145
|
+
theta_prime_lj = round((j - 3) * (j - 4) / 2 + l - 3)
|
|
146
|
+
if (l == f):
|
|
147
|
+
temp_prod *= cos_theta_prime[theta_prime_lj] * cos_theta_prime[theta_prime_lk]
|
|
148
|
+
else:
|
|
149
|
+
temp_prod *= sin_theta_prime[theta_prime_lj] * sin_theta_prime[theta_prime_lk]
|
|
150
|
+
temp_sum += temp_prod
|
|
151
|
+
numerator -= sin_theta[theta_2j] * sin_theta[theta_2k] * temp_sum
|
|
152
|
+
theta_prime_jk = round((k - 3) * (k - 4) / 2 + j - 3)
|
|
153
|
+
# print(theta_prime_jk)
|
|
154
|
+
cos_theta_primee = numerator / (denumerator if abs(denumerator) > 1e-16 else 1e-16)
|
|
155
|
+
cos_theta_primee = np.clip(cos_theta_primee, -1.0, 1.0)
|
|
156
|
+
sin_theta_primee = np.sqrt(1. - cos_theta_primee * cos_theta_primee)
|
|
157
|
+
cos_theta_prime.append(cos_theta_primee)
|
|
158
|
+
sin_theta_prime.append(sin_theta_primee)
|
|
159
|
+
theta_primee = np.arccos(cos_theta_primee) / np.pi * 180.
|
|
160
|
+
print(cos_theta_prime[theta_prime_jk], sin_theta_prime[theta_prime_jk])
|
|
161
|
+
print("cos'(theta)jk", j, k, cos_theta_primee, "corresponding to theta'=", theta_primee, 'degree')
|
|
162
|
+
# cos_theta_prime[theta_prime_jk] = numerator / denumerator
|
|
163
|
+
|
|
164
|
+
## calculate geometry of the Er
|
|
165
|
+
positions = []
|
|
166
|
+
Sxy = []
|
|
167
|
+
print('Er shape in space / a.u.')
|
|
168
|
+
for y in range(2, N_states + 1):
|
|
169
|
+
for x in range(1, y):
|
|
170
|
+
factor = 1.
|
|
171
|
+
if (y > 2):
|
|
172
|
+
theta_2y = round((y - 2) * (y - 3) / 2 + 2 - 2)
|
|
173
|
+
if (x == 1):
|
|
174
|
+
factor *= cos_theta[theta_2y]
|
|
175
|
+
else:
|
|
176
|
+
factor *= sin_theta[theta_2y]
|
|
177
|
+
for f in range(3, x + 1):
|
|
178
|
+
theta_prime_iy = round((y - 3) * (y - 4) / 2 + f - 3)
|
|
179
|
+
factor *= sin_theta_prime[theta_prime_iy]
|
|
180
|
+
if (x > 1 and x < y - 1):
|
|
181
|
+
theta_prime_x1y = round((y - 3) * (y - 4) / 2 + x + 1 - 3)
|
|
182
|
+
factor *= cos_theta_prime[theta_prime_x1y]
|
|
183
|
+
S_xy = round((y - 1) * (y - 2) / 2 + x - 1)
|
|
184
|
+
# print(S_xy,'Sxy')
|
|
185
|
+
Er_1y = round((y - 1) * (y - 2) / 2 + 1 - 1)
|
|
186
|
+
position = (np.sqrt(Ers[Er_1y] / au2eV) * factor)
|
|
187
|
+
positions.append(position)
|
|
188
|
+
Sxy.append(a * position)
|
|
189
|
+
print(position, end=',')
|
|
190
|
+
print('')
|
|
191
|
+
|
|
192
|
+
### calculate Req
|
|
193
|
+
req = np.zeros((N_subspace * N_states, spin_boson_mode))
|
|
194
|
+
for y in range(2, N_states + 1):
|
|
195
|
+
for x in range(1, y):
|
|
196
|
+
S_xy = round((y - 1) * (y - 2) / 2 + x - 1)
|
|
197
|
+
req_xy = round((y - 1) * (N_states - 1) + x - 1)
|
|
198
|
+
req[req_xy] = Sxy[S_xy]
|
|
199
|
+
|
|
200
|
+
header = "\n" + arrow_str + f"STEP 9: MSH analysis for case {job_control[job_index]['caseid']}\n"
|
|
201
|
+
header += f"SBM parameter file: {os.path.basename(sbm_file)}\n"
|
|
202
|
+
write_to_output(i, job_control, dict_of_simulation, header + _buf.getvalue())
|
|
203
|
+
return job_control
|
|
@@ -576,7 +576,7 @@ def Find_CT_states_DA(data, LE_fragment, charge_frag_list, Max_CT_states, Includ
|
|
|
576
576
|
Max_CT_states = int(Max_CT_states)
|
|
577
577
|
# Criteria 2: energy ordering
|
|
578
578
|
if len(CT_candidate) < Max_CT_states:
|
|
579
|
-
print('The number of CT states is less than the maximum number of CT states '
|
|
579
|
+
print('The number of CT states is less than the maximum number of CT states ',len(CT_candidate))
|
|
580
580
|
CT_state_order = CT_candidate
|
|
581
581
|
else:
|
|
582
582
|
CT_state_order = CT_candidate[0:Max_CT_states]
|