//public static AtomWithOrbitals FromStableIsotope(ElementName element) //{ // var isotope = IsotopeTable.GetStableIsotopeOf(element).FirstOrDefault(); // if (isotope == null) // throw new ChemistryException($"No stable isotope known for {element}"); // return new AtomWithOrbitals(isotope.Protons, isotope.Neutrons); //} private void PopulateOrbitalsInGroundState() { if (Orbitals.Any(o => !o.IsEmpty)) { throw new InvalidOperationException("Population of orbits only implemented for all orbits being empty"); } var energySortedOrbitals = Orbitals.ToLookup(OrbitalComparer.CalculateOrbitalOrder); var energyGroups = energySortedOrbitals.Select(x => x.Key).Distinct().OrderBy(x => x); var electronCount = 0; foreach (var energyGroup in energyGroups) { var energyEqualOrbitals = energySortedOrbitals[energyGroup].ToList(); // Add first electron foreach (var energyEqualOrbital in energyEqualOrbitals) { var electron = new Electron(); energyEqualOrbital.AddElectron(electron); electronCount++; if (electronCount == Protons) { break; } } if (electronCount == Protons) { break; } // Add second electron foreach (var energyEqualOrbital in energyEqualOrbitals) { var electron = new Electron(); energyEqualOrbital.AddElectron(electron); electronCount++; if (electronCount == Protons) { break; } } if (electronCount == Protons) { break; } } }
public MShell(IElement element) : base(element) { Orbitals.Add(new s_OrbitalGroup(this)); Orbitals.Add(new p_OrbitalGroup(this)); Orbitals.Add(new d_OrbitalGroup(this)); }