(no title)
dalke | 2 days ago
//! - PyMOL's layer3/Selector.cpp - SelectorAssignSS function
//! - PyMOL's layer2/ObjectMolecule2.cpp - ObjectMoleculeGetCheckHBond function
//! - PyMOL's layer1/SettingInfo.h - Default angle thresholds
and "matching PyMOL's cSS* flags from Selector.cpp"While the Rust code is cleaned up and easier to read, I can see that it preserves similar data flow, uses similar variable names, and of course identical constants.
For example, this is PyMol layer3/Selector.cpp:
/* look for antiparallel beta sheet ladders (single or double)
...
*/
if((r + 1)->real && (r + 2)->real) {
for(b = 0; b < r->n_acc; b++) { /* iterate through acceptors */
r2 = (res + r->acc[b]) - 2; /* go back 2 */
if(r2->real) {
for(c = 0; c < r2->n_acc; c++) {
if(r2->acc[c] == a + 2) { /* found a ladder */
(r)->flags |= cSSAntiStrandSingleHB;
(r + 1)->flags |= cSSAntiStrandSkip;
(r + 2)->flags |= cSSAntiStrandSingleHB;
(r2)->flags |= cSSAntiStrandSingleHB;
(r2 + 1)->flags |= cSSAntiStrandSkip;
(r2 + 2)->flags |= cSSAntiStrandSingleHB;
/* printf("anti ladder %s %s to %s %s\n",
r->obj->AtomInfo[I->Table[r->ca].atom].resi,
r->obj->AtomInfo[I->Table[(r+2)->ca].atom].resi,
r2->obj->AtomInfo[I->Table[r2->ca].atom].resi,
r2->obj->AtomInfo[I->Table[(r2+2)->ca].atom].resi); */
}
}
}
}
and this is pymol-rs's pymol-mol/src/dss.rs // Antiparallel ladder: i accepts j, (j-2) accepts (i+2)
if a + 2 < n_res && res[a + 1].real && res[a + 2].real {
for &acc_j in &acc_list {
if acc_j < 2 || !res[acc_j].real {
continue;
}
let j_minus_2 = acc_j - 2;
if !res[j_minus_2].real {
continue;
}
let acc_jm2_list: Vec<usize> = res[j_minus_2].acc.clone();
for &acc_k in &acc_jm2_list {
if acc_k == a + 2 {
res[a].flags |= SsFlags::ANTI_STRAND_SINGLE_HB;
res[a + 1].flags |= SsFlags::ANTI_STRAND_SKIP;
res[a + 2].flags |= SsFlags::ANTI_STRAND_SINGLE_HB;
res[j_minus_2].flags |= SsFlags::ANTI_STRAND_SINGLE_HB;
if acc_j >= j_minus_2 + 2 {
res[j_minus_2 + 1].flags |= SsFlags::ANTI_STRAND_SKIP;
}
res[acc_j].flags |= SsFlags::ANTI_STRAND_SINGLE_HB;
}
}
}
}
That's close enough that I really think you should include the PyMol license info, before Schrödinger's lawyers notice.
No comments yet.