# Reading CGTF basis from Basis Set Exchange site

I'm making a simple electronic structure code as an exercise, and I want to confirm that my understanding about basis set data from BSE is correct.

The CGTF of H in aug-cc-pVTZ basis is given as:

H S

 33.8700000              0.0060680
5.0950000              0.0453080
1.1590000              0.2028220


H S

  0.3258000              1.0000000


H S

  0.1027000              1.0000000


H S

  0.0252600              1.0000000


H P

  1.4070000              1.0000000


H P

  0.3880000              1.0000000


H P

  0.1020000              1.0000000


H D

  1.0570000              1.0000000


H D

  0.2470000              1.0000000


END

S-type GTF is simple, but I have questions about the number of other high-l GTFs.

# P-type GTFs

I think the values H P

  1.4070000              1.0000000


mean that $$\chi = (1.00000) g_{p}$$. Then Does that means there are three p-type function ($$x$$, $$y$$, $$z$$)?

# D, F-type GTFs

If that so, in the upper case. How D, and F-type GTFs? Specifically, if we consider D-type GTFs, are there six gaussians ($$x^{2}$$, $$y^{2}$$, $$z^{2}$$, $$xy$$, $$yz$$, $$xz$$) or five gaussians following the atomic convention ($$xy$$, $$xz$$, $$yz$$, $$x^{2}-y^{2}$$, $$3z^{2}-r^{2}$$)?

Yes it is correct that for $p$-type basis functions that you have all three $p$-functions, i.e. $p_x$, $p_y$, $p_z$.
In many electronic-structure programs both conventions are used, since the integrals are calculated in cartisean coordinates and then afterwards transformed to spherical coordinates, i.e. as you stated for $d$-type functions going from 6 basis functions to 5 basis functions.
In regard to make you own electronic-structure code, I would recommend keeping everything in cartisean coordinates, because this will make your life simpler. (Keep in mind that if you compare you energy with from a Hartree-Fock calculation with other programs you will have a slightly lower energy, because you have 1 more $d$-type basis function).