Xyce  6.1
N_DEV_Neuron3.h
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-2015 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$
27 //
28 // Purpose : Neuron classes.
29 //
30 // Special Notes :
31 //
32 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
33 //
34 // Creation Date : 06/10/09
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision$
40 //
41 // Revision Date : $Date$
42 //
43 // Current Owner : $Author$
44 //-----------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_DEV_Neuron3_h
47 #define Xyce_N_DEV_Neuron3_h
48 
49 #include <N_DEV_Configuration.h>
50 #include <Sacado.hpp>
51 
52 // ---------- Xyce Includes ----------
53 #include <N_DEV_DeviceBlock.h>
54 #include <N_DEV_DeviceInstance.h>
55 #include <N_DEV_DeviceModel.h>
56 
57 #include <N_DEV_Neuron.h>
58 
59 namespace Xyce {
60 namespace Device {
61 namespace Neuron3 {
62 
63 class Model;
64 class Instance;
65 
66 struct Traits : public DeviceTraits<Model, Instance, Neuron::Traits>
67 {
68  static const char *name() {return "Neuron";}
69  static const char *deviceTypeName() {return "YNEURON level 3";}
70  static int numNodes() {return 2;}
71  static bool modelRequired() {return true;}
72  static bool isLinearDevice() {return true;}
73 
74  static Device *factory(const Configuration &configuration, const FactoryBlock &factory_block);
75  static void loadModelParameters(ParametricData<Model> &model_parameters);
76  static void loadInstanceParameters(ParametricData<Instance> &instance_parameters);
77 };
78 
79 //-----------------------------------------------------------------------------
80 // Class : Instance
81 // Purpose : This is class refers to a single instance of the
82 // Neuron device. It has two nodes associated with it, a
83 // positive and a negative node. See the NeuronInstance
84 // class for a more detailed explanation.
85 // Special Notes :
86 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
87 // Creation Date : 06/10/09
88 //-----------------------------------------------------------------------------
89 class Instance : public DeviceInstance
90 {
91  friend class ParametricData<Instance>;
92  friend class Model;
93  friend class Traits;
94 
95 public:
96 
97  Instance(
98  const Configuration & configuration,
99  const InstanceBlock & IB,
100  Model & Miter,
101  const FactoryBlock & factory_block);
102 
103 
104  ~Instance();
105 
106 private:
107  Instance(const Instance &);
108  Instance &operator=(const Instance &);
109 
110 public:
111  void registerLIDs( const std::vector<int> & intLIDVecRef,
112  const std::vector<int> & extLIDVecRef );
113  void registerStateLIDs( const std::vector<int> & staLIDVecRef );
114 
115  void loadNodeSymbols(Util::SymbolTable &symbol_table) const; // override
116 
117  const std::vector< std::vector<int> > & jacobianStamp() const;
118  void registerJacLIDs( const std::vector< std::vector<int> > & jacLIDVec );
119 
120  bool processParams ();
121  bool updateTemperature(const double & temp_tmp);
122 
123  bool updateIntermediateVars ();
124  bool updatePrimaryState ();
125  bool updateSecondaryState ();
126  bool setIC ();
127 
128  void varTypes( std::vector<char> & varTypeVec );
129 
130  // load functions, residual:
131  bool loadDAEQVector ();
132  bool loadDAEFVector ();
133 
134  void auxDAECalculations ();
135 
136  // load functions, Jacobian:
137  bool loadDAEdQdx ();
138  bool loadDAEdFdx ();
139 
140 protected:
141 private:
142  // These functions represents the equations that need to be solved
143  // for this device. Since Xyce loads an F and Q contribution, the
144  // equations are broken up into their F and Q components. Thus there
145  // is a kcl1EquF() and kcl1EquQ(). Automatic differentiation will
146  // be used to generate all the derivatives of these equations for the
147  // dF/dX and dQ/dX loads
148 
149  // first we list some utility functions for calculating coefficients
150  //
151  // These functions expect V to be in milli-volts and then return values that
152  // are in 1/ms. Thus the extra factor's of 1000 here and there
153 
154  // potassium current, functions for activator equation
155  template <typename ScalarT>
156  static ScalarT alphaN( const ScalarT & Vn1, const ScalarT & Vrest)
157  {
158  ScalarT vDiff = 1000.0 * (Vn1 - Vrest); // convert voltage to milli-volts
159  ScalarT r;
160  // if ((vDiff > 9.99) && (vDiff < 10.01) )
161  // {
162  // r = 1.0/(10.0 * ( std::exp( (10.0 - vDiff)/10.0 )));
163  // }
164  // else
165  // {
166  r = (10.0 - vDiff) /
167  (100.0 * ( std::exp( (10.0 - vDiff)/10.0 ) - 1.0 ));
168  // }
169  r *= 1000.0; // change from 1/ms to 1/s
170  return r;
171  }
172 
173  template <typename ScalarT>
174  static ScalarT betaN( const ScalarT & Vn1, const ScalarT & Vrest)
175  {
176  ScalarT vDiff = 1000.0 * (Vn1 - Vrest);
177  ScalarT r = 0.125 * std::exp( -vDiff/80.0 );
178  r *= 1000.0; // change from 1/ms to 1/s
179  return r;
180  }
181 
182  // sodium current, functions for activator equation
183  template <typename ScalarT>
184  static ScalarT alphaM( const ScalarT & Vn1, const ScalarT & Vrest)
185  {
186  ScalarT vDiff = 1000.0 * (Vn1 - Vrest);
187  ScalarT r;
188  // if ((vDiff > 24.99) && (vDiff < 25.01) )
189  // {
190  // r = (1.0) /
191  // (( std::exp( (25.0 - vDiff)/10.0 )));
192  // }
193  // else
194  // {
195  r = (25.0 - vDiff) /
196  (10.0 * ( std::exp( (25.0 - vDiff)/10.0 ) - 1.0 ));
197  // }
198  r *= 1000.0; // change from 1/ms to 1/s
199  return r;
200  }
201 
202  template <typename ScalarT>
203  static ScalarT betaM( const ScalarT & Vn1, const ScalarT & Vrest)
204  {
205  ScalarT vDiff = 1000.0 * (Vn1 - Vrest);
206  ScalarT r = 4.0 * std::exp( -vDiff/18.0 );
207  r *= 1000.0; // change from 1/ms to 1/s
208 
209  return r;
210  }
211 
212  template <typename ScalarT>
213  static ScalarT alphaH( const ScalarT & Vn1, const ScalarT & Vrest)
214  {
215  ScalarT vDiff = 1000.0 * (Vn1 - Vrest);
216  ScalarT r = 0.07 * std::exp( -vDiff/20.0 );
217  r *= 1000.0; // change from 1/ms to 1/s
218  return r;
219  }
220 
221  template <typename ScalarT>
222  static ScalarT betaH( const ScalarT & Vn1, const ScalarT & Vrest)
223  {
224  ScalarT vDiff = 1000.0 * (Vn1 - Vrest);
225  ScalarT r = 1.0 / ( std::exp( (30.0 - vDiff)/10.0 ) + 1.0 );
226  r *= 1000.0; // change from 1/ms to 1/s
227  return r;
228  }
229 
230  // now the device equations
231  // KCL equation 1
232  // VSeg -- segment voltage
233  // VSegP -- previous segment voltage
234  // VSegN -- next segment voltage
235  // n, m, h -- vars which determine current through themembrane
236  // gPrev, gNext -- conductivity to previous and next segment (can be zero)
237  //
238  // Full equation is:
239  // i_trans_membrane - i_externally_injected - gNext (VSegN - VSeg) - gPrev (VSegP - VSeg ) + Cmem dVseg/dt = 0
240  //
241  // i_tarns_membrane is determined by the ion channel equations -- hodgkin-huxley in this case.
242  // i_externally_injeted is not supported here but could be an externally injected current.
243  //
244  template <typename ScalarT>
245  static ScalarT kcl1EquF( const ScalarT& VSeg, const ScalarT& VSegP, const ScalarT & VSegN, const ScalarT& n, const ScalarT& m, const ScalarT& h,
246  const ScalarT& gPrev, const ScalarT& gNext, const ScalarT& memG, const ScalarT& restV, const ScalarT& Kg, const ScalarT& Ke, const ScalarT& NaG, const ScalarT& NaE )
247  {
248  ScalarT powN = n * n * n * n;
249  ScalarT powM = m * m * m;
250  //ScalarT r = memG * (VSeg - restV) + Kg * powN * (VSeg - Ke ) + NaG * powM * h * (VSeg - NaE ) - gNext * (VSegN - VSeg) - gPrev * (VSegP - VSeg);
251  ScalarT r = memG * (VSeg - restV) + Kg * powN * (VSeg - Ke ) + NaG * powM * h * (VSeg - NaE )
252  - gNext * (VSegN - VSeg) - gPrev * (VSegP - VSeg);
253  return r;
254  }
255 
256  template <typename ScalarT>
257  static ScalarT kcl1EquQ( const ScalarT& VSeg, const ScalarT& memC )
258  {
259  ScalarT r = memC * VSeg;
260  return r;
261  }
262 
263 #if 0
264  // KCL equation 2 -- -1 * equation 1 because of device symmetry
265  template <typename ScalarT>
266  static ScalarT kcl2EquF( const ScalarT& Vn1, const ScalarT& Vn2, const ScalarT& n, const ScalarT& m, const ScalarT& h,
267  const ScalarT& memG, const ScalarT& restV, const ScalarT& Kg, const ScalarT& Ke, const ScalarT& NaG, const ScalarT& NaE )
268  {
269  ScalarT powN = n * n * n * n;
270  ScalarT powM = m * m * m;
271  ScalarT r = -1.0*(memG * (Vn1 - Vn2 - restV) + Kg * powN * (Vn1 - Vn2 - Ke ) + NaG * powM * h * (Vn1 - Vn2 - NaE ));
272  //ScalarT r = -1.0*(memG * (Vn1 - restV) - Kg * powN * (Vn1 - Vn2 - Ke ) - NaG * powM * h * (Vn1 - Vn2 - NaE ));
273  return r;
274  }
275 
276  template <typename ScalarT>
277  static ScalarT kcl2EquQ( const ScalarT& Vn1, const ScalarT& Vn2, const ScalarT& memC )
278  {
279  ScalarT r = -1.0 * memC * (Vn1 - Vn2);
280  return r;
281  }
282 #endif
283 
284  // n conservation equation
285  template <typename ScalarT>
286  static ScalarT nEquF( const ScalarT& Vn1, const ScalarT& n, const ScalarT& Vrest )
287  {
288  ScalarT r = alphaN<ScalarT>( Vn1, Vrest ) * (1.0 - n ) - betaN<ScalarT>( Vn1, Vrest ) * n;
289  return r;
290  }
291 
292  template <typename ScalarT>
293  static ScalarT nEquQ( const ScalarT& n )
294  {
295  ScalarT r = -n;
296  return r;
297  }
298 
299  // m conservation equation
300  template <typename ScalarT>
301  static ScalarT mEquF( const ScalarT& Vn1, const ScalarT& m, const ScalarT& Vrest )
302  {
303  ScalarT r = alphaM<ScalarT>( Vn1, Vrest ) * (1.0 - m ) - betaM<ScalarT>( Vn1, Vrest ) * m;
304  return r;
305  }
306 
307  template <typename ScalarT>
308  static ScalarT mEquQ( const ScalarT& m )
309  {
310  ScalarT r = -m;
311  return r;
312  }
313 
314  // h conservation equation
315  template <typename ScalarT>
316  static ScalarT hEquF( const ScalarT& Vn1, const ScalarT& h, const ScalarT& Vrest )
317  {
318  ScalarT r = alphaH<ScalarT>( Vn1, Vrest ) * (1.0 - h ) - betaH<ScalarT>( Vn1, Vrest ) * h;
319  return r;
320  }
321 
322  template <typename ScalarT>
323  static ScalarT hEquQ( const ScalarT& h )
324  {
325  ScalarT r = -h;
326  return r;
327  }
328 
329 public:
330  // iterator reference to the Neuron model which owns this instance.
331  // Getters and setters
333  {
334  return model_;
335  }
336 
337 private:
338 
339  Model & model_; //< Owning model
340 
341  std::vector< std::vector<int> > jacStamp;
342 
343  // model level parameters that can be overridden at the instance level
344  double rInt; // intracellular resistivity
345  double radius; // Segment radius
346  double length; // cable length (segment length = length/nSeg)
347  double segArea; // segment area (derrived from radius, length and nSeg)
348  int nSeg; // number of segments
349  bool rIntGiven;
352  bool nSegGiven;
353 
354  // the cable equation is dependent on parameters from the previous and next segment of other
355  // cables attached to the input/ouput nodes (i.e. when we branch a cable). This lets
356  // one set the parameters for the previous/next cable segment.
357  double rIntPrevious;
360  double rIntNext;
361  double radiusNext;
362  double lengthNext;
369 
370  // conductance between segments -- calculated from radius, rInt and length and number of segments
371  // gBackward connects to previous node. gForward connects to the next node
372  std::vector<double> gBackward;
373  std::vector<double> gForward;
374 
375  // derrived quantities computed in updateIntermediateVars
376  // and used in the load functions (no q terms on the external nodes)
377  double kcl1Fvalue;
378  double kcl2Fvalue;
379  // internal segments
380  std::vector<double> segFvalue;
381  std::vector<double> segQvalue;
382  std::vector<double> segNEquFvalue, segNEquQvalue;
383  std::vector<double> segMEquFvalue, segMEquQvalue;
384  std::vector<double> segHEquFvalue, segHEquQvalue;
385  // jacobian terms
388  // internal equations
389  std::vector<double> segF_dVp, segF_dV, segF_dVn, segF_dn, segF_dm, segF_dh;
390  std::vector<double> segQ_dV;
391  std::vector<double> dnF_dV, dnF_dn, dnQ_dn;
392  std::vector<double> dmF_dV, dmF_dm, dmQ_dm;
393  std::vector<double> dhF_dV, dhF_dh, dhQ_dh;
394 
395  // state variables
396  std::vector<double> potassiumCurrent;
397  std::vector<double> sodiumCurrent;
398 
399  // local state indices (offsets)
400  std::vector<int> li_KCurrentState;
401  std::vector<int> li_NaCurrentState;
402 
403  // local solution indices (offsets)
404  int li_Pos; // local index to positive node on this device
405  int li_Neg; // local index to negative node on this device
406  // local solution indices for internal vars (variable number of these)
407  std::vector<int> li_Vol; // local index to segment voltage
408  std::vector<int> li_nPro; // local index to n promoter value (Na current)
409  std::vector<int> li_mPro; // local index to m promoter value (K current)
410  std::vector<int> li_hPro; // local index to h promoter value (K current)
411 
412  // Matrix equation index variables:
413 
414  // Offset variables corresponding to the above declared indices.
417  std::vector<int> SegVEqnVpreOffset;
418  std::vector<int> SegVEqnVsegOffset;
419  std::vector<int> SegVEqnVnexOffset;
420  std::vector<int> SegVEqnNOffset;
421  std::vector<int> SegVEqnMOffset;
422  std::vector<int> SegVEqnHOffset;
423  std::vector<int> NEquVNodeOffset;
424  std::vector<int> NEquNNodeOffset;
425  std::vector<int> MEquVNodeOffset;
426  std::vector<int> MEquMNodeOffset;
427  std::vector<int> HEquVNodeOffset;
428  std::vector<int> HEquHNodeOffset;
429 };
430 
431 //-----------------------------------------------------------------------------
432 // Class : Model
433 // Purpose :
434 // Special Notes :
435 // Creator : Richard Schiek, SNL, Electrical and Microsystem Modeling
436 // Creation Date : 06/10/09
437 //-----------------------------------------------------------------------------
438 class Model : public DeviceModel
439 {
440  typedef std::vector<Instance *> InstanceVector;
441 
442  friend class ParametricData<Model>;
443  friend class Instance;
444  friend class Traits;
445 
446 public:
447  Model(
448  const Configuration & configuration,
449  const ModelBlock & MB,
450  const FactoryBlock & factory_block);
451  ~Model();
452 
453 private:
454  Model();
455  Model(const Model &);
456  Model &operator=(const Model &);
457 
458 public:
459  virtual void forEachInstance(DeviceInstanceOp &op) const /* override */;
460 
461  virtual std::ostream &printOutInstances(std::ostream &os) const;
462 
463  bool processParams ();
464  bool processInstanceParams ();
465 
466 private:
467 
468  // parameter variables
469  double cMem; // membrane capacitance
470  double gMem; // membrane conductance
471  double vRest; // resting potential
472  double eNa; // sodium rest potential
473  double gNa; // sodium base conductance
474  double eK; // potassium rest potential
475  double gK; // potassium base conductance
476  double rInt; // intracellular resistivity
477  double radius; // Segment radius
478  double length; // cable length (segment length = length/nSeg)
479  int nSeg; // number of segments
480 
481  // the cable equation is dependent on parameters from the previous and next segment of other
482  // cables attached to the input/ouput nodes (i.e. when we branch a cable). This lets
483  // one set the parameters for the previous/next cable segment.
484  double rIntPrevious;
487  double rIntNext;
488  double radiusNext;
489  double lengthNext;
496 
497  // flags that parameters were given
498  bool cMemGiven;
499  bool gMemGiven;
501  bool eNaGiven;
502  bool gNaGiven;
503  bool eKGiven;
504  bool gKGiven;
505  bool rIntGiven;
508  bool nSegGiven;
509 
510 
511 public:
512  void addInstance(Instance *instance)
513  {
514  instanceContainer.push_back(instance);
515  }
516 
517 private:
518  std::vector<Instance*> instanceContainer;
519 };
520 
521 void registerDevice();
522 
523 } // namespace Neuron3
524 } // namespace Device
525 } // namespace Xyce
526 
527 #endif
std::vector< int > MEquVNodeOffset
std::vector< double > segNEquFvalue
std::vector< double > segF_dV
static ScalarT hEquF(const ScalarT &Vn1, const ScalarT &h, const ScalarT &Vrest)
std::vector< double > dhF_dh
std::vector< double > segF_dn
std::vector< int > SegVEqnVsegOffset
bool updateTemperature(const double &temp_tmp)
static const char * deviceTypeName()
Definition: N_DEV_Neuron3.h:69
void registerJacLIDs(const std::vector< std::vector< int > > &jacLIDVec)
std::vector< int > SegVEqnNOffset
std::vector< int > NEquVNodeOffset
static ScalarT mEquF(const ScalarT &Vn1, const ScalarT &m, const ScalarT &Vrest)
std::vector< double > segQ_dV
std::vector< int > HEquHNodeOffset
std::vector< int > SegVEqnMOffset
Pure virtual class to augment a linear system.
std::vector< std::vector< int > > jacStamp
std::vector< double > dhF_dV
void addInstance(Instance *instance)
std::vector< double > dmF_dV
std::vector< double > dnF_dV
std::vector< Instance * > InstanceVector
std::vector< double > gForward
void registerStateLIDs(const std::vector< int > &staLIDVecRef)
std::vector< double > dnF_dn
static ScalarT mEquQ(const ScalarT &m)
std::vector< double > segF_dVn
std::vector< double > segF_dh
std::vector< double > dmQ_dm
std::vector< Instance * > instanceContainer
std::vector< int > MEquMNodeOffset
std::vector< double > segQvalue
std::vector< double > segHEquFvalue
static const char * name()
Definition: N_DEV_Neuron3.h:68
std::vector< int > SegVEqnHOffset
The FactoryBlock contains parameters needed by the device, instance and model creation functions...
std::vector< double > potassiumCurrent
static ScalarT betaN(const ScalarT &Vn1, const ScalarT &Vrest)
bool processParams()
processParams
static void loadInstanceParameters(ParametricData< Instance > &instance_parameters)
Definition: N_DEV_Neuron3.C:72
static Device * factory(const Configuration &configuration, const FactoryBlock &factory_block)
std::vector< int > SegVEqnVpreOffset
std::vector< double > dnQ_dn
static ScalarT kcl1EquF(const ScalarT &VSeg, const ScalarT &VSegP, const ScalarT &VSegN, const ScalarT &n, const ScalarT &m, const ScalarT &h, const ScalarT &gPrev, const ScalarT &gNext, const ScalarT &memG, const ScalarT &restV, const ScalarT &Kg, const ScalarT &Ke, const ScalarT &NaG, const ScalarT &NaE)
The Device class is an interface for device implementations.
Definition: N_DEV_Device.h:101
Instance(const Configuration &configuration, const InstanceBlock &IB, Model &Miter, const FactoryBlock &factory_block)
static ScalarT alphaN(const ScalarT &Vn1, const ScalarT &Vrest)
std::vector< int > HEquVNodeOffset
static ScalarT betaH(const ScalarT &Vn1, const ScalarT &Vrest)
std::vector< double > segFvalue
void loadNodeSymbols(Util::SymbolTable &symbol_table) const
Populates and returns the store name map.
std::vector< int > NEquNNodeOffset
std::vector< double > segHEquQvalue
const std::vector< std::vector< int > > & jacobianStamp() const
Class Configuration contains device configuration data.
std::vector< double > segNEquQvalue
virtual void forEachInstance(DeviceInstanceOp &op) const
Apply a device instance "op" to all instances associated with this model.
static ScalarT alphaM(const ScalarT &Vn1, const ScalarT &Vrest)
std::vector< double > gBackward
std::vector< int > li_KCurrentState
bool processInstanceParams()
processInstanceParams
std::vector< double > dhQ_dh
std::vector< int > SegVEqnVnexOffset
Instance & operator=(const Instance &)
static ScalarT kcl2EquQ(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &memC)
static ScalarT hEquQ(const ScalarT &h)
static ScalarT kcl1EquQ(const ScalarT &VSeg, const ScalarT &memC)
std::vector< double > segF_dVp
static ScalarT nEquQ(const ScalarT &n)
Model & operator=(const Model &)
std::vector< int > li_NaCurrentState
static ScalarT nEquF(const ScalarT &Vn1, const ScalarT &n, const ScalarT &Vrest)
void registerLIDs(const std::vector< int > &intLIDVecRef, const std::vector< int > &extLIDVecRef)
std::vector< double > segF_dm
std::vector< double > sodiumCurrent
static ScalarT kcl2EquF(const ScalarT &Vn1, const ScalarT &Vn2, const ScalarT &n, const ScalarT &m, const ScalarT &h, const ScalarT &a, const ScalarT &b, const ScalarT &MC, const ScalarT &HC, const ScalarT &CC, const ScalarT &memG, const ScalarT &restV, const ScalarT &Kg, const ScalarT &Ke, const ScalarT &NaG, const ScalarT &NaE, const ScalarT &Ag, const ScalarT &Ae, const ScalarT &CaTg, const ScalarT &CaE, const ScalarT &KCaG)
ModelBlock represents a .MODEL line from the netlist.
The DeviceTraits template describes the configuration of a device.
Manages parameter binding for class C.
Definition: N_DEV_Pars.h:214
static ScalarT betaM(const ScalarT &Vn1, const ScalarT &Vrest)
InstanceBlock represent a device instance line from the netlist.
std::vector< double > dmF_dm
void varTypes(std::vector< char > &varTypeVec)
virtual std::ostream & printOutInstances(std::ostream &os) const
std::vector< double > segMEquFvalue
static ScalarT alphaH(const ScalarT &Vn1, const ScalarT &Vrest)
static void loadModelParameters(ParametricData< Model > &model_parameters)
std::vector< double > segMEquQvalue