What Daniel says is correct and applies to all SPICEs unless they are seriously enhanced. However what you can do is to vary some sensible design parameters using .step param
and see how the output changes. But it won't design an optimal circuit for you by itself. There are some hacks using SPICE in a feedback loop, i.e. driving it by some other external program to do a guided optimization. Without knowing what you're trying to do, I'm not gonna get into that.
It turns out most [non-free] commercial SPICEs actually do offer some add-on or built-in optimizer. Below I tried to include links to examples with each so you can get some idea; generally these commercial SPICE don't have on-line documentation accessible unless you're paying customer, so precise capabilities are little hard to ascertain beforehand.
- Synopsys HSPICE: fairly old examples found on-line.
- Silvaco SmartSpice: slides from a training.
- Mentor Graphics Eldo: whitepaper that requires registration to read.
- and even IsSpice4 or TINA (not the free TI version though) have something.
- Keysight's ADS Spice module has some capabilities listed in this blurb, but I could only find on-line examples (that didn't require customer log-in) for their for their Momentum EM optimizer.
- Cadence PSpice and Spectre (SPICE-alike) each have their own optimizer. The one for PSpice is included only in the Designer Plus version.
- OPUS SPICE is the only free one that seem to have such features, but they are pretty extensive; also paper about them. (OPUS is kinda kludgy to use for other purposes, in my opinion.)
Since the optimization function[s] are not part of Berkeley SPICE, you should expect a fair amount of differences between these, so evaluate before you buy if you can.
As a separate optimizer that runs on top of other SPICEs, ASCO seems pretty capable... and it's also free; It can run with LTspice, ngspice and with some of the non-free commercial ones (Eldo, HSPICE, Spectre). Also, Qucs uses ASCO for optimization.