File: distort.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 (65 lines) | stat: -rw-r--r-- 1,902 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
/*******************************************************************************
*                                                                              *
*                                   Viewmol                                    *
*                                                                              *
*                              D I S T O R T . C                               *
*                                                                              *
*                 Copyright (c) Joerg-R. Hill, December 2000                   *
*                                                                              *
********************************************************************************
*
* $Id: distort.c,v 1.5 2000/12/10 15:04:51 jrh Exp $
* $Log: distort.c,v $
* Revision 1.5  2000/12/10 15:04:51  jrh
* Release 2.3
*
* Revision 1.4  1999/05/24 01:25:08  jrh
* Release 2.2.1
*
* Revision 1.3  1999/02/07 21:46:57  jrh
* Release 2.2
*
* Revision 1.2  1998/01/26 00:47:24  jrh
* Release 2.1
*
* Revision 1.1  1996/12/10  18:40:16  jrh
* Initial revision
*
*/
#include<stdlib.h>
#include "viewmol.h"
#include "dialog.h"

extern struct MOLECULE *molecules;
extern struct WINDOW windows[];

void distortGeometry(double);

extern int calcInternal(struct MOLECULE *, int);

extern int ninternal;

void distortGeometry(double factor)
{
  struct MOLECULE *mol;
  int mode;
  register int i, l, n;

  mol=&molecules[windows[SPECTRUM].set];
  mode=mol->mode;
  if (mode != -1)
  {
    n=mol->na;
    if (mol->existsUnitCell) n-=8;
    for (i=0; i<n; i++)
    {
	l=3*mol->atoms[i].ref;
      mol->atoms[i].x+=factor*mol->cnm[mode+mol->nmodes*l];
      mol->atoms[i].y+=factor*mol->cnm[mode+mol->nmodes*(l+1)];
      mol->atoms[i].z+=factor*mol->cnm[mode+mol->nmodes*(l+2)];
      l+=3;
    }
    for (i=0; i<mol->ninternal; i++)
      (void)calcInternal(mol, i);
  }
}