using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static ManyWorldsTheory.Atome; using UnitsNet.Units; using UnitsNet; namespace ManyWorldsTheory { public class Teilchen { double speed; public double radius; public double mass; public double ElLeitfaehigkeit; public double Ladung; double Hauptquantenzahl; int Electrons; public int Protons; public int Neutrons; bool hasvalenzelectrons; bool isinspace; Vector3D.Vector Impulsvect; Vector3D.Vector ortsvektor; public string shortname, name; public int Ordnungszahl = 0; public double enegativitaet = 0.00; double density; public TAlex.MathCore.LinearAlgebra.Vector3D Colour; public double ℎ = 6.62607015 * Math.Pow(10.000, -34.000); public double ℏ() //ugs.: "reduziertes h" { var x = (ℎ / (2 * Math.PI)); return x; } Teilchen() { setProtons(0); setspeed(0); setradius(0); setmass(0); setElLeitfaehigkeit(0); setHauptquantenzahl(0); setElektrons(0); setvector3D(0, 0, 0); if ((ortsvektor.X == 0) && ortsvektor.Y == 0 && ortsvektor.Z == 0) { this.isinspace = false; setImplusvector3D(0, 0, 0); } this.hasvalenzelectrons = false; } public void setProtons(int dbl) { this.Protons = dbl; } public int getProtons() { return this.Protons; } public void setNeutrons(int dbl) { this.Neutrons = dbl; } public int geNeutrons() { return this.Neutrons; } public Teilchen getIsotopeofTeilchen(int Protonzahl, int Neutronszahl, Teilchen t) { if (t.Protons == Protonzahl && t.Neutrons != Neutronszahl) { return t; } return t; } public double getSchroedingerOrt(double Impuls, Teilchen t, TAlex.MathCore.UnitConversion.Quantities.Time Time) { return ((-TAlex.MathCore.Complex.Pow(ℏ(), 2) / 2 * t.getmass()).Argument); } Teilchen(double speed, double r, double mass, double ladung, double Hptqz, int eminus, Vector3D.Vector vort, bool hasevalenz, Vector3D.Vector Impuls, int Protonenzahl, int neutronenzahl, bool isinspace = true) { setspeed(speed); setradius(r); setmass(mass); setladung(ladung); setHauptquantenzahl(Hptqz); setElektrons(eminus); setvector3D(vort.X, vort.Y, vort.Z); if (isinspace == true) setvector3D(vort.X, vort.Y, vort.Z); if ((ortsvektor.X != 0) && ortsvektor.Y != 0 && ortsvektor.Z != 0) { setImplusvector3D(Impuls.X, Impuls.Y, Impuls.Z); } else { isinspace = false; setImplusvector3D(0.00, 0.00, 0.00); } this.hasvalenzelectrons = hasevalenz; this.setDensity(this.calculateDensity()); } public Teilchen(int Ordnungszahl, string shortname, string name, double mass, double radius, double ElLeitfaehigkeit, double eNegativitaet, int prot, int neutron, bool isinspace = true) { this.setOrdnungszahl(Ordnungszahl); this.setShortname(shortname); this.setName(name); this.setmass(mass); this.setradius(radius); this.setElLeitfaehigkeit(ElLeitfaehigkeit); this.setEnegat(eNegativitaet); this.isinspace = true; this.setDensity(this.calculateDensity()); this.setProtons(prot); this.setNeutrons(neutron); } public void setName(string name) { this.name = name; } public string getName() { return this.name; } public void setShortname(string shortname) { this.shortname = shortname; } public string getShortname() { return this.shortname; } public void setOrdnungszahl(int z) { this.Ordnungszahl = z; } public int getOrdnungszahl() { return this.Ordnungszahl; } public void setladung(double z) { this.Ladung = z; } public double getladung() { return this.Ladung; } public void setDensity(double calculatedfunctionvalue) { this.density = calculatedfunctionvalue; } public void setspeed(double sp) { //this.speed = sp; this.speed = UnitsNet.Speed.FromMetersPerSecond(sp).MetersPerSecond; } public double getspeed() { return this.speed; } public void tetisinspace(bool b) { this.isinspace = b; } public bool getisinspace() { return this.isinspace; } public void setvector3D(double x, double y, double z) { this.ortsvektor.X = x; this.ortsvektor.Y = y; this.ortsvektor.Z = z; } public void setImplusvector3D(double x, double y, double z) { this.Impulsvect.X = x; this.Impulsvect.Y = y; this.Impulsvect.Z = z; } public Vector3D.Vector getortsvector() { return this.ortsvektor; } public Vector3D.Vector getImpuls() { return this.Impulsvect; } public void setradius(double r) { //this.radius = r; this.radius = Length.FromMeters(r).Meters; } public double getradius() { return this.radius; } public void setmass(double mass) { //this.mass = mass; this.mass = Mass.FromKilograms(mass * Math.Pow(10, -27)).Kilograms; } public double getmass() { return this.mass; } public void setElLeitfaehigkeit(double ld) { //this.ElLeitfaehigkeit = ld; this.ElLeitfaehigkeit = ElectricConductivity.FromSiemensPerMeter(ld).SiemensPerMeter; } public double getElLeitfaehigkeit() { return this.ElLeitfaehigkeit; } public void setHauptquantenzahl(double Hqz) { this.Hauptquantenzahl = Hqz; } public double getHauptquantenzahl() { return this.Hauptquantenzahl; } public void setElektrons(int e) { this.Electrons = e; } public int getElectrons() { return this.Electrons; } public void setEnegat(double zahl) { this.enegativitaet = zahl; } public double getEngat() { return this.enegativitaet; } public double calculateDensity() { double VolumeofCoreofAtom = (((4 * Math.PI) / 3)* Math.Pow(getradius(),3)); //return getmass() / VolumeofCoreofAtom; return Density.FromKilogramsPerLiter(getmass() / VolumeofCoreofAtom).KilogramsPerCubicMeter; } public async void setcolour(string colour, Teilchen t) { FarbenQuantentheorie farbenQuantentheorie = new FarbenQuantentheorie(); bool isallrightvariable = false; farbenQuantentheorie.isallright().Start(); isallrightvariable = await farbenQuantentheorie.isallright(); if (isallrightvariable == true) farbenQuantentheorie.setcolour(colour); else { isallrightvariable = farbenQuantentheorie.isallright().Result; } } public static Teilchen operator +(Teilchen a, Teilchen b) { return new Teilchen(0, a.getShortname() + b.getShortname(), a.getName() + b.getName(), a.getmass() + b.getmass(), a.getradius() + b.getradius(), a.getElLeitfaehigkeit() + b.getElLeitfaehigkeit(), a.getEngat() + b.getEngat(), a.getProtons() + b.getProtons(), a.geNeutrons() + b.geNeutrons()) { Ordnungszahl = 0, shortname = a.getShortname() + b.getShortname(), name = a.getName() + b.getName(), mass = a.getmass() + b.getmass(), radius = a.getradius() + b.getradius(), ElLeitfaehigkeit = a.getElLeitfaehigkeit() + b.getElLeitfaehigkeit(), enegativitaet = a.getEngat() + b.getEngat(), Protons = a.getProtons() + b.getProtons(), Neutrons = a.geNeutrons() + b.geNeutrons() }; } } }