fn real_space_molecular_virial(&self, configuration: &Configuration) -> Matrix3 {
        let charges = configuration.particles().charge;
        let virial = configuration.molecules().enumerate().par_bridge().map(|(i, molecule_i)| {
            let mut local_virial = Matrix3::zero();
            let ri = molecule_i.center_of_mass();

            for molecule_j in configuration.molecules().skip(i + 1) {
                let rj = molecule_j.center_of_mass();
                let mut r_ij = ri - rj;
                configuration.cell.vector_image(&mut r_ij);

                for part_a in molecule_i.indexes() {
                    let q_a = charges[part_a];
                    if q_a == 0.0 {
                        continue;
                    }

                    for part_b in molecule_j.indexes() {
                        let q_b = charges[part_b];
                        if q_b == 0.0 {
                            continue;
                        }

                        let path = configuration.bond_path(part_a, part_b);
                        let info = self.restriction.information(path);

                        let r_ab = configuration.nearest_image(part_a, part_b);
                        let force = self.real_space_force_pair(info, q_a * q_b, r_ab.norm()) * r_ab;
                        let w_ab = force.tensorial(&r_ab);
                        local_virial += w_ab * (r_ab * r_ij) / r_ab.norm2();
                    }
                }
            }
            return local_virial;
        });

        return virial.sum();
     }
/// Real space contribution to the molecular virial
Real space contribution to the molecular virial
Real space contribution to the molecular virial
fn real_space_molecular_virial(&self, configuration: &Configuration) -> Matrix3 {
        let charges = configuration.particles().charge;
        let virial = configuration.molecules().enumerate().par_bridge().map(|(i, molecule_i)| {
            let mut local_virial = Matrix3::zero();
            let ri = molecule_i.center_of_mass();
            for molecule_j in configuration.molecules().skip(i + 1) {
                let rj = molecule_j.center_of_mass();
                let mut r_ij = ri - rj;
                configuration.cell.vector_image(&mut r_ij);
                for part_a in molecule_i.indexes() {
                    let q_a = charges[part_a];
                    if q_a == 0.0 {
                        continue;
                    }
                    for part_b in molecule_j.indexes() {
                        let q_b = charges[part_b];
                        if q_b == 0.0 {
                            continue;
                        }
                        let path = configuration.bond_path(part_a, part_b);
                        let info = self.restriction.information(path);
                        let r_ab = configuration.nearest_image(part_a, part_b);
                        let force = self.real_space_force_pair(info, q_a * q_b, r_ab.norm()) * r_ab;
                        let w_ab = force.tensorial(&r_ab);
                        local_virial += w_ab * (r_ab * r_ij) / r_ab.norm2();
                    }
                }
            }
            return local_virial;
        });
        return virial.sum();
     }
fn real_space_molecular_virial ( & self , configuration : & Configuration ) -> Matrix3 { let charges = configuration . particles ( ) . charge ; let virial = configuration . molecules ( ) . enumerate ( ) . par_bridge ( ) . map ( | ( i , molecule_i ) | { let mut local_virial = Matrix3 :: zero ( ) ; let ri = molecule_i . center_of_mass ( ) ; for molecule_j in configuration . molecules ( ) . skip ( i + 1 ) { let rj = molecule_j . center_of_mass ( ) ; let mut r_ij = ri - rj ; configuration . cell . vector_image ( & mut r_ij ) ; for part_a in molecule_i . indexes ( ) { let q_a = charges [ part_a ] ; if q_a == 0.0 { continue ; } for part_b in molecule_j . indexes ( ) { let q_b = charges [ part_b ] ; if q_b == 0.0 { continue ; } let path = configuration . bond_path ( part_a , part_b ) ; let info = self . restriction . information ( path ) ; let r_ab = configuration . nearest_image ( part_a , part_b ) ; let force = self . real_space_force_pair ( info , q_a * q_b , r_ab . norm ( ) ) * r_ab ; let w_ab = force . tensorial ( & r_ab ) ; local_virial += w_ab * ( r_ab * r_ij ) / r_ab . norm2 ( ) ; } } } return local_virial ; } ) ; return virial . sum ( ) ; }
Real space contribution to the molecular virial
Real space contribution to the molecular virial
&self
configuration
&Configuration