TABLE OF CONTENTS
::pwtk::pwi::supercell
SYNOPSIS
proc ::pwtk::pwi::supercell {args} {
USAGE
::pwtk::pwi::supercell ?-unit alat|angs|bohr? ?-unitvec UNITVEC? ?-kshift "S1 S2 S3"? supercell ?unitKmesh?
PURPOSE
Generate CELL_PARAMETERS and, if requested, K_POINTS for a generic supercell.
OPTIONS
- -unit UNIT --- the length unit for unitvec (default = bohr, allowed values = alat, angs*, bohr)
- -unitvec UNITVEC --- the 3D unitcell Bravais lattice vectors in any form accepted by ::pwtk::matricize. If not set, the unitcell vectors from the CELL_PARAMETERS card are taken.
- -kshift "S1 S2 S2" --- a list of k-mesh offsets, e.g., "1 1 1" or "0 0 0" or ... (default taken from K_POINTS or "1 1 1" if the K_POINTS card does not exist)
ARGUMENTS
- supercell --- supercell expansion matrix specified in any form accepted by ::pwtk::matricize
- unitKmesh --- (optional) K-mesh for the unitcell in the K1xK2xK3 or "K1 K2 K3" form; if specified, the k-mesh for the supercell is generated.
SOURCE
set nargmin 1 set nargmax 2 set usage "?-unit alat|angs|bohr? ?-unitvec unitvec? supercell ?unitKmesh?" set options { {unit.arg bohr "alat of the 2D (1x1) unit cell"} {unitvec.arg {} "unitcell Bravais lattice vectors"} {kshift.arg {} "a list of k-mesh offsets"} } ::pwtk::parseOpt_ ::pwtk::checkOType_ -kshift $opt(kshift) {numberlist binary} "list of binary numbers" lassign $args supercell unitKmesh set path_ [namespace path] namespace path ::math::linearalgebra supercellCommonOpts_ # generate supercell & k-mesh if { $unitKmesh eq {} } { set supervec [::pwtk::supercell3D $unitvec $supercell] } else { lassign [::pwtk::supercell3D $unitvec $supercell $unitKmesh] supervec kp } set kmesh [list {*}$kp {*}$opt(kshift)] # rescale the supercell vectors so that norm(v1) = 1.0 lassign $supervec v1 set alat [norm $v1] set supervec [scale [expr 1.0/$alat] $supervec] lassign $supervec v1 v2 v3 set nb [norm $v2] set nc [norm $v3] # set the pw.x input SYSTEM "ibrav = 0, celldm(1) = $alat, A = " CELL_PARAMETERS (alat) [::pwtk::m2cell $supervec] if { $unitKmesh != {} } { K_POINTS (automatic) $kmesh } # print the basic info to stdout set sv [::pwtk::matricize $supercell] set area [expr abs([det $sv])] ::pwtk::print ++++ "Auto-generation of the supercell..." if { $unitKmesh ne {} } { ::pwtk::print "\nUnitcell k-mesh: [::pwtk::Kmeshize $unitKmesh 3]" } ::pwtk::print " Unitcell lattice vectors (in Bohr): [show $unitvec %15.10f] Supercell expansion matrix: [show $sv %3.0f] Supercell: alat = [format %10.6f $alat] Bohr = [format %10.6f [expr $alat/$unitalat]] unitcell-alat Size of vector A = [format %8.4f 1.0] alat Size of vector B = [format %8.4f $nb] alat Size of vector C = [format %8.4f $nc] alat Area of supercell = [format %8.4f $area] of the unitcell area " if { $unitKmesh != {} } { ::pwtk::print "The following cell parameters and k-points cards were generated:\n" ::pwtk::input::cardPrint CELL_PARAMETERS ::pwtk::input::cardPrint K_POINTS } else { ::pwtk::print "The following cell parameters were generated:\n" ::pwtk::input::cardPrint CELL_PARAMETERS } namespace path $path_ }