From ae95dc386b4b14241eb11637891138ea1ca6b072 Mon Sep 17 00:00:00 2001
From: hackbard <hackbard@sage.physik.uni-augsburg.de>
Date: Wed, 8 Jul 2009 18:47:00 +0200
Subject: [PATCH] well, sure, just increment each basis by 1 ... (should work
 now!)

---
 vasp_tools/create_lattice.c | 47 +++++++++++++++++++++++++++----------
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/vasp_tools/create_lattice.c b/vasp_tools/create_lattice.c
index bbcc39e..4b258a0 100644
--- a/vasp_tools/create_lattice.c
+++ b/vasp_tools/create_lattice.c
@@ -44,7 +44,7 @@
 
 int main(int argc,char **argv) {
 
-	int i,j,k,l,cnt;
+	int i,j,k,l,cnt,estimated;
 	int x,y,z;
 	t_3dvec basis[3];
 	t_3dvec o[3];
@@ -113,16 +113,38 @@ int main(int argc,char **argv) {
 
 	cnt=0;
 
+	estimated=1;
+	if(fccdia=='1') estimated*=2;
+	if(type=='1') estimated*=2;
+	if(type=='2') estimated*=4;
+	estimated*=x*y*z;
+
+	// print POSCAR 'header'
+
+	printf("cubic diamond\n");
+	printf(" 5.429\n");
+
+	v3_scale(&h,&basis[0],x);
+	printf(" %.5f %.5f %.5f\n",h.x,h.y,h.z);
+	v3_scale(&h,&basis[1],y);
+	printf(" %.5f %.5f %.5f\n",h.x,h.y,h.z);
+	v3_scale(&h,&basis[2],z);
+	printf(" %.5f %.5f %.5f\n",h.x,h.y,h.z);
+
+	printf(" %d\n",estimated);
+	printf("selective dynamics\n");
+	printf("direct\n");
+
+	// now print the coordinates
+	
 	for(i=0;i<x;i++) {
 		for(j=0;j<y;j++) {
 			for(k=0;k<z;k++) {
 
 	// first atom (all types)
-	v3_scale(&r,&basis[0],i);
-	v3_scale(&h,&basis[1],j);
-	v3_add(&r,&r,&h);
-	v3_scale(&h,&basis[2],k);
-	v3_add(&r,&r,&h);
+	r.x=i;
+	r.y=j;
+	r.z=k;
 	
 	printf(" %.5f %.5f %.5f T T T\n",r.x/x,r.y/y,r.z/z);
 	cnt+=1;
@@ -155,11 +177,9 @@ int main(int argc,char **argv) {
 			for(k=0;k<z;k++) {
 
 	// first atom (all types)
-	v3_scale(&r,&basis[0],i);
-	v3_scale(&h,&basis[1],j);
-	v3_add(&r,&r,&h);
-	v3_scale(&h,&basis[2],k);
-	v3_add(&r,&r,&h);
+	r.x=i;
+	r.y=j;
+	r.z=k;
 
 	// add the diagonal
 	v3_add(&r,&r,&dia);
@@ -191,7 +211,10 @@ int main(int argc,char **argv) {
 	}
 
 
-	printf("\ntotal: %d ions\n\n",cnt);
+	if(estimated!=cnt) {
+		printf("\nWARNING! counted %d ions and estimated %d ions\n\n",
+		       cnt,estimated);
+	}
 
 	return 0;
 }
-- 
2.39.5