[−][src]Struct bader::voxel_map::VoxelMap
A structure for building and processing the map between voxel and maxima.
Bader maxima are stored in the voxel_map whilst the contributing weights are
stored in the weight_map. The weight_map is only written to once by each
point and so once a value has been written it is safe to read by any thread.
To check it has been written to weight_get
monitors the state of corresponding
voxel_map value. Writing to the map is acheived by acquiring the lock, noting
the length of the weight_map, pushing the weight vector for voxel p to the
weight_map, droping the write lock and then storing the index of the inserted
vector using weight_store
.
Examples
use bader::voxel_map::VoxelMap; for p in 0..1isize { let voxel_map = VoxelMap::new(10); let i = { let mut weight = voxel_map.lock(); (*weight).push(Vec::with_capacity(0)); weight.len() - 1 }; voxel_map.weight_store(p, i) }
Fields
assigned_atom: Vec<usize>
minimum_distance: Vec<f64>
bader_volume: Vec<f64>
surface_distance: Vec<f64>
bader_charge: Vec<Vec<f64>>
bader_maxima: Vec<isize>
Implementations
impl VoxelMap
[src]
pub fn new(size: usize) -> Self
[src]
Initialises a VoxelMap of dimensions, size.
pub fn weight_get(&self, p: isize) -> Voxel<'_>
[src]
Retrieves the state of the voxel, p. This will lock until p has been stored
in the VoxelMap and then return either a Voxel::Maxima
or Voxel::Weight
.
Calling this on a voxel, p, that is below the vacuum_tolerance will deadlock
as a voxel is considered stored once voxel_map[p] > -1.
pub fn maxima_get(&self, p: isize) -> isize
[src]
Atomic loading of voxel, p, from voxel_map blocks if maxima == -1
pub fn maxima_non_block_get(&self, p: isize) -> isize
[src]
Atomic loading of voxel, p, from voxel_map
pub fn voxel_get(&self, p: isize) -> Voxel<'_>
[src]
A none locking retrieval of the state of voxel, p. This should only be used once the VoxelMap has been fully populated.
pub fn maxima_list(&self) -> Vec<isize>
[src]
Finds the unique values contained in voxel_map and returns them sorted by value.
pub fn maxima_store(&self, p: isize, maxima: isize)
[src]
Stores the maxima of voxel, p, in the voxel_map.
pub fn weight_store(&self, p: isize, i: usize)
[src]
Stores the index of p's weight contributions in weight_map into the weight_index and unlocks the structure.
pub fn lock(&self) -> Lock<'_>
[src]
Locks the structure for write access.
pub fn assign_atoms(&mut self, atoms: &Atoms, density: &Density<'_>)
[src]
Assigns each Bader maxima to an atom.
pub fn charge_sum(
&mut self,
densities: &[Vec<f64>],
atoms: &Atoms,
density: &Density<'_>
)
[src]
&mut self,
densities: &[Vec<f64>],
atoms: &Atoms,
density: &Density<'_>
)
Sums the densities for each bader volume.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for VoxelMap
impl Send for VoxelMap
impl Unpin for VoxelMap
impl UnwindSafe for VoxelMap
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,
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, 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.
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>,