src/system.cpp
/**
 * Computes the difference in energy from a spin flip, 
 * given the index if the spin to flip 
 * and the index of the spin value to flip it to.
 * 
 * @param site  (int): Index of the spin to flip.
 * @param new_spin_idx  (int): Index of the new spin value.
 * @return delta_E (int)
 */
Computes the difference in energy from a spin flip,
given the index if the spin to flip
and the index of the spin value to flip it to.

@param site  (int): Index of the spin to flip.
@param new_spin_idx  (int): Index of the new spin value.
Computes the difference in energy from a spin flip given the index if the spin to flip and the index of the spin value to flip it to . @param site ( int ) : Index of the spin to flip . @param new_spin_idx ( int ) : Index of the new spin value .
int System::energy_flip(int site, int new_spin_idx) {
    int E_tmp1 = 0;
    for (int a = 0; a < this->NN; ++a) {
        E_tmp1 += - this->spins_vector[site] * this->spins_vector[this->NN_table[site * this->NN + a]];
    }
    int E_tmp2 = 0;
    for (int a = 0; a < this->NN; ++a) {
        E_tmp2 += - this->spins_values[new_spin_idx] * this->spins_vector[this->NN_table[site * this->NN + a]];
    }
    return E_tmp2 - E_tmp1;
}
int System :: energy_flip ( int site , int new_spin_idx ) { int E_tmp1 = 0 ; for ( int a = 0 ; a < this -> NN ; ++ a ) { E_tmp1 += - this -> spins_vector [ site ] * this -> spins_vector [ this -> NN_table [ site * this -> NN + a ] ] ; } int E_tmp2 = 0 ; for ( int a = 0 ; a < this -> NN ; ++ a ) { E_tmp2 += - this -> spins_values [ new_spin_idx ] * this -> spins_vector [ this -> NN_table [ site * this -> NN + a ] ] ; } return E_tmp2 - E_tmp1 ; }
Computes the difference in energy from a spin flip,
 given the index if the spin to flip
 and the index of the spin value to flip it to.
Computes the difference in energy from a spin flip given the index if the spin to flip and the index of the spin value to flip it to .