fn real_space_energy(&self, configuration: &Configuration) -> f64 {
        let natoms = configuration.size();
        let charges = configuration.particles().charge;

        let energies = (0..natoms).into_par_iter().map(|i| {
            let mut local_energy = 0.0;
            let qi = charges[i];
            if qi == 0.0 {
                return 0.0;
            }

            for j in i + 1..natoms {
                let qj = charges[j];
                if qj == 0.0 {
                    continue;
                }

                let path = configuration.bond_path(i, j);
                let info = self.restriction.information(path);

                let r = configuration.distance(i, j);
                local_energy += self.real_space_energy_pair(info, qi * qj, r);
            }

            local_energy
        });
        return energies.sum();
    }
/// Real space contribution to the energy
Real space contribution to the energy
Real space contribution to the energy
fn real_space_energy(&self, configuration: &Configuration) -> f64 {
        let natoms = configuration.size();
        let charges = configuration.particles().charge;
        let energies = (0..natoms).into_par_iter().map(|i| {
            let mut local_energy = 0.0;
            let qi = charges[i];
            if qi == 0.0 {
                return 0.0;
            }
            for j in i + 1..natoms {
                let qj = charges[j];
                if qj == 0.0 {
                    continue;
                }
                let path = configuration.bond_path(i, j);
                let info = self.restriction.information(path);
                let r = configuration.distance(i, j);
                local_energy += self.real_space_energy_pair(info, qi * qj, r);
            }
            local_energy
        });
        return energies.sum();
    }
fn real_space_energy ( & self , configuration : & Configuration ) -> f64 { let natoms = configuration . size ( ) ; let charges = configuration . particles ( ) . charge ; let energies = ( 0 .. natoms ) . into_par_iter ( ) . map ( | i | { let mut local_energy = 0.0 ; let qi = charges [ i ] ; if qi == 0.0 { return 0.0 ; } for j in i + 1 .. natoms { let qj = charges [ j ] ; if qj == 0.0 { continue ; } let path = configuration . bond_path ( i , j ) ; let info = self . restriction . information ( path ) ; let r = configuration . distance ( i , j ) ; local_energy += self . real_space_energy_pair ( info , qi * qj , r ) ; } local_energy } ) ; return energies . sum ( ) ; }
Real space contribution to the energy
Real space contribution to the energy
&self
configuration
&Configuration