Show
Ignore:
Timestamp:
05/17/08 09:51:43 (8 months ago)
Author:
rjrw
Message:

Merged from trunk r2022:2078

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/newmole/source/atmdat_chianti.cpp

    r1942 r2079  
    1818        /* type is set to 0 for non chianti and 1 for chianti*/ 
    1919        long int i,j,nMolLevs,intCollTran,intcollindex,ipLo,ipHi; 
    20         FILE *atmolLevDATA , *atmolTraDATA=NULL,*atmolEleColDATA=NULL; 
     20        FILE *atmolLevDATA , *atmolTraDATA=NULL,*atmolEleColDATA=NULL,*atmolProColDATA=NULL; 
    2121        realnum  fstatwt,fenergyK,fenergyWN,fWLAng,fenergy,feinsteina; 
    2222        double fScalingParam,fEnergyDiff,fGF,*xs,*spl,*spl2; 
     
    4040        long int *intNewIndex=NULL,*intOldIndex=NULL; 
    4141        int interror; 
    42         bool lgEneLevOrder; 
     42        bool lgProtonData=false,lgEneLevOrder; 
    4343 
    4444        /*This is to identify where the fields start */ 
     
    9999        if( trace.lgTrace ) 
    100100                fprintf( ioQQQ," moldat_readin opening %s:",chProColFilename); 
     101        /*We will set a flag here to indicate if the proton collision strengths are available */ 
     102        if( ( atmolProColDATA = fopen( chProColFilename , "r" ) ) != NULL ) 
     103        { 
     104                lgProtonData = true; 
     105        } 
     106        else 
     107        { 
     108                lgProtonData = false; 
     109        } 
    101110 
    102111        nMolLevs = 0; 
     
    146155        for( intcollindex = 0; intcollindex<NUM_COLLIDERS; intcollindex++ ) 
    147156        { 
    148                 CollRatesArray[intNS][intcollindex] = (double**)MALLOC((nMolLevs)*sizeof(double*)); 
     157                CollRatesArray[intNS][intcollindex] = NULL; 
     158        } 
     159        /*Allocating space just for the electron*/ 
     160        CollRatesArray[intNS][0] = (double**)MALLOC((nMolLevs)*sizeof(double*)); 
     161        for( ipHi = 0; ipHi<nMolLevs; ipHi++ ) 
     162        { 
     163                CollRatesArray[intNS][0][ipHi] = (double*)MALLOC((unsigned long)(nMolLevs)*sizeof(double)); 
     164                for( ipLo = 0; ipLo<nMolLevs; ipLo++) 
     165                { 
     166                        CollRatesArray[intNS][0][ipHi][ipLo] = 0.0; 
     167                } 
     168        } 
     169        /*Allocating space for the proton*/ 
     170        if(lgProtonData) 
     171        { 
     172                CollRatesArray[intNS][1] = (double**)MALLOC((nMolLevs)*sizeof(double*)); 
    149173                for( ipHi = 0; ipHi<nMolLevs; ipHi++ ) 
    150174                { 
    151                         CollRatesArray[intNS][intcollindex][ipHi] = (double*)MALLOC((unsigned long)(nMolLevs)*sizeof(double)); 
     175                        CollRatesArray[intNS][1][ipHi] = (double*)MALLOC((unsigned long)(nMolLevs)*sizeof(double)); 
    152176                        for( ipLo = 0; ipLo<nMolLevs; ipLo++) 
    153177                        { 
    154                                 CollRatesArray[intNS][intcollindex][ipHi][ipLo] = 0.0; 
    155                         } 
    156                 } 
    157         } 
    158  
     178                                CollRatesArray[intNS][1][ipHi][ipLo] = 0.0; 
     179                        } 
     180                } 
     181        } 
    159182        /*Rewind the energy levels files*/ 
    160183        if( fseek( atmolLevDATA , 0 , SEEK_SET ) != 0 )