-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_feff_input.py
More file actions
1879 lines (1687 loc) · 48.9 KB
/
parse_feff_input.py
File metadata and controls
1879 lines (1687 loc) · 48.9 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
# -----------------------------
# Exceptions
# -----------------------------
class ParseError(Exception):
pass
# Range validation.
def validate_range(rng,result):
if "min" in rng:
if result < rng["min"]: return False
if "max" in rng:
if result > rng["max"]: return False
if "seq" in rng:
if result not in rng["seq"]: return False
return True
# -----------------------------
# Header parsing (required/optional/rest)
# -----------------------------
def parse_typed_line_with_optional_and_rest(
line: str,
keyword: str,
required: Dict[str,Any],
optional: Dict[str,Any]
) -> List[Any]:
"""
required: list of (name, converter) or (name, "rest")
optional: list of (name, converter[, default]) or (name, "rest"[, default])
"""
tokens = line.strip().split()
tk = tokens[0]
tokens[0] = keyword
if not tokens:
raise ParseError("Empty line")
if tokens[0] != keyword:
raise ParseError(f"Expected keyword '{keyword}', got '{tokens[0]}'")
# Everything after the keyword
body = line.strip()[len(tk):].lstrip()
values = body.split()
results: List[Any] = []
def is_rest(field) -> bool:
return field["type"] == "rest"
# Validate rest-of-line placement
if any(is_rest(f) for f in required[:-1]):
raise ParseError(f"{keyword}: rest-of-line field must be last required field")
if any(is_rest(f) for f in optional[:-1]):
raise ParseError(f"{keyword}: rest-of-line field must be last optional field")
# --- Parse required fields ---
idx = 0
for req in required:
name = req["name"]
conv = req["type"]
if conv == "rest":
result = (name,body) if body else ""
results.append(result)
return results
if idx >= len(values):
raise ParseError(
f"{keyword}: expected at least {len(required)} fields, got {len(values)}"
)
raw = values[idx]
try:
result = (name,conv(raw))
results.append(result)
except Exception as e:
raise ParseError(
f"{keyword}: required field '{name}' ('{raw}') failed conversion: {e}"
)
if "range" in req:
rng = req["range"]
if not validate_range(rng,result[1]):
raise ParseError(f"Error in '{keyword}': invalid value of '{name}'."
+ f"\n Valid values: '{rng}'")
idx += 1
# --- Parse optional fields ---
for opt in optional:
name = opt["name"]
conv = opt["type"]
if "default" in opt:
detault = opt["default"]
else:
default = None
if conv == "rest":
if idx < len(values):
result = (name," ".join(values[idx:]))
else:
result = (name,default)
results.append(result)
return results
if idx < len(values):
raw = values[idx]
try:
result = (name,conv(raw))
results.append(result)
except Exception as e:
raise ParseError(
f"{keyword}: optionoptfield '{name}' ('{raw}') failed conversion: {e}"
)
if "range" in opt:
rng = opt["range"]
if not validate_range(rng,result[name]):
raise ParseError(f"Error in '{keyword}': invalid value of '{name}'."
+ f"\n Valid values: '{rng}'")
idx += 1
else:
result = (name,default)
results.append(result)
if idx < len(values):
raise ParseError(
f"{keyword}: too many fields; expected {idx}, got {len(values)}"
)
return results
# -----------------------------
# Body line parsing (per-keyword schemas)
# -----------------------------
def parse_body_line(
line: str,
keyword: str,
required: Dict[str, Any],
optional: Dict[str,Any],
rest: Optional[Tuple[str]] = None,
) -> List[Any]:
tokens = line.strip().split()
values = tokens
results: List[Any] = []
# Required
idx = 0
for req in required:
name = req["name"]
conv = req["type"]
if idx >= len(values):
raise ParseError(
f"{keyword} body: expected at least {len(required)} fields, got {len(values)}"
)
raw = values[idx]
try:
results.append((name,conv(raw)))
except Exception as e:
raise ParseError(
f"{keyword} body: required field '{name}' ('{raw}') failed conversion: {e}"
)
if "range" in req:
rng = req["range"]
if not validate_range(rng,results[-1][1]):
raise ParseError(f"Error in '{keyword}': invalid value of '{name}'."
+ f"\n Valid values: '{rng}'")
idx += 1
# Optional
for opt in optional:
name = opt["name"]
conv = opt["type"]
if "default" in opt:
default = opt["default"]
else:
default = None
if idx < len(values):
raw = values[idx]
try:
if conv == "rest":
results.append((name, " ".join(values[idx:])))
else:
results.append((name,conv(raw)))
except Exception as e:
raise ParseError(
f"{keyword} body: optional field '{name}' ('{raw}') failed conversion: {e}"
)
idx += 1
else:
results.append((name,default))
if "range" in opt:
rng = opt["range"]
if not validate_range(rng,results[-1][1]):
raise ParseError(f"Error in '{keyword}': invalid value of '{name}'."
+ f"\n Valid values: '{rng}'")
# Rest-of-line
if rest is not None:
(rest_name,) = rest
if idx < len(values):
results.append((rest_name," ".join(values[idx:])))
else:
results.append((rest_name, ""))
else:
print(results)
if idx < len(values):
raise ParseError(
f"{keyword} body: too many fields; expected {idx}, got {len(values)}"
)
return results
# -----------------------------
# Block finalization
# -----------------------------
def finalize_block(keyword: str, block: Dict[str, Any], registry: Dict[str, Dict[str, Any]]) -> None:
spec = registry[keyword]
body_spec = spec.get("body", {"mode": "none"})
mode = body_spec.get("mode", "none")
body = block["body"]
min_lines = body_spec.get("min")
max_lines = body_spec.get("max")
if min_lines is not None and len(body) < min_lines:
raise ParseError(
f"{keyword}: expected at least {min_lines} body lines, got {len(body)}"
)
if max_lines is not None and len(body) > max_lines:
raise ParseError(
f"{keyword}: expected at most {max_lines} body lines, got {len(body)}"
)
if mode == "none":
if body:
raise ParseError(f"{keyword}: body not allowed")
block["body"] = None
elif mode == "raw":
pass
elif mode == "typed":
required = body_spec.get("required", [])
optional = body_spec.get("optional", [])
rest = body_spec.get("rest", None)
parsed = []
for line in body:
parsed.append(parse_body_line(line, keyword, required, optional, rest))
block["body"] = parsed
elif callable(mode):
block["body"] = mode(body)
else:
raise ParseError(f"{keyword}: unknown body mode '{mode}'")
# -----------------------------
# Block parsing (with comment/blank-line handling)
# -----------------------------
def strip_comment(line: str) -> str:
"""Remove everything after '*'."""
if "*" in line:
return line.split("*", 1)[0].rstrip()
return line
def parse_blocks(lines: List[str], registry: Dict[str, Dict[str, Any]]) -> List[Dict[str, Any]]:
blocks = dict()
current = None
line_num = 0
keys = registry.keys()
for raw in lines:
line_num += 1
# Remove trailing comments
raw = strip_comment(raw)
# Skip blank lines
if not raw.strip():
continue
# Skip full-line comments
if raw.lstrip().startswith("*"):
continue
stripped = raw.lstrip()
token = stripped.split()[0] if stripped else None
#is_keyword = token.upper in registry if token else False
# Check if token is a keyword
token = token.upper()
is_keyword = False
nmatch = 0
for k in keys:
if k.startswith(token):
token = k
nmatch = nmatch + 1
is_keyword = True
# Can't match more than one card.
if nmatch > 1: raise ParseError(f"Input '{token}' matches more than one input card.")
if is_keyword:
if current is not None:
current["end_line"] = line_num - 1
finalize_block(keyword, current, registry)
if keyword not in blocks:
blocks[keyword] = [current]
elif registry[keyword]["repeatable"]:
blocks[keyword].append(current)
else:
raise ParseError(f"Found multiple instances of '{token}' in input file.")
keyword = token
if keyword in blocks and not registry[keyword]["repeatable"]:
raise ParseError(f"Found multiple instances of '{token}' in input file.")
spec = registry[token]
header = parse_typed_line_with_optional_and_rest(
stripped,
token,
spec.get("required", []),
spec.get("optional", []),
)
current = {
"header": header,
"body": [],
"start_line": line_num,
"end_line": None,
}
else:
if current is None:
continue
current["body"].append(raw.rstrip("\n"))
# If END keyword, exit loop
if keyword == "END": break
if current is not None:
current["end_line"] = line_num
finalize_block(keyword, current, registry)
if keyword in blocks:
blocks[keyword].append(current)
else:
blocks[keyword] = [current]
return blocks
'''
ELNES has header data, + 4 to 5 non-repeating lines of body. Use specialized
parsing function for ELNES.
'''
def parse_elnes_input(lines):
keyword = "ELNES"
elnes_required = [
[{"name": "E","type": float,"range": {"min":0}}],
[{"name": "kx", "type": float},
{"name": "ky", "type": float},
{"name": "kz", "type":float}],
[{"name": "alpha", "type": float, "range": {"min":0}},
{"name": "beta", "type": float, "range": {"min":0}}],
[{"name": "nr", "type": int, "range": {"min": 1}},
{"name": "na", "type": int, "range": {"min": 1}}],
[{"name": "dx", "type": float},{"name": "dy", "type": float}]]
elnes_optional = [
[{"name": "aver", "type": int},
{"name": "cross","type": int},
{"name": "relat","type": int}],[],[],[],[]]
elnes_body = []
nlines=0
aver = 0
for i,line in enumerate(lines):
if i == 0:
body = parse_body_line(line, keyword, elnes_required[0],
elnes_optional[0])
# Don't expect second line if aver == 0.
aver = body[2][1] if (body[2][1] is not None) else 0
j = 1 if (aver == 1) else 0
else:
body = parse_body_line(line, keyword, elnes_required[j],
elnes_optional[j])
elnes_body.append(body)
j=j+1
nlines=nlines+1
# Now check that the number of lines is consistent and throw an error if
# not.
if aver == 0 and len(lines) !=5:
raise ParseError("Inconsistent input in ELNES card.")
elif aver == 1 and len(lines) !=4:
raise ParseError("Inconsistent input in ELNES card.")
elif aver !=1 and aver != 0:
raise ParseError("Inconsistent input in ELNES card.")
return elnes_body
def parse_egrid_input(lines):
keyword = "EGRID"
egrid_normal_required = [
{"name": "grid_type", "type": str, "range":
{"seq":('e_grid','k_grid','exp_grid')}},
{"name": "grid_min", "type": str},
{"name": "grid_max", "type": float},
{"name": "grid_step", "type": float}
]
egrid_user_required = [{"name": "energy", "type": float}]
egrid_optional = []
egrid_body = []
user_mode=False
igrid = 0
for iline, line in enumerate(lines):
token = line.strip().split()[0]
if token == "user_grid":
body = [('grid_type', 'user_grid')]
igrid = igrid + 1
grid = 'user_grid'
user_mode = True
#req = [{"name": "grid_type", "type": str}]
#body = parse_body_line(line,keyword,req,egrid_optional)
user_energies = []
elif token in ("e_grid", "k_grid", "exp_grid"):
if user_mode:
body.append(("energies",user_energies))
egrid_body.append(body)
grid = token
user_mode = False
body = parse_body_line(line,keyword,egrid_normal_required,egrid_optional)
igrid = igrid + 1
elif user_mode:
bdy = parse_body_line(line,keyword,egrid_user_required,egrid_optional)
user_energies.append(bdy[0][0])
if iline + 1 == len(lines):
body.append(('energies', user_energies))
egrid_body.append(body)
else:
raise ParseError(f"Error in EGRID card. Unexpected line after '{grid}'."
+ f"\n'{line}'")
if not user_mode: egrid_body.append(body)
return egrid_body
# -----------------------------
# registry definitions
# -----------------------------
'''
Registry entries are dictionaries with the following definition:
The dictionary keys to entries should be the name of the card in FEFF.
The data for a card entry is another dictionary with the all of the following
entries defined:
"required" - list of "field" dictionaries defining the required fields on same line as
the key. Each field dictionary must contain "name" and "type"
entries. "default" and "range" entries are optional. The
"type" entry should list the type of data, which can be
str, int, float, "rest" (rest of line), or a callable
function. Can be an empty list if no required fields exist.
"optional" - list of "field" dictionaries defining the optional fields
on the same line as the key. Same mandatory and optional
entries. Can be an empty list if no optional field exist.
"repeatable" - Logical entry. If true, keyword can show be repeated in
input file.
"body" - Another definition defining how to process multi-line
cards. This dictionary has the following entries:
"mode" - required entry, defines the mode used for processing the
multi-line block. The options are:
"none" - multi-line blocks not allowed.
"typed" - each line has the same set of
typed fields.
"callable" - call a specialized parser for
this block of lines.
"rest" - optional tuple entry ("name",) , saves the rest of each
line in the field dictionary with key name "name".
"min" - optional integer entry giving the min number
of body lines.
"max" - optional integer entry giving the max number
of body lines.
'''
metadata_registry: Dict[str, Dict[str, Any]] = {
"TITLE": {
"required": [{"name": "text", "type": "rest"}],
"optional": [],
"repeatable": True,
"body": {
"mode": "none",
},
},
}
structure_registry: Dict[str, Dict[str, Any]] = {
"CIF": {
"required": [{"name": "cif_file", "type": str}],
"optional": [{"name": "comment", "type": "rest"}],
"repeatable": False,
"body": {
"mode": "none",
},
},
"LATTICE": {
"required": [
{"name": "type", "type": str},
{"name": "scale","type": float}
],
"optional": [],
"repeatable": False,
"body": {
"mode": "typed",
"required": [
{"name": "x", "type": float},
{"name": "y", "type": float},
{"name": "z", "type": float},
],
"optional": [],
"rest": ("comment",),
"min": 3,
"max": 3,
},
},
"POTENTIALS": {
"required": [],
"optional": [],
"repeatable": False,
"body": {
"mode": "typed",
"required": [
{"name": "ipot", "type": int},
{"name": "z", "type": int},
{"name": "symbol", "type": str},
],
"optional": [
{"name": "lmax_scf", "type": int, "default": -1},
{"name": "lmax_fms", "type": int, "default": -1},
{"name": "xnat", "type": float},
{"name": "spinph", "type": float},
],
"rest": ("comment",),
"min": 2,
"max": None,
},
},
"REAL" : {
"required": [],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"RECIPROCAL" : {
"required": [],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"TARGET" : {
"required": [{"name": "ic", "type": int}],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"COORDINATES" : {
"required": [{"name": "i", "type": int}],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"RMULTIPLIER" : {
"required": [{"name": "rmult", "type": float}],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"SGROUP" : {
"required": [{"name": "igroup", "type": int}],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"CFAVERAGE" : {
"required": [
{"name": "iphabs", "type": int},
{"name": "nabs", "type": int},
{"name": "rclabs", "type": float},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"OVERLAP" : {
"required": [{"name": "iph", "type": int}],
"optional": [],
"repeatable": True,
"body": {
"mode": "typed",
"required": [
{"name": "iphovr", "type": int},
{"name": "novr", "type": int},
{"name": "rovr", "type": float},
],
"optional": [],
"rest": None,
"min": 1,
"max": 1,
},
},
"EQUIVALENCE" : {
"required": [{"name": "ieq", "type": int}],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"ATOMS": {
"required": [],
"optional": [],
"repeatable": False,
"body": {
"mode": "typed",
"required": [
{"name": "x", "type": float},
{"name": "y", "type": float},
{"name": "z", "type": float},
{"name": "ipot", "type": int},
],
"optional": [
{"name": "label", "type": "rest"},
],
"rest": None,
"min": 2,
"max": None,
},
},
}
spectrum_registry: Dict[str, Dict[str, Any]] = {
"EXAFS" : {
"required": [],
"optional": [{"name": "xkmax", "type": float}],
"repeatable": False,
"body": {
"mode": "none",
},
},
"ELNES" : {
"required": [],
"optional": [
{"name": "xkmax", "type": float},
{"name": "xkstep", "type": float},
{"name": "vixan", "type": float},
],
"repeatable": False,
"body": {
"mode": parse_elnes_input,
},
},
"EXELFS" : {
"required": [{"name": "xkmax", "type": float}],
"optional": [],
"repeatable": False,
"body": {
"mode": parse_elnes_input,
},
},
"LDOS" : {
"required": [
{"name": "emin", "type": float},
{"name": "emax", "type": float},
{"name": "eimag", "type": float},
],
"optional": [
{"name": "neldos", "type": int}
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"XANES" : {
"required": [],
"optional": [
{"name": "xkmax", "type": float},
{"name": "xkstep", "type": float},
{"name": "vixan", "type": float},
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"ELLIPTICITY" : {
"required": [
{"name": "elpty", "type": float},
{"name": "x", "type": float},
{"name": "y", "type": float},
{"name": "z", "type": float},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"MULTIPOLE" : {
"required": [
{"name": "le2", "type": int},
],
"optional": [
{"name": "l2lp", "type": int},
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"POLARIZATION" : {
"required": [
{"name": "x", "type": float},
{"name": "y", "type": float},
{"name": "z", "type": float},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"COMPTON" : {
"required": [],
"optional": [
{"name": "pqmax", "type": float},
{"name": "npq", "type": int},
{"name": "force-jzzp", "type": int},
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"DANES" : {
"required": [],
"optional": [
{"name": "xkmax", "type": float},
{"name": "xkstep", "type": float},
{"name": "vixan", "type": float},
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"FPRIME" : {
"required": [
{"name": "emin", "type": float},
{"name": "emax", "type": float},
{"name": "estep", "type": float},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"NRIXS" : {
"required": [
{"name": "nq", "type": int},
{"name": "qx", "type": float},
{"name": "qy", "type": float},
{"name": "qz", "type": float},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"XES" : {
"required": [
{"name": "emin", "type": float},
{"name": "emax", "type": float},
{"name": "estep", "type": float},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"XMCD" : {
"required": [],
"optional": [
{"name": "xkmax", "type": float},
{"name": "xkstep", "type": float},
{"name": "estep", "type": float},
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"XNCD" : {
"required": [],
"optional": [
{"name": "xkmax", "type": float},
{"name": "xkstep", "type": float},
{"name": "estep", "type": float},
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"EDGE" : {
"required": [
{"name": "label", "type": str},
],
"optional": [
{"name": "s02", "type": float},
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"HOLE" : {
"required": [
{"name": "ihole", "type": int},
{"name": "s02", "type": float},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none"
},
},
}
program_control_registry = {
"CONTROL" : {
"required": [
{"name": "ipot", "type": int},
{"name": "ixsph", "type": int},
{"name": "ifms", "type": int},
{"name": "ipaths", "type": int},
{"name": "igenfmt", "type": int},
{"name": "iff2x", "type": int},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"PRINT" : {
"required": [
{"name": "ppot", "type": int},
{"name": "pxsph", "type": int},
{"name": "pfms", "type": int},
{"name": "ppaths", "type": int},
{"name": "pgenfmt", "type": int},
{"name": "pff2x", "type": int},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"DIMS" : {
"required": [
{"name": "nmax", "type": int},
{"name": "lmax", "type": int},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"KMESH" : {
"required": [],
"optional": [
{"name": "nkp(x)", "type": int},
{"name": "nkpy", "type": int},
{"name": "nkpz", "type": int},
{"name": "ktype", "type": int},
{"name": "usesym", "type": int},
],
"repeatable": False,
"body": {
"mode": "none",
},
},
"END" : {
"required": [],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"EGRID" : {
"required": [],
"optional": [],
"repeatable": False,
"body": {
"mode": parse_egrid_input,
},
},
}
potentials_registry = {
"AFOLP" : {
"required": [
{"name": "folpx", "type": float},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"COREHOLE" : {
"required": [
{"name": "type", "type": str},
],
"optional": [],
"repeatable": False,
"body": {
"mode": "none",
},
},
"SCF" : {
"required": [
{"name": "rscf", "type": float},