-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample_solvent.m
More file actions
186 lines (150 loc) · 3.46 KB
/
example_solvent.m
File metadata and controls
186 lines (150 loc) · 3.46 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
clear;
%
% %%%%%%%%% initializing %%%%%%%%%
% addpath('functions')
% addpath(genpath('chainstats'))
% addpath('mkfigures')
% addpath('misc')
%
% %%%%%%%%% inputs %%%%%%%%%
% % In the following inputs, Kuhn step b = 2*lp
%
% figure;hold
% PHIPV = [1, 2, 3]*1e-1;
%
% % Number of Kuhn steps per polymer
% N = 1;
%
% % Flory-Huggins parameter between polymer and solvent
% CHI = .5/N/PHIP;
%
% cnt = 1;
% for PHIP = PHIPV;
% col = (cnt-1)/(length(PHIPV)-1);
% % % Mole fraction of polymers
% % PHIP = 1e-10;
%
% % Wavevector (q) in units of Kuhn steps, i.e. K = b*q
% KV = logspace(-1, 5, 101);
%
% %%%%%%%%% calculate structure factor %%%%%%%%%
% S = scatter_homopoly(N, KV, CHI, PHIP);
%
% %%%%%%%%% make a plot %%%%%%%%%
%
% loglog(KV, S/PHIP,'color', [col 0 1-col]);
%
% cnt = cnt+1;
% end
%
% xlabel('bq');ylabel('S(q)')
% set(gca,'xscale','log');set(gca,'yscale','log');
%
%
%
%
%
%
%
%
%
% %%% example of varying polymer concentration %%%
% clear;
% N = 5;
% KV = logspace(-1, 2, 101);
% CHI = 0;
%
% PHIPV = [0.01,0.02,0.05,0.10];
% figure;hold
% for ii = 1:length(PHIPV)
% COL = (ii-1)/(length(PHIPV)-1);
%
% PHIP = PHIPV(ii)
% S = scatter_homopoly(N, KV, CHI, PHIP);
%
% plot(KV, S/PHIP, 'color', [COL 0 1-COL])
% end
% plotlog(1e1, 5e-1, -1, 1) % add power law
% xlabel('bq');ylabel('S(q)/\phi_P')
% set(gca,'xscale','log');set(gca,'yscale','log');
clear;
file = load('data/Scattering Data v2.mat');
s = file.rawData;
sl = file.rawDataLabels;
s2 = file.rawData2;
sl2 = file.rawData2Labels;
for ii = 1:length(sl)
disp(strcat(num2str(ii), ' -> ', sl{ii}))
end
for ii = 1:length(sl2)
disp(strcat(num2str(ii), ' -> ', sl2{ii}))
end
%%%%%%%%%% SAMPLE 1 %%%%%%%%%%%
inds = [19, 22, 1, 7, 10];
conc = [1, 2, 4, 7, 11];
s0 = 6e2;
L = 300;
lp = 300*5/10; % unit in Angstrom
N=L/(2*lp);
figure;hold;cnt = 1;
for ind = inds
col = (cnt-1)/(length(inds)-1);
plot(s(:,ind), s(:,ind+1)/conc(cnt), ...
'color', [col 0 1-col],'linewidth',2);
cnt = cnt+1;
end
set(gca,'xscale','log');set(gca,'yscale','log')
PHIPV = 8e-2*[conc];
PHIPV = 8e-2*[1,1];
KV = logspace(-1, 3, 101);
cnt = 1;
for PHIP = PHIPV
col = (cnt-1)/(length(inds)-1);
CHI=0/PHIP/N;
S = scatter_homopoly(N, KV, CHI, PHIP);
plot(KV/(2*lp),S/PHIP*s0/N,'--',...
'color', [col 0 1-col],'linewidth',2);
cnt = cnt+1;
end
plotlog(4e-2,2e2,-1,.5)
axis([1e-3,1,1e-1,1e4])
box on
set(gca,'fontsize',20)
xlabel('q(1/A)');ylabel('S(q)')
title('p-xylene')
legend('1mg/mL','2mg/mL','4mg/mL','7mg/mL','11mg/mL', 'location', 'southwest')
%%%%%%%%%% SAMPLE 2 %%%%%%%%%%%
inds = fliplr([1, 4, 7, 10, 13]);
conc = fliplr([11, 7, 4, 2, 1]);
s0 = 3e3;
L = 300;
% lp = 150; % unit in Angstrom
lp = 100; % unit in Angstrom
N=L/(2*lp);
figure;hold;cnt = 1;
for ind = inds
col = (cnt-1)/(length(inds)-1);
plot(s(:,ind), s(:,ind+1)/conc(cnt), ...
'color', [col 0 1-col],'linewidth',2);
cnt = cnt+1;
end
set(gca,'xscale','log');set(gca,'yscale','log')
PHIPV = 8e-2*[conc];
PHIPV = 8e-2*[1,1];
KV = logspace(-1, 3, 101);
cnt = 1;
for PHIP = PHIPV
col = (cnt-1)/(length(inds)-1);
CHI=0/PHIP/N;
S = scatter_homopoly(N, KV, CHI, PHIP);
plot(KV/(2*lp),S/PHIP*s0/N,'--',...
'color', [col 0 1-col],'linewidth',2);
cnt = cnt+1;
end
plotlog(4e-2,1e3,-1,.5)
axis([1e-3,1,1e-1,1e4])
box on
set(gca,'fontsize',20)
xlabel('q(1/A)');ylabel('S(q)')
title('Tetralin')
legend('1mg/mL','2mg/mL','4mg/mL','7mg/mL','11mg/mL', 'location', 'southwest')