-
Notifications
You must be signed in to change notification settings - Fork 2
/
tprplugin.h
500 lines (494 loc) · 13.1 KB
/
tprplugin.h
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
/*
Header that describes what is all *in* a tpr file, defining energies,
force terms, and other stuff that we need to be interoperable with a tpr.
*/
//From topology/topology.h
enum {
egcTC, egcENER, egcACC, egcFREEZE,
egcUser1, egcUser2, egcVCM, egcCompressedX,
egcORFIT, egcQMMM,
egcNR
};
//From topology/ifunc.h
enum
{
F_BONDS,
F_G96BONDS,
F_MORSE,
F_CUBICBONDS,
F_CONNBONDS,
F_HARMONIC,
F_FENEBONDS,
F_TABBONDS,
F_TABBONDSNC,
F_RESTRBONDS,
F_ANGLES,
F_G96ANGLES,
F_RESTRANGLES,
F_LINEAR_ANGLES,
F_CROSS_BOND_BONDS,
F_CROSS_BOND_ANGLES,
F_UREY_BRADLEY,
F_QUARTIC_ANGLES,
F_TABANGLES,
F_PDIHS,
F_RBDIHS,
F_RESTRDIHS,
F_CBTDIHS,
F_FOURDIHS,
F_IDIHS,
F_PIDIHS,
F_TABDIHS,
F_CMAP,
F_GB12,
F_GB13,
F_GB14,
F_GBPOL,
F_NPSOLVATION,
F_LJ14,
F_COUL14,
F_LJC14_Q,
F_LJC_PAIRS_NB,
F_LJ,
F_BHAM,
F_LJ_LR,
F_BHAM_LR,
F_DISPCORR,
F_COUL_SR,
F_COUL_LR,
F_RF_EXCL,
F_COUL_RECIP,
F_LJ_RECIP,
F_DPD,
F_POLARIZATION,
F_WATER_POL,
F_THOLE_POL,
F_ANHARM_POL,
F_POSRES,
F_FBPOSRES,
F_DISRES,
F_DISRESVIOL,
F_ORIRES,
F_ORIRESDEV,
F_ANGRES,
F_ANGRESZ,
F_DIHRES,
F_DIHRESVIOL,
F_CONSTR,
F_CONSTRNC,
F_SETTLE,
F_VSITE1,
F_VSITE2,
F_VSITE2FD,
F_VSITE3,
F_VSITE3FD,
F_VSITE3FAD,
F_VSITE3OUT,
F_VSITE4FD,
F_VSITE4FDN,
F_VSITEN,
F_COM_PULL,
F_DENSITYFITTING,
F_EQM,
F_EPOT,
F_EKIN,
F_ETOT,
F_ECONSERVED,
F_TEMP,
F_VTEMP,
F_PDISPCORR,
F_PRES,
F_DVDL_CONSTR,
F_DVDL,
F_DKDL,
F_DVDL_COUL,
F_DVDL_VDW,
F_DVDL_BONDED,
F_DVDL_RESTRAINT,
F_DVDL_TEMPERATURE, /* not calculated for now, but should just be the energy (NVT) or enthalpy (NPT), or 0 (NVE) */
F_NRE /* This number is for the total number of energies */
};
//This holds the meat and potatoes, the results after extracting all the topology info from the tpr file.
struct tprdata {
int precision;
int version; //Version of the file format (fver)
int wversion; //Version of the generation code that made the file. (Equivalent to fgen)
int natoms, ngtc; //This is the TOTAL number of atoms.
float boxdims[9];
char *symtab;//Looks like internal gromacs names. Truncate to 8 charachters for storage
//(longer ones aren't related to atom names, types or residues)
int symtablen, nmoltypes, nmolblock;
int *atomsinmol, *resinmol;
int *molnames;
float **charges, **masses;
int **resids, **ptypes;
unsigned short **types;
int **atomnameids, **atomtypeids, **resnames, **atomicnumbers;
int **interactionlist[F_NRE];
int *nr[F_NRE];
int *molbtype, *molbnmol, *molbnatoms;
md_file *mf;
int has_velocities;
int readcoordinates;
};
//From tpxio.c
typedef struct {
int fvnr; /* file version number in which the function type first appeared */
int ftype; /* function type */
} t_ftupd;
static const t_ftupd ftupd[] = {
{ 20, F_CUBICBONDS },
{ 20, F_CONNBONDS },
{ 20, F_HARMONIC },
{ 34, F_FENEBONDS },
{ 43, F_TABBONDS },
{ 43, F_TABBONDSNC },
{ 70, F_RESTRBONDS },
{ 98, F_RESTRANGLES },
{ 76, F_LINEAR_ANGLES },
{ 30, F_CROSS_BOND_BONDS },
{ 30, F_CROSS_BOND_ANGLES },
{ 30, F_UREY_BRADLEY },
{ 34, F_QUARTIC_ANGLES },
{ 43, F_TABANGLES },
{ 98, F_RESTRDIHS },
{ 98, F_CBTDIHS },
{ 26, F_FOURDIHS },
{ 26, F_PIDIHS },
{ 43, F_TABDIHS },
{ 65, F_CMAP },
{ 60, F_GB12 },
{ 61, F_GB13 },
{ 61, F_GB14 },
{ 72, F_GBPOL },
{ 72, F_NPSOLVATION },
{ 41, F_LJC14_Q },
{ 41, F_LJC_PAIRS_NB },
{ 32, F_BHAM_LR },
{ 32, F_RF_EXCL },
{ 32, F_COUL_RECIP },
{ 93, F_LJ_RECIP },
{ 46, F_DPD },
{ 30, F_POLARIZATION },
{ 36, F_THOLE_POL },
{ 90, F_FBPOSRES },
{ 22, F_DISRESVIOL },
{ 22, F_ORIRES },
{ 22, F_ORIRESDEV },
{ 26, F_DIHRES },
{ 26, F_DIHRESVIOL },
{ 49, F_VSITE4FDN },
{ 50, F_VSITEN },
{ 46, F_COM_PULL },
{ 20, F_EQM },
{ 46, F_ECONSERVED },
{ 69, F_VTEMP},
{ 66, F_PDISPCORR },
{ 54, F_DVDL_CONSTR },
{ 76, F_ANHARM_POL },
{ 79, F_DVDL_COUL },
{ 79, F_DVDL_VDW },
{ 79, F_DVDL_BONDED },
{ 79, F_DVDL_RESTRAINT },
{ 79, F_DVDL_TEMPERATURE },
{ 117, F_DENSITYFITTING },
{ 118, F_VSITE2FD },
{ 121, F_VSITE1 }
};
#define asize(a) ((int)(sizeof(a)/sizeof((a)[0])))
#define NFTUPD asize(ftupd)
void readparams (md_file *mf, int file_version, int ftype) {
switch (ftype)
{
case F_ANGLES:
case F_G96ANGLES:
case F_BONDS:
case F_G96BONDS:
case F_HARMONIC:
case F_IDIHS:
//Read the 4 required harmonics.
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_RESTRANGLES:
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_LINEAR_ANGLES:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_FENEBONDS:
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_RESTRBONDS:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_TABBONDS:
case F_TABBONDSNC:
case F_TABANGLES:
case F_TABDIHS:
trx_real(mf, NULL);
trx_int(mf, NULL);
trx_real(mf, NULL);
break;
case F_CROSS_BOND_BONDS:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_CROSS_BOND_ANGLES:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_UREY_BRADLEY:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
if (file_version >= 79)
{
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
}
break;
case F_QUARTIC_ANGLES:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_BHAM:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_MORSE:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
if (file_version >= 79)
{
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
}
break;
case F_CUBICBONDS:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_CONNBONDS:
break;
case F_POLARIZATION:
trx_real(mf, NULL);
break;
case F_ANHARM_POL:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_WATER_POL:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_THOLE_POL:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_LJ:
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_LJ14:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_LJC14_Q:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_LJC_PAIRS_NB:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_PDIHS:
case F_PIDIHS:
case F_ANGRES:
case F_ANGRESZ:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_int(mf, NULL);
break;
case F_RESTRDIHS:
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_DISRES:
trx_int(mf, NULL);
trx_int(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_ORIRES:
trx_int(mf, NULL);
trx_int(mf, NULL);
trx_int(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_DIHRES:
if (file_version < 82)
{
trx_int(mf, NULL);
trx_int(mf, NULL);
}
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
if (file_version >= 82)
{
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
}
break;
case F_POSRES:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_FBPOSRES:
trx_int(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_CBTDIHS:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_RBDIHS:
case F_FOURDIHS:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_CONSTR:
case F_CONSTRNC:
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_SETTLE:
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_VSITE1: break; //VSite1 has no parameters
case F_VSITE2FD:
case F_VSITE2:
trx_real(mf, NULL);
break;
case F_VSITE3:
case F_VSITE3FD:
case F_VSITE3FAD:
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_VSITE3OUT:
case F_VSITE4FD:
case F_VSITE4FDN:
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
break;
case F_VSITEN:
trx_int(mf, NULL);
trx_real(mf, NULL);
break;
case F_GB12:
case F_GB13:
case F_GB14:
/* We got rid of some parameters in version 68 */
if (file_version < 68)
{
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
}
if (file_version < 113)
{
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
trx_real(mf, NULL);
}
break;
case F_CMAP:
trx_int(mf, NULL);
trx_int(mf, NULL);
break;
}
}