def square_2d_hamiltonian(Jx=-5e-21, Jy=-5e-21, dmi=5e-21, k1=np.array([-000 * mu_B]), k1dir=np.array([[0.0, 0, 1.0]])): atoms = Atoms( symbols="H", positions=[[0, 0, 0]], cell=[[1, 0, 0], [0, 1, 0], [0, 0, 1]]) spin = np.array([[0, 1, 0]]) ham = SpinHamiltonian( cell=atoms.cell, pos=atoms.get_scaled_positions(), spinat=spin, zion=atoms.get_atomic_numbers()) ham.gilbert_damping = [1.0] J = { (0, 0, (1, 0, 0)): Jx, (0, 0, (-1, 0, 0)): Jx, (0, 0, (0, 1, 0)): Jy, (0, 0, (0, -1, 0)): Jy, } ham.set_exchange_ijR(exchange_Jdict=J) DMI = { (0, 0, (1, 0, 0)): [0, -dmi, 0], (0, 0, (-1, 0, 0)): [0,dmi, 0], (0, 0, (0, 1, 0)): [dmi,0, 0 ], (0, 0, (0, -1, 0)): [-dmi, 0, 0], } ham.set_dmi_ijR(dmi_ddict=DMI) ham.set_uniaxial_mca(k1, k1dir) return ham
def __init__(self, fname=None, sc_matrix=None, ham=None): self.params = SpinParams() if ham is not None: self._ham=ham elif fname is not None: self.read_from_file(fname) else: self._ham = SpinHamiltonian() if sc_matrix is not None: self.make_supercell(sc_matrix) self.mover = SpinMover(self._ham)
def traingular_2d_hamiltonian(J1=-0e-21, k1=np.array([-000 * mu_B]), k1dir=np.array([[0.0, 0, 1.0]])): """ Isolated spin in an applied field. field:10T, time step: 1fs. Total time: 100 ps, No Langevin term. """ # make model atoms = Atoms( symbols="H", positions=[[0, 0, 0]], cell=[[1, 0, 0], [-1.0 / 2, np.sqrt(3) / 2, 0], [0, 0, 1]]) spin = np.array([[0, 1, 0]]) ham = SpinHamiltonian( cell=atoms.cell, pos=atoms.get_scaled_positions(), spinat=spin, zion=atoms.get_atomic_numbers()) ham.gilbert_damping = [1.0] J = { (0, 0, (1, 0, 0)): J1, (0, 0, (0, 1, 0)): J1, (0, 0, (1, 1, 0)): J1, (0, 0, (-1, 0, 0)): J1, (0, 0, (0, -1, 0)): J1, (0, 0, (-1, -1, 0)): J1, } ham.set_exchange_ijR(exchange_Jdict=J) ham.set_uniaxial_mca(k1, k1dir) return ham
def exchange_1d_hamiltonian(J1=3e-21, J2=0e-21, DMI=[0, 0, 0e-21], k1=np.array([-0 * mu_B]), k1dir=np.array([[0.0, 0.0, 1.0]]), plot_type='2d'): # make model atoms = Atoms(symbols="H", positions=[[0, 0, 0]], cell=[1, 1, 1]) spin = np.array([[0, 1, 0]]) ham = SpinHamiltonian( cell=atoms.cell, pos=atoms.get_scaled_positions(), spinat=spin, zion=atoms.get_atomic_numbers()) ham.gilbert_damping = [0.8] #ham.gyro_ratio=[1.0] J = { (0, 0, (1, 0, 0)): J1, (0, 0, (-1, 0, 0)): J1, (0, 0, (2, 0, 0)): J2, (0, 0, (-2, 0, 0)): J2, } ham.set_exchange_ijR(exchange_Jdict=J) k1 = k1 k1dir = k1dir ham.set_uniaxial_mca(k1, k1dir) DMIval = np.array(DMI) DMI = { #(0, 0, (0, 0, 1)): DMIval, #(0, 0, (0, 0, -1)): -DMIval, #(0, 0, (0, 1, 0)): DMIval, #(0, 0, (0, -1, 0)): -DMIval, (0, 0, (-1, 0, 0)): -DMIval, (0, 0, (1, 0, 0)): DMIval, } ham.set_dmi_ijR(dmi_ddict=DMI) return ham
def cubic_3d_hamiltonian(Jx=-0e-21, Jy=-0e-21, Jz=0e-21, DMI=[0, 0, 0e-21], k1=np.array([-0 * mu_B]), k1dir=np.array([[0.0, 0, 1.0]])): atoms = Atoms( symbols="H", positions=[[0, 0, 0]], cell=[[1, 0, 0], [0, 1, 0], [0, 0, 1]]) spin = np.array([[0, 1, 0]]) ham = SpinHamiltonian( cell=atoms.cell, pos=atoms.get_scaled_positions(), spinat=spin, zion=atoms.get_atomic_numbers()) ham.gilbert_damping = [1.0] J = { (0, 0, (1, 0, 0)): Jx, (0, 0, (-1, 0, 0)): Jx, (0, 0, (0, 1, 0)): Jy, (0, 0, (0, -1, 0)): Jy, (0, 0, (0, 0, 1)): Jz, (0, 0, (0, 0, -1)): Jz, } ham.set_exchange_ijR(exchange_Jdict=J) ham.set_uniaxial_mca(k1, k1dir) DMIval = np.array(DMI) DMI = { (0, 0, (0, 0, 1)): DMIval, (0, 0, (0, 0, -1)): -DMIval, #(0, 0, (0, 1, 0)): DMIval, #(0, 0, (0, -1, 0)): -DMIval, #(0, 0, (-1, 0, 0)): -DMIval, #(0, 0, (1, 0, 0)): DMIval, } ham.set_dmi_ijR(dmi_ddict=DMI) return ham
class SpinModel(): def __init__(self, fname=None, sc_matrix=None, ham=None): self.params = SpinParams() if ham is not None: self._ham=ham elif fname is not None: self.read_from_file(fname) else: self._ham = SpinHamiltonian() if sc_matrix is not None: self.make_supercell(sc_matrix) self.mover = SpinMover(self._ham) @property def ham(self): return self._ham def add_term(self, term, name=None): self._ham.add_Hamiltonian_term(term, name=name) @ham.setter def ham(self, ham): self._ham = ham @property def S(self): return self.mover.s @property def nspin(self): return self._ham.nspin def read_from_file(self, fname): self._ham = read_spin_ham_from_file(fname) def set(self, **kwargs): self.params.set(**kwargs) self.mover.set( time_step=self.params.time_step, temperature=self.params.temperature, total_time=self.params.total_time, ) def make_supercell(self, sc_matrix=None, supercell_maker=None): self._ham = self._ham.make_supercell( sc_matrix=sc_matrix, supercell_maker=supercell_maker) self.mover = SpinMover(self._ham) return self def run_one_step(self): self.mover.run_one_step() def run_time(self): self.mover.run() def plot_magnon_band( self, kvectors=np.array([[0, 0, 0], [0.5, 0, 0], [0.5, 0.5, 0], [0, 0, 0], [.5, .5, .5]]), knames=['$\Gamma$', 'X', 'M', '$\Gamma$', 'R'], supercell_matrix=None, npoints=100, color='red', ax=None, kpath_fname=None, ): self._ham.plot_magnon_band( kvectors=kvectors, knames=knames, supercell_matrix=supercell_matrix, npoints=npoints, color=color, ax=ax, kpath_fname=kpath_fname)