[ Home ] [ News ] [ Contact ] [ Search ] [ nextnano.com ]

 Download Software
 Copyright notice
 Publications

 GUI: nextnanomat
 Tool: nextnano
 Tool: nextnano++
 Tool: nextnano.QCL
 * password protected

 

 
 

Macro features

 

Macro 1 (recommended):

==> String feature

nextnano3 supports a simple "Find & Replace" feature where strings in the input file can be replaced with another string.
This macro is supported by the nextnanomat GUI.

How to use it:

Just put something like the following lines anywhere into your input file.
(We recommend that you put it at the beginning of the input file.)

!--------------------------------------------------------------------
! By default, we do not evaluate functions.
! Everything is just a simple "Find & Replace String" operation.
!--------------------------------------------------------------------
 %width            = 10d0               ! quantum well width 10 nm
 %length           = 10                 ! quantum well length 10 nm
 %size             = 10.0               ! quantum well size 10 nm
 %z_coordinates
    = -21.0d0 101d0      ! from z = -21 nm to z = 101 nm
 %well_material    = GaAs               ! quantum well material: GaAs
 %barrier_material = "AlAs"             ! quantum barrier material: AlAs
 
%zmin        
    = -10d0              ! zmin = - 10 nm
 
%zmax             =  10d0              ! zmax =   10 nm
 
%quantum_region   = %zmin  %zmax       ! derived variable: quantum_region = zmin zmax = -10d0 10d0
 
%hkl_z_direction  = 0 1 1              ! [0 1 1] growth direction
 %Region1          = region-number = 1   base-geometry = line   region-priority = 1  ! The whole string including blanks after the first '=' sign is used.
 

The % sign indicates that you define a variable.
When the input file is processed, all occurences of %width, %z-coordinates, %well_material, ... are replaced by the according strings.
A comment sign '!' is allowed in this line. Blanks are allowed within the string which is useful for reading in arrays of numbers. Almost everything is allowed.

Restrictions

  • The variables and their definitions are case sensitive.
  • A variable name must not contain a '-' sign, e.g. %cb-mass = 0.067 is not allowed.
  • In one line, only one variable can be initialized.

 

 

==> Function feature

The following operators and functions are supported:
+ , - , * , / , ^
abs
, exp , sqrt , log , log10 , sin , cos , tan , sinh , cosh , tanh , asin , acos , atan

!--------------------------------------------------------------------------
! If '
%FunctionParser = yes' , then from now on we evaluate all functions.
! If '
%FunctionParser = no' (or not present), no functions are evaluated.
! "Find & Evaluate & Replace String" operation.
!---------------------------------------------------------------------------
 
%FunctionParser = yes             ! This is an important line!
 
%a         = 2.5                  ! a = 2.5
 %b         = 5                    ! b = 5
 %function1 = SQRT(%a) + %b / 2    ! Evaluate: a1/2 + b / 2 = 2.51/2 + 5 / 2
  ...
  xalloy = %function1              ! Insert evaluated value for %function1.
 
%string1 = "GaAs"                 ! Strings are also possible. They have to be in quotation marks or apostrophes.
 %string2 = "GaAs"                 !
 
%string3 = "zero-potential = yes" !
 %Logical1 = .TRUE.                ! A logical variable that is .TRUE.
 %Logical2 = .FALSE.               ! A logical variable that is .FALSE.

 

!----------------------------------------------------------------------------
! We have to be careful about the value of a variable.
! Should it be regarded as a string (default),
! or as a function ('%FunctionParser = yes')?
!----------------------------------------------------------------------------

!----------------------------------------------------------------------------
! Treat variables as strings (default): e.g. %variable1 = %zmin %zmax ! '%zmin %zmax' is treated as a string
!                                            %variable2 = 2.5d0       !       '2.5d0' is treated as a string
!                                            %variable3 = 2.5         !       '2.5'   is treated as a string without exponent 'e0'
!----------------------------------------------------------------------------
!%radius       = 5e0 ! quantum dot radius = 5 nm (DisplayUnit:nm)
 %grid_spacing = 0.5 ! grid spacing              (DisplayUnit:nm)

!----------------------------------------------------------------------------
! From now on, evaluate all functions:  e.g. %variable1 = %zmin %zmax ! '%zmin %zmax' is treated as a formula (which will produce an error in this case)
!                                            %variable2 = 2.5         !       '2.5'   is converted to a real number including exponent 'e0'
!----------------------------------------------------------------------------
 %FunctionParser = yes                                    ! use function parser
 %radius         = 5                                      ! quantum dot radius = 5 nm (DisplayUnit:nm)
 %boundary       = %radius + 1                            ! device_width/2 = 5 nm + 1 nm (DisplayUnit:nm)



Possibility a) for integers (will be available in the next update; not included in the version of 2015-August)
!----------------------------------------------------------------------------
! If you need an integer, then use INT(...).
!----------------------------------------------------------------------------
 %nodes          = INT( ( 2 * %boundary ) / %grid_spacing - 1 ) ! number of nodes (integer) <== it is necessary to convert it to an integer


Possibility b) for integers (deprecated)
!----------------------------------------------------------------------------
! If you need an integer, then call the variable '%INT(<name>)'.
!----------------------------------------------------------------------------
 %INT(nodes)     =      ( 2 * %boundary ) / %grid_spacing - 1   ! number of nodes (integer) <== it is necessary to convert it to an integer


Possibility c) for integers (deprecated)
 %nodes          =      ( 2 * %boundary ) / %grid_spacing - 1   ! number of nodes (Here, this is a floating point number.)
!----------------------------------------------------------------------------
! If you need an integer, then call the variable '%INT(<name>)'.
!----------------------------------------------------------------------------
 %INT(nodes)     = %nodes                                       ! number of nodes (integer) <== it is necessary to convert it to an integer
 

Note that integers will be rounded up if <= .5 or rounded down if < .5, i.e. it will be rounded to the nearest integer.



 %cb_mass        = 0.112   ! Gamma conduction band effective mass   (DisplayUnit:m0)
 %hh_mass        = 1.51    ! heavy hole valence band effective mass (DisplayUnit:m0)

Integer numbers can be defined as follows:
 %NumberOfEigenvalues = "10"      ! 10 eigenvalues
 
%NumberOfEigenvalues = INT(10)   ! 10 eigenvalues

Integer arrays can be defined as follows:
 %hkl_z_direction = "0 1 1"       ! [0 1 1] growth direction
 

The following has beed fixed in updates from 2016 and later.
This is not possible because the variable string 'thickness' is contained in part of the string 'thickness1':

 %thickness        = 5              !
 
%thickness_test   = 6              ! This variable gets replaced: '%thickness_test' ==> '5_test' and thus an error is produced as '5_test' is not allowed syntax.

However, you can solve this by using apostrophes, for instance:

 %'thickness'      = 5              ! Both variables are treated independently so this is okay.
 
%'thickness_test'
= 6              !

 Here, the variable string ''thickness'' is not contained in part of the string ''thickness_test'' because the apostrope ''' is now part of the variable name.

 

Conditional comments

All updates later than 2016 support the following !IF statements, i.e. variables can also be used to define conditional comments.

!IF %TemperatureDependentBandGap  varshni-parameters-on = yes

Such a statement has the following meaning:
If the value of %TemperatureDependentBandGap is either .TRUE.  or 1 or any other nonzero value, then the statement is included in the input file.
If the value of %TemperatureDependentBandGap is either .FALSE. or 0 or undefined, then the statement is simply ignored as if it were a comment.

In this example, the text is always commented out, unless %IncludeHoles is defined with a value %IncludeHoles /= 0 or /= .FALSE..
 %IncludeHoles = .TRUE.        ! or %IncludeHoles = 1
!IF
%IncludeHoles $quantum-model-holes
!IF %IncludeHoles  model-number                   = 1
!IF %IncludeHoles  model-name                     = effective-mass
!IF %IncludeHoles  cluster-numbers                = 1
!IF %IncludeHoles  valence-band-numbers           = 1 2 3
!IF %IncludeHoles  number-of-eigenvalues-per-band = 10
!IF
%IncludeHoles  boundary-condition-100         = Dirichlet
!IF %IncludeHoles $end_quantum-model-holes
 

 %IncludeHoles     = 1
 %IncludeElectrons = 1 - %IncludeHoles   !
Note: Here the evaluated value of %IncludeElectrons is 0, therefore the following three lines are treated as a comment.
!IF
%IncludeElectrons $quantum-model-electrons
!IF %IncludeElectrons  model-number               = 1
!IF %IncludeElectrons  ...
 

If the variable definition
 %IncludeHoles = .TRUE. appears after the line '%FunctionParser = yes'
quotation marks or apostrophes must be used for the logical strings .TRUE./.FALSE. to indicate that they have to be treated as strings:
 %IncludeHoles = ".TRUE." or
 %IncludeHoles = '.TRUE.'
 

 

Once one input file has been processed, the input file (*.in) is copied to the output folder.
Additionally, this output folder contains a file called *.in.mo_macro which contains the input file where all variables have been replaced.

 

 

Macro 2 (namelist, alternative): This macro feature is deprecated and it is recommended that you use the upper implementation of the macro.

nextnano3 supports a simple "Find & Replace" feature where strings in the input file can be replaced with another string.

The first lines of the input file can contain the following additional entries (optional, not required).

  • &macro filename = 'macro.in' /


    macro.in is an ASCII file containing the following:

    &macro  Find_and_Replace_1 = '$WIDTH' ,'0d0 10.0d0'       ! Find '$WIDTH'      and replace it with '0d0 10.0d0'.
            Find_and_Replace_2 = 'x-nodes = 9','x-nodes = 29' !
    Find 'x-nodes = 9' and replace it with 'x-nodes = 29'.
            Find_and_Replace_3 = 'GaAs' ,'InP'                !
    Find 'GaAs'        and replace it with 'InP'.
    /

    Dowload example file: macro.in

 

  • !***************************************************************************!
    ! Macro: 'Find & Replace'
    !***************************************************************************!
    !
    ! A macro can be used to simply search for a specific string and to replace
    ! it with another string.
    !
    ! Example: Replace the material 'GaAs' with 'InAs'.
    !       material-name = GaAs
    !   ==> material-name = InAs

    ! Replace the quantum well width '$WIDTH' with '10d0':
    !       x-coordinates = -$WIDTH $WIDTH
    !   ==> x-coordinates = -10d0 10d0
    !
    ! Replace the string '2*$WIDTH' with '20d0':     !
    (Mathematical operations are not supported yet. They are treated as strings.)
    !       x-coordinates = 0d0 2*$WIDTH
    !   ==> x-coordinates = 0d0 20d0
    !
    ! Replace the string '$WIDTH+$SIZE' with '30d0': !
    (Mathematical operations are not supported yet. They are treated as strings.)
    !       x-coordinates = 0d0 $WIDTH+$SIZE
    !   ==> x-coordinates = 0d0 30d0
    !
    ! Replace the quantum well width '$WIDTH' with '0d0 10d0':
    !       x-coordinates = $WIDTH
    !   ==> x-coordinates = 0d0 10d0
    !
    ! Simulate along x, y or z direction:
    !       Find_and_Replace_1 = '$DIRECTION' ,'x'      ! simulation along x direction
    !       Find_and_Replace_2 = '$DOMAINTYPE','1 0 0'  ! simulation along x direction
    !
    !       Find_and_Replace_1 = '$DIRECTION' ,'y'      ! simulation along y direction
    !       Find_and_Replace_2 = '$DOMAINTYPE','0 1 0'  ! simulation along y direction
    !
    ! a) The macro can be defined in the input file: filename = '' (or)
    ! b) The macro can be read in from another file: filename = 'macro.in'
    !
    !---------------------------------------------------------------------------!
    &macro  filename            = 'macro.in'                    ! optional  
    macro file to be read in, use '' for no macro input file
            Find_and_Replace_1  = '$WIDTH' ,'0d0 10.0d0'        ! optional 
    find string, replace string (will be ignored if macro file is read in)
            Find_and_Replace_2  = 'x-nodes = 9','x-nodes = 29'  ! optional 
    find string, replace string (will be ignored if macro file is read in)
            Find_and_Replace_3  = 'GaAs' ,'InP'                 ! optional 
    find string, replace string (will be ignored if macro file is read in)
    /
     
  • &macro  filename            = ''                            ! optional  macro file to be read in, use '' for no macro input file
            Find_and_Replace_1  = '$WIDTH' ,'0d0 10.0d0'        ! optional 
    find string, replace string (will be ignored if macro file is read in)
            Find_and_Replace_2  = 'x-nodes = 9','x-nodes = 29'  ! optional 
    find string, replace string (will be ignored if macro file is read in)
            Find_and_Replace_3  = 'GaAs' ,'InP'                 ! optional 
    find string, replace string (will be ignored if macro file is read in)
    /
  • &macro  Find_and_Replace_1  = '$WIDTH' ,'0d0 10.0d0'        ! optional  find string, replace string (will be ignored if macro file is read in)
            Find_and_Replace_2  = 'x-nodes = 9','x-nodes = 29'  ! optional 
    find string, replace string (will be ignored if macro file is read in)
            Find_and_Replace_3  = 'GaAs' ,'InP'                 ! optional 
    find string, replace string (will be ignored if macro file is read in)
            ...
            Find_and_Replace_40 = 'GaAs' ,'InP'                 ! optional 
    find string, replace string (will be ignored if macro file is read in)
    /

Currently up to 40 "Find & Replace" definitions can be specified. (Just contact us if this is not sufficient.)

The input syntax for the macro is implemented as a NAMELIST (standard Fortran feature).