# Computer code for applying the variational principle to a coherent-pair condensate: The BCS case

## Description

Recently Jia (2019) proposed a new scheme that applies the variational principle directly to a coherent-pair condensate. This work publishes its computer code. The result is equivalent to that of the so-called variation after particle-number projection in the BCS case, but the new code always conserves the particle number and avoids the time-consuming projection. Specifically, the variational principle is solved by iterating the coherent-pair-structure expression at the energy minimum. We publish the code together with a semirealistic example that uses the realistic V_{low -k} interaction and large model spaces (up to 15 harmonic-oscillator major shells). The average energy can be minimized to practically arbitrary precision. We also test the code under the pairing Hamiltonian.