Skip to content

Handle negative timings #263

Description

@kjh-giesbertz

Describe the bug
For very short calculations timings can come out negative causing due to floating point errors. This causes a validation error getting the property results

To Reproduce
This was for a ccsd calculation on H2O in def2-svp, but it flaky, so not well reproducible and very system dependent.

Trace back

        # // Parse JSON
        self.property_json_data = self._process_json_file(self.property_json_file)
        # > Check in property JSON whether version fits:
        if self.do_version_check:
            self.check_version()
>       self.results_properties = PropertyResults(**self.property_json_data)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       pydantic_core._pydantic_core.ValidationError: 2 validation errors for PropertyResults
E       calculation_timings.prop
E         Input should be greater than or equal to 0 [type=greater_than_equal, input_value=-0.6242519999999999, input_type=float]
E           For further information visit https://errors.pydantic.dev/2.13/v/greater_than_equal
E       calculation_timings.sum
E         Input should be greater than or equal to 0 [type=greater_than_equal, input_value=-0.1279849999999999, input_type=float]
E           For further information visit https://errors.pydantic.dev/2.13/v/greater_than_equal

/home/giesbertz/miniforge3/envs/livdft-fix/lib/python3.11/site-packages/opi/output/core.py:228: ValidationError

Expected behavior
I suppose the best solution is to clamp timings to be non-negative. An alternative would be to allow for negative timings, but since they are meaningless (though give an impression how imprecise timings are) I would go for clamping.

Version:

  • ORCA 6.1.1
  • OPI 2.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions