ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/nonbonded/SlaterIntegrals.hpp
(Generate patch)

Comparing branches/development/src/nonbonded/SlaterIntegrals.hpp (file contents):
Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC vs.
Revision 1875 by gezelter, Fri May 17 14:41:42 2013 UTC

# Line 121 | Line 121 | inline RealType RosenA(int n, RealType a)
121   * @return the value of Rosen's B integral
122   * @note N. Rosen, Phys. Rev., 38 (1931), 255
123   */
124 < inline RealType RosenB(int n, RealType alpha)
125 < {
126 <  RealType TheSum, Term;
127 <  RealType RosenB_, PSinhRosenA, PCoshRosenA, PHyperRosenA;
124 > inline RealType RosenB(int n, RealType alpha) {
125 >  RealType RosenB_;
126  
127    if (alpha != 0.)
128      {
129 <      Term = 1.;
129 >      RealType Term = 1.;
130        bool IsPositive = true;
131                  
132        // These two expressions are (up to constant factors) equivalent
133        // to computing the hyperbolic sine and cosine of a respectively
134        // The series consists of adding up these terms in an alternating fashion
135 <      PSinhRosenA =  exp(alpha) - exp(-alpha);
136 <      PCoshRosenA = -exp(alpha) - exp(-alpha);
137 <      TheSum = PSinhRosenA;
135 >      RealType PSinhRosenA =  exp(alpha) - exp(-alpha);
136 >      RealType PCoshRosenA = -exp(alpha) - exp(-alpha);
137 >      RealType TheSum = PSinhRosenA;
138 >      RealType PHyperRosenA;
139        for (unsigned nu=1; nu<=n; nu++)
140          {
141            if (IsPositive)
# Line 226 | Line 225 | inline RealType sSTOCoulInt(RealType a, RealType b, in
225        RealType Term1 = fact[2*m - 1] / pow(2*a, 2*m);
226        RealType Term2 = 0.;
227        for (int nu = 1; nu <= 2*n; nu++) {
228 <        Term2 += nu * pow(2*b, 2*n - nu) * fact[2*(m+n)-nu-1] / (fact[2*n-nu]*2*n * pow(2*(a+b), 2*(m+n)-nu));
228 >        Term2 += nu * pow(2*b, 2*n - nu) * fact[2*(m+n)-nu-1] /
229 >          (fact[2*n-nu]*2*n * pow(2*(a+b), 2*(m+n)-nu));
230        }
231        sSTOCoulInt_ = pow(2*a, 2*m+1) * (Term1 - Term2) / fact[2*m];
232  
# Line 394 | Line 394 | inline RealType sSTOCoulIntGrad(RealType a, RealType b
394   */
395   inline RealType sSTOCoulIntGrad(RealType a, RealType b, int m, int n, RealType R)
396   {
397 <  RealType x, y, z, K2, TheSum;
397 >  RealType x;
398    // x is the argument of the auxiliary RosenA and RosenB functions
399    x = 2. * a * R;
400          
# Line 407 | Line 407 | inline RealType sSTOCoulIntGrad(RealType a, RealType b
407      }
408    else
409      {
410 +      RealType K2, TheSum;
411        if (a == b)
412          {
413            TheSum = 0.;
# Line 432 | Line 433 | inline RealType sSTOCoulIntGrad(RealType a, RealType b
433          {
434            // Slater exponents are different
435            // First calculate some useful arguments
436 <          y = R*(a+b);
437 <          z = R*(a-b);
436 >          RealType y = R*(a+b);
437 >          RealType z = R*(a-b);
438            TheSum = 0.;
439            for (int nu=0; nu<=2*n-1; nu++)
440              {
# Line 478 | Line 479 | inline RealType sSTOOvIntGrad(RealType a, RealType b,
479   * @note Derived in QTPIE research notes, May 15 2007
480   */
481   inline RealType sSTOOvIntGrad(RealType a, RealType b, int m, int n, RealType R)
482 < {
482 <  RealType w, x, y, z, TheSum;
483 <        
482 > {      
483    // Calculate first term
484    RealType sSTOOvIntGrad_ = (m+n+1.)/R * sSTOOvInt(a, b, m, n, R);
485          
486    // Calculate remaining terms; answers depend on exponents
487 <  TheSum = 0.;
488 <  x = a * R;
487 >  RealType TheSum = 0.;
488 >  RealType x = a * R;
489    if (a == b)
490      {
491        for (int q=0; q<=(m+n)/2; q++)
# Line 495 | Line 494 | inline RealType sSTOOvIntGrad(RealType a, RealType b,
494      }
495    else
496      {
497 <      w = b*R;
498 <      y = 0.5*R*(a+b);
499 <      z = 0.5*R*(a-b);
497 >      RealType w = b*R;
498 >      RealType y = 0.5*R*(a+b);
499 >      RealType z = 0.5*R*(a-b);
500        for (int q=0; q<m+n; q++)
501          TheSum = TheSum + RosenD(m,n,q) *
502            ((a-b)*RosenB(q+1,z)*RosenA(m+n-q  ,y)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines