public double[] getEnergyRange() {
        if (energyRange != null) {
            return energyRange;
        }
        double max = 0;
        double max2 = 0;
        for (MatterInterval mi : intervals) {
            if (max <= mi.getY()) {
                max2 = max;
                max = mi.getY();
            }
        }
        int rangesize = (int) (max2 / ENERGY_STEP);
        if (VERBOSE) {
            System.out.println("Energy max:  " + Utils.erg2ev(max));
            System.out.println("Energy max2: " + Utils.erg2ev(max2));
            System.out.println("Energy range size: " + rangesize);
        }
        energyRange = new double[rangesize];
        for (int i = 0; i < rangesize; i++) {
            energyRange[i] = i * ENERGY_STEP;
        }
        return energyRange;
    }