QuantumWise Forum
May 22, 2013, 01:34 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Script to dope graphene ribbon on edges only by subtitution - from me to you!  (Read 1061 times)
0 Members and 1 Guest are viewing this topic.
esp
Supreme ATK Wizard
*****

Reputation: 3
Offline Offline

United States United States

Posts: 318



View Profile WWW
« on: February 3, 2012, 02:28 »

Code:
# -------------------------------------------------------------
# dope the edges of a GNR ribbbon with specified atom
# -------------------------------------------------------------
def dopeEdges(atomsToInpect, coords, atom, ymax_, ymin_):

# get atoms on top (+y) edge of this electrode
edgeAtoms = []
for ind in range(len(atomsToInpect)):
if (coords[ind])[1] == ymax_: # is it an edge atom?
# we can quickly sort here
newInd = 0
for ind2 in range(len(edgeAtoms)):
# check if this new z coord is > each one in list, stop when not true and insert
if (coords[ind])[2] > (coords[edgeAtoms[ind2]])[2]:
pass
else:
# insert here
newInd = ind2
break
# now insert
#print ymax_, "edge", coords[ind], "inserting at", newInd, str(edgeAtoms)
edgeAtoms.insert(newInd, ind) # save this index

carbonCnt = 0
for ind in range(len(edgeAtoms)):
if atomsToInpect[edgeAtoms[ind]] == Carbon: # we know it is though
carbonCnt += 1
if carbonCnt % dopingLvl == 0:
atomsToInpect[edgeAtoms[ind]] = atom

# get atoms on bottom (-y) edge of this electrode
edgeAtoms = []
for ind in range(len(atomsToInpect)):
if (coords[ind])[1] == ymin_: # is it an edge atom?
# we can quickly sort here
newInd = 0
for ind2 in range(len(edgeAtoms)):
# check if this new z coord is > each one in list, stop when not true and insert
if (coords[ind])[2] > (coords[edgeAtoms[ind2]])[2]:
pass
else:
# insert here
newInd = ind2
break
# now insert
#print ymax_, "edge", coords[ind], "inserting at", newInd, str(edgeAtoms)
edgeAtoms.insert(newInd, ind) # save this index

carbonCnt = 0
for ind in range(len(edgeAtoms)):
if atomsToInpect[edgeAtoms[ind]] == Carbon: # we know it is though
carbonCnt += 1
if carbonCnt % dopingLvl == 0:
atomsToInpect[edgeAtoms[ind]] = atom

return atomsToInpect


example usage: set variable dopingLvl to something like 3, meaning replace every 3 Carbons with whatever you specify in the function call .. first loop through to get max and min y for the Carbon atoms in the structure, then call as below

Code:

# find min and max y for Carbon atoms (edge atoms)
yminCarbon = 10000*Angstrom
ymaxCarbon = 0*Angstrom
for ind in range(len(central_region_coordinates)):
if central_region_elements[ind] == Carbon:
if (central_region_coordinates[ind])[1] < yminCarbon:
yminCarbon = (central_region_coordinates[ind])[1]
if (central_region_coordinates[ind])[1] > ymaxCarbon:
ymaxCarbon = (central_region_coordinates[ind])[1]

# NOW DOPE
left_electrode_elements = dopeEdges(left_electrode_elements, left_electrode_coordinates, Nitrogen, ymaxCarbon, yminCarbon)
right_electrode_elements = dopeEdges(right_electrode_elements, right_electrode_coordinates, Nitrogen, ymaxCarbon, yminCarbon)
central_region_elements = dopeEdges(central_region_elements, central_region_coordinates, Boron, ymaxCarbon, yminCarbon)




Oh yes then you also need this part:

Code:

# now make sure electrodes are matched inside bulk
print "len(left_electrode_elements)", len(left_electrode_elements)
print "len(right_electrode_elements)", len(right_electrode_elements)
for ind in range(len(left_electrode_elements)):
central_region_elements[ind] = left_electrode_elements[ind]
for ind in range(len(right_electrode_elements)):
central_region_elements[\
len(central_region_elements) - len(right_electrode_elements) + ind] = right_electrode_elements[ind]




 Grin
« Last Edit: February 4, 2012, 00:48 by esp » Logged

--------------------------
E.Pataky    [Shocked>-<
Nordland
QuantumWise Staff
Supreme ATK Wizard
*****

Reputation: 14
Offline Offline

Posts: 730



View Profile
« Reply #1 on: February 3, 2012, 09:53 »

Thanks! Smiley

I will try it.
Logged
esp
Supreme ATK Wizard
*****

Reputation: 3
Offline Offline

United States United States

Posts: 318



View Profile WWW
« Reply #2 on: February 3, 2012, 09:59 »

updated above ... forgot to mention variable dopingLvl ... explained under "example usage"
Logged

--------------------------
E.Pataky    [Shocked>-<
esp
Supreme ATK Wizard
*****

Reputation: 3
Offline Offline

United States United States

Posts: 318



View Profile WWW
« Reply #3 on: February 4, 2012, 00:51 »

complete example
Logged

--------------------------
E.Pataky    [Shocked>-<
esp
Supreme ATK Wizard
*****

Reputation: 3
Offline Offline

United States United States

Posts: 318



View Profile WWW
« Reply #4 on: February 4, 2012, 04:58 »

new script ... this one uses pure atk python to create a AGNR FET (of any width), passivate it, add gate and dielectric and dope the edges of any combination of left, right or center, it if you want .... see the function call at bottom.  

Smiley


updated file to allow different doping on each electrode attached below
« Last Edit: February 8, 2012, 09:29 by esp » Logged

--------------------------
E.Pataky    [Shocked>-<
esp
Supreme ATK Wizard
*****

Reputation: 3
Offline Offline

United States United States

Posts: 318



View Profile WWW
« Reply #5 on: February 4, 2012, 05:20 »

ok so i think this script is good, except that i think previously it came up that my gate was sticking out of "the box" ... i tried to get some clarification on this but did not get a response .... i think it has to do with needing to modify the unit cell .. ?  please run this script (with or without doping on), and tell me if the resulting device is valid for simulation ... if not, how can i modify the "box" include the gate structure?  and please explain this mysterious item if you can
Logged

--------------------------
E.Pataky    [Shocked>-<
Nordland
QuantumWise Staff
Supreme ATK Wizard
*****

Reputation: 14
Offline Offline

Posts: 730



View Profile
« Reply #6 on: February 4, 2012, 13:36 »

It looks good, but there is a single problem and a suggestion for improvement.

  • As you write yourself, the gates are unlucky, since they are sticking of the central region area, meaning in your case, that the metallic region is not a part of the calculation. So either you have make the cell larger to contain these (more expensive in terms of calculation time) or make the regions more narrow. Since you have a reference for a paper I think it is because you want the exact same gate, so therefore I have opted with the increasing the cell size. If you add the keyword vacuum=12.0*Ang to all your nanosheet, and now the gates are perfect within the central region area.
  • When it comes to getting the errors if there is a error in the script, there is a much simpler and better way Smiley, just write: traceback.print_exc() and it gives your all the information about the exception in a nicely formatted print
« Last Edit: February 4, 2012, 13:41 by Nordland » Logged
esp
Supreme ATK Wizard
*****

Reputation: 3
Offline Offline

United States United States

Posts: 318



View Profile WWW
« Reply #7 on: February 4, 2012, 21:38 »

ok great thank you
Logged

--------------------------
E.Pataky    [Shocked>-<
esp
Supreme ATK Wizard
*****

Reputation: 3
Offline Offline

United States United States

Posts: 318



View Profile WWW
« Reply #8 on: February 8, 2012, 09:29 »

update this works better and devices converge too
Logged

--------------------------
E.Pataky    [Shocked>-<
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!