[]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());

Methods

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 Deref for Ewald

type Target = EwaldParameters

The resulting type after dereferencing.

impl Clone for Ewald

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl FromTomlWithRefData for Ewald

type Data = Configuration

The type of the additional data needed.

Auto Trait Implementations

impl Send for Ewald

impl Sync for Ewald

Blanket Implementations

impl<T> From for T[src]

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

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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