forked from Huaguiyuan/cif2input
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cif2input.py
98 lines (84 loc) · 3.06 KB
/
cif2input.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
90
91
92
93
94
95
96
97
98
#!/usr/bin/python3
import sys
import pymatgen
import argparse
from tool.structure2input import structure2input
if __name__ == '__main__':
parser = argparse.ArgumentParser(
prog='cif2input.py',
description='make input files for QE from a cif file.',
epilog='end',
add_help=True,
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument('-i', '--input_cif',
action='store',
dest='cif_file',
nargs='?',
type=str,
default="",
required = True,
help = ("cif file"),
metavar=None)
parser.add_argument('-pp', '--pseudo_path',
action='store',
dest='pseudo_path',
nargs='?',
type=str,
default="",
required = True,
help = ("Path to psuedo potentials"),
metavar=None)
parser.add_argument('-k', '--dk_path', action='store', dest='dk_path',
nargs='?', default=0.1, type=float, choices=None,
help=('Path to input data.'),
metavar=None)
parser.add_argument('-qg', '--dq_grid',
action='store',
dest='dq_grid',
nargs='?',
type= float,
default =0.3359385398275,
metavar=None)
parser.add_argument('-pk', '--pseudo_kind',
action='store',
dest='pseudo_kind',
nargs='?',
type=str,
default="sg15",
metavar=None)
parser.add_argument('-q', '--queue',
action='store',
dest='queue',
nargs='?',
type=str,
default="F4cpus",
metavar=None)
parser.add_argument('-r', '--rel',
action='store_true')
parser.add_argument('-nc', '--norm_con',
action='store_false')
args = parser.parse_args()
#
# CIF parser
#
structure = pymatgen.Structure.from_file(args.cif_file)
#
# Set values
#
dk_path = args.dk_path
dq_grid = args.dq_grid
pseudo_kind = args.pseudo_kind
pseudo_dir = args.pseudo_path
queue = args.queue
rel = args.rel
norm_con = args.norm_con
#
print(" dk for band : {0}".format(dk_path))
print(" dq for grid : {0}".format(dq_grid))
print(" Pseudo kind is ", pseudo_kind)
print(" Pseudo is at ", pseudo_dir)
print(" Relative Flag : ",rel)
print(" Norm conserved Flag : ",norm_con)
structure.remove_oxidation_states()
structure2input(structure, dk_path, dq_grid, pseudo_kind, pseudo_dir, queue, rel, norm_con)