Skip to main content

ExternalPotential

Struct ExternalPotential 

Source
pub struct ExternalPotential { /* private fields */ }
Expand description

An external electrostatic potential acting on the QEq system.

This struct describes the electrostatic environment surrounding a molecular fragment undergoing charge equilibration. It enables hybrid QEq/MM calculations where the QEq subsystem (e.g., a ligand) responds to the electrostatic field generated by the environment (e.g., a protein binding pocket) without including the environment atoms in the expensive matrix diagonalization.

Implementations§

Source§

impl ExternalPotential

Source

pub fn new() -> Self

Creates an empty external potential with no contributions.

This is equivalent to computing QEq in vacuum (the default behavior).

§Examples
use cheq::ExternalPotential;

let empty = ExternalPotential::new();
assert!(empty.is_empty());
Source

pub fn from_point_charges(charges: Vec<PointCharge>) -> Self

Creates an external potential from a collection of point charges.

§Arguments
  • charges - A vector of PointCharge representing external atoms.
§Returns

A new ExternalPotential instance containing the specified point charges.

§Examples
use cheq::{ExternalPotential, PointCharge};

let charges = vec![
    PointCharge::new(8, [3.0, 0.0, 0.0], -0.82),
    PointCharge::new(1, [3.5, 0.7, 0.0],  0.41),
];

let external = ExternalPotential::from_point_charges(charges);
assert_eq!(external.point_charges().len(), 2);
Source

pub fn from_uniform_field(field: [f64; 3]) -> Self

Creates an external potential from a uniform electric field.

§Arguments
  • field - The electric field vector [Ex, Ey, Ez] in V/Å.
§Returns

A new ExternalPotential instance with the specified uniform field.

§Examples
use cheq::ExternalPotential;

// Apply a field of 0.1 V/Å along the z-axis (e.g., transmembrane potential)
let external = ExternalPotential::from_uniform_field([0.0, 0.0, 0.1]);
Source

pub fn with_point_charges(self, charges: Vec<PointCharge>) -> Self

Sets the point charges for this external potential.

This method consumes and returns self, enabling a builder-style API.

§Arguments
  • charges - A vector of PointCharge representing external atoms.
§Examples
use cheq::{ExternalPotential, PointCharge};

let external = ExternalPotential::new()
    .with_point_charges(vec![
        PointCharge::new(6, [0.0, 0.0, 5.0], 0.1),
    ])
    .with_uniform_field([0.0, 0.0, 0.05]);
Source

pub fn with_uniform_field(self, field: [f64; 3]) -> Self

Sets the uniform electric field for this external potential.

This method consumes and returns self, enabling a builder-style API.

§Arguments
  • field - The electric field vector [Ex, Ey, Ez] in V/Å.
§Examples
use cheq::ExternalPotential;

let external = ExternalPotential::new()
    .with_uniform_field([0.0, 0.0, 0.2]);
Source

pub fn point_charges(&self) -> &[PointCharge]

Returns a reference to the point charges.

Source

pub fn uniform_field(&self) -> [f64; 3]

Returns the uniform electric field vector.

Source

pub fn is_empty(&self) -> bool

Returns true if this external potential has no contributions.

An empty potential is equivalent to vacuum conditions and will not affect the QEq calculation.

Source

pub fn num_point_charges(&self) -> usize

Returns the total number of point charges.

Trait Implementations§

Source§

impl Clone for ExternalPotential

Source§

fn clone(&self) -> ExternalPotential

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExternalPotential

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExternalPotential

Source§

fn default() -> ExternalPotential

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ExternalPotential

Source§

fn eq(&self, other: &ExternalPotential) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ExternalPotential

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V