Пример #1
0
        public void SingleFlip(Spin chosen)
        {
            var energyDifference = 2 * CalculateEnergyNn(chosen);

            if (Accept(energyDifference, chosen.Value))
            {
                chosen.ToggleSpin();
                TotalInteraction   += energyDifference;
                TotalMagnetization += 2 * chosen.Value;
            }
        }
Пример #2
0
        public void Kawasaki(Spin chosen)
        {
            Spin exchange = chosen.Neighbours[Rnd.Next(4)];

            if (chosen.Value == 0 || exchange.Value == 0 || chosen.Value == exchange.Value)
            {
                return;
            }
            var energyDifference = 2 * CalculateEnergyChangeKawasaki(chosen, exchange);

            if (Accept(energyDifference, 0))
            {
                chosen.ToggleSpin();
                exchange.ToggleSpin();
                TotalInteraction += energyDifference;
            }
        }