forked from xpclove/autofp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paramgroup_tof.py
89 lines (80 loc) · 2.5 KB
/
paramgroup_tof.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
import re
Param_Group=[
["Profile","Background","Contribution","Phase"],
["Pattern"],
["Atom"],
["AtomicDisplacementFactor"],
["StrainParameter","PreferOrient","AsymmetryParameter","SpecialReflection","ExpDecayFunction"],
["Atom_Occ"]
]
Param_Order_Group_Name=[
"Scale",
"a b c",
"simple background"
"Zero",
"Atom",
"Asym",
"complex background",
"U,V,W",
"Y,X",
"D_HG2,D_HL,Shift",
"Pref,Tempeture factors,Occ"]
Param_Order_Group=[
["Scale","Extinct"],
["a-Pha","b-P","c-P"],
["Back[0]"],
["Zero"],
["X-Atom","Y-Atom","Z-Atom"],
["ALPH","BETA","Biso-Atom",], # ALPH,BETA== PA
["BACK"],
["Sig2-Pr","Sig1-Pr","Sig0-Pr"], # == U,V,W
["Gam1-Pr","Gam2-Pr"], # == Y,X
["D_HG2","D_HL","Shift"],
["Pref","Bov",
"Z1" # == "GausS","1G",
"Dtt2", # == "Sycos","Transparency",
"Occ-Atom",
"B1","B2","B3",
"ABS"
#"S_L","D_L",
#"Dtt1", # == "Sysin","Displacement",
#"Gam0" # == "LorSiz","SZ",
#"LStr","LSiz","Str",
]
]
Param_Num_Order=range(0,len(Param_Order_Group))
target={}
#for the alias count
atom=-1
back=-1
order=[]
def name_to_alias(name=""):
global atom
global back
name=name.replace("Sycos","Displacement")
name=name.replace("Sysin","Transparency")
name=name.replace("Lambda","Wavelength")
name=name.replace("GausSiz","1G")
name=name.replace("LorSiz","SZ")
if name.find("BACK")!=-1:
back+=1
name=name.replace("BACK","BACK["+str(back)+"]")
if name.find("B11")!=-1:
atom+=1
reobj=re.compile(r"B[0-9][0-9]")
if reobj.search(name):
name=name.replace("B","Atom["+str(atom)+"]-B")
return name
#get a order for the rietveld
def get_order(params,param_switch,param_order_num=Param_Num_Order):
s=""
global order
order=[] # init the order[]
Param_Order=[]
for i in param_order_num:
Param_Order.extend(Param_Order_Group[i])
for i in range(0,len(Param_Order)):
for j in range(0,len(params.paramlist)):
s=params.alias[j]
if (s.find(Param_Order[i])!=-1 and param_switch[j]==True ):
order.append(j)