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
impl ExternalPotential
Sourcepub fn new() -> Self
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());Sourcepub fn from_point_charges(charges: Vec<PointCharge>) -> Self
pub fn from_point_charges(charges: Vec<PointCharge>) -> Self
Creates an external potential from a collection of point charges.
§Arguments
charges- A vector ofPointChargerepresenting 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);Sourcepub fn from_uniform_field(field: [f64; 3]) -> Self
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]);Sourcepub fn with_point_charges(self, charges: Vec<PointCharge>) -> Self
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 ofPointChargerepresenting 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]);Sourcepub fn with_uniform_field(self, field: [f64; 3]) -> Self
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]);Sourcepub fn point_charges(&self) -> &[PointCharge]
pub fn point_charges(&self) -> &[PointCharge]
Returns a reference to the point charges.
Sourcepub fn uniform_field(&self) -> [f64; 3]
pub fn uniform_field(&self) -> [f64; 3]
Returns the uniform electric field vector.
Sourcepub fn is_empty(&self) -> bool
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.
Sourcepub fn num_point_charges(&self) -> usize
pub fn num_point_charges(&self) -> usize
Returns the total number of point charges.
Trait Implementations§
Source§impl Clone for ExternalPotential
impl Clone for ExternalPotential
Source§fn clone(&self) -> ExternalPotential
fn clone(&self) -> ExternalPotential
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExternalPotential
impl Debug for ExternalPotential
Source§impl Default for ExternalPotential
impl Default for ExternalPotential
Source§fn default() -> ExternalPotential
fn default() -> ExternalPotential
Source§impl PartialEq for ExternalPotential
impl PartialEq for ExternalPotential
impl StructuralPartialEq for ExternalPotential
Auto Trait Implementations§
impl Freeze for ExternalPotential
impl RefUnwindSafe for ExternalPotential
impl Send for ExternalPotential
impl Sync for ExternalPotential
impl Unpin for ExternalPotential
impl UnsafeUnpin for ExternalPotential
impl UnwindSafe for ExternalPotential
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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