Dear all, I wanted to share with you a script that pretty much does the same thing as the
Nanotube Grower in VNL, but in a much more versatile way.
Specifically, it contains easy-to-use functions to generate
- Perfect nanotubes, as bulk
- Carbon or boron-nitride tubes (or any A-B tube)
- Ideal two-probe representations of nanotubes
- Molecular nanotube segments for editing and insertion as central region in two-probes
I will make a more proper tutorial around it later, but I just wanted to let everyone get a chance to try to script.
Essentially, it's built up around a class called
Nanotube which has a lot of useful methods like
chiralVector(),
radius(), etc. These will be documented separately later on.
Then, there are 4 high-level functions that use this class:
def createNanotubeAsPAC (n,m,reps=1,elements=(Carbon,Carbon),bondlength=1.422*Ang)
def createNanotubeAsBulk (n,m,reps=1,elements=(Carbon,Carbon),bondlength=1.422*Ang)
def createNanotubeForCentralRegion (n,m,reps=1,elements=(Carbon,Carbon),bondlength=1.422*Ang)
def createPerfectNanotubeAsTwoProbe (n,m,elec_reps,sr_reps,elements=(Carbon,Carbon),bondlength=1.422*Ang)
The parameters are almost the same for all functions.
- n and m are of course the nanotube indices, as in a (n,m)=(4,1) nanotube
- reps is a repetition factor (along the tube), by default always 1
- elements should be a tuple (or list) with 2 elements, like (Carbon,Carbon) or (Boron,Nitrogen)
- bondlength is the carbon-carbon (or whatever) distance; must be given with unit
For the two-probe function, there are 2 repetition parameters instead of one: one for the electrodes (elec_reps) and one for the scattering region (sr_reps).
The functions all return a configuration. You can use it as it is, in the script, or store it in a VNL file for manipulations in VNL or later use. For instance, running
from ATK.KohnSham import *
from Nanotube import *
# -----------------------------
# Tube parameters
# -----------------------------
aCC = 1.422*Ang
n = 12
m = 1
element1 = Boron
element2 = Nitrogen
# -----------------------------
nanotube = createNanotubeAsBulk (n,m,1,(element1,element2),aCC)
vnl_file=VNLFile("BN_nanotube.vnl")
vnl_file.addToSample(nanotube,"Boron-nitride (12,1) nanotube")
produces a file that we can visualize in VNL (attached as image) with a (12,1) B-N nanotube.
Dropping the VNL file on the NanoLanguage scripter, we can now immediately proceed to calculate its band structure, for instance, etc.