c------------------------------------------------------------------------------- c MAGMOD Simulator for NEOMOD c c Based on the parameters listed in the parameter file (neomod.par), c the code generates absolute magnitudes for model NEOs. c c The currently available magnitude range is 928 are extrapolations c c Compile: ifort -o magmod_simulator magmod_simulator.f or gfortran -o magmod_simulator magmod_simulator.f c Run: magmod_simulator < magmod.par > output_file.txt c See magmod.par for input parameters c------------------------------------------------------------------------------- implicit NONE character*100 filename,modelname integer iseed,j integer nh,nseg,npoint,nneo,counter real*8 nneo_float,hmag1,hmag2,maxmod,ran3,hmag,wmod real*8 minh,maxh,href,nref,hpoint(100),minh2,maxh2,gamma(100) real*8 nlogp(100),y2(100),nlog0,yp1,ypn,nreal,nmag1,nmag2 real*8 dh,hmagleft,hmagright c Read input parameters from neomod.par read(*,'(a)')filename ! NEO model file (only for bookkeeping) read(*,*)iseed ! seed for the random number generator read(*,*)nneo_float ! number of NEOs to be generated, <=0 for real number read(*,*)hmag1,hmag2 ! desired magnitude range if(hmag1.ge.hmag2) then write(*,*)'hmag2 in neomod.par must be greater than hmag1' write(*,*)'Exiting...' stop end if c Read the header of the model file open(1,file=filename,status='old') read(1,'(a)')modelname read(1,*)nh,minh,maxh ! absolute magnitude binning: # of H bins, Hmin,Hmax read(1,*)href,nref ! reference magnitude, reference pop read(1,*)nseg ! number of spline segments for absolute magnitude distribution npoint=nseg+1 ! number of boundaries between segments read(1,*)(hpoint(j),j=1,npoint) ! segment boundaries minh2=hpoint(1) maxh2=hpoint(npoint) if(hmag1.lt.minh2) then write(*,*) &'The requested magnitude range is outside of model domain' write(*,*)'hmag1 in neomod.par must be >= than ',minh2 write(*,*)'Exiting...' stop end if if(hmag2.gt.maxh2) then write(*,*) &'The requested magnitude range is outside of model domain' write(*,*)'hmag2 in neomod.par must be <= than ',maxh2 write(*,*)'Exiting...' stop end if read(1,*)(gamma(j),j=1,nseg) ! segment slopes (-1.0 indicates N(<15)=50) close(1) c Define cumulative magnitude distribution logN(