]> hackdaworld.org Git - physik/posic.git/blob - display_atom_data.c
removed the +
[physik/posic.git] / display_atom_data.c
1 /*
2  * code to display atom data
3  *
4  * author: frank.zirkelbach@physik.uni-augsburg.de
5  *
6  */
7
8 #define _GNU_SOURCE
9 #include <stdio.h>
10 //#include <stdlib.h>
11 //#include <unistd.h>
12 //#include <string.h>
13 //#include <sys/types.h>
14 //#include <sys/stat.h>
15 //#include <fcntl.h>
16
17 #include "moldyn.h"
18 #include "potentials/albe.h"
19
20 int usage(char *prog) {
21
22         printf("\nusage:\n");
23         printf("  %s <save file> <nr1> <nr2> ... \n\n",prog);
24
25         return -1;
26 }
27
28 int main(int argc,char **argv) {
29
30         t_moldyn moldyn;
31         int ret;
32         int i;
33         int nr;
34         t_atom *atom;
35         double off;
36         double lc;
37
38         if(argc<2) {
39                 usage(argv[0]);
40                 return -1;
41         }
42
43         memset(&moldyn,0,sizeof(t_moldyn));
44
45         printf("[search bonds] reading save file ...\n");
46         ret=moldyn_read_save_file(&moldyn,argv[1]);
47         if(ret) {
48                 printf("[search bonds] exit!\n");
49                 return ret;
50         }
51
52         /* todo: guessing offset/lc */
53         lc=ALBE_LC_SI;
54         off=0.125*lc-0.5*lc;
55
56         for(i=2;i<argc;i++) {
57
58                 nr=atoi(argv[i]);
59                 atom=&(moldyn.atom[nr]);
60                 printf("\n## atom %d ##\n",nr);
61                 printf("    r        r0         r-o      ");
62                 printf("r0-o       dr         r-o [lc]\n");
63                 printf("    -----------------------------");
64                 printf("------------------------------\n");
65                 printf(" x: %f %f | %f %f | %f | %f\n",
66                        atom->r.x,atom->r_0.x,atom->r.x-off,atom->r_0.x-off,
67                        atom->r.x-atom->r_0.x,(atom->r.x-off)/lc);
68                 printf(" y: %f %f | %f %f | %f | %f\n",
69                        atom->r.y,atom->r_0.y,atom->r.y-off,atom->r_0.y-off,
70                        atom->r.y-atom->r_0.y,(atom->r.y-off)/lc);
71                 printf(" z: %f %f | %f %f | %f | %f\n",
72                        atom->r.z,atom->r_0.z,atom->r.z-off,atom->r_0.z-off,
73                        atom->r.z-atom->r_0.z,(atom->r.z-off)/lc);
74                 
75         }
76         
77         moldyn_free_save_file(&moldyn);
78
79         return 0;
80 }