Skip to content

Commit 76ec51d

Browse files
committed
further benchmark for 2D up to the 3rd order
1 parent 768ed46 commit 76ec51d

File tree

4 files changed

+26
-29
lines changed

4 files changed

+26
-29
lines changed

inlist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
25 1.0 1.0 3.0 101 0 8
1+
20 1.0 1.0 3.0 101 0 16
22

33
10 1.0 1.0 10.0 101 1 8
44
# Beta, rs, Mass2, MaxExtMom(*kF), TotalStep(*1e6), Observable, Duplication

polar_freq.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
rs=1.0
1111
Lambda=1.0
12-
Beta=10
12+
Beta=20
1313

1414
############## 3D ##################################
1515
# kF=(9.0*np.pi/4.0)**(1.0/3.0)/rs #3D
@@ -25,7 +25,7 @@
2525
###### Bare Green's function #########################
2626
kF=np.sqrt(2.0)/rs #2D
2727
# Bubble=0.11635 #2D, Beta=0.5, rs=1
28-
Bubble=0.15916/2.0 #2D, Beta=10, rs=1
28+
Bubble=0.15916 #2D, Beta=10, rs=1
2929

3030
ScanOrder=[1,2,3]
3131
# ScanOrder=[3]
@@ -40,8 +40,7 @@
4040
Normalization=1
4141

4242

43-
# folder="./".format(Beta, rs, Lambda)
44-
folder="./"
43+
folder="./Beta{0}_rs{1}_lambda{2}_freq/".format(Beta, rs, Lambda)
4544

4645
files=os.listdir(folder)
4746
for order in ScanOrder:

send.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,11 @@
77
Cluster="local"
88
# Cluster="condor"
99

10-
compiler="ifort"
11-
# compiler="gfortran"
12-
13-
execute="feyncalc"
1410
############################################
1511

16-
sourcedir=os.getcwd()
17-
filelist=os.listdir(sourcedir)
18-
sourcename=[elem for elem in filelist if elem[0:len(execute)]==execute and elem[-3:]=="f90"]
19-
print sourcename
20-
sourcename.sort()
21-
sourcename=sourcename[-1]
22-
23-
tothomedir=os.getcwd()
24-
inlist=open(tothomedir+"/inlist","r")
12+
rootdir=os.getcwd()
13+
inlist=open(rootdir+"/inlist","r")
14+
execute="feyncalc.exe"
2515

2616
for index, eachline in enumerate(inlist):
2717
para=eachline.split()
@@ -44,7 +34,7 @@
4434

4535
os.system("cp DiagPolar*.txt "+homedir)
4636
os.system("cp DiagLoop*.txt "+homedir)
47-
os.system(compiler+" "+sourcedir+"/"+sourcename+" -O3 -o "+homedir+"/"+execute)
37+
os.system("cp {0} {1}".format(execute, homedir))
4838

4939
infilepath=homedir+"/infile"
5040
if(os.path.exists(infilepath)!=True):
@@ -55,8 +45,6 @@
5545
jobfilepath=homedir+"/jobfile"
5646
if(os.path.exists(jobfilepath)!=True):
5747
os.system("mkdir "+jobfilepath)
58-
if(os.path.exists(homedir+"/Data")!=True):
59-
os.system("mkdir "+homedir+"/Data")
6048

6149
for pid in range(int(para[-1])):
6250

src/markov.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,20 @@ void markov::Initialization(string FilePrefix) {
138138
///=== Do all kinds of test =======================//
139139
Weight.StaticTest();
140140
Weight.DynamicTest();
141+
142+
///==== Set Reweighting factor =====================//
143+
AdjustGroupReWeight();
141144
}
142145

143-
void markov::AdjustGroupReWeight(){};
146+
void markov::AdjustGroupReWeight() {
147+
double factor[3] = {1.0, 1.0, 10.0};
148+
for (int i = 0; i < Weight.Groups.size(); i++)
149+
Weight.Groups[i].ReWeight = factor[i];
150+
};
144151

145152
void markov::Measure() {
146-
double AbsWeight = fabs(Var.CurrGroup->Weight);
147-
double WeightFactor =
148-
Var.CurrGroup->Weight / AbsWeight / Var.CurrGroup->ReWeight;
153+
double MCWeight = fabs(Var.CurrGroup->Weight) * Var.CurrGroup->ReWeight;
154+
double WeightFactor = Var.CurrGroup->Weight / MCWeight;
149155
Polar[Var.CurrGroup->ID][Var.CurrExtMomBin] += WeightFactor;
150156
PolarStatic[Var.CurrGroup->ID] += WeightFactor;
151157
};
@@ -207,8 +213,10 @@ void markov::IncreaseOrder() {
207213
COPYFROMTO(NewMom, Var.LoopMom[NewLoopIndex]);
208214

209215
Weight.ChangeGroup(NewGroup);
210-
double NewWeight = Weight.GetNewWeight(NewGroup);
211-
double R = Prop * fabs(NewWeight) / fabs(Var.CurrGroup->Weight);
216+
double NewWeight = Weight.GetNewWeight(NewGroup) * NewGroup.ReWeight;
217+
double R = Prop * fabs(NewWeight) / fabs(Var.CurrGroup->Weight) /
218+
Var.CurrGroup->ReWeight;
219+
212220
if (Random.urn() < R) {
213221
Accepted[INCREASE_ORDER][Var.CurrGroup->ID]++;
214222
Weight.AcceptChange(NewGroup);
@@ -231,8 +239,10 @@ void markov::DecreaseOrder() {
231239
Prop *= RemoveOldK(Var.LoopMom[LoopToRemove]);
232240

233241
Weight.ChangeGroup(NewGroup);
234-
double NewWeight = Weight.GetNewWeight(NewGroup);
235-
double R = Prop * fabs(NewWeight) / fabs(Var.CurrGroup->Weight);
242+
double NewWeight = Weight.GetNewWeight(NewGroup) * NewGroup.ReWeight;
243+
double R = Prop * fabs(NewWeight) / fabs(Var.CurrGroup->Weight) /
244+
Var.CurrGroup->ReWeight;
245+
236246
if (Random.urn() < R) {
237247
Accepted[DECREASE_ORDER][Var.CurrGroup->ID]++;
238248
Weight.AcceptChange(NewGroup);

0 commit comments

Comments
 (0)