读取约束实现数据的例程

时间:2014-05-25 20:33:44

标签: gcc fortran

任何人都可以在this MPA网站上简短地描述或给出阅读例程的命令吗? 我现在不知道如何使用gcc-Version 4.7.2 20120921(Red Hat 4.7.2-2)在Fedora 17 32bit上使用这些Fortran文件。 例如,ReadGalCat.F

program ReadGalCat



integer*4 ngals

integer*4, dimension(:), allocatable :: IdGal,InGroup,MassGroup,Code

real*4, dimension(:), allocatable :: PosX,PosY,PosZ,VelX,VelY,VelZ
real*4, dimension(:), allocatable :: LumTotB,LumTotV,LumTotI,LumTotK,&
     &LumBulB,LumBulV,LumBulI,LumBulK


real*4, dimension(:), allocatable :: CGas,Stellar,Bulge,SFR,ZLast,VirmLast,Vc


character*100 base
character*100 ext
character*100 fname

implicit none


!base='/mybase/'
!ext='myext.halos'

base='/gpfs/mpa/hmathis/WebSiteCR/LCDM/'
ext='cat_cutLum.gals'


fname=base(1:len_trim(base))//ext

print *,'Reading : ',fname



open(1,file=fname,form='unformatted',status='old')

read(1) ngals
print*,'ngals : ',ngals



allocate(IdGal(ngals),InGroup(ngals),MassGroup(ngals),Code(ngals))
allocate(PosX(ngals),PosY(ngals),PosZ(ngals),VelX(ngals),VelY(ngals),VelZ(ngals))
allocate(LumTotB(ngals),LumTotV(ngals),LumTotI(ngals),LumTotK(ngals),&
     &LumBulB(ngals),LumBulV(ngals),LumBulI(ngals),LumBulK(ngals))
allocate(CGas(ngals),Stellar(ngals),Bulge(ngals),SFR(ngals),ZLast(ngals),VirmLast(ngals),Vc(ngals))




read(1) IdGal ! the index of the particle the galaxy is associated with
read(1) InGroup ! the index (i.e. the rank in the halo cat file) of the halo hosting the galaxy          
read(1) MassGroup ! the number of particles of that halo (found by the groupfinder)
read(1) Code ! 0 for central galaxy, 1 for satellite galaxy



read(1) PosX ! comoving position of particle attached to the galaxy SGX in kpc/h (origin = Milky Way)
read(1) PosY ! --- SGY in kpc/h (origin = Milky Way)
read(1) PosZ ! --- SGZ in kpc/h (origin = Milky Way)
read(1) VelX ! peculiar velocity of the particle attached to the galaxy in km/s
read(1) VelY ! ---
read(1) VelZ ! ---


read(1) LumTotB ! total B band luminosity in Lsol
read(1) LumTotV ! total V band luminosity in Lsol
read(1) LumTotI ! total I band luminosity in Lsol
read(1) LumTotK ! total K band luminosity in Lsol
read(1) LumBulB ! bulge B band luminosity in Lsol
read(1) LumBulV ! bulge V band luminosity in Lsol
read(1) LumBulI ! bulge I band luminosity in Lsol
read(1) LumBulK ! bulge K band luminosity in Lsol

read(1) CGas ! mass of cold gas in Msol/h
read(1) Stellar ! total stellar mass in Msol/h
read(1) Bulge ! bulge stellar mass in Msol/h
read(1) SFR ! total (starburst+quiescent) SFR during last redshift interval in Msol/h/year

read(1) ZLast ! redshift when the galaxy was last a central galaxy
read(1) VirmLast ! virial mass of the halo when the galaxy was last a central galaxy
read(1) Vc ! disk circular velocity in km/s


close(1)


print*, 'Read ...'


print* ,'min,max PosX : ',minval(PosX),maxval(PosX)
print* ,'min,max PosY : ',minval(PosY),maxval(PosY)
print* ,'min,max PosZ : ',minval(PosZ),maxval(PosZ)


print* ,'min,max VelX : ',minval(VelX),maxval(VelX)
print* ,'min,max VelY : ',minval(VelY),maxval(VelY)
print* ,'min,max VelZ : ',minval(VelZ),maxval(VelZ)

print* ,'min,max IdGal : ',minval(IdGal),maxval(IdGal)
print* ,'min,max Code : ',minval(Code),maxval(Code)
print* ,'min,max InGroup : ',minval(InGroup),maxval(InGroup)
print* ,'min,max MassGroup : ',minval(MassGroup),maxval(MassGroup)


print* ,'min,max LumTotB : ',minval(LumTotB),maxval(LumTotB)
print* ,'min,max LumTotV : ',minval(LumTotV),maxval(LumTotV)
print* ,'min,max LumTotI : ',minval(LumTotI),maxval(LumTotI)
print* ,'min,max LumTotK : ',minval(LumTotK),maxval(LumTotK)

print* ,'min,max LumBulB : ',minval(LumBulB),maxval(LumBulB)
print* ,'min,max LumBulV : ',minval(LumBulV),maxval(LumBulV)
print* ,'min,max LumBulI : ',minval(LumBulI),maxval(LumBulI)
print* ,'min,max LumBulK : ',minval(LumBulK),maxval(LumBulK)

print* ,'min,max ColdG : ',minval(CGas),maxval(CGas)
print* ,'min,max Stellar : ',minval(Stellar),maxval(Stellar)
print* ,'min,max Bulge : ',minval(Bulge),maxval(Bulge)
print* ,'min,max SFR : ',minval(SFR),maxval(SFR)

print* ,'min,max ZLast : ',minval(ZLast),maxval(ZLast)
print* ,'min,max Virm : ',minval(VirmLast),maxval(VirmLast)
print* ,'min,max Vc : ',minval(Vc),maxval(Vc)


stop

end

0 个答案:

没有答案