clue_oxide 0.2.1

CluE Oxide (Cluster Evolution Oxide) is a spin dynamics simulation program for electron spin decoherence
Documentation
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
use std::fmt;

/// `CluEError` contains the possible errors.
#[derive(PartialEq,Debug,Clone)]
pub enum CluEError{
  AllSignalsNotSameLength(String),
  AtomDoesNotSpecifyElement(usize),
  AllVectorsNotSameLength(String),
  BondsAreNotDefined,
  CannotAddPointToGrid(usize,usize),
  CannotAddTokens,
  CannontAugmentFilter(usize,String),
  CannotCombineTokens(usize),
  CannotConvertToFloat(usize,String),
  CannotConvertSerialToIndex(u32),
  CannotConvertToVector(usize),
  CannotCreateDir(String),
  CannotDiagonalizeHamiltonian(String),
  CannotDivTokens,
  CannotFindCellID(usize),
  CannotFindSpinOp(String),
  CannotFindParticleForRefIndex(usize),
  CannotFindRefIndexFromBathIndex(usize),
  CannotFindRefIndexFromNthActive(usize),
  CannotInferEigenvalues(usize),
  CannotMatchVertexToIndex(usize),
  CannotMulTokens,
  CannotOpenFile(String),
  CannotParseElement(String),
  CannotParseLine(String),
  CannotParseIsotope(String),
  CannotParseRHS(usize),
  CannotParseSecondaryParticleFilter(String),
  CannotPowTokens,
  CannotReadGrid(String),
  CannotSampleBinomialDistribution(usize,f64),
  CannotSetExchangeCoupling(usize),
  CannotSubTokens,
  CannotTakeTrace(String),
  CannotWriteFile(String),
  CIFCannotDeclareDataItem(usize,String),
  CIFCannotFindSymmetryEquivalentSite(String),
  CIFCannotParseFloat(String),
  CIFCannotStartLoop(usize),
  CIFDataItemAlreadyDeclared(usize,String),
  CIFInconsistantCoorDataSizes(usize),
  CIFNoDeclaredDataItem(usize,String),
  CIFNoField(String),
  CIFNoFractX,
  CIFNoFractY,
  CIFNoFractZ,
  CIFNoTypeSymbol,
  ClusterFileContainsNoHeader(String),
  ClusterHasNoSignal(String),
  ClusterLineFormatError(String),
  ConfigModeNotRecognized(String),
  DeprecatedKeywordReplaced(usize,String,String),
  DetectedSpinDoesNotHaveAnActiveIndex,
  EmptyVector(usize),
  ExpectedClusterSetWithNSizes(usize,usize),
  ExpectedEquality(usize),
  ExpectedBoolRHS(usize),
  ExpectedFloatRHS(usize),
  ExpectedIntRHS(usize),
  ExpectedNonNegativeIntRHS(usize),
  ExpectedVecOfNFloatsRHS(usize,usize),
  ExpectedNumber(usize),
  FilterNoMaxDistance(String),
  FilterNeedsALabel,
  FilterNoMinDistance(String),
  FiltersOverlap(String,String),
  IncorrectFormattingIsotopeAbundances(usize),
  IncorrectNumberOfAxes(usize,usize),
  InorrectNumberOfCellOffsets(usize,usize),
  IndexOutOfBounds(usize,usize,usize),
  InvalidArgument(usize,String),
  InvalidAxes,
  InvalidClusterPartitionKey,
  InvalidConfigFile(String),
  InvalidGeometry(usize,String),
  InvalidPulseSequence(usize),
  InvalidSecondaryFilter(usize,String),
  InvalidToken(usize,String),
  IsotopeAbundancesCannotBeNormalized(usize),
  IsotopeAbundancesMustBeNonnegative(usize),
  LenghMismatchTimepointsIncrements(usize,usize),
  MissingFilter(String),
  MissingFilterArgument(usize,String),
  MissingFilterLabel(usize),
  MissingHeader(String),
  MissingProperties(String),
  MissingPropertiesLabel(usize),
  ModeAttributeWrongBrackets,
  ModeAttributeWrongOption(String),
  ModeAttributeWrongSharp,
  MultipleCosubstitutionGroups(usize),
  NANTensorBathDipoleDipole(usize,String,usize,String),
  NANTensorBathZeeman(usize,String),
  NANTensorDetectedZeeman,
  NANTensorExchangeCoupling(usize,String,usize,String),
  NANTensorHyperfine(usize,String),
  NANTensorQuadrupole(usize,String),
  NoArgument(usize),
  NoBathGMatrixSpecifier(String,String),
  NoCentralSpin,
  NoCentralSpinCoor,
  NoCentralSpinIdentity,
  NoCentralSpinTransition,
  NoClashDistancePBC,
  NoClusterBatchSize,
  NoClusterMethod,
  NoClustersOfSize(usize),
  NoDensityMatrixMethod,
  NoDetectedSpinIdentity,
  NoDetectedSpinMultiplicity,
  NoDetectedSpinTransition,
  NoExtracellIsotopicDistribution(String),
  NoGMatrixSpecifier,
  NoGMatrixValues,
  NoHyperfineSpecifier(String,String),
  NoInputFile,
  NoLoadGeometry,
  NoMagneticField,
  NoModelIndex,
  NoMaxClusterSize,
  NoNeighborCutoffDistance,
  NoNumberSystemInstances,
  NoOrientationGrid,
  NoPulseSequence,
  NoQuadrupoleSpecifier(String,String),
  NoRadius,
  NoRelationalOperators(usize),
  NoRemovePartialMethyls,
  NoRHS(usize),
  NoSpinOpForClusterSize(usize,usize),
  NoSpinOpWithMultiplicity(usize),
  NoStructureFile,
  NotA3DVector(usize),
  NotALebedevGrid(usize),
  NotAnOperator(usize,String),
  NotAProperSubset(String,String),
  NoTemperature,
  NoTensorValues,
  NoTimeAxis,
  NoTimeIncrements,
  NoTimepoints,
  OptionAlreadySet(usize,String),
  ParticlesClash(usize,String,usize,String,f64,f64),
  ParticleIsNotActive(usize),
  SaveNameEmpty,
  SaveNameNotSet,
  SecondaryFilterRequiresAnIndex(String),
  SpinPropertiesNeedsALabel,
  SpinPropertiesNeedsAnIsotope(String),
  StructurePropertiesNeedsALabel,
  StructurePropertiesDoesNotNeedAnIsotope(String),
  TensorNotSet(usize),
  TooFewRHSArguments(usize),
  TooManyRelationalOperators(usize),
  TooManyRHSArguments(usize),
  UnavailableSpinOp(usize,usize),
  UnassignedCosubstitutionGroup(usize),
  UnequalLengths(String,usize,String,usize),
  UnmatchedBlockComment(usize),
  UnmatchedDelimiter(usize),
  UnrecognizedOption(String),
  UnrecognizedVectorSpecifier(String),
  VectorSpecifierDoesNotSpecifyUniqueVector(String),
  WrongClusterSizeForAnalyticCCE(usize),
  WrongNumberOfAxes(usize,usize),
  WrongOrientationGridDim(usize,usize,usize),
  WrongProbabilityDistributionDim(usize,usize,usize),
  WrongVectorLength(usize,usize,usize)
}

impl fmt::Display for CluEError{
  // This function defines the error messages.
  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    match self{

      CluEError::AllSignalsNotSameLength(filename) => write!(f,
          "for \"{}\",signals must all have the same length", filename),

      CluEError::AtomDoesNotSpecifyElement(serial) => write!(f,
          "atom {} does not specify an element",serial),

      CluEError::AllVectorsNotSameLength(filename) => write!(f,
          "for \"{}\",signals must all have the same length", filename),

      CluEError:: BondsAreNotDefined => write!(f,
          "no chemical bonds are established"),

      CluEError::CannotAddPointToGrid(point_dim, grid_dim) => write!(f,
          "cannot add {}D point t0 {}D grid",point_dim, grid_dim),

      CluEError::CannotAddTokens => write!(f,
          "cannot add tokens meaningfully"),

      CluEError::CannontAugmentFilter(index,secondary_filter) => write!(f,
          "cannot use secondary group \"{}\" with particle {}",
         secondary_filter,index),

      CluEError::CannotCombineTokens(line_number) => write!(f,
          "line {}, cannot combine tokens meaningfully", line_number),

      CluEError::CannotConvertSerialToIndex(serial) => write!(f,
          "cannot convert serial id, {}, to an index",serial),

      CluEError::CannotDiagonalizeHamiltonian(matrix) => write!(f,
          "cannot diagonalize Hamiltonian,\n {}",matrix),

      CluEError::CannotCreateDir(path) => write!(f,
          "cannot create directory \"{}\"",path),

      CluEError::CannotDivTokens => write!(f,
          "cannot divide tokens meaningfully"),

      CluEError::CannotFindCellID(idx) => write!(f,
          "cannot determine cell id for particle {}",idx),

      CluEError::CannotFindSpinOp(sop) => write!(f,
          "cannot find spin operator \"{}\"",sop),

      CluEError::CannotFindParticleForRefIndex(ref_index) => write!(f,
          "cannot find bath index for reference index \"{}\"", ref_index),

      CluEError::CannotFindRefIndexFromBathIndex(bath_index) => write!(f,
          "cannot find reference index for bath index \"{}\"", bath_index),

      CluEError::CannotFindRefIndexFromNthActive(n) => write!(f,
          "cannot find reference index for the {}th active particle", n),

      CluEError::CannotInferEigenvalues(line_number) => write!(f,
          "line {}, cannot infer eigenvalues from input",line_number),
      
      CluEError::CannotMatchVertexToIndex(vertex) => write!(f,
          "cannot match vertex {} to an index",vertex),
      
      CluEError::CannotMulTokens => write!(f,
          "cannot multiply tokens meaningfully"),

      CluEError::CannotOpenFile(file) => write!(f,
          "cannot open \"{}\"", file),

      CluEError::CannotParseElement(element) => write!(f,
          "cannot parse \"{}\" as an element", element),

      CluEError::CannotParseLine(line) => write!(f,
          "cannot parse line \"{}\"", line),

      CluEError::CannotParseIsotope(isotope) => write!(f,
          "cannot parse \"{}\" as an isotope", isotope),

      CluEError::CannotParseRHS(line_number) => write!(f,
          "line {}, cannot parse line right hand side", line_number),

      CluEError::CannotParseSecondaryParticleFilter(group) => write!(f,
          "cannot parse secondary particle group \"{}\"", group),

      CluEError::CannotSampleBinomialDistribution(n,p) => write!(f,
          "cannot sample from the binomial distribution B(n={},p={})",
          n,p),

      CluEError::CannotSetExchangeCoupling(line_number) => write!(f,
          "line {}, cannot set exchange coupling",line_number),

      CluEError::CannotSubTokens => write!(f,
          "cannot subtract tokens meaningfully"),

      CluEError::CannotTakeTrace(matrix) => write!(f,
          "cannot take trace of \"{}\"",matrix),

      CluEError::CannotPowTokens => write!(f,
          "cannot do token^token meaningfully"),

      CluEError::CannotReadGrid(filename) => write!(f,
          "cannot read grid from \"{}\": \
the grid should be specified as a csv file with one column per dimension, \
followed by a column for the weights", filename),

      CluEError::CannotConvertToFloat(line_number, token) => write!(f,
          "line {}, cannot convert \"{}\" to type float", line_number,token),

      CluEError::CannotConvertToVector(line_number) => write!(f,
          "line {}, cannot find vector", line_number),

      CluEError::ClusterFileContainsNoHeader(file) => write!(f,
          "Cluster file \"{}\" does not contain the correct header: \
\"#[clusters, number_clusters = [N1,N2,...Nn] ]\", where Ni is the number \
of clusters of size i in the file, and the list runs from to clusters of \
size n.", file),

      CluEError::ClusterHasNoSignal(cluster) => write!(f,
          "expected cluster {} to have a signal, but found none", cluster),

      CluEError::ClusterLineFormatError(line) => write!(f,
          "cluster line \"{}\" is not formatted correctly", line),

      CluEError::CannotWriteFile(file) => write!(f,
          "cannot write to \"{}\"", file),

      CluEError::CIFCannotDeclareDataItem(line_number,item) => write!(f,
          "line {}, cannot declare data item \"{}\"", line_number,item),

      CluEError::CIFCannotFindSymmetryEquivalentSite(item) => write!(f,
          "cannot find symmetry equivalent site from \"{}\"", item),

      CluEError::CIFCannotParseFloat(item) => write!(f,
          "cannot parse \"{}\" as a float", item),

      CluEError::CIFCannotStartLoop(line_number) => write!(f,
          "line {}, cannot start loop_", line_number),

      CluEError::CIFDataItemAlreadyDeclared(line_number,item) => write!(f,
          "line {}, cannot declare data item again\"{}\"", line_number,item),

      CluEError::CIFNoDeclaredDataItem(line_number,item) => write!(f,
          "line {}, no declared data item for \"{}\"", line_number,item),

      CluEError::CIFInconsistantCoorDataSizes(n_atoms)=> write!(f,
          "x, y and z coordinates must have {} elements in cif file",
          n_atoms),

      CluEError::CIFNoField(field) => write!(f,
          "no \"{}\" in cif file",field),

      CluEError::CIFNoFractX => write!(f,
          "no \"_atom_site_fract_x\" in cif file"),

      CluEError::CIFNoFractY => write!(f,
          "no \"_atom_site_fract_y\" in cif file"),

      CluEError::CIFNoFractZ => write!(f,
          "no \"_atom_site_fract_z\" in cif file"),

      CluEError::CIFNoTypeSymbol => write!(f,
          "no \"_atom_site_type_symbol\" in cif file"),

      CluEError::ConfigModeNotRecognized(mode) => write!(f,
          "#[{}] is not recognized",mode),

      CluEError::DeprecatedKeywordReplaced(line_number, 
          deprecated, replaced) => write!(f,
          "line {}, \"{}\" is deprecated and is replaced by \"{}\"", 
          line_number,deprecated, replaced),

      CluEError::EmptyVector(line_number) => write!(f,
          "line {}, supplied vector is emptry", line_number),

      CluEError::DetectedSpinDoesNotHaveAnActiveIndex => write!(f,
          "the detected spin is always active and so does have an index \
fo nth active"),

      CluEError::ExpectedClusterSetWithNSizes(n_exp,n_act) => write!(f,
          "expected a cluster set with {} sizes, but got {} sizes",
          n_exp, n_act),

      CluEError::ExpectedEquality(line_number) => write!(f,
          "line {}, expected an equaliy",line_number),

      CluEError::ExpectedBoolRHS(line_number) => write!(f,
          "line {}, expected a bool on the right hand side",line_number),

      CluEError::ExpectedFloatRHS(line_number) => write!(f,
          "line {}, expected a float on the right hand side",line_number),

      CluEError::ExpectedIntRHS(line_number) => write!(f,
          "line {}, expected an integer on the right hand side",line_number),

      CluEError::ExpectedNonNegativeIntRHS(line_number) => write!(f,
          "line {}, expected a non-negative integer on the right hand side",
          line_number),

      CluEError::ExpectedNumber(line_number) => write!(f,
          "line {}, expected a number",line_number),

      CluEError::ExpectedVecOfNFloatsRHS(line_number,n) => write!(f,
          "line {}, expected a vector of {} floats on the right hand side",
          line_number,n),

      CluEError::FilterNeedsALabel => write!(f,
          "group requires a label to be set: #[group(label = LABEL)]"),

      CluEError::FilterNoMaxDistance(label) => write!(f,
          "\"#[group(label = {})]\", has no max distance.",
          label),

      CluEError::FilterNoMinDistance(label) => write!(f,
          "\"#[group(label = {})]\", has no min distance.",
          label),

      CluEError::FiltersOverlap(label0,label1) => write!(f,
          "groups \"{}\" and \"{}\" overlap: \
particles must not reside in more than one group",label0,label1),

      CluEError::IncorrectFormattingIsotopeAbundances(line_number) 
        => write!(f,"line {}, isotope distributions are expected as
\"isotope_distribution = {{X0: p0, X1: p1 }}\", where X0 and X1 are isotopes 
and p0,p1 > 0 are abundances",line_number),

      CluEError::IncorrectNumberOfAxes(n,n_ref)=> write!(f,
          "expected {} axes, but {} were provided",n_ref, n),

      CluEError::InorrectNumberOfCellOffsets(n,n_ref)=> write!(f,
          "expected {} cell offsets, but {} were provided",n_ref, n),

      CluEError::IndexOutOfBounds(line_number,idx, len) => write!(f,
          "line {}, cannot access element {} from array of length {}", 
          line_number, idx, len),

      CluEError::InvalidAxes => write!(f,
          "invalid axes"),

      CluEError::InvalidArgument(line_number,expected_arg) => write!(f,
          "line {}, argument should be a(n) {}",line_number, expected_arg),

      CluEError::InvalidClusterPartitionKey => write!(f,
          "invalid cluster partition key"),

      CluEError::InvalidConfigFile(filename) => write!(f,
          "cannot not read config file \"{}\"", filename),

      CluEError::InvalidGeometry(line_number,rhs) => write!(f,
          "line {}, argument \"{}\" is not a valid load_geometry",
          line_number, rhs),

      CluEError::InvalidPulseSequence(line_number) => write!(f,
          "line {}, invalid pulse sequence",line_number),

      CluEError::InvalidSecondaryFilter(line_number, arg) => write!(f,
          "line {}, invalid secondary filter \"{}\"",line_number, arg),

      CluEError::InvalidToken(line_number,err_token) => write!(f,
          "line {}, invalid token \"{}\"",line_number, err_token),

      CluEError::IsotopeAbundancesCannotBeNormalized(line_number) => write!(f,
          "line {}, isotope abundances cannot be normalized",line_number),

      CluEError::IsotopeAbundancesMustBeNonnegative(line_number) => write!(f,
          "line {}, isotope abundances must be non-negative",line_number),

      CluEError::LenghMismatchTimepointsIncrements(n_dts,dts) => write!(f,
          "there are {} timepoint specifications, but {} time increments",
          n_dts,dts),

      CluEError::MissingFilter(label) => write!(f,
          "no group with label \"{}\"",label),

      CluEError::MissingFilterArgument(line_number,fn_name) => write!(f,
          "line {}, missing group argument in \"{}()\"",line_number,fn_name),

      CluEError::MissingFilterLabel(line_number) => write!(f,
          "line {}, missing label in group",line_number),

      CluEError::MissingHeader(filename) => write!(f,
          "in \"{}\", every entry must have a header",filename),

      CluEError::MissingProperties(label) => write!(f,
          "no properties with label \"{}\"",label),

      CluEError::MissingPropertiesLabel(line_number) => write!(f,
          "line {}, missing label in properties",line_number),

      CluEError::ModeAttributeWrongBrackets => write!(f,
          "modes details should with square brackets"),

      CluEError::ModeAttributeWrongOption(mode)=> write!(f,
          "#[{}...] contains an invalid option",mode),

      CluEError::MultipleCosubstitutionGroups(index)=> write!(f,
          "particle {} is assigned to more than one cosubstitution group",
          index),

      CluEError::ModeAttributeWrongSharp => write!(f,
          "modes are specified with a single '#' at the start"),

      CluEError::NANTensorBathDipoleDipole(idx0,isotope0,idx1,isotope1) 
        => write!(f,
          "dipole-dipole tensor for particles {} {} and {} {} contains NANs",
          idx0,isotope0,idx1,isotope1),

      CluEError::NANTensorBathZeeman(idx,isotope) => write!(f,
          "zeeman tensor for particle {} {} contains NANs",idx,isotope),

      CluEError::NANTensorDetectedZeeman => write!(f,
          "Zeeman tensor for the detected particle contains NANs"),

      CluEError::NANTensorExchangeCoupling(idx0,isotope0,idx1,isotope1) 
        => write!(f,
          "exchange tensor for particles {} {} and {} {} contains NANs",
          idx0,isotope0,idx1,isotope1),

      CluEError::NANTensorHyperfine(idx,isotope) => write!(f,
          "hyperfine tensor for particle {} {} contains NANs",idx,isotope),

      CluEError::NANTensorQuadrupole(idx,isotope) => write!(f,
          "electric quadrupole tensor for particle {} {} contains NANs",
          idx,isotope),

      CluEError::NoArgument(line_number) => write!(f,
          "line {}, expected a function argument",line_number),

      CluEError::NoBathGMatrixSpecifier(label,isotope) => write!(f,
          "no g-matrix specifier found for {} {}",label,isotope),
      
      CluEError::NoCentralSpin => write!(f,
          "no detected spin defined"),
      
      CluEError::NoCentralSpinCoor => write!(f,
          "coordinates for the detected spin were not defined"),
      
      CluEError::NoCentralSpinIdentity => write!(f,
          "the detected spin's identity was not defined"),
      
      CluEError::NoCentralSpinTransition => write!(f,
          "the detected spin transition was not defined"),

      CluEError::NoClashDistancePBC => write!(f,
          "clash_distance_pbc is not defined"),

      CluEError::NoClusterBatchSize => write!(f,
          "batch size for clusters not specified"),

      CluEError::NoClusterMethod => write!(f,
          "no cluster method specified"),
      
      CluEError::NoClustersOfSize(size) => write!(f,
          "cannot find any clusters of size {}", size),
      
      CluEError::NoDensityMatrixMethod=> write!(f,
          "no density matrix method specified"),
      
      CluEError::NoDetectedSpinIdentity => write!(f,
          "detected_spin_identity is not set"),

      CluEError::NoDetectedSpinMultiplicity => write!(f,
          "detected_spin_identity is not set"),

      CluEError::NoDetectedSpinTransition => write!(f,
          "detected_transition is not set"),

      CluEError::NoExtracellIsotopicDistribution(label) => write!(f,
          "extracel_isotopic_distribution is not set for {}",label),

      CluEError::NoGMatrixSpecifier => write!(f,
          "no g-matrix specifier"),
      
      CluEError::NoGMatrixValues => write!(f,
          "g-matrix values are not set"),
      
      CluEError::NoInputFile => write!(f,
          "no input file"),
      
      CluEError::NoHyperfineSpecifier(label,isotope) => write!(f,
          "no hyperfine specifier found for {} {}",label,isotope),
      
      CluEError::NoLoadGeometry => write!(f,
          "geometry for loading in the system was not defined"),
      
      CluEError::NoMagneticField => write!(f,
          "please specify the applied magnetic field"),

      CluEError::NoModelIndex => write!(f,
          "PDB model not selected"),

      CluEError::NoMaxClusterSize => write!(f,
          "maximum cluster size not set"),

      CluEError::NoNeighborCutoffDistance => write!(f,
          "neighbor_cutoff_distance is not defined"),
      
      CluEError::NoNumberSystemInstances => write!(f,
          "number_system_instances is not set"),

      CluEError::NoOrientationGrid => write!(f,
          "orientation_grid is not defined"),
      
      CluEError::NoPulseSequence => write!(f,
          "no pulse sequence is defined"),
      
      CluEError::NoQuadrupoleSpecifier(label,isotope) => write!(f,
          "no quadrupole specifier found for {} {}",label,isotope),
      
      CluEError::NoRadius => write!(f,
          "system radius not set"),

      CluEError::NoRelationalOperators(line_number) => write!(f,
          "line {}, no relational operators (=, <, >, in, ...), are present", 
          line_number),

      CluEError::NoRemovePartialMethyls => write!(f,
          "remove_partial_methyls: bool is not set"),
      
      CluEError::NotA3DVector(dim) => write!(f,
          "vector is {}-dimensional, not 3-dimensional", 
          dim),

      CluEError::NotALebedevGrid(n_ori) => write!(f,
          "\"{}\" is not a valid Lebedev grid; please choose n_ori in \
{{6, 14, 26, 38, 50, 74, 86, 110, 146, 170, \
194,  230, 266, 302, 350, 434, 590, 770, 974, 1202, \
1454, 1730, 2030, 2354, 2702, 3074, 3470, 3890, 4334, 4802,5294, 5810}}",n_ori),

      CluEError::NotAnOperator(line_number, token) => write!(f,
          "line {}, cannot interpret \"{}\" as an operator", line_number,token),

      CluEError::NotAProperSubset(subcluster, cluster) => write!(f,
          "{} is not a proper subset of {}", subcluster, cluster),

      CluEError::NoTemperature => write!(f,
          "no temperature specified"),
      
      CluEError::NoTensorValues => write!(f,
          "no values specified for tensor"),
      
      CluEError::NoTimeAxis => write!(f,
          "the time-axis has not been built"),
      
      CluEError::NoTimeIncrements => write!(f,
          "no time increments defined"),
      
      CluEError::NoTimepoints => write!(f,
          "please specify how many timepoints there are for each increment"),
      
      CluEError::NoRHS(line_number) => write!(f,
          "line {}, cannot read right hand side",line_number),

      CluEError::NoSpinOpForClusterSize(cluster_size,max_size) => write!(f,
          "no spin operators for clusters of size {} are built,\
          only sizes upto {}",cluster_size,max_size),

      CluEError::NoSpinOpWithMultiplicity(spin_multiplicity) => write!(f,
          "no spin-{} operators are built", 
          (*spin_multiplicity as f64 - 1.0)/2.0),

      CluEError::NoStructureFile => write!(f,
          "no structure file defined"),

      CluEError::ParticlesClash(idx0,elmt0,idx1,elmt1,r,r_clash) => write!(f,
          "particle {} {} and particle {} {} are {} Å apart, closer than the
clash distance of {}",idx0,elmt0,idx1,elmt1,r,r_clash),

      CluEError::ParticleIsNotActive(ref_index) => write!(f,
          "particle \"{}\" is not active", ref_index),

      CluEError::OptionAlreadySet(line_number,err_token) => write!(f,
          "line {}, \"{}\" has already been set",line_number, err_token),

      CluEError::UnmatchedBlockComment(line_number) => write!(f,
          "line {}, unmatched \"*/\"", line_number),

      CluEError::UnmatchedDelimiter(line_number) => write!(f,
          "line {}, unmatched delimiter", line_number),

      CluEError::SaveNameEmpty => write!(f,
          "save name is empty"),

      CluEError::SaveNameNotSet => write!(f,
          "save name not set"),

      CluEError::SecondaryFilterRequiresAnIndex(group) => write!(f,
          "secondary particle group, \"{}\", requires a particle index",
          group),

      CluEError::SpinPropertiesNeedsALabel => write!(f,
          "spin_properties requires a label to be set: 
#[spin_properties(label = LABEL, isotope = ISOTOPE)]"),

      CluEError::SpinPropertiesNeedsAnIsotope(label) => write!(f,
          "spin_properties requires an isotope to be set: 
#[spin_properties(label = {}, isotope = ISOTOPE)]",label),

      CluEError::StructurePropertiesNeedsALabel => write!(f,
          "structure_properties requires a label to be set: 
#[structure_properties(label = LABEL)]"),

      CluEError::StructurePropertiesDoesNotNeedAnIsotope(label) => write!(f,
          "structure_properties does not require an isotope to be set: 
#[spin_properties(label = {})]",label),

      CluEError::TensorNotSet(index) => write!(f,
          "no tensor set for particle {}",index),

      CluEError::TooFewRHSArguments(line_number) => write!(f,
          "line {}, too few arguments on the right hand side", 
          line_number),

      CluEError::TooManyRelationalOperators(line_number) => write!(f,
          "line {}, too many relational operators (=, <, >, in, ...), are present", 
          line_number),

      CluEError::TooManyRHSArguments(line_number) => write!(f,
          "line {}, too many arguments on the right hand side", 
          line_number),

      CluEError::UnassignedCosubstitutionGroup(index)=> write!(f,
          "particle {} cannot be assigned to a cosubstitution group",
          index),

      CluEError::UnavailableSpinOp(op_pos,n_ops) => write!(f,
          "spin operator index, {}, exceeds vector length of {}",
          op_pos,n_ops),

      CluEError::UnequalLengths(vec0,len0,vec1,len1) => write!(f,
          "unequal lengths, {} has length {}, but {} has length {}",
          vec0,len0,vec1,len1),

      CluEError::UnrecognizedOption(option) => write!(f,
          "unrecognized option \"{}\"",option),

      CluEError::UnrecognizedVectorSpecifier(specifier) => write!(f,
          "unrecognized vector specifier \"{}\"",specifier),

      CluEError::VectorSpecifierDoesNotSpecifyUniqueVector(specifier) 
        => write!(f,
          "vector specifier does not specify unique vector \"{}\"",specifier),

      CluEError::WrongClusterSizeForAnalyticCCE(given_size) => write!(f,
          "analytic 2-CCE cannot work with clusters of size {}",given_size),

      CluEError::WrongNumberOfAxes(num_axes, expected_num) => write!(f,
          "{} axes were provided, but {} are expected",num_axes, expected_num),

      CluEError::WrongOrientationGridDim(line_number, expected, actual) 
        => write!(f,
          "line {}, cannot add a {}D, point to a {}D grid", 
          line_number, expected,actual),

      CluEError::WrongProbabilityDistributionDim(line_number, 
          expected, actual) => write!(f,
          "line {}, expected probability distribution with {} dimensions, \
but found {} dimensions", line_number, expected,actual),

      CluEError::WrongVectorLength(line_number, expected, actual) => write!(f,
          "line {}, expected vector of length {}, but recieved a length of {}", 
          line_number, expected,actual),
    }
  }
}