1 """ @package forcebalance.custom_io Custom force field parser. 3 We take advantage of the sections in GROMACS and the 'interaction 4 type' concept, but these interactions are not supported in GROMACS; 5 rather, they are computed within our program. 11 from re
import match, sub
12 from forcebalance
import BaseReader
15 cptypes = [
None,
'CPGAUSS',
'CPEXPG',
'CPGEXP']
21 'counterpoise' : cptypes }
24 pdict = {
'CPGAUSS':{3:
'A', 4:
'B', 5:
'C'},
25 'CPGEXP' :{3:
'A', 4:
'B', 5:
'G', 6:
'X'},
26 'CPEXPG' :{3:
'A1', 4:
'B', 5:
'X0', 6:
'A2'}
30 """Finite state machine for parsing custom GROMACS force field files. 32 This class is instantiated when we begin to read in a file. The 33 feed(line) method updates the state of the machine, giving it 34 information like the residue we're currently on, the nonbonded 35 interaction type, and the section that we're in. Using this 36 information we can look up the interaction type and parameter type 37 for building the parameter ID. 52 @param[in] line The line of data 60 if len(s) == 0
or match(
'^;',line):
return None,
None 62 if match(
'^\[.*\]',line):
64 self.
sec = sub(
'[\[\] \n]',
'',line)
65 elif self.
sec ==
'counterpoise':
66 self.
itype = cptypes[int(s[2])]
68 elif self.
sec ==
'NDDO':
70 self.
itype =
'_'.join([
'NDDO', s[0], s[1]])
73 if len(atom) > 1
and atom[0] > atom[-1]:
76 self.
suffix =
''.join(atom)
pdict
The parameter dictionary (defined in this file)
Finite state machine for parsing custom GROMACS force field files.
def feed(self, line)
Feed in a line.
sec
The current section that we're in.