281,285d280
< 
<   // -WHan
<   dumExclusionsByAtom=NULL;
<   // -WHan
< 
349,352d343
<   // For exclusions involing dummy sites-WHan
<   numDumExclusions=0;
<   // -WHan
< 
624,628d614
<   // For exclusions of dummy sites -WHan
<   if (dumExclusionsByAtom != NULL)
<        delete [] dumExclusionsByAtom;
<   // -WHan
< 
998d983
<   // read_exclusions has been modified -WHan
1000,1031c985
<     read_exclusions(psf_file, numExclusions, 0);
<   // -WHan
< 
<   // -WHan
<   /*  look for the section of explicit non-bonded exclusions between spin labeled dummy sites.     */
<   if (simParams->doSpinLabel)
<   {
<    while (!NAMD_find_word(buffer, "NSL"))
<    {
<     ret_code = NAMD_read_line(psf_file, buffer);
< 
<     if (ret_code != 0)
<     {
<       NAMD_die("EOF ENCOUNTERED LOOKING FOR NSL (Exclusions between spin labels) IN PSF FILE");
<     }
<    }
< 
<   /*  Read in the number of exclusions and then the exclusions    */
<    sscanf(buffer, "%d", &numDumExclusions);
< 
<    if (numDumExclusions)
<    {
<     read_exclusions(psf_file, numDumExclusions, numExclusions);
<     numExclusions += numDumExclusions;
<   // Thus, the first numExclusions - numDumExclusions exclusions are
<   // full exclusions, follwoed by numDumExclusions exclusions for
<   // spin labels
<   // To add more types of exclusions, one can follow the same
<   // way.
<    }
<   } //end if doSpinLabel
<   // -WHan
---
>     read_exclusions(psf_file);
2023,2024c1977
< 
< void Molecule::read_exclusions(FILE *fd, int _numExclusionToLoad, int _startExclusionIdx)
---
> void Molecule::read_exclusions(FILE *fd)
2034a1988,1989
>   exclusions      = new Exclusion[numExclusions];
>   exclusion_atoms = new int[numExclusions];
2036,2065c1991
<   // Array of Exclusion needs to be extented when loading 
<   // new sections of exclusion -WHan 
<   
<   if ((_startExclusionIdx == 0) != (exclusions == NULL))
<    NAMD_die("memory allocation failed in Molecule::read_exclusions");
< 
<   if (exclusions)
<   {
<      Exclusion * _t_exclu = new Exclusion[_numExclusionToLoad + _startExclusionIdx];
<      if (_t_exclu == NULL)
<      {
<        NAMD_die("memory allocation failed in Molecule::read_exclusions");
<      }
< 
<      for(int _i=0; _i< _startExclusionIdx; _i++)
<       _t_exclu[_i] = exclusions[_i];
<      delete [] exclusions;
<      exclusions = _t_exclu;
<   }
<   else
<   {
<      exclusions      = new Exclusion[_numExclusionToLoad];
<   }
<   
<    
<   // -WHan
< 
<   exclusion_atoms = new int[_numExclusionToLoad];
< 
<   if ((exclusions == NULL) || (exclusion_atoms == NULL) )
---
>   if ( (exclusions == NULL) || (exclusion_atoms == NULL) )
2071c1997
<   for (num_read=0; num_read<_numExclusionToLoad; num_read++)
---
>   for (num_read=0; num_read<numExclusions; num_read++)
2098c2024
<     if (current_index>_numExclusionToLoad)
---
>     if (current_index>numExclusions)
2103c2029
<          current_index+1, _numExclusionToLoad, num_read);
---
>          current_index+1, numExclusions, num_read);
2126,2127c2052,2053
<           exclusions[insert_index + _startExclusionIdx].atom1 = a1;
<           exclusions[insert_index + _startExclusionIdx].atom2 = a2;
---
>           exclusions[insert_index].atom1 = a1;
>           exclusions[insert_index].atom2 = a2;
2129,2130c2055,2056
<           exclusions[insert_index + _startExclusionIdx].atom1 = a2;
<           exclusions[insert_index + _startExclusionIdx].atom2 = a1;
---
>           exclusions[insert_index].atom1 = a2;
>           exclusions[insert_index].atom2 = a1;
2970d2895
<        // This is where new type of exclusions could be introduced --Wei Han
2975,2976d2899
<        dumExclusionsByAtom = new int32 *[numAtoms]; //-WHan
< 
3370,3372d3292
<        // -WHan
<        int32 *byAtomSize3 = new int32[numAtoms];
<        // -WHan
3378,3380d3297
<          // -WHan
<          byAtomSize3[i] = 0;
<          // -WHan
3387,3390c3304
<          // Exclusion.modified 0: full exclusion
<          //                    1: modified
<          //                    2: spin labels
<          if ( exclusions[i].modified == 1) {
---
>          if ( exclusions[i].modified ) {
3393,3401c3307
<          } else if (exclusions[i].modified == 2){ // "2" is for spin label -WHan 
<            byAtomSize3[exclusions[i].atom1]++;
<            byAtomSize3[exclusions[i].atom2]++;
<            // -WHan
<            numCalcExclusions--; 
<            // Note that spin label pairs can fall out of cutoff distance
<            // and thus cannot be counted for exclusion sum check -WHan 
<          }
<          else {
---
>          } else {
3413,3414d3318
<          dumExclusionsByAtom[i] = arena->getNewArray(byAtomSize3[i]+1);
<          dumExclusionsByAtom[i][0] = 0;
3417,3418d3320
<        // It is a bit complicated, but this is where
<        // key part to be modified for adding new exclusion types
3426c3328
<          if ( exclusions[i].modified == 1 ) {
---
>          if ( exclusions[i].modified ) {
3429,3435c3331
<          // -WHan
<          } else if ( exclusions[i].modified == 2) {
<            l1 = dumExclusionsByAtom[a1];
<            l2 = dumExclusionsByAtom[a2];
<          }
<          // -WHan
<          else {
---
>          } else {
3459,3467d3354
<            // -WHan
<            int32 *ldum = dumExclusionsByAtom[i];
<            iout << "EXCL " << i << " SPIN LABEL";
<            int ndum = *(ldum++);
<            for ( int j = 0; j < ndum; ++j ) {
<              iout << " " << *(ldum++);
<            }
<            iout << "\n" << endi;
<            // -WHan
3590c3477
<        delete [] byAtomSize3;  byAtomSize3 = 0;
---
> 
3661c3548
<          if ( exclusions[i].modified == 1) {
---
>          if ( exclusions[i].modified ) {
3666,3674c3553
<          // -WHan 
<          } else if (exclusions[i].modified == 2){
<            if ( all_exclusions[a1].flags )
<              all_exclusions[a1].flags[a2-all_exclusions[a1].min] = EXCHCK_DUM;
<            if ( all_exclusions[a2].flags )
<              all_exclusions[a2].flags[a1-all_exclusions[a2].min] = EXCHCK_DUM;
<          }
<          // -WHan
<          else {
---
>          } else {
3717,3718d3595
<       // Last numDumExclusions exlcusions are those for spin labels
<        if (i<numExclusions - numDumExclusions)
3720,3725d3596
<        else
<       // Exclusion.modified 0 : not modified (fully excluded)
<       //                    1 : modified (1-4 pair scaling)
<       //                    2 : spin label exclusion (added here)
<       // -WHan
<         exclusionSet.add(Exclusion(exclusions[i].atom1, exclusions[i].atom2  , 2));
3728,3729d3598
<       
< 
8329c8198
<        
---
> 
8381c8250
<    if ( simParams->lesOn && simParams->lesReduceMass  ) {
---
>    if ( simParams->lesOn && simParams->lesReduceMass ) {
8445,8451c8314
<     } else if (simParams->doSpinLabel) // For dummy site tags -WHan
<      {
<       fepAtomFlags[i] = (int) bval;
<       //printf ("Info: parition status of atom %d : %d\n", i+1, (int) bval);
<      }
< 
< 
---
>     } 
8465,8466d8327
< 
< 
9212,9216c9073
<       // for exclusions between dummy sites, we should igore their long range
<       // contributions  --Wei Han
<       // Note that only the last numDumExclusions exclusions are those for spin labels
<  
<       for (i=0; i < numExclusions - numDumExclusions; i++) {  // -WHan
---
>       for (i=0; i < numExclusions; i++) {
