/// <summary> /// Removes the corresponding <seealso cref="ChemicalBond"/> of the given <seealso cref="AtomNode"/> /// </summary> /// <param name="bondedElement">The bonded <seealso cref="AtomNode"/> that will be removed as a bond</param> public void RemoveBond(AtomNode bondedElement) { if (Bonds.ContainsKey(bondedElement)) { Bonds.Remove(bondedElement); } }
/*public void BreakRing(AtomNode ele2, int ringNumber) * { * var bondOrder = GetBondOrder(ele2); * * var suffix = RingSuffix.Item1 == -1 * ? (ringNumber, bondOrder) * : (RingSuffix.Item1 * 10 + ringNumber, bondOrder); * * var suffix2 = ele2.RingSuffix.Item1 == -1 * ? (ringNumber, bondOrder) * : (ele2.RingSuffix.Item1 * 10 + ringNumber, bondOrder); * * ele2.RingSuffix = suffix2; * RingSuffix = suffix; * RemoveBond(ele2); * ele2.RemoveBond(this); * }*/ public void BreakRing(AtomNode ele2, int ringNumber) { var bondOrder = GetBondOrder(ele2); ele2.RingSuffixes.Add(ringNumber, bondOrder); RingSuffixes.Add(ringNumber, bondOrder); RemoveBond(ele2); ele2.RemoveBond(this); }
public Molecule(AtomNode atom) => Atoms = new List <AtomNode>
private BondOrder GetBondOrder(AtomNode bondedElement) { return(Bonds[bondedElement]); }
/// <summary> /// Adds a new <seealso cref="ChemicalBond"/> into BondList by first creating the <seealso cref="ChemicalBond"/> and then adding the equivalent into the other <seealso cref="AtomNode"/> /// </summary> /// <param name="bondOrder">The order of bond (i.e. Single, Double, Triple)</param> /// <param name="bondedElement">The AtomNode that will be bonded to</param> public void AddBond(AtomNode bondedElement, BondOrder bondOrder) { Bonds.Add(bondedElement, bondOrder); }