"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer2/ObjectMolecule.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.

ObjectMolecule.cpp  (pymol-v2.1.0.tar.bz2):ObjectMolecule.cpp  (pymol-open-source-2.2.0)
skipping to change at line 77 skipping to change at line 77
#define ntrim ParseNTrim #define ntrim ParseNTrim
#define nextline ParseNextLine #define nextline ParseNextLine
#define ncopy ParseNCopy #define ncopy ParseNCopy
#define nskip ParseNSkip #define nskip ParseNSkip
#ifndef NO_MMLIBS #ifndef NO_MMLIBS
#include "mmpymolx.h" #include "mmpymolx.h"
#endif #endif
int ObjectMoleculeUpdateMMStereoInfoForState(PyMOLGlobals * G, ObjectMolecule *
obj, int state, int initialize);
void ObjectMoleculeCylinders(ObjectMolecule * I); void ObjectMoleculeCylinders(ObjectMolecule * I);
static static
CoordSet *ObjectMoleculeMMDStr2CoordSet(PyMOLGlobals * G, const char *buffer, CoordSet *ObjectMoleculeMMDStr2CoordSet(PyMOLGlobals * G, const char *buffer,
AtomInfoType ** atInfoPtr, const char ** restart); AtomInfoType ** atInfoPtr, const char ** restart);
int ObjectMoleculeDoesAtomNeighborSele(ObjectMolecule * I, int index, int sele); int ObjectMoleculeDoesAtomNeighborSele(ObjectMolecule * I, int index, int sele);
void ObjectMoleculeAppendAtoms(ObjectMolecule * I, AtomInfoType * atInfo, void ObjectMoleculeAppendAtoms(ObjectMolecule * I, AtomInfoType * atInfo,
CoordSet * cset); CoordSet * cset);
skipping to change at line 6813 skipping to change at line 6811
if(atom < I->NAtom) { if(atom < I->NAtom) {
ITERNEIGHBORBONDS(I->Neighbor, atom, b, i) { ITERNEIGHBORBONDS(I->Neighbor, atom, b, i) {
result += I->Bond[b].order; result += I->Bond[b].order;
} }
} else { } else {
result = -1; /* error */ result = -1; /* error */
} }
return result; return result;
} }
/*
* Generate I->Neighbor from I->Bond, but only if I->Neighbor is not NULL.
*
* Changed in PyMOL 2.1.1: Ignore zero-order bonds (PYMOL-3025)
*
* To force the update, call ObjectMoleculeInvalidate(level=cRepInvBonds) first.
*
*/
/*========================================================================*/ /*========================================================================*/
int ObjectMoleculeUpdateNeighbors(ObjectMolecule * I) int ObjectMoleculeUpdateNeighbors(ObjectMolecule * I)
{ {
/* neighbor storage structure: VERY COMPLICATED... /* neighbor storage structure: VERY COMPLICATED...
0 list offset for atom 0 = n 0 list offset for atom 0 = n
1 list offset for atom 1 = n + m + 1 1 list offset for atom 1 = n + m + 1
... ...
n-1 list offset for atom n-1 n-1 list offset for atom n-1
skipping to change at line 6884 skipping to change at line 6890
if (!ok) if (!ok)
return ok; return ok;
/* initialize; zero out neighbors */ /* initialize; zero out neighbors */
l = I->Neighbor; l = I->Neighbor;
for(a = 0; a < I->NAtom; a++) for(a = 0; a < I->NAtom; a++)
(*l++) = 0; (*l++) = 0;
/* count neighbors for each atom */ /* count neighbors for each atom */
bnd = I->Bond; bnd = I->Bond;
for(b = 0; b < I->NBond; b++) { for(b = 0; b < I->NBond; b++) {
I->Neighbor[bnd->index[0]]++; if (bnd->order) {
I->Neighbor[bnd->index[1]]++; I->Neighbor[bnd->index[0]]++;
I->Neighbor[bnd->index[1]]++;
}
bnd++; bnd++;
} }
/* set up offsets and list terminators */ /* set up offsets and list terminators */
c = I->NAtom; c = I->NAtom;
for(a = 0; a < I->NAtom; a++) { for(a = 0; a < I->NAtom; a++) {
d = I->Neighbor[a]; /* get number of neighbors */ d = I->Neighbor[a]; /* get number of neighbors */
I->Neighbor[c] = d; /* store neighbor count */ I->Neighbor[c] = d; /* store neighbor count */
I->Neighbor[a] = c + d + d + 1; /* set initial position to end of list, we'll fill backwards */ I->Neighbor[a] = c + d + d + 1; /* set initial position to end of list, we'll fill backwards */
I->Neighbor[I->Neighbor[a]] = -1; /* store terminator */ I->Neighbor[I->Neighbor[a]] = -1; /* store terminator */
c += d + d + 2; c += d + d + 2;
} }
/* now load neighbors in a sequential list for each atom (reverse order) */ /* now load neighbors in a sequential list for each atom (reverse order) */
bnd = I->Bond; bnd = I->Bond;
for(b = 0; b < I->NBond; b++) { for(b = 0; b < I->NBond; b++, ++bnd) {
l0 = bnd->index[0]; l0 = bnd->index[0];
l1 = bnd->index[1]; l1 = bnd->index[1];
bnd++;
if (!bnd->order)
continue;
I->Neighbor[l0]--; I->Neighbor[l0]--;
I->Neighbor[I->Neighbor[l0]] = b; /* store bond indices (for I->Bond) */ I->Neighbor[I->Neighbor[l0]] = b; /* store bond indices (for I->Bond) */
I->Neighbor[l0]--; I->Neighbor[l0]--;
I->Neighbor[I->Neighbor[l0]] = l1; /* store neighbor references (I- >AtomInfo, etc.) */ I->Neighbor[I->Neighbor[l0]] = l1; /* store neighbor references (I- >AtomInfo, etc.) */
I->Neighbor[l1]--; I->Neighbor[l1]--;
I->Neighbor[I->Neighbor[l1]] = b; /* store bond indices (for I->Bond) */ I->Neighbor[I->Neighbor[l1]] = b; /* store bond indices (for I->Bond) */
I->Neighbor[l1]--; I->Neighbor[l1]--;
I->Neighbor[I->Neighbor[l1]] = l0; /* store neighbor references (I- >AtomInfo, etc.) */ I->Neighbor[I->Neighbor[l1]] = l0; /* store neighbor references (I- >AtomInfo, etc.) */
skipping to change at line 10331 skipping to change at line 10341
cs->objMolOpInvalidated = false; cs->objMolOpInvalidated = false;
} }
break; break;
} }
use_matrices = SettingGet_i(I->Obj.G, I->Obj.Setting, NULL, cSetting_mat rix_mode); use_matrices = SettingGet_i(I->Obj.G, I->Obj.Setting, NULL, cSetting_mat rix_mode);
if(use_matrices<0) use_matrices = 0; if(use_matrices<0) use_matrices = 0;
ai = I->AtomInfo; ai = I->AtomInfo;
#ifdef _PYMOL_IP_EXTRAS #ifdef _PYMOL_IP_EXTRAS
// use stereo or text_type ? // use stereo or text_type ?
switch (op->code){ // only do this for "label2" command (better logic in WrapperObjectSubSc
case OMOP_AlterState: ript)
case OMOP_LABL: if (op->code == OMOP_LABL && op->i2 == cExecutiveLabelEvalAlt) {
case OMOP_ALTR:
use_stereo = PLabelExprUsesVariable(G, op->s1, "stereo"); use_stereo = PLabelExprUsesVariable(G, op->s1, "stereo");
use_text_type = PLabelExprUsesVariable(G, op->s1, "text_type"); use_text_type = PLabelExprUsesVariable(G, op->s1, "text_type");
} }
#ifdef NO_MMLIBS #ifdef NO_MMLIBS
if (use_stereo) { if (use_stereo) {
PRINTFB(G, FB_ObjectMolecule, FB_Warnings) PRINTFB(G, FB_ObjectMolecule, FB_Warnings)
" NO_MMLIBS-Warning: stereochemistry not supported in this PyMOL bui ld.\n" ENDFB(G); " NO_MMLIBS-Warning: stereochemistry not supported in this PyMOL bui ld.\n" ENDFB(G);
} }
if (use_text_type) { if (use_text_type) {
skipping to change at line 11290 skipping to change at line 11298
start = state; start = state;
stop = state + 1; stop = state + 1;
} }
if(stop > I->NCSet) if(stop > I->NCSet)
stop = I->NCSet; stop = I->NCSet;
for(a = start; a < stop; a++) { for(a = start; a < stop; a++) {
CoordSet *cset = 0; CoordSet *cset = 0;
cset = I->CSet[a]; cset = I->CSet[a];
if(cset) { if(cset) {
cset->invalidateRep(rep, level); cset->invalidateRep(rep, level);
#ifndef NO_MMLIBS
if (level >= cRepInvProp) {
cset->validMMStereo = false;
cset->validTextType = false;
}
#endif
} }
} }
} }
PRINTFD(I->Obj.G, FB_ObjectMolecule) PRINTFD(I->Obj.G, FB_ObjectMolecule)
" ObjectMoleculeInvalidate: leaving...\n" ENDFD; " ObjectMoleculeInvalidate: leaving...\n" ENDFD;
} }
void ObjectMoleculeInvalidateAtomType(ObjectMolecule *I, int state){ void ObjectMoleculeInvalidateAtomType(ObjectMolecule *I, int state){
skipping to change at line 11361 skipping to change at line 11363
ObjectMoleculeGetAtomSele(I, index, buffer); ObjectMoleculeGetAtomSele(I, index, buffer);
sprintf(line, "cmd.translate_atom(\"%s\",%15.9f,%15.9f,%15.9f,%d,%d,%d)\n" , sprintf(line, "cmd.translate_atom(\"%s\",%15.9f,%15.9f,%15.9f,%d,%d,%d)\n" ,
buffer, v[0], v[1], v[2], state + 1, mode, 0); buffer, v[0], v[1], v[2], state + 1, mode, 0);
PLog(G, line, cPLog_no_flush); PLog(G, line, cPLog_no_flush);
} }
} }
return (result); return (result);
} }
/*========================================================================*/ /*========================================================================*/
int ObjectMoleculeMoveAtomLabel(ObjectMolecule * I, int state, int index, float int ObjectMoleculeMoveAtomLabel(ObjectMolecule * I, int state, int index, float
*v, *v, int log, float *diff)
int mode, int log)
{ {
int result = 0; int result = 0;
CoordSet *cs; CoordSet *cs;
if(!(I->AtomInfo[index].protekted == 1)) { if(!(I->AtomInfo[index].protekted == 1)) {
if(state < 0) if(state < 0)
state = 0; state = 0;
if(I->NCSet == 1) if(I->NCSet == 1)
state = 0; state = 0;
state = state % I->NCSet; state = state % I->NCSet;
if((!I->CSet[state]) if((!I->CSet[state])
&& (SettingGet_b(I->Obj.G, I->Obj.Setting, NULL, cSetting_all_states))) && (SettingGet_b(I->Obj.G, I->Obj.Setting, NULL, cSetting_all_states)))
state = 0; state = 0;
cs = I->CSet[state]; cs = I->CSet[state];
if(cs) { if(cs) {
result = CoordSetMoveAtomLabel(I->CSet[state], index, v, mode); result = CoordSetMoveAtomLabel(I->CSet[state], index, v, diff);
cs->invalidateRep(cRepLabel, cRepInvCoord); cs->invalidateRep(cRepLabel, cRepInvCoord);
} }
} }
return (result); return (result);
} }
/*========================================================================*/ /*========================================================================*/
int ObjectMoleculeInitBondPath(ObjectMolecule * I, ObjectMoleculeBPRec * bp) int ObjectMoleculeInitBondPath(ObjectMolecule * I, ObjectMoleculeBPRec * bp)
{ {
int a; int a;
skipping to change at line 11657 skipping to change at line 11658
CRay *ray = info->ray; CRay *ray = info->ray;
Picking **pick = info->pick; Picking **pick = info->pick;
int pass = info->pass; int pass = info->pass;
CoordSet *cs; CoordSet *cs;
int pop_matrix = false; int pop_matrix = false;
int use_matrices = SettingGet_i(I->Obj.G, I->Obj.Setting, NULL, cSetting_matri x_mode); int use_matrices = SettingGet_i(I->Obj.G, I->Obj.Setting, NULL, cSetting_matri x_mode);
if(use_matrices<0) use_matrices = 0; if(use_matrices<0) use_matrices = 0;
PRINTFD(I->Obj.G, FB_ObjectMolecule) PRINTFD(I->Obj.G, FB_ObjectMolecule)
" ObjectMolecule: rendering %s pass %d...\n", I->Obj.Name, pass ENDFD; " ObjectMolecule: rendering %s pass %d...\n", I->Obj.Name, pass ENDFD;
ObjectPrepareContext(&I->Obj, ray); ObjectPrepareContext(&I->Obj, info);
if(I->UnitCellCGO && (I->Obj.visRep & cRepCellBit)) { if(I->UnitCellCGO && (I->Obj.visRep & cRepCellBit)) {
if(ray) { if(ray) {
/* need to apply object state matrix here */ /* need to apply object state matrix here */
int ok = CGORenderRay(I->UnitCellCGO, ray, ColorGet(I->Obj.G, I->Obj.Color int ok = CGORenderRay(I->UnitCellCGO, ray, info, ColorGet(I->Obj.G, I->Obj
), .Color),
I->Obj.Setting, NULL); NULL, I->Obj.Setting, NULL);
if (!ok){ if (!ok){
CGOFree(I->UnitCellCGO); CGOFree(I->UnitCellCGO);
} }
} else if(G->HaveGUI && G->ValidContext) { } else if(G->HaveGUI && G->ValidContext) {
if(pick) { if(pick) {
} else { } else {
/* need to apply object state matrix here */ /* need to apply object state matrix here */
ObjectUseColor(&I->Obj); ObjectUseColor(&I->Obj);
CGORenderGL(I->UnitCellCGO, ColorGet(I->Obj.G, I->Obj.Color), CGORenderGL(I->UnitCellCGO, ColorGet(I->Obj.G, I->Obj.Color),
I->Obj.Setting, NULL, info, NULL); I->Obj.Setting, NULL, info, NULL);
skipping to change at line 11942 skipping to change at line 11943
ok_except1: ok_except1:
ErrMessage(I->Obj.G, "ObjectMoleculeSetStateOrder", "failed"); ErrMessage(I->Obj.G, "ObjectMoleculeSetStateOrder", "failed");
VLAFreeP(csets); VLAFreeP(csets);
return false; return false;
} }
/*========================================================================*/ /*========================================================================*/
void ObjectMoleculeFree(ObjectMolecule * I) void ObjectMoleculeFree(ObjectMolecule * I)
{ {
int a; int a;
SceneObjectDel(I->Obj.G, (CObject *) I, false);
SelectorPurgeObjectMembers(I->Obj.G, I); SelectorPurgeObjectMembers(I->Obj.G, I);
for(a = 0; a < I->NCSet; a++){ for(a = 0; a < I->NCSet; a++){
if(I->CSet[a]) { if(I->CSet[a]) {
I->CSet[a]->fFree(); I->CSet[a]->fFree();
I->CSet[a] = NULL; I->CSet[a] = NULL;
} }
} }
/* RemoveAllUndosForObjectMolecule(I); */ /* RemoveAllUndosForObjectMolecule(I); */
if(I->Symmetry) if(I->Symmetry)
SymmetryFree(I->Symmetry); SymmetryFree(I->Symmetry);
skipping to change at line 12035 skipping to change at line 12035
atInfo = I->AtomInfo; atInfo = I->AtomInfo;
isNew = true; isNew = true;
} else { } else {
atInfo = (AtomInfoType*) VLAMalloc(10, sizeof(AtomInfoType), 2, true); /* autozero here is important */ atInfo = (AtomInfoType*) VLAMalloc(10, sizeof(AtomInfoType), 2, true); /* autozero here is important */
CHECKOK(ok, atInfo); CHECKOK(ok, atInfo);
isNew = false; isNew = false;
} }
if(ok && isNew) { if(ok && isNew) {
I->Obj.Color = AtomInfoUpdateAutoColor(G); I->Obj.Color = AtomInfoUpdateAutoColor(G);
if (pdb_info->variant == PDB_VARIANT_VDB) { if (pdb_info->variant == PDB_VARIANT_VDB ||
pdb_info->variant == PDB_VARIANT_PQR) {
// pqr files have no chain identifier by default
// vdb files have same chain identifiers in all symmetry copies // vdb files have same chain identifiers in all symmetry copies
SettingSet(cSetting_retain_order, 1, (CObject *) I); SettingSet(cSetting_retain_order, 1, (CObject *) I);
} }
} }
if (ok) if (ok)
cset = ObjectMoleculePDBStr2CoordSet(G, start, &atInfo, &restart, cset = ObjectMoleculePDBStr2CoordSet(G, start, &atInfo, &restart,
segi_override, m4x, pdb_name, segi_override, m4x, pdb_name,
next_pdb, pdb_info, quiet, model_num ber); next_pdb, pdb_info, quiet, model_num ber);
if (isNew && atInfo != I->AtomInfo){ if (isNew && atInfo != I->AtomInfo){
I->AtomInfo = atInfo; I->AtomInfo = atInfo;
skipping to change at line 12395 skipping to change at line 12397
I->DiscreteAtmToIdx[a0] = I->DiscreteAtmToIdx[a]; I->DiscreteAtmToIdx[a0] = I->DiscreteAtmToIdx[a];
I->DiscreteCSet[a0] = I->DiscreteCSet[a]; I->DiscreteCSet[a0] = I->DiscreteCSet[a];
} }
} }
} }
} }
void AtomInfoSettingGenerateSideEffects(PyMOLGlobals * G, ObjectMolecule *obj, i nt index, int id){ void AtomInfoSettingGenerateSideEffects(PyMOLGlobals * G, ObjectMolecule *obj, i nt index, int id){
switch(index){ switch(index){
case cSetting_label_position: case cSetting_label_position:
case cSetting_label_placement_offset:
case cSetting_label_screen_point:
case cSetting_label_relative_mode:
ObjectMoleculeInvalidate(obj, cRepLabel, cRepInvCoord, -1); ObjectMoleculeInvalidate(obj, cRepLabel, cRepInvCoord, -1);
} }
} }
static int AtomInfoInOrder(PyMOLGlobals * G, AtomInfoType * atom, int atom1, int atom2) static int AtomInfoInOrder(PyMOLGlobals * G, AtomInfoType * atom, int atom1, int atom2)
{ {
return (AtomInfoCompare(G, atom + atom1, atom + atom2) <= 0); return (AtomInfoCompare(G, atom + atom1, atom + atom2) <= 0);
} }
static int AtomInfoInOrderIgnoreHet(PyMOLGlobals * G, AtomInfoType * atom, static int AtomInfoInOrderIgnoreHet(PyMOLGlobals * G, AtomInfoType * atom,
 End of changes. 14 change blocks. 
27 lines changed or deleted 32 lines changed or added

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