// TRANSIT.C // Function to calculate transition probabilities. // © 2021 Peter J. Meyer #include "iss.h" /* For T=1.0 Glauber transition probabilities (1/(1+e^n)) with J=1.0: -8:0.99966465 -7:0.99908895 -6:0.99752738 -5:0.99330715 -4:0.98201379 -3:0.95257413 -2:0.88079708 -1:0.73105858 0:0.50000000 1:0.26894142 2:0.11920292 3:0.04742587 4:0.01798621 5:0.00669285 6:0.00247262 7:0.00091105 8:0.00033535 For T=2.5 we have: Glauber transition probabilities (1/(1+e^n)) with J=1.0: -8:0.96083428 -7:0.94267582 -6:0.91682730 -5:0.88079708 -4:0.83201839 -3:0.76852478 -2:0.68997448 -1:0.59868766 0:0.50000000 1:0.40131234 2:0.31002552 3:0.23147522 4:0.16798161 5:0.11920292 6:0.08317270 7:0.05732418 8:0.03916572 For T=3.5 we have: Glauber transition probabilities (1/(1+e^n)) with J=1.0: -8:0.90768697 -7:0.88079708 -6:0.84739134 -5:0.80667863 -4:0.75820383 -3:0.70206337 -2:0.63909275 -1:0.57094660 0:0.50000000 1:0.42905340 2:0.36090725 3:0.29793663 4:0.24179617 5:0.19332137 6:0.15260866 7:0.11920292 8:0.09231303 For T=10.0 we have: Glauber transition probabilities (1/(1+e^n)) with J=1.0: -8:0.68997448 -7:0.66818777 -6:0.64565631 -5:0.62245933 -4:0.59868766 -3:0.57444252 -2:0.54983400 -1:0.52497919 0:0.50000000 1:0.47502081 2:0.45016600 3:0.42555748 4:0.40131234 5:0.37754067 6:0.35434369 7:0.33181223 8:0.31002552 */ // DO FOR METROPOLIS // This assumes temperature > 0. /*-----------------------------------------*/ void calculate_transition_probabilities(void) { #if DISPLAY_TRANSITION_PROBABILITIES int i; #endif int s; // If coordination number is n then // s: -2n -2n+1 -2n+2 ... -2 -1 0 1 2 ... 2n-1 2n // index: 0 1 2 2n-2 2n-1 2n 2n+1 2n+2 ... 4n-1 4n for ( s=-2*coord_num; s<=2*coord_num; s++ ) { if ( dynamics_is_metropolis ) w[s+2*coord_num] = ( s <= 0 ? 1.0 : exp((-s*J)/temperature) ); else // dynamics is glauber w[s+2*coord_num] = 1/(1+exp(s*J/temperature)); } #if DISPLAY_TRANSITION_PROBABILITIES if ( dynamics_is_metropolis ) printf("Metropolis transition probabilities (e^-n) with J=%.1f:",J); else printf("Glauber transition probabilities (1/(1+e^n)) with J=%.1f:",J); i = 0; for ( s=-2*coord_num; s<=2*coord_num; s++ ) { if ( w[s+2*coord_num] != 1.0 ) { if ( !(i%5) ) printf("\n"); printf("%3d:%10.8f ",s,w[s+2*coord_num]); i++; } } printf("\n\n"); #endif }