QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: privador on March 16, 2009, 03:55

Title: Z-shaped nanoribbon junction
Post by: privador on March 16, 2009, 03:55
I tried to follow tutoriol,but i have some problems.
When i wanted to repace this part
Quote
import math, numpy
aCC = 1.4208
x_shift = -4.0*aCC*math.sqrt(3.)/2.
right_electrode_coordinates = (
numpy.array ( [[ 8.45349407, 7.5, 1.42086005],
...
[ 16.78999329, 7.5, 3.39222002]] )
+ array([x_shift,0.,0.]) ) * Angstrom
I got script
Quote
from ATK.TwoProbe import *

# Scattering elements and coordinates
scattering_elements = [Carbon,   Carbon,   Carbon,   Hydrogen,
                       Hydrogen, Carbon,   Carbon,   Carbon,   
                       Hydrogen, Hydrogen]
scattering_coordinates = [[  9.68399525,   7.5       ,   4.97301006],
                          [ 12.14499664,   7.5       ,   4.97301006],
                          [ 14.60599804,   7.5       ,   4.97301006],
                          [  7.5       ,   7.5       ,   5.13293982],
                          [ 16.78999329,   7.5       ,   5.13293982],
                          [  9.68399525,   7.5       ,  15.29286939],
                          [ 12.14499664,   7.5       ,  15.29286939],
                          [ 14.60599804,   7.5       ,  15.29286939],
                          [  7.5       ,   7.5       ,  15.1329394 ],
                          [ 16.78999329,   7.5       ,  15.1329394 ]]*Angstrom
       

electrode_elements = [Carbon,   Carbon,   Carbon,   Carbon,   
                      Carbon,   Carbon,   Carbon,   Carbon,   
                      Carbon,   Carbon,   Carbon,   Carbon,   
                      Carbon,   Carbon,   Hydrogen, Hydrogen,
                      Hydrogen, Hydrogen]
left_electrode_coordinates = [[  8.45349407,   7.5       ,   1.42086005],
                         [  8.45349407,   7.5       ,   2.8417201 ],
                         [  9.68399525,   7.5       ,   3.55215001],
                         [  9.68399525,   7.5       ,   0.71043003],
                         [ 10.91449547,   7.5       ,   1.42086005],
                         [ 10.91449547,   7.5       ,   2.8417201 ],
                         [ 12.14499664,   7.5       ,   3.55215001],
                         [ 12.14499664,   7.5       ,   0.71043003],
                         [ 13.37549782,   7.5       ,   1.42086005],
                         [ 13.37549782,   7.5       ,   2.8417201 ],
                         [ 14.60599804,   7.5       ,   3.55215001],
                         [ 14.60599804,   7.5       ,   0.71043003],
                         [ 15.83649921,   7.5       ,   1.42086005],
                         [ 15.83649921,   7.5       ,   2.8417201 ],
                         [  7.5       ,   7.5       ,   0.87036002],
                         [  7.5       ,   7.5       ,   3.39222002],
                         [ 16.78999329,   7.5       ,   0.87036002],
                         [ 16.78999329,   7.5       ,   3.39222002]]*Angstrom
import math, numpy
aCC = 1.4208
x_shift = -4.0*aCC*math.sqrt(3.)/2.
right_electrode_coordinates = (numpy.array (  [[  8.45349407,   7.5       ,   1.42086005],
                         [  8.45349407,   7.5       ,   2.8417201 ],
                         [  9.68399525,   7.5       ,   3.55215001],
                         [  9.68399525,   7.5       ,   0.71043003],
                         [ 10.91449547,   7.5       ,   1.42086005],
                         [ 10.91449547,   7.5       ,   2.8417201 ],
                         [ 12.14499664,   7.5       ,   3.55215001],
                         [ 12.14499664,   7.5       ,   0.71043003],
                         [ 13.37549782,   7.5       ,   1.42086005],
                         [ 13.37549782,   7.5       ,   2.8417201 ],
                         [ 14.60599804,   7.5       ,   3.55215001],
                         [ 14.60599804,   7.5       ,   0.71043003],
                         [ 15.83649921,   7.5       ,   1.42086005],
                         [ 15.83649921,   7.5       ,   2.8417201 ],
                         [  7.5       ,   7.5       ,   0.87036002],
                         [  7.5       ,   7.5       ,   3.39222002],
                         [ 16.78999329,   7.5       ,   0.87036002],
                         [ 16.78999329,   7.5       ,   3.39222002]] )+array([x_shift,0.,0.] ) )*Angstrom

electrode_cell = [[ 24.28999307,   0.        ,   0.        ],
                  [  0.        ,  24.28999307,   0.        ],
                  [  0.        ,   0.        ,   4.26258   ]]*Angstrom
# Set up electrodes
left_electrode_configuration = PeriodicAtomConfiguration(
    electrode_cell,
    electrode_elements,
    left_electrode_coordinates
    )
right_electrode_configuration = PeriodicAtomConfiguration(
electrode_cell,
electrode_elements,
right_electrode_coordinates
)
# Set up two-probe configuration
twoprobe_configuration = TwoProbeConfiguration(
    (left_electrode_configuration,right_electrode_configuration),
    scattering_elements,
    scattering_coordinates,
    electrode_repetitions=[[1,1],[1,1]],
    equivalent_atoms=([3,0],[2,5])
    )

I run that script Job manager
Quote
Running: C:\Program Files\QuantumWise\Virtual NanoLab 2008.10.0\atk\bin\atk.exe c:/docume~1/rain~1.rai/locals~1/temp/tmpvpio1e.nl
Traceback (most recent call last):
  File "c:/docume~1/rain~1.rai/locals~1/temp/tmpvpio1e.nl", line 89, in ?
    right_electrode_coordinates = (numpy.array (  [[  8.45349407,   7.5       ,   1.42086005],
NameError: name 'array' is not defined
Terminated Abnormally
Title: Re: Z-shaped nanoribbon junction
Post by: Nordland on March 16, 2009, 09:06
You can either add "from numpy import array" or "from numpy import *" in the two of the script and then you script will work again
Title: Re: Z-shaped nanoribbon junction
Post by: Anders Blom on March 16, 2009, 10:16
Thank you for pointing out this typo in the tutorial. An updated version will be published promptly.

To make it a bit easier to set up the Z-shaped ribbons, I have also developed a new script which completely eliminate all complicated steps in VNL. I will publish it on the Forum very soon.

However, the tutorial as it is serves as a nice demonstration of how to make the various tools in VNL work together to set up complex geometries in the case when you don't have a ready "geometry generator script". Often, performing the steps by hand in VNL is the first step when you develop such a script anyway!
Title: Re: Z-shaped nanoribbon junction
Post by: privador on March 17, 2009, 06:35
Quote
right_electrode_coordinates = (numpy.array (  [[  8.45349407,   7.5       ,   1.42086005],
                         [  8.45349407,   7.5       ,   2.8417201 ],
                         [  9.68399525,   7.5       ,   3.55215001],
                         [  9.68399525,   7.5       ,   0.71043003],
                         [ 10.91449547,   7.5       ,   1.42086005],
                         [ 10.91449547,   7.5       ,   2.8417201 ],
                         [ 12.14499664,   7.5       ,   3.55215001],
                         [ 12.14499664,   7.5       ,   0.71043003],
                         [ 13.37549782,   7.5       ,   1.42086005],
                         [ 13.37549782,   7.5       ,   2.8417201 ],
                         [ 14.60599804,   7.5       ,   3.55215001],
                         [ 14.60599804,   7.5       ,   0.71043003],
                         [ 15.83649921,   7.5       ,   1.42086005],
                         [ 15.83649921,   7.5       ,   2.8417201 ],
                         [  7.5       ,   7.5       ,   0.87036002],
                         [  7.5       ,   7.5       ,   3.39222002],
                         [ 16.78999329,   7.5       ,   0.87036002],
                        [ 16.78999329,   7.5       ,   3.39222002]] ) +array([x_shift,0.,0.] ) )*Angstrom
Actually it was slight mistake .There should be numpy.array instead of array
No need for "from numpy import array" or "from numpy import *"
I got script work
Title: Re: Z-shaped nanoribbon junction
Post by: Anders Blom on March 17, 2009, 09:23
Well, all 3 ways would have worked :)