Skip to content

Commit

Permalink
Remove energy calculations with DFT fermi energy
Browse files Browse the repository at this point in the history
  • Loading branch information
nerkulec committed Aug 21, 2024
1 parent 5239d4c commit 515c165
Showing 1 changed file with 1 addition and 38 deletions.
39 changes: 1 addition & 38 deletions mala/network/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _calculate_errors(
target_calculator, LDOS
) and not isinstance(target_calculator, Density):
raise Exception(
"Cannot calculate the total energy from this "
"Cannot calculate density from this "
"observable."
)
target_calculator.read_additional_calculation_data(
Expand Down Expand Up @@ -294,31 +294,6 @@ def _calculate_energy_errors(
errors[energy_type] = be_error
except ValueError:
errors[energy_type] = float("inf")
elif energy_type == "band_energy_dft_fe":
try:
target_calculator.read_from_array(predicted_outputs)
be_predicted_dft_fe = target_calculator.get_band_energy(
fermi_energy=fe_dft
)
be_error_dft_fe = (be_predicted_dft_fe - be_actual) * (
1000 / len(target_calculator.atoms)
)
errors[energy_type] = be_error_dft_fe
except ValueError:
errors[energy_type] = float("inf")
elif energy_type == "band_energy_actual_fe":
try:
target_calculator.read_from_array(predicted_outputs)
be_predicted_actual_fe = target_calculator.get_band_energy(
fermi_energy=fe_actual
)
be_error_actual_fe = (
be_predicted_actual_fe - be_actual
) * (1000 / len(target_calculator.atoms))
errors[energy_type] = be_error_actual_fe
except ValueError:
errors[energy_type] = float("inf")

elif energy_type == "total_energy":
if not isinstance(target_calculator, LDOS):
raise Exception(
Expand All @@ -345,18 +320,6 @@ def _calculate_energy_errors(
errors[energy_type] = te_error
except ValueError:
errors[energy_type] = float("inf")
elif energy_type == "total_energy_dft_fe":
try:
target_calculator.read_from_array(predicted_outputs)
te_predicted_dft_fe = target_calculator.get_total_energy(
fermi_energy=fe_dft
)
te_error_dft_fe = (te_predicted_dft_fe - te_actual) * (
1000 / len(target_calculator.atoms)
)
errors[energy_type] = te_error_dft_fe
except ValueError:
errors[energy_type] = float("inf")
elif energy_type == "total_energy_actual_fe":
try:
target_calculator.read_from_array(predicted_outputs)
Expand Down

0 comments on commit 515c165

Please sign in to comment.