Allow setting the number of grid points in the short range eward summation of Coulomb interaction#4928
Conversation
|
Test this please |
ye-luo
left a comment
There was a problem hiding this comment.
Since there are many pointer manipulation, I will need to review it more closely. For now, could you put up a manual entry explaining what is "ewald_grid"? It is ewald related but what grid it is and how it's been used?
ye-luo
left a comment
There was a problem hiding this comment.
I'm still going through CoulombPBCAB about how grids are managed. Please address other comment.
| +---------------------+--------------+---------------------------+-------------------+----------------------------------------------------+ | ||
| | ``LR_tol`` | float | float | 3e-4 | Tolerance in Ha for Ewald ion-ion energy per atom. | | ||
| +---------------------+--------------+---------------------------+-------------------+----------------------------------------------------+ | ||
| | ``ewald_grid`` | int | int | 1001 | Linear grid used for short-range part of Ewald. | |
There was a problem hiding this comment.
"The number of linear grid points used for ..."
| ///number of strictly enforced periodic spatial dimensions | ||
| /// ewald_strict2d sets ndim=2, otherwise ndim=3 | ||
| unsigned ndim; | ||
| unsigned ewaldGrid; |
There was a problem hiding this comment.
In the source code, we better to use a clear name for the variable. "ewald_num_grid_points". Also please add a line of documentation.
| ///cutoff radius of the short-range part | ||
| RealType myRcut; | ||
| ///radial grid | ||
| std::shared_ptr<GridType> myGrid; |
There was a problem hiding this comment.
Just define it locally in initBreakup. I don't even think we need a pointer.
ye-luo
left a comment
There was a problem hiding this comment.
@Paul-St-Young please address my review when you get a chance.
| RealType h; //this is for finite differencing. | ||
| std::vector<PosType> sphericalgrid; | ||
| GridType* myGrid; | ||
| std::shared_ptr<GridType> myGrid; |
There was a problem hiding this comment.
I don't see why you choose shared_ptr. Should be "unique_ptr"
|
@ye-luo thanks for the great suggestions! |
|
Test this please |
|
@Paul-St-Young did you play with the number of grid points and what was your finding? |
| +---------------------+--------------+---------------------------+-------------------+----------------------------------------------------+ | ||
| | ``LR_tol`` | float | float | 3e-4 | Tolerance in Ha for Ewald ion-ion energy per atom. | | ||
| +---------------------+--------------+---------------------------+-------------------+----------------------------------------------------+ | ||
| | ``ewald_grid`` | int | int | 1001 | The number of linear grid points used for short-range part of the Ewald potential. | |
There was a problem hiding this comment.
There is formatting issue causing the table not being rendered.
| Base::LR_dim_cutoff = rhs.LR_dim_cutoff; | ||
| Base::LR_kc = rhs.LR_kc; | ||
| Base::LR_rc = rhs.LR_rc; | ||
| Base::num_ewald_grid_points = rhs.num_ewald_grid_points; |
|
Very happy to see the exposure of this hidden default. Thanks Paul Weirdly the estimator unit test failed in the complex coverage test. Will retry it. |
Still failing @PDoakORNL any clue? https://github.com/QMCPACK/qmcpack/actions/runs/8022503383/job/21922019273?pr=4928 |
|
@ye-luo Yes, I tried different number of grid points for both the bare and screened Coulomb potential. Short answer: the number of grid points may need adjustment if people want to use anything other than 1/r interaction. |
|
Test this please |
Proposed changes
Avoid instantiation of LinearGrid object at call time in
createSpline4RbyVs*, because it silently defaults to 1001 grid points without user control.Instead, I added a new
ewald_gridinput to set the density of the linear grid, which is used to interpolate the short-range part of the Ewald Coulomb interaction.What type(s) of changes does this code introduce?
Does this introduce a breaking change?
What systems has this change been tested on?
Intel workstation
Checklist