public static bool HasMultiplicity(SymmetryTypes symType) { return(!(symType == SymmetryTypes.CI || symType == SymmetryTypes.CS || symType == SymmetryTypes.T || symType == SymmetryTypes.TD || symType == SymmetryTypes.TH || symType == SymmetryTypes.O || symType == SymmetryTypes.OH || symType == SymmetryTypes.I || symType == SymmetryTypes.IH)); }
private void ComboGroups_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { SymmetryTypes SymType = Symmetry.ParseType((string)ComboGroups.SelectedItem); SliderMultiplicity.Visibility = Symmetry.HasMultiplicity(SymType) ? Visibility.Visible : Visibility.Collapsed; if (SymType == SymmetryTypes.In || SymType == SymmetryTypes.InH) { SliderMultiplicity.MaxValue = 5; Multiplicity = Math.Min(5, Multiplicity); } else { SliderMultiplicity.MaxValue = 99; } Value = new Symmetry(SymType, (int)Multiplicity).ToString(); }
public Symmetry(string symString) { Type = ParseType(symString); if (Type == SymmetryTypes.CI || Type == SymmetryTypes.CS || Type == SymmetryTypes.T || Type == SymmetryTypes.TD || Type == SymmetryTypes.TH || Type == SymmetryTypes.O || Type == SymmetryTypes.OH || Type == SymmetryTypes.I || Type == SymmetryTypes.IH) { Multiplicity = 1; } else { // Sanitize while (symString.Length < 4) { symString += " "; } if (char.IsDigit(symString[1]) && char.IsDigit(symString[2])) { Multiplicity = int.Parse(symString.Substring(1, 2)); } else { Multiplicity = int.Parse(symString.Substring(1, 1)); } Multiplicity = Math.Max(1, Math.Min(Multiplicity, 99)); } }
public Symmetry(SymmetryTypes type, int multiplicity) { Type = type; Multiplicity = multiplicity; }