Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

load_data.cpp

Go to the documentation of this file.
00001 /*
00002  * ******** fete: From ENDF To ENDL *********
00003  * 
00004  * Copyright (c) 2006, The Regents of the University of California. 
00005  * All rights reserved.
00006  * 
00007  * Produced at the Lawrence Livermore National Laboratory. 
00008  * Written by David A. Brown, Gerry Hedstrom, Tony Hill
00009  * 
00010  * This file is part of fete v1.0  (UCRL-CODE-218718)
00011  * 
00012  * Please read the COPYING file for "Our Notice and GNU General 
00013  * Public License" in the root of this software distribution.  
00014  * 
00015  * This program is free software; you can redistribute it and/or modify 
00016  * it under the terms of the GNU General Public License (as published by 
00017  * the Free Software Foundation) version 2, dated June 1991. 
00018  * 
00019  * This program is distributed in the hope that it will be useful, 
00020  * but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF 
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms 
00022  * and conditions of the GNU General Public License for more details. 
00023  * 
00024  * You should have received a copy of the GNU General Public License along 
00025  * with this program; if not, write to the Free Software Foundation, Inc., 
00026  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00027  * 
00028  * $Revision: 1892 $
00029  * $Date: 2006-09-07 10:29:17 -0700 (Thu, 07 Sep 2006) $
00030  * $Author: dbrown $
00031  * $Id: load_data.cpp 1892 2006-09-07 17:29:17Z dbrown $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 // methods
00037 
00038 #include "load_data.hpp"
00039 #include "kalbach.hpp"
00040 #include "record_types.hpp"
00041 #include "endl_formats.hpp"
00042 #include "mf4classes.hpp"
00043 #include "mf5classes.hpp"
00044 #include "mf6classes.hpp"
00045 #include "mf6_gammas.hpp"
00046 #include "mf12classes.hpp"
00047 #include "mf13classes.hpp"
00048 #include "mf14classes.hpp"
00049 #include "mf14table.hpp"
00050 #include "messaging.hpp"
00051 #include "multiplicity.hpp"
00052 #include "charge.hpp"
00053 
00054 extern ENDLClass ENDL;
00055 extern GlobalParameterClass Global;
00056 extern C55_gammas C55;
00057 
00058 // ---------------------- LoadData ------------------
00059 void LoadData( int F, int T )
00060 {
00061   try {
00062     // Do what we need to do based on the type of data...
00063     if ( T==5 )  // general particle production
00064     {
00065             Unimplemented("LoadData",
00066             "general particle production has no ENDL equivalent.");
00067     } 
00068     else if ( F==1 )
00069     {
00070         // T = 451,... is for delayed fission neutrons
00071         if ( T < 400 )   // general information
00072         {
00073             SevereError("LoadData",pastenum("MF = ",F)+" not used.");
00074         }
00075     }
00076     else if ( F==2 )  //Resonance Parameter data
00077     {}
00078     else if ( F==3 )  //Reaction Cross sections
00079     {
00080       mf3_file inFile;   //Instantiate the input file
00081       inFile.open(F, T);
00082       LoadMF3Data( inFile );
00083       Info("LoadData","Closing file "+endf_file_name(F,T)+"...");
00084       inFile.close();
00085     }
00086     else if( !ENDL.write_file )
00087     {
00088       // ignore this data
00089       return;
00090     }
00091     else if ( F==4 )  //Ang Dists for emmitted particles
00092     {
00093       mf4_file inFile;   //Instantiate the input file
00094       inFile.open(F, T);
00095       LoadMF4Data( inFile );
00096       Info("LoadData","Closing file "+endf_file_name(F,T)+"...");
00097       inFile.close();
00098     }
00099     else if ( F==5 )
00100     {
00101       mf5_file inFile;   //Instantiate the input file
00102       inFile.open(F, T);
00103       LoadMF5Data( inFile );
00104       Info("LoadData","Closing file "+endf_file_name(F,T)+"...");
00105       inFile.close();
00106     }
00107     else if ( F==6 )  //E-Ang Dists for emitted particles
00108     {
00109       mf6_file inFile;   //Instantiate the input file
00110       inFile.open(F, T); //Open the file
00111       LoadMF6Data( inFile ); //Load and translate the data
00112       Info("LoadData","Closing file "+endf_file_name(F,T)+"...");
00113       inFile.close();
00114     }
00115     else if ( F==7 )  //Thermal Neutron scattering Law
00116     {
00117         Unimplemented("LoadData",pastenum("MF = ",F)+" not implemeted yet.");
00118     }
00119     else if ( F==8 )  //Radio and fission-product yield data
00120     {
00121         Info("LoadData",
00122             "ENDL does not support Radio and fission-product decay data, "+
00123             pastenum("MF = ",F));
00124     }
00125     else if ( F==9 )  //Multiplicities for radio nuclide prod
00126     {
00127         Unimplemented("LoadData",
00128             "fete does not yet translate Multiplicities for radio nuclide prod, "+
00129             pastenum("MF = ",F));
00130     }
00131     else if ( F==10 ) //Cross sections for radio nuclide prod
00132     {
00133         Unimplemented("LoadData",
00134             "fete does not yet translate Cross sections for radio nuclide prod, "+
00135             pastenum("MF = ",F));
00136     }
00137     else if ( ( F==12 ) || ( F==13 ) )  //Multiplicities for photon production
00138     {
00139         if( Global.Value( "skip_gammas" ) <= 0.0 )
00140         {
00141             if( T > 4 ) // gammas for individual reactions
00142             {
00143                 mf12_file inFile;   //Instantiate the input file
00144                 inFile.open(F, T);
00145                 LoadGammaData( inFile );
00146                 Info("LoadData","Closing file "+endf_file_name(F,T)+"...");
00147                 inFile.close();
00148             }
00149             else  //Cross sections for photon production 
00150             {
00151                 mf13_file inFile;   //Instantiate the input file
00152                 inFile.open(F, T);
00153                 LoadMF13Data( inFile );
00154                 Info("LoadData","Closing file "+endf_file_name(F,T)+"...");
00155                 inFile.close();
00156             }
00157         }
00158     }
00159     else if ( F==14 ) //Ang Dists for photon production
00160     {
00161         // do nothing; mf14 files are treated under mf12 or mf13
00162     }
00163     else if ( F==15 ) //energy distributions for continuum photons
00164     {
00165         // do nothing; mf15 files are treated under mf12 or mf13
00166     }
00167     else if ( F==23 ) //Photo-atomic interaction x-sections
00168     {
00169         Warning("LoadData",pastenum("MF = ",F)+" not implemeted yet.");
00170     }
00171     else if ( F==27 ) //Atomic form facts for photo-atomic int
00172     {
00173         Warning("LoadData",pastenum("MF = ",F)+" not implemeted yet.");
00174     }
00175     else if ( F==30 ) //Data covariances obtained from 
00176     {
00177         Unimplemented("LoadData","ENDL does not support covariances yet, "
00178             +pastenum("MF = ",F)+" not implemented.");
00179     }                           //parameter covariances and sensitivities
00180     else if ( F==31 ) //Data cov for nu(bar)
00181     {
00182         Unimplemented("LoadData","ENDL does not support covariances yet, "
00183             +pastenum("MF = ",F)+" not implemented.");
00184     }
00185     else if ( F==32 ) //Data cov for resonance params
00186     {
00187         Unimplemented("LoadData","ENDL does not support covariances yet, "
00188             +pastenum("MF = ",F)+" not implemented.");
00189     }
00190     else if ( F==33 ) //Data cov for reaction x-sections
00191     {
00192         Unimplemented("LoadData","ENDL does not support covariances yet, "
00193             +pastenum("MF = ",F)+" not implemented.");
00194     }
00195     else if ( F==34 ) //Data cov for angular dists
00196     {
00197         Unimplemented("LoadData","ENDL does not support covariances yet, "
00198             +pastenum("MF = ",F)+" not implemented.");
00199     }
00200     else if ( F==35 ) //Data cov for energy dists
00201     {
00202         Unimplemented("LoadData","ENDL does not support covariances yet, "
00203             +pastenum("MF = ",F)+" not implemented.");
00204     }
00205     else if ( F==39 ) //Data cov for radionuke prod yields
00206     {
00207         Unimplemented("LoadData","ENDL does not support covariances yet, "
00208             +pastenum("MF = ",F)+" not implemented.");
00209     }
00210     else if ( F==40 ) //Data cov for radionuke prod x-sections
00211     {
00212         Unimplemented("LoadData","ENDL does not support covariances yet, "
00213             +pastenum("MF = ",F)+" not implemented.");
00214     }
00215     else //We have a problem...
00216     {
00217         SevereError("LoadData",pastenum("MF = ",F)+" not valid.");
00218     }
00219   }
00220   catch (string str) {
00221     cerr << "fete LoadData: " << str <<
00222             ", abort processing of this file." << endl;
00223     return;
00224   }
00225   // Reset the S number.  If was S = 0, 1, or 9 this is harmless.  
00226   // If was set, e.g. for delayed n's to S=7, this will set it back to the correct value.
00227   ENDL.set_s_number();
00228   // Recompute the Q value.  If QM or QI had to get reset (as happens when doing fission),
00229   // we'll need to re-run this.  Otw, this is harmless.
00230   ENDL.set_QValue();
00231 }
00232 
00233 // --------------- LoadMF1Data ------------------------
00234 // Deprecated
00235 void LoadMF1Data( int T, mf1_file& inFile )
00236 {
00237     Warning( "LoadMF1Data", "Use of this function is deprecated.  Use LoadFissionData instead." );
00238     LoadFissionData( );
00239 }
00240 
00241 // --------------- MTExists ------------------------
00242 bool MF1MTExists( int MT ){
00243     mf1_file inFile;
00244     inFile.open( 1, MT, false );
00245     return inFile;
00246 }
00247 
00248 // --------------- LoadFissionData ------------------------
00249 // Data for fission neutrons.  Call this only when 
00250 // translating the MF=3, MT=18 (fission) data.
00251 // In this routine, we will process (or not) MT's 452, 455, 456, 458, 460
00252 void LoadFissionData(  )
00253 {
00254     int LNU;    // flag: 1 for spontaneous fission, 2 for induced fission
00255     int ZA;     // target ZA 
00256     double AWR; // target mass
00257     bool got_nubar_prompt  = false;
00258     bool got_nubar_delayed = false;
00259 
00260     // Process the energy release due to fission (MT = 458)
00261     if ( Global.Value("fission_Q") != 0.0 ) 
00262     {
00263         // Do not include energies of delayed fission decays
00264         if( MF1MTExists( 458 ) ) 
00265         {
00266             Info("LoadFissionData","Processing energy release due to fission (MT = 458) file.");
00267             Info("LoadFissionData","Computing Q values based on (MT = 458) file.");
00268             mt458_file Q_file;
00269             Q_file.open( 1, 458 );
00270             double QM = Q_file.reduce_Q( ENDL.QM/ENDL.eV2MeV );
00271             ENDL.reaction( 0, QM, QM ); 
00272             Info("LoadFissionData","Closing file "+endf_file_name(1,458)+"...");
00273             Q_file.close();
00274         }
00275         else Info("LoadFissionData","No delayed decay energy (MT = 458) file.");
00276     }
00277 
00278     // Set the fission product residual
00279     ENDL.res_za = 99120; 
00280     
00281     // Don't process the post-fission beta-delayed gamma data (MT = 460)
00282     if ( MF1MTExists( 460 ) ) Info("LoadFissionData","Skipping post-fission beta-delayed gamma data (MT = 460) file.");
00283 
00284     // delayed fission nubar
00285     if ( MF1MTExists( 455 ) ) 
00286     {
00287         Info("LoadFissionData","Processing delayed fission nubar (MT = 455) file.");
00288         mf1_file inFile;
00289         inFile.open( 1, 455 );
00290         inFile.read_line1(&ZA, &AWR, &LNU);
00291         fission_delay fiss_delay;
00292         fiss_delay.manager(inFile);
00293         got_nubar_delayed = true;
00294         Info("LoadFissionData","Closing file "+endf_file_name(1,455)+"...");
00295         // Reset the ENDL object so can finish the cross section processing
00296         ENDL.set_yo( 0 );
00297         ENDL.set_s_number( 0 ); 
00298         ENDL.set_x1( 0.0 );
00299     }
00300     else Info("LoadFissionData","No delayed fission nubar (MT = 455) file.");
00301 
00302     // prompt fission nubar
00303     if ( MF1MTExists( 456 ) ) 
00304     {
00305         Info("LoadFissionData","Processing prompt fission nubar (MT = 456) file.");
00306         mf1_file inFile;
00307         inFile.open( 1, 456 );
00308         inFile.read_line1(&ZA, &AWR, &LNU);
00309         multiplicity multiple;
00310         //read second line
00311         int NR, NP;
00312         inFile.mult_head(
00313           &NR,   // number of INT regions 
00314           &NP    // number of data points
00315         );
00316         inFile.get_regions( NR, multiple.NBT, multiple.INT );
00317         multiple.read_data( NP, inFile );
00318         ENDL.set_yo(1);
00319         if ( ENDL.write_file ) multiple.write_endl( 7 );
00320         got_nubar_prompt = true;
00321         Info("LoadFissionData","Closing file "+endf_file_name(1,456)+"...");
00322         // Reset the ENDL object so can finish the cross section processing
00323         ENDL.set_yo( 0 );
00324         ENDL.set_s_number( 0 ); 
00325     }
00326     else Info("LoadFissionData","No prompt fission nubar (MT = 456) file.");
00327 
00328     // total fission nubar
00329     if ( MF1MTExists( 452 ) ) 
00330     {
00331         if ( got_nubar_prompt && got_nubar_delayed )
00332         {
00333             Info("LoadFissionData","Skipping total fission nubar (MT = 452), it is redundant so not worth processing.");
00334         }
00335         else
00336         {
00337             Info("LoadFissionData","Processing total fission nubar (MT = 452) file.");
00338             mf1_file inFile;
00339             inFile.open( 1, 452 );
00340             inFile.read_line1(&ZA, &AWR, &LNU);
00341             multiplicity multiple;
00342             //read second line
00343             int NR, NP;
00344             inFile.mult_head(
00345                 &NR,   // number of INT regions 
00346                 &NP    // number of data points
00347             );
00348             inFile.get_regions( NR, multiple.NBT, multiple.INT );
00349             multiple.read_data( NP, inFile );
00350             ENDL.set_yo( 1 );
00351             ENDL.set_s_number( 17 ); // Bogus S number, we'll have to post-process
00352             if ( ENDL.write_file ) multiple.write_endl( 7 ); 
00353             Info("LoadFissionData","Closing file "+endf_file_name(1,452)+"...");
00354             // Reset the ENDL object so can finish the cross section processing
00355             ENDL.set_yo( 0 );
00356             ENDL.set_s_number( 0 ); 
00357         }
00358     }
00359     else Info("LoadFissionData","No total fission nubar (MT = 452).");
00360 
00361 }
00362 
00363 // --------------- LoadMF3Data ------------------------
00364 void LoadMF3Data( mf3_file& inFile ) 
00365 {
00366   // Instantiate the cross section object
00367   one_d_table xs;  
00368 
00369   int ZA;
00370   double AWR;
00371   double QM, QI;
00372   int LR,NR, NP;
00373 
00374   // Get the target ZA and mass
00375   inFile.read_line1(&ZA, &AWR);
00376 
00377   // Read second line
00378   inFile.read_line2(
00379           &QM,             // mass difference Q value
00380           &QI,             // reaction Q value for the lowest state
00381           &LR,             // complex or "breakup" flag
00382           &NR,             // number of INT regions 
00383           &NP              // number of data points
00384   );
00385   
00386   // Stash the reaction info
00387   ENDL.reaction( LR, QM, QI ); 
00388 
00389   // Handle all fission neutron data except the cross-section
00390   if ( ENDL.T == 18 ) LoadFissionData(  );  
00391 
00392   if ( !ENDL.write_file )
00393   {
00394     Info("LoadMF3Data",pastenum("Skipping mf: ",ENDL.F)+pastenum(" mt: ",ENDL.T));
00395     return;
00396   }
00397 
00398   // Red's code has already handled the multiple region representations
00399   // so we should never see more than one region in the cross sections
00400   if ( NR != 1 ) SevereError("LoadMF3Data","Expected single region, was this file preprocessed?");
00401   
00402   inFile.get_regions( NR, xs.NBT, xs.INT );
00403   
00404   xs.read_data( NP, inFile, ENDL.Max_E_in );
00405 
00406   if ( ENDL.write_file ) 
00407   {
00408     // Clean up interpolation table
00409     xs.unique();  
00410     xs.widen_jumps(); 
00411     xs.write_endl( 0 );
00412   }
00413 
00414   // Calculate the compund nucleus and the residual ZA 
00415   // (For fission, we did this already in the LoadFissionData() routine)
00416   if( ENDL.T != 18 ) ENDL.get_resid( );
00417 }
00418 
00419 // ------------------- LoadMF4Data -------------------------------
00420 void LoadMF4Data( mf4_file& inFile ) 
00421 {
00422   int ZA, LVT, LTT;
00423   int LI, LCT;
00424   int NK,NM;
00425   double AWR;
00426   int ZAP, NR, NE;
00427 
00428   inFile.read_line1(
00429           &ZA,              // target Z & A 
00430           &AWR,             // target mass
00431           &LVT,             // transformation matrix flag
00432           &LTT              // representation flag
00433   );
00434   inFile.read_line2(
00435           &LI,              // 1 -> all ang dists are isotropic
00436           &LCT,             // 1 -> lab frame, 2 -> CM system
00437           &NK,              // number of elements in transformation matrix 
00438           &NM               // max order of Legendre (should be even)
00439   );
00440   
00441   // check whether the data is in the right frame
00442   if( ( ENDL.angles_CM && ( LCT != 2 ) ) ||
00443       ( !ENDL.angles_CM && ( LCT != 1 ) ) )
00444   {
00445     Warning( "LoadMF4Data", " wrong frame " + pastenum("LCT = ",LCT) ); 
00446     // we can handle it.  it might be crap, but we can handle it.
00447     //return;
00448   }
00449 
00450   if( LVT == 1)
00451   {
00452     // The next NK numbers give the transformation matrix; skip it
00453     inFile.skip(NK);
00454   }
00455 
00456   //Stash the reaction information
00457   ZAP=ENDL.get_ZAP( ENDL.T );
00458   ENDL.set_outgoing_ZA( ZAP );
00459 
00460   if ( !ENDL.write_file )
00461   {
00462     Info("LoadMF4Data",pastenum("Skipping mf: ",ENDL.F)+pastenum(" mt: ",ENDL.T));
00463     return;
00464   }
00465 
00466   //There are several possibilities as to what is in this file
00467 
00468   //Start reading and translating. First the isotropic distributions
00469   if ( LTT==0 )                //all angular distributions are isotropic
00470   {
00471     two_d_isotropic isotropic;
00472     if ( LI != 1 )   //supposed to be isotropic. if not, send message
00473     {
00474       Unimplemented("LoadMF4Data","Need new code for "+pastenum("LTT = ",LTT)
00475         +pastenum(" LVT = ",LVT)+pastenum(" LI = ",LI));
00476       return;
00477     }
00478     Info("LoadMF4Data","Doing mf4 isotropic");
00479     isotropic.expand_data( ENDL.T );  // make the data
00480     if ( ENDL.write_file )
00481     {
00482       isotropic.widen_jumps();
00483       isotropic.write_endl(1); //write endl
00484       if ( ( ENDL.res_za <= 2004 ) && ( ENDL.S != 9 ) )
00485       {
00486         ENDL.outgoing_particle = 10 + ENDL.za_to_yo( ENDL.res_za );
00487         isotropic.write_endl(1);
00488       }
00489     }
00490   }
00491 
00492   // for non-isotropic distributions there are three options - LTT=1,2,3
00493   else if  ( LTT==1 )  //Legendre Poly coefficients
00494   {
00495     Info("LoadMF4Data","Doing mf4 Legendre");
00496     two_d_Legendre Legendre;             //Create the Legendre object
00497 
00498     inFile.read_line3(
00499       &NR,              // number of interpolation regions
00500       &NE               // number of incident energy points
00501     );
00502     
00503     inFile.get_regions(NR, Legendre.NBT, Legendre.INT);
00504 
00505     Legendre.expand_data( inFile, NE, ENDL.F ); //read/expand data to pointwise
00506     Legendre.widen_jumps();
00507     Legendre.renorm();
00508     if (ENDL.write_file)
00509     {
00510       Legendre.write_endl(1); //write the endl file
00511       // do we have elastic scattering for a light target?
00512       if ( ( ENDL.T == 2 ) && ( ENDL.res_za <= 2004 ) )
00513       {
00514         ENDL.outgoing_particle = 10 + ENDL.za_to_yo( ENDL.res_za );
00515         Legendre.mirror();
00516         Legendre.write_endl(1);
00517       }
00518     }
00519   }
00520 
00521   else if ( LTT==2 )  // normalized probability distributions
00522   {
00523     Info("LoadMF4Data","Doing mf4 table");
00524     mf4_table Tabular;    //Create the tabulated object
00525     Tabular.master( inFile );
00526     return;
00527   }
00528   else if ( LTT==3 ) // new format: like LTT==1 for low E, LTT==2 for high E
00529   {
00530     Info("LoadMF4Data","Doing mixed mf4");
00531     mixed_mf4 mixed_data;
00532     mixed_data.master( inFile );
00533   }
00534   else
00535   {
00536     SevereError("LoadMF4Data",pastenum("LTT = ",LTT)
00537       +" in MF4 data is impossible!");
00538   }
00539 }
00540 
00541 // ------------------- LoadMF5Data -------------------------------
00542 void LoadMF5Data( mf5_file& inFile ) 
00543 {
00544   int ZA;
00545   int LF;
00546   int NK;
00547   double AWR,U;
00548   int ZAP,NR, NP;
00549 
00550   // read the first line of the file
00551   inFile.read_line1(&ZA, &AWR, &NK);
00552 
00553   //Stash the reaction information
00554   ZAP=ENDL.get_ZAP(ENDL.T);
00555   ENDL.set_outgoing_ZA( ZAP );
00556 
00557   if ( !ENDL.write_file )
00558   {
00559     Info("LoadMF5Data",pastenum("Skipping mf: ",ENDL.F)+pastenum(" mt: ",ENDL.T));
00560     return;
00561   }
00562 
00563   if( NK > 1)
00564   {
00565     Info("LoadMF5Data","Doing mf5 multiple models");
00566     add_them_up add_them( NK );
00567     add_them.manager( inFile );
00568   }
00569   else
00570   {
00571     // read the second line of the file
00572     inFile.read_line2(&U, &LF, &NR, &NP);
00573 
00574     if ( LF == 1  ) //Arbitrary tabulated function
00575     {
00576       Info("LoadMF5Data","Doing mf5 table");
00577       mf5_table Arbitrary;            //Create the table
00578       Arbitrary.read_data(inFile, NR, NP );  //read in the data
00579       if (ENDL.write_file) 
00580       {
00581         if( Arbitrary.duplicate_Ein ){
00582             Arbitrary.widen_jumps( );
00583         }
00584         Arbitrary.renorm(); 
00585         Arbitrary.write_endl(4); //write the ENDL file
00586       }
00587       return;
00588     }
00589     else if ( LF == 5  ) //General evaporation Spectrum
00590     {
00591       Unimplemented("LoadMF5Data","Need new code for LF=5");
00592       return;
00593     }
00594     else if ( LF == 7  ) //Simple fission spectrum (Maxwellian)
00595     {
00596       Info("LoadMF5Data","Doing mf5 Maxwell");
00597       two_d_Maxwell Maxwell(U);
00598       Maxwell.read_data(inFile, NR, NP );  //read in the data
00599       Maxwell.make_list();   // expand the data
00600       if (ENDL.write_file) 
00601       {
00602         if( Maxwell.duplicate_Ein ){
00603             Maxwell.widen_jumps( );
00604         }
00605         Maxwell.renorm(); 
00606         Maxwell.write_endl(4); //write the ENDL file
00607       }
00608       return;
00609     }
00610     else if ( LF == 9  ) //Evaporation spectrum
00611     {
00612       Info("LoadMF5Data","Doing mf5 evaporation");
00613       two_d_evap evap(U);
00614       evap.read_data(inFile, NR, NP );  //read in the data
00615       evap.make_list();   // expand the data
00616       if (ENDL.write_file) 
00617       {
00618         if( evap.duplicate_Ein ){
00619             evap.widen_jumps( );
00620         }
00621         evap.renorm(); 
00622         evap.write_endl(4); //write the ENDL file
00623       }
00624       return;
00625     }
00626     else if ( LF == 11 ) //Energy-Dependent Watt spectrum
00627     {
00628       Info("LoadMF5Data","Doing mf5 Watt");
00629       two_d_Watt Watt(U);
00630       Watt.read_data(inFile, NR, NP );  //read in the data
00631       Watt.make_list();   // expand the data
00632       if (ENDL.write_file) 
00633       {
00634         if( Watt.duplicate_Ein ){
00635             Watt.widen_jumps( );
00636         }
00637         Watt.renorm(); 
00638         Watt.write_endl(4); //write the ENDL file
00639       }
00640       return;
00641     }
00642     else if ( LF == 12 ) //Energy dep fission neutron spectrum (Madland & Nix)
00643     {
00644       Info("LoadMF5Data","Doing mf5 Madland");
00645       two_d_Madland Madland;
00646       Madland.read_data(inFile, NR, NP );  //read in the data
00647       Madland.make_list();   // expand the data
00648       if (ENDL.write_file) 
00649       {
00650         if( Madland.duplicate_Ein ){
00651             Madland.widen_jumps( );
00652         }
00653         Madland.renorm(); 
00654         Madland.write_endl(4); //write the ENDL file
00655       }
00656       return;
00657     }
00658     else
00659     {
00660       SevereError("LoadMF5Data",pastenum("There is no model for LF = ",LF));
00661     }  
00662   }
00663 }
00664 
00665 // ------------------- LoadMF6Data -------------------------------
00666 void LoadMF6Data( mf6_file& inFile ) 
00667 {
00668   int ZA, LCT, NK;
00669   double AWR;
00670   int ZAP, LIP, LAW, NR_1,NR_2, NP;
00671   double AWP;
00672   int LANG, LEP, NE;
00673   // by default make an i=3 gamma file except for neutron capture
00674   bool make_i3 = ( ENDL.C == 46 )? false : true;
00675   // Do we write a copy for the ENDL residual as particle?
00676   bool res_copy = false;
00677   
00678   inFile.read_line1(
00679       &ZA,         // target Z & A 
00680       &AWR,        // target mass
00681       &LCT,        // data reference frame
00682       &NK          // number of subsections
00683   );
00684   
00685   int prev_ZAP = -1;     // no previous outgoing particle
00686   int X4_count;          // the value of X[4] in (n, Xn) reactions
00687 
00688   for(int iNK = 0; iNK < NK; ++iNK)
00689   {
00690     inFile.particle_line1(
00691       &ZAP,      // product Z & A
00692       &AWP,      // product mass
00693       &LIP,      // residual isomeric state
00694       &LAW,      // kinetics model
00695       &NR_1,     // number of interpolation regions
00696       &NP        // number of multiplicity points
00697     );
00698     ENDL .set_outgoing_ZA( ZAP );
00699 
00700     // is this the residual?
00701     if( ( ENDL.current_za == ENDL.res_za ) && ( ZAP == ENDL.res_za ) )
00702     {
00703       ENDL.outgoing_particle += 10;
00704     }
00705 
00706     // this may be gamma data following skipped data for the residual
00707     if( prev_ZAP == ENDL.res_za )
00708     {
00709       ENDL.write_file = true;
00710     }
00711 
00712     if ( !ENDL.write_file )
00713     {
00714       Info("LoadMF6Data", pastenum("Skipping mf: ",ENDL.F)+
00715         pastenum(" mt: ",ENDL.T)
00716         +pastenum(" ZAP: ",ZAP));
00717 
00718       if( ( iNK == NK-1 ) || ( ENDL.C < 0 ) ) // this is the last particle
00719       {
00720         return;
00721       }
00722     }
00723 
00724     if( ZAP == prev_ZAP )
00725     {
00726       // This is multiple particle data as for (n, 2n)
00727       ENDL.append = true;
00728       ++X4_count;
00729       ENDL.X[4] = X4_count;
00730     }
00731     else
00732     {
00733       ENDL.append = false;
00734       X4_count = 0;
00735     }
00736 
00737     // Read the multiplicity data first
00738     multiplicity multiple;
00739     int this_multiple = 0;  // used in (n, Xn) reactions
00740 
00741     // interpolation regions
00742     inFile.get_regions(NR_1, multiple.NBT, multiple.INT);
00743 
00744     multiple.read_data( NP, inFile );
00745 
00746     if ( !ENDL.write_file )
00747     {
00748       // for the residual as particle we have set ENDL.outgoing_particle = 109
00749       if( ENDL.outgoing_particle > 100 ) this_multiple = 1;
00750     }
00751     else if( ( ZAP == 0 ) && ( LAW > 0 ) )  // for LAW = 0 it's printed later
00752     {
00753       // it's a sad state of affairs when I need to make sure 
00754       // there aren't a negative number of gammas
00755       multiple.set_min_mult(0.0);
00756     
00757       // print the gamma multiplicity
00758       multiple.write_endl(9);
00759     }
00760     else if( ( ENDL.T == 18 ) && ( ZAP == 1 ) )
00761     {
00762       // fission neutron multiplicity
00763       multiple.write_endl(7);
00764     }
00765     else if( ENDL.T != 5 )
00766     {
00767       // if we already know the multiplicity from the MT number, 
00768       // let's use that instead if the value in the ENDF file is bogus
00769       if ( !multiple.check_const_mult( ENDL.yo_mult( ) ) ) 
00770       {
00771         Warning("LoadMF6Data", "Found non-constant or incorrect multiplicity for a reaction requiring constant multiplicity, so overwriting");
00772         multiple.set_mult( ENDL.yo_mult( ) );  
00773       }
00774       this_multiple = multiple.get_mult( );
00775       // we may need to copy the data as residual
00776       if( ( this_multiple > 1 ) && ( this_multiple*ZAP == ENDL.current_za ) )
00777       {
00778         res_copy = true;
00779       }
00780       // this could be the first of split (n, Xn) data
00781       if( ( X4_count == 0 ) && ( this_multiple < ENDL.yo_mult() ) )
00782       {
00783         X4_count = 1;
00784         ENDL.X[4] = X4_count;
00785       }
00786     }
00787 
00788     if ( LAW == 0 )  // only multiplicities
00789     {
00790       if ( ENDL.write_file )
00791       {
00792         multiple.write_endl( 9 );
00793       }
00794     }
00795     else if ( LAW == 1 )  // continuum energy-angle distributions
00796     {
00797       // read the next line
00798       inFile.get_model(
00799         &LANG,  // the model
00800         &LEP,   // interpolation for E_out
00801         &NR_2,  // number of regions
00802         &NE     // number of incident energies
00803       );
00804   
00805       if(LANG == 1)
00806       {
00807         if( ( ZAP == 0 ) && make_i3 )
00808         {
00809           Info("LoadMF6Data","Doing i=3 gammas");
00810           mf6_gammas gammas;
00811           gammas.read_data( inFile, LEP, NR_2, NE );
00812         }
00813         else
00814         {
00815           Info("LoadMF6Data",pastenum("Doing mf6 Legendre for ZAP=",ZAP));
00816           mf6_Legendre Legendre;
00817 
00818           // mcapm currently can't handle mixed double differential data
00819           if( make_i3 && ( iNK > 0 ) && ENDL.write_file )
00820           {
00821             Warning("LoadMF6Data", "mixing types of double differential data");
00822           }
00823 
00824           Legendre.master( inFile, LEP, NR_2, NE, res_copy );
00825           if( ENDL.write_file )
00826           {
00827             make_i3 = false;
00828           }
00829         }
00830       }
00831       else if(LANG == 2)
00832       {
00833         Info("LoadMF6Data",pastenum("Doing mf6 Kalbach for ZAP=",ZAP));
00834         //  Kalbach
00835         if( ( LCT != 2 ) && ( LCT != 3 ) )
00836         {
00837           Warning("LoadMF6Data",
00838             pastenum("Kalbach data must be center-of-mass coordinates.  Evaluation uses LCT=",LCT)+
00839             ".  Since this makes no sense, we are treating it as center-of-mass data.");
00840           LCT=2;
00841         }
00842         if(LEP != 1)
00843         {
00844           SevereError("LoadMF6Data","Implement Kalbach for non-histogram data.");
00845         }
00846       
00847         three_d_Kalbach Kalbach( ZA, ENDL.yo_to_za( ENDL.incident_particle ), ZAP, this_multiple );
00848         // get the interpolation rules
00849         inFile.get_regions(NR_2, Kalbach.NBT, Kalbach.INT);
00850         Kalbach.expand_data(NE, inFile);
00851         if ( ENDL.write_file )
00852         {
00853           Kalbach.renorm();
00854           Kalbach.write_endl( );
00855           if( res_copy )
00856           {
00857             // make a copy for the residual as particle
00858             ENDL.outgoing_particle += 10;
00859             Kalbach.write_endl( );
00860           }
00861         }
00862       }
00863       else
00864       {
00865         Unimplemented("LoadMF6Data",pastenum("LANG = ",LANG)+" not implemented");
00866       }
00867     }
00868     else if ( LAW == 2 )
00869     {
00870       // general discrete 2-body
00871       Info("LoadMF6Data","Doing general mf6 2-body");
00872       if( LCT != 2 )
00873       {
00874         SevereError("LoadMF6Data","Expected center-of-mass coordinates");
00875       }
00876       gen_mf4 mu_dist;
00877       mu_dist.master( inFile );
00878       make_i3 = false;
00879     }
00880     else if ( LAW == 5 )
00881     {
00882       Info("LoadMF6Data",pastenum("Doing charged-particle scattering for ZAP=",ZAP));
00883       two_d_charge mu_dist;
00884       mu_dist.master( inFile );
00885     }
00886     else if ( LAW == 6 )
00887     {
00888       // N-body phase-space model
00889       Info("LoadMF6Data",pastenum("Doing  mf6 N-body phase-space model for ZAP=",ZAP));
00890       phase_space phase( 1, ZA, ZAP );
00891       phase.expand_data( inFile, multiple );
00892       if ( ENDL.write_file )
00893       {
00894         phase.write_endl( );
00895     if( res_copy )
00896         {
00897       // make a copy for the residual as particle
00898       ENDL.outgoing_particle += 10;
00899       phase.write_endl( );
00900         }
00901       }
00902     }
00903     else if ( LAW == 7 )
00904     {
00905       // ENDL-type angle-energy table in laboratory coordinates
00906       if ( ENDL.write_file )
00907          Info("LoadMF6Data",pastenum("Doing  mf6 ENDL-type angle-energy table for ZAP=",ZAP));
00908       if( LCT != 1 )
00909       {
00910         SevereError("LoadMF6Data","Expected laboratory coordinates");
00911       }
00912       ENDL_table table;
00913       table.read_data( inFile, ZAP, multiple );
00914       if ( ENDL.write_file )
00915       {
00916         table.write_endl( );
00917         if( res_copy )
00918         {
00919           // make a copy for the residual as particle
00920           ENDL.outgoing_particle += 10;
00921           table.write_endl( );
00922         }
00923       }
00924     }
00925     else if ( ( LAW == 3 ) && 
00926               (
00927                 ( 
00928                   ( ENDL.C == 11 ) || 
00929                   ( ENDL.C == 40 ) ||
00930                   ( ENDL.C == 41 ) ||
00931                   ( ENDL.C == 42 ) ||
00932                   ( ENDL.C == 44 ) ||
00933                   ( ENDL.C == 45 )
00934                 ) && ( ENDL.S == 1 ) 
00935               ) 
00936             )
00937     {
00938       //Make an isotropic distribution
00939       two_d_isotropic isotropic;
00940       Info("LoadMF6Data",pastenum("Doing mf4 isotropic for ZAP=",ZAP));
00941       isotropic.expand_data( ENDL.T );  // make the data
00942       if ( ENDL.write_file )
00943       {
00944         isotropic.write_endl(1); //write endl
00945       }
00946       make_i3 = false;
00947     }
00948     else if ( ( LAW == 4 ) && ( ENDL.current_za == ENDL.res_za ) )
00949     {
00950       // This is harmless residual data, just go on
00951     }
00952     else
00953     {
00954       Unimplemented("LoadMF6Data",pastenum("Implement LAW ",LAW));
00955       return;
00956     }
00957     prev_ZAP = ZAP;
00958     // update the current residual nucleus
00959     if ( ENDL.T != 5 )
00960     {
00961       ENDL.current_za -= this_multiple * ZAP;
00962     }
00963   }
00964   // set the particle count to zero for the next reaction
00965   ENDL.X[4] = 0;
00966 }
00967 
00968 // --------------- LoadGammaData ------------------------
00969 void LoadGammaData( mf12_file& inFile ) 
00970 {
00971   if ( !ENDL.write_file )
00972   {
00973     Info("LoadGammaData",pastenum("Skipping mf: ",ENDL.F)+pastenum(" mt: ",ENDL.T));
00974     return;
00975   }
00976 
00977   int ZA;
00978   double AWR;
00979   int LO,LG,mf12_NK;
00980 
00981   ENDL.set_yo( 7 );
00982 
00983   // there may be an mf14 file
00984   int mf14_LI, mf14_LTT;
00985   int mf14_NK, mf14_NI;
00986   mf14_file angle_file;   //Instantiate the input file
00987   angle_file.open( 14, ENDL.T );
00988   if( angle_file )
00989   {
00990     Info("LoadGammaData","Loading angular distributions from the MF=14 file.");
00991     // read the first line
00992     angle_file.first_line(
00993       &ZA,       // target Z & A 
00994       &AWR,      // target mass
00995       &mf14_LI,  // isotropy flag
00996       &mf14_LTT, // Legendre flag
00997       &mf14_NK,  // number of discreet photons (inc continuum)
00998       &mf14_NI   // number of isotropic photon dists
00999     );
01000   }
01001   else
01002   {
01003     Info("LoadGammaData","All gammas are emitted isotropicly.");
01004     mf14_LI = 1;  //all photons isotropic
01005   }
01006 
01007   inFile.read_line1(
01008     &ZA,       // target Z & A 
01009     &AWR,      // target mass
01010     &LO,       // representation flag (=1 or 2) 
01011     &LG,       // for LO = 2: flag for gamma source
01012     &mf12_NK   // number of discrete photons (inc continuum)
01013   );
01014   
01015   // What we do next depends on the LO flag...
01016   
01017   // We have multiplicities
01018   if ( ( LO == 1 ) || ( ENDL.F == 13 ) ) 
01019   {
01020   
01021     //  isotropic discrete gamma energies
01022     if( mf14_LI == 1 )
01023     {
01024       Info("LoadGammaData","Doing mf12 discrete table");
01025       MF12_list e_dist;
01026       e_dist.master( AWR, mf12_NK, &inFile );
01027     }
01028     
01029     //  isotropic discrete+continuum gammas
01030     else if ( mf14_LTT == 1 )
01031     {
01032       // do we split off the discrete lines?
01033       if( Global.Value( "split_gammas" ) > 0 )
01034       {
01035         Info("LoadGammaData","Splitting discrete & continuum gammas");
01036         MF14_split e_dist;
01037         e_dist.master( AWR, mf12_NK, &inFile, &angle_file );
01038       }
01039       else
01040       {
01041         // get the maximum Legendre order
01042         Info("LoadGammaData","MF14 Legendre expansions for gammas");
01043         int max_order = angle_file.get_order( mf14_NK, mf14_NI );
01044         angle_file.close();
01045         Info("LoadData","Closing file "+endf_file_name(14,ENDL.T)+"...");
01046         angle_file.open( 14, ENDL.T );
01047         MF14_list e_dist( mf14_NI, mf14_NK, max_order, &inFile, &angle_file );
01048         e_dist.master( mf12_NK );
01049       }
01050     }
01051     
01052     // anisotropic gammas
01053     else
01054     {
01055     
01056       // there is just one line, and it is anisotropic
01057       if( ( mf14_NK == 1 ) && ( mf14_NI == 0 ) )
01058       {
01059         Info("LoadGammaData","Doing mf4 table for 1 line");
01060         mf4_table Tabular;    //Create the tabulated object
01061         Tabular.master( angle_file );
01062       }
01063       
01064       // there are multiple, and they are anisotropic
01065       else
01066       {
01067         Info("LoadGammaData","Doing mf14 table for multiple lines");
01068         MF14_table Tabular;    //Create the tabulated object
01069         Tabular.master( inFile, angle_file, mf12_NK, mf14_NK ); 
01070       }
01071     }
01072   }
01073   
01074   //We have transition probability arrays
01075   else if ( LO == 2 ) 
01076   {
01077     if( mf14_LI == 1 )
01078     {
01079       Info("LoadGammaData","Doing mf12 deexcitation");
01080       MF12_deexcite e_dist; 
01081       e_dist.master( AWR, LG, inFile );
01082     }
01083     else
01084     {
01085       Unimplemented("LoadGammaData","Implement anisotropic gammas for deexcitation");
01086     }
01087   }
01088   else // something horribly wrong
01089   {
01090     SevereError("LoadGammaData",
01091         pastenum("There is no LO = ",LO)+" option for MF=12 data!!");
01092   }
01093 
01094   
01095 }
01096 
01097 // --------------- LoadMF13Data ------------------------
01098 void LoadMF13Data( mf13_file& inFile ) 
01099 {
01100   int ZA;
01101   double AWR;
01102   int NK;
01103 
01104   // read the first line
01105   inFile.read_line1(
01106     &ZA,             // target Z & A 
01107     &AWR,            // target mass
01108     &NK              // number of discreet photons (inc continuum)
01109   );
01110    
01111   // Reset the header information, overwrite the previous reaction
01112   ENDL.set_x0( 0.0 );      // the Q value
01113   ENDL.set_I_number( 0 );  // recompose the header
01114   if ( !ENDL.write_file )
01115   {
01116     Info("LoadMF13Data",pastenum("Skipping mf: ",ENDL.F)+pastenum(" mt: ",ENDL.T));
01117     return;
01118   }
01119   if( ENDL.T == 3 )
01120   {
01121     Info("LoadMF13Data","Doing mf13 table for mt3");
01122     C55.MT3_gammas.master(NK, inFile);
01123     C55.has_MT3 = true;
01124   }
01125   else if( ENDL.T == 4 )
01126   {
01127     Info("LoadMF13Data","Doing mf13 table for mt4");
01128     C55.MT4_gammas.master(NK, inFile);
01129     C55.has_MT4 = true;
01130   }
01131   else
01132   {
01133     Warning("LoadMF13Data","Write new code for gamma multiplicity.");
01134   }
01135 }

Generated on Thu Sep 7 10:30:06 2006 for fete -- From ENDFB6 To ENDL by doxygen 1.3.4