pub struct Coulomb;Expand description
Standard Coulomb potential implementation for electrostatics.
§Physics
Models the electrostatic interaction between two point charges.
- Formula: $$ E = \frac{C \cdot q_i q_j}{\epsilon \cdot r} $$
- Derivative Factor (
diff): $$ D = -\frac{1}{r} \frac{dE}{dr} = \frac{E}{r^2} = \frac{C \cdot q_i q_j}{\epsilon \cdot r^3} $$
§Parameters
q_product: The effective charge product $ Q_{eff} = \frac{C \cdot q_i q_j}{\epsilon} $.
§Inputs
r_sq: Squared distance $ r^2 $ between two atoms.
§Implementation Notes
- Optimized to minimize arithmetic operations by reusing intermediate
inv_randinv_r2. - Utilizes
rsqrtfor potential hardware acceleration. - Branchless and panic-free.
Trait Implementations§
Source§impl<T: Real> PairKernel<T> for Coulomb
impl<T: Real> PairKernel<T> for Coulomb
Source§fn diff(r_sq: T, q_product: Self::Params) -> T
fn diff(r_sq: T, q_product: Self::Params) -> T
Computes only the force pre-factor $D$.
§Formula
$$ D = \frac{Q_{eff}}{r^3} $$
This factor is defined such that the force vector can be computed by a single vector multiplication: $\vec{F} = -D \cdot \vec{r}$.
Source§fn compute(r_sq: T, q_product: Self::Params) -> EnergyDiff<T>
fn compute(r_sq: T, q_product: Self::Params) -> EnergyDiff<T>
Computes both energy and force pre-factor efficiently.
This method reuses intermediate calculations to minimize operations.
impl Copy for Coulomb
Auto Trait Implementations§
impl Freeze for Coulomb
impl RefUnwindSafe for Coulomb
impl Send for Coulomb
impl Sync for Coulomb
impl Unpin for Coulomb
impl UnwindSafe for Coulomb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more