def adp_iso_analytical_gradients(weight, average_power, u_isos):
  """
um = (u1 + u2)/2
r=w*((u1-um)^2+(u2-um)^2)/um^mp
D[r,u1]

um = (u1 + u2 + u3)/3
r=w*((u1-um)^2+(u2-um)^2+(u3-um)^2)/um^mp
D[r,u1]

um = (u1 + u2 + u3 + u4)/4
r=w*((u1-um)^2+(u2-um)^2+(u3-um)^2+(u4-um)^2)/um^mp
D[r,u1]
"""
  n = u_isos.size()
  u_ave = flex.sum(u_isos) / n
  u_diff = u_isos - u_ave
  n_ave_pow = n*u_ave**average_power
  return weight * (  2/n_ave_pow*(u_diff*n-flex.sum(u_diff))
                   - average_power/(n_ave_pow*u_ave)*flex.sum_sq(u_diff))
Beispiel #2
0
def adp_iso_analytical_gradients(weight, average_power, u_isos):
    """
um = (u1 + u2)/2
r=w*((u1-um)^2+(u2-um)^2)/um^mp
D[r,u1]

um = (u1 + u2 + u3)/3
r=w*((u1-um)^2+(u2-um)^2+(u3-um)^2)/um^mp
D[r,u1]

um = (u1 + u2 + u3 + u4)/4
r=w*((u1-um)^2+(u2-um)^2+(u3-um)^2+(u4-um)^2)/um^mp
D[r,u1]
"""
    n = u_isos.size()
    u_ave = flex.sum(u_isos) / n
    u_diff = u_isos - u_ave
    n_ave_pow = n * u_ave**average_power
    return weight * (2 / n_ave_pow *
                     (u_diff * n - flex.sum(u_diff)) - average_power /
                     (n_ave_pow * u_ave) * flex.sum_sq(u_diff))
Beispiel #3
0
def adp_iso_residual_sum(weight, average_power, u_isos):
    n = u_isos.size()
    u_ave = flex.sum(u_isos) / n
    u_diff = u_isos - u_ave
    return weight * flex.sum_sq(u_diff) / u_ave**average_power
 def calculate_rms(self):
     length = self.ref_model1.unit_cell().length
     self.shortest_distances = flex.double(
         [length(d) for d in self.calculate_shortest_diffs()])
     self.rms = math.sqrt(
         flex.sum_sq(self.shortest_distances) / len(self.pairs))
def adp_iso_residual_sum(weight, average_power, u_isos):
  n = u_isos.size()
  u_ave = flex.sum(u_isos) / n
  u_diff = u_isos - u_ave
  return weight * flex.sum_sq(u_diff) / u_ave**average_power
Beispiel #6
0
 def log_p_obs_given_gamma(self, gamma):
   x_gamma = (gamma * self.delta_fc2.data() - self.delta_fo2.data()) \
           / self.delta_fo2.sigmas()
   if self.probability_plot_slope is not None:
     x_gamma /= self.probability_plot_slope
   return -0.5 * flex.sum_sq(x_gamma)
Beispiel #7
0
 def log_p_obs_given_gamma(self, gamma):
   x_gamma = (gamma * self.delta_fc2.data() - self.delta_fo2.data()) \
           / self.delta_fo2.sigmas()
   if self.probability_plot_slope is not None:
     x_gamma /= self.probability_plot_slope
   return -0.5 * flex.sum_sq(x_gamma)
 def calculate_rms(self):
   length = self.ref_model1.unit_cell().length
   self.shortest_distances = flex.double([
     length(d) for d in self.calculate_shortest_diffs() ])
   self.rms = math.sqrt(flex.sum_sq(self.shortest_distances)/len(self.pairs))