International
Tables for
Crystallography
Volume B
Reciprocal space
Edited by U. Shumeli

International Tables for Crystallography (2006). Vol. B. ch. 3.1, p. 352   | 1 | 2 |

Section 3.1.12. Computation

D. E. Sandsa*

a Department of Chemistry, University of Kentucky, Chemistry–Physics Building, Lexington, Kentucky 40506-0055, USA
Correspondence e-mail: sands@pop.uky.edu

3.1.12. Computation

| top | pdf |

It has been mentioned that the tensor formulation used in this chapter is particularly amenable to machine computation. As a simple illustration of this point, the following Fortran program will compute the lengths of vectors X and Y and the angle between them.[\eqalign{&\hbox{DIMENSION X(3),Y(3),G(3,3),SUM(3)}\cr &\hbox{READ (5,10)(X(I),I = 1,3)}\cr &\hbox{READ (5,10)(Y(I),I = 1,3)}\cr &\hbox{READ (5,10)((G(I,J),J = 1,3),I = 1,3)}\cr 10\; & \hbox{FORMAT (3F10.5)}\cr &\hbox{DO 20 I = 1,3}\cr 20\; &\hbox{SUM(I)} = 0\cr &\hbox{DO 30 I = 1,3}\cr & \hbox{DO 30 J = 1,3}\cr &\hbox{SUM(1)} = \hbox{SUM(1) + X(I) }\ast\hbox{ X(J) }\ast\hbox{ G(I,J)}\cr & \hbox{SUM(2)} = \hbox{SUM(2) + Y(I) }\ast\hbox{ Y(J) }\ast\hbox{ G(I,J)}\cr &\hbox{SUM(3)} = \hbox{SUM(3) + X(I) }\ast\hbox{ Y(J) }\ast\hbox{ G(I,J)}\cr 30\;&\hbox{CONTINUE}\cr &\hbox{DIST1} = \hbox{SQRT(SUM(1))}\cr &\hbox{DIST2} = \hbox{SQRT(SUM(2))}\cr &\hbox{ANGLE} = \hbox{57.296 }\ast\hbox{ ACOS(SUM(3)/(DIST1 }\ast\hbox{ DIST2))}\cr &\hbox{WRITE (6,10) DIST1,DIST2,ANGLE}\cr &\hbox{END}}]








































to end of page
to top of page