How to perform Mulliken population analysis by hand with GAMESS output? I did a simple calculation on hydrogen fluoride with GAMESS and I wanted to reproduce the Mulliken population analysis for atomic orbitals.

A molecular orbital is a linear combination of atomic orbitals and if I understand correctly the Mulliken analysis uses coefficients to calculate population (overlap or atomic).

In the molecular orbital part of my GAMESS output, if I want to calculate the population of the 1s orbital of the hydrogen, I'm summing every coefficients squared of the contribution of this AO in all the MO, but I'm not getting the right answer.

Would someone be able to clarify this?

INPUT:

 $CONTRL SCFTYP=RHF RUNTYP=OPTIMIZE COORD=CART ICHARG=0 MULT=1 $END
 $SYSTEM TIMLIM=90  MEMORY=1000000 $END
 $STATPT OPTTOL=1.0E-4  NSTEP=100 $END
 $BASIS  GBASIS=STO NGAUSS=3 $END
 $SCF DIRSCF=.TRUE. $END
 $GUESS  GUESS=HUCKEL  $END
 $DATA
 HF
C1
H     1.0     0.00000     0.00000     0.00000
F     9.0     0.00000     0.00000     1.0000
 $END


OUTPUT: 

      ------------------
      MOLECULAR ORBITALS
      ------------------

                  1          2          3          4          5
              -25.9035    -1.4599    -0.5737    -0.4631    -0.4631
                 A          A          A          A          A
1  H  1  S    0.005341   0.150431  -0.533704   0.000000   0.000000
2  F  2  S   -0.994746  -0.250678  -0.078268   0.000000   0.000000
3  F  2  S   -0.022260   0.946703   0.410905   0.000000   0.000000
4  F  2  X    0.000000   0.000000   0.000000  -0.004070   0.999992
5  F  2  Y    0.000000   0.000000   0.000000  -0.999992  -0.004070
6  F  2  Z    0.002673  -0.078256   0.698060   0.000000   0.000000

                  6
                0.5898
                 A
1  H  1  S    1.054350
2  F  2  S    0.080571
3  F  2  S   -0.515861
4  F  2  X    0.000000
5  F  2  Y    0.000000
6  F  2  Z    0.816436

           ----- POPULATIONS IN EACH AO -----
                         MULLIKEN      LOWDIN
          1  H  1  S      0.80774     0.85856
          2  F  2  S      1.99913     1.99848
          3  F  2  S      1.94822     1.88452
          4  F  2  X      2.00000     2.00000
          5  F  2  Y      2.00000     2.00000
          6  F  2  Z      1.24491     1.25844
Using ORCA and reverse engineering the calculation provided in the question (HF/STO-3G at a $\ce{H}$-$\ce{F}$ distance of 0.955464 Angstroem), I obtained the following output, to which I added the matrix product of the density and overlap matrices, dubbed the Mulliken Population Matrix. By comparing to the output of other programs, the reader can follow the analysis.

------------------
MOLECULAR ORBITALS
------------------
                  0         1         2         3         4         5
             -25.90350  -1.45985  -0.57365  -0.46312  -0.46312   0.58982
               2.00000   2.00000   2.00000   2.00000   2.00000   0.00000
              --------  --------  --------  --------  --------  --------
0H   1s        -0.005340 -0.150428  0.533708 -0.000000  0.000000 -1.054338
1F   1s         0.994746  0.250679  0.078267 -0.000000  0.000000 -0.080569
1F   2s         0.022260 -0.946706 -0.410898  0.000000 -0.000000  0.515847
1F   1pz       -0.002673  0.078253 -0.698059  0.000000 -0.000000 -0.816434
1F   1px        0.000000 -0.000000 -0.000000 -0.998068 -0.062124 -0.000000
1F   1py       -0.000000  0.000000 -0.000000 -0.062124  0.998068  0.000000


-------
DENSITY
-------
              0          1          2          3          4          5
  0       0.615003  -0.002499  -0.154014  -0.768633  -0.000000   0.000000
  1      -0.002499   2.116969  -0.494672  -0.075355   0.000000  -0.000000
  2      -0.154014  -0.494672   2.131170   0.425379   0.000000   0.000000
  3      -0.768633  -0.075355   0.425379   0.986834  -0.000000   0.000000
  4      -0.000000   0.000000   0.000000  -0.000000   2.000000   0.000000
  5       0.000000  -0.000000   0.000000   0.000000   0.000000   2.000000

--------------
OVERLAP MATRIX
--------------
              0          1          2          3          4          5
  0       1.000000   0.045145   0.423474  -0.335755   0.000000   0.000000
  1       0.045145   1.000000   0.237990  -0.000000   0.000000   0.000000
  2       0.423474   0.237990   1.000000   0.000000   0.000000   0.000000
  3      -0.335755  -0.000000   0.000000   1.000000   0.000000   0.000000
  4       0.000000   0.000000   0.000000   0.000000   1.000000   0.000000
  5       0.000000   0.000000   0.000000   0.000000   0.000000   1.000000

--------------------------
MULLIKEN POPULATION MATRIX
--------------------------

 0,807741631  -0,0113884814   0,1058290434   -0,9751233323  0  0
-0,091108347   1,9991291934   0,0080871908   -0,0745159483  0  0
 0,583325991   0,0055721863   1,9482220861    0,4770899706  0  0
-0,923232404  -0,0088189886   0,0819491725    1,2449063729  0  0
 0             0              0               0             2  0
 0             0              0               0             0  2

-----------------------
MULLIKEN ATOMIC CHARGES
-----------------------
0 H :    0.192259
1 F :   -0.192259
Sum of atomic charges:    0.0000000