計算物理学 Rubin H. Landau 参考文献・docker登録
<この項は書きかけです。順次追記します。>
docker/ubuntu
# cd /home/cp/HCPcode
# gfortran tune.f90 -o tune
tune.f90:2:4:
by RH Landau, MJ Paez, and CC Bordeianu
1
Error: Unclassifiable statement at (1)
tune.f90:3:4:
Copyright Wiley-VCH Verlag GmbH & Co. KGaA, Berlin; Copyright R Landau,
1
Error: Unclassifiable statement at (1)
tune.f90:3:57:
Copyright Wiley-VCH Verlag GmbH & Co. KGaA, Berlin; Copyright R Landau,
1
Error: Unclassifiable statement at (1)
tune.f90:4:4:
Oregon State Unv, MJ Paez, Univ Antioquia, C Bordeianu, Univ Bucharest, 2015.
1
Error: Unclassifiable statement at (1)
tune.f90:5:4:
Support by National Science Foundation
1
Error: Unclassifiable statement at (1)
tune.f90:61:6:
Stop
1
Error: Blank required in STOP statement near (1)
commentと見なされなかったらしい。
エラーが出た行を!でコメントに
tune.f90
! From "COMPUTATIONAL PHYSICS", 3rd Ed, Enlarged Python eTextBook
! by RH Landau, MJ Paez, and CC Bordeianu
! Copyright Wiley-VCH Verlag GmbH & Co. KGaA, Berlin; Copyright R Landau,
! Oregon State Unv, MJ Paez, Univ Antioquia, C Bordeianu, Univ Bucharest, 2015.
! Support by National Science Foundation
!
! tune.f90: matrix algebra program to be tuned for performance
Program tune
parameter (ldim = 2050)
Implicit Double precision (a - h, o - z)
dimension ham(ldim, ldim), coef(ldim), sigma(ldim)
! set up H and starting vector
Do i = 1, ldim
Do j = 1, ldim
If ( abs(j - i) > 10) then
ham(j, i) = 0.
else
ham(j, i) = 0.3**Abs(j - i)
EndIf
End Do
ham(i, i) = i
coef(i) = 0.
End Do
coef(1) = 1.
! start iterating
err = 1.
iter = 0
20 If (iter< 15 .and. err >1.e-6) then
iter = iter + 1
! compute current energy & normalize
ener = 0.
ovlp = 0.
Do i = 1, ldim
ovlp = ovlp + coef(i)*coef(i)
sigma(i) = 0.
Do j = 1, ldim
sigma(i) = sigma(i) + coef(j)*ham(j, i)
End Do
ener = ener + coef(i)*sigma(i)
End Do
ener = ener/ovlp
Do I = 1, ldim
coef(i) = coef(i)/Sqrt(ovlp)
sigma(i) = sigma(i)/Sqrt(ovlp)
End Do
! compute update and error norm
err = 0.
Do i = 1, ldim
If (i == 1) goto 22
step = (sigma(i) - ener*coef(i))/(ener - ham(i, i))
coef(i) = coef(i) + step
err = err + step**2
22 Continue
23 End Do
err = sqrt(err)
write(*, '(1x, i2, 7f10.5)') iter, ener, err, coef(1)
goto 20
Endif
! Stop
End Program tune
コンパイル&go
docker/ubuntu
# gfortran tune.f90
# ./a.out
1 1.00000 0.30350 1.00000
2 0.92179 0.05728 0.95690
3 0.91720 0.01562 0.96664
4 0.91691 0.00402 0.96348
5 0.91688 0.00116 0.96414
6 0.91688 0.00031 0.96391
7 0.91688 0.00009 0.96397
8 0.91688 0.00002 0.96395
9 0.91688 0.00001 0.96395
10 0.91688 0.00000 0.96395
11 0.91688 0.00000 0.96395
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20190807
最後までおよみいただきありがとうございました。
いいね 💚、フォローをお願いします。
Thank you very much for reading to the last sentence.
Please press the like icon 💚 and follow me for your happy life.