CompressPsf.h File Reference

#include "structures.h"
#include <string>
#include <deque>
#include <ckhashtable.h>

Go to the source code of this file.

Classes

struct  OutputAtomRecord
struct  OutputAtomRecord::shortVals
struct  OutputAtomRecord::integerVals
struct  OutputAtomRecord::floatVals
class  HashPoolAdaptorT< T >
class  HashPool< T >

Defines

#define COMPRESSED_PSF_VER   1.72
#define COMPRESSED_PSF_MAGICNUM   1234

Functions

void compress_molecule_info (Molecule *mol, char *psfFileName, Parameters *param, SimParameters *simParam, ConfigList *cfgList)
void flipNum (char *elem, int elemSize, int numElems)
template<typename T>
int lookupCstPool (const std::vector< T > &pool, const T &val)


Define Documentation

#define COMPRESSED_PSF_MAGICNUM   1234

Definition at line 13 of file CompressPsf.h.

Referenced by outputCompressedFile().

#define COMPRESSED_PSF_VER   1.72

Definition at line 9 of file CompressPsf.h.

Referenced by outputCompressedFile().


Function Documentation

void compress_molecule_info ( Molecule mol,
char *  psfFileName,
Parameters param,
SimParameters simParam,
ConfigList cfgList 
)

Definition at line 436 of file CompressPsf.C.

References buildExclusions(), g_cfgList, g_mol, g_param, g_simParam, integrateAllAtomSigs(), loadMolInfo(), outputCompressedFile(), and param.

Referenced by NamdState::loadStructure().

00437 {
00438     g_mol = mol;
00439     g_param = param;
00440     g_simParam = simParam; //used for building exclusions
00441     g_cfgList = cfgList; //used for integrating extra bonds
00442 
00443     //read psf files
00444     //readPsfFile(psfFileName);
00445     loadMolInfo();
00446 
00447     integrateAllAtomSigs();
00448 
00449     buildExclusions();
00450 
00451     //buildParamData();
00452 
00453     char *outFileName = new char[strlen(psfFileName)+20];
00454     sprintf(outFileName, "%s.inter", psfFileName);
00455     //the text file for signatures and other non-per-atom info
00456     FILE *txtOfp = fopen(outFileName, "w");
00457     sprintf(outFileName, "%s.inter.bin", psfFileName);
00458     //the binary file for per-atom info
00459     FILE *binOfp = fopen(outFileName, "wb");
00460     delete [] outFileName;
00461 
00462     //output compressed psf file
00463     outputCompressedFile(txtOfp, binOfp);
00464 
00465     fclose(txtOfp);
00466     fclose(binOfp);
00467 }

void flipNum ( char *  elem,
int  elemSize,
int  numElems 
)

Definition at line 406 of file CompressPsf.C.

References j.

Referenced by OutputAtomRecord::flip().

00406                                                     {
00407     int mid = elemSize/2;
00408     char *ptr = elem;
00409     for(int i=0; i<numElems; i++) {
00410         for(int j=0; j<mid; j++) {
00411             char tmp = ptr[j];
00412             ptr[j] = ptr[elemSize-1-j];
00413             ptr[elemSize-1-j] = tmp;
00414         }
00415         ptr += elemSize;
00416     }
00417 }

template<typename T>
int lookupCstPool ( const std::vector< T > &  pool,
const T &  val 
)

Definition at line 56 of file CompressPsf.h.

Referenced by buildBondData().

00057 {
00058     for(int i=0; i<pool.size(); i++)
00059     {
00060         if(pool[i]==val)
00061             return i;
00062     }
00063     return -1;
00064 }


Generated on Mon Nov 20 01:17:15 2017 for NAMD by  doxygen 1.4.7