Quantcast
Channel: Active questions tagged vmd - Stack Overflow
Viewing all articles
Browse latest Browse all 33

How to make 2 Fortran subroutines have the same output file?

$
0
0

I need the code to write the data of two circles in order to export it as an animation (vmd). This should give me around 6000 data(3000 per circle).

When I run the program it only writes the data of the first circle.How do I write the two sets of data in the same file?Here is the code I used

       Program circulo       implicit double precision(A-H,O-Z)       Character*4 W1,W6       Character*4 W2,W7          Open(3,file='circular.xyz',access='append',action='readwrite')       open(9,file='circular.dat',form='formatted',action='readwrite')       Call Circular1       Call Circular2       Stop       End c*******************************************************************************       Subroutine Circular1       implicit double precision(A-H,O-Z)       Dimension x(9000),y(9000),z(9000)       Character*4 W1,W6       W1='Rb'       W6=''       Natomos = 1       rewind(3)       rewind(9)       write(6,*) 'dame el valor del radio'       read(5,*)Radio       write(6,*) 'dame el valor del angulo inicial'       read(5,*) Phio       write(6,*) 'dame el valor de la velocidad angular'       read(5,*) wo       write(6,*) 'dame el valor de la aceleracion angular'       read(5,*) alpha       write(6,*) 'Estoy trabajando'       Pi      = 3.1416       Fact    = Pi/180.0d0       Phio    = Phio*Fact       Nciclos = 3000       t       = 0.0       dt      =0.005       do i = 1,Nciclos            write(3,*)Natomos            write(3,*)            Phi  = Phio + wo*t +.5*alpha*t*t            x(i) = Radio*cos(Phi)            y(i) = Radio*sin(Phi)            z(i) = 0.0            t    = t + dt            write(9,23)x(i),y(i)            write(3,12)w1,w6,x(i),y(i),z(i)              end do23     FORMAT(2F15.6)12     FORMAT(A4,A8,3F22.6)       close(9)       close(3)       RETURN       END subroutinec**************************************************************************       Subroutine Circular2       implicit double precision(A-H,O-Z)       Dimension a(9000),b(9000),c(9000)       Character*4 W2,W7       W2='Hg'       W7=''       Natomos = 1       rewind(3)       rewind(9)       write(6,*) 'dame el valor del radio2'       read(5,*)Radio2       write(6,*) 'dame el valor del angulo inicial2'       read(5,*) Phio2       write(6,*) 'dame el valor de la velocidad angular2'       read(5,*) wo2       write(6,*) 'dame el valor de la aceleracion angular2'       read(5,*) alpha2       write(6,*) 'Estoy trabajando'       Pi      = 3.1416       Fact    = Pi/180.0d0       Phio2    = Phio2*Fact       Nciclos = 3000       t       = 0.0       dt      =0.005       do i = 1,Nciclos            write(3,*)Natomos            write(3,*)            Phi  = Phio2 + wo2*t +.5*alpha2*t*t            a(i) = Radio2*cos(Phi)            b(i) = Radio2*sin(Phi)            c(i) = 0.0            t    = t + dt            write(9,23)a(i),b(i)            write(3,12)w2,w7,a(i),b(i),c(i)              end do23     FORMAT(2F15.6)12     FORMAT(A4,A8,3F22.6)       close(9)       close(3)       RETURN       END subroutine

Viewing all articles
Browse latest Browse all 33

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>