Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

DumpBench.h File Reference

Go to the source code of this file.

Functions

int dumpbench (FILE *)


Function Documentation

int dumpbench FILE *  file  ) 
 

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 27 of file DumpBench.C.

References LJTable::TableEntry::A, Angle, angle::angle_type, AtomSignature::angleCnt, AtomSignature::angleSigs, improper::atom2, dihedral::atom2, angle::atom2, bond::atom2, improper::atom3, dihedral::atom3, angle::atom3, improper::atom4, dihedral::atom4, CompAtom::atomFixed, Molecule::atomvdwtype(), LJTable::TableEntry::B, Bond, bond::bond_type, AtomSignature::bondCnt, AtomSignature::bondSigs, CompAtom::charge, computeNonbondedPairType, Dihedral, dihedral::dihedral_type, AtomSignature::dihedralCnt, AtomSignature::dihedralSigs, ExclusionCheck::flags, FullAtomList, Molecule::get_angle(), Molecule::get_angles_for_atom(), Molecule::get_bond(), Molecule::get_bonds_for_atom(), Molecule::get_dihedral(), Molecule::get_dihedrals_for_atom(), Molecule::get_excl_check_for_atom(), Molecule::get_improper(), Molecule::get_impropers_for_atom(), LJTable::get_table(), LJTable::get_table_dim(), HomePatch::getAtomList(), Patch::getNumAtoms(), CompAtom::groupFixed, PatchMap::homePatch(), CompAtom::hydrogenGroupSize, CompAtom::id, Improper, improper::improper_type, AtomSignature::improperCnt, AtomSignature::improperSigs, Index, ExclusionCheck::max, ExclusionCheck::min, Node::molecule, CompAtom::nonbondedGroupIsAtom, Molecule::numAngles, Molecule::numAtoms, Molecule::numBonds, Molecule::numCalcAngles, Molecule::numCalcBonds, Molecule::numCalcDihedrals, Molecule::numCalcExclusions, Molecule::numCalcImpropers, ComputeMap::numComputes(), Molecule::numDihedrals, Molecule::numImpropers, PatchMap::numPatches(), ComputeMap::Object(), PatchMap::Object(), Node::Object(), ComputeMap::partition(), CompAtom::partition, ComputeMap::pid(), CompAtom::position, Node::simParameters, simParams, ComputeMap::trans(), TupleSignature::tupleParamType, ComputeMap::type(), Vector::x, Vector::y, and Vector::z.

00027                           {
00028 
00029   Node *node = Node::Object();
00030 
00031   fprintf(file,"SIMPARAMETERS_BEGIN\n");
00032 
00033   SimParameters *simParams = node->simParameters;
00034 
00035 #define SIMPARAM(T,N,V) dump_param(file,#N,simParams->N)
00036 #include "DumpBenchParams.h"
00037 #undef SIMPARAM
00038 
00039   fprintf(file,"SIMPARAMETERS_END\n");
00040 
00041   fprintf(file,"LJTABLE_BEGIN\n");
00042 
00043   const LJTable *ljTable = ComputeNonbondedUtil::ljTable;
00044 
00045   int table_dim = ljTable->get_table_dim();
00046   fprintf(file,"%d\n",table_dim);
00047 
00048   const LJTable::TableEntry *table = ljTable->get_table();
00049   int i,j;
00050   for ( i=0; i < table_dim; ++i) {
00051     for ( j=i; j < table_dim; ++j)
00052     {
00053       const LJTable::TableEntry *curij = &(table[2*(i*table_dim+j)]);
00054       fprintf(file,"%g %g %g %g\n",curij->A,curij->B,
00055                                 (curij+1)->A,(curij+1)->B);
00056     }
00057   }
00058 
00059   fprintf(file,"LJTABLE_END\n");
00060 
00061   fprintf(file,"MOLECULE_BEGIN\n");
00062 
00063   const Molecule *mol = node->molecule;
00064 
00065   fprintf(file,"%d %d\n",mol->numAtoms,mol->numCalcExclusions);
00066  
00067   for ( i=0; i<mol->numAtoms; ++i) {
00068     int vdw = mol->atomvdwtype(i);
00069     #ifdef MEM_OPT_VERSION
00070     Index exclIdx = mol->getAtomExclSigId(i);
00071     const ExclusionCheck *excl = mol->get_excl_check_for_idx(exclIdx);
00072     if(excl->flags==NULL || excl->flags == (char *)-1){
00073         fprintf(file,"%d: %d ====\n",i, vdw);
00074         continue;
00075     }
00076     int min = i+excl->min;
00077     int max = i+excl->max;
00078     #else
00079     const ExclusionCheck *excl = mol->get_excl_check_for_atom(i);
00080     if(excl->flags==NULL || excl->flags == (char *)-1){
00081         fprintf(file,"%d: %d ====\n",i, vdw);
00082         continue;
00083     }
00084     int min = excl->min;
00085     int max = excl->max;
00086     #endif
00087     fprintf(file,"%d: %d %d %d |",i,vdw,min,max);
00088     if ( min <= max ) {
00089       int s = max - min + 1;
00090       const char *f = excl->flags;
00091       for ( int k=0; k<s; ++k ) {
00092         int fk = f[k];
00093         fprintf(file," %d",fk);
00094       }
00095     }
00096     fprintf(file,"\n");
00097   }
00098 
00099   fprintf(file,"MOLECULE_END\n");
00100 
00101   fprintf(file, "BONDS_BEGIN\n");
00102   fprintf(file, "%d %d\n", mol->numBonds, mol->numCalcBonds);
00103 #ifdef MEM_OPT_VERSION
00104   for(i=0; i<mol->numAtoms; i++){
00105       int sigId = node->molecule->getAtomSigId(i);
00106       AtomSignature *sig = &(mol->atomSigPool[sigId]);
00107       if(sig->bondCnt==0){
00108           fprintf(file, "%d: ===\n", i);
00109           continue;
00110       }
00111       fprintf(file, "%d:", i);
00112       for(j=0; j<sig->bondCnt; j++){
00113           fprintf(file, " (%d | %d)", (sig->bondSigs[j]).offset[0], sig->bondSigs[j].tupleParamType);
00114       }
00115       fprintf(file, "\n");
00116   }
00117 #else
00118   for(i=0; i<mol->numAtoms; i++){      
00119       int *p = node->molecule->get_bonds_for_atom(i);      
00120       if(*p==-1){
00121           fprintf(file, "%d: ===\n", i);
00122           continue;
00123       }
00124       fprintf(file, "%d:", i);
00125       for(; *p!=-1;p++){
00126           Bond *t = mol->get_bond(*p);
00127           fprintf(file, " (%d | %d)", t->atom2-i, t->bond_type);
00128       }
00129       fprintf(file, "\n");
00130   }
00131 #endif
00132   fprintf(file, "BONDS_END\n");
00133 
00134   fprintf(file, "ANGLES_BEGIN\n");
00135   fprintf(file, "%d %d\n", mol->numAngles, mol->numCalcAngles);
00136 #ifdef MEM_OPT_VERSION
00137   for(i=0; i<mol->numAtoms; i++){
00138       int sigId = node->molecule->getAtomSigId(i);
00139       AtomSignature *sig = &(mol->atomSigPool[sigId]);
00140       if(sig->angleCnt==0){
00141           fprintf(file, "%d: ===\n", i);
00142           continue;
00143       }
00144       fprintf(file, "%d:", i);
00145       for(j=0; j<sig->angleCnt; j++){
00146           int offset0 = (sig->angleSigs[j]).offset[0];
00147           int offset1 = (sig->angleSigs[j]).offset[1];
00148           fprintf(file, " (%d, %d | %d)", offset0, offset1, sig->angleSigs[j].tupleParamType);
00149       }
00150       fprintf(file, "\n");
00151   }
00152 #else
00153   for(i=0; i<mol->numAtoms; i++){      
00154       int *p = node->molecule->get_angles_for_atom(i);      
00155       if(*p==-1){
00156           fprintf(file, "%d: ===\n", i);
00157           continue;
00158       }
00159       fprintf(file, "%d:", i);
00160       for(; *p!=-1;p++){
00161           Angle *t = mol->get_angle(*p);
00162           int offset0 = t->atom2 - i;
00163           int offset1 = t->atom3 - i;
00164           fprintf(file, " (%d, %d | %d)", offset0, offset1, t->angle_type);
00165       }
00166       fprintf(file, "\n");
00167   }
00168 #endif
00169   fprintf(file, "ANGLES_END\n");
00170 
00171   fprintf(file, "DIHEDRALS_BEGIN\n");
00172   fprintf(file, "%d %d\n", mol->numDihedrals, mol->numCalcDihedrals);
00173 #ifdef MEM_OPT_VERSION
00174   for(i=0; i<mol->numAtoms; i++){
00175       int sigId = node->molecule->getAtomSigId(i);
00176       AtomSignature *sig = &(mol->atomSigPool[sigId]);
00177       if(sig->dihedralCnt==0){
00178           fprintf(file, "%d: ===\n", i);
00179           continue;
00180       }
00181       fprintf(file, "%d:", i);
00182       for(j=0; j<sig->dihedralCnt; j++){
00183           int offset0 = (sig->dihedralSigs[j]).offset[0];
00184           int offset1 = (sig->dihedralSigs[j]).offset[1];
00185           int offset2 = (sig->dihedralSigs[j]).offset[2];
00186           fprintf(file, " (%d, %d, %d | %d)", offset0, offset1, offset2, sig->dihedralSigs[j].tupleParamType);
00187       }
00188       fprintf(file, "\n");
00189   }
00190 #else
00191   for(i=0; i<mol->numAtoms; i++){      
00192       int *p = node->molecule->get_dihedrals_for_atom(i);      
00193       if(*p==-1){
00194           fprintf(file, "%d: ===\n", i);
00195           continue;
00196       }
00197       fprintf(file, "%d:", i);
00198       for(; *p!=-1;p++){
00199           Dihedral *t = mol->get_dihedral(*p);
00200           int offset0 = t->atom2 - i;
00201           int offset1 = t->atom3 - i;
00202           int offset2 = t->atom4 - i;
00203           fprintf(file, " (%d, %d, %d | %d)", offset0, offset1, offset2, t->dihedral_type);
00204       }
00205       fprintf(file, "\n");
00206   }
00207 #endif
00208   fprintf(file, "DIHEDRALS_END\n");
00209 
00210   fprintf(file, "IMPROPERS_BEGIN\n");
00211   fprintf(file, "%d %d\n", mol->numImpropers, mol->numCalcImpropers);
00212 #ifdef MEM_OPT_VERSION
00213   for(i=0; i<mol->numAtoms; i++){
00214       int sigId = node->molecule->getAtomSigId(i);
00215       AtomSignature *sig = &(mol->atomSigPool[sigId]);
00216       if(sig->improperCnt==0){
00217           fprintf(file, "%d: ===\n", i);
00218           continue;
00219       }
00220       fprintf(file, "%d:", i);
00221       for(j=0; j<sig->improperCnt; j++){
00222           int offset0 = (sig->improperSigs[j]).offset[0];
00223           int offset1 = (sig->improperSigs[j]).offset[1];
00224           int offset2 = (sig->improperSigs[j]).offset[2];
00225           fprintf(file, " (%d, %d, %d | %d)", offset0, offset1, offset2, sig->improperSigs[j].tupleParamType);
00226       }
00227       fprintf(file, "\n");
00228   }
00229 #else
00230   for(i=0; i<mol->numAtoms; i++){      
00231       int *p = node->molecule->get_impropers_for_atom(i);      
00232       if(*p==-1){
00233           fprintf(file, "%d: ===\n", i);
00234           continue;
00235       }
00236       fprintf(file, "%d:", i);
00237       for(; *p!=-1;p++){
00238           Improper *t = mol->get_improper(*p);
00239           int offset0 = t->atom2 - i;
00240           int offset1 = t->atom3 - i;
00241           int offset2 = t->atom4 - i;
00242           fprintf(file, " (%d, %d, %d | %d)", offset0, offset1, offset2, t->improper_type);
00243       }
00244       fprintf(file, "\n");
00245   }
00246 #endif
00247   fprintf(file, "IMPROPERS_END\n");
00248 
00249   fprintf(file,"PATCHLIST_BEGIN\n");
00250 
00251   PatchMap *patchMap = PatchMap::Object();
00252   int numPatches = patchMap->numPatches();
00253   fprintf(file,"%d\n",numPatches);
00254 
00255   for ( i=0; i<numPatches; ++i) {
00256     HomePatch *patch = patchMap->homePatch(i);
00257     fprintf(file,"PATCH_BEGIN\n");
00258     int numAtoms = patch->getNumAtoms();
00259     fprintf(file,"%d\n",numAtoms);
00260     FullAtomList &atoms = patch->getAtomList();
00261     for ( j=0; j<numAtoms; ++j) {
00262       CompAtom &a = atoms[j];
00263       double x,y,z,q;
00264       int id,hgs,ngia,af,gf,part;
00265       x = a.position.x;
00266       y = a.position.y;
00267       z = a.position.z;
00268       q = a.charge;
00269       id = a.id;
00270       hgs = a.hydrogenGroupSize;
00271       ngia = a.nonbondedGroupIsAtom;
00272       af = a.atomFixed;
00273       gf = a.groupFixed;
00274       part = a.partition;
00275       fprintf(file,"%f %f %f %f %d %d %d %d %d %d\n",
00276         x,y,z,q,id,hgs,ngia,af,gf,part);
00277     }
00278     fprintf(file,"PATCH_END\n");
00279   }
00280 
00281   fprintf(file,"PATCHLIST_END\n");
00282 
00283   fprintf(file,"COMPUTEPAIR_BEGIN\n");
00284 
00285   ComputeMap *computeMap = ComputeMap::Object();
00286   int numComputes = computeMap->numComputes();
00287   int numPairComputes = 0;
00288   for ( i=0; i<numComputes; ++i) {
00289     if ( computeMap->type(i) == computeNonbondedPairType
00290          && computeMap->partition(i) == 0 ) ++numPairComputes;
00291   }
00292   fprintf(file,"%d\n",numPairComputes);
00293   for ( i=0; i<numComputes; ++i) {
00294     if ( computeMap->type(i) == computeNonbondedPairType
00295          && computeMap->partition(i) == 0 ) {
00296       int pid1 = computeMap->pid(i,0);
00297       int trans1 = computeMap->trans(i,0);
00298       int pid2 = computeMap->pid(i,1);
00299       int trans2 = computeMap->trans(i,1);
00300       fprintf(file,"%d %d %d %d\n",pid1,trans1,pid2,trans2);
00301     }
00302   }
00303 
00304   fprintf(file,"COMPUTEPAIR_END\n");
00305 
00306   return 0;
00307 }


Generated on Sun Sep 7 04:07:42 2008 for NAMD by  doxygen 1.3.9.1