Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Re: compiler pr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 14 of 14 Topic 8216 of 8775
Post > Topic >>

Re: compiler problem

by Dick Hendrickson <dick.hendrickson@[EMAIL PROTECTED] > May 16, 2008 at 03:00 PM

rudra wrote:
> dear friends,
>  here is the full code that is creating the problem!!!
> 
> !===========================================
> !       This is the main driver routine
> !       of the reverse monte carlo program
>         program rmonte
> !===========================================
> 
>         implicit none
>         integer::i,j
>         integer:: seed,tr,rmcs
>         integer::ntyp,nap,ntot,it1,it2,atnm
>         real(selected_real_kind(8))::rmin,rmax,boxl,dr
>         real(selected_real_kind(8))::rr,rdf
>         real(selected_real_kind(8)),dimension(100)::x,y,z
>         real(selected_real_kind(8)),dimension(100):: gr,rrl
>         real(selected_real_kind(8)):: dx,dy,dz,dist,rcut
>         character(2)::elmnt
> !
> 	real::t1,t2
>         t1=secnds(t1)
> !
> 	seed=12345
> 	BOXL=20
> 	RCUT=1.5
> 	DR=5.0
> 	RMCS=1000
> 
>         ntot=100
>         tr=1
>         write(*,*) &
>         "===============Creating Initial Configuration=============="
>         write(*,&
>        '(1x,"Minimum distance between any two particle is",1x,f6.4)'),
> &
>         rcut
> !-----------------------------------------------
> !          INITIALISE POSITION
> !-----------------------------------------------
> 10        do i=1,ntot
>              x(i)=boxl*(ran(seed)-0.0)
>              y(i)=boxl*(ran(seed)-0.0)
>              z(i)=boxl*(ran(seed)-0.0)
>              call pbc(x,y,z,boxl)
This line can't be what you want.  From looking at PBC, the
call is equivalent to
call pbc(x(1),y(1),z(1),boxl)
I'm sure that what you want is
call pbc(x(I),y(I),z(I),boxl)

Dick Hendrickson
>          end do
> !- - - - - - - - - - - - - - - - - - - - - - - -
> !       KEEPING MINIMUM DIST. BETWEEN ANY TWO
> !       ATOM GREATER THEN  RCUT
> !- - - - - - - - - - - - - - - - - - - - - - - -
>          do i=1,ntot-1
>            do j=i+1,ntot
>             dx=x(i)-x(j)
>             dy=y(i)-y(j)
>             dz=z(i)-z(j)
> 
>             dist=dsqrt(dx*dx+dy*dy+dz*dz)
>             tr=tr+1
> !                    write(*,*) tr
>             if (dist<rcut)go to 10
>            end do
>         end do
>         write(*,'(1x,"Success after",1x,i0,1x,"try")')tr
>         call mindist(x,y,z)
>         write(*,*) &
>         "==========================================================="
>         write(*,*) ""
> 
> !-----------------------------------------------
> !       INITIAL CONFIGURATION DONE
> !-----------------------------------------------
>         t2=secnds(t1)
>         write(*,'("Elapsed Time =",1x,f10.4)'), t2
>         end
> 
> !===========================================
> !       Subroutine to apply periodic
> !       boundary value
> !===========================================
>         subroutine pbc(xx,yy,zz,boxl)
>         implicit none
>         real(selected_real_kind(4))::xx,yy,zz,boxl
> 
>         if(xx.gt. boxl)xx=xx-boxl
>         if(xx.lt.-boxl)xx=xx+boxl
>         if(yy.gt. boxl)yy=yy-boxl
>         if(yy.lt.-boxl)yy=yy+boxl
>         if(zz.gt. boxl)zz=zz-boxl
>         if(zz.lt.-boxl)zz=zz+boxl
>         return
>         end
> 
> !==============================================
> !	Subroutine to calculate minimum
> !	distance between two atom
>         subroutine mindist(x,y,z)
> !==============================================
>         implicit none
>         integer::i,j,p1,p2
>         real(selected_real_kind(8)),dimension(100):: x,y,z
>         real(selected_real_kind(8)):: dist,dx,dy,dz,dmini,dmin
> 	write(*, &
> 	'(" Calculating minimum distance between atoms....",$)')
> 
>         dx=x(1)-x(2)
>         dy=y(1)-y(2)
>         dz=z(1)-z(2)
>         dmini=dsqrt(dx*dx+dy*dy+dz*dz)
>         do i=1,99
>            do j=i+1,100
>         dx=x(i)-x(j)
>         dy=y(i)-y(j)
>         dz=z(i)-z(j)
>         dmin=dsqrt(dx*dx+dy*dy+dz*dz)
>         if (dmini>dmin)then
>         dmini=dmin
>         p1=i
>         p2=j
>         end if
>         end do
>         end do
> 	write(*,*) "DONE"
>         write &
>         (*,'(1x,"Shortest distance between to atom is",2x,f8.6)')dmini
>         write(*,'(1x,"between particle pair",1x,i0," - ",i0)') p1,p2
>         return
>         end
> while running with ifort, its prompting:
> 
> $ ./a.out
>  ===============Creating Initial Configuration==============
>  Minimum distance between any two particle is 1.5000
>  Success after 1680724 try
>  Calculating minimum distance between atoms.... DONE
>  Shortest distance between to atom is  1.626997
>  between particle pair 40 - 92
>  ===========================================================
> 
> Elapsed Time =     0.0623
> 
> but while running with gfortran, its never success...why?
 




 14 Posts in Topic:
compiler problem
rudra <bnrj.rudra@[EMA  2008-05-08 10:20:18 
Re: compiler problem
kargl@[EMAIL PROTECTED]   2008-05-08 17:38:04 
Re: compiler problem
rudra <bnrj.rudra@[EMA  2008-05-10 23:09:46 
Re: compiler problem
Craig Powers <craig.po  2008-05-12 13:57:31 
Re: compiler problem
glen herrmannsfeldt <g  2008-05-12 11:22:51 
Re: compiler problem
"Michael Metcalf&quo  2008-05-12 20:04:21 
Re: compiler problem
glen herrmannsfeldt <g  2008-05-12 13:17:13 
Re: compiler problem
Craig Powers <craig.po  2008-05-12 17:45:30 
Re: compiler problem
lindahl@[EMAIL PROTECTED]  2008-05-12 16:08:25 
Re: compiler problem
"Michael Metcalf&quo  2008-05-12 22:32:25 
Re: compiler problem
kargl@[EMAIL PROTECTED]   2008-05-12 18:09:13 
Re: compiler problem
rudra <bnrj.rudra@[EMA  2008-05-15 21:37:38 
Re: compiler problem
Craig Powers <craig.po  2008-05-16 01:28:35 
Re: compiler problem
Dick Hendrickson <dick  2008-05-16 15:00:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 3:08:18 CDT 2008.