示例#1
0
            O_lst.append(dist)
        elif name == 'N':
            N_lst.append(dist)
        else:
            C_lst.append(dist)
H_rot = []
O_rot = []
N_rot = []
C_rot = []
#rotation is not about the center of the molecule but about the origin, need to translate it after the rotation
#the molecule will be incorrectly rotated if it is not reported in terms of coordinates relative to its. This may be found
alt = 90 * np.pi / 180
azi = 90 * np.pi / 180
disp = np.array([5, 5, 5])

H_lst = orient(H_lst, alt, azi) + disp
O_lst = orient(O_lst, alt, azi) + disp
N_lst = orient(N_lst, alt, azi) + disp
C_lst = orient(C_lst, alt, azi) + disp

lsave(H_lst, 'H1')
lsave(O_lst, 'O1')
lsave(N_lst, 'N1')
lsave(C_lst, 'C1')

sublats = ['H1', 'O1', 'N1', 'C1']

scvecs = [[10, 0, 0], [0, 10, 0], [0, 0, 10]]

genPOSCAR(sublats, scvecs, sys_name='molecule', POS_name='mculPOSCAR.vasp')
示例#2
0
    nb = 2
    ncl = int(np.floor(nc / 2))
    ncu = int(np.ceil(nc / 2))

    if nc % 2 == 0:  #even
        lstzn1 = rep(zn1, lvecs, na, nb, ncu)
        lstzn2 = rep(zn2, lvecs, na, nb, ncl - 1)
        lsto1 = rep(o1 + lvecs[2], lvecs, na, nb, ncl - 1)
        lsto2 = rep(o2, lvecs, na, nb, ncl)
    else:  # odd
        lstzn1 = rep(zn1, lvecs, na, nb, ncl)
        lstzn2 = rep(zn2, lvecs, na, nb, ncl)
        lsto1 = rep(o1 + lvecs[2], lvecs, na, nb, ncl)
        lsto2 = rep(o2, lvecs, na, nb, ncl)

    lsave(lstzn1, 'Zn1')
    lsave(lstzn2, 'Zn2')
    lsave(lsto1, 'O1')
    lsave(lsto2, 'O2')

    sublats = ['Zn1', 'Zn2', 'O1', 'O2']

    a = np.array([lvecs[0], np.zeros(3), np.zeros(3)])
    b = np.array([np.zeros(3), lvecs[1], np.zeros(3)])
    c = np.array([np.zeros(3), np.zeros(3), lvecs[2]])
    scvecs = na * a + nb * b + nc * c
    genPOSCAR(sublats,
              scvecs,
              sys_name='Zinc Oxide',
              POS_name=str(nc) + 'pPOSCAR.vasp')
示例#3
0
            if dist < R:
                comb.append([na,nb,nc])
                ncyl+=1

for i in comb:
    dist=np.dot(np.array(i),lvecs) + np.array([2*R,2*R,0])
    lstmg1.append(mg1+dist)
    lstmg2.append(mg2+dist)
    lstmg3.append(mg3+dist)
    lstmg4.append(mg4+dist)
    lsto1.append(o1+dist)
    lsto2.append(o2+dist)
    lsto3.append(o3+dist)
    lsto4.append(o4+dist)

lsave(lstmg1,'Mg1')  #array method possible?
lsave(lstmg2,'Mg2')
lsave(lstmg3,'Mg3') 
lsave(lstmg4,'Mg4')
lsave(lsto1,'O1')
lsave(lsto2,'O2')
lsave(lsto3,'O3')
lsave(lsto4,'O4')

sublats=['Mg1','Mg2','Mg3','Mg4','O1','O2','O3','O4']

scvecs=[[4*R,0,0],[0,4*R,0],[0,0,(2*crange+4)*np.linalg.norm(c)]]

genPOSCAR(sublats,scvecs,sys_name='Magnesium Oxide Rod System',POS_name='MgORodPOSCAR.vasp')
rel=np.pi*crange*np.linalg.norm(c)/R
metr=100*(ncyl/nrect-rel)/rel
    nc = 6
    ncl = int(np.floor(nc / 2))
    ncu = int(np.ceil(nc / 2))
    shift = nc / 4. * lvecs[2]
    if nc % 2 == 0:  #even
        lstzn1 = rep(zn1 + shift, lvecs, na, nb, ncu)
        lstzn2 = rep(zn2 + shift, lvecs, na, nb, ncl - 1)
        lsto1 = rep(o1 + lvecs[2] + shift, lvecs, na, nb, ncl - 1)
        lsto2 = rep(o2 + shift, lvecs, na, nb, ncl)
    else:  # odd
        lstzn1 = rep(zn1 + shift, lvecs, na, nb, ncl)
        lstzn2 = rep(zn2 + shift, lvecs, na, nb, ncl)
        lsto1 = rep(o1 + lvecs[2] + shift, lvecs, na, nb, ncl)
        lsto2 = rep(o2 + shift, lvecs, na, nb, ncl)

    lsave(lstzn1, 'Zn1')
    lsave(lstzn2, 'Zn2')
    lsave(lsto1, 'O1')
    lsave(lsto2, 'O2')

    #note that Zn_Ot is O_Ot alternatingly
    Zn_Ot = o1 + (nc / 2 - 0.3) * lvecs[2] + shift
    O_Ot = zn2 + (nc / 2 - 1.1) * lvecs[2] + shift
    hole_Ot = lvecs[0] + lvecs[1] + (nc / 2 - 0.3) * lvecs[2] + shift
    bridge_Ot = lvecs[0] / 2 + lvecs[1] / 2 + (nc / 2 - 0.3) * lvecs[2] + shift

    Zn_Znt = zn2 - 0.3 * lvecs[2] + shift
    O_Znt = zn1 - 0.3 * lvecs[2] + shift
    hole_Znt = lvecs[0] + lvecs[1] + 0.3 * lvecs[2] + shift
    bridge_Znt = lvecs[0] / 2 + lvecs[1] / 2 + 0.3 * lvecs[2] + shift
示例#5
0
    nb=4
    ncl=int(np.floor(nc/2))
    ncu=int(np.ceil(nc/2))

    if nc % 2 == 0: #even
            lstzn1=rep(zn1,lvecs,na,nb,ncu)
            lstzn2=rep(zn2,lvecs,na,nb,ncl-1)
            lsto1=rep(o1+lvecs[2],lvecs,na,nb,ncl-1)
            lsto2=rep(o2,lvecs,na,nb,ncl)
    else: # odd
            lstzn1=rep(zn1,lvecs,na,nb,ncl)
            lstzn2=rep(zn2,lvecs,na,nb,ncl)
            lsto1=rep(o1+lvecs[2],lvecs,na,nb,ncl)
            lsto2=rep(o2,lvecs,na,nb,ncl)

    lsave(lstzn1,'Zn1')
    lsave(lstzn2,'Zn2')
    lsave(lsto1,'O1')
    lsave(lsto2,'O2')
    #bases of surface sites
    #have arbitrary positions above surfaces, that is, multiples of lvecs[2]
    #due to non-centro symmetry, capping will change on even and odd numbered layers. These names are given for even number of double layers, opposite for odd number of double layers
    Zn_Ot=o1+(nc/2-0.3)*lvecs[2]
    O_Ot=zn2+(nc/2-1.1)*lvecs[2]
    hole_Ot=lvecs[0]+lvecs[1]+(nc/2-0.3)*lvecs[2] 
    bridge_Ot=lvecs[0]/2+lvecs[1]/2+(nc/2-0.3)*lvecs[2] 

    Zn_Znt=zn2-0.3*lvecs[2] 
    O_Znt=zn1-0.3*lvecs[2] 
    hole_Znt=lvecs[0]+lvecs[1]+0.3*lvecs[2]
    bridge_Znt=lvecs[0]/2+lvecs[1]/2+0.3*lvecs[2]
lvecs = np.genfromtxt('../in/_lvecs')
bases = np.genfromtxt('../in/_bases')
zn1, zn2, o1, o2 = bases
nar = range(3, 20)

for na in nar:
    nb = 2
    nc = 2

    lstzn1 = rep(zn1, lvecs, na, nb, nc)
    lstzn2 = rep(zn2, lvecs, na, nb, nc)
    lsto1 = rep(o1 + lvecs[0], lvecs, na, nb, nc)
    lsto2 = rep(o2, lvecs, na, nb, nc)

    lsave(
        lstzn1, 'Zn1'
    )  #convention is to use numerical end characters with the proper species name prefix
    lsave(lstzn2, 'Zn2')
    lsave(lsto1, 'O1')
    lsave(lsto2, 'O2')

    O2 = o2 + (na - 1 / 3) * lvecs[0]
    Zn2 = zn2 + (na - 1 / 3) * lvecs[0]
    O1 = o1 + (na + 1 / 3) * lvecs[0]
    Zn1 = zn1 + (na - 1 / 3) * lvecs[0]
    hole = (o1 + zn1) / 2 + 1 / 2 * lvecs[1] + na * lvecs[0]
    bridge = o2 + (na - 1 / 2) * lvecs[0] + lvecs[2] / 5
    hole2 = zn2 + (lvecs[2] + lvecs[1]) / 4 + na * lvecs[
        0]  #off center, subtract c to get at same position as hole

    lsave(O2, 'S1')
示例#7
0
lvecs = np.genfromtxt('../in/_lvecs')
bases = np.genfromtxt('../in/_bases')
zn1, zn2, o1, o2 = bases
nar = range(3, 20)

for na in nar:
    nb = 2
    nc = 2

    lstzn1 = rep(zn1, lvecs, na, nb, nc)
    lstzn2 = rep(zn2, lvecs, na, nb, nc)
    lsto1 = rep(o1 + lvecs[0], lvecs, na, nb, nc)
    lsto2 = rep(o2, lvecs, na, nb, nc)

    lsave(
        lstzn1, 'Zn1'
    )  #convention is to use numerical end characters with the proper species name prefix
    lsave(lstzn2, 'Zn2')
    lsave(lsto1, 'O1')
    lsave(lsto2, 'O2')

    sublats = ['Zn1', 'Zn2', 'O1', 'O2']

    a = np.array([lvecs[0], np.zeros(3), np.zeros(3)])
    b = np.array([np.zeros(3), lvecs[1], np.zeros(3)])
    c = np.array([np.zeros(3), np.zeros(3), lvecs[2]])
    scvecs = na * a + nb * b + nc * c + 4 * a
    genPOSCAR(sublats,
              scvecs,
              sys_name='nonpolar zinc oxide',
              POS_name=str(na) + 'npPOSCAR.vasp')