******************************************************************************* program MC_to_MD ******************************************************************************* c c This program is designed to convert a data file to BIOSYM format c The input file for the nvt Monte Carlo simulation can be read in c and then converted to a car file c c To compile non-graphics programs use : c f77 $(OPT) MC_to_MD.f -o MC_to_MD parameter (n = 1000) real rx(n), ry(n), rz(n) real length, density, sigma, angle character*40 fname character*40 gname integer natom c c print *,'Enter MC filename (inside single quotes) : ' read(5,*) fname c call readcn( fname, rx, ry, rz, natom ) c print *,'This cell is in reduced Lennard-Jones units' print *,'The cell is of unit length' print *,'To convert to Angstroms you must input the density' print *,'and the value of the L-J sigma parameter' print *,'Input sigma:' read(5,*) sigma print *,'Input box length in reduced units:' read(5,*) length length=length*sigma c print *,'Enter MD filename (inside single quotes): ' read(5,*) gname c open(unit=7,file=gname,form='formatted', $ status='new',err=990) c angle = 90.0000 write(7,'(a17)') '!BIOSYM archive 3' write(7,'(a6)') 'PBC=ON' write(7,'(a20)') ' ' write(7,'(a29)') '!DATE Mon Dec 19 3:10:05 2000' write(7,210) length, length, length, angle, angle, angle do 200 i=1,natom rx(i) = rx(i)*sigma ry(i) = ry(i)*sigma rz(i) = rz(i)*sigma write(7,220) i,rx(i), ry(i), rz(i),i 200 continue 210 format('PBC ',5(f9.6,1x),f9.6,'(P1)') 220 format('AR',i3,3(2x,f13.9),1x,'ARH ',i3, $ ' ar Ar 0.000') write(7,170) 'end' write(7,170) 'end' 170 format(a3) goto 999 990 continue print *,'Error in output file' 999 continue c end SUBROUTINE READCN ( CNFILE, RX, RY, RZ, NN ) C ******************************************************************* C ** SUBROUTINE TO READ IN INITIAL CONFIGURATION FROM UNIT 10 ** C ******************************************************************* INTEGER N,I PARAMETER ( N = 1000 ) CHARACTER CNFILE*(*) CHARACTER*80 RECORD REAL RX(N), RY(N), RZ(N) INTEGER CNUNIT, NN PARAMETER ( CNUNIT = 10 ) C ****************************************************************** OPEN ( UNIT = CNUNIT, FILE = CNFILE, STATUS = 'OLD', : FORM = 'FORMATTED' ) READ( CNUNIT,'(A80)',END=3000,ERR=3000) RECORD print *, record READ(RECORD,130,ERR=3000) NN print *,nn C IF ( NN .NE. N ) STOP ' INCORRECT NUMBER OF ATOMS ' READ( CNUNIT,'(A80)',END=3000,ERR=3000) RECORD READ( CNUNIT,'(A80)',END=3000,ERR=3000) RECORD READ( CNUNIT,'(A80)',END=3000,ERR=3000) RECORD DO 2000 I=1,NN READ( CNUNIT,'(A80)',END=3000,ERR=3000) RECORD READ(RECORD,120,ERR=3000) RX(I), RY(I), RZ(I) 2000 CONTINUE 120 FORMAT(3(F12.6),A44) 130 FORMAT(1X,I4,A75) CLOSE ( UNIT = CNUNIT ) GOTO 3001 3000 CONTINUE PRINT *,'ERROR IN READCN' 3001 CONTINUE RETURN END