added s2xyz tools
[physik/posic.git] / s2xyz.c
diff --git a/s2xyz.c b/s2xyz.c
new file mode 100644 (file)
index 0000000..5163e41
--- /dev/null
+++ b/s2xyz.c
@@ -0,0 +1,55 @@
+/*
+ * calcultae pair correlation function
+ *
+ * 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"
+
+#define ME "[s2xyz]"
+
+int main(int argc,char **argv) {
+
+       t_moldyn moldyn;
+       int i,ret;
+       char color[2][64];
+       char type[2][8];
+
+       memset(&moldyn,0,sizeof(t_moldyn));
+
+       strcpy(color[0],"Yellow");
+       strcpy(type[0],"Si");
+       strcpy(color[1],"Gray");
+       strcpy(type[1],"C");
+
+       ret=moldyn_read_save_file(&moldyn,argv[1]);
+       if(ret) {
+               printf("%s exit!\n",ME);
+               return ret;
+       }
+
+
+       printf("# [P] %d 0 <0,0,0>\n",moldyn.count);
+
+       for(i=0;i<moldyn.count;i++)
+               printf("%s %f %f %f %s %f\n",
+                      type[moldyn.atom[i].brand],
+                      moldyn.atom[i].r.x,
+                      moldyn.atom[i].r.y,
+                      moldyn.atom[i].r.z,
+                      color[moldyn.atom[i].brand],
+                      moldyn.atom[i].ekin/EV);
+
+       return 0;
+}
+