When an SCF calculation is done in a QM program, the MO coefficients of the solution are printed into the output. Now, graphical softwares can plot 3D molecular orbitals from these coefficients, presumably by combining the basis set and the coefficients.
This is the first part of the output of an RHF/MIDI calculation on an $\ce{H2O}$ molecule with GAMESS(US):
------------
EIGENVECTORS
------------
1 2 3 4 5
-20.4191 -1.3388 -0.6850 -0.5393 -0.4837
A A A A A
1 O 1 S 0.989154 -0.220275 -0.001184 0.079432 -0.000000
2 O 1 S 0.065271 0.487564 0.002152 -0.177885 -0.000000
3 O 1 S -0.034882 0.438551 0.006441 -0.333617 -0.000000
4 O 1 X 0.001409 0.036986 0.314950 0.210975 0.164841
5 O 1 Y -0.000292 -0.007466 -0.121285 -0.044237 0.484575
6 O 1 Z 0.002563 0.069802 -0.193015 0.375649 -0.035515
7 O 1 X -0.002020 0.037929 0.308448 0.249550 0.207751
8 O 1 Y 0.000419 -0.007817 -0.118676 -0.052406 0.610715
9 O 1 Z -0.003659 0.069385 -0.187599 0.443221 -0.044760
10 H 2 S 0.000324 0.134487 0.264755 0.153642 -0.000000
11 H 2 S 0.006519 0.005342 0.148311 0.110818 -0.000000
12 H 3 S 0.000260 0.138002 -0.267972 0.150940 -0.000000
13 H 3 S 0.006664 0.004777 -0.147661 0.106685 -0.000000
The basis set is:
O
1 S 1 281.8665800 0.069059895330
1 S 2 42.4160000 0.393159473412
1 S 3 9.0956200 0.665669054983
2 S 4 11.4660300 -0.145056191626
2 S 5 0.8878600 1.044738808830
3 S 6 0.2788000 1.000000000000
4 P 7 8.0472400 0.226466081004
4 P 8 1.6684200 0.868524024343
5 P 9 0.3725100 1.000000000000
H
6 S 10 4.5018000 0.156285427224
6 S 11 0.6814440 0.904690578596
7 S 12 0.1513980 1.000000000000
H
8 S 13 4.5018000 0.156285427224
8 S 14 0.6814440 0.904690578596
9 S 15 0.1513980 1.000000000000
At this point, I don't know how to combine the coefficients with the primitives in the basis set. Clearly the symbols on the left side of the MO coefficients indicate S, px, py, pz... etc orbitals. So, according to the output, Oxygen should have 3 S, then 3 P and then 3 P orbitals. But the basis set has 6 S and 3 P functions. So I don't know which basis primitives correspond to which AO name (i.e. s, px etc.).
Could someone help me understand how the final MOs are constructued from the coefficients and the basis set?