Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

tprplugin.h

Go to the documentation of this file.
00001 /*
00002 Header that describes what is all *in* a tpr file, defining energies,
00003 force terms, and other stuff that we need to be interoperable with a tpr.
00004 */
00005 
00006 //From topology/topology.h
00007 enum {
00008     egcTC,    egcENER,   egcACC, egcFREEZE,
00009     egcUser1, egcUser2,  egcVCM, egcCompressedX,
00010     egcORFIT, egcQMMM,
00011     egcNR
00012 };
00013 
00014 //From topology/ifunc.h
00015 enum
00016 {
00017     F_BONDS,
00018     F_G96BONDS,
00019     F_MORSE,
00020     F_CUBICBONDS,
00021     F_CONNBONDS,
00022     F_HARMONIC,
00023     F_FENEBONDS,
00024     F_TABBONDS,
00025     F_TABBONDSNC,
00026     F_RESTRBONDS,
00027     F_ANGLES,
00028     F_G96ANGLES,
00029     F_RESTRANGLES,
00030     F_LINEAR_ANGLES,
00031     F_CROSS_BOND_BONDS,
00032     F_CROSS_BOND_ANGLES,
00033     F_UREY_BRADLEY,
00034     F_QUARTIC_ANGLES,
00035     F_TABANGLES,
00036     F_PDIHS,
00037     F_RBDIHS,
00038     F_RESTRDIHS,
00039     F_CBTDIHS,
00040     F_FOURDIHS,
00041     F_IDIHS,
00042     F_PIDIHS,
00043     F_TABDIHS,
00044     F_CMAP,
00045     F_GB12,
00046     F_GB13,
00047     F_GB14,
00048     F_GBPOL,
00049     F_NPSOLVATION,
00050     F_LJ14,
00051     F_COUL14,
00052     F_LJC14_Q,
00053     F_LJC_PAIRS_NB,
00054     F_LJ,
00055     F_BHAM,
00056     F_LJ_LR,
00057     F_BHAM_LR,
00058     F_DISPCORR,
00059     F_COUL_SR,
00060     F_COUL_LR,
00061     F_RF_EXCL,
00062     F_COUL_RECIP,
00063     F_LJ_RECIP,
00064     F_DPD,
00065     F_POLARIZATION,
00066     F_WATER_POL,
00067     F_THOLE_POL,
00068     F_ANHARM_POL,
00069     F_POSRES,
00070     F_FBPOSRES,
00071     F_DISRES,
00072     F_DISRESVIOL,
00073     F_ORIRES,
00074     F_ORIRESDEV,
00075     F_ANGRES,
00076     F_ANGRESZ,
00077     F_DIHRES,
00078     F_DIHRESVIOL,
00079     F_CONSTR,
00080     F_CONSTRNC,
00081     F_SETTLE,
00082     F_VSITE1,
00083     F_VSITE2,
00084     F_VSITE2FD,
00085     F_VSITE3,
00086     F_VSITE3FD,
00087     F_VSITE3FAD,
00088     F_VSITE3OUT,
00089     F_VSITE4FD,
00090     F_VSITE4FDN,
00091     F_VSITEN,
00092     F_COM_PULL,
00093     F_DENSITYFITTING,
00094     F_EQM,
00095     F_EPOT,
00096     F_EKIN,
00097     F_ETOT,
00098     F_ECONSERVED,
00099     F_TEMP,
00100     F_VTEMP,
00101     F_PDISPCORR,
00102     F_PRES,
00103     F_DVDL_CONSTR,
00104     F_DVDL,
00105     F_DKDL,
00106     F_DVDL_COUL,
00107     F_DVDL_VDW,
00108     F_DVDL_BONDED,
00109     F_DVDL_RESTRAINT,
00110     F_DVDL_TEMPERATURE, /* not calculated for now, but should just be the energy (NVT) or enthalpy (NPT), or 0 (NVE) */
00111     F_NRE /* This number is for the total number of energies      */
00112 };
00113 
00114 //This holds the meat and potatoes, the results after extracting all the topology info from the tpr file.
00115 struct tprdata {
00116     int precision;
00117     int version; //Version of the file format (fver)
00118     int wversion; //Version of the generation code that made the file. (Equivalent to fgen)
00119     int natoms, ngtc; //This is the TOTAL number of atoms.
00120     float boxdims[9];
00121     char *symtab;//Looks like internal gromacs names. Truncate to 8 charachters for storage
00122     //(longer ones aren't related to atom names, types or residues)
00123     int symtablen, nmoltypes, nmolblock;
00124     int *atomsinmol, *resinmol;
00125     int *molnames;
00126     float **charges, **masses;
00127     int **resids, **ptypes;
00128     unsigned short **types;
00129     int **atomnameids, **atomtypeids, **resnames, **atomicnumbers;
00130     int **interactionlist[F_NRE];
00131     int *nr[F_NRE];
00132     int *molbtype, *molbnmol, *molbnatoms;
00133     md_file *mf;
00134     int has_velocities;
00135     int readcoordinates;
00136 };
00137 
00138 //From tpxio.c
00139 typedef struct {
00140     int fvnr;  /* file version number in which the function type first appeared */
00141     int ftype; /* function type */
00142 } t_ftupd;
00143 static const t_ftupd ftupd[] = {
00144     { 20, F_CUBICBONDS        },
00145     { 20, F_CONNBONDS         },
00146     { 20, F_HARMONIC          },
00147     { 34, F_FENEBONDS         },
00148     { 43, F_TABBONDS          },
00149     { 43, F_TABBONDSNC        },
00150     { 70, F_RESTRBONDS        },
00151     { 98, F_RESTRANGLES },
00152     { 76, F_LINEAR_ANGLES     },
00153     { 30, F_CROSS_BOND_BONDS  },
00154     { 30, F_CROSS_BOND_ANGLES },
00155     { 30, F_UREY_BRADLEY      },
00156     { 34, F_QUARTIC_ANGLES    },
00157     { 43, F_TABANGLES         },
00158     { 98, F_RESTRDIHS },
00159     { 98, F_CBTDIHS },
00160     { 26, F_FOURDIHS          },
00161     { 26, F_PIDIHS            },
00162     { 43, F_TABDIHS           },
00163     { 65, F_CMAP              },
00164     { 60, F_GB12              },
00165     { 61, F_GB13              },
00166     { 61, F_GB14              },
00167     { 72, F_GBPOL             },
00168     { 72, F_NPSOLVATION       },
00169     { 41, F_LJC14_Q           },
00170     { 41, F_LJC_PAIRS_NB      },
00171     { 32, F_BHAM_LR           },
00172     { 32, F_RF_EXCL           },
00173     { 32, F_COUL_RECIP        },
00174     { 93, F_LJ_RECIP          },
00175     { 46, F_DPD               },
00176     { 30, F_POLARIZATION      },
00177     { 36, F_THOLE_POL         },
00178     { 90, F_FBPOSRES          },
00179     { 22, F_DISRESVIOL        },
00180     { 22, F_ORIRES            },
00181     { 22, F_ORIRESDEV         },
00182     { 26, F_DIHRES            },
00183     { 26, F_DIHRESVIOL        },
00184     { 49, F_VSITE4FDN         },
00185     { 50, F_VSITEN            },
00186     { 46, F_COM_PULL          },
00187     { 20, F_EQM               },
00188     { 46, F_ECONSERVED        },
00189     { 69, F_VTEMP},
00190     { 66, F_PDISPCORR         },
00191     { 54, F_DVDL_CONSTR       },
00192     { 76, F_ANHARM_POL        },
00193     { 79, F_DVDL_COUL         },
00194     { 79, F_DVDL_VDW         },
00195     { 79, F_DVDL_BONDED      },
00196     { 79, F_DVDL_RESTRAINT    },
00197     { 79, F_DVDL_TEMPERATURE  },
00198     { 117, F_DENSITYFITTING },
00199     { 118, F_VSITE2FD },
00200     { 121, F_VSITE1 }
00201 };
00202 #define asize(a) ((int)(sizeof(a)/sizeof((a)[0])))
00203 #define NFTUPD asize(ftupd)
00204 
00205 void readparams (md_file *mf, int file_version, int ftype) {
00206     switch (ftype)
00207     {
00208         case F_ANGLES:
00209         case F_G96ANGLES:
00210         case F_BONDS:
00211         case F_G96BONDS:
00212         case F_HARMONIC:
00213         case F_IDIHS:
00214             //Read the 4 required harmonics.
00215             trx_real(mf, NULL);
00216             trx_real(mf, NULL);
00217             trx_real(mf, NULL);
00218             trx_real(mf, NULL);
00219             break;
00220         case F_RESTRANGLES:
00221             trx_real(mf, NULL);
00222             trx_real(mf, NULL);
00223             break;
00224         case F_LINEAR_ANGLES:
00225             trx_real(mf, NULL);
00226             trx_real(mf, NULL);
00227             trx_real(mf, NULL);
00228             trx_real(mf, NULL);
00229             break;
00230         case F_FENEBONDS:
00231             trx_real(mf, NULL);
00232             trx_real(mf, NULL);
00233             break;
00234         case F_RESTRBONDS:
00235             trx_real(mf, NULL);
00236             trx_real(mf, NULL);
00237             trx_real(mf, NULL);
00238             trx_real(mf, NULL);
00239             trx_real(mf, NULL);
00240             trx_real(mf, NULL);
00241             trx_real(mf, NULL);
00242             trx_real(mf, NULL);
00243             break;
00244         case F_TABBONDS:
00245         case F_TABBONDSNC:
00246         case F_TABANGLES:
00247         case F_TABDIHS:
00248             trx_real(mf, NULL);
00249             trx_int(mf, NULL);
00250             trx_real(mf, NULL);
00251             break;
00252         case F_CROSS_BOND_BONDS:
00253             trx_real(mf, NULL);
00254             trx_real(mf, NULL);
00255             trx_real(mf, NULL);
00256             break;
00257         case F_CROSS_BOND_ANGLES:
00258             trx_real(mf, NULL);
00259             trx_real(mf, NULL);
00260             trx_real(mf, NULL);
00261             trx_real(mf, NULL);
00262             break;
00263         case F_UREY_BRADLEY:
00264             trx_real(mf, NULL);
00265             trx_real(mf, NULL);
00266             trx_real(mf, NULL);
00267             trx_real(mf, NULL);
00268             if (file_version >= 79)
00269             {
00270                 trx_real(mf, NULL);
00271                 trx_real(mf, NULL);
00272                 trx_real(mf, NULL);
00273                 trx_real(mf, NULL);
00274             }
00275             break;
00276         case F_QUARTIC_ANGLES:
00277             trx_real(mf, NULL);
00278             trx_real(mf, NULL);
00279             trx_real(mf, NULL);
00280             trx_real(mf, NULL);
00281             trx_real(mf, NULL);
00282             trx_real(mf, NULL);
00283             break;
00284         case F_BHAM:
00285             trx_real(mf, NULL);
00286             trx_real(mf, NULL);
00287             trx_real(mf, NULL);
00288             break;
00289         case F_MORSE:
00290             trx_real(mf, NULL);
00291             trx_real(mf, NULL);
00292             trx_real(mf, NULL);
00293             if (file_version >= 79)
00294             {
00295                 trx_real(mf, NULL);
00296                 trx_real(mf, NULL);
00297                 trx_real(mf, NULL);
00298             }
00299             break;
00300         case F_CUBICBONDS:
00301             trx_real(mf, NULL);
00302             trx_real(mf, NULL);
00303             trx_real(mf, NULL);
00304             break;
00305         case F_CONNBONDS:
00306             break;
00307         case F_POLARIZATION:
00308             trx_real(mf, NULL);
00309             break;
00310         case F_ANHARM_POL:
00311             trx_real(mf, NULL);
00312             trx_real(mf, NULL);
00313             trx_real(mf, NULL);
00314             break;
00315         case F_WATER_POL:
00316             trx_real(mf, NULL);
00317             trx_real(mf, NULL);
00318             trx_real(mf, NULL);
00319             trx_real(mf, NULL);
00320             trx_real(mf, NULL);
00321             trx_real(mf, NULL);
00322             break;
00323         case F_THOLE_POL:
00324             trx_real(mf, NULL);
00325             trx_real(mf, NULL);
00326             trx_real(mf, NULL);
00327             trx_real(mf, NULL);
00328             break;
00329         case F_LJ:
00330             trx_real(mf, NULL);
00331             trx_real(mf, NULL);
00332             break;
00333         case F_LJ14:
00334             trx_real(mf, NULL);
00335             trx_real(mf, NULL);
00336             trx_real(mf, NULL);
00337             trx_real(mf, NULL);
00338             break;
00339         case F_LJC14_Q:
00340             trx_real(mf, NULL);
00341             trx_real(mf, NULL);
00342             trx_real(mf, NULL);
00343             trx_real(mf, NULL);
00344             trx_real(mf, NULL);
00345             break;
00346         case F_LJC_PAIRS_NB:
00347             trx_real(mf, NULL);
00348             trx_real(mf, NULL);
00349             trx_real(mf, NULL);
00350             trx_real(mf, NULL);
00351             break;
00352         case F_PDIHS:
00353         case F_PIDIHS:
00354         case F_ANGRES:
00355         case F_ANGRESZ:
00356             trx_real(mf, NULL);
00357             trx_real(mf, NULL);
00358             trx_real(mf, NULL);
00359             trx_real(mf, NULL);
00360             trx_int(mf, NULL);
00361             break;
00362         case F_RESTRDIHS:
00363             trx_real(mf, NULL);
00364             trx_real(mf, NULL);
00365             break;
00366         case F_DISRES:
00367             trx_int(mf, NULL);
00368             trx_int(mf, NULL);
00369             trx_real(mf, NULL);
00370             trx_real(mf, NULL);
00371             trx_real(mf, NULL);
00372             trx_real(mf, NULL);
00373             break;
00374         case F_ORIRES:
00375             trx_int(mf, NULL);
00376             trx_int(mf, NULL);
00377             trx_int(mf, NULL);
00378             trx_real(mf, NULL);
00379             trx_real(mf, NULL);
00380             trx_real(mf, NULL);
00381             break;
00382         case F_DIHRES:
00383             if (file_version < 82)
00384             {
00385                 trx_int(mf, NULL);
00386                 trx_int(mf, NULL);
00387             }
00388             trx_real(mf, NULL);
00389             trx_real(mf, NULL);
00390             trx_real(mf, NULL);
00391             if (file_version >= 82)
00392             {
00393                 trx_real(mf, NULL);
00394                 trx_real(mf, NULL);
00395                 trx_real(mf, NULL);
00396             }
00397             break;
00398         case F_POSRES:
00399             trx_real(mf, NULL);
00400             trx_real(mf, NULL);
00401             trx_real(mf, NULL);
00402             trx_real(mf, NULL);
00403             trx_real(mf, NULL);
00404             trx_real(mf, NULL);
00405             trx_real(mf, NULL);
00406             trx_real(mf, NULL);
00407             trx_real(mf, NULL);
00408             trx_real(mf, NULL);
00409             trx_real(mf, NULL);
00410             trx_real(mf, NULL);
00411             break;
00412         case F_FBPOSRES:
00413             trx_int(mf, NULL);
00414             trx_real(mf, NULL);
00415             trx_real(mf, NULL);
00416             trx_real(mf, NULL);
00417             trx_real(mf, NULL);
00418             trx_real(mf, NULL);
00419             break;
00420         case F_CBTDIHS:
00421             trx_real(mf, NULL);
00422             trx_real(mf, NULL);
00423             trx_real(mf, NULL);
00424             trx_real(mf, NULL);
00425             trx_real(mf, NULL);
00426             trx_real(mf, NULL);
00427             break;
00428         case F_RBDIHS:
00429         case F_FOURDIHS:
00430             trx_real(mf, NULL);
00431             trx_real(mf, NULL);
00432             trx_real(mf, NULL);
00433             trx_real(mf, NULL);
00434             trx_real(mf, NULL);
00435             trx_real(mf, NULL);
00436             trx_real(mf, NULL);
00437             trx_real(mf, NULL);
00438             trx_real(mf, NULL);
00439             trx_real(mf, NULL);
00440             trx_real(mf, NULL);
00441             trx_real(mf, NULL);
00442             break;
00443         case F_CONSTR:
00444         case F_CONSTRNC:
00445             trx_real(mf, NULL);
00446             trx_real(mf, NULL);
00447             break;
00448         case F_SETTLE:
00449             trx_real(mf, NULL);
00450             trx_real(mf, NULL);
00451             break;
00452         case F_VSITE1: break; //VSite1 has no parameters
00453         case F_VSITE2FD:
00454         case F_VSITE2:
00455             trx_real(mf, NULL);
00456             break;
00457         case F_VSITE3:
00458         case F_VSITE3FD:
00459         case F_VSITE3FAD:
00460             trx_real(mf, NULL);
00461             trx_real(mf, NULL);
00462             break;
00463         case F_VSITE3OUT:
00464         case F_VSITE4FD:
00465         case F_VSITE4FDN:
00466             trx_real(mf, NULL);
00467             trx_real(mf, NULL);
00468             trx_real(mf, NULL);
00469             break;
00470         case F_VSITEN:
00471             trx_int(mf, NULL);
00472             trx_real(mf, NULL);
00473             break;
00474         case F_GB12:
00475         case F_GB13:
00476         case F_GB14:
00477             /* We got rid of some parameters in version 68 */
00478             if (file_version < 68)
00479             {
00480                 trx_real(mf, NULL);
00481                 trx_real(mf, NULL);
00482                 trx_real(mf, NULL);
00483                 trx_real(mf, NULL);
00484 
00485             }
00486             if (file_version < 113)
00487             {
00488                 trx_real(mf, NULL);
00489                 trx_real(mf, NULL);
00490                 trx_real(mf, NULL);
00491                 trx_real(mf, NULL);
00492                 trx_real(mf, NULL);
00493             }
00494             break;
00495         case F_CMAP:
00496             trx_int(mf, NULL);
00497             trx_int(mf, NULL);
00498             break;
00499     }
00500 }

Generated on Thu Mar 28 03:08:20 2024 for VMD Plugins (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002