NEC2++ is a free (GPL v2) electromagnetic simulation software compatable with NEC-2. It has been rewritten from the ground up.
Nec2++ consists of a library that can be called from C++, C, python and Ruby, and so it can incorporated into other projects like GUI tools and automatic antenna optimization systems. There is also an executable necpp that can read antenna description files (like the original).
Nec2++ is developed on Debian linux, but will work on a variety of other operating systems.
If you use nec2++, please cite it as follows:
Timothy C.A. Molteno, ''NEC2++: An NEC-2 compatible Numerical Electromagnetics Code'', Electronics Technical Reports No. 2014-3, ISSN 1172-496X, October 2014.
NEC2++ can be used in several ways. Either standalone from the command line, or by using C, C++, Ruby or Python libriaries that are included.
Command line usage:
usage: nec2++ [-i<input-file-name>] [-o<output-file-name>] -g: print maximum gain to stdout. -b: Perform NEC++ Benchmark. -s: print results to standard output. -c: print results in comma-separated-value (CSV) format, this options is used in conjunction with (-s) above. -h: print this usage information and exit. -v: print nec2++ version number and exit.
The NEC2++ library provides an API for modeling structures. This interface is described in the libnecpp.h header file.
The C++ API for using NEC2++ is described in nec_context.h
An example using the python module is test.py
The code for the Ruby module for using nec2++ is contained in the directory Ruby.