Repository navigation
Conversation
The Ewald splitting parameter of qNEP models is alpha = pi / rc_radial. The default PPPM spacing is rc_radial / 6, which keeps alpha * spacing at pi / 6. An explicit spacing in kspace pppm takes precedence.
The default spacing is min(1, rc_radial / 6) A. Models with rc_radial above 6 A keep the 1 A mesh. The test covers an absent kspace line and a kspace line after run.
A kspace line anywhere in run.in applies to every run.
At the first force evaluation, PPPM prints the root-mean-square force error estimate of Deserno and Holm for ik differentiation and five-point charge assignment, using the charges of that step. The regression checker accepts the new line after the mesh line.
gpumd_replica accepts kspace pppm [spacing] with the validation of gpumd. The default spacing is min(1, rc_radial / 6) A. The replica PPPM rounds the mesh up to 2, 3, 5, 7-smooth sizes, grows it with the box, enforces the 512^3 limit, and prints the mesh and the force error estimate from the first stream. The PRD and REMD restarts record the requested spacing and reject a resume with a different one.
Collaborator
Author
|
@brucefan1983 this PR is built up from several commits that allow one to cherry pick changes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
For qNEP models,
NEP_Chargesets the Ewald splitting parameter to alpha = pi / rc_radial, while the default PPPM mesh spacing is a fixed 1 Å. The reciprocal-space part grows with alpha, and for a short radial cutoff the 1 Å mesh does not resolve it. GPUMD also prints the mesh without any estimate of its error.This MR sets the default spacing to min(1, rc_radial / 6) Å in
NEP_Charge::check_ewald_pppm. The default keeps the product of alpha and the target spacing at or below pi / 6, which is its value at rc_radial = 6 Å. Models with rc_radial of 6 Å or more keep the 1 Å mesh. An explicitkspace pppm <spacing>takes precedence over the default.This MR adds an estimate of the root-mean-square PPPM force error, which
PPPM::print_meshprints after the mesh line at the first force evaluation. It is the estimate of Deserno and Holm, J. Chem. Phys. 109, 7694 (1998), for ik differentiation and five-point charge assignment, with the coefficients ofPPPM::estimate_ik_errorin LAMMPS and the charges of that step.tests_regression/pppm_checks.pyaccepts the new line.This MR ports the PPPM mesh selection of
gpumdtogpumd_replica. The replica acceptskspace pppm [spacing]with the validation ofgpumd, applies the same default, rounds the mesh up to 2, 3, 5, 7-smooth sizes, grows it with the box, enforces the limit of 512^3 points, and prints the mesh line and the estimate. AKspace_Settingstruct replaces thekspace_methodstring in the replica code. The PRD and REMD restarts record the requested spacing in apppm_spacingkey.doc/gpumd/input_parameters/kspace.rststates the default and the estimate, and states that akspaceline applies to everyrunwherever it appears inrun.in. The replica pageskspace.rstandrestart.rststate the spacing, the estimate and the restart check.This MR changes the PPPM energies and forces of models with rc_radial below 6 Å. For the rc_radial = 4 Å water model in
tests_pytest/fixtures/models/qnep_mode1_water.txton a 1701-atom cell, the mesh rises from 28 x 40 x 20 to 40 x 56 x 28. The PPPM energy minus the Ewald energy is reduced from -0.353 to -0.0016 meV/atom, and the RMS force difference per component is reduced from 2.25 to 0.19 meV/Å. The speed is 2.51e6 atom*step/s against 2.53e6 with the 1 Å mesh, corresponding to about 1 percent. The finer mesh reaches the limit of 512^3 points in smaller boxes: an rc_radial = 4 Å model stops with "PPPM mesh is too large" in a cubic box of 345 Å, which runs withkspace pppm 1.0.On the same water cell, the ratio of the estimate to the RMS force difference between PPPM and Ewald is 0.97, 1.13 and 1.20 at spacings of 0.5, 0.7 and 1.0 Å. For the mode-2 water model it is between 1.27 and 1.53 at spacings of 0.7 to 1.5 Å. At 0.5 Å it is 0.28, where the measured difference is 2.6e-5 eV/Å. The estimate assumes randomly distributed charges. For a 1080-atom BaTiO3 crystal it exceeds the measured difference by factors of 1.8 to 31, which the documentation states.
This MR brings
gpumd_replicain line withgpumd. For a 1512-atom cell of the rc_radial = 4 Å water model, both executables choose a 40 x 40 x 40 mesh and print an estimate of 2.342e-04 eV/A. The step-0 potential energy is -6311.92918 eV fromgpumd_replicaand -6311.92894 eV fromgpumd. With master,gpumd_replicagave -6312.0474 eV. The remaining difference of 2.4e-4 eV is of the size of the Ewald difference between the two executables, 2.0e-4 eV.Breaking changes
The PRD restart format version rises from 6 to 7, and the REMD restart format version from 5 to 6. Restart files written by earlier builds of
gpumd_replicaare rejected as an unsupported format. A resume with akspacespacing that differs from the restart is rejected with "restart pppm_spacing does not match the input". A secondkspaceline in a replicarun.innow raises "kspace can only appear once.", the message ofgpumd.Testing
test_pppm_spacingintests_pytest/test_kspace_consistency.pyreads the target spacing from the PPPM mesh line ofgpumd. It covers a model with rc_radial = 4 Å without akspaceline, models with rc_radial = 4, 6 and 8 Å withkspace pppm, andkspace pppm 0.9before and afterrun. The rc_radial = 4 Å cases fail on master, and the rc_radial = 8 Å case fails with the uncapped rc_radial / 6.test_pppm_force_error_estimatein the same file compares the printed estimate with the RMS force difference between PPPM and Ewald on the 1701-atom water cell at 0.5, 0.7 and 1.0 Å, within 25 percent.test_force_error_estimateintests_regression/test_pppm_checks.pychecks that the checker accepts one estimate line after the mesh line and rejects a misplaced, repeated or negative one.tests_regression/replica/test_replica.pyadds three tests.test_qnep_pppm_spacing_and_force_error_estimatechecks the default spacing for rc_radial = 4 and 8 Å, an explicit spacing, and one mesh line and one estimate line.test_qnep_pppm_spacing_input_validationchecks the messages for an invalid spacing, a spacing afterewald, and an extra argument.test_restart_pppm_spacing_validationchecks that PRD and REMD record the spacing and reject a resume with another spacing, the default, or nokspaceline. All three fail on master.pytest -m "not slow"intests_pytest: 671 passed, 478 skipped.run_regression.py --suite pppmwith a-DDEBUGbuild of this branch on both sides: 37 passed, 0 failed, relations 2 passed, 23 skipped.python -m unittest test_runner test_manifest test_post_checks test_pppm_checksintests_regression: 27 tests OK.tests_regression/replica/test_replica.py: 15 tests OK.sphinx-build -b html doc: 0 warnings.git clang-formatagainst master: no changes insrc/force. Insrc/main_replicait would rewrite the leading-comma initializer lists of the replica constructors, which keep the style of the surrounding code.A run of
run_regression.pywith master as the baseline shows the new estimate line as a stdout difference in the PPPM cases.