def check_model_termination(ClockStruct,InitCond):
    """
    Function to check and declare model termination


    *Arguments:*\n

    `ClockStruct` : `ClockStructClass` :  model time paramaters

    `InitCond` : `InitCondClass` :  containing current model paramaters

    *Returns:*

    `ClockStruct` : `ClockStructClass` : updated clock paramaters


    """

    ## Check if current time-step is the last
    CurrentTime = ClockStruct.StepEndTime
    if CurrentTime < ClockStruct.SimulationEndDate:
        ClockStruct.ModelTermination = False
    elif CurrentTime >= ClockStruct.SimulationEndDate:
        ClockStruct.ModelTermination = True


    ## Check if at the end of last growing season ##
    # Allow model to exit early if crop has reached maturity or died, and in
    # the last simulated growing season
    if (InitCond.HarvestFlag == True) \
    and    (ClockStruct.SeasonCounter == ClockStruct.nSeasons-1):

            ClockStruct.ModelTermination = True



    return ClockStruct