Exemplo n.º 1
0
    def apply(self, soup):
        residue = soup.residue(self.i_res)
        atoms = residue.atoms()
        n_chi = get_n_chi(residue)

        if self.mean_chis is None:
            self.mean_chis = [calculate_chi(residue, i) for i in range(n_chi)]

        rot_vels = [get_rot_vel_chi(residue, i) for i in range(n_chi)]
        for atom in atoms:
            v3.set_vector(atom.vel, 0.0, 0.0, 0.0)

        for i_chi in reversed(range(n_chi)):
            chi = calculate_chi(residue, i_chi)
            delta_chi = v3.normalize_angle(chi - self.mean_chis[i_chi])
            target_rot_vel = get_random_chi_rot_vel(residue, i_chi,
                                                    self.heating_temperature)
            if abs(delta_chi) > self.max_delta_chi:
                if delta_chi > self.max_delta_chi:
                    target_rot_vel = -target_rot_vel
            else:
                if rot_vels[i_chi] < 0.0:
                    target_rot_vel *= -target_rot_vel
            add_rot_vel_to_chi(residue, i_chi, target_rot_vel)

        anderson_velocity_scale(atoms, self.heating_temperature,
                                3 * len(atoms))
Exemplo n.º 2
0
  def apply(self, soup):
    residue = soup.residue(self.i_res)
    atoms = residue.atoms()
    n_chi = get_n_chi(residue)

    if self.mean_chis is None:
      self.mean_chis = [calculate_chi(residue, i) for i in range(n_chi)]

    rot_vels = [get_rot_vel_chi(residue, i) for i in range(n_chi)]
    for atom in atoms:
      v3.set_vector(atom.vel, 0.0, 0.0, 0.0)

    for i_chi in reversed(range(n_chi)):
      chi = calculate_chi(residue, i_chi)
      delta_chi = v3.normalize_angle(chi - self.mean_chis[i_chi])
      target_rot_vel = get_random_chi_rot_vel(
          residue, i_chi, self.heating_temperature)
      if abs(delta_chi) > self.max_delta_chi:
        if delta_chi > self.max_delta_chi:
          target_rot_vel = -target_rot_vel
      else:
        if rot_vels[i_chi] < 0.0:
          target_rot_vel *= -target_rot_vel
      add_rot_vel_to_chi(residue, i_chi, target_rot_vel)

    anderson_velocity_scale(atoms, self.heating_temperature, 3*len(atoms))
Exemplo n.º 3
0
def calculate_chi(residue, i_chi):
    """
  Returns the angle for the i_chi dihedral angle of residue.
  """
    res_chi_topology = data.get_res_chi_topology(residue.type)
    if i_chi < len(res_chi_topology):
        atom_types = res_chi_topology[i_chi]
        crds = [residue.atom(t).pos for t in atom_types]
        return v3.normalize_angle(v3.dihedral(*crds))
    raise ValueError, "No Chi%d angle for residue %d" % (i_chi, i)
Exemplo n.º 4
0
def calculate_chi(residue, i_chi):
  """
  Returns the angle for the i_chi dihedral angle of residue.
  """
  res_chi_topology = data.get_res_chi_topology(residue.type)
  if i_chi < len(res_chi_topology):
    atom_types = res_chi_topology[i_chi]
    crds = [residue.atom(t).pos for t in atom_types]
    return v3.normalize_angle(v3.dihedral(*crds))
  raise ValueError, "No Chi%d angle for residue %d" % (i_chi, i)