示例#1
0
文件: sllg.py 项目: fangohr/fidimag
    def set_options(self, dt=1e-15, theta=1.0, gamma=const.gamma, k_B=const.k_B, seed=100):

        clib.init_random(seed)
        self.gamma = gamma
        self.k_B = k_B
        self.dt = dt
        self.theta = theta
        self.theta1 = 1-0.5/theta
        self.theta2 = 0.5/theta
示例#2
0
文件: mc.py 项目: fangohr/fidimag
 def set_options(self, J=50.0, D=0, H=None, seed=100, T=10.0):
     """
     J and D in units of k_B
     H in units of Tesla.
     """
     clib.init_random(seed)
     self.J = J
     self.D = D
     self.T = T
     self.mu_s =  1.0
     if H is not None:
         self._H[:] = helper.init_vector(H, self.mesh)
         self._H[:] = self._H[:]*const.mu_s_1/const.k_B
示例#3
0
文件: sllg.py 项目: fangohr/fidimag
    def set_options(self,
                    dt=1e-15,
                    theta=1.0,
                    gamma=const.gamma,
                    k_B=const.k_B,
                    seed=100):

        clib.init_random(seed)
        self.gamma = gamma
        self.k_B = k_B
        self.dt = dt
        self.theta = theta
        self.theta1 = 1 - 0.5 / theta
        self.theta2 = 0.5 / theta
示例#4
0
文件: test_mc.py 项目: ww1g11/fidimag
def test_random_sphere(do_plot=False):
    clib.init_random(99999)
    spin = np.ones(3 * 10000, dtype=np.float)
    clib.random_spin_uniform_sphere(spin, 10000)
    spin.shape = (-1,3)
    x,y,z = my_average(spin)
    print(abs(x-y), abs(x-z), abs(y-z))
    assert(abs(x-y)<4e-3)
    assert(abs(x-z)<4e-3)
    assert(abs(y-z)<4e-3)

    if do_plot:
        fig = plt.figure()
        ax3D = fig.add_subplot(111, projection='3d')
        ax3D.scatter(spin[:1000,0], spin[:1000,1], spin[:1000,2], s=30, marker='.')
        plt.savefig('test_random_sphere.png')