def step_c1(self, state, dt): pos_init = state.pos.copy() state.pos += dt * self.system.dh_dmom(state) pos_fwd = state.pos.copy() self.step_c2(state, -dt) rev_diff = self.reverse_check_norm(state.pos - pos_init) if rev_diff > self.reverse_check_tol: raise NonReversibleStepError( f'Non-reversible step. Distance between initial and ' f'forward-backward integrated positions = {rev_diff:.1e}.') state.pos = pos_fwd
def step_b2(self, state, dt): mom_init = state.mom.copy() state.mom -= dt * self.system.dh2_dpos(state) mom_fwd = state.mom.copy() self.step_b1(state, -dt) rev_diff = self.reverse_check_norm(state.mom - mom_init) if rev_diff > self.reverse_check_tol: raise NonReversibleStepError( f'Non-reversible step. Distance between initial and ' f'forward-backward integrated momentums = {rev_diff:.1e}.') state.mom = mom_fwd
def step_b(self, state, dt): dt_i = dt / self.n_inner_step for i in range(self.n_inner_step): state_prev = state.copy() self.step_b_inner(state, dt_i) self.project_onto_manifold(state, state_prev) self.solve_for_mom_post_projection(state, state_prev, dt_i) self.project_onto_cotangent_space(state) state_back = state.copy() self.step_b_inner(state_back, -dt_i) self.project_onto_manifold(state_back, state) rev_diff = self.reverse_check_norm(state_back.pos - state_prev.pos) if rev_diff > self.reverse_check_tol: raise NonReversibleStepError( f'Non-reversible step. Distance between initial and ' f'forward-backward integrated positions = {rev_diff:.1e}.')