当前位置: 首页>>代码示例>>C++>>正文


C++ Conformer::parent方法代码示例

本文整理汇总了C++中Conformer::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ Conformer::parent方法的具体用法?C++ Conformer::parent怎么用?C++ Conformer::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Conformer的用法示例。


在下文中一共展示了Conformer::parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OptimizeLigandGeomety

void OptimizeLigandGeomety(Conformer& ligand, double chi_increment, std::vector<double> chi_stdev, std::string lp_atom,
                           double unit_cell_length, double angle_tolerance, std::string output_dir) {
  if (ligand.parent()->conformer_states() == NULL)
    Log->error(FLERR, "There are no conformer states for the ligand!");
  const std::vector<Linkage<std::string> >& chi_names = ligand.parent()->conformer_states()->degrees_of_freedom();

  std::vector<double> chi_values = GetChiValues(ligand);
  //adjust chi to values between [0, 360]
  for (size_t i = 0; i < chi_values.size(); ++i) {
    chi_values[i] = (chi_values[i] < 0 ? chi_values[i] += 360 : chi_values[i]);
  }

  //loop through the possible chi angles, filling the ligand geometry map
  std::map<std::vector<double>, std::vector<double> > ligand_geometry;
  for(double chi1 = floor(chi_values[0] - chi_stdev[0]); chi1 < ceil(chi_values[0] + chi_stdev[0]); chi1 += chi_increment) {
    for(double chi2 = floor(chi_values[1] - chi_stdev[1]); chi2 < ceil(chi_values[1] + chi_stdev[1]); chi2 += chi_increment) {
      ligand.AdjustLinkage(chi_names[0], chi1);
      ligand.AdjustLinkage(chi_names[1], chi2);

      std::vector<double> chis;
      chis.push_back(chi1);
      chis.push_back(chi2);
      Vector3 v = CalculateLonePairDirection(ligand, lp_atom);

      //Calculate the dot product of v and z axis unit vector
      //cos(q) = v*w / (|v|*|w|)
      double angle_z = RADIANS_TO_DEGREES * acos(v.DotProduct(Vector3(0, 0, 1)) / v.Length());
      //Calculate the dot product of v and the vector from the N to the metal (where the C4 symmetry axis is)
      Atom* N = ligand.Find(lp_atom);
      Vector3 N_metal(unit_cell_length - N->x(), - N->y(), 0);
      double angle_metal = RADIANS_TO_DEGREES * acos(v.DotProduct(N_metal) / (v.Length() * N_metal.Length()));

      if ((angle_z < (90.0 + angle_tolerance) && angle_z > (90.0 - angle_tolerance)) && (angle_metal < angle_tolerance)) {
        ligand_geometry[chis].push_back(angle_z);
        ligand_geometry[chis].push_back(angle_metal);

        //OutputStructure(ligand.parent()->parent()->parent()->parent()->parent()->parent(), chis, lp_atom, output_dir);
        Log->print("Optimized Cu binding PDB with chi1 " + Log->to_str(chi1) + ", chi2 " + Log->to_str(chi2));

        OutputLatticeStructure(ligand.parent()->parent()->parent()->parent()->parent()->parent(), chis, unit_cell_length, lp_atom, output_dir);
      }
    }
  }

  OutputStat(ligand_geometry, lp_atom, output_dir);
}
开发者ID:iceviolet,项目名称:protein_design,代码行数:46,代码来源:CuP422.cpp

示例2: GetChiValues

std::vector<double> GetChiValues(Conformer& ligand) {
  //get degrees of freedom and the chi angles of the ligand
  size_t number_of_chis = ligand.parent()->conformer_states()->NumberDegreesOfFreedom();
  if (ligand.parent()->conformer_states() == NULL)
    Log->error(FLERR, "There are no conformer states for the ligand!");
  const std::vector<Linkage<std::string> >& chi_names = ligand.parent()->conformer_states()->degrees_of_freedom();
  std::vector<double> chi_values;

  for (size_t i = 0; i < number_of_chis; ++i) {
    Atom* a = ligand.Find(chi_names[i][0]);
    Atom* b = ligand.Find(chi_names[i][1]);
    Atom* c = ligand.Find(chi_names[i][2]);
    Atom* d = ligand.Find(chi_names[i][3]);

    if (a == NULL || b == NULL || c == NULL || d == NULL) {
      Log->error(FLERR, "Check if there are missing atoms in the ligand");
    }

    chi_values.push_back(RADIANS_TO_DEGREES * Geometry::Dihedral(*a, *b, *c, *d));
  }

  return chi_values;
}
开发者ID:iceviolet,项目名称:protein_design,代码行数:23,代码来源:CuP422.cpp


注:本文中的Conformer::parent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。