fn delta_rho_move_rigid_molecules(
        &mut self,
        configuration: &Configuration,
        molecule_id: usize,
        new_positions: &[Vector3D],
    ) -> Vec<Complex> {
        let molecule = configuration.molecule(molecule_id);
        let mut new_energy_ikr = Ewald3DArray::zeros((-self.kmax..(self.kmax + 1), 3, molecule.size()));

        // Do the k=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..molecule.size() {
                new_energy_ikr[(0, spatial, i)] = Complex::cartesian(1.0, 0.0);
                new_energy_ikr[(1, spatial, i)] = Complex::polar(1.0, k_vector * new_positions[i]);
                new_energy_ikr[(-1, spatial, i)] = new_energy_ikr[(1, spatial, i)].conj();
            }
        }

        // Use recursive definition for computing the factor for all the other values of k.
        for spatial in 0..3 {
            for k in 2..(self.kmax + 1) {
                for i in 0..molecule.size() {
                    new_energy_ikr[(k, spatial, i)] = new_energy_ikr[(k - 1, spatial, i)] * new_energy_ikr[(1, spatial, i)];
                    new_energy_ikr[(-k, spatial, i)] = new_energy_ikr[(k, spatial, i)].conj();
                }
            }
        }

        let mut delta = Vec::new();
        let charges = configuration.particles().charge;
        for &(ikx, iky, ikz) in &self.factors.index {
            let mut partial = Complex::zero();
            for (i, part_i) in molecule.indexes().enumerate() {
                let old_phi = self.eikr[(ikx, 0, part_i)] *
                              self.eikr[(iky, 1, part_i)] *
                              self.eikr[(ikz, 2, part_i)];

                let new_phi = new_energy_ikr[(ikx, 0, i)] *
                              new_energy_ikr[(iky, 1, i)] *
                              new_energy_ikr[(ikz, 2, i)];

                partial += charges[part_i] * (new_phi - old_phi);
            }
            delta.push(partial);
        }

        return delta;
    }
/// Compute the Fourier transform of the electrostatic density changes
/// while moving the molecule with the given `molecule_id` to
/// `new_positions`
Compute the Fourier transform of the electrostatic density changes
while moving the molecule with the given `molecule_id` to
`new_positions`
Compute the Fourier transform of the electrostatic density changes while moving the molecule with the given ` molecule_id ` to ` new_positions `
fn delta_rho_move_rigid_molecules(
        &mut self,
        configuration: &Configuration,
        molecule_id: usize,
        new_positions: &[Vector3D],
    ) -> Vec<Complex> {
        let molecule = configuration.molecule(molecule_id);
        let mut new_energy_ikr = Ewald3DArray::zeros((-self.kmax..(self.kmax + 1), 3, molecule.size()));
        // Do the k=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..molecule.size() {
                new_energy_ikr[(0, spatial, i)] = Complex::cartesian(1.0, 0.0);
                new_energy_ikr[(1, spatial, i)] = Complex::polar(1.0, k_vector * new_positions[i]);
                new_energy_ikr[(-1, spatial, i)] = new_energy_ikr[(1, spatial, i)].conj();
            }
        }
        // Use recursive definition for computing the factor for all the other values of k.
        for spatial in 0..3 {
            for k in 2..(self.kmax + 1) {
                for i in 0..molecule.size() {
                    new_energy_ikr[(k, spatial, i)] = new_energy_ikr[(k - 1, spatial, i)] * new_energy_ikr[(1, spatial, i)];
                    new_energy_ikr[(-k, spatial, i)] = new_energy_ikr[(k, spatial, i)].conj();
                }
            }
        }
        let mut delta = Vec::new();
        let charges = configuration.particles().charge;
        for &(ikx, iky, ikz) in &self.factors.index {
            let mut partial = Complex::zero();
            for (i, part_i) in molecule.indexes().enumerate() {
                let old_phi = self.eikr[(ikx, 0, part_i)] *
                              self.eikr[(iky, 1, part_i)] *
                              self.eikr[(ikz, 2, part_i)];
                let new_phi = new_energy_ikr[(ikx, 0, i)] *
                              new_energy_ikr[(iky, 1, i)] *
                              new_energy_ikr[(ikz, 2, i)];
                partial += charges[part_i] * (new_phi - old_phi);
            }
            delta.push(partial);
        }
        return delta;
    }
fn delta_rho_move_rigid_molecules ( & mut self , configuration : & Configuration , molecule_id : usize , new_positions : & [ Vector3D ] , ) -> Vec < Complex > { let molecule = configuration . molecule ( molecule_id ) ; let mut new_energy_ikr = Ewald3DArray :: zeros ( ( - self . kmax .. ( self . kmax + 1 ) , 3 , molecule . size ( ) ) ) ; // Do the k=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 .. molecule . size ( ) { new_energy_ikr [ ( 0 , spatial , i ) ] = Complex :: cartesian ( 1.0 , 0.0 ) ; new_energy_ikr [ ( 1 , spatial , i ) ] = Complex :: polar ( 1.0 , k_vector * new_positions [ i ] ) ; new_energy_ikr [ ( - 1 , spatial , i ) ] = new_energy_ikr [ ( 1 , spatial , i ) ] . conj ( ) ; } } // Use recursive definition for computing the factor for all the other values of k. for spatial in 0 .. 3 { for k in 2 .. ( self . kmax + 1 ) { for i in 0 .. molecule . size ( ) { new_energy_ikr [ ( k , spatial , i ) ] = new_energy_ikr [ ( k - 1 , spatial , i ) ] * new_energy_ikr [ ( 1 , spatial , i ) ] ; new_energy_ikr [ ( - k , spatial , i ) ] = new_energy_ikr [ ( k , spatial , i ) ] . conj ( ) ; } } } let mut delta = Vec :: new ( ) ; let charges = configuration . particles ( ) . charge ; for & ( ikx , iky , ikz ) in & self . factors . index { let mut partial = Complex :: zero ( ) ; for ( i , part_i ) in molecule . indexes ( ) . enumerate ( ) { let old_phi = self . eikr [ ( ikx , 0 , part_i ) ] * self . eikr [ ( iky , 1 , part_i ) ] * self . eikr [ ( ikz , 2 , part_i ) ] ; let new_phi = new_energy_ikr [ ( ikx , 0 , i ) ] * new_energy_ikr [ ( iky , 1 , i ) ] * new_energy_ikr [ ( ikz , 2 , i ) ] ; partial += charges [ part_i ] * ( new_phi - old_phi ) ; } delta . push ( partial ) ; } return delta ; }
Compute the Fourier transform of the electrostatic density changes
while moving the molecule with the given `molecule_id` to
`new_positions`
Compute the Fourier transform of the electrostatic density changes while moving the molecule with the given ` molecule_id ` to ` new_positions `
&mut self
configuration
&Configuration
molecule_id
usize
new_positions
&[Vector3D]