コード例 #1
0
        /// <param name="maxIterations">Number of maximum iterations</param>
        /// <param name="checkLonePairElectron">Checking lone pair electrons. Default <see langword="true"/></param>
        /// <param name="maxResonanceStructures">Number of maximum resonance structures to be searched</param>
        public PartialPiChargeDescriptor(IAtomContainer container,
                                         int maxIterations          = int.MaxValue,
                                         bool checkLonePairElectron = true,
                                         int maxResonanceStructures = int.MaxValue)
        {
            clonedContainer = (IAtomContainer)container.Clone();
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(clonedContainer);

            var pepe = new GasteigerPEPEPartialCharges();

            if (checkLonePairElectron)
            {
                CDK.LonePairElectronChecker.Saturate(clonedContainer);
            }
            if (maxIterations != int.MaxValue)
            {
                pepe.MaxGasteigerIterations = maxIterations;
            }
            if (maxResonanceStructures != int.MaxValue)
            {
                pepe.MaxResonanceStructures = maxResonanceStructures;
            }

            foreach (var catom in clonedContainer.Atoms)
            {
                catom.Charge = 0;
            }
            pepe.AssignGasteigerPiPartialCharges(clonedContainer, true);

            this.container = container;
        }
コード例 #2
0
        /// <param name="maxIterations">Number of maximum iterations</param>
        /// <param name="checkLonePairElectron">Checking lone pair electrons. Default <see langword="true"/></param>
        /// <param name="maxResonanceStructures">Number of maximum resonance structures to be searched</param>
        public PartialTChargePEOEDescriptor(IAtomContainer container,
                                            int maxIterations          = int.MaxValue,
                                            bool checkLonePairElectron = true,
                                            int maxResonanceStructures = int.MaxValue)
        {
            clonedContainer = (IAtomContainer)container.Clone();
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(clonedContainer);

            var pepe = new GasteigerPEPEPartialCharges();

            if (checkLonePairElectron)
            {
                CDK.LonePairElectronChecker.Saturate(clonedContainer);
            }
            if (maxIterations != int.MaxValue)
            {
                pepe.MaxGasteigerIterations = maxIterations;
            }
            if (maxResonanceStructures != int.MaxValue)
            {
                pepe.MaxResonanceStructures = maxResonanceStructures;
            }

            var peoe = new GasteigerMarsiliPartialCharges();

            peoe.AssignGasteigerMarsiliSigmaPartialCharges(clonedContainer, true);
            var peoeAtom = clonedContainer.Atoms.Select(n => n.Charge.Value).ToList();

            foreach (var aatom in clonedContainer.Atoms)
            {
                aatom.Charge = 0;
            }
            pepe.AssignGasteigerPiPartialCharges(clonedContainer, true);

            for (int i = 0; i < clonedContainer.Atoms.Count; i++)
            {
                var aatom = clonedContainer.Atoms[i];
                aatom.Charge = aatom.Charge.Value + peoeAtom[i];
            }

            this.container = container;
        }