-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcc_update_parallel.py
More file actions
executable file
·92 lines (76 loc) · 2.92 KB
/
Copy pathcc_update_parallel.py
File metadata and controls
executable file
·92 lines (76 loc) · 2.92 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
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
##----------------------------------------------------------------------------------------------------------------##
# Routine to Symmetrize the two body residue of ground state CC #
# Author: Soumi Tribedi, Anish Chakraborty, Rahul Maitra #
# Date - 10th Dec, 2019 #
##----------------------------------------------------------------------------------------------------------------##
##--------------------------------------------------##
#Import important modules#
##--------------------------------------------------##
import gc
import numpy as np
import copy as cp
import MP2
import inp
import diagrams
##--------------------------------------------------##
#import important parameters#
##--------------------------------------------------##
D1 = MP2.D1
D2=MP2.D2
So = MP2.So
Do=MP2.Do
Sv = MP2.Sv
Dv=MP2.Dv
conv = 10**(-inp.conv)
##--------------------------------------------------##
#compute new t2#
##--------------------------------------------------##
def update_t2(R_ijab,t2):
ntmax = 0
eps_t = 100
if eps_t >= conv:
delt2 = np.divide(R_ijab,D2)
t2 = t2 + delt2
ntmax = np.size(t2)
eps_t = float(np.sum(abs(R_ijab))/ntmax)
return eps_t, t2, R_ijab
##--------------------------------------------------##
#compute new t1 and t2#
##--------------------------------------------------##
def update_t1t2(R_ia,R_ijab,t1,t2):
ntmax = 0
eps = 100
delt2 = np.divide(R_ijab,D2)
delt1 = np.divide(R_ia,D1)
t1 = t1 + delt1
t2 = t2 + delt2
ntmax = np.size(t1)+np.size(t2)
eps = float(np.sum(abs(R_ia)+np.sum(abs(R_ijab)))/ntmax)
return eps, t1, t2
##--------------------------------------------------##
#compute new So#
##--------------------------------------------------##
def update_So(R_ijav,So):
ntmax = 0
eps_So = 100
if eps_So >= conv:
delSo = np.divide(R_ijav,Do)
So = So + delSo
ntmax = np.size(So)
eps_So = float(np.sum(abs(R_ijav))/ntmax)
return eps_So, So
##--------------------------------------------------##
#compute new Sv#
##--------------------------------------------------##
def update_Sv(R_iuab,Sv):
ntmax = 0
eps_Sv = 100
if eps_Sv >= conv:
delSv = np.divide(R_iuab,Dv)
Sv = Sv + delSv
ntmax = np.size(Sv)
eps_Sv = float(np.sum(abs(R_iuab))/ntmax)
return eps_Sv, Sv
##-----------------------------------------------------------------------------------------------------------------------##
#THE END#
##-----------------------------------------------------------------------------------------------------------------------##