Skip to content

Commit

Permalink
function for computing total charge (needs test)
Browse files Browse the repository at this point in the history
  • Loading branch information
2AUK committed Oct 3, 2023
1 parent b850e20 commit 773d789
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/dipole.rs
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
use crate::data::Species;
use crate::quaternion::Quaternion;
use ndarray::{Array, Array1};

pub fn total_charge(species: Vec<Species>) -> f64 {
species.iter().fold(0.0, |acc, x| {
acc + x
.atom_sites
.iter()
.fold(0.0, |acc_inner, y| acc_inner + y.params.last().unwrap())
})
}

pub fn centre_of_charge(species: Vec<Species>) -> Array1<f64> {
let out = Array::zeros(3);
out
}

0 comments on commit 773d789

Please sign in to comment.