示例#1
0
        public static bool IsFormedNeutralMolecule(Cation cation, Anion anion)
        {
            if (anion.Charge + cation.Charge == 0)
                return true;

            return false;
        }
示例#2
0
        public void GoodSynthesis()
        {
            Cation sodiumIon = new Cation("Sodium", +1);
            Anion chlorideIon = new Anion("Chloride", -1);

            Assert.AreEqual(true, Synthesis.IsFormedNeutralMolecule(sodiumIon, chlorideIon));
        }
示例#3
0
        public Salz(Kation kation, Anion anion)
        {
            Kation = kation;
            Anion  = anion;

            (int anzahlKation, int anzahlAnionen)benoetigeMolekuehle = Ion.BerechneAnzahlMolekuele(kation, anion);
            Kation.Molekuel.Anzahl = benoetigeMolekuehle.anzahlKation;
            Anion.Molekuel.Anzahl  = benoetigeMolekuehle.anzahlAnionen;

            if (Anion.Molekuel.Atombindung.IstElementbindung())
            {
                if (!String.IsNullOrEmpty(Anion.Molekuel.Atombindung.ErhalteElement().Wurzel))
                {
                    Name = Kation.Molekuel.Atombindung.Name + Anion.Molekuel.Atombindung.ErhalteElement().Wurzel.ToLower() + "id";
                }
                else
                {
                    Name = Kation.Molekuel.Atombindung.Name + Anion.Molekuel.Atombindung.ErhalteElement().Name.ToLower() + "id";
                }
            }
            else
            {
                Name = Kation.Molekuel.Atombindung.Name + Anion.Molekuel.Atombindung.Name.ToLower();
            }

            if (Kation.Molekuel.Anzahl > 1)
            {
                if (Kation.Molekuel.Atombindung.IstElementbindung())
                {
                    ChemischeFormel += $"{Kation.Molekuel.Atombindung.ChemischeFormel}{UnicodeHelfer.GetSubscriptOfNumber(Kation.Molekuel.Anzahl)}";
                }
                else
                {
                    ChemischeFormel += $"({Kation.Molekuel.Atombindung.ChemischeFormel}){UnicodeHelfer.GetSubscriptOfNumber(Kation.Molekuel.Anzahl)}";
                }
            }
            else
            {
                ChemischeFormel += $"{Kation.Molekuel.Atombindung.ChemischeFormel}";
            }

            if (Anion.Molekuel.Anzahl > 1)
            {
                if (UnicodeHelfer.GetNumberOfSubscript(Anion.Molekuel.Atombindung.ChemischeFormel.Last()) != -1)
                {
                    ChemischeFormel += $"({Anion.Molekuel.Atombindung.ChemischeFormel}){UnicodeHelfer.GetSubscriptOfNumber(Anion.Molekuel.Anzahl)}";
                }
                else
                {
                    ChemischeFormel += $"{Anion.Molekuel.Atombindung.ChemischeFormel}{UnicodeHelfer.GetSubscriptOfNumber(Anion.Molekuel.Anzahl)}";
                }
            }
            else
            {
                ChemischeFormel += $"{Anion.Molekuel.Atombindung.ChemischeFormel}";
            }
        }
示例#4
0
        public List <(Kation wasserstoffIon, Anion saeurerestIon)> ErhalteIonisierteSaeurevarianten()
        {
            List <(Kation wasserstoffIon, Anion saeurerestIon)> ionisierteSaeurevarianten = new List <(Kation wasserstoffIon, Anion saeurerestIon)>();

            Nichtmetall wasserstoff = Periodensystem.Instance.FindeNichtmetallNachAtomsymbol("H");

            if (wasserstoff == null)
            {
                throw new Exception("Wasserstoff konnte im Periodensystem nicht gefunden werden");
            }

            for (int wasserstoffInEster = Wasserstoff.Atombindung.AnzahlAtome - 1; wasserstoffInEster >= 0; wasserstoffInEster--)
            {
                // Kation
                Atombindung wasserstoffbindung = new Atombindung(wasserstoff, Wasserstoff.Atombindung.AnzahlAtome - wasserstoffInEster);
                Kation      abgabeWasserstoff  = new Kation(new Molekuel(wasserstoffbindung, 1), Wasserstoff.Atombindung.AnzahlAtome - wasserstoffInEster);

                // Anion
                if (wasserstoffInEster == 0)
                {
                    // Das Säurerest hat sich nicht verändert und wird identisch abgegeben
                    Anion abgabeSaeurerest = new Anion(Saeurerest, -(Wasserstoff.Atombindung.AnzahlAtome - wasserstoffInEster));
                    abgabeSaeurerest.Molekuel.Atombindung.SetzeTrivialname(NameSaurerestAnion);

                    ionisierteSaeurevarianten.Add((abgabeWasserstoff, abgabeSaeurerest));
                }
                else
                {
                    // Das Säurerest beinhaltet nun Wassserstoff Atome
                    string saeurerestName = null;
                    if (wasserstoffInEster > 1)
                    {
                        saeurerestName = NomenklaturHelfer.Praefix(wasserstoffInEster) + "hydrogen" + NameSaurerestAnion;
                    }
                    else
                    {
                        saeurerestName = "Hydrogen" + NameSaurerestAnion;
                    }

                    Atombindung wasserstoffbindungInSaeurerest = new Atombindung(wasserstoff, wasserstoffInEster);
                    string      saurerrestFormel = wasserstoffbindungInSaeurerest.ChemischeFormel + Saeurerest.Atombindung.ChemischeFormel;

                    Atombindung saeurerestbindung = new Atombindung(saurerrestFormel, wasserstoffbindungInSaeurerest, Saeurerest.Atombindung);
                    saeurerestbindung.SetzeTrivialname(saeurerestName);

                    Anion abgabeSaeurerest = new Anion(new Molekuel(saeurerestbindung, 1), -(Wasserstoff.Atombindung.AnzahlAtome - wasserstoffInEster));
                    ionisierteSaeurevarianten.Add((abgabeWasserstoff, abgabeSaeurerest));
                }
            }

            return(ionisierteSaeurevarianten);
        }