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


C++ OBMol::SetTorsion方法代码示例

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


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

示例1: turnMolMT

void turnMolMT(OBMol& mol,vector< vector <int> >& maplist,int k)
{
	if (k<0)
		return;
	if (k>=maplist.size())
		return;

	OBAtom *a1, *a2, *a3, *a4;
	pthread_t threadList[angleSum];

	for (int i=0;i<angleSum;++i) {
		pthread_create(threadList+i,NULL,turnMolSingle,new MolData(mol,maplist,k-1));

		a2 = mol.GetAtom(maplist[k][0]);
		a3 = mol.GetAtom(maplist[k][1]);
		std::vector<OBEdgeBase*>::iterator temp = a2->BeginBonds();
		a1 = a2->BeginNbrAtom(temp);
		if (a1==a3)
			a1 = a2->NextNbrAtom(temp);
		temp = a3->BeginBonds();
		a4 = a3->BeginNbrAtom(temp);
		if (a4==a2)
			a4 = a3->NextNbrAtom(temp);
		mol.SetTorsion(a1, a2, a3, a4, i * angle * DEG_TO_RAD);
	}
	for (int i=0;i<angleSum;++i) {
		pthread_join(threadList[i],NULL);
	}
}
开发者ID:lkstc112233,项目名称:openbabel,代码行数:29,代码来源:rkrotate.cpp

示例2: turnMol

void turnMol(OBMol& mol,vector< vector <int> >& maplist,int k)
{
	if (k<0)
		return;
	if (k>=maplist.size())
		return;

	OBAtom *a1, *a2, *a3, *a4;
	double energy;

	string fileName;
	ostringstream oss(fileName);
	for (int i=0;i<angleSum;++i) {
		fileName = "";
		a2 = mol.GetAtom(maplist[k][0]);
		a3 = mol.GetAtom(maplist[k][1]);
		std::vector<OBEdgeBase*>::iterator temp = a2->BeginBonds();
		a1 = a2->BeginNbrAtom(temp);
		if (a1==a3)
			a1 = a2->NextNbrAtom(temp);
		temp = a3->BeginBonds();
		a4 = a3->BeginNbrAtom(temp);
		if (a4==a2)
			a4 = a3->NextNbrAtom(temp);
		if ( !a2->IsConnected(a3) ) {
			cerr << "obrotate: The atoms of the rotating bond must be bonded." << endl;
			exit(-1);
		}

		mol.SetTorsion(a1, a2, a3, a4, i * angle * DEG_TO_RAD);

		if (isEnergyCalcing)
		{
			indexSheet[k]=i;
			forceField->Setup(mol);
			energy = forceField->Energy(false);
			energySheet->getVectorValue(indexSheet)=energy;
		}
		else
		{
			oss.str("");
			pthread_mutex_lock(&sum_lock);
			oss << sum++ << "," << FileIn ;
			pthread_mutex_unlock(&sum_lock);
			ofstream ofs(oss.str().c_str());
			cerr << "Outputing file no." << sum << "/" << totalSum << endl;
			conv.Write(&mol,&ofs); //NF
		}
		turnMol(mol,maplist,k-1);
	}
}
开发者ID:lkstc112233,项目名称:openbabel,代码行数:51,代码来源:rkrotate.cpp

示例3: outputMol

void outputMol(vector<int*>& mols,OBMol& mol,vector< vector <int> >& maplist,int k)
{
	if (k<0)
		return;
	if (k>=maplist.size())
		return;

	OBAtom *a1, *a2, *a3, *a4;
	double energy;

	string fileName;
	ostringstream oss(fileName);
	for (int i=0;i<angleSum;++i) {
		fileName = "";
		a2 = mol.GetAtom(maplist[k][0]);
		a3 = mol.GetAtom(maplist[k][1]);
		std::vector<OBEdgeBase*>::iterator temp = a2->BeginBonds();
		a1 = a2->BeginNbrAtom(temp);
		if (a1==a3)
			a1 = a2->NextNbrAtom(temp);
		temp = a3->BeginBonds();
		a4 = a3->BeginNbrAtom(temp);
		if (a4==a2)
			a4 = a3->NextNbrAtom(temp);
		
		mol.SetTorsion(a1, a2, a3, a4, i * angle * DEG_TO_RAD);

		indexSheet[k]=i;
		if (isContained(mols,indexSheet))
		{
			oss.str("");
			pthread_mutex_lock(&sum_lock);
			oss << sum++ << "," << FileIn;
			pthread_mutex_unlock(&sum_lock);
			ofstream ofs(oss.str().c_str());
			cerr << "Outputing low energy file no." << sum << "/" << totalSum << endl;
			conv.Write(&mol,&ofs); //NF
		}
		outputMol(mols,mol,maplist,k-1);
	}
}
开发者ID:lkstc112233,项目名称:openbabel,代码行数:41,代码来源:rkrotate.cpp


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