aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-11-25 11:04:15 +0100
committerTechnus <daniel112092@gmail.com>2017-11-25 11:04:15 +0100
commit36a08c05ce617083aabcfede788287f3370ca8da (patch)
treef1c92a84fdbaa8ed4789b4af1f90bc585cdbfd75 /src/main/java
parent03ffe42b5d25ad82e6dd0bc9928d4ebec018e095 (diff)
downloadGT5-Unofficial-36a08c05ce617083aabcfede788287f3370ca8da.tar.gz
GT5-Unofficial-36a08c05ce617083aabcfede788287f3370ca8da.tar.bz2
GT5-Unofficial-36a08c05ce617083aabcfede788287f3370ca8da.zip
Imported and implemented nuclides lifetimes
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java3
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java2
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java127
-rw-r--r--src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/iaea/iaeaNuclide.java132
-rw-r--r--src/main/java/com/github/technus/tectech/loader/AtomOverrider.java42
5 files changed, 198 insertions, 108 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index c80a9de6f4..952e57ac14 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -2,8 +2,6 @@ package com.github.technus.tectech;
import com.github.technus.tectech.auxiliary.Reference;
import com.github.technus.tectech.auxiliary.TecTechConfig;
-import com.github.technus.tectech.elementalMatter.definitions.complex.dAtomDefinition;
-import com.github.technus.tectech.loader.AtomOverrider;
import com.github.technus.tectech.loader.MainLoader;
import com.github.technus.tectech.proxy.CommonProxy;
import cpw.mods.fml.common.Loader;
@@ -73,7 +71,6 @@ public class TecTech {
GTCustomLoader = new MainLoader();
- dAtomDefinition.overrides.add(new AtomOverrider());
TecTech.Logger.info("Added Atom Overrider");
}
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java
index ea34530057..e40e2c0a46 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/interfaces/iElementalDefinition.java
@@ -12,7 +12,7 @@ import net.minecraft.nbt.NBTTagCompound;
* Created by danie_000 on 11.11.2016.
*/
public interface iElementalDefinition extends Comparable<iElementalDefinition>,Cloneable {//IMMUTABLE
- float STABLE_RAW_LIFE_TIME =1.5e25f;
+ float STABLE_RAW_LIFE_TIME =1.5e36f;
//Nomenclature
String getName();
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java
index 3052ac0600..3fc042f0d9 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/dAtomDefinition.java
@@ -11,6 +11,7 @@ import com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefi
import com.github.technus.tectech.elementalMatter.core.tElementalException;
import com.github.technus.tectech.elementalMatter.core.templates.cElementalDefinition;
import com.github.technus.tectech.elementalMatter.core.transformations.*;
+import com.github.technus.tectech.elementalMatter.definitions.complex.iaea.iaeaNuclide;
import com.github.technus.tectech.elementalMatter.definitions.primitive.eBosonDefinition;
import com.github.technus.tectech.elementalMatter.definitions.primitive.eLeptonDefinition;
import com.github.technus.tectech.elementalMatter.definitions.primitive.eNeutrinoDefinition;
@@ -47,6 +48,8 @@ public final class dAtomDefinition extends cElementalDefinition {
private static final HashMap<dAtomDefinition,Float> lifetimeOverrides = new HashMap<>();
public static final ArrayList<Runnable> overrides = new ArrayList<>();
+ public final iaeaNuclide iaea;
+
public static void addOverride(dAtomDefinition atom, float rawLifeTime){
lifetimeOverrides.put(atom,rawLifeTime);
}
@@ -128,7 +131,6 @@ public final class dAtomDefinition extends cElementalDefinition {
element = Math.abs(element);
- xstr.setSeed((long) (element + 1) * (neutralCount + 100));
//stability curve
int StableIsotope = stableIzoCurve(element);
@@ -137,20 +139,32 @@ public final class dAtomDefinition extends cElementalDefinition {
hash=super.hashCode();
- Float overriddenLifeTime=lifetimeOverrides.get(this);
- float rawLifeTimeTemp;
- if(overriddenLifeTime!=null)
- rawLifeTimeTemp = overriddenLifeTime;
- else
- rawLifeTimeTemp= calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti);
+ iaea=iaeaNuclide.get(element,neutralCount);
+ if(iaea!=null){
+ xstr.setSeed((long) (element + 1) * (neutralCount + 100));
+ this.rawLifeTime=containsAnti ? iaea.Thalf * 1.5514433E-21f * (1f + xstr.nextFloat() * 9f):iaea.Thalf;
+ }else{
+ Float overriddenLifeTime=lifetimeOverrides.get(this);
+ float rawLifeTimeTemp;
+ if(overriddenLifeTime!=null)
+ rawLifeTimeTemp = overriddenLifeTime;
+ else {
+ xstr.setSeed((long) (element + 1) * (neutralCount + 100));
+ rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti);
+ }
+ this.rawLifeTime=rawLifeTimeTemp> STABLE_RAW_LIFE_TIME ? STABLE_RAW_LIFE_TIME :rawLifeTimeTemp;
+ }
- this.rawLifeTime=rawLifeTimeTemp> STABLE_RAW_LIFE_TIME ? STABLE_RAW_LIFE_TIME :rawLifeTimeTemp;
- if (izoDiff == 0)
- this.decayMode = 0;
- else
- this.decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4);
- this.stable = this.rawLifeTime>= STABLE_RAW_LIFE_TIME;
+ if(iaea==null || iaea.energeticStates==null || iaea.energeticStates.get(0f)==null) {
+ if (izoDiff == 0)
+ this.decayMode = 0;
+ else
+ this.decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4);
+ }else{
+ this.decayMode=Byte.MAX_VALUE;
+ }
+ this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME;
}
private static int stableIzoCurve(int element) {
@@ -308,6 +322,8 @@ public final class dAtomDefinition extends cElementalDefinition {
return Emmision(dHadronDefinition.hadron_n1);
case 2:
return MbetaDecay();
+ case Byte.MAX_VALUE:
+ return iaeaDecay();
default:
return getNaturalDecayInstant();
}
@@ -316,6 +332,10 @@ public final class dAtomDefinition extends cElementalDefinition {
}
}
+ private cElementalDecay[] iaeaDecay(){
+ return null;
+ }
+
private cElementalDecay[] Emmision(cElementalDefinitionStack emit) {
final cElementalMutableDefinitionStackMap tree = new cElementalMutableDefinitionStackMap(elementalStacks.values());
if (tree.removeAmount(false, emit)) {
@@ -403,14 +423,14 @@ public final class dAtomDefinition extends cElementalDefinition {
final cElementalMutableDefinitionStackMap light = new cElementalMutableDefinitionStackMap(elementalStacks.values());
final cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap();
final ArrayList<cElementalDefinitionStack> particles = new ArrayList<>(4);
- final double[] liquidDrop=liquidDropFunction(Math.abs(element)>97);
+ final double[] liquidDrop=liquidDropFunction(Math.abs(element)<=97);
for(cElementalDefinitionStack stack:light.values()){
if(spontaneousCheck && stack.definition instanceof dHadronDefinition &&
(stack.amount<=80 || (stack.amount<90 && XSTR_INSTANCE.nextInt(10)<stack.amount-80)))
return getNaturalDecayInstant();
if(stack.definition.getCharge()==0){
- if(stack.definition instanceof dHadronDefinition){
+ //if(stack.definition instanceof dHadronDefinition){
double neutrals=stack.amount*liquidDrop[2];
int neutrals_cnt=(int)Math.floor(neutrals);
neutrals_cnt+=neutrals-neutrals_cnt>XSTR_INSTANCE.nextDouble()?1:0;
@@ -421,12 +441,14 @@ public final class dAtomDefinition extends cElementalDefinition {
heavy_cnt--;
light.removeAmount(false,new cElementalDefinitionStack(stack.definition,heavy_cnt+neutrals_cnt));
heavy.putReplace(new cElementalDefinitionStack(stack.definition, heavy_cnt));
- }else{
- particles.add(stack);
- light.remove(stack.definition);
- }
+ //}else{
+ // particles.add(stack);
+ // light.remove(stack.definition);
+ //}
}else{
int heavy_cnt=(int)Math.ceil(stack.amount*liquidDrop[0]);
+ if(heavy_cnt%2==1 && XSTR_INSTANCE.nextFloat()>0.05f)
+ heavy_cnt--;
cElementalDefinitionStack new_stack=new cElementalDefinitionStack(stack.definition, heavy_cnt);
light.removeAmount(false,new_stack);
heavy.putReplace(new_stack);
@@ -456,24 +478,24 @@ public final class dAtomDefinition extends cElementalDefinition {
if (XSTR_INSTANCE.nextBoolean())
out[0] = XSTR_INSTANCE.nextDouble() * 2d - 1d;
- if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(3) == 0)
- out[0] = -out[0];
+ if (asymmetric && out[0] > XSTR_INSTANCE.nextDouble() && XSTR_INSTANCE.nextInt(4) == 0)
+ out[0] = -out[0];
//scale to splitting ratio
- out[0]=out[0]*0.025d+.575d;
+ out[0] = out[0] * 0.05d + .6d;
- if(out[0]<0 || out [0]>1)
+ if (out[0] < 0 || out[0] > 1)
return liquidDropFunction(asymmetric);
- if(out[0]<.5d)
- out[0]=1d-out[0];
+ if (out[0] < .5d)
+ out[0] = 1d - out[0];
//extra neutrals
- out[2]=0.012d+XSTR_INSTANCE.nextDouble()*0.01d;
+ out[2] = 0.012d + XSTR_INSTANCE.nextDouble() * 0.01d;
if (asymmetric)
- out[1]=out[0];
+ out[1] = out[0];
else
- out[1]=out[0]-out[2]*.5d;
+ out[1] = out[0] - out[2] * .5d;
return out;
}
@@ -522,34 +544,34 @@ public final class dAtomDefinition extends cElementalDefinition {
return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd};
}
+ //@Override
+ //public iElementalDefinition getAnti() {
+ // cElementalDefinitionStack[] stacks = this.elementalStacks.values();
+ // cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length];
+ // for (int i = 0; i < antiElements.length; i++) {
+ // antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount);
+ // }
+ // try {
+ // return new dAtomDefinition(false, antiElements);
+ // } catch (tElementalException e) {
+ // if (DEBUG_MODE) e.printStackTrace();
+ // return null;
+ // }
+ //}
+
@Override
public iElementalDefinition getAnti() {
- cElementalDefinitionStack[] stacks = this.elementalStacks.values();
- cElementalDefinitionStack[] antiElements = new cElementalDefinitionStack[stacks.length];
- for (int i = 0; i < antiElements.length; i++) {
- antiElements[i] = new cElementalDefinitionStack(stacks[i].definition.getAnti(), stacks[i].amount);
- }
+ cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap();
+ for (cElementalDefinitionStack stack : elementalStacks.values())
+ anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount));
try {
- return new dAtomDefinition(false, antiElements);
+ return new dAtomDefinition(anti.toImmutable());
} catch (tElementalException e) {
if (DEBUG_MODE) e.printStackTrace();
return null;
}
}
- //@Override
- //public iElementalDefinition getAnti() {
- // cElementalMutableDefinitionStackMap anti = new cElementalMutableDefinitionStackMap();
- // for (cElementalDefinitionStack stack : elementalStacks.values())
- // anti.putReplace(new cElementalDefinitionStack(stack.definition.getAnti(), stack.amount));
- // try {
- // return new dAtomDefinition(anti.toImmutable());
- // } catch (tElementalException e) {
- // if (TecTechConfig.DEBUG_MODE) e.printStackTrace();
- // return null;
- // }
- //}
-
@Override
public aFluidDequantizationInfo someAmountIntoFluidStack() {
return transformation.fluidDequantization.get(this);
@@ -606,7 +628,7 @@ public final class dAtomDefinition extends cElementalDefinition {
}
//populate stable isotopes
- for (int element = 1; element < 84; element++)//Up to Astatine exclusive
+ for (int element = 1; element < 83; element++)//Up to Bismuth exclusive
for (int isotope = 0; isotope < 130; isotope++) {
xstr.setSeed((long) (element + 1) * (isotope + 100));
//stability curve
@@ -614,7 +636,8 @@ public final class dAtomDefinition extends cElementalDefinition {
final int izoDiff = isotope - StableIsotope;
final int izoDiffAbs = Math.abs(izoDiff);
final float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false);
- if (rawLifeTime>= STABLE_RAW_LIFE_TIME) {
+ iaeaNuclide nuclide=iaeaNuclide.get(element,isotope);
+ if (rawLifeTime>= STABLE_RAW_LIFE_TIME || (nuclide!=null && nuclide.Thalf>=STABLE_RAW_LIFE_TIME)) {
TreeSet<Integer> isotopes = stableIsotopes.get(element);
if (isotopes == null) stableIsotopes.put(element, isotopes = new TreeSet<>());
isotopes.add(isotope);
@@ -622,7 +645,7 @@ public final class dAtomDefinition extends cElementalDefinition {
}
//populate unstable isotopes
- for (int element = 84; element < 150; element++)
+ for (int element = 83; element < 150; element++)
for (int isotope = 100; isotope < 180; isotope++) {
xstr.setSeed((long) (element + 1) * (isotope + 100));
//stability curve
@@ -756,11 +779,11 @@ public final class dAtomDefinition extends cElementalDefinition {
transformation.addFluid(new cElementalDefinitionStack(getFirstStableIsotope(80), 144),Materials.Mercury.mFluid.getID(), 144);
//transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(81), 144),OrePrefixes.dust, Materials.Thallium,1);
transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(82), 144), dust, Materials.Lead,1);
- transformation.addOredict(new cElementalDefinitionStack(getFirstStableIsotope(83), 144), dust, Materials.Bismuth,1);
/*----UNSTABLE ATOMS----**/
- refUnstableMass = getFirstStableIsotope(83).getMass() * 144F;
+ refUnstableMass = getFirstStableIsotope(82).getMass() * 144F;
+ transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(83), 144), dust, Materials.Bismuth,1);
//transformation.addOredict(new cElementalDefinitionStack(getBestUnstableIsotope(84),144),OrePrefixes.dust, Materials.Polonium,1);
//transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(85),144),Materials.Astatine.mPlasma.getID(), 144);
transformation.addFluid(new cElementalDefinitionStack(getBestUnstableIsotope(86),144),Materials.Radon.mGas.getID(), 144);
diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/iaea/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/iaea/iaeaNuclide.java
index 7537decba4..d9cdf8db4e 100644
--- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/iaea/iaeaNuclide.java
+++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/iaea/iaeaNuclide.java
@@ -9,6 +9,8 @@ import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.TreeMap;
import static com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition.STABLE_RAW_LIFE_TIME;
@@ -17,17 +19,21 @@ public final class iaeaNuclide {
//Nuclide T1/2 T1/2 [s] Decay Modes ? Q Q?- Q? QEC Q?- n Sn Sp Binding/A Atomic Mass Mass Excess Discovery
//Abund. [mole fract.] BR [%] [?N] [barn] [keV] [keV] [keV] [keV] [keV] [keV] [keV] [? AMU] [keV]
+
+ //Z,N,symb,radius, unc, energy, unc, jp, half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quad , unc,Qb-,unc,Qb- n,unc,Qa, unc, Qec, unc,Sn,unc, Sp,unc,Binding/A,unc,atomic mass, unc, mass excess,unc,
+ //Z,N,symbol,energy , unc, jp,half-life operator, half_life, unc,unit, half_life [s], unc, decay, decay %, unc, decay, decay %, unc, decay, decay %, unc,isospin,magn. dipole, unc, elect. quadrupole , unc,
private static final HashMap<Integer,iaeaNuclide> NUCLIDES=new HashMap<>();
public static void run(){
+ String line="";
+
try {
- ResourceLocation loc = new ResourceLocation(Reference.MODID+":nuclides.tsv");
+ ResourceLocation loc = new ResourceLocation(Reference.MODID+":nuclides.csv");
BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(loc).getInputStream()));
ArrayList<String[]> blockOfData=new ArrayList<>(4);
- String line;
while((line=reader.readLine())!=null) {
- String[] split= Util.splitButDifferent(line,"\t");
- if(split.length!=19) throw new Error("Invalid count ("+split.length+") of separators in IAEA database " + line);
+ String[] split= Util.splitButDifferent(line,",");
+ if(split.length!=19) throw new Error("Invalid count ("+split.length+") of separators in IAEA nuclides database " + line);
if(split[1].length()>0 && !blockOfData.isEmpty()) {
new iaeaNuclide(blockOfData.toArray(new String[0][]));
blockOfData.clear();
@@ -38,9 +44,39 @@ public final class iaeaNuclide {
new iaeaNuclide(blockOfData.toArray(new String[0][]));
blockOfData.clear();
}
- }catch (Throwable e){
+ }catch (Exception e){
+ System.out.println(line);
+ e.printStackTrace();
+ }
+
+ try {
+ ResourceLocation loc = new ResourceLocation(Reference.MODID+":nuclidesTable.csv");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(loc).getInputStream()));
+ while((line=reader.readLine())!=null) {
+ String[] split= Util.splitButDifferent(line,",");
+ if(split.length!=47) throw new Error("Invalid count ("+split.length+") of separators in IAEA nuvlidesTable database " + line);
+ get(Integer.parseInt(split[0]),Integer.parseInt(split[1])).getMoreData(split);
+ }
+ }catch (Exception e){
+ System.out.println(line);
+ e.printStackTrace();
+ }
+
+ try {
+ ResourceLocation loc = new ResourceLocation(Reference.MODID+":energyLevels.csv");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(loc).getInputStream()));
+ while((line=reader.readLine())!=null) {
+ String[] split= Util.splitButDifferent(line,",");
+ if(split.length!=27) throw new Error("Invalid count ("+split.length+") of separators in IAEA energyLevels database " + line);
+ new energeticState(split);
+ }
+ }catch (Exception e){
+ System.out.println(line);
e.printStackTrace();
- throw new Error(e.getMessage());
+ }
+
+ for(String s:decays){
+ System.out.println(s);
}
}
@@ -50,10 +86,9 @@ public final class iaeaNuclide {
public final short N,Z;
public final float Thalf;//sec
- //public final HashMap<String,Float> decaymodes;
-
public final float mass;//eV/c^2
public final short discovery;//year
+ public TreeMap<Float,energeticState> energeticStates;
private iaeaNuclide(String[][] rows){
@@ -61,7 +96,6 @@ public final class iaeaNuclide {
Z=Short.parseShort(rows[1][0]);
NUCLIDES.put((((int)Z)<<16)+N,this);
-
String[] parts = Util.splitButDifferent(rows[0][16], "|");
double Mass=doubleOrNaN(parts[0],"mass");
if(Mass!=Double.NaN) mass = (float)(Mass*MICRO_AMU_TO_EV_DIV_C_C);
@@ -74,6 +108,11 @@ public final class iaeaNuclide {
}else{
parts = Util.splitButDifferent(rows[0][4], "|");
Thalf = (float)doubleOrNaN(parts[0],"half life");
+ //if(Thalf>STABLE_RAW_LIFE_TIME) System.out.println("KEK KEK"+N+" "+Z+" "+Thalf);
+ }
+
+ for(int i=0;i<rows.length;i++){
+ add(rows[i][5]);
}
@@ -84,6 +123,12 @@ public final class iaeaNuclide {
//System.out.println("KEKEKEK");
}
+ private void getMoreData(String[] cells){
+ add(cells[14]);
+ add(cells[17]);
+ add(cells[20]);
+ }
+
private double doubleOrNaN(String s, String name){
s=s.replaceAll("#","");
if(s.length()>0) {
@@ -91,9 +136,76 @@ public final class iaeaNuclide {
return Double.parseDouble(s);
} catch (Exception e) {
System.out.println("Invalid Value " + name + " " + N + " " + Z + " " + s);
- return Double.NaN;
+ e.printStackTrace();
}
}
return Double.NaN;
}
+
+ public static class energeticState{
+ public final float energy;
+ public final float Thalf;
+ public TreeMap<Float,String> decaymodes;
+
+ private energeticState(iaeaNuclide nuclide,float Thalf,TreeMap<Float,String> decaymodes){
+ energy=0;
+ this.Thalf=Thalf;
+ this.decaymodes=decaymodes;
+ if(nuclide.energeticStates==null)
+ nuclide.energeticStates=new TreeMap<>();
+ nuclide.energeticStates.put(energy,this);
+ }
+
+ private energeticState(String[] cells){
+ iaeaNuclide nuclide=get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons"));
+ if(nuclide==null)
+ throw new Error("Missing nuclide "+(int)doubleOrNaN(cells[0],"protons")+" "+(int)doubleOrNaN(cells[1],"neutrons"));
+ this.energy=(float) (doubleOrNaN(cells[3],"energy level",nuclide)*1000);//to eV
+ this.Thalf=(float) doubleOrNaN(cells[10],"half life",nuclide);
+ if(nuclide.energeticStates==null)
+ nuclide.energeticStates=new TreeMap<>();
+ nuclide.energeticStates.put(energy,this);
+
+ add(cells[12]);
+ add(cells[15]);
+ add(cells[18]);
+ }
+
+ private double doubleOrNaN(String s, String name){
+ return doubleOrNaN(s,name,null);
+ }
+
+ private double doubleOrNaN(String s, String name, iaeaNuclide nuclide){
+ s = s.replaceAll("#", "");
+ if (s.length() > 0) {
+ try {
+ return Double.parseDouble(s);
+ } catch (Exception e) {
+ if(nuclide==null){
+ System.out.println("Invalid Value " + name + " " + s);
+ }else {
+ System.out.println("Invalid Value " + name + " " + nuclide.N + " " + nuclide.Z + " " + s);
+ }
+ e.printStackTrace();
+ }
+ }
+ return Double.NaN;
+ }
+ }
+
+ private static HashSet<String> decays=new HashSet<>();
+ private static void add(String s){
+ int len=decays.size();
+ decays.add(s);
+ if(decays.size()>len){
+ System.out.println(s);
+ }
+ }
+ public enum decayType{
+ ;
+ public final String name;
+ decayType(String name){
+ this.name=name;
+ }
+ }
}
diff --git a/src/main/java/com/github/technus/tectech/loader/AtomOverrider.java b/src/main/java/com/github/technus/tectech/loader/AtomOverrider.java
deleted file mode 100644
index 34bbbf4d93..0000000000
--- a/src/main/java/com/github/technus/tectech/loader/AtomOverrider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.github.technus.tectech.loader;
-
-import com.github.technus.tectech.elementalMatter.core.containers.cElementalDefinitionStack;
-import com.github.technus.tectech.elementalMatter.core.tElementalException;
-import com.github.technus.tectech.elementalMatter.definitions.complex.dAtomDefinition;
-import com.github.technus.tectech.elementalMatter.definitions.complex.dHadronDefinition;
-import com.github.technus.tectech.elementalMatter.definitions.primitive.eLeptonDefinition;
-
-import static com.github.technus.tectech.elementalMatter.core.interfaces.iElementalDefinition.STABLE_RAW_LIFE_TIME;
-import static com.github.technus.tectech.elementalMatter.definitions.complex.dAtomDefinition.addOverride;
-
-/**
- * Created by Tec on 29.05.2017.
- */
-public class AtomOverrider implements Runnable{
- @Override
- public void run() {
- try {
- addOverride(new dAtomDefinition(
- new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 2),
- dHadronDefinition.hadron_p2,
- new cElementalDefinitionStack(dHadronDefinition.hadron_n, 3)
- ), STABLE_RAW_LIFE_TIME);//He3
-
- addOverride(new dAtomDefinition(
- eLeptonDefinition.lepton_e1,
- dHadronDefinition.hadron_p1,
- dHadronDefinition.hadron_n1
- ), STABLE_RAW_LIFE_TIME);//D
-
- addOverride(new dAtomDefinition(
- eLeptonDefinition.lepton_e1,
- dHadronDefinition.hadron_p1,
- dHadronDefinition.hadron_n2
- ), 1e9f);//T
-
-
- }catch (tElementalException e){
- e.printStackTrace();
- }
- }
-}