#  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/>.


def jost_corr_surf(Q,epsilon,R):
    """Caculates the Jost correction for a surface."""

    from ..data import unitconvert

    # h_to_eV = 27.2114  #Hartree to eV conversion factor
    correction_surf = -((Q*Q)*(epsilon-1))/(2*R*(epsilon+1)) #* h_to_eV
    correction_surf *= unitconvert.Ha2eV

    return correction_surf

def jost_corr_bulk(Q,epsilon,R):
    """Caculates the Jost correction for a bulk."""

    from ..data import unitconvert

    #h_to_eV = 27.2114  #Hartree to eV conversion factor
    correction_bulk = -((Q*Q)/(2*R))*(1-(1/epsilon)) #* h_to_eV
    correction_bulk *= unitconvert.Ha2eV

    return correction_bulk
