-
Notifications
You must be signed in to change notification settings - Fork 0
/
armchairCnt.m
59 lines (43 loc) · 891 Bytes
/
armchairCnt.m
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
function armchairCnt(n,L,string)
bond = 1.41;
a=2.46;
%n = 10;
d = a * n * sqrt(3) / pi;
%L = 26;
h = bond*cos(pi/6);
Teta = 2*pi/n;
teta = asin(bond/d);
TT=[0:Teta:2*pi];
TT1=TT+3*teta;
Zc=0;
k=1;
for i=1:n
for j=1:2
Data(k,1)=d/2*cos(TT(i)+(-1)^j*teta);
Data(k,2)=d/2*sin(TT(i)+(-1)^j*teta);
Data(k,3)=Zc;
k=k+1;
end
for j=1:2
Data(k,1)=d/2*cos(TT1(i)+(-1)^j*teta);
Data(k,2)=d/2*sin(TT1(i)+(-1)^j*teta);
Data(k,3)=Zc+h;
k=k+1;
end
end
l1=max(Data(:,3))-min(Data(:,3));
hig = 2*h;
nR = ceil(L/(l1+h))-1;
finalData=Data;
for i=1:nR
matrix = Data;
matrix(:,3)=matrix(:,3)+hig;
finalData=[finalData;matrix];
hig = hig+2*h;
end
mm=length(finalData(:,1));
fid = fopen(string,'wt');
fprintf(fid,'%3.1d \n',mm);
fprintf(fid,'C %8.6f %8.6f %8.6f\n',finalData.');
fclose(fid);
end