コード例 #1
0
 def test_nonexisting_chain_to_clipboard(self):
     ''' Must do nothing if we want to add non existing state to clipboard'''
     chain.Image_to_Clipboard(self.p_state, -1, 10)
     # copy 10th chain
     chain.Image_to_Clipboard(self.p_state, 10, 10)
     # copy 10th image 10th chain
     chain.Image_to_Clipboard(self.p_state, -1, -10)
コード例 #2
0
 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")
コード例 #3
0
ファイル: main.py プロジェクト: disselkamp/spirit
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)
コード例 #4
0
sys.path.insert(0, spirit_py_dir)

from spirit import state
from spirit import chain
from spirit import system

import unittest

##########
''' In order to avoid overhead and numerous log files in stderr in case of a 
failing test we load a p_state once and we use constructor and destructor
of each test (setUp/tearDown) to clean that p_state'''

cfgfile = spirit_py_dir + "/../test/input/api.cfg"  # Input File
p_state = state.setup(cfgfile)  # State setup
chain.Image_to_Clipboard(p_state)  # Copy p_state to Clipboard


class TestChain(unittest.TestCase):
    def setUp(self):
        ''' Setup a p_state and copy it to Clipboard'''
        self.p_state = p_state

    def tearDown(self):
        ''' clean the p_state '''
        noi = chain.Get_NOI(self.p_state)
        for i in range(noi - 1):
            chain.Pop_Back(self.p_state)
        self.assertEqual(chain.Get_NOI(self.p_state), 1)