本文整理汇总了C++中Transforms::getLastTranslation方法的典型用法代码示例。如果您正苦于以下问题:C++ Transforms::getLastTranslation方法的具体用法?C++ Transforms::getLastTranslation怎么用?C++ Transforms::getLastTranslation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transforms
的用法示例。
在下文中一共展示了Transforms::getLastTranslation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}