-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforcefield.py
More file actions
31 lines (28 loc) · 830 Bytes
/
forcefield.py
File metadata and controls
31 lines (28 loc) · 830 Bytes
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
"""
Manage Forcefield parameters (vdw, Srf)
uses modified CMIP vdwprm file
"""
import sys
class VdwParamset():
def __init__(self, file_name):
self.at_types = {}
try:
fh = open(file_name, "r")
except OSError:
print("#ERROR while loading parameter file (", file_name, ")")
sys.exit(2)
for line in fh:
if line[0] == '#':
continue
data = line.split()
self.at_types[data[0]] = AtomType(data)
self.ntypes = len(self.at_types)
fh.close()
class AtomType():
def __init__(self, data):
self.id = data[0]
self.eps = float(data[1])
self.sig = float(data[2])
self.mass = float(data[3])
self.fsrf = float(data[4])
self.rvdw = self.sig * 0.5612