![]() |
ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
|
00001 #include "BetaStablePrinter.h" 00002 00003 int main() 00004 { 00005 int thisVariableIsOnlyUsedToAvoidCompilerWarnings = 0; 00006 printf("Loading nucleid mass table..."); fflush(stdout); 00007 MassTable myMassTable("../ENSDF_MASSTABLE/mass.mas03"); 00008 printf("done\n"); 00009 printf("Enter output file name: "); fflush(stdout); fflush(stdin); 00010 char * myD = new char[255]; 00011 thisVariableIsOnlyUsedToAvoidCompilerWarnings=scanf("%s", myD); 00012 FILE * myFile = fopen(myD, "w"); 00013 if(myFile==NULL) 00014 { 00015 perror("File could not be opened."); 00016 return 1; 00017 } 00018 list<MassObject> myList = myMassTable.getMassObjects(); 00019 for(list<MassObject>::iterator it = myList.begin(); it!=myList.end(); it++) 00020 { 00021 double aLess = 1E99; 00022 double aMore = 1E99; 00023 double aAlpha = 1E99; 00024 double aMyself = it->getMassExcess().value; 00025 try 00026 { 00027 aLess = myMassTable.getMassObject(it->getNukleid().getZ()-1, it->getNukleid().getA()).getMassExcess().value; 00028 } 00029 catch(DataFileException){} 00030 try 00031 { 00032 aMore = myMassTable.getMassObject(it->getNukleid().getZ()+1, it->getNukleid().getA()).getMassExcess().value; 00033 } 00034 catch(DataFileException){} 00035 try 00036 { 00037 aAlpha = myMassTable.getMassObject(it->getNukleid().getZ() - 2,it->getNukleid().getA()-4).getMassExcess().value + myMassTable.getMassObject(2,4).getMassExcess().value; 00038 } 00039 catch(DataFileException) 00040 { 00041 //do nothing... 00042 } 00043 double HL1 = 1E99, HL2 = 1E99, HL3 = 1E99, HL4 = 1E99, HL5=1E99; 00044 try 00045 { 00046 HL1 = myMassTable.getMassObject(it->getNukleid().getZ()-1, it->getNukleid().getA()-1).getAtomicMass().value + PROTONMASS; 00047 } 00048 catch(DataFileException) {} 00049 try 00050 { 00051 HL2 = myMassTable.getMassObject(it->getNukleid().getZ(), it->getNukleid().getA()-1).getAtomicMass().value + NEUTRONMASS; 00052 } 00053 catch(DataFileException) {} 00054 try 00055 { 00056 HL3 = myMassTable.getMassObject(it->getNukleid().getZ(), it->getNukleid().getA()-2).getAtomicMass().value + 2*NEUTRONMASS; 00057 } 00058 catch(DataFileException) {} 00059 try 00060 { 00061 HL4 = myMassTable.getMassObject(it->getNukleid().getZ()-1, it->getNukleid().getA()-2).getAtomicMass().value + NEUTRONMASS + PROTONMASS; 00062 } 00063 catch(DataFileException) {} 00064 try 00065 { 00066 HL5 = myMassTable.getMassObject(it->getNukleid().getZ()-2, it->getNukleid().getA()-2).getAtomicMass().value + 2*PROTONMASS; 00067 } 00068 catch(DataFileException) {} 00069 double VL = it->getAtomicMass().value; 00070 HalfLifeEstimator myEstimator; 00071 //aLess is mass of beta-minus nucleus, aMore of beta-plus. 00072 double QbetaPlus = aMyself-aLess- 2*ELECTRONMASSINMEV; 00073 double QbetaMinus = aMyself - aMore; 00074 //cout << QbetaMinus << " " << QbetaPlus << endl; 00075 bool SF = (pow((float)it->getNukleid().getZ(),(float)2.)/((float)it->getNukleid().getA()) >= 49); 00076 //cout << pow((float)it->getNukleid().getZ(),(float)2.)/((float)it->getNukleid().getA()) << endl; 00077 //cout << it->getNukleid().getA() << it->getNukleid().getElement() << " " << myEstimator.estimateHalfLife((aMyself-aAlpha)/1E3, it->getNukleid().getA(), it->getNukleid().getZ()) << " " << aMyself << " " << aLess << " " << aMore << " " << aAlpha << " " << SF << endl << endl << endl; 00078 if(!SF && QbetaMinus < 0 && QbetaPlus < 0 && (aAlpha > aMyself || (myEstimator.estimateHalfLife((aMyself-aAlpha)/1E3, it->getNukleid().getA(), it->getNukleid().getZ()) > 1E12)) && !(VL>HL1 || VL>HL2 || VL>HL3 || VL>HL4 || VL>HL5)) 00079 fprintf(myFile, "%d %d %s\n", it->getNukleid().getZ(), it->getNukleid().getA(), it->getNukleid().getElement().c_str()); 00080 } 00081 fclose(myFile); 00082 printf("File successfully created, finishing.\n"); 00083 return 0; 00084 }