"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer3/Selector.cpp" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

Selector.cpp  (pymol-open-source-2.2.0):Selector.cpp  (pymol-open-source-2.3.0)
skipping to change at line 200 skipping to change at line 200
SelectorAtomIterator(CSelector * I) { SelectorAtomIterator(CSelector * I) {
selector = I; selector = I;
// no coord set // no coord set
cs = NULL; cs = NULL;
idx = -1; idx = -1;
reset(); reset();
} }
void reset() { void reset() override {
a = cNDummyAtoms - 1; a = cNDummyAtoms - 1;
} }
bool next(); bool next() override;
}; };
bool SelectorAtomIterator::next() { bool SelectorAtomIterator::next() {
if ((++a) >= selector->NAtom) if ((++a) >= selector->NAtom)
return false; return false;
TableRec *table_a = selector->Table + a; TableRec *table_a = selector->Table + a;
atm = table_a->atom; atm = table_a->atom;
obj = selector->Obj[table_a->model]; obj = selector->Obj[table_a->model];
skipping to change at line 1785 skipping to change at line 1785
} }
for(a = 0; a < (n_free - 1); a++) { for(a = 0; a < (n_free - 1); a++) {
I->Member[list[a]].next = list[a + 1]; I->Member[list[a]].next = list[a + 1];
} }
I->Member[list[n_free - 1]].next = 0; I->Member[list[n_free - 1]].next = 0;
I->FreeMember = list[0]; I->FreeMember = list[0];
FreeP(list); FreeP(list);
} }
} }
int SelectorWalkTree(PyMOLGlobals * G, int *atom, int *comp, int *toDo, int **st
k,
int stkDepth, ObjectMolecule * obj,
int sele1, int sele2, int sele3, int sele4);
typedef struct { typedef struct {
int color; int color;
int sele; int sele;
} ColorectionRec; } ColorectionRec;
static void SelectorDeleteSeleAtOffset(PyMOLGlobals * G, int n) static void SelectorDeleteSeleAtOffset(PyMOLGlobals * G, int n)
{ {
CSelector *I = G->Selector; CSelector *I = G->Selector;
int id; int id;
id = I->Info[n].ID; id = I->Info[n].ID;
skipping to change at line 4006 skipping to change at line 4002
if(obj->Obj.Name[0]) { if(obj->Obj.Name[0]) {
SelectorDelete(G, obj->Obj.Name); SelectorDelete(G, obj->Obj.Name);
SelectorCreate(G, obj->Obj.Name, NULL, obj, true, NULL); SelectorCreate(G, obj->Obj.Name, NULL, obj, true, NULL);
/* create a selection with same name */ /* create a selection with same name */
if(SettingGetGlobal_b(G, cSetting_auto_classify_atoms)) if(SettingGetGlobal_b(G, cSetting_auto_classify_atoms))
{ {
SelectorClassifyAtoms(G, 0, false, obj); SelectorClassifyAtoms(G, 0, false, obj);
// for file formats other than PDB // for file formats other than PDB
if (obj->need_hetatm_classification) { if (obj->need_hetatm_classification) {
for (auto ai = obj->AtomInfo, ai_end = ai + obj->NAtom; for (auto ai = obj->AtomInfo.data(), ai_end = ai + obj->NAtom;
ai != ai_end; ++ai) { ai != ai_end; ++ai) {
if (!(ai->flags & cAtomFlag_polymer)) { if (!(ai->flags & cAtomFlag_polymer)) {
ai->hetatm = true; ai->hetatm = true;
ai->flags |= cAtomFlag_ignore; ai->flags |= cAtomFlag_ignore;
} }
} }
obj->need_hetatm_classification = false; obj->need_hetatm_classification = false;
} }
} }
} }
skipping to change at line 4398 skipping to change at line 4394
} }
} }
while(si--) { while(si--) {
zero[scratch[si]] = 0; zero[scratch[si]] = 0;
} }
/* EXIT POINT 2 */ /* EXIT POINT 2 */
return 0; return 0;
} }
/*========================================================================*/ /*========================================================================*/
static
int SelectorWalkTree(PyMOLGlobals * G, int *atom, int *comp, int *toDo, int **st k, int SelectorWalkTree(PyMOLGlobals * G, int *atom, int *comp, int *toDo, int **st k,
int stkDepth, ObjectMolecule * obj, int stkDepth, ObjectMolecule * obj,
int sele1, int sele2, int sele3, int sele4) int sele1, int sele2, int sele3, int sele4)
{ {
int s; int s;
int c = 0; int c = 0;
int a, a1; int a, a1;
int seleFlag; int seleFlag;
AtomInfoType *ai; AtomInfoType *ai;
skipping to change at line 6602 skipping to change at line 6599
int SelectorCreateObjectMolecule(PyMOLGlobals * G, int sele, const char *name, int SelectorCreateObjectMolecule(PyMOLGlobals * G, int sele, const char *name,
int target, int source, int discrete, int target, int source, int discrete,
int zoom, int quiet, int singletons, int copy_p roperties) int zoom, int quiet, int singletons, int copy_p roperties)
{ {
CSelector *I = G->Selector; CSelector *I = G->Selector;
int ok = true; int ok = true;
int a, b, a2, b1, b2, c, d, s, at; int a, b, a2, b1, b2, c, d, s, at;
BondType *ii1, *bond = NULL; BondType *ii1, *bond = NULL;
int nBond = 0; int nBond = 0;
int nCSet, nAtom, ts; int nCSet, nAtom, ts;
AtomInfoType *atInfo = NULL;
int isNew; int isNew;
CoordSet *cs = NULL; CoordSet *cs = NULL;
CoordSet *cs1, *cs2; CoordSet *cs1, *cs2;
ObjectMolecule *obj; ObjectMolecule *obj;
CObject *ob; CObject *ob;
ObjectMolecule *targ = NULL; ObjectMolecule *targ = NULL;
ObjectMolecule *info_src = NULL; ObjectMolecule *info_src = NULL;
int static_singletons = SettingGetGlobal_b(G, cSetting_static_singletons); int static_singletons = SettingGetGlobal_b(G, cSetting_static_singletons);
if(singletons < 0) if(singletons < 0)
skipping to change at line 6696 skipping to change at line 6692
dst_bond->index[1] = I->Table[b2].index; dst_bond->index[1] = I->Table[b2].index;
/* printf("Selector-DEBUG %d %d\n",dst_bond->index[0],dst _bond->index[1]); */ /* printf("Selector-DEBUG %d %d\n",dst_bond->index[0],dst _bond->index[1]); */
nBond++; nBond++;
} }
} }
} }
ii1++; ii1++;
} }
} }
atInfo = VLACalloc(AtomInfoType, nAtom); pymol::vla<AtomInfoType> atInfo(nAtom);
/* copy the atom info records and create new zero-based IDs */ /* copy the atom info records and create new zero-based IDs */
c = 0; c = 0;
{ {
for(a = cNDummyAtoms; a < I->NAtom; a++) { for(a = cNDummyAtoms; a < I->NAtom; a++) {
if(I->Table[a].index >= 0) { if(I->Table[a].index >= 0) {
obj = I->Obj[I->Table[a].model]; obj = I->Obj[I->Table[a].model];
at = I->Table[a].atom; at = I->Table[a].atom;
VLACheck(atInfo, AtomInfoType, c); VLACheck(atInfo, AtomInfoType, c);
AtomInfoCopy(G, obj->AtomInfo + at, atInfo + c); AtomInfoCopy(G, obj->AtomInfo + at, atInfo + c);
c++; c++;
skipping to change at line 6719 skipping to change at line 6715
} }
cs = CoordSetNew(G); /* set up a dummy coordinate set for the merge x ref */ cs = CoordSetNew(G); /* set up a dummy coordinate set for the merge x ref */
cs->NIndex = nAtom; cs->NIndex = nAtom;
cs->enumIndices(); cs->enumIndices();
cs->TmpBond = bond; /* load up the bonds */ cs->TmpBond = bond; /* load up the bonds */
cs->NTmpBond = nBond; cs->NTmpBond = nBond;
bond = NULL; bond = NULL;
/* printf("Selector-DEBUG nAtom %d\n",nAtom); */ /* printf("Selector-DEBUG nAtom %d\n",nAtom); */
ObjectMoleculeMerge(targ, atInfo, cs, false, cAIC_AllMask, true); /* will free atInfo */ ObjectMoleculeMerge(targ, std::move(atInfo), cs, false, cAIC_AllMask, true); /* will free atInfo */
/* cs->IdxToAtm will now have the reverse mapping from the new subset /* cs->IdxToAtm will now have the reverse mapping from the new subset
to the new merged molecule */ to the new merged molecule */
ObjectMoleculeExtendIndices(targ, -1); ObjectMoleculeExtendIndices(targ, -1);
ObjectMoleculeUpdateIDNumbers(targ); ObjectMoleculeUpdateIDNumbers(targ);
ObjectMoleculeUpdateNonbonded(targ); ObjectMoleculeUpdateNonbonded(targ);
if(!isNew) { /* recreate selection table */ if(!isNew) { /* recreate selection table */
SelectorUpdateTable(G, source, -1); SelectorUpdateTable(G, source, -1);
skipping to change at line 8591 skipping to change at line 8587
{ {
CWordMatchOptions options; CWordMatchOptions options;
WordMatchOptionsConfigAlphaList(&options, wildcard[0], ignore_case); WordMatchOptionsConfigAlphaList(&options, wildcard[0], ignore_case);
table_a = i_table + cNDummyAtoms; table_a = i_table + cNDummyAtoms;
base_0_sele_a = &base[0].sele[cNDummyAtoms]; base_0_sele_a = &base[0].sele[cNDummyAtoms];
if((matcher = WordMatcherNew(G, base[1].text, &options, true))) { if((matcher = WordMatcherNew(G, base[1].text, &options, true))) {
AtomInfoType * ai; AtomInfoType * ai;
int prevmodel;
table_a = i_table + cNDummyAtoms; table_a = i_table + cNDummyAtoms;
base_0_sele_a = &base[0].sele[cNDummyAtoms]; base_0_sele_a = &base[0].sele[cNDummyAtoms];
prevmodel = -1; #ifndef NO_MMLIBS
#endif
for(a = cNDummyAtoms; a < I_NAtom; a++) { for(a = cNDummyAtoms; a < I_NAtom; a++) {
ai = i_obj[table_a->model]->AtomInfo + table_a->atom; ai = i_obj[table_a->model]->AtomInfo + table_a->atom;
#ifndef NO_MMLIBS #ifndef NO_MMLIBS
#endif #endif
if((*base_0_sele_a = WordMatcherMatchAlpha(matcher, LexStr(G, ai->text Type)))) if((*base_0_sele_a = WordMatcherMatchAlpha(matcher, LexStr(G, ai->text Type))))
c++; c++;
table_a++; table_a++;
base_0_sele_a++; base_0_sele_a++;
} }
WordMatcherFree(matcher); WordMatcherFree(matcher);
skipping to change at line 8638 skipping to change at line 8634
table_a++; table_a++;
base_0_sele_a++; base_0_sele_a++;
} }
WordMatcherFree(matcher); WordMatcherFree(matcher);
} }
} }
break; break;
case SELE_STRO: case SELE_STRO:
{ {
CWordMatchOptions options; CWordMatchOptions options;
int prevmodel;
WordMatchOptionsConfigAlphaList(&options, wildcard[0], ignore_case); WordMatchOptionsConfigAlphaList(&options, wildcard[0], ignore_case);
table_a = i_table + cNDummyAtoms; table_a = i_table + cNDummyAtoms;
base_0_sele_a = &base[0].sele[cNDummyAtoms]; base_0_sele_a = &base[0].sele[cNDummyAtoms];
if((matcher = WordMatcherNew(G, base[1].text, &options, true))) { if((matcher = WordMatcherNew(G, base[1].text, &options, true))) {
table_a = i_table + cNDummyAtoms; table_a = i_table + cNDummyAtoms;
base_0_sele_a = &base[0].sele[cNDummyAtoms]; base_0_sele_a = &base[0].sele[cNDummyAtoms];
prevmodel = -1; #ifndef NO_MMLIBS
#endif
for(a = cNDummyAtoms; a < I_NAtom; a++) { for(a = cNDummyAtoms; a < I_NAtom; a++) {
#ifndef NO_MMLIBS #ifndef NO_MMLIBS
#endif #endif
const char * mmstereotype = const char * mmstereotype =
AtomInfoGetStereoAsStr(i_obj[table_a->model]->AtomInfo + table_a->at om); AtomInfoGetStereoAsStr(i_obj[table_a->model]->AtomInfo + table_a->at om);
if((*base_0_sele_a = if((*base_0_sele_a =
WordMatcherMatchAlpha(matcher,mmstereotype))) WordMatcherMatchAlpha(matcher,mmstereotype)))
c++; c++;
table_a++; table_a++;
base_0_sele_a++; base_0_sele_a++;
 End of changes. 12 change blocks. 
17 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)