[]Struct lumol::energy::Ewald

pub struct Ewald { /* fields omitted */ }

Ewald summation for coulombic interactions.

The Ewald summation is based on a separation of the coulombic potential U in two parts, using the trivial identity:

$$ U(x) = U(x) \times (f(x) + 1) - U(x) \times f(x) $$

where f is the erf function. This leads to a separation of the conditionally convergent coulombic sum into two absolutely convergent sums: one in real space, and the other in Fourier or k-space. For more information about this algorithm see [FS2002].

[FS2002] Frenkel, D. & Smith, B. Understanding molecular simulation. (Academic press, 2002).

Examples

let ewald = SharedEwald::new(
    Ewald::new(/* cutoff */ 12.0, /* kmax */ 7, /* alpha */ None)
);

// Setup a system containing a NaCl pair
let mut system = System::with_cell(UnitCell::cubic(30.0));

let mut na = Particle::new("Na");
na.charge = 1.0;
na.position = Vector3D::new(0.0, 0.0, 0.0);

let mut cl = Particle::new("Cl");
cl.charge = -1.0;
cl.position = Vector3D::new(2.0, 0.0, 0.0);

system.add_molecule(Molecule::new(na));
system.add_molecule(Molecule::new(cl));

// Use Ewald summation for electrostatic interactions
system.set_coulomb_potential(Box::new(ewald));

println!("energy is {}", system.potential_energy());

Implementations

impl Ewald

pub fn new<I>(cutoff: f64, kmax: usize, alpha: I) -> Ewald where
    I: Into<Option<f64>>, 

Create an Ewald summation using the given cutoff radius in real space, and kmax points in k-space (Fourier space). If alpha is None, then the default value of π / cutoff is used.

pub fn with_accuracy(
    cutoff: f64,
    accuracy: f64,
    configuration: &Configuration
) -> Ewald

Create an Ewald solver with the given real space cutoff, setting alpha and kmax to ensure that the energy is computed with the specified relative accuracy. The optimal parameter depends on the exact configuration used: both the total number of charges, and the unit cell.

Trait Implementations

impl Clone for Ewald

impl Deref for Ewald

type Target = EwaldParameters

The resulting type after dereferencing.

impl FromTomlWithRefData for Ewald

type Data = Configuration

The type of the additional data needed.

Auto Trait Implementations

impl !RefUnwindSafe for Ewald

impl Send for Ewald

impl Sync for Ewald

impl Unpin for Ewald

impl !UnwindSafe for Ewald

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,