当前位置: 首页>>代码示例>>Python>>正文


Python Sim.set_m方法代码示例

本文整理汇总了Python中fidimag.atomistic.Sim.set_m方法的典型用法代码示例。如果您正苦于以下问题:Python Sim.set_m方法的具体用法?Python Sim.set_m怎么用?Python Sim.set_m使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fidimag.atomistic.Sim的用法示例。


在下文中一共展示了Sim.set_m方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: excite_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def excite_system(T=0.1, H=0.15):

    mesh = CuboidMesh(nx=28 * 3, ny=16 * 5, nz=1, pbc='2d')

    sim = Sim(mesh, name='dyn', driver='sllg')
    sim.set_options(dt=1e-14, gamma=const.gamma, k_B=const.k_B)
    sim.alpha = 0.1
    sim.mu_s = const.mu_s_1

    sim.set_m(random_m)

    J = 50 * const.k_B
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.5 * J
    dmi = DMI(D)
    sim.add(dmi)

    Hz = H * J / const.mu_s_1
    zeeman = Zeeman([0, 0, Hz])
    sim.add(zeeman)

    sim.T = J / const.k_B * T

    ts = np.linspace(0, 5e-11, 51)
    for t in ts:
        sim.run_until(t)
        # sim.save_vtk()

    np.save('m.npy', sim.spin)
    plot_m(mesh, 'm.npy', comp='z')
开发者ID:River315,项目名称:fidimag,代码行数:34,代码来源:phase.py

示例2: test_dynamic

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def test_dynamic():

    mesh = CuboidMesh(nx=1, ny=1, nz=1)

    sim = Sim(mesh, name='dyn_spin', driver='llg_stt_cpp')
    # sim.set_options(rtol=1e-10,atol=1e-14)
    sim.driver.gamma = 1.0
    sim.mu_s = 1.0

    sim.set_m((0.8,0,-1))

    Kx = Anisotropy(Ku=-0.05, axis=(0, 0, 1), name='Kz')
    sim.add(Kx)

    sim.p = (0,0,1)

    sim.a_J = 0.0052
    sim.alpha = 0.1

    ts = np.linspace(0, 1200, 401)
    for t in ts:
        sim.driver.run_until(t)


    mz = sim.spin[2]
    alpha, K, u = 0.1, 0.05, 0.0052
    print(mz, u/(2*alpha*K))

    #########################################################
    # The system used in this test can be solved analytically, which gives that mz = u/(2*alpha*K),
    # where K represents the easy-plane anisotropy.
    ###
    assert abs(mz - u/(2*alpha*K))/mz< 5e-4
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:35,代码来源:test_stt_slonczewski.py

示例3: relax_system_stage2

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def relax_system_stage2():

    mesh = CuboidMesh(nx=140 , ny=140, nz=1)

    sim = Sim(mesh, name='dyn', driver='llg')
    sim.alpha = 0.1
    sim.do_precession = True
    sim.gamma = const.gamma
    sim.mu_s = spatial_mu

    sim.set_m(np.load('skx.npy'))

    J = 50 * const.k_B
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.27 * J
    dmi = DMI(D)
    sim.add(dmi)

    zeeman = Zeeman(spatial_H)
    sim.add(zeeman)

    ts = np.linspace(0, 2e-9, 201)
    for t in ts:
        sim.run_until(t)
        sim.save_vtk()
        sim.save_m()
        print(t)
开发者ID:fangohr,项目名称:fidimag,代码行数:31,代码来源:disk.py

示例4: relax_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def relax_system(mesh):

    sim=Sim(mesh,name='relax')
    sim.set_options(rtol=1e-12,atol=1e-14)
    sim.do_precession = False
    sim.alpha = 0.5
    sim.gamma = 1.0
    sim.mu_s = 1.0

    sim.set_m(init_m)

    J = 1.0
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.18
    dmi = DMI(D)
    sim.add(dmi)

    zeeman = Zeeman([0,0e-3,2e-2],name='H')
    sim.add(zeeman)

    sim.relax(dt=2.0, stopping_dmdt=1e-8, max_steps=10000, save_m_steps=None, save_vtk_steps=100)

    np.save('m0.npy',sim.spin)
开发者ID:fangohr,项目名称:fidimag,代码行数:27,代码来源:skx.py

示例5: test_exch_3d

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def test_exch_3d():
    """
    Test the exchange field of the spins in this 3D mesh:

    bottom layer:
    8  9  10  11
    4  5  6   7       x 2
    0  1  2   3

    The assertions are the mx component
    of the: 0, 1, 2, .. 7 spins

    Remember the new new ordering: fx1, fy1, fz1, fx2, ...

    """
    mesh = CuboidMesh(nx=4, ny=3, nz=2)
    sim = Sim(mesh)
    exch = UniformExchange(1)
    sim.add(exch)

    sim.set_m(init_m, normalise=False)

    field = exch.compute_field()
    # print field
    assert field[0] == 1
    assert field[3] == 0 + 1 + 2 + 1
    assert field[6] == 1 + 2 + 3 + 2
    assert field[9] == 2 + 3 + 3

    assert field[4 * 3] == 1
    assert field[5 * 3] == 5
    assert field[6 * 3] == 10
    assert field[7 * 3] == 11
开发者ID:River315,项目名称:fidimag,代码行数:35,代码来源:test_exch.py

示例6: excite_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def excite_system(mesh, Hy=0):

    sim = Sim(mesh, name="dyn")

    sim.set_options(rtol=1e-10, atol=1e-12)
    sim.alpha = 0.04
    sim.gamma = 1.0
    sim.mu_s = 1.0

    sim.set_m(np.load("m0.npy"))

    J = 1.0
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.18
    dmi = DMI(D)
    sim.add(dmi)

    zeeman = Zeeman([0, Hy, 2e-2], name="H")
    sim.add(zeeman)

    hx = TimeZeeman([0, 0, 1e-5], sinc_fun, name="h")
    sim.add(hx, save_field=True)

    dt = 5
    steps = 2001
    for i in range(steps):

        sim.run_until(i * dt)
开发者ID:ww1g11,项目名称:fidimag,代码行数:32,代码来源:dyn.py

示例7: excite_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def excite_system(mesh):

    sim = Sim(mesh, name='dyn', driver='sllg')
    sim.set_options(dt=1e-14, gamma=const.gamma, k_B=const.k_B)
    sim.driver.alpha = 0.1
    sim.mu_s = const.mu_s_1
    sim.T = temperature_gradient

    sim.set_m(np.load("m0.npy"))

    J = 50.0 * const.k_B
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.5 * J
    dmi = DMI(D)
    sim.add(dmi)

    Hz = 0.2 * J / const.mu_s_1
    zeeman = Zeeman([0, 0, Hz])
    sim.add(zeeman)

    dt = 2e-14 * 50  # 1e-12
    ts = np.linspace(0, 1000 * dt, 501)
    for t in ts:
        sim.run_until(t)
        sim.save_vtk()
        sim.save_m()
        print 'sim t=%g' % t
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:31,代码来源:single.py

示例8: relax_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def relax_system(mesh, Dx=0.005, Dp=0.01):

    mat = UnitMaterial()

    sim = Sim(mesh, name='test_energy')
    print('Created sim')
    sim.driver.set_tols(rtol=1e-10, atol=1e-12)

    sim.alpha = mat.alpha
    sim.driver.gamma = mat.gamma
    sim.pins = pin_fun

    exch = UniformExchange(mat.J)
    sim.add(exch)
    print('Added UniformExchange')

    anis = Anisotropy(Dx, axis=[1, 0, 0], name='Dx')
    sim.add(anis)
    print('Added Anisotropy')

    anis2 = Anisotropy([0, 0, -Dp], name='Dp')
    sim.add(anis2)
    print('Added Anisotropy 2')

    sim.set_m((1, 1, 1))

    T = 100
    ts = np.linspace(0, T, 201)
    for t in ts:
        # sim.save_vtk()
        sim.driver.run_until(t)
        print(('Running -', t))

    # sim.save_vtk()
    np.save('m0.npy', sim.spin)
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:37,代码来源:test_energy.py

示例9: excite_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def excite_system(mesh):

    sim = Sim(mesh, name='dyn')

    # sim.set_options(rtol=1e-10,atol=1e-14)
    sim.driver.alpha = 0.04
    sim.driver.gamma = 1.0
    sim.mu_s = 1.0

    sim.set_m(np.load('m0.npy'))

    J = 1.0
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.09
    dmi = DMI(D)
    sim.add(dmi)

    zeeman = Zeeman([0, 0, 3.75e-3], name='H')
    sim.add(zeeman)

    w0 = 0.02

    def time_fun(t):
        return np.exp(-w0 * t)

    hx = TimeZeeman([0, 0, 1e-5], sinc_fun, name='h')
    sim.add(hx, save_field=True)

    ts = np.linspace(0, 20000, 5001)
    for t in ts:
        sim.run_until(t)
        print 'sim t=%g' % t
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:36,代码来源:figure2.py

示例10: relax_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def relax_system(mesh):

    sim = Sim(mesh, name='relax')
    # sim.set_options(rtol=1e-10,atol=1e-14)
    sim.alpha = 1.0
    sim.gamma = 1.0
    sim.mu_s = 1.0

    sim.set_m(init_m)
    # sim.set_m(random_m)
    # sim.set_m(np.load('m_10000.npy'))

    J = 1.0
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.09
    dmi = DMI(D)
    sim.add(dmi)

    zeeman = Zeeman([0, 0, 3.75e-3])
    sim.add(zeeman)

    sim.relax(dt=2.0, stopping_dmdt=1e-6, max_steps=1000,
              save_m_steps=100, save_vtk_steps=50)

    np.save('m0.npy', sim.spin)
开发者ID:River315,项目名称:fidimag,代码行数:29,代码来源:figure1.py

示例11: relax_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def relax_system(mesh):

    # Only relaxation
    sim = Sim(mesh, name='relax')

    # Simulation parameters
    sim.driver.set_tols(rtol=1e-8, atol=1e-10)
    sim.alpha = 0.5
    sim.driver.gamma = 2.211e5 / mu0
    sim.mu_s = 1e-27 / mu0
    sim.driver.do_precession = False

    # The initial state passed as a function
    sim.set_m(init_m)
    # sim.set_m(np.load('m0.npy'))

    # Energies
    exch = UniformExchange(J=2e-20)
    sim.add(exch)

    anis = Anisotropy(0.01*2e-20, axis=(0, 0, 1))
    sim.add(anis)

    # dmi = DMI(D=8e-4)
    # sim.add(dmi)

    # Start relaxation and save the state in m0.npy
    sim.relax(dt=1e-14, stopping_dmdt=1e4, max_steps=5000,
              save_m_steps=None, save_vtk_steps=None)

    np.save('m0.npy', sim.spin)
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:33,代码来源:test_stt_dw_atomistic.py

示例12: relax_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def relax_system(mesh, Hy=0):

    sim = Sim(mesh, name="relax")
    sim.set_options(rtol=1e-10, atol=1e-12)
    sim.alpha = 0.5
    sim.gamma = 1.0
    sim.mu_s = 1.0

    sim.do_precession = False

    sim.set_m(init_m)
    # sim.set_m(random_m)
    # sim.set_m(np.load('m_10000.npy'))

    J = 1.0
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.18
    dmi = DMI(D)
    sim.add(dmi)

    zeeman = Zeeman([0, Hy, 2e-2], name="H")
    sim.add(zeeman)

    sim.relax(dt=2.0, stopping_dmdt=1e-8, max_steps=10000, save_m_steps=100, save_vtk_steps=50)

    np.save("m0.npy", sim.spin)
开发者ID:ww1g11,项目名称:fidimag,代码行数:30,代码来源:dyn.py

示例13: dynamic

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def dynamic(mesh):

    sim = Sim(mesh, name='dyn', driver='slonczewski')
    # sim.set_options(rtol=1e-10,atol=1e-14)
    sim.gamma = 1.0
    sim.mu_s = 1.0

    sim.set_m(np.load('m0.npy'))

    J = 1.0
    exch = UniformExchange(J)
    sim.add(exch)

    Kx = Anisotropy(Ku=0.005, axis=(1, 0, 0), name='Kx')
    sim.add(Kx)

    sim.p = (0,0,1)

    sim.u0 = 0.03
    sim.alpha = 0.1

    ts = np.linspace(0, 1e3, 101)
    for t in ts:
        sim.run_until(t)
        sim.save_vtk()
        print t
开发者ID:River315,项目名称:fidimag,代码行数:28,代码来源:stt.py

示例14: test_skx_num

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def test_skx_num():

    mesh = CuboidMesh(nx=120, ny=120, nz=1, periodicity=(True, True, False))

    sim = Sim(mesh, name='skx_num')
    sim.set_tols(rtol=1e-6, atol=1e-6)
    sim.alpha = 1.0
    sim.gamma = 1.0
    sim.mu_s = 1.0

    sim.set_m(init_m)

    sim.do_procession = False

    J = 1.0
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.09
    dmi = DMI(D)
    sim.add(dmi)

    zeeman = Zeeman([0, 0, 5e-3])
    sim.add(zeeman)

    sim.relax(dt=2.0, stopping_dmdt=1e-2, max_steps=1000,
              save_m_steps=None, save_vtk_steps=None)

    skn = sim.skyrmion_number()
    print 'skx_number', skn
    assert skn > -1 and skn < -0.99
开发者ID:River315,项目名称:fidimag,代码行数:33,代码来源:test_sky_number.py

示例15: relax_system

# 需要导入模块: from fidimag.atomistic import Sim [as 别名]
# 或者: from fidimag.atomistic.Sim import set_m [as 别名]
def relax_system(mesh):

    sim = Sim(mesh, name='relax')
    sim.set_default_options(gamma=const.gamma)
    sim.driver.alpha = 0.5
    sim.mu_s = const.mu_s_1

    sim.set_m(init_m)

    J = 50.0 * const.k_B
    exch = UniformExchange(J)
    sim.add(exch)

    D = 0.5 * J
    dmi = DMI(D)
    sim.add(dmi)

    Hz = 0.2 * J / const.mu_s_1
    zeeman = Zeeman([0, 0, Hz])
    sim.add(zeeman)

    ONE_DEGREE_PER_NS = 17453292.52

    sim.relax(dt=1e-13, stopping_dmdt=0.01 * ONE_DEGREE_PER_NS,
              max_steps=1000, save_m_steps=100, save_vtk_steps=50)

    np.save('m0.npy', sim.spin)
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:29,代码来源:single.py


注:本文中的fidimag.atomistic.Sim.set_m方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。