def test_get_spin_directions(self): configuration.PlusZ(self.p_state) nos = system.Get_NOS(self.p_state) arr = system.Get_Spin_Directions(self.p_state) for i in range(nos): self.assertAlmostEqual(arr[i][0], 0.) self.assertAlmostEqual(arr[i][1], 0.) self.assertAlmostEqual(arr[i][2], 1.)
def configurations(p_state): ### Copy the system a few times chain.Image_to_Clipboard(p_state) for number in range(1, 7): chain.Insert_Image_After(p_state) noi = chain.Get_NOI(p_state) ### Read Image from file # Configuration_from_File(state.get(), spinsfile, 0); ### Read Chain from file # Chain_from_File(state.get(), chainfile); ### First image is homogeneous with a Skyrmion at pos configuration.PlusZ(p_state, idx_image=0) configuration.Skyrmion(p_state, 5.0, phase=-90.0, idx_image=0) ### Last image is homogeneous configuration.PlusZ(p_state, idx_image=noi - 1) # spinsfile = "input/spins.txt" # io.Image_Read(p_state, spinsfile) ### Create transition of images between first and last transition.Homogeneous(p_state, 0, noi - 1)
def test(self): with state.State(cfgfile) as p_state: # Noise configuration.Random(p_state) configuration.Add_Noise_Temperature(p_state, 5) # Homogeneous configuration.PlusZ(p_state) configuration.MinusZ(p_state) configuration.Domain(p_state, [1,1,1]) # Skyrmion configuration.Skyrmion(p_state, 5) # Hopfion configuration.Hopfion(p_state, 5) # Spin Spiral configuration.SpinSpiral(p_state, "Real Lattice", [0,0,0.1], [0,0,1], 30)
def test_chain_write(self): # add two more images chain.Image_to_Clipboard(self.p_state) chain.Insert_Image_After(self.p_state) chain.Insert_Image_After(self.p_state) # set different configuration in each image chain.Jump_To_Image(self.p_state, 0) configuration.MinusZ(self.p_state) chain.Jump_To_Image(self.p_state, 1) configuration.Random(self.p_state) chain.Jump_To_Image(self.p_state, 2) configuration.PlusZ(self.p_state, ) # write and append chain io.Chain_Write(self.p_state, io_chain_test, 6, "python io chain") # this must be overwritten io.Chain_Write(self.p_state, io_chain_test, 6, "python io chain") io.Chain_Append(self.p_state, io_chain_test, 6, "python io chain")
def test_read(self): nos = system.Get_NOS(self.p_state) configuration.PlusZ(self.p_state) io.Image_Write(self.p_state, io_image_test, 6, "python io test") io.Image_Read(self.p_state, io_image_test) spins = system.Get_Spin_Directions(self.p_state) for i in range(nos): self.assertAlmostEqual(spins[i][0], 0.) self.assertAlmostEqual(spins[i][1], 0.) self.assertAlmostEqual(spins[i][2], 1.) configuration.MinusZ(self.p_state) io.Image_Write(self.p_state, io_image_test, 6, "python io test") io.Image_Read(self.p_state, io_image_test) spins = system.Get_Spin_Directions(self.p_state) for i in range(nos): self.assertAlmostEqual(spins[i][0], 0.) self.assertAlmostEqual(spins[i][1], 0.) self.assertAlmostEqual(spins[i][2], -1.)
energy_samples = [] magnetization_samples = [] susceptibility_samples = [] specific_heat_samples = [] binder_cumulant_samples = [] cfgfile = "ui-python/input.cfg" # Input File with state.State(cfgfile, quiet=True) as p_state: # State setup # Set parameters parameters.mc.setOutputGeneral(p_state, False) # Disallow any output geometry.setNCells(p_state, [system_size, system_size, system_size]) NOS = system.Get_NOS(p_state) # Ferromagnet in z-direction configuration.PlusZ(p_state) # configuration.Random(p_state) # Loop over temperatures for iT, T in enumerate(sample_temperatures): parameters.mc.setTemperature(p_state, T) # Cumulative average variables E = 0 E2 = 0 M = 0 M2 = 0 M4 = 0 # Thermalisation parameters.mc.setIterations(
def test_playpause(self): configuration.PlusZ(self.p_state) configuration.Skyrmion(p_state, 5) simulation.PlayPause(self.p_state, "LLG", "SIB")
def test_singleshot(self): configuration.PlusZ(self.p_state) simulation.SingleShot(self.p_state, "LLG", "SIB", n_iterations=1)
def test_write(self): configuration.PlusZ(self.p_state) io.Image_Write(self.p_state, io_image_test)
def test_magnetization(self): configuration.PlusZ(self.p_state) M = quantities.Get_Magnetization(self.p_state) self.assertAlmostEqual(M[0], 0) self.assertAlmostEqual(M[1], 0) self.assertAlmostEqual(M[2], 1)