-
Notifications
You must be signed in to change notification settings - Fork 8
/
cpin_utilities.py
53 lines (45 loc) · 1.57 KB
/
cpin_utilities.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
# This python file contains functions useful to cpinutil.py
########################################################################
# List of functions and a brief description of their purpose
#
# fileexists: determines whether a passed file is found in the current
# directory
#
# fileexists_noprint: determines whether a passed file is found in the
# current directory, but does not print an error
# message
#
# printusage: prints the usage statement for the script
#
########################################################################
def fileexists(file):
import sys
try:
f = open(file,'r')
except IOError:
print >> sys.stderr, 'Error: Specified file (' + file + \
') does not exist!'
return -1
f.close()
return 0
def fileexists_noprint(file):
try:
f = open(file,'r')
except IOError:
return -1
f.close()
return 0
def printusage():
import sys
print "cpinutil.py -p <prmtop> \\"
print " -igb <2 or 5> \\"
print " -resname <resname list> \\"
print " -notresname <resname list> \\"
print " -resnum <residue numbers> \\"
print " -notresnum <residue numbers> \\"
print " -minpKa <value> \\"
print " -maxpKa <value> \\"
print " -states <list of states> \\"
print " -system <system name> \\"
print " [--ignore-warnings]"
sys.exit()