658
659
/* ie can happen when the lattice matrix has large non-diagonal elements */
659
660
ARR3SET(x2, core2->x);
661
fractional_minsq(x2, model->periodic);
662
fractional_min(x2, model->periodic);
663
664
#if DEBUG_ATOM_BONDS
664
665
printf(" [%s ?< %f]\n", core2->atom_label, r2cut);
942
943
data->bonds=NULL;
946
/******************************/
947
/* redo bond midpoint offsets */
948
/******************************/
949
void connect_midpoints(struct model_pak *model)
953
struct core_pak *core1, *core2;
954
struct bond_pak *bond;
956
g_assert(model != NULL);
958
for (list=model->bonds ; list ; list=g_slist_next(list))
965
ARR3SET(x, core2->x);
966
ARR3SUB(x, core1->x);
967
fractional_min(x, model->periodic);
969
ARR3SET(bond->offset, x);
948
976
#define DEBUG_CALC_BONDS 0
949
void connect_bonds(struct model_pak *data)
977
void connect_bonds(struct model_pak *model)
952
980
struct core_pak *core;
954
g_assert(data->zone_array != NULL);
982
g_assert(model != NULL);
984
/* enforce a midpoint recalculation (gulp noautobonds + selection rotate fix) */
985
connect_midpoints(model);
989
if (!model->build_molecules)
992
g_assert(model->zone_array != NULL);
959
994
/* TODO - delete polyhedra */
960
995
/* redo atom connectivity */
963
for (list=data->cores ; list ; list=g_slist_next(list))
998
for (list=model->cores ; list ; list=g_slist_next(list))
965
1000
core = list->data;
967
1002
core->status &= ~ZEOL_HIDDEN;
968
1003
if (!(core->status & HIDDEN))
969
connect_atom_compute(core, data);
1004
connect_atom_compute(core, model);
972
1007
/* user bond modification */
973
connect_merge_user(data);
1008
connect_merge_user(model);
975
1010
/* special building modes */
1011
build_hbonds(model);
978
if (data->build_zeolite)
1013
if (model->build_zeolite)
1014
build_zeolite(model);
981
1016
#if DEBUG_CALC_BONDS
983
dump_atom_bonds(data);
1018
dump_atom_bonds(model);