What is ngspice?
Simulation Program with Integrated Circuit Emphasis. NGSPICE is an open source mixed-signal circuit simulator. It is freely available for use in Linux and Windows. It is recommended to use Linux for NGSPICE. NGSPICE requires you to describe your circuit as a netlist. A netlist is defined as a set of circuit components and their interconnections.
Why install from source?
Because the most recent code has some nasty bug fixed. If not, you can fix the bugs in the code yourself, build and install the freshly built binaries.
Well, there is this one bug I found, when you plot multiple lines like in transistor output characteristics, you get the lines joining back to the origin after the last point as seen below.
How do you fix this bug?
There was this one suggestion on Stackexchange answer that suggested to edit an if statement to check that on addition some more conditions are fullfilled. The suggestion was to edit line 277 (it was actually line 273) of the file graf.c to replace the code
if (np) DevDrawLine(fromx, fromy, tox, toy);
With the code
if (np && (tox > fromx)) DevDrawLine(fromx, fromy, tox, toy);
The first thing we want to do is get the source
cd ~/src/ git clone https://git.code.sf.net/p/ngspice/ngspice ngspice cd ngspice
Then after making the above mentioned change in graf.c, configure the sources ready for building
./autogen.sh ./configure --with-readline --enable-xspice
The –with-readline option helps in the command-line to store the history of the commands you type in the ngspice interactive mode so you can use the up/down arrow keys to navigate the history instead of retyping them every time. That feature is very useful in the learning process where trial and error is needed :-).
The configure command breaks with some errors to do with Xaw library not found. I found a suggestion to install the package libxaw-dev on debian based systems. I found the package libxaw7-dev was available by using tab auto-complete feature in the terminal.
sudo apt install libxaw7-dev
now configure works. Next build the source
Install the binaries in default location(/usr/local/bin)
sudo make install ls /usr/local/bin
and now we have one more bug free ngspice which produces this graph