def compose(self): # extract parameters from the internal list dist, shift1, shift2, tau1, tau2, tau3 = self._param # convert angles to radians tau1rad = tau1.value / 1000.0 tau2rad = tau2.value / 1000.0 tau3rad = tau3.value / 1000.0 # compose rotation matrices and their first order derivatives Tau1 = (tau1.axis).axis_and_angle_as_r3_rotation_matrix(tau1rad, deg=False) dTau1_dtau1 = dR_from_axis_and_angle(tau1.axis, tau1rad, deg=False) Tau2 = (tau2.axis).axis_and_angle_as_r3_rotation_matrix(tau2rad, deg=False) dTau2_dtau2 = dR_from_axis_and_angle(tau2.axis, tau2rad, deg=False) Tau3 = (tau3.axis).axis_and_angle_as_r3_rotation_matrix(tau3rad, deg=False) dTau3_dtau3 = dR_from_axis_and_angle(tau3.axis, tau3rad, deg=False) # Compose the new state from scitbx.array_family import flex from dials_refinement_helpers_ext import multi_panel_compose ret = multi_panel_compose( flex.vec3_double( [self._initial_state[tag] for tag in ("d1", "d2", "dn")]), flex.double([p.value for p in self._param]), flex.vec3_double([p.axis for p in self._param]), self._model, flex.vec3_double(self._offsets), flex.vec3_double(self._dir1s), flex.vec3_double(self._dir2s), Tau1, dTau1_dtau1, Tau2, dTau2_dtau2, Tau3, dTau3_dtau3, ) # Store the results. The results come back as a single array, convert it to a 2D array self._multi_state_derivatives = [[ matrix.sqr(ret[j * len(self._offsets) + i]) for j in range(len(self._param)) ] for i in range(len(self._offsets))]
def compose(self): # extract parameters from the internal list dist, shift1, shift2, tau1, tau2, tau3 = self._param # convert angles to radians tau1rad = tau1.value / 1000. tau2rad = tau2.value / 1000. tau3rad = tau3.value / 1000. # compose rotation matrices and their first order derivatives Tau1 = (tau1.axis).axis_and_angle_as_r3_rotation_matrix(tau1rad, deg=False) dTau1_dtau1 = dR_from_axis_and_angle(tau1.axis, tau1rad, deg=False) Tau2 = (tau2.axis).axis_and_angle_as_r3_rotation_matrix(tau2rad, deg=False) dTau2_dtau2 = dR_from_axis_and_angle(tau2.axis, tau2rad, deg=False) Tau3 = (tau3.axis).axis_and_angle_as_r3_rotation_matrix(tau3rad, deg=False) dTau3_dtau3 = dR_from_axis_and_angle(tau3.axis, tau3rad, deg=False) # Compose the new state from dials_refinement_helpers_ext import multi_panel_compose from scitbx.array_family import flex ret = multi_panel_compose(flex.vec3_double([self._initial_state[tag] for tag in ('d1','d2','dn')]), flex.double([p.value for p in self._param]), flex.vec3_double([p.axis for p in self._param]), self._model, flex.vec3_double(self._offsets), flex.vec3_double(self._dir1s), flex.vec3_double(self._dir2s), Tau1, dTau1_dtau1, Tau2, dTau2_dtau2, Tau3, dTau3_dtau3) # Store the results. The results come back as a single array, convert it to a 2D array self._multi_state_derivatives = [[matrix.sqr(ret[j*len(self._offsets)+i]) \ for j in xrange(len(self._param))] \ for i in xrange(len(self._offsets))] return