]> hackdaworld.org Git - physik/posic.git/commitdiff
added display atom data tool
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Fri, 9 May 2008 07:31:49 +0000 (09:31 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Fri, 9 May 2008 07:31:49 +0000 (09:31 +0200)
Makefile
display_atom_data.c [new file with mode: 0644]

index 36c411ef907eece86406a2b9bf0754ff7b26619a..47670a825c9f5cf3af48675999688c6945ebc9e4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ DEPS += potentials/lennard_jones.o potentials/harmonic_oscillator.o
 DEPS += potentials/tersoff.o potentials/albe.o
 
 ALL = mdrun sic fluctuation_calc postproc pair_correlation_calc diffusion_calc
-ALL += bond_analyze search_bonds visual_atoms
+ALL += bond_analyze search_bonds visual_atoms display_atom_data
 
 all: $(ALL)
 
@@ -43,6 +43,8 @@ search_bonds: $(DEPS)
 
 visual_atoms: $(DEPS)
 
+display_atom_data: $(DEPS)
+
 .PHONY:clean
 clean:
        rm -vf $(ALL) *.o */*.o
diff --git a/display_atom_data.c b/display_atom_data.c
new file mode 100644 (file)
index 0000000..0872366
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * code to display atom data
+ *
+ * author: frank.zirkelbach@physik.uni-augsburg.de
+ *
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+//#include <stdlib.h>
+//#include <unistd.h>
+//#include <string.h>
+//#include <sys/types.h>
+//#include <sys/stat.h>
+//#include <fcntl.h>
+
+#include "moldyn.h"
+#include "potentials/albe.h"
+
+int usage(char *prog) {
+
+       printf("\nusage:\n");
+       printf("  %s <save file> <nr1> <nr2> ... \n\n",prog);
+
+       return -1;
+}
+
+int main(int argc,char **argv) {
+
+       t_moldyn moldyn;
+       int ret;
+       int i;
+       int nr;
+       t_atom *atom;
+       double off;
+       double lc;
+
+       if(argc<2) {
+               usage(argv[0]);
+               return -1;
+       }
+
+       memset(&moldyn,0,sizeof(t_moldyn));
+
+       printf("[search bonds] reading save file ...\n");
+       ret=moldyn_read_save_file(&moldyn,argv[1]);
+       if(ret) {
+               printf("[search bonds] exit!\n");
+               return ret;
+       }
+
+       /* todo: guessing offset/lc */
+       lc=ALBE_LC_SI;
+       off=0.125*lc-0.5*lc;
+
+       for(i=2;i<argc;i++) {
+
+               nr=atoi(argv[i]);
+               atom=&(moldyn.atom[nr]);
+               printf("\n## atom %d ##\n",nr);
+               printf("    r        r0         r-o      ");
+               printf("r0-o       dr         r-o [lc]\n");
+               printf("    -----------------------------");
+               printf("------------------------------\n");
+               printf(" x: %f %f | %f %f | %f | %f\n",
+                      atom->r.x,atom->r_0.x,atom->r.x-off,atom->r_0.x-off,
+                      atom->r.x-atom->r_0.x,(atom->r.x-off)/lc);
+               printf(" y: %f %f | %f %f | %f | %f\n",
+                      atom->r.y,atom->r_0.y,atom->r.y-off,atom->r_0.y-off,
+                      atom->r.y-atom->r_0.y,(atom->r.y-off)/lc);
+               printf(" z: %f %f | %f %f | %f | %f\n",
+                      atom->r.z,atom->r_0.z,atom->r.z-off,atom->r_0.z-off,
+                      atom->r.z-atom->r_0.z,(atom->r.z-off)/lc);
+               
+       }
+       
+       moldyn_free_save_file(&moldyn);
+
+       return 0;
+}