Пример #1
0
def make_map_from_file(save_dir,
                       KDbulk_list,
                       KDsurf_list,
                       ref,
                       reverse=True,
                       precision=1e-7,
                       maxiter=None,
                       state_name='magnpzfile',
                       J=1.0,
                       D=np.tan(np.pi / 10),
                       boundary=['P', 'P', 'F']):
    initial = Path(ref)
    directory = Path(save_dir)

    if not os.path.exists(directory):
        os.makedirs(directory)

    Klist, Kaxis = mfm.file_manager(directory,
                                    params={
                                        'double':
                                        False,
                                        'add': [
                                            np.round(KDbulk_list,
                                                     decimals=5).tolist(),
                                            np.round(KDsurf_list,
                                                     decimals=5).tolist()
                                        ]
                                    },
                                    dimension=2)

    Klist = np.array(
        sorted(Klist.tolist(), key=lambda x: [-x[1], x[0]], reverse=reverse))

    for idx, Kv in enumerate(Klist, start=1):
        minimize_from_file(directory=directory,
                           load_file=initial,
                           save_file=state_name +
                           '_{:.5f}_{:.5f}.npz'.format(Kv[0], Kv[1]),
                           J=J,
                           D=D,
                           Kbulk=np.power(D, 2) * Kv[0],
                           Ksurf=np.power(D, 2) * Kv[1],
                           precision=precision,
                           maxiter=maxiter,
                           boundary=boundary)
Пример #2
0
J = 1.0
D = np.tan(np.pi / 10)

size = ini.shape[0:3]
print(size)
SZ = ini.shape[1]
Nz = ini.shape[2]
primitives = [(1., 0., 0.), (0., 1., 0.), (0., 0., 1.)]
representatives = [(0., 0., 0.)]
bc = [magnes.BC.PERIODIC, magnes.BC.PERIODIC, magnes.BC.FREE]

Klist, Kaxis = mfm.file_manager(directory,
                                params={
                                    'add': [
                                        np.round(np.linspace(-2, 0, 11),
                                                 decimals=6).tolist(),
                                        np.round(np.linspace(0, 60, 11),
                                                 decimals=6).tolist()
                                    ]
                                })

#'source':'/media/ivan/64E21891E2186A16/Users/vano2/Documents/LC_SK/new_spx/alt_bulk_from_rows/alt_20_bulk_19/1/best'}
#					   'double':False

for idx, Kv in enumerate(Klist, start=1):
    system, s, energy = minimize(ini=ini,
                                 J=J,
                                 D=D,
                                 Kbulk=np.power(D, 2) * Kv[0],
                                 Ksurf=np.power(D, 2) * Kv[1],
                                 precision=1e-5)
Пример #3
0
state_name='toron'
'''

if not os.path.exists(directory):
    os.makedirs(directory)

Np = 50
max_distance = 100

dlist = mfm.file_manager(directory,
                         params={
                             'double':
                             False,
                             'add': [
                                 np.round(np.linspace(-max_distance,
                                                      max_distance, Np),
                                          decimals=0).tolist(),
                                 np.round(np.linspace(-max_distance,
                                                      max_distance, Np),
                                          decimals=0).tolist()
                             ]
                         })

container = magnes.io.load(file)
ini = container["STATE"]
skyrmion_cut = 30
sample_size = 350
skyrmion = magnes.utils.state_reshape(
    ini, [skyrmion_cut, skyrmion_cut, ini.shape[2]], [
        0.5 * (skyrmion_cut - ini.shape[0]), 0.5 *
        (skyrmion_cut - ini.shape[1]), 0
Пример #4
0
def make_map_from_file_x_minimisation(save_dir,
                                      KDbulk_list,
                                      KDsurf_list,
                                      ref,
                                      period_N=1,
                                      max_steps_from_minimum=5,
                                      z_max_proj=np.infty,
                                      max_period=np.infty,
                                      reverse=True,
                                      precision=1e-7,
                                      state_name='matspx',
                                      D=np.tan(np.pi / 10),
                                      boundary=['P', 'P', 'F']):
    initial = Path(ref)
    directory = Path(save_dir)

    if not os.path.exists(directory):
        os.makedirs(directory)

    Klist, Kaxis = mfm.file_manager(directory,
                                    params={
                                        'double':
                                        False,
                                        'add': [
                                            np.round(KDbulk_list,
                                                     decimals=5).tolist(),
                                            np.round(KDsurf_list,
                                                     decimals=5).tolist()
                                        ]
                                    },
                                    dimension=2)

    Klist = np.array(
        sorted(Klist.tolist(), key=lambda x: [-x[1], x[0]], reverse=reverse))

    print(f'{Klist = }')

    for idx, Kv in enumerate(Klist, start=1):
        complete, _ = mfm.content(directory)
        print(f'{len(complete) = }')
        if len(complete) == 0:
            Kbulk_D = Kv[0]
            Ksurf_D = Kv[1]
            print(colored('initial', 'green'))
            print(
                colored(
                    'K_bulk = {}\tK_surf = {}\n\n'.format(Kbulk_D, Ksurf_D),
                    'blue'))
            container = magnes.io.load(str(initial))
            if 'STATE' in container:
                ini = container["STATE"]
            else:
                print(
                    f'minimize from 0 image of the path with {container["PATH"].shape = }'
                )
                ini = list(container["PATH"])[0]
            period = ini.shape[0] / period_N

            print(f'{period = }')
            set_xperiod_point(Kbulk_D=Kbulk_D,
                              Ksurf_D=Ksurf_D,
                              initials_set=[[period, ini]],
                              directory=directory,
                              state_name=state_name,
                              period_N=period_N,
                              max_steps_from_minimum=max_steps_from_minimum,
                              z_max_proj=z_max_proj,
                              max_period=max_period,
                              precision=precision,
                              D=D,
                              boundary=boundary)
        else:
            Kbulk_D = Kv[0]
            Ksurf_D = Kv[1]
            print(
                colored(
                    '\n\nK_bulk = {}\tK_surf = {}\n\n'.format(
                        Kbulk_D, Ksurf_D), 'blue'))

            initial = get_reference(Kv, complete,
                                    reverse)  #Kbulk_D,Ksurf_D,period
            initial = sorted(initial, key=lambda x: x[2])

            initial_set = []
            for i in initial:
                container = magnes.io.load(
                    str(
                        directory.joinpath(state_name +
                                           '_{:.5f}_{:.5f}_{:.5f}.npz'.format(
                                               i[0], i[1], i[2]))))
                if 'STATE' in container:
                    ini = container["STATE"]
                else:
                    ini = list(container["PATH"])[0]
                initial_set.append([i[2], ini])

            set_xperiod_point(Kbulk_D=Kbulk_D,
                              Ksurf_D=Ksurf_D,
                              initials_set=initial_set,
                              directory=directory,
                              state_name=state_name,
                              period_N=period_N,
                              max_steps_from_minimum=max_steps_from_minimum,
                              z_max_proj=z_max_proj,
                              max_period=max_period,
                              precision=precision,
                              D=D,
                              boundary=boundary)
Пример #5
0

J=1.0

size=ini.shape[0:3]
print(size)
SZ=ini.shape[1]
Nz=ini.shape[2]
primitives = [(1., 0., 0.), (0., 1., 0.), (0., 0., 1.)]
representatives = [(0., 0., 0.)]
bc=[magnes.BC.PERIODIC,magnes.BC.PERIODIC,magnes.BC.FREE]



Klist,Kaxis=mfm.file_manager(directory,
					   params={'double':False, 'add': [np.round(np.linspace(0., 0.25, 101), decimals=6).tolist(),
													   np.round(np.linspace(0, 15, 101), decimals=6).tolist()]})

#'source':'/media/ivan/64E21891E2186A16/Users/vano2/Documents/LC_SK/spx/xsp_map/best/'})

Kx0=0.5
Kz0=-1
epsilon=1.
K=6e-12
l=5e-6

for idx,Kv in enumerate(Klist,start=1):
	system = magnes.System(primitives, representatives, size, bc)
	origin = magnes.Vertex(cell=[0, 0, 0])
	D = np.tan(Kv[1]/Nz)
	system.add(magnes.Exchange(origin, magnes.Vertex([1, 0, 0]), J, [D, 0., 0.]))