deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
164 stars 128 forks source link

Add --dry-run Option to ABACUS CLI #5074

Open savebean opened 1 week ago

savebean commented 1 week ago

Background

The --dry-run option is a common feature in many CLI tools, which serves a critical role in operational safety and testing. This feature enables users to:

1、Preview changes: Users can see what changes a command would make without actually applying them. 2、Verify command syntax and parameters: Ensures that commands and the central input files are constructed correctly without the risk of disruptive impacts. 3、Integrate with scripts and automation: Allows developers to incorporate the CLI tool into larger scripts and workflows safely by testing them in a --dry-run mode first.

Describe the solution you'd like

I propose adding a --dry-run option to the command line interface. This option would allow users to simulate commands without actually making any changes to the system or data. Since INPUT, STRU, and KPT are the central input files for the ABACUS program, it is crucial to ensure that these files are configured correctly and stored in the working directory before executing the program. If there is an incorrect configuration in the INPUT, STRU, or KPT files, the tool should provide detailed error messages to help diagnose and fix the issues.The --dry-run option would be particularly useful for verifying that these files are correctly set up and ready.

Task list only for developers

Notice Possible Changes of Behavior (Reminder only for developers)

No response

Notice any changes of core modules (Reminder only for developers)

No response

Notice Possible Changes of Core Modules (Reminder only for developers)

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

hongriTianqi commented 2 days ago

@savebean Just for your information, currently you can run

abacus --check-input

to avoid errors in INPUT parameters. However, the function to check memory, KPT and STRU files before running is still not yet available.