public double getPropagationEnergy(int index, double energy_min, double energy_max) {
        System.out.println("ENTERING BISECTION...");
        double energy = (energy_min + energy_max) / 2;
        // double dprop = getPropagationValueLogDerivative(index, energy);
        double dprop = getPropagationValueDerivative(index, energy);

        while (Math.abs(dprop) > Function.CALC_TOLERANCE) {
            System.out.println("BSF: " + dprop + "\tenergy_min: " + energy_min + "\tenergy: " + energy + "\tenergy_max: "
                    + energy_max);
            if (Math.abs(energy / (energy_min + energy_max) - 0.5) < Function.CALC_TOLERANCE * 0.001) // XXX Magic
            {
                return energy;
            }

            // if (dprop * getPropagationValueLogDerivative(index, energy_min) > 0)
            if (dprop * getPropagationValueDerivative(index, energy_min) > 0) {
                energy_min = energy;
            }
            // else if (dprop * getPropagationValueLogDerivative(index, energy_max) > 0)
            else if (dprop * getPropagationValueDerivative(index, energy_max) > 0) {
                energy_max = energy;
            }

            System.out.println("Energy difference = " + (energy - (energy_min + energy_max) / 2));
            energy = (energy_min + energy_max) / 2;
            // dprop = getPropagationValueLogDerivative(index, energy);
            dprop = getPropagationValueDerivative(index, energy);
        }
        return energy;
    }