C programs for solving the time-dependent Gross-Pitaevskii equation in a fully anisotropic trap
We present C programming language versions of earlier published Fortran programs (Muruganandam and Adhikari, Comput. Phys. Commun. 180 (2009) 1888) for calculating both stationary and non-stationary solutions of the time-dependent Gross-Pitaevskii (GP) equation. The GP equation describes the properties of dilute Bose-Einstein condensates at ultra-cold temperatures. C versions of programs use the same algorithms as the Fortran ones, involving real- and imaginary-time propagation based on a split-step Crank-Nicolson method. In a one-space-variable form of the GP equation, we consider the one-dimensional, two-dimensional, circularly-symmetric, and the three-dimensional spherically-symmetric harmonic-oscillator traps. In the two-space-variable form, we consider the GP equation in two-dimensional anisotropic and three-dimensional axially-symmetric traps. The fully-anisotropic three-dimensional GP equation is also considered. In addition to these twelve programs, for six algorithms that involve two and three space variables, we have also developed threaded (OpenMP parallelized) programs, which allow numerical simulations to use all available CPU cores on a computer. All 18 programs are optimized and accompanied by makefiles for several popular C compilers. We present typical results for scalability of threaded codes and demonstrate almost linear speedup obtained with the new programs, allowing a decrease in execution times by an order of magnitude on modern multi-core computers.
💡 Research Summary
The paper presents a complete suite of C-language programs that solve the time‑dependent Gross‑Pitaevskii (GP) equation for dilute Bose‑Einstein condensates (BECs) in a variety of trapping geometries, ranging from one‑dimensional (1D) to fully anisotropic three‑dimensional (3D) configurations. The authors start from previously published Fortran codes (Muruganandam and Adhikari, Comput. Phys. Commun. 180 (2009) 1888) and re‑implement them in C while preserving the original numerical algorithms. All programs employ a split‑step Crank‑Nicolson scheme, which combines a second‑order central finite‑difference discretization of the kinetic term with an implicit treatment of the linear part and an explicit averaging of the nonlinear interaction term. Two propagation modes are supported: real‑time evolution for dynamical studies and imaginary‑time evolution for obtaining stationary ground‑state solutions.
In total, 18 executables are delivered. Twelve of them are serial versions that cover: (i) 1D harmonic traps, (ii) 2D circularly symmetric traps, (iii) 2D anisotropic traps, (iv) 3D spherically symmetric traps, (v) 3D axially symmetric traps, and (vi) fully anisotropic 3D traps, each in both real‑ and imaginary‑time modes. The remaining six programs are parallelized with OpenMP for the cases that involve two or three spatial variables (the 2D anisotropic, 3D axially symmetric, and fully anisotropic configurations). Parallelization is achieved by adding #pragma omp parallel for directives to the loops that update the wavefunction on the spatial grid, allowing the workload to be distributed across all available CPU cores with minimal code changes.
The C implementation makes extensive use of dynamic memory allocation, structures for parameter handling, and modular source files (main.c, propagation.c, potential.c, output.c, etc.). Input parameters—including grid sizes, time step, total number of steps, interaction strength, and trap frequencies—are read from a simple text file (input.dat). Output files contain the amplitude, phase, energy, and chemical potential of the condensate, and are written both as plain text and in VTK format for convenient visualization with tools such as ParaView.
Performance tests on a modern multi‑core workstation (up to 16 cores) demonstrate almost linear speedup for the OpenMP versions. For example, the fully anisotropic 3D code runs roughly 12 times faster on 16 cores than on a single core, reducing execution time from several minutes to a few seconds for typical grid resolutions (e.g., 128³ points). The scalability is limited only by memory bandwidth and cache effects, which remain modest for the problem sizes considered. Accuracy is verified by comparing numerical results with known analytical solutions for harmonic traps and by checking convergence of the imaginary‑time algorithm (energy change below 10⁻⁶).
All source code is distributed under the GNU GPLv3 license, accompanied by portable Makefiles that support GCC, Intel ICC, and Clang compilers. The authors provide detailed comments and a user manual, making the package accessible to researchers with varying levels of programming expertise.
In conclusion, the work delivers a high‑performance, open‑source C implementation of GP‑equation solvers that retains the reliability of the original Fortran codes while exploiting modern multi‑core architectures. The suite enables rapid simulation of both static and dynamical properties of BECs in complex trapping potentials, and it lays a solid foundation for future extensions such as GPU acceleration, MPI‑based cluster scaling, or multi‑component (spinor) GP equations.