00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <stdio.h>
00025
00026 #include "GeometryDihedral.h"
00027 #include "MoleculeList.h"
00028 #include "Molecule.h"
00029 #include "utilities.h"
00030
00031
00033 GeometryDihedral::GeometryDihedral(int *m, int *a, const int *cell,
00034 MoleculeList *mlist,
00035 CommandQueue *cq, Displayable *d)
00036 : GeometryMol(4, m, a, cell, mlist, cq, d) {
00037
00038 }
00039
00040
00041
00043
00044
00045 float GeometryDihedral::calculate(void) {
00046
00047
00048 float pos1[3], pos2[3], pos3[3], pos4[3];
00049 if(!normal_atom_coord(0, pos1))
00050 return 0.0;
00051 if(!normal_atom_coord(1, pos2))
00052 return 0.0;
00053 if(!normal_atom_coord(2, pos3))
00054 return 0.0;
00055 if(!normal_atom_coord(3, pos4))
00056 return 0.0;
00057
00058 return (geomValue = dihedral(pos1, pos2, pos3, pos4));
00059 }
00060
00061
00062
00063 void GeometryDihedral::create_cmd_list() {
00064 char valbuf[32];
00065
00066
00067 reset_disp_list();
00068 float pos1[3], pos2[3], pos3[3], pos4[3];
00069 if(!transformed_atom_coord(0, pos1))
00070 return;
00071 if(!transformed_atom_coord(1, pos2))
00072 return;
00073 if(!transformed_atom_coord(2, pos3))
00074 return;
00075 if(!transformed_atom_coord(3, pos4))
00076 return;
00077
00078 DispCmdColorIndex cmdColor;
00079 cmdColor.putdata(my_color, cmdList);
00080
00081 DispCmdLineType cmdLineType;
00082 DispCmdLineWidth cmdLineWidth;
00083 cmdLineType.putdata(DASHEDLINE, cmdList);
00084 cmdLineWidth.putdata(4, cmdList);
00085
00086
00087 display_line(pos1, pos2, cmdList);
00088 display_line(pos2, pos3, cmdList);
00089 display_line(pos3, pos4, cmdList);
00090
00091
00092 midpoint(valuePos, pos2, pos3);
00093
00094
00095
00096 valuePos[0] += 0.05f;
00097 sprintf(valbuf, "%-7.2f", geomValue);
00098 display_string(valbuf, cmdList);
00099 }
00100
00101 void GeometryDihedral::set_pick(void) {
00102
00103 if (objIndex[0] == objIndex[1] && objIndex[1] == objIndex[2] &&
00104 objIndex[2] == objIndex[3]) {
00105 set_pick_selection(objIndex[0], 4, comIndex);
00106 } else {
00107 set_pick_selection();
00108 }
00109 set_pick_value(geomValue);
00110 }
00111