Commit b11b79b3 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

OmegaUtils: working on honeycomb

parent 6827b0cd
......@@ -238,6 +238,12 @@ sub fourier
return fourierLadder2orb($f, $v, $hptr);
}
}
if ($geometry->{"subname"} =~ /^Honeycomb/) {
my $type = $geometry->{"subname"};
$type =~ s/^Honeycomb//;
return fourierHoneycomb($f, $v, $hptr, $type);
}
}
die "$0: ft: undefined geometry ".$geometry->{"name"}."\n";
......@@ -491,6 +497,44 @@ sub fourierLadderAverageInput
return @partialV;
}
sub fourierHoneycomb
{
my ($f, $v, $hptr, $type) = @_;
my $lx = $hptr->{"#Lx"};
my $ly = $hptr->{"#Ly"};
my ($M1, $M2) = (2*$lx, $ly);
my $n = scalar(@$v);
for (my $m1 = 0; $m1 < $M1; ++$m1) { # loop over momenta
for (my $m2 = 0; $m2 < $M2; ++$m2) { # loop over momenta
# valid ($qx, $qy)
my ($qx, $qy) = honeyGetQ($m1, $m2, $lx, $ly, $type);
my @sum = (0, 0);
for (my $i = 0; $i < $n; ++$i) { # loop over space
my $ptr = $v->[$i];
my @temp = @$ptr;
my @fourierFactor = honeyFourierFactor($i, $qx, $qy, $n, $hptr, $type);
$sum[0] += $fourierFactor[0]*$temp[1] + $fourierFactor[1]*$temp[0]; # imaginary part
$sum[1] += $fourierFactor[0]*$temp[0] - $fourierFactor[1]*$temp[1]; # real part
}
$f->[$m1 + $m2*$M1] = \@sum;
}
}
}
sub honeyFourierFactor
{
my ($i, $qx, $qy, $n, $hptr, $type) = @_;
# get (rx, ry) and (cx, cy)
my $indexForCenter = $hptr->{"centralSite"};
my ($rx, $ry) = honeySpaceFromIndex($i, $n, $hptr, $type);
my ($cx, $cy) = honeySpaceFromIndex($indexForCenter, $n, $hptr, $type);
my $arg = $qx*($rx - $cx) + $qy*($ry - $cy);
return (cos($arg), sin($arg));
}
sub writeFourier
{
my ($array, $f, $geometry) = @_;
......@@ -541,5 +585,25 @@ sub getQ
return ($isPeriodic) ? 2.0*$pi*$m/$n : ($m + 1)*$pi/($n+1.0);
}
sub honeyGetQ
{
my ($m1, $m2, $lx, $ly, $type) = @_;
my ($b1x, $b1y) = (2*$pi/(3*$lx), 0);
my ($b2x, $b2y) = (0, 2*$pi/(sqrt(3)*$ly));
if ($type eq "zigzag") {
($b1x, $b1y) = (2*$pi*sqrt(3)/(3*$lx), -1);
($b2x, $b2y) = (0, 4*$pi/(3*$ly));
}
return ($m1 * $b1x + $m2 * $b2x, $m1 * $b1y + $m2 * $b2y);
}
sub honeySpaceFromIndex
{
my ($ind, $n, $hptr, $type) = @_;
}
1;
......@@ -36,11 +36,14 @@ my $jacksOrLorentz = "none";
my $ChebyC = 0;
my $ChebySign = 1;
my $testoutputfile;
my ($lx, $ly) = (0, 0);
my $hptr = {"#OmegaBegin" => \$omega0,
"#OmegaTotal" => \$omegaTotal,
"#OmegaStep" => \$omegaStep,
"#OmegaOffset" => \$omegaOffset,
"#Lx" => \$lx,
"#Ly" => \$ly,
"GeometryKind" => \$geometryName,
"GeometrySubKind" => \$geometrySubName,
"LadderLeg" => \$geometryLeg,
......@@ -52,12 +55,13 @@ my $hptr = {"#OmegaBegin" => \$omega0,
"TotalNumberOfSites" => \$GlobalNumberOfSites,
"OutputFile" => \$testoutputfile};
OmegaUtils::getLabels($hptr,$templateInput);
OmegaUtils::getLabels($hptr, $templateInput);
$hptr->{"isPeriodic"} = $isPeriodic;
$hptr->{"mMax"} = $mMax;
$hptr->{"centralSite"} = $centralSite;
$hptr->{"isCheby"} = findIfWeAreCheby($jacksOrLorentz, $testoutputfile, $ChebyC);
my $logFile = "Log$templateInput";
$logFile =~ s/\..*$//;
$logFile .= ".log";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment