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


C++ Transforms::rmsdAlignment方法代码示例

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


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

示例1: printResults


//.........这里部分代码省略.........

			
				// Get AtomVectors of matching windows
				AtomPointerVector ca1 = minWindow1.getSmallAVec();
				AtomPointerVector ca2 = minWindow2.getSmallAVec();
//for(int i=0; i<ca2.size();i++) cout<<*ca2[i]<<endl;

				// Read PDB1 in 
				PDBReader r1;
				r1.open(dm1.getPDBid());
				r1.read();
				r1.close();
				AtomPointerVector &ref = r1.getAtomPointers();
				if (ref.size() == 0){
					cerr << "ERRROR 3453 in ManageDistanceMatrixResults::printResults while aligning pdbs, ref pdb not found?: "<<dm1.getPDBid()<<endl;
					exit(3453);
				}


				

				PDBReader r2;
				r2.open(dm2.getPDBid());
				r2.read();
				r2.close();
				AtomPointerVector &vec = r2.getAtomPointers();



				Transforms t;		    
//for(int i=0; i<vec.size();i++) cout<<*vec[i]<<endl;
//cout<<endl;
//				cout << ca2.size() << "\t" << ca1.size() << "\t" << vec.size() << endl;
				bool result = t.rmsdAlignment(ca2,ca1, vec);
// This align is to a get vec (full pdb coordinates)
//ca2,ca1 did not changed; vec changed
				if (!result){
					cerr << "Alignment has failed!"<<endl;
					exit(1211);
				}

				
				ca2.saveCoor("pre");
// here record old ca2 coordinates

				result = t.rmsdAlignment(ca2,ca1);
// this align is to get a new ca2 to calculate rmsd
				if (!result){
					cerr << "Alignment has failed!"<<endl;
					exit(1212);
				}
				
				double rmsd=ca1.rmsd(ca2);
				cout << "RMSD: "<<rmsd<<endl;
				if (rmsd <= rmsdTol){
// a smaller rmsd is to get optimized structures

					numberAligned++;
/*
					// Write out aligned PDB for dm2
					char a[80];
					sprintf(a, "%s.aligned.%5.3f.pdb",MslTools::getFileName(dm2.getPDBid()).c_str(),rmsd);

					PDBWriter w;
					w.open(a);
					w.write(vec);
开发者ID:Suncuss,项目名称:mslib,代码行数:67,代码来源:ManageDistanceMatrixResults.cpp

示例2: main


//.........这里部分代码省略.........
	if (opt.setModel2) {
		// set the current NMR model
		sys2.setActiveModel(opt.model2);
	}


	AtomPointerVector av1 = sys1.getAtomPointers();
	AtomPointerVector av2 = sys2.getAtomPointers();
	
	AtomPointerVector alignAtoms1;
	if (opt.sele1.size() == 0) {
		// select all atoms
		alignAtoms1.insert(alignAtoms1.end(), av1.begin(), av1.end());
	} else {
		AtomSelection sel1(av1);
		for (unsigned int i=0; i<opt.sele1.size(); i++) {
			char c [1000];
			sprintf(c, "keyatoms, %s", opt.sele1[i].c_str());
			AtomPointerVector selAtom = sel1.select(c);
			alignAtoms1.insert(alignAtoms1.end(), selAtom.begin(), selAtom.end());
		}
	}
	cout << "Selected " << alignAtoms1.size() << " reference atoms for pdb " << opt.pdb1 << endl;

	AtomPointerVector alignAtoms2;
	if (opt.sele2.size() == 0) {
		// select all atoms
		alignAtoms2.insert(alignAtoms2.end(), av2.begin(), av2.end());
	} else {
		AtomSelection sel2(av2);
		for (unsigned int i=0; i<opt.sele2.size(); i++) {
			char c [1000];
			sprintf(c, "keyatoms, %s", opt.sele2[i].c_str());
			AtomPointerVector selAtom = sel2.select(c);
			alignAtoms2.insert(alignAtoms2.end(), selAtom.begin(), selAtom.end());
		}
	}
	cout << "Selected " << alignAtoms2.size() << " reference atoms for pdb " << opt.pdb2 << endl;

	if (alignAtoms1.size() != alignAtoms2.size()) {
		cerr << "The number of atoms selected for pdb 1 (" << alignAtoms1.size() << ") does not match the number of atoms selected for pdb 2 (" << alignAtoms2.size() << ")" << endl;
		exit(1);
	}

	cout << endl;
	cout << "Set 1 ================================" << endl;
	cout << endl;
	cout << alignAtoms1;
	cout << endl;
	cout << "Set 2 ================================" << endl;
	cout << endl;
	cout << alignAtoms2;
	cout << endl;
	cout << "      ================================" << endl;

	if (opt.noAlign) {
		// only calc the rmsd
		double rmsd = alignAtoms2.rmsd(alignAtoms1);
		cout << endl;
		cout << opt.pdb2 << " was NOT aligned to " << opt.pdb1 << "." << endl;
		cout << "RMSD " << rmsd << endl;
	} else {
		Transforms tm;
		if (!tm.rmsdAlignment(alignAtoms2,alignAtoms1,av2)) {
			cerr << "Alignment failed!" << endl;
			exit(1);
		}
		//double rmsd = tm.getRMSD();
		double rmsd = alignAtoms2.rmsd(alignAtoms1);
		Matrix rotMatrix = tm.getLastRotationMatrix();
		CartesianPoint translation = tm.getLastTranslation();
		cout << rotMatrix << endl;
		cout << translation << endl;
		cout << endl;
		cout << "Aligned " << opt.pdb2;
		if (opt.setModel2) {
			cout << " (model " << opt.model2 << ")";
		}
		cout << " to " << opt.pdb1;
		if (opt.setModel1) {
			cout << " (model " << opt.model1 << ")";
		}
		cout << "." << endl;
		cout << "RMSD " << rmsd << endl;
		if (!opt.noOutputPdb) {
			if (!sys2.writePdb(opt.outputPdb2, opt.writeAllModels)) {
				cerr << "Cannot open " << opt.outputPdb2 << " for writing" << endl;
				exit(1);
			}
			cout << "Written to " << opt.outputPdb2 << endl;
		} else {
			cout << "Aligned PDB not written" << endl;
		}
	}



	return 0;

}
开发者ID:Suncuss,项目名称:mslib,代码行数:101,代码来源:alignMolecules.cpp


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