Exemple #1
0
        /// <summary>
        /// Get the version of Java that was used to build the CDK .jar file
        /// </summary>
        /// <returns></returns>

        /// <summary>
        /// GetHydrogenAdder
        /// </summary>
        /// <returns></returns>

        static CDKHydrogenAdder GetHydrogenAdder()
        {
            if (_hydrogenAdder == null)
            {
                _hydrogenAdder = CDKHydrogenAdder.GetInstance();
            }
            return(_hydrogenAdder);
        }
Exemple #2
0
        public static void Script8_3()
        {
            var parser = new SmilesParser();
            var hAdder = CDKHydrogenAdder.GetInstance();

            var methanol = parser.ParseSmiles("CO");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(methanol);
            hAdder.AddImplicitHydrogens(methanol);
            AtomContainerManipulator.ConvertImplicitToExplicitHydrogens(methanol);

            var dimethoxymethane = parser.ParseSmiles("COC");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(dimethoxymethane);
            hAdder.AddImplicitHydrogens(dimethoxymethane);
            AtomContainerManipulator.ConvertImplicitToExplicitHydrogens(dimethoxymethane);

            var water = parser.ParseSmiles("O");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(water);
            hAdder.AddImplicitHydrogens(water);
            AtomContainerManipulator.ConvertImplicitToExplicitHydrogens(water);

            var reaction = new Reaction();

            reaction.Reactants.Add(methanol, 2.0D);
            reaction.Products.Add(dimethoxymethane);
            reaction.Products.Add(water);

            Console.WriteLine("Reactants:");

            foreach (var reactant in reaction.Reactants)
            {
                var formula = MolecularFormulaManipulator.GetMolecularFormula(reactant);
                Console.WriteLine(MolecularFormulaManipulator.GetString(formula));
            }

            Console.WriteLine("Products: ");
            foreach (var product in reaction.Products)
            {
                var formula = MolecularFormulaManipulator.GetMolecularFormula(product);
                Console.WriteLine(MolecularFormulaManipulator.GetString(formula));
            }
        }