This program places the required number of sodium ions around a system of electric charges, e.g., the atoms of a biological macromolecule (protein, DNA, protein/DNA complex).
The ions are placed in the nodes of a cubic grid, in which the electrostatic energy achieves the smallest values. The energy is re-computed after placement of each ion. A simple Coulombic formula is used for the energy:
Energy(R) = Sum(i_atoms,ions) Q_i / |R-R_i|
All the constants are dropped out from this formula, resulting in some weird energy units; that doesn't matter for the purpose of energy comparison. To speed the program up, the atoms of the macromolecule are re-located to the grid nodes, closest to their original locations.
The resulting error is believed to be minor, compared to that resulting from the one-by-one ions placement, or from using the simplified energy function. The coordinates of the placed ions are printed out in the PDB format for further usage.
It is recommended that the placed ions are equilibrated in a separate Monte Carlo or Molecular Dynamics simulation. Trivial modifications to the program should allow the placement of any combination of multivalent ions of different charges.