-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmolcas_maker.py
More file actions
executable file
·98 lines (80 loc) · 2.9 KB
/
molcas_maker.py
File metadata and controls
executable file
·98 lines (80 loc) · 2.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
#!/usr/bin/env python
# Script by Jogvan to make molcas input files from xyz
# Only removed some submit stuff (arnfinn)
import os
import argparse as ap
parser = ap.ArgumentParser(description='LoProp job submitter 0.1b')
parser.add_argument('-xyz', '--xyz', dest='xyzfile', metavar='XYZ_FILE',
help='''the name of the xyz input file that contains the
molecule.''')
parser.add_argument('--method', dest='method', metavar='METHOD',
default='DFT', choices=['DFT', 'HF'],
help='''Choose QM method. Valid choices are
%(choices)s. If you use DFT then you can also
specify the xc-functional using the
--xcfun option. [default: %(default)s]''')
parser.add_argument('--basis', dest='basis', metavar='BASISSET',
default='A-AUG-CC-PVDZ',
help='''Specify basis set. [default: %(default)s]''')
parser.add_argument('--xcfun', dest='xcfun', default='B3LYP',
metavar='XCFUN',
help='''Specify xc-functional. [default: %(default)s]''')
parser.add_argument('--bond-midpoints', dest='bonds', action='store_true',
default=False,
help='''Also calculate parameters on bond midpoints.
[default: %(default)s]''')
parser.add_argument('--charge', dest='charge', metavar='CHARGE',
default=0, type=int,
help='''Specify basis set. [default: %(default)s]''')
args = parser.parse_args()
if not args.xyzfile:
exit('You must specify a .mol input file.')
if args.xyzfile[-4:] == '.xyz':
xyzfile = args.xyzfile[:-4]
else:
xyzfile = args.xyzfile
if not os.path.isfile('{}.xyz'.format(xyzfile)):
exit('{}.xyz not found.'.format(xyzfile))
if args.method == 'DFT':
method = 'KSDFT\n' + args.xcfun
elif args.method == 'HF':
method = ''
else:
exit('Invalid QM method for force field calculation.')
if args.bonds:
bmids = ''
else:
bmids = 'BONDS\n0.0\n'
if args.basis == "2":
basis = "A-AUG-CC-PVDZ"
else:
basis = args.basis
input = ('&GATEWAY &END\n' +
'TITLE\n' +
'Generated by subloprop 0.1b\n' +
'COORD\n' +
'{0}.xyz\n'.format(xyzfile) +
'BASIS\n' +
'{0}\n'.format(basis) +
'GROUP\n' +
'C1\n' +
'END OF INPUT\n' +
'&SEWARD &END\n' +
'MULT\n' +
'2\n' +
'CHOL\n' +
'END OF INPUT\n' +
'&SCF &END\n' +
'CHARGE\n' +
'{0}\n'.format(args.charge) +
'CHOL\n' +
'{0}\n'.format(method) +
'END OF INPUT\n' +
'&LOPROP &END\n' +
'MPPROP\n' +
'2\n' +
'{0}'.format(bmids) +
'END OF INPUT\n')
finp = open('{0}.inp'.format(xyzfile), 'w')
finp.write(input)
finp.close()