1. Introduction:
GEFANS is a GTK2-based graphical environment for working with NEC-family antenna models and results. It can read and display NEC input files, load NEC output files, visualize antenna geometry, currents, radiation patterns, near-field data and frequency-domain results, and launch external NEC-compatible solvers through a simple input/output-file command-line interface.
GEFANS is derived from the xnecview code base and has been extended for broader NEC2/NEC4/NEC5 workflows. It also integrates code derived from nec2c for an optional built-in NEC2 solver.
GEFANS includes practical compatibility support for many existing 4nec2-style designs, including common 4nec2 comments, symbolic parameters, unit constants and expression syntax. This is intended to help users who already have antenna designs in 4nec2 open and test many of them in GEFANS and compare results with other NEC-family solvers. GEFANS is not intended to replace 4nec2, and it is not a promise to support every 4nec2-specific extension or workflow. If a remaining design uses unsupported 4nec2-only syntax, the user should convert that part manually to pure NEC format before running it through external solvers. The main goal of GEFANS is to open, visualize, edit, run and compare NEC files across different NEC-compatible solvers.
The current source tree keeps application source code under source/ and uses build/ only for generated build work and packages. Build scripts stage their work directly under build/<script-name>/ so that the repository root and source/ tree remain clean.
2. Compiling and running guides for Linux and Windows:
The public GitHub tree keeps only the main native Linux build script and the recommended Windows MSYS2/MinGW64 themed package script. Generated build work and packages are written under build/<script-name>/.
Linux build
Required packages include a C compiler, make, pkg-config, GTK2 development headers and libpng development headers. On Rocky/RHEL-style systems a typical base setup is:
sudo dnf install gcc make pkgconf-pkg-config gtk2-devel libpng-develA plain native build can be made directly from the source directory:
cd source
make clean
make
./gefansThe public Linux build script is:
./build_linux.shThis script is the Linux OpenBLAS/OpenMP build route used for the package tree. It builds GEFANS with the built-in NEC2 solver linked against OpenBLAS/LAPACK when the required libraries are available. Runtime thread control is usually done with variables such as:
export OPENBLAS_NUM_THREADS=4
export GOTO_NUM_THREADS=4
export OMP_NUM_THREADS=4If OpenBLAS/LAPACK, OpenMP or the required thread libraries are not available on the target Linux system, open source/Makefile, set:
INTERNAL_NEC2_LAPACK ?= noand then build normally:
cd source
make clean
make
./gefansThis disables the LAPACK/OpenBLAS internal NEC2 path and builds the normal GTK2 application path. External solvers can still be configured and used from inside GEFANS.
If OpenBLAS is installed in a non-standard location, the Linux build script can also be run with explicit flags, for example:
OPENBLAS_CFLAGS="-I/usr/include/openblas" \
OPENBLAS_LIBS="-L/usr/lib64 -lopenblaso -lgfortran -lgomp -lm -lpthread" \
./build_linux.shAdjust the include and library paths to match the target Linux system.
Windows build with MSYS2/MinGW64
Windows users can build GEFANS directly on Windows using MSYS2. The recommended public Windows build route is the themed MSYS2/MinGW64 package script. It builds a portable package with gefans.exe, the required MSYS2/MinGW64 runtime DLLs, and GTK2 runtime/theme data bundled under the package folder. The generated package can be copied to another Windows PC without requiring a full MSYS2 installation there.
Install MSYS2, open the MSYS2 MINGW64 shell, and install the typical dependencies:
pacman -S --needed \
mingw-w64-x86_64-gcc \
mingw-w64-x86_64-pkgconf \
mingw-w64-x86_64-gtk2 \
mingw-w64-x86_64-libpng \
mingw-w64-x86_64-openblas \
make zip tarThen build the themed package from the repository root:
./build_windows_msys2_mingw64_themed_pkg.shUseful overrides include:
JOBS=8 ./build_windows_msys2_mingw64_themed_pkg.sh
PKGDIR=GEFANS_msys2_mingw64_themed_win64_pkg ./build_windows_msys2_mingw64_themed_pkg.sh
INTERNAL_NEC2_LAPACK=no ./build_windows_msys2_mingw64_themed_pkg.shUse INTERNAL_NEC2_LAPACK=no when the MSYS2 OpenBLAS package is not installed or when you want to build without the LAPACK/OpenBLAS internal NEC2 path.
The generated package is written under:
build/build_windows_msys2_mingw64_themed_pkg/
Inside the generated package, use:
run_gefans_mingw64_portable_theme_hidden.vbs
for normal double-click use without a visible terminal window. Use:
run_gefans_mingw64_portable_theme_console.bat
when you want to see terminal output for diagnostics. The direct executable gefans.exe is also present, but the launcher scripts are preferred because they set the relative GTK2 runtime and theme environment for the package.
Do not mix MSYS2 runtime DLLs from different environments in the same package directory. This public Windows route is for the MSYS2 MINGW64 environment.
External solver convention
External NEC solvers launched by GEFANS should accept:
<solver.exe> <input.nec> <output.out>
No interactive prompts or alternate -i/-o syntax are expected by the built-in simulation launcher. If a solver uses a different command-line interface, use a wrapper that follows the convention above.
A ready-to-use pre-built MSYS2/MinGW64 themed Windows package may also be provided in:
Windows pre-build exec/
Copy the whole pre-built package folder to the target Windows system and launch GEFANS with the provided themed launcher.
3. Features:
-
Interactive NEC input and output viewing: GEFANS can open NEC input files from the command line or with File -> Open. It displays the antenna structure in the main window and can load matching
.out,.sNpand parametric sweep output files next to the input file. -
Geometry visualization: Wire structures, surface patches, imported mesh surfaces and NEC5-style surface/NL geometry can be displayed in 3D. Source and load markers are drawn where they can be associated with the parsed geometry.
-
Built-in NEC input editor and card help: GEFANS includes an internal NEC text editor and practical card help for common NEC2-family cards. NEC4/NEC5-specific documentation in the project is intentionally limited to short, original, functional descriptions and is not copied from LLNL manuals.
-
Integrated help in application windows: GEFANS includes help text and tooltips in the main window, Sim Results, Radiation Pattern window, NEC editor/card help, geometry checks and solver/build-related dialogs, so that commonly used controls and plot modes can be understood without leaving the program.
-
Current and charge visualization: NEC output currents and charges can be displayed on the structure using colour coding. Current animation and printed-current views use the same long colour-legend style as the radiation-pattern and near-field views.
-
Radiation Pattern window: GEFANS displays far-field radiation patterns as 3D filled or wireframe patterns and as 2D polar cuts. Gain-vs-theta and gain-vs-phi polar plots include markers, optional 3 dB beamwidth overlays and support for the RealGAIN display mode.
-
Realized gain support: Sim Results can plot estimated realized gain to a selected
Z0. The Radiation Pattern window also provides a RealGAIN toggle, applying the mismatch loss from the selected source impedance to the displayed gain pattern without changing the pattern shape. -
Near-field visualization: Rectangular and spherical NE/NH data can be displayed in the Radiation Pattern window. Spherical near-field data are handled as full spheres, open angular patches, 1D angular cuts or radial cuts according to the topology present in the output data.
-
NF-1D diagnostic plots: When spherical 1D NE/NH data are available, Sim Results shows an NF-1D plot. It can display NE-1D or NH-1D data versus theta or phi, with marker support and optional logarithmic Y scale. This is useful for diagnosing narrow near-field spikes or discontinuities that are hard to see in a 3D spatial colour view.
-
Sim Results window: Frequency-dependent NEC output data can be plotted, including impedance, SWR, gain-related quantities, RealGAIN and NF-1D data. Touchstone
.sNpfiles can be plotted with S-parameter selection, Smith chart display, interpolation overlays andZ0renormalization support. -
External solver launcher: GEFANS can launch external NEC-compatible solvers. The expected command form is:
<solver> <input.nec> <output.out>Solver executables are configured by the user and are not included in the GEFANS repository.
-
NEC2 built-in solver: GEFANS includes an optional built-in NEC2C-derived solver for NEC2-style jobs. This solver can use the original NEC2C-style factor/solve code or an OpenBLAS/LAPACK build depending on compile options.
-
S-parameter extraction: The integrated S-parameter extraction tool can drive repeated solver runs for multiport workflows and produce Touchstone output for plotting in Sim Results.
-
Geometry import tools: GEFANS includes code for importing/converting mesh geometry, including Gmsh
.mshworkflows for NEC-oriented surface/wire models. -
Repository layout:
source/ C source, headers, Makefiles, icons, third-party code build/ generated build work and packages; ignored by Git Windows pre-build exec/ optional ready-to-use Windows executable package version_history.txt version history in the public GitHub tree README.md GitHub README COPYING GPL license text
External Solvers and Affiliation Notice:
GEFANS is intended to be an interactive viewer, editor, plotting tool and solver front-end. It does not include NEC4 or NEC5 executables, does not include LLNL NEC4/NEC5 manuals, and is not a replacement for obtaining or using any external solver under its own license terms. Users are responsible for obtaining and using external NEC-family solvers in accordance with their applicable licenses and restrictions.
GEFANS is an independent project. It is not affiliated with, endorsed by, or sponsored by Lawrence Livermore National Laboratory, the University of California, or the developers/distributors of NEC4 or NEC5.
Acknowledgment:
GEFANS includes code and functionality derived from xnecview, originally written by Pieter-Tjerk de Boer, PA3FWM. Xnecview is licensed under the GNU General Public License. GEFANS preserves this attribution with appreciation to the original author.
GEFANS also includes and integrates code derived from nec2c. We gratefully acknowledge the nec2c project and its contributors.
Author: Spyros Liolis
Contact: gefans.devel@gmail.com


