Subject: perl
To: RiscBSD <port-arm32@NetBSD.ORG>
From: Patrick Welche <prlw1@CUS.CAM.AC.UK>
List: port-arm32
Date: 06/21/1996 14:50:00
For those of you who are interested, the simple perl script is:
# ** Perl 5 ** arrays[0..n-1]
# Script to generate file from files like rhsT30
# (3 Sept 1995) Time reversal symmetry introduced => everything needs multiplying by 2, gamma_a no
# longer needs dividing by 2, but gamma_c needs multiplying by 2.
sub strain
{
$e1=($c33*$xi1-$c13*$xi3)/$denom;
$e3=(($c11+$c12)*$xi3-2*$c13*$xi1)/$denom;
}
$al=0; $cl=0; $am=0; $cm=0; $ah=0; $ch=0; $N=<STDIN>; $V=135.6516203e-30;
$c11=116.4e9; $c12=16.2e9; $c13=32.9e9; $c33=110.7e9;
$denom=($c11+$c12)*$c33-2*$c13*$c13;
$unit=$N*$N*$V;
$A=0; $B=0; $C=0; $D=0; $E=0; $F=0; $G=0; $H=0; $I=0; $J=0;
while(<STDIN>)
{
if(/^#/) { next; }
split;
$xi1=$_[1]/$unit; $xi3=$_[2]/$unit*2; &strain; $e1l=$e1; $e3l=$e3;
printf("%2d % 8.2e % 8.2e % 8.2e % 8.2e\n",$_[0]+1,$xi1,$xi3,$e1,$e3);
if($_[0]>3)
{
$A+=$xi1; $B+=$xi3; $C+=$e1; $D+=$e3;
}
else
{
$E+=$xi1; $F+=$xi3; $G+=$e1; $H+=$e3;
if($_[0]==0){$smxi1=$xi1;$smxi3=$xi3;$sme1=$e1;$sme3=$e3;}
}
}
printf("Lowest mode - mainly Vallade mode:\n");
printf(" % 8.2e % 8.2e % 8.2e % 8.2e\n",$smxi1,$smxi3,$sme1,$sme3);
printf("Total of acoustic modes and Vallade mode:\n");
printf(" % 8.2e % 8.2e % 8.2e % 8.2e\n",$E,$F,$G,$H);
printf("Total of all optic modes other than the Vallade mode:\n");
printf(" % 8.2e % 8.2e % 8.2e % 8.2e\n",$A,$B,$C,$D);
printf("Total of all modes minus the lowest one:\n");
printf(" % 8.2e % 8.2e % 8.2e % 8.2e\n",$A+$E-$smxi1,$B+$F-$smxi3,$C+$G-$sme1,$D+$H-$sme3);
printf("Total of all modes:\n");
printf(" % 8.2e % 8.2e % 8.2e % 8.2e\n",$A+$E,$B+$F,$C+$G,$D+$H);
and the data is:
40
# 1100.83 a 1100.83 c 1100.83 V
0 -1.139465288075e-19 -5.6395674955093e-20 -5.6784166134811e-20
1 -1.7816291311542e-19 -9.4243688221105e-20 -9.0387797631345e-20
2 -8.036363152069e-20 -4.1654393200426e-20 -4.0555162679822e-20
3 -5.0898816535236e-20 -2.6315856983656e-20 -2.5664893609735e-20
4 -2.7463994998256e-20 -1.2213891913142e-20 -1.3341890141245e-20
5 -1.3614686073124e-20 -5.5479324363314e-21 -6.4799354933331e-21
6 -4.092431480201e-21 -4.2609036119117e-21 -2.6168604200302e-21
7 -4.784120849416e-21 -8.8332360565303e-21 -4.049289705013e-21
8 -7.0282842927647e-21 -1.0361192863924e-20 -5.2756624410244e-21
9 -3.9648742435716e-21 -9.8039275249815e-21 -3.994491347213e-21
10 -1.612868905682e-21 -2.7830499874424e-21 -1.3124095021571e-21
11 5.7405195359401e-21 5.0969800230552e-21 3.4488290140914e-21
12 6.9745261910231e-21 5.1870801508173e-21 3.9305017565913e-21
13 1.0131085263917e-20 8.9703419833938e-21 6.0679090463016e-21
14 7.0227267619441e-21 2.5017689519156e-21 3.2493056160678e-21
15 7.0706114582223e-21 3.4767125559166e-21 3.5195199223737e-21
16 8.9268825861908e-21 7.3459921489928e-21 5.2050360443774e-21
17 1.4952443489633e-20 8.4515732794319e-21 7.7256177964229e-21
18 1.3256558404612e-20 7.5441961268226e-21 6.8626903000656e-21
19 9.5061099485523e-21 3.802345531059e-21 4.507692824448e-21
20 9.7543871798013e-21 5.9225946537335e-21 5.1453121565266e-21
21 3.3046244675446e-20 1.7843936752782e-20 1.685997091018e-20
22 3.2325379275601e-20 1.5514875783164e-20 1.5992243553255e-20
23 2.951445620956e-20 1.5332891384755e-20 1.4906325833983e-20
24 2.7110855755733e-20 1.4706997657851e-20 1.385008787371e-20
25 2.4257649349806e-20 1.3615150891358e-20 1.2510087359881e-20
26 2.3682167850376e-20 1.2635474831253e-20 1.2044177131213e-20
OK, the numbers are small, but they aren't *that* small! If it works
for you, let me know!
Patrick