Skip to content

Return value is 0 after calculation error #5459

@MabinogiX

Description

@MabinogiX

Describe the bug

While using ABACUS for calculations, I noticed that when there is an error due to incorrect INPUT format, the program's return value is 0. However, if there’s an error due to an incorrect STRU file format, the return value is 1. Is this behavior expected?

Expected behavior

I believe the return value should be non-zero when an error occurs. Otherwise, when I use ABACUS in a script, the script continues running normally even if the program encounters an error, which leads to subsequent errors.

To Reproduce

Find a system that runs successfully, duplicate a parameter in the INPUT file, and execute the abacus command. Then, check the return value using echo $?, which shows 0.
Using the same system, modify the STRU file (e.g., delete a line with atomic coordinate information) to induce an error. Then, check the return value using echo $?, which shows 1.
Image

Environment

abacus 3.8.0

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Verify the issue is not a duplicate.
  • Describe the bug.
  • Steps to reproduce.
  • Expected behavior.
  • Error message.
  • Environment details.
  • Additional context.
  • Assign a priority level (low, medium, high, urgent).
  • Assign the issue to a team member.
  • Label the issue with relevant tags.
  • Identify possible related issues.
  • Create a unit test or automated test to reproduce the bug (if applicable).
  • Fix the bug.
  • Test the fix.
  • Update documentation (if necessary).
  • Close the issue and inform the reporter (if applicable).

Metadata

Metadata

Assignees

Labels

RefactorRefactor ABACUS codesUnit Tests/Integreate TestsIssues/PR related to unit tests and integrate tests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions