/// <summary>
        /// Calculate the electronegativity of orbitals pi.
        /// </summary>
        /// <param name="ac"></param>
        /// <param name="atom">atom for which effective atom electronegativity should be calculated</param>
        /// <param name="maxIterations">The maximal number of Iteration</param>
        /// <param name="maxResonStruc">The maximal number of Resonance Structures</param>
        /// <returns>Electronegativity of orbitals pi.</returns>
        public double CalculatePiElectronegativity(IAtomContainer ac, IAtom atom, int maxIterations, int maxResonStruc)
        {
            MaxIterations          = maxIterations;
            MaxResonanceStructures = maxResonStruc;

            double electronegativity = 0;

            try
            {
                if (!ac.Equals(acOldP))
                {
                    molPi = ac.Builder.NewAtomContainer(ac);

                    peoe = new GasteigerMarsiliPartialCharges();
                    peoe.AssignGasteigerMarsiliSigmaPartialCharges(molPi, true);
                    var iSet = ac.Builder.NewAtomContainerSet();
                    iSet.Add(molPi);
                    iSet.Add(molPi);

                    gasteigerFactors = pepe.AssignrPiMarsilliFactors(iSet);

                    acOldP = ac;
                }
                IAtom  atomi        = molPi.Atoms[ac.Atoms.IndexOf(atom)];
                int    atomPosition = molPi.Atoms.IndexOf(atomi);
                int    stepSize     = pepe.StepSize;
                int    start        = (stepSize * (atomPosition) + atomPosition);
                double q            = atomi.Charge.Value;
                if (molPi.GetConnectedLonePairs(molPi.Atoms[atomPosition]).Any() ||
                    molPi.GetMaximumBondOrder(atomi) != BondOrder.Single || atomi.FormalCharge != 0)
                {
                    return((gasteigerFactors[1][start]) + (q * gasteigerFactors[1][start + 1]) + (gasteigerFactors[1][start + 2] * (q * q)));
                }
            }
            catch (Exception e)
            {
                Trace.TraceError(e.StackTrace);
            }

            return(electronegativity);
        }
Exemple #2
0
        /// <summary>
        /// calculate the electronegativity of orbitals sigma.
        /// </summary>
        /// <param name="ac">IAtomContainer</param>
        /// <param name="atom">atom for which effective atom electronegativity should be calculated</param>
        /// <param name="maxIterations">The maximal number of Iterations</param>
        /// <param name="maxResonStruc">The maximal number of Resonance Structures</param>
        /// <returns>piElectronegativity</returns>
        public double CalculateSigmaElectronegativity(IAtomContainer ac, IAtom atom, int maxIterations, int maxResonStruc)
        {
            MaxIterations          = maxIterations;
            MaxResonanceStructures = maxResonStruc;

            double electronegativity = 0;

            try
            {
                if (!ac.Equals(acOldS))
                {
                    molSigma = ac.Builder.NewAtomContainer(ac);
                    peoe.MaxGasteigerIterations = MaxIterations;
                    peoe.AssignGasteigerMarsiliSigmaPartialCharges(molSigma, true);
                    marsiliFactors = peoe.AssignGasteigerSigmaMarsiliFactors(molSigma);

                    acOldS = ac;
                }
                int stepSize     = peoe.StepSize;
                int atomPosition = ac.Atoms.IndexOf(atom);
                int start        = (stepSize * (atomPosition) + atomPosition);

                electronegativity =
                    marsiliFactors[start]
                    + (molSigma.Atoms[atomPosition].Charge.Value * marsiliFactors[start + 1])
                    + (marsiliFactors[start + 2]
                       * (molSigma.Atoms[atomPosition].Charge.Value * molSigma.Atoms[atomPosition].Charge.Value));
                return(electronegativity);
            }
            catch (Exception e)
            {
                Trace.TraceError(e.ToString());
            }

            return(electronegativity);
        }