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)
def relax_system(mesh): sim = Sim(mesh, name='relax') sim.set_default_options(gamma=const.gamma) sim.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)
def test_dw_dmi_atomistic(do_plot=False): mesh = CuboidMesh(nx=300, ny=1, nz=1) sim = Sim(mesh, name='relax') sim.set_default_options(gamma=const.gamma) sim.alpha = 0.5 sim.mu_s = const.mu_s_1 sim.do_precession = False sim.set_m(m_init_dw) J = 50.0 * const.k_B exch = UniformExchange(J) sim.add(exch) D = 0.01 * J dmi = DMI(D) sim.add(dmi) K = 0.005 * J anis = Anisotropy(K, axis=[1, 0, 0]) sim.add(anis) 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) xs = np.array([p[0] for p in mesh.coordinates]) - 150 mx, my, mz = analytical(xs, A=J / 2.0, D=-D, K=K) mxyz = sim.spin.copy() mxyz = mxyz.reshape(-1, 3).T assert max(abs(mxyz[0, :] - mx)) < 0.001 assert max(abs(mxyz[1, :] - my)) < 0.001 assert max(abs(mxyz[2, :] - mz)) < 0.0006 if do_plot: save_plot(xs, mxyz, mx, my, mz)
def test_dw_dmi_atomistic(do_plot=False): mesh = CuboidMesh(nx=300, ny=1, nz=1) sim = Sim(mesh, name='relax') sim.set_default_options(gamma=const.gamma) sim.alpha = 0.5 sim.mu_s = const.mu_s_1 sim.do_procession = False sim.set_m(m_init_dw) J = 50.0 * const.k_B exch = UniformExchange(J) sim.add(exch) D = 0.01 * J dmi = DMI(D) sim.add(dmi) K = 0.005 * J anis = Anisotropy(K, axis=[1,0,0]) sim.add(anis) 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) xs = np.array([p[0] for p in mesh.coordinates]) - 150 mx, my, mz = analytical(xs, A=J/2.0, D=-D, K=K) mxyz = sim.spin.copy() mxyz = mxyz.reshape(-1, 3).T assert max(abs(mxyz[0, :] - mx)) < 0.001 assert max(abs(mxyz[1, :] - my)) < 0.001 assert max(abs(mxyz[2, :] - mz)) < 0.0006 if do_plot: save_plot(xs, mxyz, mx, my, mz)
def relax_system(mesh): sim = Sim(mesh, name='relax') sim.set_default_options(gamma=const.gamma) sim.alpha = 0.5 sim.mu_s = const.mu_s_1 sim.do_procession = False sim.set_m(m_init_dw) J = 50.0 * const.k_B exch = UniformExchange(J) sim.add(exch) D = 0.1 * J dmi = DMI(D, dmi_type='interfacial') sim.add(dmi) K = 0.02 * J anis = Anisotropy(K, axis=[0, 0, 1]) sim.add(anis) 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) xs = np.array([p[0] for p in mesh.pos]) - 150 mx, my, mz = analytical(xs, A=J / 2.0, D=-D, K=K) mxyz = sim.spin.copy() mxyz.shape = (3, -1) save_plot(xs, mxyz, mx, my, mz)
def relax_system(mesh): sim = Sim(mesh, name='relax') sim.set_default_options(gamma=constant.gamma) sim.driver.alpha = 0.5 sim.mu_s = constant.mu_s_1 sim.do_precession = False sim.set_m(m_init_dw) J = 50.0 * constant.k_B exch = UniformExchange(J) sim.add(exch) D = 0.1 * J dmi = DMI(D, dmi_type = 'interfacial') sim.add(dmi) K = 0.02 * J anis = Anisotropy(K, axis=[0,0,1]) sim.add(anis) 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) xs = np.array([p[0] for p in mesh.pos]) - 150 mx, my, mz = analytical(xs, A=J/2.0, D=-D, K=K) mxyz = sim.spin.copy() mxyz.shape = (3, -1) save_plot(xs, mxyz, mx, my, mz)