pub struct FermionHamiltonian {
pub terms: Vec<FermionTerm>,
pub n_modes: usize,
}
Expand description
A sum of fermionic terms (second-quantized Hamiltonian)
Fields§
§terms: Vec<FermionTerm>
Terms in the Hamiltonian
n_modes: usize
Number of fermionic modes
Implementations§
Source§impl FermionHamiltonian
impl FermionHamiltonian
Sourcepub fn add_term(&mut self, term: FermionTerm)
pub fn add_term(&mut self, term: FermionTerm)
Add a term to the Hamiltonian
Sourcepub fn add_one_body(&mut self, i: usize, j: usize, coefficient: Complex<f64>)
pub fn add_one_body(&mut self, i: usize, j: usize, coefficient: Complex<f64>)
Add a one-body term: h_ij a†_i a_j
Sourcepub fn add_two_body(
&mut self,
i: usize,
j: usize,
k: usize,
l: usize,
coefficient: Complex<f64>,
)
pub fn add_two_body( &mut self, i: usize, j: usize, k: usize, l: usize, coefficient: Complex<f64>, )
Add a two-body term: g_ijkl a†_i a†_j a_k a_l
Sourcepub fn add_chemical_potential(&mut self, i: usize, mu: f64)
pub fn add_chemical_potential(&mut self, i: usize, mu: f64)
Add a chemical potential term: μ n_i
Sourcepub fn is_hermitian(&self, _tolerance: f64) -> bool
pub fn is_hermitian(&self, _tolerance: f64) -> bool
Check if the Hamiltonian is Hermitian
Trait Implementations§
Source§impl Clone for FermionHamiltonian
impl Clone for FermionHamiltonian
Source§fn clone(&self) -> FermionHamiltonian
fn clone(&self) -> FermionHamiltonian
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for FermionHamiltonian
impl RefUnwindSafe for FermionHamiltonian
impl Send for FermionHamiltonian
impl Sync for FermionHamiltonian
impl Unpin for FermionHamiltonian
impl UnwindSafe for FermionHamiltonian
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.