!  Copyright (C) 2017 The authors of Py-ChemShell
!
!  This file is part of Py-ChemShell.
!
!  Py-ChemShell is free software: you can redistribute it and/or modify
!  it under the terms of the GNU Lesser General Public License as
!  published by the Free Software Foundation, either version 3 of the
!  License, or (at your option) any later version.
!
!  Py-ChemShell is distributed in the hope that it will be useful,
!  but WITHOUT ANY WARRANTY; without even the implied warranty of
!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  GNU Lesser General Public License for more details.
!
!  You should have received a copy of the GNU Lesser General Public
!  License along with Py-ChemShell.  If not, see
!  <http://www.gnu.org/licenses/>.

subroutine getfilenames(infile, outfile, len)
    character(len=len), intent(out) :: infile, outfile
    integer           , intent(in)  :: len

    integer, external :: ipg_nnodes

    ! FIXME: dynamically obtain the names
    infile  = "_gamess-uk.in"
    outfile = "_gamess-uk.out"

endsubroutine getfilenames
integer function gamess_chemsh_comm() result(communicator)

    use ChemShellParallelModule, only : chemsh_parallel

    ! chemsh_comm_workgroup in TCS's src/interface_gamess_2/link_gamess.c
    communicator = chemsh_parallel%comm_workgroup

endfunction gamess_chemsh_comm
! always required by GAMESS-UK/ChemShell interface: see int default_heap_() in TCS's src/chemsh/chem.c and GAMESS-UK's m4/machscf.m
integer function default_heap() result(heap)

    heap = 20000000

endfunction default_heap
! TO IMPLEMENT
subroutine gamessjumpout(icode)

    integer :: icode
    integer :: ijunk
    integer(kind=8) :: gms_jmp_buf

!    call longjmp(gms_jmp_buf,ijunk)
    print *, "### gamessjumpout..."

endsubroutine gamessjumpout
