"Fossies" - the Fresh Open Source Software Archive  

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

CifMoleculeReader.cpp  (pymol-v2.1.0.tar.bz2):CifMoleculeReader.cpp  (pymol-open-source-2.2.0)
skipping to change at line 299 skipping to change at line 299
subtract3f( subtract3f(
cset->coordPtr(idx1), cset->coordPtr(idx1),
cset->coordPtr(idx2), v); cset->coordPtr(idx2), v);
return length3f(v); return length3f(v);
} }
/* /*
* Bond order string to int * Bond order string to int
*/ */
static int bondOrderLookup(const char * order) { static int bondOrderLookup(const char * order) {
switch (order[0]) { if (p_strcasestartswith(order, "doub"))
case 'a': case 'A': // arom return 2;
return 4; if (p_strcasestartswith(order, "trip"))
case 't': case 'T': // triple return 3;
return 3; if (p_strcasestartswith(order, "arom"))
case 'd': case 'D': return 4;
switch (order[1]) { if (p_strcasestartswith(order, "delo"))
case 'e': case 'E': // deloc return 4;
return 4;
}
// double
return 2;
}
// single // single
return 1; return 1;
} }
/* /*
* Read bonds from CHEM_COMP_BOND in `bond_dict` dictionary * Read bonds from CHEM_COMP_BOND in `bond_dict` dictionary
*/ */
static bool read_chem_comp_bond_dict(const cif_data * data, bond_dict_t &bond_di ct) { static bool read_chem_comp_bond_dict(const cif_data * data, bond_dict_t &bond_di ct) {
const cif_array *arr_id_1, *arr_id_2, *arr_order, *arr_comp_id; const cif_array *arr_id_1, *arr_id_2, *arr_order, *arr_comp_id;
skipping to change at line 470 skipping to change at line 465
return false; return false;
} }
// reserve some memory for new bonds // reserve some memory for new bonds
if (!I->Bond) { if (!I->Bond) {
I->Bond = VLACalloc(BondType, I->NAtom * 4); I->Bond = VLACalloc(BondType, I->NAtom * 4);
} else { } else {
VLACheck(I->Bond, BondType, I->NAtom * 4); VLACheck(I->Bond, BondType, I->NAtom * 4);
} }
for (int i = 0;; ++i) { for (int i = 0; i < I->NAtom; ++i) {
// intra-residue // intra-residue
if(!AtomInfoSameResidue(G, I->AtomInfo + i_start, I->AtomInfo + i)) { if(!AtomInfoSameResidue(G, I->AtomInfo + i_start, I->AtomInfo + i)) {
ConnectComponent(I, i_start, i, bond_dict); ConnectComponent(I, i_start, i, bond_dict);
i_start = i; i_start = i;
} }
if (i == I->NAtom)
break;
// ignore alt coords for inter-residue bonding // ignore alt coords for inter-residue bonding
if (I->AtomInfo[i].alt[0] && I->AtomInfo[i].alt[0] != 'A') if (I->AtomInfo[i].alt[0] && I->AtomInfo[i].alt[0] != 'A')
continue; continue;
const char *name = LexStr(G, I->AtomInfo[i].name); const char *name = LexStr(G, I->AtomInfo[i].name);
// inter-residue polymer bonds // inter-residue polymer bonds
if (strcmp("C", name) == 0) { if (strcmp("C", name) == 0) {
i_prev_c = i; i_prev_c = i;
} else if (strncmp("O3", name, 2) == 0 && (name[2] == '*' || name[2] == '\'' )) { } else if (strncmp("O3", name, 2) == 0 && (name[2] == '*' || name[2] == '\'' )) {
skipping to change at line 506 skipping to change at line 498
if (i_prev >= 0 && !AtomInfoSameResidue(G, if (i_prev >= 0 && !AtomInfoSameResidue(G,
I->AtomInfo + i_prev, I->AtomInfo + i) I->AtomInfo + i_prev, I->AtomInfo + i)
&& GetDistance(I, i_prev, i) < 1.8) { && GetDistance(I, i_prev, i) < 1.8) {
// make bond // make bond
ObjectMoleculeAddBond2(I, i_prev, i, 1); ObjectMoleculeAddBond2(I, i_prev, i, 1);
} }
} }
} }
// final residue
ConnectComponent(I, i_start, I->NAtom, bond_dict);
// clean up // clean up
VLASize(I->Bond, BondType, I->NBond); VLASize(I->Bond, BondType, I->NBond);
return true; return true;
} }
/* /*
* secondary structure hash * secondary structure hash
*/ */
class sshashkey { class sshashkey {
skipping to change at line 1869 skipping to change at line 1864
// identifiers -> coord set index // identifiers -> coord set index
std::map<std::string, int> name_dict; std::map<std::string, int> name_dict;
for (int i = 0; i < nAtom; i++) { for (int i = 0; i < nAtom; i++) {
int idx = cset->atmToIdx(i); int idx = cset->atmToIdx(i);
if (idx != -1) if (idx != -1)
name_dict[make_mm_atom_site_label(G, atInfo + i)] = idx; name_dict[make_mm_atom_site_label(G, atInfo + i)] = idx;
} }
bool metalc_as_zero = SettingGetGlobal_b(G, cSetting_cif_metalc_as_zero_order_
bonds);
for (int i = 0; i < nrows; i++) { for (int i = 0; i < nrows; i++) {
const char * type_id = col_type_id->as_s(i); const char * type_id = col_type_id->as_s(i);
if (strncasecmp(type_id, "covale", 6) && if (strncasecmp(type_id, "covale", 6) &&
strcasecmp(type_id, "modres") && strcasecmp(type_id, "modres") &&
#ifdef _PYMOL_IP_EXTRAS #ifdef _PYMOL_IP_EXTRAS
strcasecmp(type_id, "metalc") && !(metalc_as_zero && strcasecmp(type_id, "metalc") == 0) &&
#endif #endif
strcasecmp(type_id, "disulf")) strcasecmp(type_id, "disulf"))
// ignore non-covalent bonds (saltbr, hydrog) // ignore non-covalent bonds (saltbr, hydrog)
continue; continue;
if (strcmp(col_symm[0]->as_s(i), if (strcmp(col_symm[0]->as_s(i),
col_symm[1]->as_s(i))) col_symm[1]->as_s(i)))
// don't bond to symmetry mates // don't bond to symmetry mates
continue; continue;
std::string key[2]; std::string key[2];
skipping to change at line 1953 skipping to change at line 1950
static BondType * read_chem_comp_bond(PyMOLGlobals * G, cif_data * data, static BondType * read_chem_comp_bond(PyMOLGlobals * G, cif_data * data,
AtomInfoType * atInfo) { AtomInfoType * atInfo) {
const cif_array *col_ID_1, *col_ID_2, *col_comp_id; const cif_array *col_ID_1, *col_ID_2, *col_comp_id;
if ((col_ID_1 = data->get_arr("_chem_comp_bond.atom_id_1")) == NULL || if ((col_ID_1 = data->get_arr("_chem_comp_bond.atom_id_1")) == NULL ||
(col_ID_2 = data->get_arr("_chem_comp_bond.atom_id_2")) == NULL || (col_ID_2 = data->get_arr("_chem_comp_bond.atom_id_2")) == NULL ||
(col_comp_id = data->get_arr("_chem_comp_bond.comp_id")) == NULL) (col_comp_id = data->get_arr("_chem_comp_bond.comp_id")) == NULL)
return NULL; return NULL;
const cif_array *col_order = data->get_opt("_chem_comp_bond.value_order"); // "_chem_comp_bond.type" seems to be non-standard here. It's found in the
// wild with values like "double" and "aromatic". mmcif_nmr-star.dic defines
// it, but with different vocabulary (e.g. "amide", "ether", etc.).
const cif_array *col_order = data->get_opt(
"_chem_comp_bond.value_order",
"_chem_comp_bond.type");
int nrows = col_ID_1->get_nrows(); int nrows = col_ID_1->get_nrows();
int nAtom = VLAGetSize(atInfo); int nAtom = VLAGetSize(atInfo);
int nBond = 0; int nBond = 0;
BondType *bondvla, *bond; BondType *bondvla, *bond;
bondvla = bond = VLACalloc(BondType, 6 * nAtom); bondvla = bond = VLACalloc(BondType, 6 * nAtom);
// name -> atom index // name -> atom index
std::map<std::string, int> name_dict; std::map<std::string, int> name_dict;
 End of changes. 7 change blocks. 
19 lines changed or deleted 23 lines changed or added

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