Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_RateConstantCalculators.C
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2014 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 // ----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_RateConstantCalculators.C,v $
27 //
28 // Purpose : strategy pattern for reactions with different temperature
29 // dependent rate constant styles
30 //
31 // Special Notes :
32 //
33 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
34 //
35 // Creation Date : 07/27/2006
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.9 $
41 //
42 // Revision Date : $Date: 2014/05/03 18:15:53 $
43 //
44 // Current Owner : $Author: lcmusso $
45 //-----------------------------------------------------------------------------
46 
47 #include <Xyce_config.h>
48 
49 
50 
51 #include <N_UTL_Misc.h>
52 
53 #ifdef HAVE_CMATH
54 #include <cmath>
55 #else
56 #include <math.h>
57 #endif
58 
59 #include <string>
60 #include <vector>
61 
62 #include <N_DEV_Const.h>
63 #include <N_ERH_ErrorMgr.h>
64 
65 #include <N_DEV_Specie.h>
67 
68 #include<iostream>
69 
70 namespace Xyce {
71 namespace Device {
72 
73 //-----------------------------------------------------------------------------
74 // Function : SimpleRateCalculator::SimpleRateCalculator
75 // Purpose : constructor for "simple" reaction rate calculator
76 // This is one that has no temperature dependence, and scales
77 // as concentration*time
78 // Special Notes :
79 // Scope : public
80 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
81 // Creation Date : 7/31/06
82 //-----------------------------------------------------------------------------
83  SimpleRateCalculator::SimpleRateCalculator(double k, double C0, double t0,
84  double x0)
85  : K(k)
86  {
87  setScaleFactors(C0,t0,x0);
88  }
89 
90 //-----------------------------------------------------------------------------
91 // Function : SimpleRateCalculator::SimpleRateCalculator
92 // Purpose : Copy constructor for "simple" reaction rate calculator
93 // Special Notes :
94 // Scope : public
95 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
96 // Creation Date : 7/31/06
97 //-----------------------------------------------------------------------------
99  :K(right.K),
100  rk0(right.rk0)
101  {
102  }
103 
104 //-----------------------------------------------------------------------------
105 // Function : SimpleRateCalculator::Clone
106 // Purpose : Copy self operation for "simple" reaction rate calculator
107 // Special Notes :
108 // Scope : public
109 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
110 // Creation Date : 7/31/06
111 //-----------------------------------------------------------------------------
113  {
114  return new SimpleRateCalculator(*this);
115  }
116 
117 //-----------------------------------------------------------------------------
118 // Function : SimpleRateCalculator::computeRateConstant
119 // Purpose : returns rate constant for simple rate style
120 // Special Notes :
121 // Scope : public
122 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
123 // Creation Date : 7/31/06
124 //-----------------------------------------------------------------------------
126  {
127  return(K);
128  }
129 
130 
131 //-----------------------------------------------------------------------------
132 // Function : SimpleRateCalculator::computeRateConstant
133 // Purpose : returns rate constant for simple rate style
134 // Special Notes :
135 // Scope : public
136 // Creator : Lawrence C Musson, SNL
137 // Creation Date : 04/17/14
138 //-----------------------------------------------------------------------------
140  std::vector<double> &concs,
141  std::vector<double> &constant_vec)
142  {
143  return(K);
144  }
145 
146 //-----------------------------------------------------------------------------
147 // Function : SimpleRateCalculator::rateConstantScaleFactor
148 // Purpose : returns rate scaling factor for simple rate style
149 // Special Notes :
150 // Scope : public
151 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
152 // Creation Date : 7/31/06
153 //-----------------------------------------------------------------------------
155  {
156  return (rk0);
157  }
158 
159 
160 //-----------------------------------------------------------------------------
161 // Function : CaptureRateCalculator::CaptureRateCalculator
162 // Purpose : constructor for capture reaction rate calculator
163 // This is one that models electron or hole capture reactions.
164 // Special Notes :
165 // Scope : public
166 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
167 // Creation Date : 7/31/06
168 //-----------------------------------------------------------------------------
170  double C0, double t0,
171  double x0)
172  {
173  K=sigma*v;
174  setScaleFactors(C0,t0,x0);
175  }
176 
177 //-----------------------------------------------------------------------------
178 // Function : CaptureRateCalculator::CaptureRateCalculator
179 // Purpose : Copy constructor for "capture" reaction rate calculator
180 // Special Notes :
181 // Scope : public
182 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
183 // Creation Date : 7/31/06
184 //-----------------------------------------------------------------------------
186  :K(right.K),
187  rk0(right.rk0)
188  {
189  }
190 //-----------------------------------------------------------------------------
191 // Function : CaptureRateCalculator::Clone
192 // Purpose : Copy self operation for "capture" reaction rate calculator
193 // Special Notes :
194 // Scope : public
195 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
196 // Creation Date : 7/31/06
197 //-----------------------------------------------------------------------------
199  {
200  return new CaptureRateCalculator(*this);
201  }
202 
203 //-----------------------------------------------------------------------------
204 // Function : CaptureRateCalculator::computeRateConstant
205 // Purpose : returns rate constant for capture rate style
206 // Special Notes :
207 // Scope : public
208 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
209 // Creation Date : 7/31/06
210 //-----------------------------------------------------------------------------
212  {
213  return(K);
214  }
215 
216 
217 //-----------------------------------------------------------------------------
218 // Function : CaptureRateCalculator::computeRateConstant
219 // Purpose : returns rate constant for capture rate style
220 // Special Notes :
221 // Scope : public
222 // Creator : Lawrence C Musson, SNL
223 // Creation Date : 04/17/2014
224 //-----------------------------------------------------------------------------
226  std::vector<double> &concs,
227  std::vector<double> &constant_vec)
228  {
229  return(K);
230  }
231 
232 //-----------------------------------------------------------------------------
233 // Function : CaptureRateCalculator::rateConstantScaleFactor
234 // Purpose : returns rate scaling factor for capture rate style
235 // Special Notes :
236 // Scope : public
237 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
238 // Creation Date : 7/31/06
239 //-----------------------------------------------------------------------------
241  {
242  return (rk0);
243  }
244 
245 //-----------------------------------------------------------------------------
246 // Function : EmissionRateCalculator::EmissionRateCalculator
247 // Purpose : constructor for emission reaction rate calculator
248 // This is one that models electron or hole emission reactions.
249 // Special Notes :
250 // Scope : public
251 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
252 // Creation Date : 7/31/06
253 //-----------------------------------------------------------------------------
255  double N, double Energy,
256  double C0, double t0,
257  double x0)
258  : E(Energy)
259  {
260  K_f=sigma*v*N;
261  setScaleFactors(C0,t0,x0);
262  }
263 
264 //-----------------------------------------------------------------------------
265 // Function : EmissionRateCalculator::EmissionRateCalculator
266 // Purpose : Copy constructor for "emission" reaction rate calculator
267 // Special Notes :
268 // Scope : public
269 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
270 // Creation Date : 7/31/06
271 //-----------------------------------------------------------------------------
273  :T0(right.T0),
274  E(right.E),
275  K_f(right.K_f)
276  {
277  }
278 
279 //-----------------------------------------------------------------------------
280 // Function : EmissionRateCalculator::Clone
281 // Purpose : Copy self operation for "emission" reaction rate calculator
282 // Special Notes :
283 // Scope : public
284 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
285 // Creation Date : 7/31/06
286 //-----------------------------------------------------------------------------
288  {
289  return new EmissionRateCalculator(*this);
290  }
291 //-----------------------------------------------------------------------------
292 // Function : EmissionRateCalculator::computeRateConstant
293 // Purpose : returns rate constant for emission rate style
294 // Special Notes :
295 // Scope : public
296 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
297 // Creation Date : 7/31/06
298 //-----------------------------------------------------------------------------
300  {
301  double KbT=CONSTboltz*T/CONSTQ;
302  return(K_f*exp(-E/KbT));
303  }
304 
305 //-----------------------------------------------------------------------------
306 // Function : EmissionRateCalculator::computeRateConstant
307 // Purpose : returns rate constant for emission rate style
308 // Special Notes :
309 // Scope : public
310 // Creator : Lawrence C Musson, SNL
311 // Creation Date : 04/17/2014
312 //-----------------------------------------------------------------------------
314  std::vector<double> &concs,
315  std::vector<double> &constant_vec)
316  {
317  double KbT=CONSTboltz*T/CONSTQ;
318  return(K_f*exp(-E/KbT));
319  }
320 
321 //-----------------------------------------------------------------------------
322 // Function : EmissionRateCalculator::rateConstantScaleFactor
323 // Purpose : returns rate scaling factor for emission rate style
324 // Special Notes :
325 // Scope : public
326 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
327 // Creation Date : 7/31/06
328 //-----------------------------------------------------------------------------
330  {
331  return (T0);
332  }
333 
334 
335 //-----------------------------------------------------------------------------
336 // Function : ComplexRateCalculator::ComplexRateCalculator
337 // Purpose : constructor for "complex" reaction rate calculator
338 // This is one that models two discrete species forming a
339 // complex, e.g.:
340 // V0 + VM -> VVM
341 //
342 // Special Notes : For this to work, there must either be two species in the
343 // reactants list, or one species with 2.0 as the stochiometric
344 // coefficient.
345 // Scope : public
346 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
347 // Creation Date : 7/31/06
348 //-----------------------------------------------------------------------------
350  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
351  std::vector< std::pair<int,double> > &Reactants,
352  double C0, double t0, double x0)
353  {
354  int ij;
355 
356  // Check assumptions:
357  if ( ! ((Reactants.size() == 1 && Reactants[0].second == 2.0) ||
358  (Reactants.size() == 2 && Reactants[0].second == 1.0 &&
359  Reactants[1].second == 1.0)))
360  {
361  std::string msg;
362  msg = "ComplexRateCalculator: Invalid attempt to use complex rate method.";
363  msg = " This method is only valid for binary complexing reactions:\n";
364  if (Reactants.size() == 1)
365  {
366  msg += " Only one reactant specified, but its stoichimetric coefficient is not 2.\n";
367  }
368  else if (Reactants.size() == 2)
369  {
370  msg += " Two reactants specified, but both stoichimetric coefficient are not 1.\n";
371  }
372  else
373  {
374  msg += " More than two reactants specified.\n";
375  }
376  // exit with error --- we probably need to do something more careful
377  // in parallel
378  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL,msg);
379  }
380 
381  if (Reactants[0].first >= 0)
382  Specie1 = &(VariableSpecies[Reactants[0].first]);
383  else
384  Specie1 = &(ConstantSpecies[-(Reactants[0].first+1)]);
385 
386  // Handle case where there's only one species with a coefficient of 2.0
387  if (Reactants.size() == 1)
388  {
389  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
390  }
391  else
392  {
393  if (Reactants[1].first >= 0)
394  Specie2 = &(VariableSpecies[Reactants[1].first]);
395  else
396  Specie2 = &(ConstantSpecies[-(Reactants[1].first+1)]);
397  }
398  ij =Specie1->getChargeState();
399  ij *=Specie2->getChargeState();
400 
401 
402 
403  // Only divide reaction_distance_factor by T in one special case
404  Tdep=false;
405  if (ij>0)
407  else if (ij == 0)
408  reaction_distance_factor = 4*M_PI*5.0e-8;
409  //reaction_distance_factor = 4*M_PI*5.43e-8;
410  //reaction_distance_factor = 4*3.1416*5.43e-8;
411  else
412  {
413  reaction_distance_factor = 4*M_PI*1.4e-4*(-ij);
414  //reaction_distance_factor = 4*M_PI*1.40419676681412915e-4*(-ij);
415  //reaction_distance_factor = 4*3.1416*1.404e-4*(-ij);
416  Tdep=true;
417  }
418 
419  setScaleFactors(C0,t0,x0);
420  }
421 
422 
423 //-----------------------------------------------------------------------------
424 // Function : ComplexRateCalculator::ComplexRateCalculator
425 // Purpose : Copy constructor for "complex" reaction rate calculator
426 // Special Notes :
427 // Scope : public
428 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
429 // Creation Date : 7/31/06
430 //-----------------------------------------------------------------------------
432  :rk0(right.rk0),
433  reaction_distance_factor(right.reaction_distance_factor),
434  Tdep(right.Tdep),
435  Specie1(right.Specie1),
436  Specie2(right.Specie2)
437  {
438  }
439 
440 //-----------------------------------------------------------------------------
441 // Function : ComplexRateCalculator::Clone
442 // Purpose : Copy self operation for "complex" reaction rate calculator
443 // Special Notes :
444 // Scope : public
445 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
446 // Creation Date : 7/31/06
447 //-----------------------------------------------------------------------------
449  {
450  return new ComplexRateCalculator(*this);
451  }
452 
453 //-----------------------------------------------------------------------------
454 // Function : ComplexRateCalculator::computeRateConstant
455 // Purpose : returns rate constant for complex rate style
456 // Special Notes :
457 // Scope : public
458 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
459 // Creation Date : 7/31/06
460 //-----------------------------------------------------------------------------
462  {
463  if (Tdep)
466  else
469 
470  }
471 
472 
473 //-----------------------------------------------------------------------------
474 // Function : ComplexRateCalculator::computeRateConstant
475 // Purpose : returns rate constant for complex rate style
476 // Special Notes :
477 // Scope : public
478 // Creator : Lawrence C Musson, SNL
479 // Creation Date : 04/17/2014
480 //-----------------------------------------------------------------------------
482  std::vector<double> &concs,
483  std::vector<double> &constant_vec)
484  {
485  if (Tdep)
486  return(reaction_distance_factor/T*(Specie1->getDiffusionCoefficient(T,concs,constant_vec)
488  else
489  return(reaction_distance_factor*(Specie1->getDiffusionCoefficient(T,concs,constant_vec)
490  +Specie2->getDiffusionCoefficient(T,concs,constant_vec)));
491 
492  }
493 
494 //-----------------------------------------------------------------------------
495 // Function : ComplexRateCalculator::rateConstantScaleFactor
496 // Purpose : returns rate scaling factor for complex rate style
497 // Special Notes :
498 // Scope : public
499 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
500 // Creation Date : 7/31/06
501 //-----------------------------------------------------------------------------
503  {
504  return (rk0);
505  }
506 
507 
508 
509 
510 
511 //-----------------------------------------------------------------------------
512 // Function : DecomplexRateCalculator::DecomplexRateCalculator
513 // Purpose : constructor for "complex" reaction rate calculator
514 // This is one that models two discrete species decomposing from
515 // a complex, e.g.:
516 // VMM->V0 + VM
517 //
518 // Special Notes : For this to work, there must either be two species in the
519 // products list, or one species with 2.0 as the stochiometric
520 // coefficient.
521 // Scope : public
522 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
523 // Creation Date : 5/04/09
524 //-----------------------------------------------------------------------------
526  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
527  std::vector< std::pair<int,double> > &Reactants,
528  std::vector< std::pair<int,double> > &Products,
529  double bindingEnergy, double degenAB, double degenA, double degenB,
530  double siliconConcentration,
531  double C0, double t0, double x0)
532  :concSi(siliconConcentration),
533  c0(C0),
534  gammaAB(degenAB),
535  gammaA(degenA),
536  gammaB(degenB),
537  deltaE(bindingEnergy)
538  {
539  int ij;
540 
541  // Check assumptions:
542  if ( ! ((Products.size() == 1 && Products[0].second == 2.0) ||
543  (Products.size() == 2 && Products[0].second == 1.0 &&
544  Products[1].second == 1.0)))
545  {
546  std::string msg;
547  msg = "DeomplexRateCalculator: Invalid attempt to use decomplex rate method.";
548  msg = " This method is only valid for decomplexing reactions with two products:\n";
549  if (Products.size() == 1)
550  {
551  msg += " Only one product specified, but its stoichimetric coefficient is not 2.\n";
552  }
553  else if (Products.size() == 2)
554  {
555  msg += " Two products specified, but both stoichimetric coefficient are not 1.\n";
556  }
557  else
558  {
559  msg += " More than two products specified.\n";
560  }
561  // exit with error --- we probably need to do something more careful
562  // in parallel
563  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL,msg);
564  }
565 
566  if (Products[0].first >= 0)
567  Specie1 = &(VariableSpecies[Products[0].first]);
568  else
569  Specie1 = &(ConstantSpecies[-(Products[0].first+1)]);
570 
571  // Handle case where there's only one species with a coefficient of 2.0
572  if (Products.size() == 1)
573  {
574  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
575  }
576  else
577  {
578  if (Products[1].first >= 0)
579  Specie2 = &(VariableSpecies[Products[1].first]);
580  else
581  Specie2 = &(ConstantSpecies[-(Products[1].first+1)]);
582  }
583  ij =Specie1->getChargeState();
584  ij *=Specie2->getChargeState();
585 
586 
587 
588  // Only divide reaction_distance_factor by T in one special case
589  Tdep=false;
590  if (ij>0)
592  else if (ij == 0)
593  reaction_distance_factor = 4*M_PI*5.0e-8;
594  //reaction_distance_factor = 4*M_PI*5.43e-8;
595  //reaction_distance_factor = 4*3.1416*5.43e-8;
596  else
597  {
598  reaction_distance_factor = 4*M_PI*1.4e-4*(-ij);
599  //reaction_distance_factor = 4*M_PI*1.40419676681412915e-4*(-ij);
600  Tdep=true;
601  }
602 
603  setScaleFactors(C0,t0,x0);
604  }
605 
606 
607 //-----------------------------------------------------------------------------
608 // Function : DecomplexRateCalculator::DecomplexRateCalculator
609 // Purpose : Copy constructor for "decomplex" reaction rate calculator
610 // Special Notes :
611 // Scope : public
612 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
613 // Creation Date : 5/04/09
614 //-----------------------------------------------------------------------------
616  :Specie1(right.Specie1),
617  Specie2(right.Specie2),
618  reaction_distance_factor(right.reaction_distance_factor),
619  Tdep(right.Tdep),
620  deltaE(right.deltaE),
621  gammaA(right.gammaA),
622  gammaB(right.gammaB),
623  gammaAB(right.gammaAB),
624  concSi(right.concSi),
625  rk0(right.rk0),
626  c0(right.c0)
627  {
628  }
629 
630 //-----------------------------------------------------------------------------
631 // Function : DecomplexRateCalculator::Clone
632 // Purpose : Copy self operation for "decomplex" reaction rate calculator
633 // Special Notes :
634 // Scope : public
635 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
636 // Creation Date : 7/31/06
637 //-----------------------------------------------------------------------------
639  {
640  return new DecomplexRateCalculator(*this);
641  }
642 
643 
644 //-----------------------------------------------------------------------------
645 // Function : DecomplexRateCalculator::computeRateConstant
646 // Purpose : returns rate constant for decomplex rate style
647 // Special Notes :
648 // Scope : public
649 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
650 // Creation Date : 7/31/06
651 //-----------------------------------------------------------------------------
653  {
654  double R;
655  double KbT=CONSTboltz*T/CONSTQ;
656  double k;
657  double D1=Specie1->getDiffusionCoefficient(T);
658  double D2=Specie2->getDiffusionCoefficient(T);
659  if (Tdep)
661  else
663 
664  k=(R*(D1 +D2)*(concSi)*((gammaA*gammaB)/gammaAB)*exp(-deltaE/KbT));
665 
666  return k;
667  }
668 
669 
670 //-----------------------------------------------------------------------------
671 // Function : DecomplexRateCalculator::computeRateConstant
672 // Purpose : returns rate constant for decomplex rate style
673 // Special Notes :
674 // Scope : public
675 // Creator : Lawrence C Musson, SNL
676 // Creation Date : 04/17/2014
677 //-----------------------------------------------------------------------------
679  std::vector<double> &concs,
680  std::vector<double> &constant_vec)
681  {
682  double R;
683  double KbT=CONSTboltz*T/CONSTQ;
684  double k;
685  double D1=Specie1->getDiffusionCoefficient(T,concs,constant_vec);
686  double D2=Specie2->getDiffusionCoefficient(T,concs,constant_vec);
687  if (Tdep)
689  else
691 
692  k=(R*(D1 +D2)*(concSi)*((gammaA*gammaB)/gammaAB)*exp(-deltaE/KbT));
693 
694  return k;
695  }
696 
697 //-----------------------------------------------------------------------------
698 // Function : DecomplexRateCalculator::rateConstantScaleFactor
699 // Purpose : returns rate scaling factor for decomplex rate style
700 // Special Notes :
701 // Scope : public
702 // Creator : Tom Russo, SNL, Electrical and Microsystems Modeling
703 // Creation Date : 7/31/06
704 //-----------------------------------------------------------------------------
706  {
707  return (rk0);
708  }
709 
710 
711 
712 
713 //-----------------------------------------------------------------------------
714 // Function : BourgoinCorbettRateCalculator::BourgoinCorbettRateCalculator
715 // Purpose : constructor for "bourgoin corbett" reaction rate calculator
716 // This is one that models two discrete species decomposing from
717 // a complex, e.g.:
718 // SII0 + B0 + H -> BI0
719 //
720 // Special Notes :
721 // Scope : public
722 // Creator : Lawrence C Musson, SNL
723 // Creation Date : 03/24/2014
724 //-----------------------------------------------------------------------------
726  std::vector<Specie> &VariableSpecies, std::vector<Specie> &ConstantSpecies,
727  std::vector< std::pair<int,double> > &Reactants,
728  std::vector< std::pair<int,double> > &Products,
729  double sigma,
730  double C0, double t0, double x0)
731  :c0(C0)
732  {
733  int ij;
734 
735  // Check assumptions:
736  if ( ! (Reactants.size() == 3 && Reactants[0].second == 1.0 &&
737  Reactants[1].second == 1.0 && Reactants[2].second == 1.0) )
738  {
739  std::string msg;
740  msg = "BourgoinCorbettCalculator: Invalid attempt to use rate method.";
741  msg = " This method is only valid for ternary reactions:\n";
742  // exit with error --- we probably need to do something more careful
743  // in parallel
744  N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL,msg);
745  }
746 
747 
748  if (Reactants[0].first >= 0)
749  Specie1 = &(VariableSpecies[Reactants[0].first]);
750  else
751  Specie1 = &(ConstantSpecies[-(Reactants[0].first+1)]);
752 
753  // Handle case where there's only one species with a coefficient of 2.0
754  if (Reactants.size() == 1)
755  {
756  Specie2 = Specie1; // that way we can just treat as A+A instead of 2A
757  }
758  else
759  {
760  if (Reactants[1].first >= 0)
761  Specie2 = &(VariableSpecies[Reactants[1].first]);
762  else
763  Specie2 = &(ConstantSpecies[-(Reactants[1].first+1)]);
764  }
765  ij =Specie1->getChargeState();
766  ij *=Specie2->getChargeState();
767 
768  double carrierThermalVelocity;
769 
770  if(Reactants[2].first == -1)
771  carrierThermalVelocity = 20335471.413078606;
772  else
773  carrierThermalVelocity = 16805108.930336751;
774 
775 
776  // Only divide reaction_distance_factor by T in one special case
777  Tdep=false;
778  if (ij>0)
780  else if (ij == 0)
781  {
782  reaction_distance_factor = 4*M_PI*5.0e-8*sigma* carrierThermalVelocity * 5.0e-8 * 5.0e-8/6.0;
783  //reaction_distance_factor = 4*M_PI*5.43e-8;
784  //reaction_distance_factor = 4*3.1416*5.43e-8;
785  }
786  else
787  {
788  reaction_distance_factor = 4*M_PI*1.4e-4*(-ij)*sigma*carrierThermalVelocity*5.0e-8*5.0e-8/6.0;
789  //reaction_distance_factor = 4*M_PI*1.40419676681412915e-4*(-ij)*sigma*carrierThermalVelocity*5.0e-8*5.0e-8/6.0;
790  Tdep=true;
791  }
792 
793  setScaleFactors(C0,t0,x0);
794  }
795 
796 
797 //-----------------------------------------------------------------------------
798 // Function : BourgoinCorbettHoleRateCalculator::BourgoinCorbettHoleRateCalculator
799 // Purpose : Copy constructor for "decomplex" reaction rate calculator
800 // Special Notes :
801 // Scope : public
802 // Creator : Lawrence C Musson, SNL
803 // Creation Date : 03/24/2014
804 //-----------------------------------------------------------------------------
806  :Specie1(right.Specie1),
807  Specie2(right.Specie2),
808  reaction_distance_factor(right.reaction_distance_factor),
809  Tdep(right.Tdep),
810  sigma(right.sigma),
811  rk0(right.rk0),
812  c0(right.c0)
813  {
814  }
815 
816 //-----------------------------------------------------------------------------
817 // Function : BourgoinCorbettHoleRateCalculator::Clone
818 // Purpose : Copy self operation for "decomplex" reaction rate calculator
819 // Special Notes :
820 // Scope : public
821 // Creator : Lawrence C Musson, SNL
822 // Creation Date : 03/24/2014
823 //-----------------------------------------------------------------------------
825  {
826  return new BourgoinCorbettHoleRateCalculator(*this);
827  }
828 
829 
830 //-----------------------------------------------------------------------------
831 // Function : BourgoinCorbettHoleRateCalculator::computeRateConstant
832 // Purpose : returns rate constant for decomplex rate style
833 // Special Notes :
834 // Scope : public
835 // Creator : Lawrence C Musson, SNL
836 // Creation Date : 03/24/2014
837 //-----------------------------------------------------------------------------
839  {
840  double R;
841  double KbT=CONSTboltz*T/CONSTQ;
842  double k;
843  double D1=Specie1->getDiffusionCoefficient(T);
844  double D2=Specie2->getDiffusionCoefficient(T);
845  if (Tdep)
847  else
849 
850  k=R;
851 
852  return k;
853  }
854 
855 
856 //-----------------------------------------------------------------------------
857 // Function : BourgoinCorbettHoleRateCalculator::computeRateConstant
858 // Purpose : returns rate constant for decomplex rate style
859 // Special Notes :
860 // Scope : public
861 // Creator : Lawrence C Musson, SNL
862 // Creation Date : 03/24/2014
863 //-----------------------------------------------------------------------------
865  std::vector<double> &concs,
866  std::vector<double> &constant_vec)
867  {
868  double R;
869  double KbT=CONSTboltz*T/CONSTQ;
870  double k;
871  double D1=Specie1->getDiffusionCoefficient(T);
872  double D2=Specie2->getDiffusionCoefficient(T);
873  if (Tdep)
875  else
877 
878  k=R;
879 
880  return k;
881  }
882 
883 //-----------------------------------------------------------------------------
884 // Function : BourgoinCorbettHoleRateCalculator::rateConstantScaleFactor
885 // Purpose : returns rate scaling factor for decomplex rate style
886 // Special Notes :
887 // Scope : public
888 // Creator : Lawrence C Musson, SNL
889 // Creation Date : 03/24/2014
890 //-----------------------------------------------------------------------------
892  {
893  return (rk0);
894  }
895 
896 } // namespace Device
897 } // namespace Xyce