/**
   * corrects the computed melting temperature depending on the environment.
   *
   * @param environment
   * @return double corrected melting temperature
   */
  protected double correctTemperature(Environment environment) {
    OptionManagement.logMessage("\n The magnesium correction is");
    OptionManagement.logMethodName(methodName);
    OptionManagement.logMessage(temperatureCorrection);
    OptionManagement.logMessage("where : ");
    OptionManagement.logMessage("b = " + this.b);
    OptionManagement.logMessage("c = " + this.c);
    OptionManagement.logMessage("e = " + this.e);
    OptionManagement.logMessage("f = " + this.f);
    displayVariable();

    double Mg = environment.getMg() - environment.getDNTP();
    double square = Math.log(Mg) * Math.log(Mg);
    double Fgc = environment.getSequences().computesPercentGC() / 100.0;

    double TmInverse =
        1.0 / (environment.getResult().getTm() + 273.15)
            + this.a
            + this.b * Math.log(Mg)
            + Fgc * (this.c + this.d * Math.log(Mg))
            + 1.0
                / (2.0 * ((double) environment.getSequences().getDuplexLength() - 1.0))
                * (this.e + this.f * Math.log(Mg) + this.g * square);
    return (1.0 / TmInverse) - 273.15;
  }
  public ThermoResult correctMeltingResults(Environment environment) {

    OptionManagement.logMessage("\n The sodium correction is");
    OptionManagement.logMethodName(methodName);
    OptionManagement.logMessage(temperatureCorrection);

    double NaEq = Helper.computesNaEquivalent(environment);
    double Fgc = environment.getSequences().computesPercentGC() / 100.0;

    double TmInverse =
        1.0 / (environment.getResult().getTm() + 273.15)
            + (3.85 * Fgc - 6.18) * 1 / 100000 * Math.log(NaEq);
    environment.setResult((1.0 / TmInverse) - 273.15);

    return environment.getResult();
  }
  public ThermoResult correctMeltingResults(Environment environment) {

    double Tm = correctTemperature(environment);
    environment.setResult(Tm);

    return environment.getResult();
  }