def test_map_to_primitive(self):
     sc_atoms = read('data/supercell.vasp')
     patoms = gen_primitive(name="SrMnO3",
                            latticeconstant=7.6266083947907566 / 2,
                            mag_order='FM',
                            m=3)
     ilist, Rlist = map_to_primitive(sc_atoms, patoms)
     print(Rlist)
def test():
    from pyDFTutils.perovskite.cubic_perovskite import gen_primitive
    from pyDFTutils.ase_utils import symbol_number
    from ase.io import read
    patoms = gen_primitive(name="SrMnO3",
                           latticeconstant=7.6266083947907566 / 2,
                           mag_order='FM',
                           m=3)
    syms = list(symbol_number(patoms).keys())
    atoms = read('./supercell444/flip_Mn12_-3_-3/POSCAR')
    #ilist, Rlist = map_to_primitive(atoms, patoms)

    d = OijuFitter(atoms=patoms, sc_atoms=atoms, scell=np.eye(3) * 4, nspin=1)
    d.fit(ijdict={
        (1, 2): (1, 1, (0, 0, 1)),
        (1, 3): (1, 1, (0, 1, 0)),
        (1, 5): (1, 1, (1, 0, 0))
    },
          fname_template=name_template)
    d.write_netcdf_scalarij(fname='Oiju_scalarij.nc')

    read_Oiju_netcdf(fname='Oiju_scalarij.nc')
Ejemplo n.º 3
0
def gen_distorted_perovskite(name,
                             cell=[3.9, 3.9, 3.9],
                             supercell_matrix=[[1, -1, 0], [1, 1, 0],
                                               [0, 0, 2]],
                             out_of_phase_rotation=0.0,
                             in_phase_rotation=0.0,
                             in_phase_tilting=0.0,
                             breathing=0.0,
                             JT_d=0.0,
                             JT_a=0.0):
    atoms = gen_primitive(name=name, mag_order='PM', latticeconstant=3.9)
    spos = atoms.get_scaled_positions()
    #atoms.set_cell([3.5,3.5,3.9,90,90,90])
    atoms.set_cell(cell)
    atoms.set_scaled_positions(spos)
    #from ase.io import write
    #write('cubic_LaMnO3.cif',atoms)
    dcell = distorted_cell(atoms, supercell_matrix=supercell_matrix)
    eigvec = np.zeros(15)

    eig_breathing = np.array(perovskite_mode.R2p)

    eig_JT_d = np.array(perovskite_mode.M2)

    eig_in_phase_tilting = np.array(perovskite_mode.X5_3)

    eig_out_of_phase_rotation_x = np.array(perovskite_mode.R25_1)
    eig_out_of_phase_rotation_y = np.array(perovskite_mode.R25_2)

    eig_in_phase_rotation_z = np.array(perovskite_mode.M3)

    disp_br = dcell._get_displacements(eigvec=eig_breathing,
                                       q=[0.5, 0.5, 0.5],
                                       amplitude=breathing,
                                       argument=0)
    #disp2=dcell._get_displacements(eigvec=out_of_phase_rotation,q=[0.5,0.5,0.5],amplitude=0.55,argument=0)
    disp_jt = dcell._get_displacements(eigvec=eig_JT_d,
                                       q=[0.5, 0.5, 0.0],
                                       amplitude=JT_d,
                                       argument=0)

    disp_tilting = dcell._get_displacements(eigvec=eig_in_phase_tilting,
                                            q=[0.0, 0.0, 0.5],
                                            amplitude=in_phase_tilting,
                                            argument=0)

    disp_rotx = dcell._get_displacements(eigvec=eig_out_of_phase_rotation_x,
                                         q=[0.5, 0.5, 0.5],
                                         amplitude=out_of_phase_rotation,
                                         argument=0)
    disp_roty = dcell._get_displacements(eigvec=eig_out_of_phase_rotation_y,
                                         q=[0.5, 0.5, 0.5],
                                         amplitude=out_of_phase_rotation,
                                         argument=0)
    disp_rotz = dcell._get_displacements(eigvec=eig_in_phase_rotation_z,
                                         q=[0.5, 0.5, 0.0],
                                         amplitude=in_phase_rotation,
                                         argument=0)

    #print(out_of_phase_rotation)
    #print(disp_rotx)
    #print(disp_jt)

    #print disp.shape
    newcell = dcell._get_cell_with_modulation(disp_jt + disp_rotx + disp_roty +
                                              disp_rotz + disp_br +
                                              disp_tilting)
    newcell = Atoms(newcell)
    print(spglib.get_spacegroup(newcell))
    #vesta_view(newcell)
    return newcell
Ejemplo n.º 4
0
def gen_P21c_perovskite(
    name,
    cell=[3.9, 3.9, 3.9],
    supercell_matrix=[[1, -1, 0], [1, 1, 0], [0, 0, 2]],
    modes=dict(
        R2_m_O1=0.0,  # R2-[O1:c:dsp]A2u(a), O, breathing
        R3_m_O1=
        0.0,  # R3-[O1:c:dsp]A2u(a), O JT inplane-stagger, out-of-plane antiphase
        R3_m_O2=
        0.0,  # R3-[O1:c:dsp]A2u(b), O, out-of-plane-stagger, inplane antiphase, Unusual.
        R4_m_A1=0.0,  # R4-[Nd1:a:dsp]T1u(a), A , Unusual
        R4_m_A2=0.0,  # R4-[Nd1:a:dsp]T1u(b), A, Unusual
        R4_m_A3=0.0,  # R4-[Nd1:a:dsp]T1u(c), A, Unusual
        R4_m_O1=0.0,  # R4-[O1:c:dsp]Eu(a), O, Unusual
        R4_m_O2=0.0,  # R4-[O1:c:dsp]Eu(b), O, Unusual
        R4_m_O3=0.0,  # R4-[O1:c:dsp]Eu(c), O, Unusual
        R5_m_O1=0.0,  # R5-[O1:c:dsp]Eu(a), O  a-
        R5_m_O2=0.0,  # R5-[O1:c:dsp]Eu(b), O  b-
        R5_m_O3=0.0,  # R5-[O1:c:dsp]Eu(c), O  c-
        X3_m_A1=0.0,  # X3-[Nd1:a:dsp]T1u(a), What's this..
        X3_m_O1=0.0,  # X3-[O1:c:dsp]A2u(a)

        #X5_m_A1=0.0,  # [Nd1:a:dsp]T1u(a), A , Antiferro mode
        #X5_m_A2=0.0,  # [Nd1:a:dsp]T1u(b), A , save as above
        #X5_m_O1=0.0,  # [Nd1:a:dsp]T1u(a), O , Antiferro mode
        #X5_m_O2=0.0,  # [Nd1:a:dsp]T1u(b), O , same as above
        #M2_p_O1=0.0,  # M2+[O1:c:dsp]Eu(a), O, In phase rotation c+
        Z5_m_A1=0.0,  # [Nd1:a:dsp]T1u(a), A , Antiferro mode
        Z5_m_A2=0.0,  # [Nd1:a:dsp]T1u(b), A , save as above
        Z5_m_O1=0.0,  # [Nd1:a:dsp]T1u(a), O , Antiferro mode
        Z5_m_O2=0.0,  # [Nd1:a:dsp]T1u(b), O , same as above
        M2_p_O1=0.0,  # M2+[O1:c:dsp]Eu(a), O, In phase rotation
        M3_p_O1=0.0,  # M3+[O1:c:dsp]A2u(a), O, D-type JT inplane stagger
        M5_p_O1=0.0,  # M5+[O1:c:dsp]Eu(a), O, Out of phase tilting
        M5_p_O2=0.0,  # M5+[O1:c:dsp]Eu(a), O, Out of phase tilting
        M4_p_O1=0.0,  # M4+[O1:c:dsp]A2u(a), O, in-plane-breathing (not in P21/c)
        G_Ax=0.0,
        G_Ay=0.0,
        G_Az=0.0,
        G_Sx=0.0,
        G_Sy=0.0,
        G_Sz=0.0,
        G_Axex=0.0,
        G_Axey=0.0,
        G_Axez=0.0,
        G_Lx=0.0,
        G_Ly=0.0,
        G_Lz=0.0,
        G_G4x=0.0,
        G_G4y=0.0,
        G_G4z=0.0,
    )):
    atoms = gen_primitive(name=name, mag_order='PM', latticeconstant=cell[0])
    spos = atoms.get_scaled_positions()
    atoms.set_cell(cell)
    atoms.set_scaled_positions(spos)
    dcell = distorted_cell(atoms, supercell_matrix=supercell_matrix)
    eigvec = np.zeros(15)

    mode_dict = {
        'R2_m_O1': perovskite_mode.R2p,
        'R3_m_O1': perovskite_mode.
        R12p_1,  # R3-[O1:c:dsp]A2u(a), O JT inplane-stagger, out-of-plane antiphase
        'R3_m_O2': perovskite_mode.
        R12p_2,  # R3-[O1:c:dsp]A2u(b), O, out-of-plane-stagger, inplane antiphase
        'R4_m_A1': perovskite_mode.R15_1,  # R4-[Nd1:a:dsp]T1u(a), A
        'R4_m_A2': perovskite_mode.R15_2,  # R4-[Nd1:a:dsp]T1u(b), A
        'R4_m_A3': perovskite_mode.R15_3,  # R4-[Nd1:a:dsp]T1u(c), A
        'R4_m_O1': perovskite_mode.R15_4,  # R4-[O1:c:dsp]Eu(a), O
        'R4_m_O2': perovskite_mode.R15_5,  # R4-[O1:c:dsp]Eu(b), O
        'R4_m_O3': perovskite_mode.R15_6,  # R4-[O1:c:dsp]Eu(c), O
        'R5_m_O1': perovskite_mode.
        R25_1,  # R5-[O1:c:dsp]Eu(a), O, out-of-phase rotation a-
        'R5_m_O2': perovskite_mode.R25_2,  # R5-[O1:c:dsp]Eu(b), O, b-
        'R5_m_O3': perovskite_mode.
        R25_3,  # R5-[O1:c:dsp]Eu(c), O, c-. For Pnma. Do not use.

        #'X3_m_A1':perovskite_mode., # X3-[Nd1:a:dsp]T1u(a), What's this..
        #'X3_m_O1':perovskite_mode., # X3-[O1:c:dsp]A2u(a)
        'Z5_m_A1':
        perovskite_mode.Z5p_1,  # [Nd1:a:dsp]T1u(a), A , Antiferro mode
        'Z5_m_A2':
        perovskite_mode.Z5p_2,  # [Nd1:a:dsp]T1u(b), A , save as above
        'Z5_m_O1':
        perovskite_mode.Z5p_3,  # [Nd1:a:dsp]T1u(b), O , same as above
        'Z5_m_O2':
        perovskite_mode.Z5p_4,  # [Nd1:a:dsp]T1u(b), O , same as above
        'M2_p_O1':
        perovskite_mode.M3,  # M2+[O1:c:dsp]Eu(a), O, In phase rotation
        'M3_p_O1': perovskite_mode.
        M2,  # M3+[O1:c:dsp]A2u(a), O, D-type JT inplane stagger
        'M5_p_O1':
        perovskite_mode.M5_1,  # M5+[O1:c:dsp]Eu(a), O, Out of phase tilting
        'M5_p_O2': perovskite_mode.
        M5_2,  # M5+[O1:c:dsp]Eu(b), O, Out of phase tilting, -above
        'M4_p_O1': perovskite_mode.
        M4,  # M4+[O1:c:dsp]A2u(a), O, in-plane-breathing (not in P21/c)
    }

    # add Gamma modes to mode_dict
    Gamma_mode_dict = Gamma_modes(atoms.get_chemical_symbols())
    mode_dict.update(Gamma_mode_dict)

    mode_disps = {}
    qdict = {
        'G': [0, 0, 0],
        #'X':[0,0.0,0.5],
        'M': [0.5, 0.5, 0],
        'R': [0.5, 0.5, 0.5],
        'Z': [0.0, 0.0, 0.5]
    }
    disps = 0.0  #np.zeros(3,dtype='complex128')
    for name, amp in modes.items():
        eigvec = np.array(mode_dict[name])
        disp = dcell._get_displacements(eigvec=eigvec,
                                        q=qdict[name[0]],
                                        amplitude=amp,
                                        argument=0)
        disps += disp

    newcell = dcell._get_cell_with_modulation(disps)
    newcell = Atoms(newcell)
    print(spglib.get_spacegroup(newcell))
    #vesta_view(newcell)
    return newcell
Ejemplo n.º 5
0
def gen_RNiO3(a=3.709, c=3.709, rot_R=1.0, rot_M=1.0, jt=0.0, br=0.00):
    atoms = gen_primitive(name='YNiO3', mag_order='PM', latticeconstant=3.7094)
    spos = atoms.get_scaled_positions()
    atoms.set_cell([a, a, c, 90, 90, 90])
    atoms.set_scaled_positions(spos)

    from ase.io import write
    dcell = distorted_cell(atoms, supercell_matrix=np.eye(3) * 2)
    dcell = distorted_cell(atoms,
                           supercell_matrix=[[1, -1, 0], [1, 1, 0], [0, 0, 2]])
    eigvec = np.zeros(15)
    eigvec[6] = 1
    eigvec[10] = 1

    breathing = np.array(perovskite_mode.R2p)
    JT_d = np.array(perovskite_mode.M2)

    in_phase_tilting_A1 = np.array(perovskite_mode.X5p_1)
    in_phase_tilting_A2 = np.array(perovskite_mode.X5p_2)
    in_phase_tilting_O1 = np.array(perovskite_mode.X5p_3)
    in_phase_tilting_O2 = np.array(perovskite_mode.X5p_4)

    in_phase_rotation = np.array(perovskite_mode.M3)
    out_of_phase_rotation_x = np.array(perovskite_mode.R25_1)
    out_of_phase_rotation_y = np.array(perovskite_mode.R25_2)

    # R2- breathing 0.1
    disp_br = dcell._get_displacements(eigvec=breathing,
                                       q=[0.5, 0.5, 0.5],
                                       amplitude=br,
                                       argument=0)
    #disp2=dcell._get_displacements(eigvec=out_of_phase_rotation,q=[0.5,0.5,0.5],amplitude=0.55,argument=0)

    # M3+ JT 0.1
    disp_jt = dcell._get_displacements(eigvec=JT_d,
                                       q=[0.5, 0.5, 0.0],
                                       amplitude=jt,
                                       argument=0)
    #disp4=dcell._get_displacements(eigvec=in_phase_tilting,q=[0.0,0.5,0.0],amplitude=0.5,argument=0)

    # R5- rotation out 1.07
    disp_rotx = dcell._get_displacements(eigvec=out_of_phase_rotation_x,
                                         q=[0.5, 0.5, 0.5],
                                         amplitude=1.07 * rot_R,
                                         argument=0)
    disp_roty = dcell._get_displacements(eigvec=out_of_phase_rotation_y,
                                         q=[0.5, 0.5, 0.5],
                                         amplitude=-1.07 * rot_R,
                                         argument=0)

    # M2+
    disp_rot_zin = dcell._get_displacements(eigvec=in_phase_rotation,
                                            q=[0.5, 0.5, 0.0],
                                            amplitude=0.525 * 2 * rot_M,
                                            argument=0)

    #X5-
    disp_tilting_A1 = dcell._get_displacements(eigvec=in_phase_tilting_A1,
                                               q=[0.0, 0.0, 0.5],
                                               amplitude=-0.485 * 2,
                                               argument=0)
    #print disp_tilting_A1
    disp_tilting_A2 = dcell._get_displacements(eigvec=in_phase_tilting_A2,
                                               q=[0.0, 0.0, 0.5],
                                               amplitude=0.485 * 2,
                                               argument=0)
    #print disp_tilting_A2

    disp_tilting_O1 = dcell._get_displacements(eigvec=in_phase_tilting_O1,
                                               q=[0.0, 0.5, 0.0],
                                               amplitude=-0.168 * 2,
                                               argument=0)
    disp_tilting_O2 = dcell._get_displacements(eigvec=in_phase_tilting_O2,
                                               q=[0.0, 0.5, 0.0],
                                               amplitude=0.168 * 2,
                                               argument=0)
    #print disp.shape
    newcell = dcell._get_cell_with_modulation(
        disp_rotx + disp_roty + disp_rot_zin + disp_br + disp_jt
    )  # +disp_tilting_A1)#+disp_tilting_A2)#+disp_tilting_O1+disp_tilting_O2)
    print(spglib.get_spacegroup(newcell))
    #vesta_view(newcell)
    return newcell