+ count_p=0;
+ M=0;
+ if((*(atom+x_c+((2*y_c+1)%max_y)*max_x))&1) ++count_p;
+ if((*(atom+x_c+((2*y_c-1)%max_y)*max_x))&1) ++count_p;
+ if((*(atom+((2*x_c+1)%max_x)+y_c*max_x))&1) ++count_p;
+ if((*(atom+((2*x_c-1)%max_x)+y_c*max_x))&1) ++count_p;
+ if(((*(atom+x_c+y_c*max_x))&1)==0) count_p=4-count_p;
+ delta_e=(2*count_p-4)*S;
+ if(delta_e<0) *(atom+x_c+y_c*max_x)=(*(atom+x_c+y_c*max_x)+1)&1;
+ else
+ {
+ if(1.0*rand()/RAND_MAX<exp(-1.0*delta_e*beta))
+ *(atom+x_c+y_c*max_x)=(*(atom+x_c+y_c*max_x)+1)&1;
+ }
+ if((*(atom+x_c+((2*y_c+1)%max_y)*max_x))&1) ++M;