CVD/KMC.pm

filter: Statementstmt 70.9% 159 / 224 Branchbran 34.4% 20 / 58 Conditioncond 42.5% 20 / 47 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 95.2% 20 / 21 Podpod 0.0% 0 / 8 totaltotal 57.3% 219 / 382 CC 66 SCAR 33.5
CC
66
Cov
60%
_event_surface_reaction
127.3
_event_decomposition
28.3
run
18.2
CRAP 28.6
« CVD/Chemistry.pm ↑ Summary CVD/Interface/Cantera.pm »
1 package Physics::CVD::KMC;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use List::Util qw(sum max min);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # ═══════════════════════════════════════════════════════════════════════════════
8 # KMC engine for CVD surface growth
9 #
10 # Models surface processes during CVD:
11 # - Precursor adsorption (sticking coefficient model)
12 # - Surface decomposition of adsorbed precursors
13 # - Surface diffusion of adatoms
14 # - Reaction between co-adsorbed species (LH mechanism)
15 # - Desorption of byproducts
16 # - Film incorporation
17 #
18 # Uses deposition-centric BKL algorithm adapted for multi-species CVD.
19 # ═══════════════════════════════════════════════════════════════════════════════
20  
21 1 ▶use constant KB => 1.380649e-23;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use constant EV => 1.602176634e-19;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use constant PI => 3.14159265358979;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 ▶sub new {
Subroutine new: called CC=7 SCAR=22.6
Pod undocumented
26 1 my ($class, %opts) = @_;
27 my $self = bless {
28 temperature => $opts{temperature} // 700,
29 pressure => $opts{pressure} // 100,
30 verbose => $opts{verbose} // 0,
31 lattice_size => $opts{lattice_size} // [30, 30, 20],
32 lattice_const => $opts{lattice_const} // 3.0, # Angstrom
33 1 ▶ attempt_freq => $opts{attempt_freq} // 1e13,
Condition50%6/12
$opts{"temperature"} // 700
l!l
10
$opts{"pressure"} // 100
l!l
10
$opts{"verbose"} // 0
l!l
01
$opts{"lattice_size"} // [30, 30, 20]
l!l
10
$opts{"lattice_const"} // 3
l!l
01
$opts{"attempt_freq"} // "10000000000000"
l!l
01
MC/DC0%0/1
$opts{"temperature"} // 700
$opts{"temperature"}
MC/DC0%0/1
$opts{"pressure"} // 100
$opts{"pressure"}
MC/DC0%0/1
$opts{"verbose"} // 0
$opts{"verbose"}
MC/DC0%0/1
$opts{"lattice_size"} // [30, 30, 20]
$opts{"lattice_size"}
MC/DC0%0/1
$opts{"lattice_const"} // 3
$opts{"lattice_const"}
MC/DC0%0/1
$opts{"attempt_freq"} // "10000000000000"
$opts{"attempt_freq"}
Truth table50%1/2
A
A= $opts{"temperature"}
Aresult
11
00
Truth table50%1/2
A
A= $opts{"pressure"}
Aresult
11
00
Truth table50%1/2
A
A= $opts{"verbose"}
Aresult
11
00
Truth table50%1/2
A
A= $opts{"lattice_size"}
Aresult
11
00
Truth table50%1/2
A
A= $opts{"lattice_const"}
Aresult
11
00
Truth table50%1/2
A
A= $opts{"attempt_freq"}
Aresult
11
00
34 species => {},
35 species_list => [],
36 lattice => undef,
37 surface => undef,
38 site_species => undef, # tracks which species at each site
39 time => 0,
40 steps => 0,
41 deposited => 0,
42 events => { adsorption => 0, diffusion => 0, reaction => 0,
43 decomposition => 0, desorption => 0 },
44 surface_reactions => [],
45 }, $class;
46  
47 1 $self->_init_lattice;
48 1 return $self;
49 }
50  
51 1 ▶sub _init_lattice {
Subroutine _init_lattice: called CC=4 SCAR=13.9
52 1 my ($self) = @_;
53 1 my ($nx, $ny, $nz) = @{$self->{lattice_size}};
54 1 $self->{lattice} = [];
55 1 $self->{surface} = [];
56 1 $self->{site_species} = [];
57 1 for my $x (0 .. $nx-1) {
58 15 for my $y (0 .. $ny-1) {
59 225 $self->{surface}[$x][$y] = 0;
60 225 for my $z (0 .. $nz-1) {
61 2250 $self->{lattice}[$x][$y][$z] = 0;
62 2250 $self->{site_species}[$x][$y][$z] = '';
63 }
64 }
65 }
66 }
67  
68 1 ▶sub add_species {
Subroutine add_species: called CC=11 SCAR=28.8
Pod undocumented
69 1 my ($self, %spec) = @_;
70 1 ▶ croak "Species 'name' required" unless $spec{name};
Branch: 1 branch
BranchTrueFalseTotal
unless $spec{"name"} 0 1 1
71 $self->{species}{$spec{name}} = {
72 name => $spec{name},
73 mass => $spec{mass} // 28,
74 sticking_coeff => $spec{sticking_coeff} // 0.1,
75 diffusion_barrier => $spec{diffusion_barrier} // 0.5, # eV
76 desorption_energy => $spec{desorption_energy} // 2.0, # eV
77 decomposition_barrier => $spec{decomposition_barrier} // undef,
78 decomp_products => $spec{decomp_products} // [],
79 is_precursor => $spec{is_precursor} // 0,
80 is_byproduct => $spec{is_byproduct} // 0,
81 1 ▶ partial_pressure => $spec{partial_pressure} // 0, # Pa
Condition50%9/18
$spec{"mass"} // 28
l!l
10
$spec{"sticking_coeff"} // "0.1"
l!l
10
$spec{"diffusion_barrier"} // "0.5"
l!l
10
$spec{"desorption_energy"} // 2
l!l
01
$spec{"decomposition_barrier"} // undef
l!l
01
$spec{"decomp_products"} // []
l!l
01
$spec{"is_precursor"} // 0
l!l
01
$spec{"is_byproduct"} // 0
l!l
01
$spec{"partial_pressure"} // 0
l!l
10
MC/DC0%0/1
$spec{"mass"} // 28
$spec{"mass"}
MC/DC0%0/1
$spec{"sticking_coeff"} // "0.1"
$spec{"sticking_coeff"}
MC/DC0%0/1
$spec{"diffusion_barrier"} // "0.5"
$spec{"diffusion_barrier"}
MC/DC0%0/1
$spec{"desorption_energy"} // 2
$spec{"desorption_energy"}
MC/DC0%0/1
$spec{"decomposition_barrier"} // undef
$spec{"decomposition_barrier"}
MC/DC0%0/1
$spec{"decomp_products"} // []
$spec{"decomp_products"}
MC/DC0%0/1
$spec{"is_precursor"} // 0
$spec{"is_precursor"}
MC/DC0%0/1
$spec{"is_byproduct"} // 0
$spec{"is_byproduct"}
MC/DC0%0/1
$spec{"partial_pressure"} // 0
$spec{"partial_pressure"}
Truth table50%1/2
A
A= $spec{"mass"}
Aresult
11
00
Truth table50%1/2
A
A= $spec{"sticking_coeff"}
Aresult
11
00
Truth table50%1/2
A
A= $spec{"diffusion_barrier"}
Aresult
11
00
Truth table50%1/2
A
A= $spec{"desorption_energy"}
Aresult
11
00
Truth table50%1/2
A
A= $spec{"decomposition_barrier"}
Aresult
11
00
Truth table50%1/2
A
A= $spec{"decomp_products"}
Aresult
11
00
Truth table50%1/2
A
A= $spec{"is_precursor"}
Aresult
11
00
Truth table50%1/2
A
A= $spec{"is_byproduct"}
Aresult
11
00
Truth table50%1/2
A
A= $spec{"partial_pressure"}
Aresult
11
00
82 };
83 1 push @{$self->{species_list}}, $spec{name};
84 1 return $self;
85 }
86  
87 # Add surface reaction between co-adsorbed species
88 0 ▶sub add_surface_reaction {
Subroutine add_surface_reaction: not called CC=3 SCAR=24.8
Pod undocumented
89 0 my ($self, %rxn) = @_;
90 0 ▶ push @{$self->{surface_reactions}}, {
Condition0%0/4
$rxn{"barrier"} // "0.3"
l!l
00
$rxn{"name"} // "reaction"
l!l
00
MC/DC0%0/1
$rxn{"barrier"} // "0.3"
$rxn{"barrier"}
MC/DC0%0/1
$rxn{"name"} // "reaction"
$rxn{"name"}
Truth table0%0/2
A
A= $rxn{"barrier"}
Aresult
11
00
Truth table0%0/2
A
A= $rxn{"name"}
Aresult
11
00
91 reactants => $rxn{reactants}, # ['SiH2', 'O']
92 products => $rxn{products}, # ['SiO2']
93 barrier => $rxn{barrier} // 0.3, # eV
94 0 name => $rxn{name} // 'reaction',
95 };
96 0 return $self;
97 }
98  
99 # Set deposition conditions
100 1 ▶sub deposit {
Subroutine deposit: called CC=6 SCAR=27.8
Pod undocumented
101 1 my ($self, %opts) = @_;
102 1 ▶ my $time = $opts{time} // 60;
Condition50%1/2
$opts{"time"} // 60
l!l
01
MC/DC0%0/1
$opts{"time"} // 60
$opts{"time"}
Truth table50%1/2
A
A= $opts{"time"}
Aresult
11
00
103 1 ▶ my $steps = $opts{steps} // undef;
Condition50%1/2
$opts{"steps"} // undef
l!l
10
MC/DC0%0/1
$opts{"steps"} // undef
$opts{"steps"}
Truth table50%1/2
A
A= $opts{"steps"}
Aresult
11
00
104  
105 1 ▶ unless ($steps) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($steps) 0 1 1
106 # Estimate atoms to deposit from impingement flux
107 0 my ($nx, $ny) = @{$self->{lattice_size}};
108 0 my $area = $nx * $ny * ($self->{lattice_const} * 1e-8)**2;
109 0 my $total_flux = 0;
110 0 for my $sp (values %{$self->{species}}) {
111 0 ▶ next unless $sp->{partial_pressure} > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless $sp->{"partial_pressure"} > 0 0 0 0
112 0 my $m_kg = $sp->{mass} * 1.66054e-27;
113 my $phi = $sp->{partial_pressure} /
114 0 sqrt(2 * PI() * $m_kg * KB * $self->{temperature});
115 0 $total_flux += $phi * $sp->{sticking_coeff} * $area * 1e-4;
116 }
117 0 $steps = int($total_flux * $time + 0.5);
118 0 $steps = max($steps, 100);
119 }
120  
121 1 $self->run(steps => $steps);
122 1 return $self;
123 }
124  
125 1 ▶sub _rate {
Subroutine _rate: called CC=2 SCAR=7.0
126 1 my ($self, $barrier_eV) = @_;
127 1 my $T = $self->{temperature};
128 1 ▶ return 0 if $T <= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $T <= 0 0 1 1
129 1 return $self->{attempt_freq} * exp(-$barrier_eV * EV / (KB * $T));
130 }
131  
132 # Run deposition-centric KMC
133 1 ▶sub run {
Subroutine run: called CC=17 SCAR=29.0
Pod undocumented
134 1 my ($self, %opts) = @_;
135 1 ▶ my $steps = $opts{steps} // 1000;
Condition50%1/2
$opts{"steps"} // 1000
l!l
10
MC/DC0%0/1
$opts{"steps"} // 1000
$opts{"steps"}
Truth table50%1/2
A
A= $opts{"steps"}
Aresult
11
00
136 1 ▶ my $max_diff = $opts{max_diff_per_dep} // 30;
Condition50%1/2
$opts{"max_diff_per_dep"} // 30
l!l
01
MC/DC0%0/1
$opts{"max_diff_per_dep"} // 30
$opts{"max_diff_per_dep"}
Truth table50%1/2
A
A= $opts{"max_diff_per_dep"}
Aresult
11
00
137  
138 1 ▶ croak "No species defined" unless keys %{$self->{species}};
Branch: 1 branch
BranchTrueFalseTotal
unless keys %{$$self{"species"};} 0 1 1
139  
140 1 my ($nx, $ny, $nz) = @{$self->{lattice_size}};
141 1 my $n_sites = $nx * $ny;
142  
143 # Compute relative fluxes for each precursor species
144 1 my @precursors;
145 1 my $total_flux = 0;
146 1 for my $name (@{$self->{species_list}}) {
147 1 my $sp = $self->{species}{$name};
148 1 ▶ next unless $sp->{partial_pressure} > 0 && !$sp->{is_byproduct};
Branch: 1 branch
BranchTrueFalseTotal
unless $sp->{"partial_pressure"} > 0 and not $sp->{"is_byproduct"} 0 1 1
Condition33%1/3
$sp->{"partial_pressure"} > 0 and not $sp->{"is_byproduct"}
!ll&&!rl&&r
001
MC/DC0%0/2
$sp->{"partial_pressure"} > 0 and not $sp->{"is_byproduct"}
$sp->{"partial_pressure"} > 0 not $sp->{"is_byproduct"}
Truth table33%1/3
A and not(B)
A= $sp->{"partial_pressure"} > 0B= not $sp->{"is_byproduct"}
ABresult
0X0
100
111
149 1 my $m_kg = $sp->{mass} * 1.66054e-27;
150 my $flux = $sp->{partial_pressure} /
151 1 sqrt(2 * PI() * $m_kg * KB * $self->{temperature});
152 1 $flux *= $sp->{sticking_coeff};
153 1 push @precursors, { name => $name, flux => $flux };
154 1 $total_flux += $flux;
155 }
156  
157 1 ▶ croak "No precursors with partial_pressure > 0" unless @precursors;
Branch: 1 branch
BranchTrueFalseTotal
unless @precursors 0 1 1
158  
159 # Normalize for weighted random selection
160 1 my @cum_prob;
161 1 my $cum = 0;
162 1 for my $p (@precursors) {
163 1 $cum += $p->{flux} / $total_flux;
164 1 push @cum_prob, $cum;
165 }
166  
167 # D/F ratio for surface diffusion (use lightest barrier)
168 1 my $min_barrier = min(map { $self->{species}{$_->{name}}{diffusion_barrier} }
169 @precursors);
170 1 my $rate_diff = $self->_rate($min_barrier);
171 1 my $area_per_site = ($self->{lattice_const} * 1e-8)**2;
172 1 my $F_per_site = $total_flux * $area_per_site * 1e-4;
173 1 ▶ my $DF_ratio = ($F_per_site > 0) ? $rate_diff / $F_per_site : 0;
Branch: 1 branch
BranchTrueFalseTotal
$F_per_site > 0 ? : 1 0 1
174 1 $DF_ratio = min($DF_ratio, $max_diff);
175  
176 1 ▶ my $dt_dep = ($F_per_site > 0) ? 1.0 / ($F_per_site * $n_sites) : 1.0;
Branch: 1 branch
BranchTrueFalseTotal
$F_per_site > 0 ? : 1 0 1
177  
178 printf " CVD-KMC: Running %d depositions (T=%.0f K, P=%.1f Pa, D/F=%.1f)\n",
179 $steps, $self->{temperature}, $self->{pressure}, $DF_ratio
180 1 ▶ if $self->{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"verbose"} 0 1 1
181  
182 1 for my $step (1 .. $steps) {
183 # 1) Select species to deposit based on relative flux
184 200 my $r = rand();
185 200 my $sp_name = $precursors[-1]{name};
186 200 for my $i (0 .. $#cum_prob) {
187 200 ▶ if ($r < $cum_prob[$i]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r < $cum_prob[$i]) 200 0 200
188 200 $sp_name = $precursors[$i]{name};
189 200 last;
190 }
191 }
192  
193 # 2) Adsorb atom
194 200 $self->_event_adsorption($sp_name);
195  
196 # 3) Surface diffusion hops
197 200 my $n_hops = int($DF_ratio + 0.5);
198 200 for (1 .. $n_hops) {
199 6000 $self->_event_diffusion;
200 }
201  
202 # 4) Surface decomposition (if precursor has decomp pathway)
203 200 $self->_event_decomposition($sp_name);
204  
205 # 5) Surface reactions between co-adsorbed species
206 200 $self->_event_surface_reaction;
207  
208 200 $self->{time} += $dt_dep;
209 200 $self->{steps} += 1 + $n_hops;
210 }
211  
212 printf " CVD-KMC: Done. t=%.3e s, deposited=%d atoms\n",
213 $self->{time}, $self->{deposited}
214 1 ▶ if $self->{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"verbose"} 0 1 1
215  
216 1 return $self;
217 }
218  
219 200 ▶sub _event_adsorption {
Subroutine _event_adsorption: called CC=2 SCAR=6.9
220 200 my ($self, $species) = @_;
221 200 my ($nx, $ny, $nz) = @{$self->{lattice_size}};
222  
223 200 my $x = int(rand($nx));
224 200 my $y = int(rand($ny));
225 200 my $z = $self->{surface}[$x][$y];
226  
227 200 ▶ return if $z >= $nz; # column full
Branch: 1 branch
BranchTrueFalseTotal
if $z >= $nz 0 200 200
228  
229 200 $self->{lattice}[$x][$y][$z] = 1;
230 200 $self->{site_species}[$x][$y][$z] = $species;
231 200 $self->{surface}[$x][$y] = $z + 1;
232 200 $self->{deposited}++;
233 200 $self->{events}{adsorption}++;
234 }
235  
236 6000 ▶sub _event_diffusion {
Subroutine _event_diffusion: called CC=3 SCAR=11.0
237 6000 my ($self) = @_;
238 6000 my ($nx, $ny, $nz) = @{$self->{lattice_size}};
239  
240 6000 my $x = int(rand($nx));
241 6000 my $y = int(rand($ny));
242 6000 my $z = $self->{surface}[$x][$y] - 1;
243 6000 ▶ return if $z < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $z < 0 3474 2526 6000
244  
245 # Pick random neighbor
246 2526 my @dx = (1, -1, 0, 0);
247 2526 my @dy = (0, 0, 1, -1);
248 2526 my $dir = int(rand(4));
249 2526 my $nx2 = ($x + $dx[$dir]) % $nx;
250 2526 my $ny2 = ($y + $dy[$dir]) % $ny;
251 2526 my $z_n = $self->{surface}[$nx2][$ny2];
252  
253 2526 ▶ if ($z_n <= $z) {
Branch: 1 branch
BranchTrueFalseTotal
if ($z_n <= $z) 1255 1271 2526
254 1255 my $sp = $self->{site_species}[$x][$y][$z];
255 1255 $self->{lattice}[$x][$y][$z] = 0;
256 1255 $self->{site_species}[$x][$y][$z] = '';
257 1255 $self->{lattice}[$nx2][$ny2][$z_n] = 1;
258 1255 $self->{site_species}[$nx2][$ny2][$z_n] = $sp;
259 1255 $self->{surface}[$x][$y] = $z;
260 1255 $self->{surface}[$nx2][$ny2] = $z_n + 1;
261 1255 $self->{events}{diffusion}++;
262 }
263 }
264  
265 200 ▶sub _event_decomposition {
Subroutine _event_decomposition: called CC=6 SCAR=33.4
266 200 my ($self, $species) = @_;
267 200 my $sp = $self->{species}{$species};
268 200 ▶ return unless $sp->{decomposition_barrier};
Branch: 1 branch
BranchTrueFalseTotal
unless $sp->{"decomposition_barrier"} 200 0 200
269 0 ▶ return unless @{$sp->{decomp_products}};
Branch: 1 branch
BranchTrueFalseTotal
unless @{$sp->{"decomp_products"};} 0 0 0
270  
271 # Probability of decomposition this step
272 0 my $k = $self->_rate($sp->{decomposition_barrier});
273 0 my $dt = 1.0 / $self->{attempt_freq}; # characteristic time
274 0 ▶ return unless rand() < $k * $dt;
Branch: 1 branch
BranchTrueFalseTotal
unless rand() < $k * $dt 0 0 0
275  
276 # Find an adsorbed precursor and decompose it
277 0 my ($nx, $ny) = @{$self->{lattice_size}};
278 0 my $x = int(rand($nx));
279 0 my $y = int(rand($ny));
280 0 my $z = $self->{surface}[$x][$y] - 1;
281 0 ▶ return if $z < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $z < 0 0 0 0
282 0 ▶ return unless $self->{site_species}[$x][$y][$z] eq $species;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"site_species"}[$x][$y][$z] eq $species 0 0 0
283  
284 # Replace with first decomposition product (rest desorb as byproducts)
285 0 $self->{site_species}[$x][$y][$z] = $sp->{decomp_products}[0];
286 0 $self->{events}{decomposition}++;
287 }
288  
289 200 ▶sub _event_surface_reaction {
Subroutine _event_surface_reaction: called CC=12 SCAR=48.5
290 200 my ($self) = @_;
291 200 ▶ return unless @{$self->{surface_reactions}};
Branch: 1 branch
BranchTrueFalseTotal
unless @{$self->{"surface_reactions"};} 200 0 200
292  
293 0 my ($nx, $ny) = @{$self->{lattice_size}};
294 0 my $x = int(rand($nx));
295 0 my $y = int(rand($ny));
296 0 my $z = $self->{surface}[$x][$y] - 1;
297 0 ▶ return if $z < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $z < 0 0 0 0
298  
299 0 my $sp_here = $self->{site_species}[$x][$y][$z];
300 0 ▶ return unless $sp_here;
Branch: 1 branch
BranchTrueFalseTotal
unless $sp_here 0 0 0
301  
302 # Check neighbors for reaction partners
303 0 my @dx = (1, -1, 0, 0);
304 0 my @dy = (0, 0, 1, -1);
305 0 for my $rxn (@{$self->{surface_reactions}}) {
306 0 ▶ next unless grep { $_ eq $sp_here } @{$rxn->{reactants}};
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ eq $sp_here;} @{$$rxn{"reactants"};} 0 0 0
307 0 my $partner = (grep { $_ ne $sp_here } @{$rxn->{reactants}})[0];
308 0 ▶ next unless $partner;
Branch: 1 branch
BranchTrueFalseTotal
unless $partner 0 0 0
309  
310 # Look for partner in neighbors
311 0 for my $dir (0 .. 3) {
312 0 my $nx2 = ($x + $dx[$dir]) % $nx;
313 0 my $ny2 = ($y + $dy[$dir]) % $ny;
314 0 my $z_n = $self->{surface}[$nx2][$ny2] - 1;
315 0 ▶ next if $z_n < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $z_n < 0 0 0 0
316 0 ▶ next unless $self->{site_species}[$nx2][$ny2][$z_n] eq $partner;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"site_species"}[$nx2][$ny2][$z_n] eq $partner 0 0 0
317  
318 # Reaction probability
319 0 my $k = $self->_rate($rxn->{barrier});
320 0 my $dt = 1.0 / $self->{attempt_freq};
321 0 ▶ next unless rand() < $k * $dt;
Branch: 1 branch
BranchTrueFalseTotal
unless rand() < $k * $dt 0 0 0
322  
323 # React: convert both to product
324 0 ▶ my $product = $rxn->{products}[0] // 'film';
Condition0%0/2
$rxn->{"products"}[0] // "film"
l!l
00
MC/DC0%0/1
$rxn->{"products"}[0] // "film"
$rxn->{"products"}[0]
Truth table0%0/2
A
A= $rxn->{"products"}[0]
Aresult
11
00
325 0 $self->{site_species}[$x][$y][$z] = $product;
326 # Remove partner
327 0 $self->{lattice}[$nx2][$ny2][$z_n] = 0;
328 0 $self->{site_species}[$nx2][$ny2][$z_n] = '';
329 0 $self->{surface}[$nx2][$ny2] = $z_n;
330 0 $self->{events}{reaction}++;
331 0 return;
332 }
333 }
334 }
335  
336 1 ▶sub get_film {
Subroutine get_film: called CC=1 SCAR=0.0
Pod undocumented
337 1 my ($self) = @_;
338 1 require Physics::CVD::Film;
339 return Physics::CVD::Film->new(
340 lattice => $self->{lattice},
341 surface => $self->{surface},
342 site_species => $self->{site_species},
343 lattice_size => $self->{lattice_size},
344 lattice_const => $self->{lattice_const},
345 1 );
346 }
347  
348 1 ▶sub coverage {
Subroutine coverage: called CC=4 SCAR=13.9
Pod undocumented
349 1 my ($self) = @_;
350 1 my ($nx, $ny) = @{$self->{lattice_size}};
351 1 my $occupied = 0;
352 1 for my $x (0 .. $nx-1) {
353 15 for my $y (0 .. $ny-1) {
354 225 ▶ $occupied++ if $self->{surface}[$x][$y] > 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"surface"}[$x][$y] > 0 176 49 225
355 }
356 }
357 1 return $occupied / ($nx * $ny);
358 }
359  
360 1 ▶sub stats {
Subroutine stats: called CC=1 SCAR=0.0
Pod undocumented
361 1 my ($self) = @_;
362 return {
363 time => $self->{time},
364 steps => $self->{steps},
365 deposited => $self->{deposited},
366 coverage => $self->coverage,
367 1 events => { %{$self->{events}} },
368 };
369 }
370  
371 1 1;
« CVD/Chemistry.pm ↑ Summary CVD/Interface/Cantera.pm »