FUNCTION shorten_eos_name( eos_long ) RESULT( eos_str )
!*********************************************
! *
! Converts the longer names from LORENE *
! to the 4-character strings needed by *
! select_EOS_parameters *
! *
! FT 11.08.2021 *
! *
! Last update FT 28.03.2023 *
! *
!*********************************************
IMPLICIT NONE
CHARACTER(4):: eos_str
CHARACTER(LEN=*), INTENT(IN):: eos_long
IF( INDEX(eos_long, 'SLy ') /= 0 .OR. INDEX(eos_long, 'sly ') /= 0 )THEN
eos_str= 'SLy '
ELSEIF( INDEX(eos_long, 'ALF2') /= 0 .OR. INDEX(eos_long, 'alf2') /= 0 )THEN
eos_str= 'ALF2'
ELSEIF( INDEX(eos_long, 'ALF4') /= 0 .OR. INDEX(eos_long, 'alf4') /= 0 )THEN
eos_str= 'ALF4'
ELSEIF( INDEX(eos_long, 'ENG ') /= 0 .OR. INDEX(eos_long, 'eng ') /= 0 )THEN
eos_str= 'ENG '
ELSEIF( INDEX(eos_long, 'H4 ') /= 0 .OR. INDEX(eos_long, 'h4 ') /= 0 )THEN
eos_str= 'H4 '
ELSEIF( INDEX(eos_long, 'MPA1') /= 0 .OR. INDEX(eos_long, 'mpa1') /= 0 )THEN
eos_str= 'MPA1'
ELSEIF( INDEX(eos_long, 'MS1 ') /= 0 .OR. INDEX(eos_long, 'ms1 ') /= 0 )THEN
eos_str= 'MS1 '
ELSEIF( INDEX(eos_long, 'MS1b') /= 0 .OR. INDEX(eos_long, 'ms1b') /= 0 )THEN
eos_str= 'MS1b'
ELSEIF( INDEX(eos_long, 'APR3') /= 0 .OR. INDEX(eos_long, 'apr3') /= 0 )THEN
eos_str= 'AP3'
ELSEIF( INDEX(eos_long, 'AP3 ') /= 0 .OR. INDEX(eos_long, 'ap3 ') /= 0 )THEN
eos_str= 'AP3 '
ELSEIF( INDEX(eos_long, 'APR4') /= 0 .OR. INDEX(eos_long, 'apr4') /= 0 )THEN
eos_str= 'APR4'
ELSEIF( INDEX(eos_long, 'AP4 ') /= 0 .OR. INDEX(eos_long, 'ap4 ') /= 0 )THEN
eos_str= 'APR4'
ELSEIF( INDEX(eos_long, 'WFF1') /= 0 .OR. INDEX(eos_long, 'wff1') /= 0 )THEN
eos_str= 'WFF1'
ELSEIF( INDEX(eos_long, 'WFF2') /= 0 .OR. INDEX(eos_long, 'wff2') /= 0 )THEN
eos_str= 'WFF2'
ELSEIF( INDEX(eos_long, 'HASO') /= 0 .OR. INDEX(eos_long, 'haso') /= 0 )THEN
eos_str= 'haso'
ELSEIF( eos_long == 'Polytropic EOS' .OR. INDEX(eos_long, 'gam') /= 0 )THEN
eos_str= 'POLY'
ELSE
PRINT *, "** ERROR! Unknown EOS name: ", TRIM(eos_long)
PRINT *, " * Please add the name to SUBROUTINE shorten_eos_name. "
PRINT *, " * Stopping..."
PRINT *
STOP
ENDIF
END FUNCTION shorten_eos_name