Creating Subcircuits
Let's use a basic discrete Class A operational amplifier for our subcircuit:
The filename is sirius-purple-a-mk-2.sch, so the terminal command is:
gnetlist -g spice-sdb -o sirius-purple-a-mk-2.cir sirius-purple-a-mk-2.sch
Then open the .cir file in a text editor:
Change the last line from ".end" to ".ends".
Then add the .SUBCKT directive, the subcircuit name (I used sirius-purple-a for my subcircuit) and the connections (vpos is pin 1, vneg is pin 2, vcc is pin 3, vee is pin 4 and output is pin 5):
To include the subcircuit in your schematics, see the Using Subcircuits tutorial.