MmtfMoleculeReader.cpp (pymol-v1.8.6.0.tar.bz2) | : | MmtfMoleculeReader.cpp (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 132 | skipping to change at line 132 | |||
MMTF_container * container = MMTF_container_new(); | MMTF_container * container = MMTF_container_new(); | |||
if (!MMTF_unpack_from_string(st, st_len, container)) { | if (!MMTF_unpack_from_string(st, st_len, container)) { | |||
PRINTFB(G, FB_ObjectMolecule, FB_Errors) | PRINTFB(G, FB_ObjectMolecule, FB_Errors) | |||
" Error: Failed to load MMTF file\n" ENDFB(G); | " Error: Failed to load MMTF file\n" ENDFB(G); | |||
MMTF_container_free(container); | MMTF_container_free(container); | |||
return NULL; | return NULL; | |||
} | } | |||
PRINTFB(G, FB_ObjectMolecule, FB_Details) | if (!quiet) { | |||
" MMTF structureId: '%s', mmtfVersion: '%s'\n", | PRINTFB(G, FB_ObjectMolecule, FB_Details) | |||
(container->structureId ? container->structureId : ""), | " MMTF structureId: '%s', mmtfVersion: '%s'\n", | |||
(container->mmtfVersion ? container->mmtfVersion : "") ENDFB(G); | (container->structureId ? container->structureId : ""), | |||
(container->mmtfVersion ? container->mmtfVersion : "") ENDFB(G); | ||||
// title "echo tag" | ||||
if (container->title && container->title[0] && | ||||
strstr(SettingGetGlobal_s(G, cSetting_pdb_echo_tags), "TITLE")) { | ||||
PRINTFB(G, FB_ObjectMolecule, FB_Details) | ||||
"TITLE %s\n", container->title ENDFB(G); | ||||
} | ||||
} | ||||
int chainIndex = 0; | int chainIndex = 0; | |||
int groupIndex = 0; | int groupIndex = 0; | |||
int atomIndex = 0; | int atomIndex = 0; | |||
// template atom | // template atom | |||
AtomInfoType tai; | AtomInfoType tai; | |||
memset(&tai, 0, sizeof(AtomInfoType)); | memset(&tai, 0, sizeof(AtomInfoType)); | |||
tai.visRep = RepGetAutoShowMask(G); | tai.visRep = RepGetAutoShowMask(G); | |||
tai.id = -1; | ||||
tai.q = 1.0f; | ||||
I = ObjectMoleculeNew(G, /* discrete */ 1); | I = ObjectMoleculeNew(G, /* discrete */ 1); | |||
I->Obj.Color = AtomInfoUpdateAutoColor(G); | I->Obj.Color = AtomInfoUpdateAutoColor(G); | |||
I->NAtom = container->numAtoms; | I->NAtom = container->numAtoms; | |||
I->NCSet = container->numModels; | I->NCSet = container->numModels; | |||
I->Bond = VLAlloc(BondType, container->numBonds); | I->Bond = VLAlloc(BondType, container->numBonds); | |||
VLASize(I->AtomInfo, AtomInfoType, I->NAtom); | VLASize(I->AtomInfo, AtomInfoType, I->NAtom); | |||
VLASize(I->CSet, CoordSet *, I->NCSet); | VLASize(I->CSet, CoordSet *, I->NCSet); | |||
int nindexEstimate = container->numAtoms / std::max(1, container->numModels); | int nindexEstimate = container->numAtoms / std::max(1, container->numModels); | |||
skipping to change at line 246 | skipping to change at line 257 | |||
if (container->bFactorList) | if (container->bFactorList) | |||
ai->b = container->bFactorList[atomIndex]; | ai->b = container->bFactorList[atomIndex]; | |||
if (container->occupancyList) | if (container->occupancyList) | |||
ai->q = container->occupancyList[atomIndex]; | ai->q = container->occupancyList[atomIndex]; | |||
if (container->altLocList) | if (container->altLocList) | |||
ai->alt[0] = container->altLocList[atomIndex]; | ai->alt[0] = container->altLocList[atomIndex]; | |||
AtomInfoAssignParameters(G, ai); | AtomInfoAssignParameters(G, ai); | |||
AtomInfoAssignColors(G, ai); | AtomInfoAssignColors(G, ai); | |||
if (container->pymolRepsList) { | ||||
ai->visRep = container->pymolRepsList[atomIndex]; | ||||
ai->flags |= cAtomFlag_inorganic; // suppress auto_show_classified | ||||
} | ||||
if (container->pymolColorList) { | ||||
ai->color = container->pymolColorList[atomIndex]; | ||||
} | ||||
VLACheck(cset->IdxToAtm, int, cset->NIndex); | VLACheck(cset->IdxToAtm, int, cset->NIndex); | |||
VLACheck(cset->Coord, float, 3 * cset->NIndex + 2); | VLACheck(cset->Coord, float, 3 * cset->NIndex + 2); | |||
cset->IdxToAtm[cset->NIndex] = atomIndex; | cset->IdxToAtm[cset->NIndex] = atomIndex; | |||
float * coord = cset->coordPtr(cset->NIndex); | float * coord = cset->coordPtr(cset->NIndex); | |||
cset->NIndex++; | cset->NIndex++; | |||
coord[0] = container->xCoordList[atomIndex]; | coord[0] = container->xCoordList[atomIndex]; | |||
coord[1] = container->yCoordList[atomIndex]; | coord[1] = container->yCoordList[atomIndex]; | |||
coord[2] = container->zCoordList[atomIndex]; | coord[2] = container->zCoordList[atomIndex]; | |||
} | } | |||
skipping to change at line 291 | skipping to change at line 311 | |||
I->NBond, container->numBonds ENDFB(G); | I->NBond, container->numBonds ENDFB(G); | |||
} | } | |||
if (discrete < 1) { | if (discrete < 1) { | |||
ObjectMoleculeSetDiscrete(G, I, 0); | ObjectMoleculeSetDiscrete(G, I, 0); | |||
} else { | } else { | |||
I->updateAtmToIdx(); | I->updateAtmToIdx(); | |||
} | } | |||
// assemblies | // assemblies | |||
if (!I->DiscreteFlag) { | if (!I->DiscreteFlag && I->NCSet > 0) { | |||
CoordSet ** assembly_csets = get_assembly_csets(G, container, | CoordSet ** assembly_csets = get_assembly_csets(G, container, | |||
I->AtomInfo, I->CSet[0]); | I->AtomInfo, I->CSet[0]); | |||
ObjectMoleculeSetAssemblyCSets(I, assembly_csets); | ObjectMoleculeSetAssemblyCSets(I, assembly_csets); | |||
} | } | |||
MMTF_container_free(container); | MMTF_container_free(container); | |||
ObjectMoleculeInvalidate(I, cRepAll, cRepInvAll, -1); | ObjectMoleculeInvalidate(I, cRepAll, cRepInvAll, -1); | |||
ObjectMoleculeUpdateNonbonded(I); | ObjectMoleculeUpdateNonbonded(I); | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 25 lines changed or added |