public static IAtomContainer Acetone() { var acetone = new AtomContainer(); var carbon0 = acetone.AddAtom("C"); for (var i = 0; i < 3; i++) { acetone.AddBond(carbon0, acetone.AddAtom("H"), BondOrder.Single); } var carbon1 = acetone.AddAtom("C"); acetone.AddBond(carbon0, carbon1, BondOrder.Single); acetone.AddBond(carbon1, acetone.AddAtom("O"), BondOrder.Double); var carbon2 = acetone.AddAtom("C"); for (var i = 0; i < 3; i++) { acetone.AddBond(carbon2, acetone.AddAtom("H"), BondOrder.Single); } acetone.AddBond(carbon1, carbon2, BondOrder.Single); acetone.SetProperty(NCDK.CDKPropertyName.Title, nameof(acetone)); return(acetone); }
public static IAtomContainer Propane() { var propane = new AtomContainer(); var carbon = new[] { propane.AddAtom("C"), propane.AddAtom("C"), propane.AddAtom("C") }; propane.AddBond(carbon[0], carbon[1], BondOrder.Single); propane.AddBond(carbon[1], carbon[2], BondOrder.Single); for (var j = 0; j < 3; j++) { propane.AddBond(carbon[0], propane.AddAtom("H"), BondOrder.Single); } for (var j = 0; j < 2; j++) { propane.AddBond(carbon[1], propane.AddAtom("H"), BondOrder.Single); } for (var j = 0; j < 3; j++) { propane.AddBond(carbon[2], propane.AddAtom("H"), BondOrder.Single); } propane.SetProperty(NCDK.CDKPropertyName.Title, nameof(propane)); return(propane); }
public static IAtomContainer RubbingAlcohol() { var rubbingAlcohol = new AtomContainer(); var carbonTop = rubbingAlcohol.AddAtom("C"); for (var i = 0; i < 3; i++) { rubbingAlcohol.AddBond(carbonTop, rubbingAlcohol.AddAtom("H"), BondOrder.Single); } var carbonBottom = rubbingAlcohol.AddAtom("C"); for (var i = 0; i < 3; i++) { rubbingAlcohol.AddBond(carbonBottom, rubbingAlcohol.AddAtom("H"), BondOrder.Single); } var carbonCenter = rubbingAlcohol.AddAtom("C"); rubbingAlcohol.AddBond(carbonCenter, carbonTop, BondOrder.Single); rubbingAlcohol.AddBond(carbonCenter, carbonBottom, BondOrder.Single); rubbingAlcohol.AddBond(carbonCenter, rubbingAlcohol.AddAtom("H"), BondOrder.Single); var oxy = rubbingAlcohol.AddAtom("O"); rubbingAlcohol.AddBond(carbonCenter, oxy, BondOrder.Single); rubbingAlcohol.AddBond(oxy, rubbingAlcohol.AddAtom("H"), BondOrder.Single); rubbingAlcohol.SetProperty(NCDK.CDKPropertyName.Title, nameof(rubbingAlcohol)); return(rubbingAlcohol); }
public static IAtomContainer Vinegar() { var vinegar = new AtomContainer(); var carbon0 = vinegar.AddAtom("C"); for (var i = 0; i < 3; i++) { vinegar.AddBond(carbon0, vinegar.AddAtom("H"), BondOrder.Single); } var carbon1 = vinegar.AddAtom("C"); vinegar.AddBond(carbon0, carbon1, BondOrder.Single); vinegar.AddBond(carbon1, vinegar.AddAtom("O"), BondOrder.Double); var oxy = vinegar.AddAtom("O"); vinegar.AddBond(carbon1, oxy, BondOrder.Single); vinegar.AddBond(oxy, vinegar.AddAtom("H"), BondOrder.Single); vinegar.SetProperty(NCDK.CDKPropertyName.Title, nameof(vinegar)); return(vinegar); }
public static IAtomContainer Ethanol() { var ethanol = new AtomContainer(); var carbon00 = ethanol.AddAtom("C"); for (var i = 0; i < 3; i++) { ethanol.AddBond(carbon00, ethanol.AddAtom("H"), BondOrder.Single); } var carbon01 = ethanol.AddAtom("C"); ethanol.AddBond(carbon00, carbon01, BondOrder.Single); for (var i = 0; i < 2; i++) { ethanol.AddBond(carbon01, ethanol.AddAtom("H"), BondOrder.Single); } var oxy = ethanol.AddAtom("O"); ethanol.AddBond(carbon01, oxy, BondOrder.Single); ethanol.AddBond(oxy, ethanol.AddAtom("H"), BondOrder.Single); ethanol.SetProperty(NCDK.CDKPropertyName.Title, nameof(ethanol)); return(ethanol); }
public static IAtomContainer AppleSmell() { var appleSmell = new AtomContainer(); var carbons = new[] { appleSmell.AddAtom("C"), appleSmell.AddAtom("C"), appleSmell.AddAtom("C"), appleSmell.AddAtom("C"), appleSmell.AddAtom("C"), appleSmell.AddAtom("C"), }; var oxygens = new[] { appleSmell.AddAtom("O"), appleSmell.AddAtom("O") }; appleSmell.AddBond(carbons[0], carbons[1], BondOrder.Single); appleSmell.AddBond(carbons[1], carbons[2], BondOrder.Single); appleSmell.AddBond(carbons[2], carbons[3], BondOrder.Single); appleSmell.AddBond(carbons[3], oxygens[0], BondOrder.Double); appleSmell.AddBond(carbons[3], oxygens[1], BondOrder.Single); appleSmell.AddBond(oxygens[1], carbons[4], BondOrder.Single); appleSmell.AddBond(carbons[4], carbons[5], BondOrder.Single); appleSmell.SetProperty(NCDK.CDKPropertyName.Title, nameof(appleSmell)); return(appleSmell); }
public static IAtomContainer Ethylene() { var ethylene = new AtomContainer(); var carbon = new[] { new Atom(ChemicalElement.C), new Atom(ChemicalElement.C), }; for (var i = 0; i < carbon.Length; i++) { ethylene.Atoms.Add(carbon[i]); for (var j = 0; j < 2; j++) { var hij = new Atom(ChemicalElement.H); ethylene.Atoms.Add(hij); ethylene.Bonds.Add(new Bond(carbon[i], hij, BondOrder.Single)); } } ethylene.Bonds.Add(new Bond(carbon[0], carbon[1], BondOrder.Double)); ethylene.SetProperty(NCDK.CDKPropertyName.Title, nameof(ethylene)); return(ethylene); }
public static IAtomContainer Glycine() { var glycine = new AtomContainer(); var nitrogen = glycine.AddAtom("N"); for (var i = 0; i < 2; i++) { glycine.AddBond(nitrogen, glycine.AddAtom("H"), BondOrder.Single); } var carbon0 = glycine.AddAtom("C"); glycine.AddBond(nitrogen, carbon0, BondOrder.Single); for (var i = 0; i < 2; i++) { glycine.AddBond(carbon0, glycine.AddAtom("H"), BondOrder.Single); } var carbon1 = glycine.AddAtom("C"); glycine.AddBond(carbon0, carbon1, BondOrder.Single); glycine.AddBond(carbon1, glycine.AddAtom("O"), BondOrder.Double); var oxy = glycine.AddAtom("O"); glycine.AddBond(carbon1, oxy, BondOrder.Single); glycine.AddBond(oxy, glycine.AddAtom("H"), BondOrder.Single); glycine.SetProperty(NCDK.CDKPropertyName.Title, nameof(glycine)); return(glycine); }
public static AtomContainer GetProgrammaticButanone() { var mol = new AtomContainer(); var c00 = new Atom(ChemicalElement.C); mol.Atoms.Add(c00); for (var i = 0; i < 3; i++) { var h = new Atom(ChemicalElement.H); var bond = new Bond(c00, h, BondOrder.Single); mol.Bonds.Add(bond); mol.Atoms.Add(h); } var c01 = new Atom(ChemicalElement.C); mol.Atoms.Add(c01); for (var i = 0; i < 2; i++) { var h = new Atom(ChemicalElement.H); var bond = new Bond(c01, h, BondOrder.Single); mol.Bonds.Add(bond); mol.Atoms.Add(h); } mol.Bonds.Add(new Bond(c00, c01, BondOrder.Single)); var c02 = new Atom(ChemicalElement.C); mol.Atoms.Add(c02); var o00 = new Atom(ChemicalElement.O); mol.Atoms.Add(o00); mol.Bonds.Add(new Bond(c02, o00, BondOrder.Double)); mol.Bonds.Add(new Bond(c01, c02, BondOrder.Single)); var c03 = new Atom(ChemicalElement.C); mol.Atoms.Add(c03); for (var i = 0; i < 3; i++) { var h = new Atom(ChemicalElement.H); var bond = new Bond(c03, h, BondOrder.Single); mol.Bonds.Add(bond); mol.Atoms.Add(h); } mol.Bonds.Add(new Bond(c02, c03, BondOrder.Single)); mol.SetProperty(NCDK.CDKPropertyName.Title, "butanone"); return(mol); }
public void TestInChI() { var mol = new AtomContainer(); string inchi = "InChI=1/CH2O2/c2-1-3/h1H,(H,2,3)"; mol.SetProperty(CDKPropertyName.InChI, inchi); IAtomContainer roundTrippedMol = CMLRoundTripTool.RoundTripMolecule(convertor, mol); Assert.IsNotNull(roundTrippedMol); Assert.AreEqual(inchi, roundTrippedMol.GetProperty <string>(CDKPropertyName.InChI)); }
/// <summary> /// see https://pubchem.ncbi.nlm.nih.gov/compound/6389 /// </summary> public static IAtomContainer Trichlorofluoromethane() { var trichlorofluoromethane = new AtomContainer(); var carbon = trichlorofluoromethane.AddAtom("C"); for (var i = 0; i < 3; i++) { trichlorofluoromethane.AddBond(carbon, trichlorofluoromethane.AddAtom("Cl"), BondOrder.Single); } trichlorofluoromethane.AddBond(carbon, trichlorofluoromethane.AddAtom("F"), BondOrder.Single); trichlorofluoromethane.SetProperty(NCDK.CDKPropertyName.Title, nameof(trichlorofluoromethane)); return(trichlorofluoromethane); }
public static IAtomContainer DiethylEther() { var diethylEther = new AtomContainer(); var carbon0 = diethylEther.AddAtom("C"); for (var i = 0; i < 3; i++) { diethylEther.AddBond(carbon0, diethylEther.AddAtom("H"), BondOrder.Single); } var carbon1 = diethylEther.AddAtom("C"); diethylEther.AddBond(carbon0, carbon1, BondOrder.Single); for (var i = 0; i < 2; i++) { diethylEther.AddBond(carbon1, diethylEther.AddAtom("H"), BondOrder.Single); } var oxy = diethylEther.AddAtom("O"); diethylEther.AddBond(carbon1, oxy, BondOrder.Single); var carbon2 = diethylEther.AddAtom("C"); diethylEther.AddBond(oxy, carbon2, BondOrder.Single); for (var i = 0; i < 2; i++) { diethylEther.AddBond(carbon2, diethylEther.AddAtom("H"), BondOrder.Single); } var carbon3 = diethylEther.AddAtom("C"); for (var i = 0; i < 3; i++) { diethylEther.AddBond(carbon3, diethylEther.AddAtom("H"), BondOrder.Single); } diethylEther.AddBond(carbon2, carbon3, BondOrder.Single); diethylEther.SetProperty(NCDK.CDKPropertyName.Title, nameof(diethylEther)); return(diethylEther); }
public static IAtomContainer Water() { var water = new AtomContainer(); var oxy = water.AddAtom("O"); oxy.Charge = -0.5; var h1 = water.AddAtom("H"); h1.Charge = 0.25; var h2 = water.AddAtom("H"); h2.Charge = 0.25; water.AddBond(oxy, h1, BondOrder.Single); water.AddBond(oxy, h2, BondOrder.Single); water.SetProperty(NCDK.CDKPropertyName.Title, nameof(water)); return(water); }
public static IAtomContainer Refrigerant() { var refrigerant = new AtomContainer(); var carbon = refrigerant.AddAtom("C"); for (var i = 0; i < 2; i++) { refrigerant.AddBond(carbon, refrigerant.AddAtom("Cl"), BondOrder.Single); } for (var i = 0; i < 2; i++) { refrigerant.AddBond(carbon, refrigerant.AddAtom("F"), BondOrder.Single); } refrigerant.SetProperty(NCDK.CDKPropertyName.Title, nameof(refrigerant)); return(refrigerant); }
public void TestWrite_IAtomContainer_MultIAtomContainer() { StringWriter writer = new StringWriter(); SDFWriter sdfWriter = new SDFWriter(writer); var molecule = builder.NewAtomContainer(); molecule.Atoms.Add(new Atom("C")); molecule.SetProperty("foo", "bar"); sdfWriter.Write(molecule); molecule = new AtomContainer(); molecule.Atoms.Add(new Atom("C")); molecule.SetProperty("toys", "r-us"); sdfWriter.Write(molecule); sdfWriter.Close(); Assert.IsTrue(writer.ToString().IndexOf("foo") != -1); Assert.IsTrue(writer.ToString().IndexOf("bar") != -1); Assert.IsTrue(writer.ToString().IndexOf("toys") != -1); Assert.IsTrue(writer.ToString().IndexOf("r-us") != -1); Assert.IsTrue(writer.ToString().IndexOf("$$$$") != -1); }
public static IAtomContainer Antifreeze() { var antifreeze = new AtomContainer(); var oxy0 = antifreeze.AddAtom("O"); antifreeze.AddBond(antifreeze.AddAtom("H"), oxy0, BondOrder.Single); var carbon0 = antifreeze.AddAtom("C"); antifreeze.AddBond(oxy0, carbon0, BondOrder.Single); for (var i = 0; i < 2; i++) { antifreeze.AddBond(carbon0, antifreeze.AddAtom("H"), BondOrder.Single); } var carbon1 = antifreeze.AddAtom("C"); antifreeze.AddBond(carbon0, carbon1, BondOrder.Single); for (var i = 0; i < 2; i++) { antifreeze.AddBond(carbon1, antifreeze.AddAtom("H"), BondOrder.Single); } var oxy1 = antifreeze.AddAtom("O"); antifreeze.AddBond(carbon1, oxy1, BondOrder.Single); antifreeze.AddBond(oxy1, antifreeze.AddAtom("H"), BondOrder.Single); antifreeze.SetProperty(NCDK.CDKPropertyName.Title, nameof(antifreeze)); return(antifreeze); }
public static IAtomContainer DDT() { var ddt = new AtomContainer(); var benzeneLeft = Benzene(); benzeneLeft.AddBond(benzeneLeft.Atoms[0], benzeneLeft.AddAtom("Cl"), BondOrder.Single); var benzeneRight = Benzene(); benzeneRight.AddBond(benzeneRight.Atoms[0], benzeneRight.AddAtom("Cl"), BondOrder.Single); var carbon00 = ddt.AddAtom("C"); benzeneLeft.Atoms.Add(carbon00); benzeneLeft.AddBond(benzeneLeft.Atoms[3], carbon00, BondOrder.Single); benzeneRight.Atoms.Add(carbon00); benzeneRight.AddBond(benzeneRight.Atoms[3], carbon00, BondOrder.Single); ddt.AddAtomContainer(benzeneLeft); ddt.AddAtomContainer(benzeneRight); var carbon01 = ddt.AddAtom("C"); ddt.AddBond(carbon00, carbon01, BondOrder.Single); for (var i = 0; i < 3; i++) { ddt.AddBond(carbon01, ddt.AddAtom("Cl"), BondOrder.Single); } ddt.SetProperty(NCDK.CDKPropertyName.Title, "DDT"); return(ddt); }