pub fn init(&mut self, system: &System) {
        self.clear();
        self.pairs_cache.resize_if_different((system.size(), system.size()));

        let evaluator = system.energy_evaluator();

        for i in 0..system.size() {
            for j in (i + 1)..system.size() {
                let r = system.nearest_image(i, j).norm();
                let path = system.bond_path(i, j);
                let energy = evaluator.pair(path, r, i, j);
                self.pairs_cache[(i, j)] = energy;
                self.pairs_cache[(j, i)] = energy;
                self.pairs += energy;
            }
        }

        self.pairs_tail = evaluator.pairs_tail();
        self.bonds = evaluator.bonds();
        self.angles = evaluator.angles();
        self.dihedrals = evaluator.dihedrals();
        self.coulomb = evaluator.coulomb();
        self.global = evaluator.global();
    }
/// Initialize the cache to be used with `system`. After a call to this
/// function, the cache is only usable with the same system. To change
/// the associated system, one must call this function again.
Initialize the cache to be used with `system`. After a call to this
function, the cache is only usable with the same system. To change
the associated system, one must call this function again.
Initialize the cache to be used with ` system ` . After a call to this function the cache is only usable with the same system . To change the associated system one must call this function again .
pub fn init(&mut self, system: &System) {
        self.clear();
        self.pairs_cache.resize_if_different((system.size(), system.size()));
        let evaluator = system.energy_evaluator();
        for i in 0..system.size() {
            for j in (i + 1)..system.size() {
                let r = system.nearest_image(i, j).norm();
                let path = system.bond_path(i, j);
                let energy = evaluator.pair(path, r, i, j);
                self.pairs_cache[(i, j)] = energy;
                self.pairs_cache[(j, i)] = energy;
                self.pairs += energy;
            }
        }
        self.pairs_tail = evaluator.pairs_tail();
        self.bonds = evaluator.bonds();
        self.angles = evaluator.angles();
        self.dihedrals = evaluator.dihedrals();
        self.coulomb = evaluator.coulomb();
        self.global = evaluator.global();
    }
pub fn init ( & mut self , system : & System ) { self . clear ( ) ; self . pairs_cache . resize_if_different ( ( system . size ( ) , system . size ( ) ) ) ; let evaluator = system . energy_evaluator ( ) ; for i in 0 .. system . size ( ) { for j in ( i + 1 ) .. system . size ( ) { let r = system . nearest_image ( i , j ) . norm ( ) ; let path = system . bond_path ( i , j ) ; let energy = evaluator . pair ( path , r , i , j ) ; self . pairs_cache [ ( i , j ) ] = energy ; self . pairs_cache [ ( j , i ) ] = energy ; self . pairs += energy ; } } self . pairs_tail = evaluator . pairs_tail ( ) ; self . bonds = evaluator . bonds ( ) ; self . angles = evaluator . angles ( ) ; self . dihedrals = evaluator . dihedrals ( ) ; self . coulomb = evaluator . coulomb ( ) ; self . global = evaluator . global ( ) ; }
Initialize the cache to be used with `system`.
Initialize the cache to be used with ` system ` .
&mut self
system
&System