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