Page 1 of 1

How to produce the K point of the full Brillouin zone of the hexagonal structure

Posted: Fri Oct 25, 2024 11:54 pm
by guodonglin
Dear all,

How to produce the K point of the full Brillouin zone of the hexagonal structure.

Donglin Guo

Re: How to produce the K point of the full Brillouin zone of the hexagonal structure

Posted: Mon Oct 28, 2024 11:22 pm
by stiwari
Hi Donglin,

There are multiple codes which can produce the uniform grid in the full Brillouin zone. The easiest method is to use the perl code below (Part of Wannier90 distribution kmesh.pl). To run the code below and generate a 6 6 6 k-grid -> perl kmesh.pl 6 6 6

Best regards,
Sabya

Code: Select all

[#!/usr/bin/perl -w


$numargs = $#ARGV+1;

if (($numargs<3)||($numargs>4)) {
    print  "usage: n1 n2 n3 [wan]\n";
    print  "       n1  - divisions along 1st recip vector\n";
    print  "       n2  - divisions along 2nd recip vector\n";
    print  "       n3  - divisions along 3rd recip vector\n";
    print  "       wan - omit the kpoint weight (optional)\n";
    exit;
}

if ($ARGV[0]<=0) {
    print "n1 must be >0\n";
    exit;
}
if ($ARGV[1]<=0) {
    print "n2 must be >0\n";
    exit;
}
if ($ARGV[2]<=0) {
    print "n3 must be >0\n";
    exit;
}

$totpts=$ARGV[0]*$ARGV[1]*$ARGV[2];

if ($numargs==3) {
    print "K_POINTS crystal\n";
    print $totpts,"\n";
    for ($x=0; $x<$ARGV[0]; $x++) {
    for ($y=0; $y<$ARGV[1]; $y++) {
        for ($z=0; $z<$ARGV[2]; $z++) {
        printf ("%12.8f%12.8f%12.8f%14.6e\n", $x/$ARGV[0],$y/$ARGV[1],$z/$ARGV[2],1/$totpts);
        }
    }
    }
}


if ($numargs==4) {
    for ($x=0; $x<$ARGV[0]; $x++) {
    for ($y=0; $y<$ARGV[1]; $y++) {
        for ($z=0; $z<$ARGV[2]; $z++) {
        printf ("%12.8f%12.8f%12.8f\n", $x/$ARGV[0],$y/$ARGV[1],$z/$ARGV[2]);
        }
    }
    }
}


exit;
]