Skip to content

Commit 558c6de

Browse files
author
Weiwei Wang
committed
bug fix
1 parent 6e24531 commit 558c6de

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/mc/skx.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ def init_m(pos):
1212

1313
return (0,0,1)
1414

15+
def random_m(pos):
16+
return np.random.random(3) - 0.5
17+
1518

1619
def run(mesh):
1720

1821
mc = MonteCarlo(mesh, name='test1')
1922
mc.set_m(init_m)
20-
mc.set_options(H=[0,0,0.5], J=50.0, D=0.27*50, T=5.0)
23+
mc.set_options(H=[0,0,0.0], J=50.0, D=0.27*50, T=5.0)
2124
mc.run(steps=200000, save_m_steps=None, save_vtk_steps=1000, save_data_steps=10)
2225

2326
if __name__=='__main__':

fidimag/atomistic/lib/mc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
void uniform_random_sphere(double *phi, double *ct, int n){
44
for (int i=0;i<n;i++){
5-
phi[i] = single_random()*2*M_PI;
5+
phi[i] = single_random()*2*WIDE_PI;
66
ct[i] = 2*single_random()-1;
77
}
88
}
@@ -13,7 +13,7 @@ void uniform_random_sphere(double *phi, double *ct, int n){
1313
void random_spin_uniform(double *spin, int n){
1414
for (int i=0;i<n;i++){
1515
int j=3*i;
16-
double phi= single_random()*2*M_PI;
16+
double phi= single_random()*2*WIDE_PI;
1717
double ct = 2*single_random()-1;
1818
double st = sqrt(1-ct*ct);
1919
spin[j] = st*cos(phi); //mx = sin(theta)*cos(phi)

0 commit comments

Comments
 (0)