next up previous contents
Next: Printing Conventions Up: Programming Style Previous: Formatting the Code   Contents

Naming of Variables

All non-trivial data must be given descriptive names, although extremely long names are discouraged. For example, compound variable names like num_atoms or atom_orbit_degen should be preferred to nat or atord, so that non-specialists could understand the code. It is also a good idea to put a descriptive comment where a non-trivial variable is declared. However, simple loop indices should generally be named i,j,k or p,q,r.

PSI3 programs have certain conventions in place for names of most common variables, as shown in the Table 1.


Table 1: Some Variable Naming Conventions in PSI3
Quantity Variable(s)
Number of atoms na, natom, num_atoms
Number of atoms * 3 natom3, num_atoms3
Nuclear repulsion energy enuc, repnuc
SCF energy escf
Number of atomic orbitals nbfao, num_ao
Number of symmetry orbitals nbfso, num_so
Size of lower triangle  
of AO's, SO's nbatri, nbstri; ntri
Input file pointer infile
Output file pointer outfile
Offset array ioff
Number of irreps num_ir, nirreps
Open-shell flag iopen
Number of orbitals per irrep orbs_per_irrep, orbspi, mopi
Number of closed-shells  
per irrep docc, clsd_per_irrep, clsdpi
Number of open-shells  
per irrep socc, open_per_irrep, openpi
Orbital symmetry array orbsym


next up previous contents
Next: Printing Conventions Up: Programming Style Previous: Formatting the Code   Contents
psi 2003-01-07