Commit 1a366ff8 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1741 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent c5766e2f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ You need to create a user input file. In the examples folder you will find
an example input script, LAMMPS dump file, and the correct .cfg output. 
The input script reads like this:

2898           #total number of atoms in system (may be more than in dump)
7              #number of atom types in your LAMMPS file       
'dump.atom'    #name of the LAMMPS dump file, you need the ' '
1              #first frame
+1 −1
Original line number Diff line number Diff line
Number of particles =    2898
#

A = 1.5 Angstrom
A = 1.0 Angstrom
#

 H0(1,1) =   26.05200 A
+1 −1
Original line number Diff line number Diff line
Number of particles =    2898
#

A = 1.5 Angstrom
A = 1.0 Angstrom
#

 H0(1,1) =   26.05200 A
+1 −0
Original line number Diff line number Diff line
2898
7
'dump.atom'
1
+164 −184
Original line number Diff line number Diff line
@@ -4,49 +4,56 @@ c----------------------------------------------------------------------
c----------------------------------------------------------------------
*Programming by Jeff Greathouse and Ara Kooser
*Version 1.0 9/1/04
*Version 1.1 4/10/08 by Axel Kohlmeyer
*Sandia National Labs
*Converts LAMMPS atom dump to .cfg files for AtomEye
*This program is provided as is. Please see the README file.
c----------------------------------------------------------------------
      implicit real*8 (a-h,o-z)
      implicit none
      
      character*12 inhist,snapshot
      character*4 fftype(100),name,ciframe

      integer natom,iatom,itype(50000),q
      integer atype(99),itycon,ntype,mass(99)
      integer maxatom,maxtype
      parameter(maxatom=50000,maxtype=99)

      dimension x(50000),y(50000),z(50000)
      dimension amass(99)
      integer i,j,iframe,iframe1,iframe2,jframe
      integer natom,iatom,allatom,itype(maxatom)
      integer atype(maxtype),ntype,mass(maxtype)

      real*8 x(maxatom),y(maxatom),z(maxatom),amass(maxtype)
      real*8 xcell,ycell,zcell,upper,lower


c-------Reads in the user input file-------------------------------
      read(*,*) allatom
      if(allatom.gt.maxatom) then
        write(*,*) 'number of total atoms larger than:',maxatom
        write(*,*) 'change maxatom and recompile'
        STOP
      endif

      read(*,*) ntype
      if(ntype.gt.maxtype) then
        write(*,*) 'number of total types larger than:',maxtype
        write(*,*) 'change maxtype and recompile'
        STOP
      endif

      read(*,*) inhist
      read(*,*) iframe1
      read(*,*) iframe2
c          write(*,*) ntype
c          write(*,*) inhist
       do 1, i=1, ntype

      do 1, i=1, ntype
        read(*,*) atype(i)
        read(*,*) amass(i)
        mass(i)=anint(amass(i))  
        read(*,*) fftype(i)

       
c          write(*,*) atype(i)
c          write(*,*) amass(i)
c          write(*,*) fftype(i)
 1    continue

c-------Lammps output file is 9, reads in lmps header--------------         

      name=inhist(1:4)
      open(9,file=inhist,status='old',form='formatted')
c         open(2,status='new',form='formatted')


      iatom=0
      iframe=0
@@ -56,41 +63,29 @@ c---------------------------------------------------------------------
c----------This begins the frame by frame reading section-------------

 9999 continue

      read(9,*,end=999)
      read(9,*,end=999)
      read(9,*,end=999)
      read(9,*,end=999) natom
      read(9,*,end=999)
         read(9,*,end=999) xlower,xupper
         read(9,*,end=999) ylower,yupper
         read(9,*,end=999) zlower,zupper
      read(9,*,end=999) lower,upper
      xcell=upper-lower
      read(9,*,end=999) lower,upper
      ycell=upper-lower
      read(9,*,end=999) lower,upper
      zcell=upper-lower
      read(9,*,end=999)
 50      format(2f12.5)
         xcell=xupper-xlower
         ycell=yupper-ylower
         zcell=zupper-zlower
          



 1000    format(1x,i5,1x,i2,3f9.5)
         




         
C clear data array.
      do 400 j=1,allatom
        itype(j)=0
        x(j)=0.0d0
        y(j)=0.0d0
        z(j)=0.0d0
 400  continue

      do 440 j=1,natom
 420      read(9,*,end=999)iatom,itype(iatom),x(iatom),y(iatom),z(iatom)


*23456789|123456789|123456789|123456789|123456789|123456789|123456789|12 


 

        read(9,*,end=999)iatom,itype(iatom),x(iatom),y(iatom),z(iatom)
 440  continue

      jframe=jframe+1
@@ -102,16 +97,8 @@ c----------This begins the frame by frame reading section-------------

c--------------------------------------------------------------------
c-------This section writes each ts to a seperate .cfg file----------

c         ciframe=char(iframe)
c         snapshot(iframe)=name//ciframe//'.cfg'
c         write(*,*)ciframe
         
c         write(snapshot,'("Cfgs/",i7.7,".cfg")') iframe
      ciframe='.cfg'
c         write(*,*)ciframe 
      write(snapshot,'(i5.5,a4)')iframe,ciframe
c         write(*,*)snapshot
      open(unit=iframe+20,file=snapshot,status='new',
     *    form='formatted')

@@ -159,26 +146,19 @@ c write(*,*)snapshot
          
 435  format(a11,f10.5,a2)

          do 460, j=1,natom
          
      do 460, j=1,allatom
        do 450,i=1,ntype
c            write(*,*)i,amass(i),fftype(i) 
c             write(*,*)ntype
          if(itype(j).eq.atype(i))
     *        write((iframe+20),445)mass(i),fftype(i),x(j),
     *        y(j),z(j),' 0',' 0',' 0'

c---445 is the format for writing atom data to .cfg file------------
 445      format(i3.3,1x,a2,1x,3f9.6,3a2)

 450    continue

 460  continue

      go to 9999

 999  continue
      close(9)      


      end