File: normod.c

package info (click to toggle)
viewmol 2.3-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 9,424 kB
  • ctags: 2,239
  • sloc: ansic: 29,098; sh: 909; makefile: 513; python: 238
file content (75 lines) | stat: -rw-r--r-- 2,257 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*******************************************************************************
*                                                                              *
*                                   Viewmol                                    *
*                                                                              *
*                               N O R M O D . C                                *
*                                                                              *
*                 Copyright (c) Joerg-R. Hill, December 2000                   *
*                                                                              *
********************************************************************************
*
* $Id: normod.c,v 1.5 2000/12/10 15:13:19 jrh Exp $
* $Log: normod.c,v $
* Revision 1.5  2000/12/10 15:13:19  jrh
* Release 2.3
*
* Revision 1.4  1999/05/24 01:26:49  jrh
* Release 2.2.1
*
* Revision 1.3  1999/02/07 21:53:50  jrh
* Release 2.2
*
* Revision 1.2  1998/01/26 00:48:55  jrh
* Release 2.1
*
* Revision 1.1  1996/12/10  18:42:41  jrh
* Initial revision
*
*/
#include<X11/Intrinsic.h>
#include "viewmol.h"

extern void redraw(int);
extern int  calcInternal(struct MOLECULE *, int);

extern struct MOLECULE *molecules;
extern double amplitude;
extern int nmolecule;

Boolean normalMode(XtPointer data)
{
  static int j=1, k=0;
  double fac;
  int imol, mode;
  register int i, l, n;

/*if ((int)data == 1)
  {
    j=1;
    k=0;
  }*/
  fac=(double)j*amplitude*0.05;
  for (imol=0; imol<nmolecule; imol++)
  {
    n=molecules[imol].na;
    mode=molecules[imol].mode;
    if (mode != (-1))
    {
      if (molecules[imol].existsUnitCell) n-=8;
      for (i=0; i<n; i++)
      {
        l=3*molecules[imol].atoms[i].ref;
        molecules[imol].atoms[i].x+=fac*molecules[imol].cnm[mode+molecules[imol].nmodes*l];
        molecules[imol].atoms[i].y+=fac*molecules[imol].cnm[mode+molecules[imol].nmodes*(l+1)];
        molecules[imol].atoms[i].z+=fac*molecules[imol].cnm[mode+molecules[imol].nmodes*(l+2)];
      }
      for (i=0; i<molecules[imol].ninternal; i++)
        (void)calcInternal(&molecules[imol], i);
    }
  }
  if (j < 0) k--;
  else       k++;
  if (abs(k) == 5) j=-j;
  redraw(VIEWER);
  return(False);
}