pme
torch_admp.pme
Particle Mesh Ewald (PME) implementation for torch-admp.
This module implements the Coulomb energy calculation using the Particle Mesh Ewald method, which splits the calculation into real-space and reciprocal-space contributions for improved efficiency in periodic systems. It includes support for slab corrections and various optimization methods.
CoulombForceModule(rcut: float, ethresh: float = 1e-05, kspace: bool = True, rspace: bool = True, slab_corr: bool = False, slab_axis: int = 2, units_dict: Optional[Dict] = None, sel: Optional[list[int]] = None, kappa: Optional[float] = None, spacing: Union[List[float], float, None] = None, kmesh: Union[List[int], int, None] = None)
Bases: BaseForceModule
Coulomb energy module with Particle Mesh Ewald (PME).
This module implements the Coulomb energy calculation using the Particle Mesh Ewald method, which splits the calculation into real-space and reciprocal-space contributions for improved efficiency in periodic systems.
| PARAMETER | DESCRIPTION |
|---|---|
rcut
|
Real-space cutoff distance
TYPE:
|
ethresh
|
Energy threshold for PME accuracy, by default 1e-5
TYPE:
|
kspace
|
Whether to include reciprocal space contribution, by default True
TYPE:
|
rspace
|
Whether to include real space contribution, by default True
TYPE:
|
slab_corr
|
Whether to apply slab correction, by default False
TYPE:
|
slab_axis
|
Axis at which the slab correction is applied, by default 2
TYPE:
|
units_dict
|
Dictionary of unit conversions, by default None
TYPE:
|
sel
|
Selection list for neighbor list, by default None
TYPE:
|
kappa
|
Inverse screening length [Å^-1], by default None
TYPE:
|
spacing
|
Grid spacing for reciprocal space, by default None
TYPE:
|
Initialize the CoulombForceModule with PME.
| PARAMETER | DESCRIPTION |
|---|---|
rcut
|
Real-space cutoff distance
TYPE:
|
ethresh
|
Energy threshold for PME accuracy, by default 1e-5
TYPE:
|
kspace
|
Whether to include reciprocal space contribution, by default True
TYPE:
|
rspace
|
Whether to include real space contribution, by default True
TYPE:
|
slab_corr
|
Whether to apply slab correction, by default False
TYPE:
|
slab_axis
|
Axis at which the slab correction is applied, by default 2
TYPE:
|
units_dict
|
Dictionary of unit conversions, by default None
TYPE:
|
sel
|
Selection list for neighbor list, by default None
TYPE:
|
kappa
|
Inverse screening length [Å^-1], by default None
TYPE:
|
spacing
|
Grid spacing for reciprocal space, by default None
TYPE:
|
Source code in torch_admp/pme.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
get_rcut() -> float
get_sel() -> Optional[list[int]]
Get sel list of DP model.
| RETURNS | DESCRIPTION |
|---|---|
Optional[list[int]]
|
The number of selected neighbors for each type of atom. |
setup_ewald_parameters(rcut: float, box: Union[torch.Tensor, np.ndarray, None] = None, threshold: float = 1e-05, spacing: Optional[float] = None, method: str = 'openmm') -> Tuple[float, int, int, int]
Given the cutoff distance, and the required precision, determine the parameters used in Ewald sum, including: kappa, kx, ky, and kz.
| PARAMETER | DESCRIPTION |
|---|---|
rcut
|
Cutoff distance
TYPE:
|
threshold
|
Expected average relative errors in force
TYPE:
|
box
|
Lattice vectors in (3 x 3) matrix Keep unit consistent with rcut
TYPE:
|
spacing
|
Fourier spacing to determine K, used in gromacs method Keep unit consistent with rcut
TYPE:
|
method
|
Method to determine ewald parameters. Valid values: "openmm" or "gromacs". If openmm, the algorithm can refer to http://docs.openmm.org/latest/userguide/theory/02_standard_forces.html#coulomb-interaction-with-particle-mesh-ewald If gromacs, the algorithm is adapted from gromacs source code
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
kappa
|
Ewald parameter, in 1/lenght unit
TYPE:
|
kx, ky, kz: int
|
number of the k-points mesh |
Source code in torch_admp/pme.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | |