how to change the number of harmonics for THD in LTSpice
.FOUR -- Compute a Fourier Component after a .TRAN Analysis

Syntax: .four &lt;frequency&gt; [Nharmonics] [Nperiods] &lt;data trace1&gt; [&lt;data trace2&gt; ...]


If we define [Nharmonics] ,then analysis includes that (Nharmonics) number of harmonics.

Example
.four 1kHz 50 V(out)
It will find THD with 50 harmonics.

Reference: http://ltwiki.org/index.php5?title=FOUR_dot_command