added s2xyz tools
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 19 May 2010 15:14:14 +0000 (17:14 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Wed, 19 May 2010 15:14:14 +0000 (17:14 +0200)
s2xyz.c [new file with mode: 0644]
s2xyz_script [new file with mode: 0755]

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;
+}
+
diff --git a/s2xyz_script b/s2xyz_script
new file mode 100755 (executable)
index 0000000..98ee7f5
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+DIR="$1"
+
+for i in $1/s-*.save; do
+       FILE="`basename $i`"
+       NUM="`echo $FILE | awk -F- '{ print $2 }' | awk -F. '{ print $1 }'`"
+       TRG="$DIR/atomic_conf_${NUM}.xyz"
+       echo "converting $i -> $TRG"
+       ./s2xyz $i > $TRG
+done
+
+       
+