CamCASP/Interfaces

From CUC3
Jump to navigation Jump to search

CamCASP => Interfaces

This page describes details of interfaces to various SCF codes. Also see details of basis sets given in section Basis functions .

NWChem

Interface

All we've used NWChem with are spherical GTOs. It supplied MO coefficients as standing in front of fully normalized spherical GTOs (like any sensible code should!). But the sign of some of these is different:

d1+ ==> - d1+
f1+ ==> - f1+
f3+ ==> - f3+
g1+ ==> - g1+
g3+ ==> - g3+

User-defined basis sets

Scratch_dir /scratch/alston/CH2-nwchem

start ch2-rhf

Geometry units angstrom

C    0.0      0.0     0.0
H1   0.92884  0.7079 -0.2
H2  -0.82884  0.7079  0.2

End

Basis Spherical Nosegment
 carbon  S
           8236.0000000    0.000542430189
           1235.0000000    0.004196427901
            280.8000000    0.021540914108
             79.2700000    0.083614949614
             25.5900000    0.239871618922
              8.9970000    0.443751820060
              3.3190000    0.353579696469
              0.3643000   -0.009176366076
 carbon  S
           8236.0000000   -0.000196392234
           1235.0000000   -0.001525950274
            280.8000000   -0.007890449028
             79.2700000   -0.031514870532
             25.5900000   -0.096910008320
              8.9970000   -0.220541526288
              3.3190000   -0.296069112937
              0.3643000    1.040503432950
 carbon  S
              0.9059000    1.000000000000
 carbon  S
              0.1285000    1.000000000000
 carbon  P
             18.7100000    0.039426387165
              4.1330000    0.244088984924
              1.2000000    0.815492008943
 carbon  D
              1.0970000    1.000000000000
 carbon  F
              0.7610000    1.000000000000
 hydrogen  S
             33.8700000    0.025494863235
              5.0950000    0.190362765893
              1.1590000    0.852162022245
 hydrogen  S
              0.3258000    1.000000000000
 hydrogen  P
              1.4070000    1.000000000000
End

Title "CH2  RHF/aTZ"


task scf

The EMSL Basis portal supplies basis sets with the atom symbol in place of a name. So perhaps we can use the symbol instead. We will need a converter to convert our GAMESS(US) formatted basis sets to NWChem format.

GAMESS(US)

Interface Details

GAMESS(US) uses Spherical GTOs in a slightly different way from other codes. The MO coefficients of its spherical GTOs are not supplied as standing in front of the components of the spherical GTOs, but rather they stand in front of the Cartesian components. To make this concrete, rather than supply 5 sets of 5 MO coefficients for a spherical d-function (each set of 5 would correspond to an MO), GAMESS(US) will supply 5 sets of 6 coefficients. Each of these 6 would stand in front of Cartesian GTOs. This is OK, but the normalization of these Cartesian GTOs is rather awkward. I have worked out the transformation matrices from these Cartesian GTOs to an equivalent spherical set.

Here are some comments from subroutine trans3 which is contained in subroutine transform_mos in module molecular_orbitals:

    !(1) GAMESS(US) writes out coefficients of MOs of spherical GTOs not as they
    !stand infront of the components of spherical GTOs (which would be logical),
    !but as they stand in front of Cartesian GTOs. So we get 6 coefficients for
    !a d-function, 7 for an f, etc. 
    ! 
    !(2) The order of the Cartesian functions is the
    !same as that in CamCASP. See module basis_trans_mats. This is not
    !surprising as we use the GAMINT interal module for our integrals. This
    !module is the same as that used by GAMESS(US) - apart from modifications
    !made by Wojtek. 
    !
    !We can take care of points (1) and (2) by defining the transformation
    !matrices as the Cartesian to spherical transformation matrices.
    !This choice was made above by the call to 
    !  subroutine init_basis_trans_mats(2)
    !
    !(3) But the normalization of the Cartesian GTOs does not seem to be anything
    !I have encountered before. The following factors need to be included in the
    !transformation matrices:
    !  (3a) All coefficients in front of x^i y^j z^k get
    !  multiplied by sqrt[(2i-1)!!(2j-1)!!(2k-1)!!]
    !  (3b) The term x^i in (3a) gets multiplied by
    !       1    i=0
    !       1    i=1
    !       2/3  i=2
    !       2/5  i=3
    !       8/35 i=4
    !  With similar multipliers for y^j and z^k.
    !  I.e., xxy gets a multiplier of  (2/3)*1 = 2/3
    !  and   xxx gets a multiplied of (2/5)
    !  and   xxyy gets (2/3)*(2/3) = 4/9

And here's how this is implemented (part of subroutine trans3 follows):

use basis_trans_mats, only : BT0, BT1, BT2, BT3, BT4
...
    real(dp), dimension(0:4) :: gmsfac = (/                           &
        1.0_dp, 1.0_dp, 2.0_dp/3.0_dp, 2.0_dp/5.0_dp, 8.0_dp/35.0_dp  &
                                          /)
...
    select case(l)
    case(0)
      transmat(1:ncomp_trans,1:ncomp) = (BT0)
    case(1)
      transmat(1:ncomp_trans,1:ncomp) = (BT1)
    case(2)
      transmat(1:ncomp_trans,1:ncomp) = (BT2)
    case(3)
      transmat(1:ncomp_trans,1:ncomp) = (BT3)
    case(4)
      transmat(1:ncomp_trans,1:ncomp) = (BT4)
    case default
      print *,'INTERNAL ERROR in ',trim(this_routine)
      print *,'Illegal value of l received is ',l
      info = -1
      return
    end select
    !
    !Get Cartesian symmetry components (force GAMINT ordering):
    call map_symm_to_powers(l,i,j,k,order=par_order_symm_comp)
    do m = 1, ncomp
      fac = dfactorial(2*i(m)-1)*dfactorial(2*j(m)-1)*dfactorial(2*k(m)-1)
      fac = sqrt(fac)*gmsfac(i(m))*gmsfac(j(m))*gmsfac(k(m))
      ! transmat(i,m) = t(i,m) fac(m)
      transmat(1:ncomp_trans,m) = transmat(1:ncomp_trans,m) * fac
    enddo
    !

The effect of this subroutine is best seen with an example. Consider a basis of a single Spherical d-function. GAMESS(US) will supply MO coefficients as

       MO1    MO2    MO3   MO4  MO5
xx    C(1,1) C(2,1) C(1,3) ...  ... 
yy    C(2,1) C(2,2) ...    ...  ...
zz    ...
xy    ...
xz    ...
yz    ...                      C(6,5)

Ie., we get a 6 x 5 matrix C of MO coefficient. There are only 5 MOs, but 6 coefficients for each. What we need to do is determine a transformation matrix that transforms each of the sets of 6 coefficients into a set containing only 5, which would then stand in front of the fully normalized spherical GTOs used by CamCASP. To do this we use subroutine trans3 to define the matrix in the following manner.

First define the usual sort of Cartesian to Spherical transformation matrix. See details of basis sets given in section Basis functions . For the d-function this matrix is (called BT2 in the code fragment above):

                     xx   yy   zz   xy   xz   yz 
BT2 = 1      3d2- [                 rt3            ]
     ---   x 3d1- [                           rt3  ]
    sqrt(3)  3d0  [ -1/2 -1/2  1                   ]
             3d1+ [                      rt3       ]
             3d2+ [rt3/2 -rt3/2                    ]
where
   rt3 = sqrt(3) and blank terms are zeros.

Each column refers to a Cartesian GTO of the form <math>x^i y^j z^k</math>. We now multiply the column corresponding to <math>x^i y^j z^k</math> by <math>\sqrt{((2i-1)!!(2j-1)!!(2k-1)!!)}</math>. This is item (3a) in the comments extracted from subroutine term3 shown above. Additionally, we need to include item (3b). These multipliers are shown below:

    (3a)             rt3  rt3  rt3  1    1    1
    (3b)             2/3  2/3  2/3  1    1    1

                     xx   yy   zz   xy   xz   yz 
BT2 = 1      3d2- [                 rt3            ]
     ---   x 3d1- [                           rt3  ]
    sqrt(3)  3d0  [ -1/2 -1/2  1                   ]
             3d1+ [                      rt3       ]
             3d2+ [rt3/2 -rt3/2                    ]

Including all the multipliers we get the final matrix:

                     xx   yy   zz   xy   xz   yz 
             3d2- [                 1              ]
             3d1- [                           1    ]
  T =        3d0  [ -1/3 -1/3  2/3                 ]
             3d1+ [                      1         ]
             3d2+ [1/rt3 -1/rt3                    ]

And the transformation is then

   D = T * C
where 
   D is a 5 x 5 matrix of coefficients in the form needed by CamCASP. That is, the first MO is given by 
MO(1) = D(1,1)*G(3d2-) + D(2,1)*G(3d1-) + D(3,1)*G(3d0) + ...

Question: Could there have been an easier way to work this out? It took me ages. You can get GAMESS(US) to write out the transformation matrices it uses (see below) but it doesn't tell you how it normalizes the Cartesian GTOs. That's where I had a problem. To get it to write out the transformation matrices I needed to do a bit of hacking (it should have printed them out with EXETYP = DEBUG in the $CONTROL block, but it didn't.) At line 111 in symslc.src include an explicit call to CALL SPHPRT. This produces the following:

 SPHERICAL HARMONICS
 -------------------
 CHI(   1    S ) =  CHI(   1    S ) =   1.000 *    S
 CHI(   1  P X ) =  CHI(   1    P1) =   1.000 *    X  0.000 *    Y  0.000 *    Z
 CHI(   2  P Y ) =  CHI(   2    P2) =   0.000 *    X  1.000 *    Y  0.000 *    Z
 CHI(   3  P Z ) =  CHI(   3    P3) =   0.000 *    X  0.000 *    Y  1.000 *    Z
 CHI(   1  D Z2) =  CHI(   1    D1) =  -0.500 *   XX -0.500 *   YY  1.000 *   ZZ  0.000 *   XY  0.000 *   XZ  0.000 *   YZ
 CHI(   2  D X2) =  CHI(   2    D2) =   0.866 *   XX -0.866 *   YY  0.000 *   ZZ  0.000 *   XY  0.000 *   XZ  0.000 *   YZ
 CHI(   3  D XY) =  CHI(   3    D3) =   0.000 *   XX  0.000 *   YY  0.000 *   ZZ  1.000 *   XY  0.000 *   XZ  0.000 *   YZ
 CHI(   4  D XZ) =  CHI(   4    D4) =   0.000 *   XX  0.000 *   YY  0.000 *   ZZ  0.000 *   XY  1.000 *   XZ  0.000 *   YZ
 CHI(   5  D YZ) =  CHI(   5    D5) =   0.000 *   XX  0.000 *   YY  0.000 *   ZZ  0.000 *   XY  0.000 *   XZ  1.000 *   YZ
 CHI(   6  D S ) =  CHI(   6    DS) =   0.447 *   XX  0.447 *   YY  0.447 *   ZZ  0.000 *   XY  0.000 *   XZ  0.000 *   YZ
 CHI(   1    F1) =  CHI(   1    F1) =   0.791 *  XXX  0.000 *  YYY  0.000 *  ZZZ  0.000 *  XXY  0.000 *  XXZ -1.061 *  YYX
                                        0.000 *  YYZ  0.000 *  ZZX  0.000 *  ZZY  0.000 *  XYZ
 CHI(   2    F2) =  CHI(   2    F2) =   0.000 *  XXX  0.000 *  YYY  0.000 *  ZZZ  0.000 *  XXY  0.866 *  XXZ  0.000 *  YYX
                                       -0.866 *  YYZ  0.000 *  ZZX  0.000 *  ZZY  0.000 *  XYZ
 CHI(   3    F3) =  CHI(   3    F3) =  -0.612 *  XXX  0.000 *  YYY  0.000 *  ZZZ  0.000 *  XXY  0.000 *  XXZ -0.274 *  YYX
                                        0.000 *  YYZ  1.095 *  ZZX  0.000 *  ZZY  0.000 *  XYZ
 CHI(   4    F4) =  CHI(   4    F4) =   0.000 *  XXX  0.000 *  YYY  1.000 *  ZZZ  0.000 *  XXY -0.671 *  XXZ  0.000 *  YYX
                                       -0.671 *  YYZ  0.000 *  ZZX  0.000 *  ZZY  0.000 *  XYZ
 CHI(   5    F5) =  CHI(   5    F5) =   0.000 *  XXX -0.612 *  YYY  0.000 *  ZZZ -0.274 *  XXY  0.000 *  XXZ  0.000 *  YYX
                                        0.000 *  YYZ  0.000 *  ZZX  1.095 *  ZZY  0.000 *  XYZ
 CHI(   6    F6) =  CHI(   6    F6) =   0.000 *  XXX  0.000 *  YYY  0.000 *  ZZZ  0.000 *  XXY  0.000 *  XXZ  0.000 *  YYX
                                        0.000 *  YYZ  0.000 *  ZZX  0.000 *  ZZY  1.000 *  XYZ
 CHI(   7    F7) =  CHI(   7    F7) =   0.000 *  XXX -0.791 *  YYY  0.000 *  ZZZ  1.061 *  XXY  0.000 *  XXZ  0.000 *  YYX
                                        0.000 *  YYZ  0.000 *  ZZX  0.000 *  ZZY  0.000 *  XYZ
 CHI(   8  F P1) =  CHI(   8  F P1) =   0.655 *  XXX  0.000 *  YYY  0.000 *  ZZZ  0.000 *  XXY  0.000 *  XXZ  0.293 *  YYX
                                        0.000 *  YYZ  0.293 *  ZZX  0.000 *  ZZY  0.000 *  XYZ
 CHI(   9  F P2) =  CHI(   9  F P2) =   0.000 *  XXX  0.655 *  YYY  0.000 *  ZZZ  0.293 *  XXY  0.000 *  XXZ  0.000 *  YYX
                                        0.000 *  YYZ  0.000 *  ZZX  0.293 *  ZZY  0.000 *  XYZ
 CHI(  10  F P3) =  CHI(  10  F P3) =   0.000 *  XXX  0.000 *  YYY  0.655 *  ZZZ  0.000 *  XXY  0.293 *  XXZ  0.000 *  YYX
                                        0.293 *  YYZ  0.000 *  ZZX  0.000 *  ZZY  0.000 *  XYZ

But this didn't help as I didn't know how GAMESS(US) was normalizing the Cartesian GTOs!

The interface code in $CAMCASP/interfaces/gamessus/ is based on the gamsintf.F code from SAPT2006, but has been heavily modified. It's infinitely better!

Examples

User-defined basis sets with ghost-functions

 $CONTRL SCFTYP=RHF RUNTYP=ENERGY COORD=UNIQUE
         UNITS=BOHR NPRINT=-5 NOSYM=1 INTTYP=HONDO
         ISPHER=1 ITOL=26 ICUT=24 $END
 $SYSTEM MEMORY=220000 $END
 $GUESS  GUESS=HCORE $END
 $DATA
Ar in ArHF 86 functions, acpVDZ basis: monomer A, DCBS
C1
Ar        18.0    0.0         0.0      5.0
     S  7 1.0
     1  6928373.0   0.000002
     2  1037230.0   0.000015
     3  236034.70   0.000078
     4  66858.440   0.000329
     5  21813.690   0.001197
     6  7875.9300   0.003898
     7  3072.2630   0.011563
     S 10 1.0
     1  1274.5120   0.031361
     2  555.99500   0.076762
     3  252.80110   0.163303
     4  118.90690   0.280177
     5  57.450650   0.333084
     6  28.090080   0.208711
     7  13.097940   0.040730
     8  6.5044220  -0.000735
     9  3.2532260   0.001640
    10  1.6151790  -0.000616
...
...
     D  1 1.0
     1  0.840       1.0
     D  1 1.0
     1  0.174       1.0
     F  1 1.0
     1  0.23        1.0

H          0.0    0.0         1.645511268   0.0
     S 10 1.0
     1  6909.251    0.00001
     2  1034.623    0.00006
     3  235.4512    0.00033
     4  66.68922    0.00138
     5  21.75548    0.00500
     6  7.853013    0.01608
     7  3.062057    0.04618
     8  1.269367    0.11624
     9  0.553063    0.24107
    10  0.250866    0.35925
     S  1 1.0
     1  0.117111    1.0
     S  1 1.0
     1  0.054654    1.0
     P  1 1.0
     1  0.392       1.0
     P  1 1.0
     1  0.142       1.0
     D  1 1.0
     1  0.226       1.0

F          0.0    0.0       -0.087288732   0.0
     S  6 1.0
     1  72075.71    0.000060
     2  20416.83    0.000251
     3  6661.458    0.000916
     4  2405.188    0.002987
     5  938.2595    0.008882
     6  389.2710    0.024232
...
...
     D  2 1.0
     1  2.9532      0.18353
     2  0.9186      0.51058
     D  2 1.0
     1  0.2668      0.69925
     2  0.0775      0.42926
     F  1 1.0
     1  0.275       1.0

 $END
 $SCF NCONV=9 $END
 $INTGRL NOPK=1 NINTMX=2048 $END
 $MOROKM MOROKM=.FALSE. $END

The '1.0's in the angular momenta lines does not seem to be needed.