Multiple Integration Using Simpson’s Rule – Calculation of the Ground State of the Non-Relativistic Helium Atom by James Pate Williams, Jr.

The six-dimensional Cartesian coordinate wavefunction is calculated by the C# method:

public double Psi(double[] x, double[] alpha)
        {
            double r1 = Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
            double r2 = Math.Sqrt(x[3] * x[3] + x[4] * x[4] + x[5] * x[5]);
            double r12 = Math.Sqrt(Math.Pow(x[0] - x[3], 2.0) +
                Math.Pow(x[1] - x[4], 2.0) + Math.Pow(x[2] - x[5], 2.0));
            double exp1 = Math.Exp(-alpha[0] * r1);
            double exp2 = Math.Exp(-alpha[1] * r2);
            double exp3 = Math.Exp(-alpha[2] * r12);

            return exp1 * exp2 * exp3;
        }

        public double Psi2(double[] x, double[] alpha)
        {
            double psi = Psi(x, alpha);

            return psi * psi;
        }

The wavefunction normalization method is:

public double Normalize(double[] alpha, int nSteps)
        {
            double[] lower = new double[6];
            double[] upper = new double[6];
            int[] steps = new int[6];

            lower[0] = 0.001;
            lower[1] = 0.001;
            lower[2] = 0.001;
            lower[3] = 0.001;
            lower[4] = 0.001;
            lower[5] = 0.001;

            upper[0] = 10.0;
            upper[1] = 10.0;
            upper[2] = 10.0;
            upper[3] = 10.0;
            upper[4] = 10.0;
            upper[5] = 10.0;

            for (int i = 0; i < 6; i++)
                steps[i] = nSteps;

            double norm = Math.Sqrt(integ.Integrate(
                lower, upper, alpha, Psi2, 6, steps));

            return norm;
        }

The two kinetic energy integrands are encapsulated in the following two methods:

private double Integrand1(double[] x, double[] alpha)
        {
            double r1 = Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
            double r2 = Math.Sqrt(x[3] * x[3] + x[4] * x[4] + x[5] * x[5]);
            double r12 = Math.Sqrt(Math.Pow(x[0] - x[3], 2.0) +
                Math.Pow(x[1] - x[4], 2.0) + Math.Pow(x[2] - x[5], 2.0));
            double term = -2.0 * alpha[0] / r1 + alpha[0] * alpha[0];
            double mul1 = Math.Exp(-2.0 * alpha[0] * r1);
            double mul2 = Math.Exp(-2.0 * alpha[1] * r2);
            double mul3 = Math.Exp(-2.0 * alpha[2] * r12);

            return N * N * term * mul1 * mul2 * mul3;
        }

        private double Integrand2(double[] x, double[] alpha)
        {
            double r1 = Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
            double r2 = Math.Sqrt(x[3] * x[3] + x[4] * x[4] + x[5] * x[5]);
            double r12 = Math.Sqrt(Math.Pow(x[0] - x[3], 2.0) +
                Math.Pow(x[1] - x[4], 2.0) + Math.Pow(x[2] - x[5], 2.0));
            double term = -2.0 * alpha[1] / r1 + alpha[1] * alpha[1];
            double mul1 = Math.Exp(-2.0 * alpha[0] * r1);
            double mul2 = Math.Exp(-2.0 * alpha[1] * r2);
            double mul3 = Math.Exp(-2.0 * alpha[2] * r12);

            return N * N * term * mul1 * mul2 * mul3;
        }

The two potential energy terms use the following two integrands:

private double Integrand3(double[] x, double[] alpha)
        {
            double r1 = Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
            double r2 = Math.Sqrt(x[3] * x[3] + x[4] * x[4] + x[5] * x[5]);
            double r12 = Math.Sqrt(Math.Pow(x[0] - x[3], 2.0) +
                Math.Pow(x[1] - x[4], 2.0) + Math.Pow(x[2] - x[5], 2.0));
            double term = 1.0 / r1;
            double mul =
                Math.Exp(-2.0 * alpha[0] * r1) *
                Math.Exp(-2.0 * alpha[1] * r2) *
                Math.Exp(-2.0 * alpha[2] * r12);

            return -N * N * Z * term * mul;
        }

        private double Integrand4(double[] x, double[] alpha)
        {
            double r1 = Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
            double r2 = Math.Sqrt(x[3] * x[3] + x[4] * x[4] + x[5] * x[5]);
            double r12 = Math.Sqrt(Math.Pow(x[0] - x[3], 2.0) +
                Math.Pow(x[1] - x[4], 2.0) + Math.Pow(x[2] - x[5], 2.0));
            double term = 1.0 / r2;
            double mul =
                Math.Exp(-2.0 * alpha[0] * r1) *
                Math.Exp(-2.0 * alpha[1] * r2) *
                Math.Exp(-2.0 * alpha[2] * r12);

            return -N * N * Z * term * mul;
        }

The electron-electron repulsion integrand is given by:

private double Integrand5(double[] x, double[] alpha)
        {
            double r1 = Math.Sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
            double r2 = Math.Sqrt(x[3] * x[3] + x[4] * x[4] + x[5] * x[5]);
            double r12 = Math.Sqrt(Math.Pow(x[0] - x[3], 2.0) +
                Math.Pow(x[1] - x[4], 2.0) + Math.Pow(x[2] - x[5], 2.0));

            if (r12 == 0)
                r12 = 0.01;

            double term = 1.0 / r12;
            double mul =
                Math.Exp(-2.0 * alpha[0] * r1) *
                Math.Exp(-2.0 * alpha[1] * r2) *
                Math.Exp(-2.0 * alpha[2] * r12);

            return N * N * term * mul;
        }

The ground state non-relativistic energy is computed by the method:

public double Energy(double[] alpha, int nSteps, int Z)
        {
            double[] lower = new double[6];
            double[] upper = new double[6];
            int[] steps = new int[6];

            lower[0] = lower[1] = lower[2] = lower[3] = lower[4] = lower[5] = 0.001;
            upper[0] = upper[1] = upper[2] = upper[3] = upper[4] = upper[5] = 10.0;
            steps[0] = steps[1] = steps[2] = steps[3] = steps[4] = steps[5] = nSteps;

            N = Normalize(alpha, nSteps);

            this.Z = Z;

            double integ1 = integ.Integrate(lower, upper, alpha, Integrand1, 6, steps);
            double integ2 = integ.Integrate(lower, upper, alpha, Integrand2, 6, steps);
            double integ3 = integ.Integrate(lower, upper, alpha, Integrand3, 6, steps);
            double integ4 = integ.Integrate(lower, upper, alpha, Integrand4, 6, steps);
            double integ5 = integ.Integrate(lower, upper, alpha, Integrand5, 6, steps);
            
            return integ1 + integ2 - integ3 - integ4 + integ5;
        }

Using trial and error we calculate Alpha as: 0.535139999999

public double Integrate(double[] lower, double[] upper, double[] alpha,
            Func<double[], double[], double> f, int n, int[] steps)
        {
            double p = 1;
            double[] h = new double[n];
            double[] h2 = new double[n];
            double[] s = new double[n];
            double[] t = new double[n];
            double[] x = new double[n];
            double[] w = new double[n];

            for (int i = 0; i < n; i++)
            {
                h[i] = (upper[i] - lower[i]) / steps[i];
                h2[i] = 2.0 * h[i];
            }

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                    x[j] = lower[j];
                
                x[i] = lower[i] + h[i];

                for (int j = 1; j < steps[i]; j += 2)
                {
                    s[i] += f(x, alpha);
                    x[i] += h2[i];
                }

                for (int j = 0; j < n; j++)
                    x[j] = lower[j];

                x[i] = lower[i] + h2[i];

                for (int j = 2; j < steps[i]; j += 2)
                {
                    t[i] += f(x, alpha);
                    x[i] += h2[i];
                }

                w[i] = h[i] * (f(lower, alpha) + 4 * s[i] + 2 * t[i] + f(upper, alpha)) / 3.0;
            }

            for (int i = 0; i < n; i++)
                p *= w[i];

            return p;
        }
Unknown's avatar

Author: jamespatewilliamsjr

My whole legal name is James Pate Williams, Jr. I was born in LaGrange, Georgia approximately 70 years ago. I barely graduated from LaGrange High School with low marks in June 1971. Later in June 1979, I graduated from LaGrange College with a Bachelor of Arts in Chemistry with a little over a 3 out 4 Grade Point Average (GPA). In the Spring Quarter of 1978, I taught myself how to program a Texas Instruments desktop programmable calculator and in the Summer Quarter of 1978 I taught myself Dayton BASIC (Beginner's All-purpose Symbolic Instruction Code) on LaGrange College's Data General Eclipse minicomputer. I took courses in BASIC in the Fall Quarter of 1978 and FORTRAN IV (Formula Translator IV) in the Winter Quarter of 1979. Professor Kenneth Cooper, a genius poly-scientist taught me a course in the Intel 8085 microprocessor architecture and assembly and machine language. We would hand assemble our programs and insert the resulting machine code into our crude wooden box computer which was designed and built by Professor Cooper. From 1990 to 1994 I earned a Bachelor of Science in Computer Science from LaGrange College. I had a 4 out of 4 GPA in the period 1990 to 1994. I took courses in C, COBOL, and Pascal during my BS work. After graduating from LaGrange College a second time in May 1994, I taught myself C++. In December 1995, I started using the Internet and taught myself client-server programming. I created a website in 1997 which had C and C# implementations of algorithms from the "Handbook of Applied Cryptography" by Alfred J. Menezes, et. al., and some other cryptography and number theory textbooks and treatises.

Leave a comment