Modified for partial trajectory integration

This will be necessary for data assimilation
where observations are at different times.
Verified adjoint validity for partial integration