51     flipNum((
char *)&sSet, 
sizeof(
short), 
sizeof(sSet)/
sizeof(
short));
    52     flipNum((
char *)&iSet, 
sizeof(
int), 
sizeof(iSet)/
sizeof(
int));
    53     flipNum((
char *)&fSet, 
sizeof(
float), 
sizeof(fSet)/
sizeof(
float));
    68         bondSigIndices.clear();
    72         angleSigIndices.clear();
    76         dihedralSigIndices.clear();
    80         improperSigIndices.clear();
    84         crosstermSigIndices.clear();
    91         bondSigIndices.clear();
    92         angleSigIndices.clear();
    93         dihedralSigIndices.clear();
    94         improperSigIndices.clear();
    95         crosstermSigIndices.clear();
   100         sort(bondSigIndices.begin(), bondSigIndices.end());
   101         sort(angleSigIndices.begin(), angleSigIndices.end());
   102         sort(dihedralSigIndices.begin(), dihedralSigIndices.end());
   103         sort(improperSigIndices.begin(), improperSigIndices.end());
   104         sort(crosstermSigIndices.begin(), crosstermSigIndices.end());
   107     inline CkHashCode 
hash()
 const {
   114       const int maxlen = 32;
   115       unsigned char keydata[maxlen+1];
   116       const int maxchar = 256;
   118       for(j=0;j<=maxlen;j++) keydata[j] = 0;
   120       for(i=0; i<bondSigIndices.size(); i++,j++) {
   121         keydata[j % maxlen] ^= (bondSigIndices[i] % maxchar);
   123       for(i=0; i<angleSigIndices.size(); i++,j++) {
   124         keydata[j % maxlen] ^= (angleSigIndices[i] % maxchar);
   126       for(i=0; i<dihedralSigIndices.size(); i++,j++) {
   127         keydata[j % maxlen] ^= (dihedralSigIndices[i] % maxchar);
   129       for(i=0; i<improperSigIndices.size(); i++,j++) {
   130         keydata[j % maxlen] ^= (improperSigIndices[i] % maxchar);
   132       for(i=0; i<crosstermSigIndices.size(); i++,j++) {
   133         keydata[j % maxlen] ^= (crosstermSigIndices[i] % maxchar);
   136       if (j > maxlen) j = maxlen;
   142       return CkHashFunction_default((
const void*)keydata,(
size_t)j);
   162     for(
int i=0; i<bondSigCnt; i++)
   164     if(equalCnt!=bondSigCnt)
   169     for(
int i=0; i<angleSigCnt; i++)
   171     if(equalCnt!=angleSigCnt)
   176     for(
int i=0; i<dihedralSigCnt; i++)
   178     if(equalCnt!=dihedralSigCnt)
   183     for(
int i=0; i<improperSigCnt; i++)
   185     if(equalCnt!=improperSigCnt)
   190     for(
int i=0; i<crosstermSigCnt; i++)
   192     if(equalCnt!=crosstermSigCnt)
   207         fullExclOffset.clear();
   211         modExclOffset.clear();
   218         fullExclOffset.clear();
   219         modExclOffset.clear();
   224         sort(fullExclOffset.begin(), fullExclOffset.end());
   225         sort(modExclOffset.begin(), modExclOffset.end());
   229       unsigned int code = 0x1234;
   230       unsigned int codesz = 8 * 
sizeof(int);
   231       const unsigned int numFoffset = fullExclOffset.size();
   232       const unsigned int numMoffset = modExclOffset.size();
   233       const unsigned int numOffsets = numFoffset + numMoffset;
   239       unsigned int shift = codesz / numOffsets;
   240       if (shift == 0) shift=1;
   242       for(i=0; i < numFoffset; i++) {
   244         code ^= fullExclOffset[i];
   246       for(i=0; i < numMoffset; i++) {
   248         code ^= modExclOffset[i];
   277     const char* d = this->c_str();
   279     for (
int i=0;d[i]!=0;i++) {
   280       int shift1=((5*i)%16)+0;
   281       int shift2=((6*i)%16)+8;
   282       ret+=((0xa5^d[i])<<shift2)+(d[i]<<shift1);
   292   operator Real & () { 
return val; }
   293   operator const Real & () 
const { 
return val; }
   296     const char* d = (
const char *)&val;
   298     for (
int i=0;i < 
sizeof(
Real);i++) {
   299       int shift1=((5*i)%16)+0;
   300       int shift2=((6*i)%16)+8;
   301       ret+=((0xa5^d[i])<<shift2)+(d[i]<<shift1);
   345     return (b1.
k==b2.
k) && (b1.
x0==b2.
x0);
   406 void flipNum(
char *elem, 
int elemSize, 
int numElems){
   407     int mid = elemSize/2;
   409     for(
int i=0; i<numElems; i++) {
   410         for(
int j=0; j<mid; j++) {
   412             ptr[j] = ptr[elemSize-1-j];
   413             ptr[elemSize-1-j] = tmp;
   453     char *outFileName = 
new char[strlen(psfFileName)+20];
   454     sprintf(outFileName, 
"%s.inter", psfFileName);
   456     FILE *txtOfp = fopen(outFileName, 
"w");
   457     sprintf(outFileName, 
"%s.inter.bin", psfFileName);
   459     FILE *binOfp = fopen(outFileName, 
"wb");
   460     delete [] outFileName;
   507     printf(
"Bond sigs:  %d\n", (
int)
sigsOfBonds.size());
   526     printf(
"Atom's sigs: %d\n", (
int)
atomSigPool.size());
   543 #ifndef MEM_OPT_VERSION   546     fprintf(txtOfp, 
"%d !NSEGMENTNAMES\n", 
segNamePool.size());
   552     fprintf(txtOfp, 
"%d !NRESIDUENAMES\n", 
resNamePool.size());
   558     fprintf(txtOfp, 
"%d !NATOMNAMES\n", 
atomNamePool.size());
   564     fprintf(txtOfp, 
"%d !NATOMTYPES\n", 
atomTypePool.size());
   570     fprintf(txtOfp, 
"%d !NCHARGES\n", 
chargePool.size());
   574         fprintf(txtOfp, 
"%f\n", charge);
   577     fprintf(txtOfp, 
"%d !NMASSES\n", 
massPool.size());
   578     for(
int i=0; i<
massPool.size(); i++)
   581         fprintf(txtOfp, 
"%f\n", mass);
   585     fprintf(txtOfp, 
"%d !NATOMSIGS\n", 
atomSigPool.size());
   590         fprintf(txtOfp, 
"%d !%sSIGS\n", oneTypeCnt, 
"NBOND");
   591         for(
int j=0; j<oneTypeCnt; j++)
   599         fprintf(txtOfp, 
"%d !%sSIGS\n", oneTypeCnt, 
"NTHETA");
   600         for(
int j=0; j<oneTypeCnt; j++)
   608         fprintf(txtOfp, 
"%d !%sSIGS\n", oneTypeCnt, 
"NPHI");
   609         for(
int j=0; j<oneTypeCnt; j++)
   617         fprintf(txtOfp, 
"%d !%sSIGS\n", oneTypeCnt, 
"NIMPHI");
   618         for(
int j=0; j<oneTypeCnt; j++)
   626         fprintf(txtOfp, 
"%d !%sSIGS\n", oneTypeCnt, 
"NCRTERM");
   627         for(
int j=0; j<oneTypeCnt; j++)
   637     fprintf(txtOfp, 
"%d !NEXCLSIGS\n", exclSigCnt);
   638     for(
int i=0; i<exclSigCnt; i++)
   642         fprintf(txtOfp, 
"%lu", (
unsigned long) sig->
fullExclOffset.size());
   645         fprintf(txtOfp, 
"\n");
   648         fprintf(txtOfp, 
"%lu", (
unsigned long) sig->
modExclOffset.size());
   651         fprintf(txtOfp, 
"\n");
   669     fprintf(txtOfp, 
"%d !OCCUPANCYVALID\n", (atomOccupancy==NULL)?0:1);
   670     fprintf(txtOfp, 
"%d !TEMPFACTORVALID\n", (atomBFactor==NULL)?0:1);
   672     float *zeroFloats = NULL;
   673     if(atomOccupancy==NULL || atomBFactor==NULL) {
   676         if(atomOccupancy==NULL) atomOccupancy = (
const float *)zeroFloats;
   677         if(atomBFactor==NULL) atomBFactor = (
const float *)zeroFloats;
   686     fwrite(&magicNum, 
sizeof(
int), 1, binOfp);
   689     fwrite(&verNum, 
sizeof(
float), 1, binOfp);
   692     fwrite(&recSize, 
sizeof(
int), 1, binOfp);
   749     fprintf(txtOfp, 
"!DIHEDRALPARAMARRAY\n");
   754     fprintf(txtOfp, 
"\n");
   755     fprintf(txtOfp, 
"!IMPROPERPARAMARRAY\n");
   760     fprintf(txtOfp, 
"\n");
   766 #ifndef MEM_OPT_VERSION   775     for(
int atomID=0; atomID < numAtoms; atomID++)
   780         fieldName.assign(atomSegResids[atomID].segname);
   787         atomData[atomID].segNameIdx = poolIndex;
   791         fieldName.assign(atomNames[atomID].resname);
   798         atomData[atomID].resNameIdx = poolIndex;
   800         fieldName.assign(atomNames[atomID].atomname);
   807         atomData[atomID].atomNameIdx = poolIndex;
   809         fieldName.assign(atomNames[atomID].atomtype);
   816         atomData[atomID].atomTypeIdx = poolIndex;
   818         poolIndex = 
chargePool.lookupCstPool(atoms[atomID].charge);
   824         atomData[atomID].chargeIdx = poolIndex;
   826         poolIndex = 
massPool.lookupCstPool(atoms[atomID].mass);
   829             massPool.push_back(atoms[atomID].mass);
   832         atomData[atomID].massIdx = poolIndex;
   838     delete [] atomSegResids;
   845 #ifndef MEM_OPT_VERSION   871                 sprintf(err_msg, 
"Duplicate bond %d-%d!", b->
atom1+1, b->
atom2+1);
   882         int atom2 = b->
atom2;
   883         int thisOffset = atom2 - b->
atom1;
   888             if(thisOffset== -(secSig->
offset[0]))
   891                 sprintf(err_msg, 
"Duplicate bond %d-%d because two atoms are just reversed!", b->
atom1+1, atom2+1);
   899     vector<int> *atomListOfBonded = 
new vector<int>[
g_mol->
numAtoms];
   904         int atom1 = b->
atom1;
   905         int atom2 = b->
atom2;
   906         atomListOfBonded[atom1].push_back(atom2);
   907         atomListOfBonded[atom2].push_back(atom1);
   930         if(curClusterID!=-1) 
continue;
   933         deque<int> toVisitAtoms;
   935         toVisitAtoms.push_back(i);
   936         while(!toVisitAtoms.empty())
   938             int visAtomID = toVisitAtoms.front();
   939             toVisitAtoms.pop_front();
   940             for(
int j=0; j<atomListOfBonded[visAtomID].size(); j++)
   942                 int otherAtom = atomListOfBonded[visAtomID][j];
   945                     toVisitAtoms.push_back(otherAtom);
   979     int curClusterSize = 1;
   983         if(curClusterID == prevClusterID){
   990         prevClusterID = curClusterID;   
   998     g_isClusterContiguous = 1;    
  1003     newClusterIDs[0] = newCId;
  1006         if(curClusterID > prevClusterID){
  1007                 newClusterIDs[seg] = ++newCId;
  1008                 prevClusterID = curClusterID;
  1011                 g_isClusterContiguous = 0;
  1018                         int mid = (jl+jh)/2;
  1024                                 newClusterIDs[seg] = newClusterIDs[mid];                                
  1032                         sprintf(errmsg, 
"Assumption about building cluster is broken in file %s at line %d\n", __FILE__, __LINE__);
  1042     if(g_isClusterContiguous){
  1048             for(
int i=aid+1; i<aid+curSize; i++)
  1057             for(
int i=aid; i<aid+curSize; i++)
  1062     free(newClusterIDs);
  1076         atomListOfBonded[i].clear();
  1077     delete [] atomListOfBonded;
  1083 #ifndef MEM_OPT_VERSION  1088         Angle *tuple = angles+i;
  1109 #ifndef MEM_OPT_VERSION  1138 #ifndef MEM_OPT_VERSION  1167 #ifndef MEM_OPT_VERSION  1193   delete[] crossterms;
  1222     vector<int> *eachAtomNeighbors = 
new vector<int>[
g_mol->
numAtoms];   
  1229             if(!tSig->
isReal) 
continue;
  1230             int atom2 = atom1+tSig->
offset[0];
  1231             eachAtomNeighbors[atom1].push_back(atom2);
  1232             eachAtomNeighbors[atom2].push_back(atom1);
  1238         switch (exclude_flag)
  1271         eachAtomNeighbors[i].clear();
  1272     delete [] eachAtomNeighbors;
  1275     iout << 
iINFO << 
"ADDED " << allExclusions.
size() << 
" IMPLICIT EXCLUSIONS\n" << 
endi;
  1278     for(exclIter=exclIter.
begin(); exclIter!=exclIter.
end(); exclIter++)
  1280         int atom1 = exclIter->
atom1;
  1281         int atom2 = exclIter->
atom2;
  1282         int offset21 = atom2-atom1;
  1294     allExclusions.
clear();
  1307         atomData[i].exclSigIdx = poolIndex;
  1318         vector<int> *atom1List = &eachAtomNeighbors[atom1];
  1319         for(
int j=0; j<atom1List->size(); j++)
  1321             int atom2 = atom1List->at(j);
  1334         vector<int> *atom1List = &eachAtomNeighbors[atom1];
  1335         for(
int j=0; j<atom1List->size(); j++)
  1337             int atom2 = atom1List->at(j);
  1338             vector<int> *atom2List = &eachAtomNeighbors[atom2];
  1339             for(
int k=0; k<atom2List->size(); k++)
  1341                 int atom3 = atom2List->at(k);
  1358         vector<int> *atom1List = &eachAtomNeighbors[atom1];
  1359         for(
int j=0; j<atom1List->size(); j++)
  1361             int atom2 = atom1List->at(j);
  1362             vector<int> *atom2List = &eachAtomNeighbors[atom2];
  1363             for(
int k=0; k<atom2List->size(); k++)
  1365                 int atom3 = atom2List->at(k);
  1369                 vector<int> *atom3List = &eachAtomNeighbors[atom3];
  1370                 for(
int l=0; l<atom3List->size(); l++)
  1372                     int atom4 = atom3List->at(l);
  1374                     if(atom4 == atom2 || atom4 == atom1)
  1388   for(
int j=0; j < pool.size(); j++) {
  1390     CmiPrintf(
"Pool[%d]=%p %p  hash = %d\n",j,pool[j],pval,pval->
hash());
  1392   CkHashtableIterator *iter = index_table.iterator();
  1394   while (iter->hasNext()) {
  1395     indx = iter->next(&key);
  1397     CmiPrintf(
"key %p indx %p %d hash=%d\n",key,indx,*((
int *)indx),pkey->
hash());
 AtomSigInfo(const AtomSigInfo &sig)
 
std::ostream & iINFO(std::ostream &s)
 
vector< Bond > extraBonds
 
void flipNum(char *elem, int elemSize, int numElems)
 
#define COMPRESSED_PSF_MAGICNUM
 
vector< DihedralValue > extraDihedralParams
 
vector< Angle > extraAngles
 
Crossterm * getAllCrossterms() const
 
vector< Dihedral > extraDihedrals
 
std::ostream & endi(std::ostream &s)
 
void build14Excls(UniqueSet< Exclusion > &, vector< int > *, int)
 
void outputCompressedFile(FILE *txtOfp, FILE *binOfp)
 
Dihedral * getAllDihedrals() const
 
DihedralValue * dihedral_array
 
int add(const Elem &elem)
 
vector< SigIndex > crosstermSigIndices
 
Improper * getAllImpropers() const
 
vector< SigIndex > improperSigIndices
 
HashPool< TupleSignature > sigsOfAngles
 
Molecule stores the structural information for the system. 
 
SimParameters * g_simParam
 
vector< AngleValue > extraAngleParams
 
Bond * getAllBonds() const
 
ExclSigInfo(const ExclSigInfo &sig)
 
UniqueSetIter< T > begin(void) const
 
#define COMPRESSED_PSF_VER
 
HashPool< TupleSignature > sigsOfBonds
 
vector< ImproperValue > extraImproperParams
 
FourBodyConsts values[MAX_MULTIPLICITY]
 
HydrogenGroup hydrogenGroup
 
void integrateAllAtomSigs()
 
void setOffsets(int *offs)
 
Angle * getAllAngles() const
 
CkHashCode hash(void) const
 
void buildExclusionData()
 
vector< int > fullExclOffset
 
HashPool< ExclSigInfo > sigsOfExclusions
 
vector< BondValue > extraBondParams
 
const float * getBFactorData()
 
int lookupCstPool(const std::vector< T > &pool, const T &val)
 
HashPool< HashReal > chargePool
 
AtomSegResInfo * getAtomSegResInfo() const
 
vector< SigIndex > bondSigIndices
 
unsigned int circShift(unsigned int h, unsigned int by)
 
AtomSigInfo * eachAtomSigs
 
void clearGlobalVectors()
 
vector< int > eachClusterID
 
const float * getOccupancyData()
 
ImproperValue * improper_array
 
ExclSigInfo * eachAtomExclSigs
 
void NAMD_die(const char *err_msg)
 
UniqueSetIter< T > end(void) const
 
HashPool< HashString > atomNamePool
 
HashPool< TupleSignature > sigsOfImpropers
 
HashPool< HashString > resNamePool
 
int operator!=(const FourBodyConsts &f1, const FourBodyConsts &f2)
 
FourBodyConsts values[MAX_MULTIPLICITY]
 
int maxMigrationGroupSize
 
void compress_molecule_info(Molecule *mol, char *psfFileName, Parameters *param, SimParameters *simParam, ConfigList *cfgList)
 
struct OutputAtomRecord::floatVals fSet
 
void build13Excls(UniqueSet< Exclusion > &, vector< int > *)
 
vector< SigIndex > angleSigIndices
 
vector< int > eachClusterSize
 
int atomsInMigrationGroup
 
HashPool< TupleSignature > sigsOfCrossterms
 
struct OutputAtomRecord::integerVals iSet
 
void buildCrosstermData()
 
int atomsInMigrationGroup
 
vector< int > modExclOffset
 
AtomNameInfo * getAtomNames() const
 
HashPool< HashString > segNamePool
 
HashPool< HashString > atomTypePool
 
int operator==(const AtomSigInfo &s1, const AtomSigInfo &s2)
 
vector< Improper > extraImpropers
 
HashPool< TupleSignature > sigsOfDihedrals
 
void sortTupleSigIndices()
 
vector< SigIndex > dihedralSigIndices
 
void getExtraBonds(StringList *file)
 
ExclusionSettings exclude
 
void build12Excls(UniqueSet< Exclusion > &, vector< int > *)
 
HashPool< HashReal > massPool
 
struct OutputAtomRecord::shortVals sSet
 
Real rigid_bond_length(int atomnum) const
 
HashPool< AtomSigInfo > atomSigPool