c kspectrum (http://www.meso-star.com/en_Products.html) - This file is part of kspectrum c Copyright (C) 2008-2015 - Méso-Star - Vincent Eymet c c This file must be used under the terms of the CeCILL license. c This source file is licensed as described in the file COPYING, which c you should have received as part of this distribution. The terms c are also available at c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt c subroutine indexes(Nmol,mol_index,iso_index, & mol_niso,index,isotope,molec,isotop,isotopf) implicit none include 'max.inc' c c Purpose: to retrieve "molec" and "isotop" the indexes of arrays c "mol_index", "iso_index", etc... that correspond to molecule c number "index" with isotope number "isotope" (used in the HITRAN database) c c Inputs: c + Nmol: number of molecules used in the HITRAN database c + mol_index: indexes of the HITRAN molecules c + iso_index: indexes of the HITRAN isotopes c + mol_niso: number of isotopes for each molecule c + index: number of the HITRAN molecule c + isotope: number of the HITRAN isotope c c Outputs: c + molec: index (in array "mol_index") of molecule "index" c + isotop: index (in array "mol_index") of isotope "isotope" c + isotopf: 0 if "isotop" index not found; 1 if found c c I/O integer Nmol,molec,isotop,i,index,isotope integer mol_index(1:Nmol_max) integer mol_niso(1:Nmol_max) integer iso_index(1:Nmol_max,1:Niso_max) integer molecf,isotopf c temp integer strlen character*(Nchar_mx) label label='subroutine indexes' c Debug c write(*,*) 'IN ',label(1:strlen(label)) c write(*,*) 'index=',index c Debug molecf=0 do i=1,Nmol if (mol_index(i).eq.index) then molec=i molecf=1 c Debug c write(*,*) 'mol_index(',i,')=',mol_index(i) c Debug goto 123 endif enddo 123 continue if (molecf.eq.0) then write(*,*) 'Error from ',label(1:strlen(label)),' :' write(*,*) 'molec could not be found for index=',index write(*,*) 'Nmol=',Nmol do i=1,Nmol write(*,*) 'mol_index(',i,')=',mol_index(i) enddo stop endif c Debug c write(*,*) 'mol_niso(',molec,')=',mol_niso(molec) c do i=1,mol_niso(molec) c write(*,*) 'iso_index(',molec,',',i,')=',iso_index(molec,i) c enddo c write(*,*) 'isotope=',isotope c Debug isotopf=0 isotop=0 do i=1,mol_niso(molec) if (iso_index(molec,i).eq.isotope) then isotop=i isotopf=1 goto 124 endif enddo c if (isotopf.eq.0) then c write(*,*) 'Error from routine indexes:' c write(*,*) 'isotop could not be found for isotope=',isotope c write(*,*) 'index=',index,' molec=',molec c do i=1,mol_niso(molec) c write(*,*) 'iso_index(',molec,',',i,')=',iso_index(molec,i) c enddo c stop c endif 124 continue c Debug c write(*,*) 'molec=',molec c write(*,*) 'OUT ',label(1:strlen(label)) c Debug return end