Skip to content

test: run calc scripts#163

Open
kzsigmond wants to merge 20 commits intomainfrom
146-test-run-calc
Open

test: run calc scripts#163
kzsigmond wants to merge 20 commits intomainfrom
146-test-run-calc

Conversation

@kzsigmond
Copy link
Copy Markdown
Contributor

@kzsigmond kzsigmond commented Oct 30, 2025

This pull request introduces several improvements and bug fixes to the PySCF and Gaussian calculation scripts in the fanpy package, focusing on argument parsing, default parameter handling, and test coverage. The main changes include standardizing argument types and defaults, improving script generation for PySCF workflows, and adding comprehensive tests for these scripts.

Argument parsing and default handling improvements:

  • Updated the run_calc function in fanpy/scripts/gaussian/run_calc.py to use explicit default values for nuc_nuc, pspace_exc, objective, and solver parameters, improving reliability and usability.
  • Changed the --optimize_orbs argument in fanpy/scripts/pyscf/pyscf_parser.py to use action="store_true" for correct boolean flag behavior, and updated --pspace_exc to accept a string for easier CLI parsing.
  • Added logic in fanpy/scripts/pyscf/make_fanci_script.py to parse pspace_exc from a string to a list of integers, ensuring correct data types are passed to downstream functions.

Script generation and interface enhancements:

  • Refactored write_wfn_py in fanpy/scripts/pyscf/run_calc.py to require explicit geom and basis arguments, clarified docstrings, and replaced the old_fanpy flag with fanpy_only for clearer intent. Improved the way geometry and other arguments are formatted and passed to subprocesses.
  • Fixed directory change logic in job submission scripts to ensure correct working directories during batch calculations.

Test coverage:

  • Added new test files tests/test_scripts_gaussian_run_calc.py and tests/test_scripts_pyscf_run_calc.py to provide comprehensive testing for the CLI and Python interfaces of the calculation scripts, including error handling and file generation.
  • NOTE some features of run_calc.py in the PySCF folder cannot be tested, as they are used to submit calculations to servers. Also, some of the features would require an interface that has the variational approach.

@kzsigmond kzsigmond linked an issue Oct 30, 2025 that may be closed by this pull request
2 tasks
@kzsigmond kzsigmond self-assigned this Oct 30, 2025
@kzsigmond kzsigmond added the test unit tests, integration tests, etc. label Oct 30, 2025
@kzsigmond kzsigmond added this to the v2.0.0 milestone Oct 30, 2025
@kzsigmond kzsigmond marked this pull request as ready for review October 30, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test unit tests, integration tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test: run calc

1 participant