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


C++ Molecule::AddAtom方法代码示例

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


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

示例1: main

int main () {

  PDBFile pdb ("temp.pdb");

  Molecule * mol = pdb.Molecules(0);
  mol->Name("qtz");
  std::vector<Atom *> atoms = mol->Atoms();

  /* cycle through each atom in order of the pdb file */
  RUN (atoms)
  {
	Atom * atom = atoms[i];
	atom->Residue("qtz");
	VecR pos = atom->Position();

	/* find the surface Oxygens */
	if (atom->Name().find("O") != string::npos && pos[z] > -7.9)
	{
	  /* add H's to the surface */
	  Atom * h = new Atom ("H", pos + VecR (0.0, 0.0, 1.1));
	  mol->AddAtom(h);
	}
  }
  std::vector<Molecule *> mols;
  mols.push_back(mol);
  PDBFile::WritePDB(mols);
}
开发者ID:eshamay,项目名称:interfacemd,代码行数:27,代码来源:find-oh.cpp

示例2: MakeSingleMolecule

/* Take a set of molecules and return a single molecule with all the atoms */
Molecule * MakeSingleMolecule (Mol_ptr_vec& mols) {
  Molecule * mol = new Molecule();

  for (Mol_it mols_i = mols.begin(); mols_i != mols.end(); mols_i++) {

    for (Atom_it atom_i = (*mols_i)->begin(); atom_i != (*mols_i)->end(); atom_i++) {

      mol->AddAtom((*atom_i));
    }
  }

  return mol;
}
开发者ID:eshamay,项目名称:interfacemd,代码行数:14,代码来源:molgrid.cpp

示例3: UnitCellToSlab

// Makes a repeating slab out of a single unit cell by creating copies and shifting
Mol_ptr_vec UnitCellToSlab (GridParams& params) {

  std::vector<Molecule *> mols;
  Molecule * uc = params.unitCell;

  VecR yshift, xshift, zshift;

  yshift.Zero();
  for (int i = 0; i < params.y; i++) {
    zshift.Zero();

    for (int j = 0; j < params.x; j++) {
      xshift.Zero();
      if (!(j % 2))
		xshift += params.x_shift * 0.5;

      for (int k = 0; k < params.z; k++) {

	// make a copy of the unitcell
	Molecule * copy = new Molecule();
	copy->Name(params.name);
	// make copies of all the atoms in the unitcell
	for (Atom_it atom_i = uc->begin(); atom_i != uc->end(); atom_i++) {
	//for (int atom = 0; atom < uc->size(); atom++) {
	  Atom * pa = new Atom (*(*atom_i));
	  copy->AddAtom(pa);
	}

	// shift the new copy to the next lattice point
	copy->Shift(yshift + xshift + zshift);
	mols.push_back(copy);

	xshift += params.x_shift;
      } 

      zshift += params.z_shift;
    } 
    yshift += params.y_shift;
  }

  return mols;
}
开发者ID:eshamay,项目名称:interfacemd,代码行数:43,代码来源:molgrid.cpp

示例4: UnitCellToSlab

// Makes a repeating slab out of a single unit cell by creating copies and shifting
Mol_ptr_vec UnitCellToSlab (Molecule * uc, VecR& x_shift,VecR& y_shift, VecR& z_shift) {

  std::vector<Molecule *> mols;
  VecR yshift, xshift, zshift;
  for (int i = 0; i < 1; i++) {
    zshift.Zero();
    yshift.Zero();

    for (int j = 0; j < 6; j++) {
      xshift.Zero();

      for (int k = 0; k < 6; k++) {

	// make a copy of the unitcell
	Molecule * copy = new Molecule();
	copy->Name("qtz");
	// make copies of all the atoms in the unitcell
	for (int atom = 0; atom < uc->size(); atom++) {
	  Atom * pa = new Atom (*uc->Atoms(atom));
	  copy->AddAtom(pa);
	}

	// shift the new copy to the next lattice point
	copy->Shift(yshift + xshift + zshift);
	mols.push_back(copy);

	xshift += x_shift;
      } 

      yshift += y_shift;
    } 
    zshift += z_shift;
  }

  return mols;
}
开发者ID:eshamay,项目名称:interfacemd,代码行数:37,代码来源:make-quartz-slab.cpp


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