******************************************************************************* program geomchk ******************************************************************************* c c To compile non-graphics programs use : c f77 $(OPT) geomchk.f -o geomchk c real rx(300), ry(300), rz(300) real dax,day,daz,dhx,dhy,dhz real davec,dhvec,udax,uday,udaz real dstart,disp,prod character*80 record(300) character*80 rec character*80 aform character*40 fname character*40 gname character*8 left character*30 right integer i,ia,id,ih integer natom c c print *,'Enter car file name (inside single quotes): ' read(5,*) fname c print *,'Input the number of atoms:' read(5,*) natom c c open(unit=7,file=fname,form='formatted', $ status='old',err=990) c aform = "(a5,3(2x,f13.9),a29)" c read(7,'(a80)',end=997,err=995) record(1) read(7,'(a80)',end=997,err=995) record(2) read(7,'(a80)',end=997,err=995) record(3) read(7,'(a80)',end=997,err=995) record(4) do 200 i=1,natom read(7,'(a80)',end=997,err=995) record(i+4) write(6,'(a80)') record(i+4) read (record(i+4),aform,err=996) left,rx(i), $ ry(i),rz(i),right 200 continue print *,'Input the atom number of end atom#1:' read(5,*) id print *,'Input the atom number of end atom#2:' read(5,*) ia print *,'Input the atom number of the center atom:' read(5,*) ih dax=rx(id)-rx(ih) day=ry(id)-ry(ih) daz=rz(id)-rz(ih) davec=sqrt(dax*dax+day*day+daz*daz) print *,'The center-1 distance is:',davec dhx=rx(ia)-rx(ih) dhy=ry(ia)-ry(ih) dhz=rz(ia)-rz(ih) dhvec=sqrt(dhx*dhx+dhy*dhy+dhz*dhz) print *,'The center-2 distance is:',dhvec prod=(dax*dhx+day*dhy+daz*dhz)/davec/dhvec prod=180/3.1415926*acos(prod) print *,'The angle between C-1 and C-2 is:',prod udax=dax/davec uday=day/davec udaz=daz/davec c close(7) c goto 999 990 continue print *,'Error in input file' goto 999 995 continue print *,'Error in format' print *, record goto 999 996 continue print *,'Error parsing format' print *, record print *,left, rx(i), ry(i), rz(i),right goto 999 997 continue print *,'End of file detected' 999 continue c end c