public HashMap<Double, JComplex> buildHashMap(
      double qMax, double qStep, double wavelength, int Z, JVector vx, JVector vy) {
    JComplex complexF = null;

    try {
      complexF = getComplexF(1, wavelength, Z);
    } catch (Exception e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    double mapSize = qMax / qStep / .75;

    HashMap<Double, JComplex> hm = new HashMap<Double, JComplex>((int) mapSize);

    for (double qy = 0; qy < qMax; qy += qStep) {
      for (double qx = 0; qx < qMax; qx += qStep) {
        JVector Qx = JVector.multiply(vx, qx);

        JVector Qy = JVector.multiply(vy, qy);

        JVector Q = JVector.add(Qx, Qy);

        double key = Q.length();

        if (!hm.containsKey(key)) {
          JComplex temp = generateF0(Q, Z, complexF);

          hm.put(key, temp);
        }
      }
    }
    return hm;
  }
  public JComplex generateF0(JVector Q, int Z, JComplex energyFormFactor) {
    JComplex f0 = new JComplex(0, 0);

    double fTemp = elementConstants[Z - 1][9];

    for (int i = 1; i < 5; i++) {
      double ai = elementConstants[Z - 1][i];
      double bi = elementConstants[Z - 1][i + 4];

      fTemp += ai * Math.exp(-1 * bi * Math.pow((Q.length()) / (4 * Math.PI), 2));
    }

    f0 = JComplex.add(energyFormFactor, fTemp);

    return f0;
  }