[][src]Function bader::methods::neargrid

pub fn neargrid(
    p: usize,
    density: &Density<'_>,
    _weight_map: WeightMap
) -> (isize, Vec<(usize, f64)>)

Find the maxima assiociated with the current point using the neargrid method

  • p: The point from which to step.
  • density: The reference Density.
  • _weight_map: An unused Arc wrapped VoxelMap for tracking the maxima.

Returns:

(isize, Vec::with_capacity(0)): The point current point's maxima and it's weights. As this is not the weight method there are no weights.

Examples

use bader::density::Density;
use bader::atoms::Lattice;
use bader::voxel_map::VoxelMap;
use bader::methods::neargrid;
use std::sync::Arc;

// Intialise the reference density.
let data = (0..64).map(|rho| rho as f64).collect::<Vec<f64>>();
let lattice = Lattice::new([[3., 0., 0.], [0., 3., 0.], [0., 0., 3.]]);
let density = Density::new(&data,
                           [4, 4, 4],
                           lattice.to_cartesian,
                           1E-8,
                           None,
                           [0., 0., 0.]);
let voxel_map = VoxelMap::new(64);
let voxel_map = Arc::new(voxel_map);
// Unlike the other methods this follows the density gradient all the way to
// a maxima as the correction to the steps means that landing at a point
// doesn't mean the the original point's maxima will be the same.
assert_eq!(neargrid(22, &density, Arc::clone(&voxel_map)).0, 63)