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

OmegaUtils: foreach fixed

parent 8345a19b
......@@ -87,7 +87,7 @@ sub printGnuplotFromHash
my ($ptr, $geometry, $isPeriodic, $zeroAtCenter, $nonNegativeOnly) = @_;
my ($factor, $fileIndices, $leg) = getGeometryDetails($geometry);
foreach my $fileIndex (@$fileIndices) {
my $outFile = "outSpectrum$fileIndex.gnuplot";
my $outFile2 = "outSpectrum$fileIndex.pgfplots";
......@@ -106,10 +106,9 @@ sub printGnuplotFromHash
@array = fillQvalues($numberOfQs, $isPeriodic, $zeroAtCenter);
}
foreach my $ind (@array) {
my $ptr = $array[$ind];
my ($m, $q) = ($ptr->{"m"}, $ptr->{"q"});
foreach my $ptr2 (@array) {
my ($m, $q) = ($ptr2->{"m"}, $ptr2->{"q"});
my $realPart = $aptr->[2*$m+1+2*$fileIndex*$numberOfQs];
my $imagPart = $aptr->[2*$m+2+2*$fileIndex*$numberOfQs];
$imagPart = 0 if ($nonNegativeOnly and $imagPart < 0);
......@@ -132,7 +131,7 @@ sub fillQvalues
my ($numberOfQs, $isPeriodic, $zeroAtCenter) = @_;
my $centerShift = ($numberOfQs & 1) ? ($numberOfQs - 1)/2 : $numberOfQs/2;
$centerShift = 0 unless ($zeroAtCenter);
my @array;
my @array;
for (my $m2 = 0; $m2 < $numberOfQs; ++$m2) {
my $m = $m2 - $centerShift;
$m += $numberOfQs if ($m < 0);
......@@ -538,7 +537,7 @@ sub fourierHoneycomb
Honeycomb::honeySpace(\@tindx, \@tindy, $n, $hptr, $type);
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) = Honeycomb::honeyGetQ($m1, $m2, $lx, $ly, $type);
my @sum = (0, 0);
......@@ -562,7 +561,7 @@ sub honeyFourierFactor
my $indexForCenter = $hptr->{"centralSite"};
my ($rx, $ry) = ($tindx->[$i], $tindy->[$i]);
my ($cx, $cy) = ($tindx->[$indexForCenter], $tindy->[$indexForCenter]);
my $arg = $qx*($rx - $cx) + $qy*($ry - $cy);
my $arg = $qx*($rx - $cx) + $qy*($ry - $cy);
return (cos($arg), sin($arg));
}
......
......@@ -87,7 +87,7 @@ sub createInput
my $ndown = $nup;
my %valuesHash = (
"steps" => $steps,
"steps" => $steps,
"data" => $data,
"nup" => $nup,
"ndown" => $ndown,
......@@ -143,7 +143,7 @@ sub createBatch
my $file = "Batch$ind.pbs";
my %valuesHash = (
"input" => $input,
"input" => $input,
"ind" => $ind,
"omega" => $omega);
......@@ -182,4 +182,3 @@ sub submitBatch
chomp($ret);
return $ret;
}
......@@ -63,7 +63,7 @@ $hptr->{"isPeriodic"} = $isPeriodic;
$hptr->{"mMax"} = $mMax;
$hptr->{"centralSite"} = $centralSite;
$hptr->{"isCheby"} = findIfWeAreCheby($jacksOrLorentz, $testoutputfile, $ChebyC);
my $logFile = "Log$templateInput";
$logFile =~ s/\..*$//;
$logFile .= ".log";
......@@ -380,9 +380,9 @@ sub chebyRealSpace
# adding the zeroth Cheby momentum $n==0
my $sum = $factor->[$om]*$vM->[$p];
# adding all the others
# adding all the others
for (my $n = 1; $n < $times; ++$n) {
$sum += 2.0*$dampG->[$n]*$ChebyPolyXfactor->[$n+$times*$om]*
$sum += 2.0*$dampG->[$n]*$ChebyPolyXfactor->[$n+$times*$om]*
$vM->[$p + $GlobalNumberOfSites*$n];
}
......@@ -396,7 +396,7 @@ sub doFactorAndPolyXfactor
{
my ($times) = @_;
my $epsilont = 0.025;
my $Wprime = 1.0-0.5*$epsilont;
my $Wprime = 1.0-0.5*$epsilont;
my (@factor, @polyXfactor);
for (my $om = 0; $om < $omegaTotal; ++$om) {
......@@ -404,7 +404,7 @@ sub doFactorAndPolyXfactor
# Scaling
my $omegaPrime = ($ChebySign*$omega-$omega0)*$ChebyC-$Wprime;
my $underSqrt = 1.0-$omegaPrime*$omegaPrime;
die "$0: $omegaPrime is such that 1-w'^2 < 0\n" if ($underSqrt < 0);
die "$0: $omegaPrime is such that 1-w'^2 < 0\n" if ($underSqrt < 0);
$factor[$om] = 1.0/(pi*sqrt($underSqrt));
for (my $n = 1; $n < $times; ++$n) {
$polyXfactor[$n + $times*$om] = $ChebyC*$factor[$om]*cos($n*acos($omegaPrime));
......@@ -603,4 +603,3 @@ sub findIfWeAreCheby
die "$0: JacksOrLorentz is NOT none, but OutputFile= is dollarized\n";
}
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