[Fortran] 纯文本查看 复制代码
program PDBtodata
implicit none
character chr1*6,chr2*2,chr3*6,chr4*4,chr5*8,header*80,atmnam*8,ww*200,xx*80,cc*80,&
vv*80,nn*80,sss*100
character elmname*3,tt*5
character filename*12,kk*50,jj*200
character*10 bb(3)
integer i,j,atomtypes,atomtyp,atomser,natom,nf,R,zz,o,gg,mm,n(9),ntype,ios
integer:: date_time(8)
real(kind=8) a,b,c,xlo,xhi,ylo,yhi,zlo,zhi,alpha,beta,gamma,&
xy,xz,yz,charge,mass(1:7),lx,ly,lz,x,y,z,q,qq,ff
real(kind=8), parameter :: pi=3.1415926
write(*,*)'filename: '
read(*,*)filename
open(5,file=filename,status='old')
open(6,file='105.data')
open(7,file='data')
open(8,file='da2222ta')
open(9,file='da333333ta')
open(15,file='dqa')
open(20,file='fort.7',status='old')
write(6,*)
xlo=0.0
ylo=0.0
zlo=0.0
mass=0.0
atomtyp=0
q=0.0
read(5,*)
read(5,*)
read(5,*)chr3,a,b,c,alpha,beta,gamma,chr4
alpha=(alpha/180.0)*Pi
beta=(beta/180.0)*Pi
gamma=(gamma/180.0)*Pi
lx=a
xy=b*dcos(gamma)
xz=c*dcos(beta)
ly=dsqrt(b*b-xy*xy)
yz=(b*c*dcos(alpha)-xy*xz)/ly
lz=dsqrt(c*c-xz*xz-yz*yz)
xhi=lx
yhi=ly
zhi=lz
write(6,*)'1',' 1000cddd'
write(6,*)xlo,xhi,'xlo xhi'
write(6,*)ylo,yhi,'ylo yhi'
write(6,*)zlo,zhi,'zlo zhi'
write(6,*)
write(6,*)xy,xz,yz,'xy xz yz'
write(6,*)
mass(1)=12.011150
mass(2)=1.007970
mass(3)=15.999400
mass(4)=14.006700
mass(7)=26.981539
write(6,*)'Masses'
write(6,*)
do i=1,6
read(5,*)
enddo
write(6,*)'1',' 1000cddd'
do
read(5,"(a)")jj
if(index(jj,"ATOM") > 0) then
i=i+1
read(jj(32:),"(a)")kk
kk=adjustl(kk)
read(kk,*)x,y,z,ff,charge,elmname
if (index(elmname,"C") > 0) then
atomtyp=1
else if (index(elmname,"H") > 0) then
atomtyp=2
else if (index(elmname,"O") > 0) then
atomtyp=3
else if (index(elmname,"N") > 0) then
else if (index(elmname,"Al") > 0) then
atomtyp=5
write(9,500)i,atomtyp,q,x,y,z
endif
endif
enddo
200 FORMAT(I6,A8)
300 FORMAT(I6,A12)
500 FORMAT(I6,I3,F9.6,3F15.9)
close(5)
close(6)
if(.true.) then
open(22,file='105.data')
write(22,*)'1',' 1000cddd'
endif
end