Skip to content

Commit a4220ae

Browse files
committed
Extend examples
1 parent f622eab commit a4220ae

File tree

3 files changed

+113
-6
lines changed

3 files changed

+113
-6
lines changed

examples/submit_any_engine_input.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import argparse
5+
6+
from yascheduler import Yascheduler
7+
8+
9+
parser = argparse.ArgumentParser()
10+
parser.add_argument("-f", dest="file", action="store", type=str, required=True)
11+
parser.add_argument("-e", dest="engine", action="store", type=str, required=True)
12+
parser.add_argument("-l", dest="localrepo", action="store", type=bool, required=False, default=False)
13+
args = parser.parse_args()
14+
15+
input_data = {}
16+
yac = Yascheduler()
17+
assert args.engine in yac.config.engines
18+
19+
target = os.path.abspath(args.file)
20+
work_folder = os.path.dirname(target)
21+
with open(target, encoding="utf-8") as f:
22+
MAIN_INPUT = f.read()
23+
24+
if args.localrepo:
25+
input_data["local_folder"] = None
26+
print("**To save calc in a local repo**")
27+
else:
28+
input_data["local_folder"] = work_folder
29+
print("**To save calc in an input folder**")
30+
31+
input_data[yac.config.engines[args.engine].input_files[0]] = MAIN_INPUT
32+
for inp in yac.config.engines[args.engine].input_files[1:]:
33+
input_data[inp] = ""
34+
35+
result = yac.queue_submit_task("test calc", input_data, args.engine)
36+
print(result)

examples/submit_fullprof_input.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env python3
2+
"""Submit FP task"""
3+
4+
from yascheduler import Yascheduler
5+
6+
LABEL = "Al2O3 XRPD pattern"
7+
8+
PATTERN_REQUEST = """COMM Corindon Al2O3
9+
! Files => DAT-file: corindon, PCR-file: corindonx
10+
!Job Npr Nph Nba Nex Nsc Nor Dum Iwg Ilo Ias Res Ste Nre Cry Uni Cor Opt Aut
11+
2 5 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
12+
!
13+
!Ipr Ppl Ioc Mat Pcr Ls1 Ls2 Ls3 NLI Prf Ins Rpa Sym Hkl Fou Sho Ana
14+
0 0 1 0 1 0 0 0 0 2 0 0 0 0 0 0 1
15+
!
16+
! lambda1 Lambda2 Ratio Bkpos Wdt Cthm muR AsyLim Rpolarz ->Patt# 1
17+
1.540596 1.540596 0.50 65.00 20.00 0.7998 0.00 40.00 0.0000
18+
!
19+
!NCY Eps R_at R_an R_pr R_gl Thmin Step Thmax PSD Sent0
20+
1 0.01 0.65 0.65 0.35 0.65 10.0000 0.100000 175.0000 0.000 0.000
21+
!
22+
0 !Number of refined parameters
23+
!
24+
! Zero Code SyCos Code SySin Code Lambda Code MORE ->Patt# 1
25+
-0.090 21.00 0.0000 0.00 0.0000 0.00 0.0000 0.0000 0
26+
! Background coefficients/codes for Pattern# 1
27+
21.00 -5.66 -9.36 8.30 37.04 -24.55
28+
51.00 61.00 71.00 81.00 31.00 41.00
29+
!-------------------------------------------------------------------------------
30+
! Data for PHASE number: 1
31+
!-------------------------------------------------------------------------------
32+
Al2O3
33+
!
34+
!Nat Dis Ang Pr1 Pr2 Pr3 Jbt Irf Isy Str Furth ATZ Nvk Npr More
35+
2 0 0 0.0 0.0 1.0 0 0 0 0 0 611.760 0 5 0
36+
!
37+
R -3 c <--Space group symbol
38+
!Atom Typ X Y Z Biso Occ In Fin N_t Spc /Codes
39+
AL AL+3 0.00000 0.00000 0.35218 0.4000 0.33333 0 0 0 0
40+
0.00 0. 00 171.00 191.00 0.00
41+
O O-2 0.30610 0.00000 0.25000 0.5000 0.50000 0 0 0 0
42+
181.00 0.00 0.00 201.00 0.00
43+
!-------> Profile Parameters for Pattern # 1
44+
! Scale Shape1 Bov Str1 Str2 Str3 Strain-Model
45+
0.28556E-02 0.5000 0.00000 0.00000 0.00000 0.00000 0
46+
11.00000 161.000 0.000 0.000 0.000 0.000
47+
! U V W X Y GauSiz LorSiz Size-Model
48+
0.005865 0.025089 0.018587 0.000000 0.000000 0.000000 0.000000 0
49+
141.000 151.000 131.000 0.000 0.000 0.000 0.000
50+
! a b c alpha beta gamma #Cell Info
51+
4.75758 4.75758 12.9876 90.000 90.000 120.000
52+
111.000 111.000 121.000 0.000 0.000 111.000
53+
! Pref1 Pref2 Asy1 Asy2 Asy3 Asy4
54+
0.00000 0.00000 0.023 0.061 0.00000 0.00000
55+
0.00 0.00 91.00 101.00 0.00 0.00
56+
"""
57+
58+
yac = Yascheduler()
59+
result = yac.queue_submit_task(LABEL, {"calc.pcr": PATTERN_REQUEST}, "fullprof")
60+
print(LABEL)
61+
print(result)

examples/submit_topas_input.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@
33

44
from yascheduler import Yascheduler
55

6-
LABEL = "SrTiO3 XRPD pattern"
6+
LABEL = "SrTiO3 XRPD dI"
77

88
PATTERN_REQUEST = """
9-
iters 0
10-
yobs_eqn !x = 0; min 10 max 175 del 0.1
11-
12-
Out_X_Ycalc( calc.xy )
9+
macro Out_Dif(file)
10+
{
11+
out file phase_out file load out_record out_fmt out_eqn
12+
{
13+
" %11.5f" = D_spacing;
14+
" %11.5f\n" = I_after_scale_pks;
15+
}
16+
}
17+
18+
iters 1
19+
yobs_eqn = 0; min 0 max 80 del 0.01
20+
LP_Factor(0)
1321
1422
lam
1523
ymin_on_ymax 0.0001
@@ -24,10 +32,12 @@
2432
site O x 0.00000 y 0.00000 z 2.00000 occ O 1 beq 1
2533
site Sr x 2.00000 y 2.00000 z 2.00000 occ Sr 1 beq 1
2634
site Ti x 0.00000 y 0.00000 z 0.00000 occ Ti 1 beq 1
35+
36+
Out_Dif( calc.xy )
2737
"""
2838

2939

3040
yac = Yascheduler()
31-
result = yac.queue_submit_task(LABEL, {"calc.inp": PATTERN_REQUEST, "structure.inc": "", "input.xy: ""}, "topas")
41+
result = yac.queue_submit_task(LABEL, {"calc.inp": PATTERN_REQUEST, "structure.inc": ""}, "topas")
3242
print(LABEL)
3343
print(result)

0 commit comments

Comments
 (0)