      SUBROUTINE FILLENGY(LVSED,NVTS,IVTS,ABDISO,ENGY,VSTSCM)
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C FILLENGY FINDS THE UPPER AND LOWER VIBRATIONAL ENERGIES FOR EACH
C TRANSITION SIMULATED. THE ISOTOPIC ABUNDANCES ARE ALSO OBTAINED.
C
C INPUT PARAMETERS:
C
C   LVSED  --- UNIT NUMBER OF VIBRATIONAL STATE PARAMETER DATABASE.
C   NVTS   --- NUMBER OF VIBRATIONAL TRANSITIONS SIMULATED.
C   IVTS   --- PSUEDO GAS ID'S OF SIMULATED VIBRATIONAL TRANSITIONS.
C   VSTSCM --- UPPER/LOWER VIBRATIONAL STATE DESIGNATIONS (kp_setnlte).
C
C OUTPUT PARAMETERS:
C
C   ABDISO --- ISOTOPIC ABUNDANCE.
C   ENGY   --- UPPER/LOWER ENERGIES OF SIMULATED TRANSITIONS (CM-1).
C
C SOFTWARE WRITTEN BY Christopher J. Mertens
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C      (c) Copyright 1987-2000 by GATS, Inc.
C          11864 Canon Blvd., Suite 101, Newport News, Virginia, 23606
C          Phone: (757) 873-5920
C
C  All Rights Reserved. No part of this software or publication may be
C  reproduced, stored in a retrieval system, or transmitted, in any form
C  or by any means, electronic, mechanical, photocopying, recording, or
C  otherwise without the prior written permission of GATS, Inc.
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      PARAMETER(NVLEVMAX=50)
      CHARACTER*8 VSTSCM(2,NVTS),VSTATES(NVLEVMAX)
      DIMENSION IVTS(NVTS),ABDISO(NVTS),ENGY(2,NVTS)
      DIMENSION VENG(NVLEVMAX),DEGEN(NVLEVMAX)

      DO IV=1,NVTS
        IDV=IVTS(IV)/10000
	CALL KP_VSEDRD(LVSED,IDV,NVLEVS,XISO,VENG,DEGEN,VSTATES)
	ABDISO(IV)=XISO
	DO IS=1,2
	  DO IVLEV=1,NVLEVS
	    IF(VSTSCM(IS,IV).EQ.VSTATES(IVLEV)) GO TO 3
	  ENDDO
	  WRITE(*,*) 'ERROR IN VIBRATIONAL STATE DESIGNATIONS'
	  STOP 'STOP IN FILLENGY'
 3        ENGY(IS,IV)=VENG(IVLEV)
        ENDDO
      ENDDO
      RETURN
      END
