Skip to content

Commit aa1b228

Browse files
cleanup; correct reason string for inequalities
1 parent 0b8f40d commit aa1b228

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pymatgen/io/validation/check_incar.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -742,15 +742,20 @@ def check_parameter(
742742
tolerance = tolerance or 1.0e-4
743743
valid_value = isclose(current_value, reference_value, rel_tol=tolerance, abs_tol=0.0)
744744
else:
745-
if operation == "approx" and not isinstance(current_value, float):
746-
print(current_value, input_tag)
747745
valid_value = reference_value.__getattribute__(self.operations[operation])(current_value)
748746

749747
if not valid_value:
750-
msg = (
748+
# reverse the inequality sign because of ordering of input and expected
749+
# values in reason string
750+
flipped_operation = operation
751+
if ">" in operation:
752+
flipped_operation.replace(">", "<")
753+
elif "<" in operation:
754+
flipped_operation.replace("<", ">")
755+
756+
reasons.append(
751757
"INPUT SETTINGS --> "
752758
f"{self.input_tag_translation.get(input_tag,input_tag)}: "
753-
f"set to {current_value}, but should be {operation} "
759+
f"set to {current_value}, but should be {flipped_operation} "
754760
f"{reference_value}. {extra_comments_upon_failure}"
755761
)
756-
reasons.append(msg)

0 commit comments

Comments
 (0)