~ubuntu-branches/ubuntu/trusty/gdis/trusty

« back to all changes in this revision

Viewing changes to connect.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Leidert (dale)
  • Date: 2009-04-06 17:12:18 UTC
  • mfrom: (3.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090406171218-uizoe126jrq09ytt
Tags: 0.90-1
* New upstream release 0.90.
* Acknowledge NMU (closes: #492994). Thanks to Neil Williams.

* makefile.debian: Upstream doesn't provide a Makefile to edit - so created
  our own.
* debian/compat: Added and set to be 5.
* debian/control: Added Homepage, Vcs* and DM-Upload-Allowed fields.
  (Maintainer): Set to the debichem team with approval by Noèl.
  (Uploaders): Added myself.
  (Build-Depends): Increased debhelper version to 5. Removed glutg3-dev.
  Added dpatch.
  (Standards-Version): Bumped to 3.8.1.
  (Description): Removed homepage. Fixed a typo.
* debian/copyright: Updated, completed and adjusted.
* debian/dirs: Dropped useless file.
* debian/docs: Renamed to debian/gdis.docs.
* debian/menu: Renamed to debian/gdis.menu.
  (section): Fixed accordingly to policy.
* debian/gdis.1: Just some formatting changes.
* debian/gdis.desktop: Added file (with small fixes) provided by Phill Bull
  (LP: #111353).
* debian/gdis.install: Added.
* debian/rules: Cleaned. Installation is now done by dh_install. Make sure,
  the CVS directory is not copied. Added dh_desktop call.
* debian/source.lintian-overrides: makefile.debian is created for Debian but
  lives outside debian/.
* debian/watch: Added.
* debian/README.build: Dropped.
* debian/README.source: Added to be compliant to the policy v3.8.
* debian/patches/Debian_make.dpatch: Added.
  - gdis.h (ELEM_FILE): Moved fix for gdis.elemts path (#399132) to this
    patch.
* debian/patches/00list: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "gdis.h"
34
34
#include "coords.h"
35
35
#include "interface.h"
36
 
#include "shortcuts.h"
 
36
#include "gui_shorts.h"
37
37
#include "matrix.h"
 
38
#include "model.h"
38
39
#include "spatial.h"
39
40
#include "numeric.h"
40
41
#include "morph.h"
658
659
/* ie can happen when the lattice matrix has large non-diagonal elements */
659
660
  ARR3SET(x2, core2->x);
660
661
  ARR3SUB(x2, x1);
661
 
  fractional_minsq(x2, model->periodic);
 
662
  fractional_min(x2, model->periodic);
662
663
 
663
664
#if DEBUG_ATOM_BONDS
664
665
printf(" [%s ?< %f]\n", core2->atom_label, r2cut);
759
760
    core2 = bond2->atom2;
760
761
    ARR3SET(x, core2->x);
761
762
    ARR3SUB(x, core1->x);
762
 
    fractional_minsq(x, data->periodic);
 
763
    fractional_min(x, data->periodic);
763
764
    VEC3MUL(x, 0.5);
764
765
    ARR3SET(bond2->offset, x);
765
766
 
942
943
data->bonds=NULL;
943
944
}
944
945
 
 
946
/******************************/
 
947
/* redo bond midpoint offsets */
 
948
/******************************/
 
949
void connect_midpoints(struct model_pak *model)
 
950
{
 
951
gdouble x[3];
 
952
GSList *list;
 
953
struct core_pak *core1, *core2;
 
954
struct bond_pak *bond;
 
955
 
 
956
g_assert(model != NULL);
 
957
 
 
958
for (list=model->bonds ; list ; list=g_slist_next(list))
 
959
  {
 
960
  bond = list->data;
 
961
 
 
962
/* compute offset */
 
963
  core1 = bond->atom1;
 
964
  core2 = bond->atom2;
 
965
  ARR3SET(x, core2->x);
 
966
  ARR3SUB(x, core1->x);
 
967
  fractional_min(x, model->periodic);
 
968
  VEC3MUL(x, 0.5);
 
969
  ARR3SET(bond->offset, x);
 
970
  }
 
971
}
 
972
 
945
973
/*********/
946
974
/* BONDS */
947
975
/*********/
948
976
#define DEBUG_CALC_BONDS 0
949
 
void connect_bonds(struct model_pak *data)
 
977
void connect_bonds(struct model_pak *model)
950
978
{
951
979
GSList *list;
952
980
struct core_pak *core;
953
981
 
954
 
g_assert(data->zone_array != NULL);
955
 
 
956
 
if (data->anim_fix)
957
 
  return;
 
982
g_assert(model != NULL);
 
983
 
 
984
/* enforce a midpoint recalculation (gulp noautobonds + selection rotate fix) */
 
985
connect_midpoints(model);
 
986
 
 
987
if (model->anim_fix)
 
988
  return;
 
989
if (!model->build_molecules)
 
990
  return;
 
991
 
 
992
g_assert(model->zone_array != NULL);
958
993
 
959
994
/* TODO - delete polyhedra */
960
995
/* redo atom connectivity */
961
 
wipe_bonds(data);
 
996
wipe_bonds(model);
962
997
 
963
 
for (list=data->cores ; list ; list=g_slist_next(list))
 
998
for (list=model->cores ; list ; list=g_slist_next(list))
964
999
  {
965
1000
  core = list->data;
966
1001
 
967
1002
  core->status &= ~ZEOL_HIDDEN;
968
1003
  if (!(core->status & HIDDEN))
969
 
    connect_atom_compute(core, data);
 
1004
    connect_atom_compute(core, model);
970
1005
  }
971
1006
 
972
1007
/* user bond modification */
973
 
connect_merge_user(data);
 
1008
connect_merge_user(model);
974
1009
 
975
1010
/* special building modes */
976
 
build_hbonds(data);
 
1011
build_hbonds(model);
977
1012
 
978
 
if (data->build_zeolite)
979
 
  build_zeolite(data);
 
1013
if (model->build_zeolite)
 
1014
  build_zeolite(model);
980
1015
 
981
1016
#if DEBUG_CALC_BONDS
982
 
dump_bonds(data);
983
 
dump_atom_bonds(data);
 
1017
dump_bonds(model);
 
1018
dump_atom_bonds(model);
984
1019
#endif
985
1020
}
986
1021
 
1152
1187
        core2->status |= PRUNED;
1153
1188
 
1154
1189
/* always attempt to unfragment molecules */
1155
 
/* CURRENT - fix for fractional_minsq not giving cartesian minimum */
 
1190
/* CURRENT - fix for fractional_min not giving cartesian minimum */
1156
1191
        ARR3ADD(x, core->x);
1157
1192
        ARR3SUB(x, core2->x);
1158
1193
        ARR3ADD(core2->x, x);