-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForceField.py
More file actions
34 lines (29 loc) · 830 Bytes
/
ForceField.py
File metadata and controls
34 lines (29 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
31
32
33
#
# Manage Forcefield parameters (vdw, Srf)
# uses modified CMIP vdwprm file
#
import sys
import math
class VdwParamset():
def __init__ (self, fname):
self.atTypes = {}
try:
fh = open(fname,"r")
except OSError:
print ("#ERROR while loading parameter file (" ,fname,")" )
sys.exit(2)
for line in fh:
if line[0] == '#':
continue
data = line.split()
self.atTypes[data[0]]=AtType(data)
self.ntypes = len(self.atTypes)
fh.close()
class AtType():
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