The high-harmonic generation (HHG) spectrum  in the dipole acceleration form is calculated
by
      
         251
      
      
         
            
           Int. J. Quantum Chem.
 
           (2016), 
           116,
           pp. 1120.
        
        
            
               Link
            
        
     
   ,
      
         100
      
      
         
            
           J. Chem. Phys.
 
           (2019), 
           150,
           pp. 234114.
        
        
            
               Link
            
        
     
   
| (7.62) | 
where is some kind of window function to improve spectrum quality, and is the time-dependent dipole moment component. For light polarized in the direction (), we have (), and Eq. (7.62) becomes
| (7.63) | 
The incorporation of a complex absorbing potential (CAP) is frequently preferred to mitigate artifacts arising from the finite-basis approximation, see Section 7.4.2.3.
A script is provided to obtain the spectrum after the TDKS simulation is completed:
$QC/bin/tools/tdks_hhg.py
This uses Eq. (7.63) with  taken to be the Hamming window function.
      
         1503
      
      
         
            
           J. Chem. Phys.
 
           (2022), 
           156,
           pp. 204123.
        
        
            
               Link
            
        
     
   
For , the script can be run as follows:
python3 $QC/bin/tools/tdks_hhg.py z output spectrum.txt
The file spectrum.txt produced by the processing script will contain two columns: harmonic order and logarithmic strength (arbitrary units).
The harmonic order is  divided by FIELD_FREQUENCY, and the logarithmic strength is .
These data can be visualized as an  plot to view the spectrum. Users of Q-Chem’s TDKS code for HHG spectra are asked to cite
Ref. 
      1503
      
         
            
           J. Chem. Phys.
 
           (2022), 
           156,
           pp. 204123.
        
        
            
               Link
            
        
     
   
.