def ori_structure(self): lead1=self.lead1=graphene(dict(latx=1,laty=self.laty,latz=1)).lmp_structure() n=len(lead1) center=graphene(dict(latx=self.latx,laty=self.laty,latz=1)).lmp_structure() center.translate(lead1.cell[0]) lead2=lead1.copy() lead2.translate(lead1.cell[0]+center.cell[0]) atoms=Atoms() atoms.extend(lead1) atoms.extend(center) atoms.extend(lead2) atoms.cell=center.cell atoms.cell[0]=lead1.cell[0]+center.cell[0]+lead2.cell[0] lx=self.extent(atoms)[0] self.getScale(lx/2) self.center_box(atoms) self.writeatoms(atoms,'graphene') low=atoms.positions[:,0].min()+2 hi=atoms.positions[:,0].max()-2 self.leftgroup=np.arange(len(atoms),dtype='int')[:n]+1 self.rightgroup=np.arange(len(atoms),dtype='int')[-n:]+1 self.fmag=self.strain/float(len(self.leftgroup)) self.posleft=atoms.positions[self.leftgroup[0]-1].copy()+(50,50,50) self.posright=atoms.positions[self.rightgroup[0]-1].copy()+(50,50,50) self.posleft[0]*=10 self.posright[0]*=10 for atom in atoms: atom.position=self.trans(atom.position) atoms.center(vacuum=50) return atoms
def lmp_structure(self): ribbon=graphene(dict(latx=self.gnrx,laty=self.gnry,latz=1,gnrtype=self.gnrtype)).lmp_structure() gnt=GNT(dict(latx=self.latx,laty=self.laty,latz=1,type=self.gnttype)) atoms=gnt.lmp_structure() self.center_box(atoms) self.center_box(ribbon) ribbon.rotate('z',self.angle) r=gnt.radius+self.bond for atom in ribbon: atom.position=gnt.trans(atom.position,r=r) max=atoms.positions[:,0].max() min=atoms.positions[:,0].min() del ribbon[ribbon.positions[:,0]>max] del ribbon[ribbon.positions[:,0]<min] ribbon.translate([0,0,-r]) atoms.extend(ribbon) atoms.center(vacuum=10) return atoms
def ori_structure(self): atoms = graphene(dict(latx=self.latx, laty=self.laty, latz=self.latz)).lmp_structure() self.center_box(atoms) for atom in atoms: atom.position = self.trans(atom.position) pair = atoms.copy() if self.tripair: pair.rotate('y', pi) pair.translate([0, 0, -4]) gnt = GNT(dict(latx=4, laty=10, xp=0)).lmp_structure() self.center_box(gnt) gnt.translate([0, 0, -2]) atoms.extend(gnt) atoms.extend(pair) self.swap(atoms, 1) atoms.rotate('x', pi / 2) else: pair.rotate('z', pi / 2) pair.rotate('y', pi) pair.translate([0, 0, 10]) atoms.extend(pair) self.swap(atoms, 1) dx = 7 xlo = atoms.positions[:, 0].min() + dx xhi = atoms.positions[:, 0].max() - dx ylo = atoms.positions[:, 1].min() + dx yhi = atoms.positions[:, 1].max() - dx zlo = atoms.positions[:, 2].min() + dx zhi = atoms.positions[:, 2].max() - dx right0 = atoms.positions[:, 2] > zhi right1 = atoms.positions[:, 2] < zlo if self.tripair: right0 = atoms.positions[:, 1] > yhi right1 = atoms.positions[:, 1] < ylo self.x1z1 = np.arange(len(atoms), dtype='int')[np.logical_and( atoms.positions[:, 0] > xhi, right0)] + 1 self.x1z0 = np.arange(len(atoms), dtype='int')[np.logical_and( atoms.positions[:, 0] > xhi, right1)] + 1 self.x0y1 = np.arange(len(atoms), dtype='int')[np.logical_and( atoms.positions[:, 0] < xlo, atoms.positions[:, 1] > yhi)] + 1 self.x0y0 = np.arange(len(atoms), dtype='int')[np.logical_and( atoms.positions[:, 0] < xlo, atoms.positions[:, 1] < ylo)] + 1 self.fmag = self.strain / float(len(self.x1z1)) g = self.angle / 2.0 d = self.angle1 / 2.0 r0 = [cos(g), 0.0, sin(g)] r1 = [cos(g), 0.0, -sin(g)] if self.tripair: r0 = [cos(g), sin(g), 0.0] r1 = [cos(g), -sin(g), 0.0] self.posx1z1 = np.array((50, 50, 50)) + 500 * np.array(r0) self.posx1z0 = np.array((50, 50, 50)) + 500 * np.array(r1) self.posx0y1 = np.array( (50, 50, 50)) + 500 * np.array([-cos(d), sin(d), 0.0]) self.posx0y0 = np.array( (50, 50, 50)) + 500 * np.array([-cos(d), -sin(d), 0.0]) atoms.center(vacuum=50) return atoms
def lmp_structure(self): ribbon=graphene(dict(latx=self.latx,laty=self.laty,latz=1,gnrtype=self.gnrtype)).lmp_structure() for atom in ribbon: atom.position=self.trans(atom.position) atoms=Atoms() atoms.extend(ribbon) atoms.center(vacuum=10) return atoms
def lmp_structure(self): ribbon=graphene(dict(latx=self.latx,laty=self.laty,latz=1,gnrtype=self.gnrtype)).lmp_structure() self.writeatoms(ribbon,'ribbon') self.length=ribbon.cell[0,0] self.center_box(ribbon) for atom in ribbon: atom.position=self.trans(atom.position) atoms=ribbon atoms.center(vacuum=10,axis=[1,2]) atoms.center(axis=[0]) return atoms
def ori_structure(self): atoms=graphene(dict(latx=self.latx,laty=self.laty,latz=self.latz)).lmp_structure() self.center_box(atoms) for atom in atoms: atom.position=self.trans(atom.position) pair=atoms.copy() if self.tripair: pair.rotate('y',pi) pair.translate([0,0,-4]) gnt=GNT(dict(latx=4,laty=10,xp=0)).lmp_structure() self.center_box(gnt) gnt.translate([0,0,-2]) atoms.extend(gnt) atoms.extend(pair) self.swap(atoms,1) atoms.rotate('x',pi/2) else: pair.rotate('z',pi/2) pair.rotate('y',pi) pair.translate([0,0,10]) atoms.extend(pair) self.swap(atoms,1) dx=7 xlo=atoms.positions[:,0].min()+dx xhi=atoms.positions[:,0].max()-dx ylo=atoms.positions[:,1].min()+dx yhi=atoms.positions[:,1].max()-dx zlo=atoms.positions[:,2].min()+dx zhi=atoms.positions[:,2].max()-dx right0=atoms.positions[:,2]>zhi right1=atoms.positions[:,2]<zlo if self.tripair: right0=atoms.positions[:,1]>yhi right1=atoms.positions[:,1]<ylo self.x1z1=np.arange(len(atoms),dtype='int')[np.logical_and(atoms.positions[:,0]>xhi , right0)]+1 self.x1z0=np.arange(len(atoms),dtype='int')[np.logical_and(atoms.positions[:,0]>xhi , right1)]+1 self.x0y1=np.arange(len(atoms),dtype='int')[np.logical_and(atoms.positions[:,0]<xlo , atoms.positions[:,1]>yhi)]+1 self.x0y0=np.arange(len(atoms),dtype='int')[np.logical_and(atoms.positions[:,0]<xlo , atoms.positions[:,1]<ylo)]+1 self.fmag=self.strain/float(len(self.x1z1)) g=self.angle/2.0 d=self.angle1/2.0 r0=[cos(g),0.0,sin(g)] r1=[cos(g),0.0,-sin(g)] if self.tripair: r0=[cos(g),sin(g),0.0] r1=[cos(g),-sin(g),0.0] self.posx1z1=np.array((50,50,50))+500*np.array(r0) self.posx1z0=np.array((50,50,50))+500*np.array(r1) self.posx0y1=np.array((50,50,50))+500*np.array([-cos(d),sin(d),0.0]) self.posx0y0=np.array((50,50,50))+500*np.array([-cos(d),-sin(d),0.0]) atoms.center(vacuum=50) return atoms
def lmp_structure(self): ribbon = graphene( dict(latx=self.latx, laty=self.laty, latz=1, gnrtype=self.gnrtype)).lmp_structure() self.writeatoms(ribbon, 'ribbon') self.length = ribbon.cell[0, 0] self.center_box(ribbon) for atom in ribbon: atom.position = self.trans(atom.position) atoms = ribbon atoms.center(vacuum=10, axis=[1, 2]) atoms.center(axis=[0]) return atoms
def lmp_structure(self): atoms = Atoms() unit = graphene( dict( latx=2, laty=1, latz=1, gnrtype='zigzag')).lmp_structure() # del unit[unit.positions[:,0].argsort()[-2:]] ly = unit.cell[1][1] lidx = unit.positions[:, 0].argsort()[0] left_of_unit = unit[lidx].position # the center must be assign because the atoms are centered unit.rotate('y', 30.0 / 180 * np.pi, center=left_of_unit) ridx = unit.positions[:, 0].argsort()[-1] right_of_unit = unit[ridx].position unit1 = unit.copy() unit1.rotate('y', 120.0 / 180 * np.pi, center=right_of_unit) ridx1 = unit1.positions[:, 0].argsort()[-1] right_of_unit1 = unit1[ridx1].position # cell[0,0] lx = right_of_unit1[0] - left_of_unit[0] unit2 = unit.copy() # translate unit2 but don't traslate along y deta = right_of_unit1 - right_of_unit + [0, 0, 1.42 * np.sqrt(3) / 2] deta[1] = 0 unit2.translate(deta) lidx2 = unit2.positions[:, 0].argsort()[0] left_of_unit2 = unit2.positions[lidx2] unit3 = unit2.copy() unit3.rotate('y', 120.0 / 180 * np.pi, center=left_of_unit2) lz = left_of_unit2[2] - right_of_unit[2] + 1.42 * np.sqrt(3) / 2 atoms.extend(unit) atoms.extend(unit1) atoms.extend(unit2) atoms.extend(unit3) atoms.set_cell([lx, ly, lz]) # important for distance calculation,default all False atoms.set_pbc([True] * 3) atoms.center() atoms = atomic.get_unique_atoms(atoms) # prevent xs~=1.0 atoms.translate([0.01, 0, 0]) atomic.wrap(atoms) return atoms
def lmp_structure(self): atoms = graphene( dict(latx=self.latx, laty=self.laty, latz=self.latz, gnrtype=self.type)).lmp_structure() atomic.center_box(atoms) self.radius = atoms.cell[1][1] / self.phi for atom in atoms: atom.position = self.trans(atom.position, r=self.radius) atoms.center(vacuum=10, axis=[1, 2]) atoms.center(axis=[0]) return atoms
def lmp_structure(self): atoms = graphene( dict( latx=self.latx, laty=self.laty, latz=self.latz, gnrtype=self.type)).lmp_structure() atomic.center_box(atoms) self.radius = atoms.cell[1][1] / self.phi for atom in atoms: atom.position = self.trans(atom.position, r=self.radius) atoms.center(vacuum=10, axis=[1, 2]) atoms.center(axis=[0]) return atoms
def ori_structure(self): lead1 = self.lead1 = graphene(dict(latx=1, laty=self.laty, latz=1)).lmp_structure() n = len(lead1) center = graphene(dict(latx=self.latx, laty=self.laty, latz=1)).lmp_structure() center.translate(lead1.cell[0]) lead2 = lead1.copy() lead2.translate(lead1.cell[0] + center.cell[0]) atoms = Atoms() atoms.extend(lead1) atoms.extend(center) atoms.extend(lead2) atoms.cell = center.cell atoms.cell[0] = lead1.cell[0] + center.cell[0] + lead2.cell[0] lx = self.extent(atoms)[0] self.getScale(lx / 2) self.center_box(atoms) self.writeatoms(atoms, 'graphene') low = atoms.positions[:, 0].min() + 2 hi = atoms.positions[:, 0].max() - 2 self.leftgroup = np.arange(len(atoms), dtype='int')[:n] + 1 self.rightgroup = np.arange(len(atoms), dtype='int')[-n:] + 1 self.fmag = self.strain / float(len(self.leftgroup)) self.posleft = atoms.positions[self.leftgroup[0] - 1].copy() + (50, 50, 50) self.posright = atoms.positions[self.rightgroup[0] - 1].copy() + (50, 50, 50) self.posleft[0] *= 10 self.posright[0] *= 10 for atom in atoms: atom.position = self.trans(atom.position) atoms.center(vacuum=50) return atoms
def lmp_structure(self): atoms = Atoms() unit = graphene(dict(latx=2, laty=1, latz=1, gnrtype='zigzag')).lmp_structure() # del unit[unit.positions[:,0].argsort()[-2:]] ly = unit.cell[1][1] lidx = unit.positions[:, 0].argsort()[0] left_of_unit = unit[lidx].position # the center must be assign because the atoms are centered unit.rotate('y', 30.0 / 180 * np.pi, center=left_of_unit) ridx = unit.positions[:, 0].argsort()[-1] right_of_unit = unit[ridx].position unit1 = unit.copy() unit1.rotate('y', 120.0 / 180 * np.pi, center=right_of_unit) ridx1 = unit1.positions[:, 0].argsort()[-1] right_of_unit1 = unit1[ridx1].position # cell[0,0] lx = right_of_unit1[0] - left_of_unit[0] unit2 = unit.copy() # translate unit2 but don't traslate along y deta = right_of_unit1 - right_of_unit + [0, 0, 1.42 * np.sqrt(3) / 2] deta[1] = 0 unit2.translate(deta) lidx2 = unit2.positions[:, 0].argsort()[0] left_of_unit2 = unit2.positions[lidx2] unit3 = unit2.copy() unit3.rotate('y', 120.0 / 180 * np.pi, center=left_of_unit2) lz = left_of_unit2[2] - right_of_unit[2] + 1.42 * np.sqrt(3) / 2 atoms.extend(unit) atoms.extend(unit1) atoms.extend(unit2) atoms.extend(unit3) atoms.set_cell([lx, ly, lz]) # important for distance calculation,default all False atoms.set_pbc([True] * 3) atoms.center() atoms = atomic.get_unique_atoms(atoms) # prevent xs~=1.0 atoms.translate([0.01, 0, 0]) atomic.wrap(atoms) return atoms
def lmp_structure(self): ribbon=graphene(dict(latx=self.gnrx,laty=self.gnry,latz=1,gnrtype=self.gnrtype)).lmp_structure() length=ribbon.cell[0][0] gnt=GNT(dict(latx=self.gntx,laty=self.gnty,latz=1,type=self.gnttype)) atoms=gnt.lmp_structure() self.center_box(atoms) self.center_box(ribbon) atoms.rotate('z',pi/2) left=atoms.copy() r=gnt.radius+self.bond d=(length-2*pi*r)/2 left.translate([-d/2,0,0]) atoms.translate([d/2,0,0]) for atom in ribbon: atom.position=self.trans(atom.position,r=r,d=d) atoms.extend(ribbon) atoms.extend(left) atoms.center(vacuum=10) return atoms
def lmp_structure(self): ribbon=graphene(dict(latx=20,laty=3,latz=1,gnrtype='zigzag')).lmp_structure() self.length=ribbon.cell[0,0] self.center_box(ribbon) self.w=.2 self.getW(self.length/2) newlx=2*self.phase(self.length/2,self.w) for atom in ribbon: atom.position=self.trans(atom.position) atoms=ribbon #atoms.center(vacuum=10,axis=[1,2]) #atoms.cell[0,0]=newlx #atoms.center(axis=[0]) newatoms=Atoms() for i in range(4): atoms.rotate('z',i*pi/2,center=[0,-newlx/4,0]) newatoms.extend(atoms.copy()) newatoms.cell[0,0]=newatoms.cell[1,1]=newlx newatoms.center() atoms=newatoms#.repeat([self.latx,self.laty,1]) return atoms
def lmp_structure(self): ribbon = graphene(dict(latx=20, laty=3, latz=1, gnrtype='zigzag')).lmp_structure() self.length = ribbon.cell[0, 0] self.center_box(ribbon) self.w = .2 self.getW(self.length / 2) newlx = 2 * self.phase(self.length / 2, self.w) for atom in ribbon: atom.position = self.trans(atom.position) atoms = ribbon #atoms.center(vacuum=10,axis=[1,2]) #atoms.cell[0,0]=newlx #atoms.center(axis=[0]) newatoms = Atoms() for i in range(4): atoms.rotate('z', i * pi / 2, center=[0, -newlx / 4, 0]) newatoms.extend(atoms.copy()) newatoms.cell[0, 0] = newatoms.cell[1, 1] = newlx newatoms.center() atoms = newatoms #.repeat([self.latx,self.laty,1]) return atoms
def lmp_structure(self): ribbon = graphene( dict(latx=self.gnrx, laty=self.gnry, latz=1, gnrtype=self.gnrtype)).lmp_structure() length = ribbon.cell[0][0] gnt = GNT( dict(latx=self.gntx, laty=self.gnty, latz=1, type=self.gnttype)) atoms = gnt.lmp_structure() self.center_box(atoms) self.center_box(ribbon) atoms.rotate('z', pi / 2) left = atoms.copy() r = gnt.radius + self.bond d = (length - 2 * pi * r) / 2 left.translate([-d / 2, 0, 0]) atoms.translate([d / 2, 0, 0]) for atom in ribbon: atom.position = self.trans(atom.position, r=r, d=d) atoms.extend(ribbon) atoms.extend(left) atoms.center(vacuum=10) return atoms