fn eik_dot_r(&mut self, configuration: &Configuration) {
        let natoms = configuration.size();
        let range = -self.kmax..(self.kmax + 1);
        self.eikr.resize_if_different((range, 3, natoms));
        self.rho.clear();

        let positions = configuration.particles().position;
        let charges = configuration.particles().charge;

        // do the k = -1, 0, 1 cases first
        for spatial in 0..3 {
            let mut k_idx = [0.0, 0.0, 0.0];
            k_idx[spatial] = 1.0;
            let k_vector = configuration.cell.k_vector(k_idx);
            for i in 0..natoms {
                self.eikr[(0, spatial, i)] = Complex::cartesian(1.0, 0.0);
                self.eikr[(1, spatial, i)] = Complex::polar(1.0, k_vector * positions[i]);
                self.eikr[(-1, spatial, i)] = self.eikr[(1, spatial, i)].conj();
            }
        }

        // compute the other values of k by recursion
        for spatial in 0..3 {
            for k in 2..(self.kmax + 1) {
                for i in 0..natoms {
                    self.eikr[(k, spatial, i)] = self.eikr[(k - 1, spatial, i)] * self.eikr[(1, spatial, i)];
                    self.eikr[(-k, spatial, i)] = self.eikr[(k, spatial, i)].conj();
                }
            }
        }

        for &(ikx, iky, ikz) in &self.factors.index {
            let mut partial = Complex::zero();
            for i in 0..natoms {
                let phi = self.eikr[(ikx, 0, i)] *
                          self.eikr[(iky, 1, i)] *
                          self.eikr[(ikz, 2, i)];
                partial += charges[i] * phi;
            }
            self.rho.push(partial);
        }
    }
/// Compute the Fourier transform of the electrostatic density
Compute the Fourier transform of the electrostatic density
Compute the Fourier transform of the electrostatic density
fn eik_dot_r(&mut self, configuration: &Configuration) {
        let natoms = configuration.size();
        let range = -self.kmax..(self.kmax + 1);
        self.eikr.resize_if_different((range, 3, natoms));
        self.rho.clear();
        let positions = configuration.particles().position;
        let charges = configuration.particles().charge;
        // do the k = -1, 0, 1 cases first
        for spatial in 0..3 {
            let mut k_idx = [0.0, 0.0, 0.0];
            k_idx[spatial] = 1.0;
            let k_vector = configuration.cell.k_vector(k_idx);
            for i in 0..natoms {
                self.eikr[(0, spatial, i)] = Complex::cartesian(1.0, 0.0);
                self.eikr[(1, spatial, i)] = Complex::polar(1.0, k_vector * positions[i]);
                self.eikr[(-1, spatial, i)] = self.eikr[(1, spatial, i)].conj();
            }
        }
        // compute the other values of k by recursion
        for spatial in 0..3 {
            for k in 2..(self.kmax + 1) {
                for i in 0..natoms {
                    self.eikr[(k, spatial, i)] = self.eikr[(k - 1, spatial, i)] * self.eikr[(1, spatial, i)];
                    self.eikr[(-k, spatial, i)] = self.eikr[(k, spatial, i)].conj();
                }
            }
        }
        for &(ikx, iky, ikz) in &self.factors.index {
            let mut partial = Complex::zero();
            for i in 0..natoms {
                let phi = self.eikr[(ikx, 0, i)] *
                          self.eikr[(iky, 1, i)] *
                          self.eikr[(ikz, 2, i)];
                partial += charges[i] * phi;
            }
            self.rho.push(partial);
        }
    }
fn eik_dot_r ( & mut self , configuration : & Configuration ) { let natoms = configuration . size ( ) ; let range = - self . kmax .. ( self . kmax + 1 ) ; self . eikr . resize_if_different ( ( range , 3 , natoms ) ) ; self . rho . clear ( ) ; let positions = configuration . particles ( ) . position ; let charges = configuration . particles ( ) . charge ; // do the k = -1, 0, 1 cases first for spatial in 0 .. 3 { let mut k_idx = [ 0.0 , 0.0 , 0.0 ] ; k_idx [ spatial ] = 1.0 ; let k_vector = configuration . cell . k_vector ( k_idx ) ; for i in 0 .. natoms { self . eikr [ ( 0 , spatial , i ) ] = Complex :: cartesian ( 1.0 , 0.0 ) ; self . eikr [ ( 1 , spatial , i ) ] = Complex :: polar ( 1.0 , k_vector * positions [ i ] ) ; self . eikr [ ( - 1 , spatial , i ) ] = self . eikr [ ( 1 , spatial , i ) ] . conj ( ) ; } } // compute the other values of k by recursion for spatial in 0 .. 3 { for k in 2 .. ( self . kmax + 1 ) { for i in 0 .. natoms { self . eikr [ ( k , spatial , i ) ] = self . eikr [ ( k - 1 , spatial , i ) ] * self . eikr [ ( 1 , spatial , i ) ] ; self . eikr [ ( - k , spatial , i ) ] = self . eikr [ ( k , spatial , i ) ] . conj ( ) ; } } } for & ( ikx , iky , ikz ) in & self . factors . index { let mut partial = Complex :: zero ( ) ; for i in 0 .. natoms { let phi = self . eikr [ ( ikx , 0 , i ) ] * self . eikr [ ( iky , 1 , i ) ] * self . eikr [ ( ikz , 2 , i ) ] ; partial += charges [ i ] * phi ; } self . rho . push ( partial ) ; } }
Compute the Fourier transform of the electrostatic density
Compute the Fourier transform of the electrostatic density
&mut self
configuration
&Configuration