[−]Struct lumol::Ewald
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>>,
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
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
pub fn clone(&self) -> Ewald
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Deref for Ewald
type Target = EwaldParameters
The resulting type after dereferencing.
pub fn deref(&self) -> &EwaldParameters
impl FromTomlWithRefData for Ewald
type Data = Configuration
The type of the additional data needed.
pub fn from_toml(
table: &Map<String, Value>,
configuration: &Configuration
) -> Result<Ewald, Error>
table: &Map<String, Value>,
configuration: &Configuration
) -> Result<Ewald, Error>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,