"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer3/Selector.cpp" between
pymol-v2.1.0.tar.bz2 and pymol-open-source-2.2.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-v2.1.0.tar.bz2):Selector.cpp  (pymol-open-source-2.2.0)
skipping to change at line 6122 skipping to change at line 6122
} }
} }
oMap->Active = true; oMap->Active = true;
} }
VLAFreeP(point); VLAFreeP(point);
VLAFreeP(charge); VLAFreeP(charge);
return (1); return (1);
} }
/*========================================================================*/ /*========================================================================*/
#ifndef _PYMOL_NOPY
// obsolete by MoleculeExporter
int SelectorGetPDB(PyMOLGlobals * G, char **charVLA, int cLen, int sele, int sta
te,
int conectFlag, PDBInfoRec * pdb_info, int *counter, double *
ref,
ObjectMolecule * single_object)
{
CSelector *I = G->Selector;
int a, b, b1, b2, c, d, s, idx, at, a1, a2;
int use_ter = SettingGetGlobal_i(G, cSetting_pdb_use_ter_records);
int retain_ids = SettingGetGlobal_b(G, cSetting_pdb_retain_ids);
int conect_all = SettingGetGlobal_b(G, cSetting_pdb_conect_all);
int conect_nodup = SettingGetGlobal_b(G, cSetting_pdb_conect_nodup);
double matrix[16];
double *matrix_ptr = NULL;
double matrix_full[16]; // for ANISOU
double *matrix_full_ptr = NULL;
float v_tmp[3], *v_ptr;
CoordSet *cs, *mat_cs = NULL;
ObjectMolecule *obj, *last_obj = NULL;
AtomInfoType *atInfo, *ai, *last = NULL;
if(!single_object) {
SelectorUpdateTable(G, state, -1);
} else {
SelectorUpdateTableSingleObject(G, single_object, state, false, NULL, 0, fal
se);
}
if(pdb_info->is_pqr_file())
use_ter = false;
if(counter)
c = *counter;
else
c = 0;
for(a = cNDummyAtoms; a < I->NAtom; a++) {
at = I->Table[a].atom;
I->Table[a].index = 0;
obj = I->Obj[I->Table[a].model];
s = obj->AtomInfo[at].selEntry;
if(SelectorIsMember(G, s, sele)) {
if((state >= 0) && (state < obj->NCSet))
cs = obj->CSet[state];
else
cs = NULL;
if(cs) {
idx = cs->atmToIdx(at);
if(idx >= 0) {
if(mat_cs != cs) {
/* compute the effective matrix for output coordinates */
matrix_ptr = ref;
matrix_full_ptr = ref;
if(ObjectGetTotalMatrix(&obj->Obj, state, true, matrix_full)) {
if(ref)
left_multiply44d44d(ref, matrix_full);
matrix_full_ptr = matrix_full;
}
if(ObjectGetTotalMatrix(&obj->Obj, state, false, matrix)) {
if(ref) {
left_multiply44d44d(ref, matrix);
}
matrix_ptr = matrix;
}
mat_cs = cs;
}
ai = obj->AtomInfo + at;
if(last)
if(last->flags & cAtomFlag_polymer)
if(ai->resv != last->resv)
if((abs(ai->resv - last->resv) > 1) || !(ai->flags & cAtomFlag_p
olymer)) {
if(use_ter) {
CoordSetAtomToTERStrVLA(G, charVLA, &cLen, last, c);
c++;
}
}
if(retain_ids) {
I->Table[a].index = ai->id;
} else {
I->Table[a].index = c + 1; /* NOTE marking with "1" based indexes h
ere */
}
v_ptr = cs->Coord + (3 * idx);
if(matrix_ptr) {
transform44d3f(matrix_ptr, v_ptr, v_tmp);
v_ptr = v_tmp;
}
CoordSetAtomToPDBStrVLA(G, charVLA, &cLen, ai, v_ptr, c, pdb_info, mat
rix_full_ptr);
last = ai;
c++;
if(!conect_all) {
int conect_all_tmp = 0;
if(last_obj != obj) {
if(SettingGetIfDefined_b
(G, obj->Obj.Setting, cSetting_pdb_conect_all, &conect_all_tmp)
) {
if(conect_all_tmp)
conect_all = true;
}
}
last_obj = obj;
}
}
}
}
}
if(conectFlag && !(pdb_info->is_pqr_file())) {
BondType *bond = NULL;
BondType *ii1;
int nBond = 0;
int newline;
nBond = 0;
bond = VLACalloc(BondType, 1000);
for(a = cNDummyModels; a < I->NModel; a++) {
obj = I->Obj[a];
ii1 = obj->Bond;
if((state >= 0) && (state < obj->NCSet))
cs = obj->CSet[state];
else
cs = NULL;
if(cs) {
atInfo = obj->AtomInfo;
for(b = 0; b < obj->NBond; b++) {
b1 = ii1->index[0];
b2 = ii1->index[1];
if(obj->DiscreteFlag) {
if((cs == obj->DiscreteCSet[b1]) && (cs == obj->DiscreteCSet[b2])) {
a1 = obj->DiscreteAtmToIdx[b1];
a2 = obj->DiscreteAtmToIdx[b2];
} else {
a1 = -1;
a2 = -1;
}
} else {
a1 = cs->AtmToIdx[b1];
a2 = cs->AtmToIdx[b2];
}
if((a1 >= 0) && (a2 >= 0)
&& (conect_all || atInfo[b1].hetatm || atInfo[b2].hetatm)) {
int i_b1 = SelectorGetObjAtmOffset(I, obj, b1);
int i_b2 = SelectorGetObjAtmOffset(I, obj, b2);
if((i_b1 >= 0) && (i_b2 >= 0)) {
if(I->Table[i_b1].index && I->Table[i_b2].index) {
int order = conect_nodup ? 1 : ii1->order;
VLACheck(bond, BondType, nBond + (2 * order) + 2);
b1 = I->Table[i_b1].index;
b2 = I->Table[i_b2].index;
for(d = 0; d < order; d++) {
bond[nBond].index[0] = b1;
bond[nBond].index[1] = b2;
nBond++;
bond[nBond].index[0] = b2;
bond[nBond].index[1] = b1;
nBond++;
}
}
}
}
ii1++;
}
}
}
{
char *reg_cVLA = *charVLA;
int reg_cLen = cLen;
UtilSortInPlace(G, bond, nBond, sizeof(BondType), (UtilOrderFn *) BondInOr
der);
ii1 = bond;
b1 = -1;
b2 = -1;
newline = false;
for(a = 0; a < nBond; a++) {
if(a < (nBond - 1)) {
if((ii1->index[0] == (ii1 + 1)->index[0])
&& (ii1->index[1] == (ii1 + 1)->index[1]))
newline = true;
}
if((b1 != ii1->index[0]) || ((b1 == ii1->index[0]) && (b2 == ii1->index[
1]))
|| newline) {
VLACheck(reg_cVLA, char, reg_cLen + 255);
if(a)
reg_cLen += sprintf(reg_cVLA + reg_cLen, "\n");
reg_cLen += sprintf(reg_cVLA + reg_cLen, "CONECT%5d%5d",
ii1->index[0], ii1->index[1]);
b1 = ii1->index[0];
b2 = ii1->index[1];
newline = false;
if(a > 0) {
if(((ii1 - 1)->index[0] == ii1->index[0])
&& ((ii1 - 1)->index[1] == ii1->index[1]))
newline = true;
}
} else {
VLACheck(reg_cVLA, char, reg_cLen + 255);
reg_cLen += sprintf(reg_cVLA + reg_cLen, "%5d", ii1->index[1]);
}
b2 = ii1->index[1];
ii1++;
}
if(reg_cLen) {
VLACheck(reg_cVLA, char, reg_cLen + 255);
if(*(reg_cVLA + reg_cLen - 1) != '\n')
reg_cLen += sprintf(reg_cVLA + reg_cLen, "\n");
}
(*charVLA) = reg_cVLA;
cLen = reg_cLen;
}
VLAFree(bond);
}
/*
VLAFreeP(ss); */
if(counter)
*counter = c;
return (cLen);
}
#endif
int SelectorAssignAtomTypes(PyMOLGlobals * G, int sele, int state, int quiet, in t format) int SelectorAssignAtomTypes(PyMOLGlobals * G, int sele, int state, int quiet, in t format)
{ {
#ifndef NO_MMLIBS #ifndef NO_MMLIBS
CSelector *I = G->Selector; CSelector *I = G->Selector;
int ok = true; int ok = true;
SelectorUpdateTable(G, state, -1); SelectorUpdateTable(G, state, -1);
if(ok) { if(ok) {
ObjectMolecule *prevobj = NULL; ObjectMolecule *prevobj = NULL;
skipping to change at line 11446 skipping to change at line 11225
} }
/* for each state */ /* for each state */
for(a = 0; a < c; a++) { for(a = 0; a < c; a++) {
atom1Info = NULL; atom1Info = NULL;
/* get the interstate atom identifier for the two atoms to distance */ /* get the interstate atom identifier for the two atoms to distance */
a1 = vla[a * 2]; a1 = vla[a * 2];
a2 = vla[a * 2 + 1]; a2 = vla[a * 2 + 1];
/* check their coverage to avoid duplicates */ /* check their coverage to avoid duplicates */
if(a1 < a2 || (a1 != a2 && !(coverage[a1] && coverage[a2]))) { /* eliminate if(a1 < a2 || (a1 != a2 && !(coverage[a1] && coverage[a2]))
reverse duplicates */ || (state1 != state2)) { /* eliminate reverse duplicates */
/* get the object-local atom ID */ /* get the object-local atom ID */
at1 = I->Table[a1].atom; at1 = I->Table[a1].atom;
at2 = I->Table[a2].atom; at2 = I->Table[a2].atom;
/* get the object for this global atom ID */ /* get the object for this global atom ID */
obj1 = I->Obj[I->Table[a1].model]; obj1 = I->Obj[I->Table[a1].model];
obj2 = I->Obj[I->Table[a2].model]; obj2 = I->Obj[I->Table[a2].model];
/* the states are valid for these two atoms */ /* the states are valid for these two atoms */
if((state1 < obj1->NCSet) && (state2 < obj2->NCSet)) { if((state1 < obj1->NCSet) && (state2 < obj2->NCSet)) {
/* get the coordinate sets for both atoms */ /* get the coordinate sets for both atoms */
skipping to change at line 11733 skipping to change at line 11513
idx2 = cs2->atmToIdx(at2); idx2 = cs2->atmToIdx(at2);
if(idx2 >= 0) { if(idx2 >= 0) {
/* neighbor table like BPRec */ /* neighbor table like BPRec */
bonded12 = ObjectMoleculeAreAtomsBonded2(obj1, at1, obj2 , at2); bonded12 = ObjectMoleculeAreAtomsBonded2(obj1, at1, obj2 , at2);
for(i3 = 0; i3 < n3; i3++) { for(i3 = 0; i3 < n3; i3++) {
atom1Info = NULL; atom1Info = NULL;
a3 = list3[i3]; a3 = list3[i3];
if((a1 != a2) && (a2 != a3) && (a1 != a3)) { if( (a1 != a2 || state1 != state2) &&
(a2 != a3 || state2 != state3) &&
(a1 != a3 || state1 != state3)) {
if(!(coverage[a1] && coverage[a3]) if(!(coverage[a1] && coverage[a3])
|| (a1 < a3)) { /* eliminate alternate-order dup || (a1 < a3)
licates */ || (state1 != state3)) { /* eliminate alternate-
order duplicates */
at3 = I->Table[a3].atom; at3 = I->Table[a3].atom;
obj3 = I->Obj[I->Table[a3].model]; obj3 = I->Obj[I->Table[a3].model];
if(state3 < obj3->NCSet) { if(state3 < obj3->NCSet) {
cs3 = obj3->CSet[state3]; cs3 = obj3->CSet[state3];
if(cs3) { if(cs3) {
idx3 = cs3->atmToIdx(at3); idx3 = cs3->atmToIdx(at3);
 End of changes. 4 change blocks. 
235 lines changed or deleted 8 lines changed or added

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