NAMD
Classes | Macros | Functions
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 >
 

Macros

#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)
 

Macro Definition 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(), and outputCompressedFile().

Referenced by NamdState::loadStructure().

437 {
438  g_mol = mol;
439  g_param = param;
440  g_simParam = simParam; //used for building exclusions
441  g_cfgList = cfgList; //used for integrating extra bonds
442 
443  //read psf files
444  //readPsfFile(psfFileName);
445  loadMolInfo();
446 
448 
449  buildExclusions();
450 
451  //buildParamData();
452 
453  char *outFileName = new char[strlen(psfFileName)+20];
454  sprintf(outFileName, "%s.inter", psfFileName);
455  //the text file for signatures and other non-per-atom info
456  FILE *txtOfp = fopen(outFileName, "w");
457  sprintf(outFileName, "%s.inter.bin", psfFileName);
458  //the binary file for per-atom info
459  FILE *binOfp = fopen(outFileName, "wb");
460  delete [] outFileName;
461 
462  //output compressed psf file
463  outputCompressedFile(txtOfp, binOfp);
464 
465  fclose(txtOfp);
466  fclose(binOfp);
467 }
void buildExclusions()
Definition: CompressPsf.C:1197
void outputCompressedFile(FILE *txtOfp, FILE *binOfp)
Definition: CompressPsf.C:541
SimParameters * g_simParam
Definition: CompressPsf.C:34
void loadMolInfo()
Definition: CompressPsf.C:473
void integrateAllAtomSigs()
Definition: CompressPsf.C:505
Parameters * g_param
Definition: CompressPsf.C:33
Molecule * g_mol
Definition: CompressPsf.C:32
ConfigList * g_cfgList
Definition: CompressPsf.C:35
void flipNum ( char *  elem,
int  elemSize,
int  numElems 
)

Definition at line 406 of file CompressPsf.C.

Referenced by OutputAtomRecord::flip().

406  {
407  int mid = elemSize/2;
408  char *ptr = elem;
409  for(int i=0; i<numElems; i++) {
410  for(int j=0; j<mid; j++) {
411  char tmp = ptr[j];
412  ptr[j] = ptr[elemSize-1-j];
413  ptr[elemSize-1-j] = tmp;
414  }
415  ptr += elemSize;
416  }
417 }
template<typename T >
int lookupCstPool ( const std::vector< T > &  pool,
const T &  val 
)

Definition at line 56 of file CompressPsf.h.

Referenced by buildBondData().

57 {
58  for(int i=0; i<pool.size(); i++)
59  {
60  if(pool[i]==val)
61  return i;
62  }
63  return -1;
64 }