00001 subroutine read_parameter_pbh_mpt(impt)
00002   use phys_constant, only : long, pi
00003   use def_bh_parameter
00004   use def_binary_parameter, only : mass_ratio
00005   implicit none
00006   integer,intent(in)  :: impt
00007   character(len=1) :: np(5) = (/'1', '2','3', '4', '5'/)
00008   character(len=3) :: spin_input
00009   real(long) :: spin_bh_xy
00010   open(1,file='pbhpar_mpt'//np(impt)//'.dat',status='old')
00011   read(1,'(1p,1e14.6,2x,a3)') mass_pBH, spin_input
00012   read(1,'(1p,1e14.6,3x,a2)') mass_ratio, bh_soltype
00013   read(1,'(1p,2e14.6)') ome_bh, spin_bh
00014   read(1,'(1p,2e14.6)') th_spin_bh_deg, phi_spin_bh_deg
00015   read(1,'(1p,2e14.6)') mom_pBH(1), spin_pBH(1)
00016   read(1,'(1p,2e14.6)') mom_pBH(2), spin_pBH(2)
00017   read(1,'(1p,2e14.6)') mom_pBH(3), spin_pBH(3)
00018   close(1)
00019   if (spin_input.eq.'ANG') then 
00020     th_spin_bh  = pi* th_spin_bh_deg/180.0d0
00021     phi_spin_bh = pi*phi_spin_bh_deg/180.0d0
00022     spin_pBH(1) = spin_bh*dsin(th_spin_bh)*dcos(phi_spin_bh)
00023     spin_pBH(2) = spin_bh*dsin(th_spin_bh)*dsin(phi_spin_bh)
00024     spin_pBH(3) = spin_bh*dcos(th_spin_bh)
00025   else 
00026     spin_bh = dsqrt(spin_pBH(1)**2 + spin_pBH(2)**2 + spin_pBH(3)**2)
00027     spin_bh_xy = dsqrt(spin_pBH(1)**2 + spin_pBH(2)**2)
00028     if (spin_bh.eq.0.0d0) then 
00029       th_spin_bh  = 0.0d0 ; th_spin_bh_deg  = 0.0
00030       phi_spin_bh = 0.0d0 ; phi_spin_bh_deg = 0.0
00031     else if (spin_bh_xy.eq.0.0d0) then 
00032       th_spin_bh  = dmod(atan2(spin_bh_xy,spin_pbh(3))+2.0d0*pi,2.0d0*pi)
00033       th_spin_bh_deg  = th_spin_bh*180.0d0/pi
00034       phi_spin_bh = 0.0d0 ; phi_spin_bh_deg = 0.0
00035     else 
00036       th_spin_bh  = dmod(atan2(spin_bh_xy,spin_pbh(3))+2.0d0*pi,2.0d0*pi)
00037       th_spin_bh_deg  = th_spin_bh*180.0d0/pi
00038       phi_spin_bh = dmod(atan2(spin_pbh(2),spin_pbh(1))+2.0d0*pi,2.0d0*pi)
00039       phi_spin_bh_deg = phi_spin_bh*180.0d0/pi
00040     end if
00041   end if
00042   bh_sptype = 'SP'
00043   if (th_spin_bh_deg.eq.90.0.or.phi_spin_bh_deg.eq.  0.0) bh_sptype = 'Xp'
00044   if (th_spin_bh_deg.eq.90.0.or.phi_spin_bh_deg.eq. 90.0) bh_sptype = 'Yp'
00045   if (th_spin_bh_deg.eq.90.0.or.phi_spin_bh_deg.eq.180.0) bh_sptype = 'Xm'
00046   if (th_spin_bh_deg.eq.90.0.or.phi_spin_bh_deg.eq.270.0) bh_sptype = 'Ym'
00047   if (th_spin_bh_deg.eq.  0.0) bh_sptype = 'Zp'
00048   if (th_spin_bh_deg.eq.180.0) bh_sptype = 'Zm'
00049 end subroutine read_parameter_pbh_mpt