-
Notifications
You must be signed in to change notification settings - Fork 0
/
c100.pov
111 lines (103 loc) · 3.5 KB
/
c100.pov
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Libraries containing color, texture, vector operations
#include "colors.inc"
#include "shapes.inc"
#include "math.inc"
//--------abrimos archivo de entrada---------------
#fopen Myfile_entrada "4-icosaedro.xyz" read
//----leemos coordeandas de icosaedro y las guardamos en un arreglo-----
#declare ico=array[12];
//------------bloque para leer coordenadas de icosaedro----------------
#for (i,0,11,1)
#read (Myfile_entrada, x0,y0,z0)
#declare ico[i]=<x0,y0,z0>;
#end
//-----------vamos a calcular la distancia minima entre cada atomo del icosaedro------------------
#declare minimo=1000;
#for (i,1,11,1)
#if (VDist(ico[0],ico[i])<minimo)
#declare minimo=VDist(ico[0],ico[i]);
#end
#end
//-----teniendo la distancia del minimo ahora podemos seleccionar nuestras aristas--------------
#declare N=4;
#declare Arista= array[30][2+N];
#declare n=0;
#while (n<30)
#declare Arista[n][0]=<1000,10000,1000>;
#declare Arista[n][1]=<1000,10000,1000>;
#declare Arista[n][2]=<1000,10000,1000>;
#declare n=n+1;
#end
#declare s=0;
#for(j,0,10,1)
#for(i,j+1,11,1)
#if ((VDist(ico[j],ico[i])<(minimo+0.1))&(VDist(ico[j],ico[i])>(minimo-0.1)))
//----------------------------asegurarnos de que no se repita-----------------------------
//-------------------------------------------------------------------------------------------
#declare Arista[s][0]=ico[j];
#declare Arista[s][1]=ico[i];
#declare Arista[s][1+N]=(ico[i]+ico[j])/2;
#for (h,2,N,1)
#declare Arista[s][h]=Arista[s][1]+(h-1)*(Arista[s][0]-Arista[s][1])/N;
#end
#declare s=s+1;
#end
#end
#end
//-----------------------------------------------------------------------
//---------definimos el numero N para las diviciones oviamente tiene que ser mayor a cero
#declare caras=array[10000];
#declare caras2=array[10000];
#declare f=0;
#declare delta=0.001;
#for(i,0,29,1)
#for(s,i+1,29,1)
#if (VDist(Arista[i][1+N],Arista[s][1+N])<minimo/2+0.02)
#for(j,2,N,1)
#for(h,2,N,1)
#for(mil,2,N-1,1)
#if ((VDist(Arista[i][j],Arista[s][h])>mil*minimo/N-delta)&(VDist(Arista[i][j],Arista[s][h])<mil*minimo/N+delta))
#declare beta=1;
#while (beta<mil)
#declare caras[f]=Arista[i][j]+beta*(Arista[s][h]-Arista[i][j])/mil;
#declare f=f+1;
#declare beta=beta+1;
#end
#end
#end
#end
#end
#end
#end
#end
#declare caras2[0]=caras[0];
#declare contador2=1;
#declare zeta=0;
#for (i,1,f-1,1)
#declare ata=1;
#for(s,0,contador2-1,1)
#if (VDist(caras2[s],caras[i])<delta)
#declare ata=0;
#end
#end
#if (ata=1)
#declare caras2[contador2]=caras[i];
#declare contador2=contador2+1;
#end
#end
//------------------------------------------------------------
#fopen Myfile_Avogadro "Coordenadas_Avogadro.xyz" write
#write(Myfile_Avogadro,12+(N-1)*30+contador2,"\n")
#write(Myfile_Avogadro,"\n")
#for (i,0,contador2-1,1)
#write (Myfile_Avogadro, "AU ",vstr(3, caras2[i], " ", 0,3), "\n")
#end
#for (i,0,29,1)
#for(j,2,N,1)
#write (Myfile_Avogadro, "Au ",vstr(3, Arista[i][j], " ", 0,3), "\n")
//#sphere{ c100[i], 0.15 pigment{color Red}}
#end
#end
#for(j,0,11,1)
#write (Myfile_Avogadro, "Au ",vstr(3, ico[j], " ", 0,3), "\n")
#end