[Documentation] Add comprehensive argument documentation for pwmat FP style with correct parameter validation#1793
[Documentation] Add comprehensive argument documentation for pwmat FP style with correct parameter validation#1793
Conversation
|
@njzjz 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Added |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #1793 +/- ##
==========================================
+ Coverage 49.46% 49.54% +0.07%
==========================================
Files 83 83
Lines 14801 14822 +21
==========================================
+ Hits 7322 7343 +21
Misses 7479 7479 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tests/test_check_examples.py
Outdated
| ), | ||
| (run_jdata, p_examples / "run" / "dprc" / "generator.json"), | ||
| # pwmat test file from tests/generator | ||
| (run_jdata, Path(__file__).parent / "generator" / "param-pyridine-pwmat.json"), |
There was a problem hiding this comment.
@copilot I see other lines use p_examples. Please match it.
There was a problem hiding this comment.
Updated the pwmat test file reference to use p_examples path pattern consistently with other test files. Changed from Path(__file__).parent / "generator" / "param-pyridine-pwmat.json" to p_examples / "run" / "deprecated" / "dp2.x-lammps-pwmat" / "param_CH4.json". Test passes successfully. Commit: 9d03f93
Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
| Argument("icmix", float, optional=True, doc=doc_icmix), | ||
| Argument("smearing", int, optional=True, doc=doc_smearing), | ||
| Argument("sigma", float, optional=True, doc=doc_sigma), | ||
| Argument("flag_symm", [int, str], optional=True, doc=doc_flag_symm), |
There was a problem hiding this comment.
Fixed! Made flag_symm required for user_fp_params since it's accessed directly without checking at line 3037. The fp_params path still has it as optional since it goes through _make_flag_symm() which handles optional parameters. Commit: e4a3bbc
| Argument("icmix", float, optional=True, doc=doc_icmix), | ||
| Argument("smearing", int, optional=True, doc=doc_smearing), | ||
| Argument("sigma", float, optional=True, doc=doc_sigma), |
There was a problem hiding this comment.
You're correct! Removed icmix, smearing, and sigma from user_fp_params structure since they're hardcoded as None in the user_fp_params code path (lines 3057-3059). They remain in fp_params structure since they are used via _make_smearing(). Commit: e4a3bbc
dpgen/generator/arginfo.py
Outdated
| Argument("fp_pp_files", list[str], optional=False, doc=doc_fp_pp_files), | ||
| Argument("fp_incar", str, optional=True, doc=doc_fp_incar), | ||
| Argument("fp_params", dict, args, [], optional=True, doc=doc_fp_params), | ||
| Argument("user_fp_params", dict, optional=True, doc=doc_user_fp_params), |
There was a problem hiding this comment.
@copilot It seems that user_pwmat_params is missing here
dpgen/dpgen/generator/lib/pwmat.py
Line 181 in 2fdbdf2
There was a problem hiding this comment.
Added user_pwmat_params to the fp_params structure. It's used in pwmat.py:181 with conditional checking. Commit: e4a3bbc
dpgen/generator/arginfo.py
Outdated
| Argument("fp_pp_files", list[str], optional=False, doc=doc_fp_pp_files), | ||
| Argument("fp_incar", str, optional=True, doc=doc_fp_incar), | ||
| Argument("fp_params", dict, args, [], optional=True, doc=doc_fp_params), | ||
| Argument("user_fp_params", dict, optional=True, doc=doc_user_fp_params), |
There was a problem hiding this comment.
@copilot I am wondering if user_fp_params is just an alias of fp_params or not. args should also be defined for user_fp_params.
There was a problem hiding this comment.
Added proper argument definitions for user_fp_params. It has the same core parameters as fp_params but excludes icmix/smearing/sigma (not used in that code path) and makes flag_symm required (accessed directly). The two paths have different behaviors which are now properly reflected in the argument structure. Commit: e4a3bbc
- Make flag_symm required for user_fp_params (accessed directly in run.py:3037) - Remove icmix, smearing, sigma from user_fp_params (not used in that code path) - Keep icmix, smearing, sigma in fp_params (used via make_pwmat_input_user_dict) - Add proper argument definitions for user_fp_params parameter structure - Add comments explaining the different behavior between fp_params and user_fp_params paths Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
|
The current issue is that I cannot validate whether the agent makes the correct code... |
This PR adds complete argument documentation for the
pwmatFP style variant indpgen.generator.arginfo.fp_style_variant_type_args(), replacing the placeholder implementation with a comprehensive structure that accurately reflects the actual pwmat implementation behavior.Key Changes
1. Comprehensive Parameter Documentation
Added detailed documentation for all pwmat parameters including:
fp_pp_path,fp_pp_files, core calculation parametersuser_pwmat_paramsfor custom input overrides2. Correct Argument Structure Based on Code Analysis
The implementation now properly handles the two different code paths in the pwmat implementation:
fp_paramspath (viamake_pwmat_input_user_dict()):icmix,smearing,sigma(processed by_make_smearing())flag_symmis optional (processed by_make_flag_symm())user_pwmat_paramsfor additional parametersuser_fp_paramspath (direct usage inmake_pwmat_input()):icmix,smearing,sigma(hardcoded asNonein run.py:3057-3059)flag_symmis required (accessed directly in run.py:3037)3. Enhanced Validation
fp_incar,user_fp_params, andfp_paramsBefore/After
Before:
After:
The pwmat FP style now has accurate argument validation that matches the actual implementation, preventing configuration errors and providing clear documentation for users.
Fixes #774.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.