-
Notifications
You must be signed in to change notification settings - Fork 36
fix: exclude VASP data generator from pytest #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/usr/bin/env python3 | ||
| """Regenerate randomized VASP k-point test data on explicit invocation.""" | ||
|
|
||
| import os | ||
|
|
||
| import dpdata | ||
| import numpy as np | ||
| from ase.geometry import ( | ||
| cellpar_to_cell, | ||
| ) | ||
|
|
||
|
|
||
| def make_one(out_dir): | ||
| """Generate one randomized POSCAR fixture in *out_dir*.""" | ||
| # [0.5, 1) | ||
| [aa, bb, cc] = np.random.random(3) * 0.5 + 0.5 | ||
| # [1, 179) | ||
| [alpha, beta, gamma] = np.random.random(3) * (178 / 180) + 1 | ||
| cell = cellpar_to_cell([aa, bb, cc, alpha, beta, gamma]) | ||
| system = dpdata.System("POSCAR") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not blocking, but worth fixing while the file is open: this reads a bare relative Anchoring both paths to |
||
| system["cells"][0] = cell | ||
| os.makedirs(out_dir, exist_ok=True) | ||
| system.to_vasp_poscar(os.path.join(out_dir, "POSCAR")) | ||
|
|
||
|
|
||
| def main(ntest=30): | ||
| """Regenerate all randomized fixture directories.""" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This docstring, and the module one on line 2, promise a regeneration this function does not perform. Running exactly what the docstrings advertise: and recomputing afterwards, all 30 directories disagree with their committed Before this PR the loop only ran by accident at import time, so this was a latent hazard. Adding |
||
| for index in range(ntest): | ||
| make_one("test.%03d" % index) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Carried over unchanged from the old file, so not something this PR introduced, and I am not asking for it here. Recording it because the file is being rewritten and the comment is false.
178 / 180is about 0.9889, so this yields angles in [1, 1.99) degrees, not [1, 179).cellpar_to_celltakes degrees, so every generated cell is nearly collinear. I measured all 90 angles across the 30 committed fixtures: 1.0007 to 1.9848 degrees. That is also whytest.000/kp.refreads3012 1844 2485-- k-point counts in the thousands only happen for cells this flat at kspacing 0.16. Sotest_make_kphas effectively no coverage of the ordinary-cell regime.If anyone fixes this:
* 178 + 1is not the answer. Uniformly random angle triples are usually not geometrically realizable, and 143 of 200 samples I tried raised ase'scz_sqr >= 0assertion. It needs rejection sampling, plus regeneratingkp.ref.