[]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

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.

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

The resulting type after dereferencing.

Dereferences the value.

impl Clone for Ewald

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl FromTomlWithRefData for Ewald

The type of the additional data needed.

Do the conversion from table and data to Self.

Auto Trait Implementations

impl Send for Ewald

impl Sync for Ewald

Blanket Implementations

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

Creates owned data from borrowed data, usually by cloning. Read more

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> From for T
[src]

Performs the conversion.

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

Performs the conversion.

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

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

The type returned in the event of a conversion error.

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

Performs the conversion.

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

Important traits for &'a mut R

Immutably borrows from an owned value. Read more

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

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

The type returned in the event of a conversion error.

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

Performs the conversion.

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

Important traits for &'a mut R

Mutably borrows from an owned value. Read more

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

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

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more