rgrow 0.22.0

A modular Tile Assembly Model simulator, inspired by Xgrow.
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
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
use num_traits::identities::Zero;
#[cfg(feature = "python")]
use pyo3::prelude::*;
use serde::{Deserialize, Serialize};
use std::{
    fmt::Display,
    iter::Sum,
    ops::{Add, AddAssign, Div, Mul, Neg, Sub, SubAssign},
};

const R_VAL: KcalPerMolKelvin = KcalPerMolKelvin(1.98720425864083e-3); // in kcal/mol/K

// ===================
// Temperature
// ===================
pub trait Temperature: Sized {
    fn to_kelvin_m(self) -> f64;

    fn to_kelvin(self) -> Kelvin {
        Kelvin(self.to_kelvin_m())
    }

    fn to_celsius(self) -> Celsius {
        Celsius(self.to_kelvin_m() - 273.15)
    }
}

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct Kelvin(pub f64);

impl Kelvin {
    pub fn new(value: f64) -> Self {
        Kelvin(value)
    }
}

impl Temperature for Kelvin {
    fn to_kelvin_m(self) -> f64 {
        self.0
    }
}

impl Add for Kelvin {
    type Output = Kelvin;
    fn add(self, other: Kelvin) -> Kelvin {
        Kelvin(self.0 + other.0)
    }
}

impl Sub for Kelvin {
    type Output = Kelvin;
    fn sub(self, other: Kelvin) -> Kelvin {
        Kelvin(self.0 - other.0)
    }
}

impl AddAssign for Kelvin {
    fn add_assign(&mut self, other: Kelvin) {
        self.0 += other.0;
    }
}

impl SubAssign for Kelvin {
    fn sub_assign(&mut self, other: Kelvin) {
        self.0 -= other.0;
    }
}

impl From<Celsius> for Kelvin {
    fn from(value: Celsius) -> Self {
        Kelvin(value.to_kelvin_m())
    }
}

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct Celsius(pub f64);

impl Celsius {
    pub fn new(value: f64) -> Self {
        Celsius(value)
    }
}

impl Temperature for Celsius {
    fn to_kelvin_m(self) -> f64 {
        self.0 + 273.15
    }

    fn to_celsius(self) -> Celsius {
        self
    }
}

impl From<Celsius> for f64 {
    fn from(value: Celsius) -> Self {
        value.0
    }
}

impl From<f64> for Celsius {
    fn from(value: f64) -> Self {
        Celsius(value)
    }
}

impl From<f64> for Kelvin {
    fn from(value: f64) -> Self {
        Kelvin(value)
    }
}

impl From<Kelvin> for f64 {
    fn from(value: Kelvin) -> Self {
        value.0
    }
}

impl Sub<Kelvin> for Celsius {
    type Output = Celsius;
    fn sub(self, other: Kelvin) -> Celsius {
        Celsius(self.0 - other.0)
    }
}

impl Sub<Celsius> for Kelvin {
    type Output = Kelvin;
    fn sub(self, other: Celsius) -> Kelvin {
        Kelvin(self.0 - other.to_kelvin_m())
    }
}

// ===================
// Energy
// ===================
pub trait Energy {
    fn times_beta(self, temperature: impl Temperature) -> f64;
}

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct KcalPerMol(pub(crate) f64);

impl KcalPerMol {
    pub fn new(value: f64) -> Self {
        KcalPerMol(value)
    }
}

impl Energy for KcalPerMol {
    fn times_beta(self, temperature: impl Temperature) -> f64 {
        self / (R_VAL * temperature)
    }
}

impl Div<KcalPerMol> for KcalPerMol {
    type Output = f64;
    fn div(self, other: KcalPerMol) -> f64 {
        self.0 / other.0
    }
}

impl Default for KcalPerMol {
    fn default() -> Self {
        KcalPerMol(0.0)
    }
}

impl Add for KcalPerMol {
    type Output = KcalPerMol;
    fn add(self, other: KcalPerMol) -> KcalPerMol {
        KcalPerMol(self.0 + other.0)
    }
}

impl AddAssign for KcalPerMol {
    fn add_assign(&mut self, other: KcalPerMol) {
        self.0 += other.0;
    }
}

impl Sub for KcalPerMol {
    type Output = KcalPerMol;
    fn sub(self, other: KcalPerMol) -> KcalPerMol {
        KcalPerMol(self.0 - other.0)
    }
}

impl From<f64> for KcalPerMol {
    fn from(value: f64) -> Self {
        KcalPerMol(value)
    }
}

impl Zero for KcalPerMol {
    fn zero() -> Self {
        KcalPerMol(0.0)
    }
    fn is_zero(&self) -> bool {
        self.0 == 0.0
    }
}

impl Mul<f64> for KcalPerMol {
    type Output = KcalPerMol;
    fn mul(self, other: f64) -> KcalPerMol {
        KcalPerMol(self.0 * other)
    }
}

impl Mul<i32> for KcalPerMol {
    type Output = KcalPerMol;
    fn mul(self, other: i32) -> KcalPerMol {
        KcalPerMol(self.0 * other as f64)
    }
}

impl From<KcalPerMol> for f64 {
    fn from(value: KcalPerMol) -> Self {
        value.0
    }
}

impl approx::AbsDiffEq for KcalPerMol {
    type Epsilon = f64;
    fn default_epsilon() -> f64 {
        f64::default_epsilon()
    }
    fn abs_diff_eq(&self, other: &Self, epsilon: f64) -> bool {
        f64::abs_diff_eq(&self.0, &other.0, epsilon)
    }
}

impl approx::RelativeEq for KcalPerMol {
    fn default_max_relative() -> f64 {
        f64::default_max_relative()
    }
    fn relative_eq(&self, other: &Self, epsilon: f64, max_relative: f64) -> bool {
        f64::relative_eq(&self.0, &other.0, epsilon, max_relative)
    }
}

impl approx::UlpsEq for KcalPerMol {
    fn default_max_ulps() -> u32 {
        f64::default_max_ulps()
    }
    fn ulps_eq(&self, other: &Self, epsilon: f64, max_ulps: u32) -> bool {
        f64::ulps_eq(&self.0, &other.0, epsilon, max_ulps)
    }
}

// ===================
// Entropy
// ===================
pub trait Entropy {
    fn to_kcal_mol_k(self) -> KcalPerMolKelvin;
}

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct KcalPerMolKelvin(pub(crate) f64);

impl KcalPerMolKelvin {
    pub fn new(value: f64) -> Self {
        KcalPerMolKelvin(value)
    }
}

impl Entropy for KcalPerMolKelvin {
    fn to_kcal_mol_k(self) -> KcalPerMolKelvin {
        self
    }
}

impl Default for KcalPerMolKelvin {
    fn default() -> Self {
        KcalPerMolKelvin(0.0)
    }
}

impl From<f64> for KcalPerMolKelvin {
    fn from(value: f64) -> Self {
        KcalPerMolKelvin(value)
    }
}

impl<T: Temperature> Mul<T> for KcalPerMolKelvin {
    type Output = KcalPerMol;
    fn mul(self, other: T) -> KcalPerMol {
        KcalPerMol(self.0 * other.to_kelvin_m())
    }
}

impl Mul<KcalPerMolKelvin> for Kelvin {
    type Output = KcalPerMol;
    fn mul(self, other: KcalPerMolKelvin) -> KcalPerMol {
        KcalPerMol(self.0 * other.0)
    }
}

impl Mul<KcalPerMolKelvin> for Celsius {
    type Output = KcalPerMol;
    fn mul(self, other: KcalPerMolKelvin) -> KcalPerMol {
        KcalPerMol(self.to_kelvin_m() * other.0)
    }
}

impl From<KcalPerMolKelvin> for f64 {
    fn from(value: KcalPerMolKelvin) -> Self {
        value.0
    }
}

impl Add<KcalPerMolKelvin> for KcalPerMolKelvin {
    type Output = KcalPerMolKelvin;
    fn add(self, other: KcalPerMolKelvin) -> KcalPerMolKelvin {
        KcalPerMolKelvin(self.0 + other.0)
    }
}

impl AddAssign<KcalPerMolKelvin> for KcalPerMolKelvin {
    fn add_assign(&mut self, other: KcalPerMolKelvin) {
        self.0 += other.0;
    }
}

impl Sub<KcalPerMolKelvin> for KcalPerMolKelvin {
    type Output = KcalPerMolKelvin;
    fn sub(self, other: KcalPerMolKelvin) -> KcalPerMolKelvin {
        KcalPerMolKelvin(self.0 - other.0)
    }
}

impl approx::AbsDiffEq for KcalPerMolKelvin {
    type Epsilon = f64;
    fn default_epsilon() -> f64 {
        f64::default_epsilon()
    }
    fn abs_diff_eq(&self, other: &Self, epsilon: f64) -> bool {
        f64::abs_diff_eq(&self.0, &other.0, epsilon)
    }
}

impl approx::RelativeEq for KcalPerMolKelvin {
    fn default_max_relative() -> f64 {
        f64::default_max_relative()
    }
    fn relative_eq(&self, other: &Self, epsilon: f64, max_relative: f64) -> bool {
        f64::relative_eq(&self.0, &other.0, epsilon, max_relative)
    }
}

impl approx::UlpsEq for KcalPerMolKelvin {
    fn default_max_ulps() -> u32 {
        f64::default_max_ulps()
    }
    fn ulps_eq(&self, other: &Self, epsilon: f64, max_ulps: u32) -> bool {
        f64::ulps_eq(&self.0, &other.0, epsilon, max_ulps)
    }
}

impl num_traits::Zero for KcalPerMolKelvin {
    fn zero() -> Self {
        KcalPerMolKelvin(0.0)
    }
    fn is_zero(&self) -> bool {
        self.0 == 0.0
    }
}

// ===================
// Concentration
// ===================
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct Molar(pub(crate) f64);

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct MolarSq(f64);

impl Molar {
    pub fn new(value: f64) -> Molar {
        Molar(value)
    }
    pub fn squared(self) -> MolarSq {
        MolarSq(self.0 * self.0)
    }
    pub fn u0_times(unitless: f64) -> Molar {
        Molar(unitless)
    }
    pub fn over_u0(self) -> f64 {
        self.0
    }
}

impl Zero for Molar {
    fn zero() -> Self {
        Molar(0.0)
    }
    fn is_zero(&self) -> bool {
        self.0 == 0.0
    }
}

impl Add for Molar {
    type Output = Molar;
    fn add(self, other: Molar) -> Molar {
        Molar(self.0 + other.0)
    }
}

impl Mul<f64> for Molar {
    type Output = Molar;
    fn mul(self, other: f64) -> Molar {
        Molar(self.0 * other)
    }
}

impl Mul<Molar> for f64 {
    type Output = Molar;
    fn mul(self, other: Molar) -> Molar {
        Molar(self * other.0)
    }
}

impl Div<Molar> for Molar {
    type Output = f64;
    fn div(self, other: Molar) -> f64 {
        self.0 / other.0
    }
}

impl Sub for Molar {
    type Output = Molar;
    fn sub(self, other: Molar) -> Molar {
        Molar(self.0 - other.0)
    }
}

impl Mul<Molar> for Molar {
    type Output = MolarSq;
    fn mul(self, other: Molar) -> MolarSq {
        MolarSq(self.0 * other.0)
    }
}

impl Sum for Molar {
    fn sum<I: Iterator<Item = Molar>>(iter: I) -> Molar {
        iter.fold(Molar::zero(), |acc, x| acc + x)
    }
}

impl From<Molar> for f64 {
    fn from(value: Molar) -> Self {
        value.0
    }
}

impl From<f64> for Molar {
    fn from(value: f64) -> Self {
        Molar(value)
    }
}

impl MolarSq {
    pub fn sqrt(self) -> Molar {
        Molar(self.0.sqrt())
    }
    pub fn over_u0(self) -> Molar {
        Molar(self.0)
    }
}

impl Add for MolarSq {
    type Output = MolarSq;
    fn add(self, other: MolarSq) -> MolarSq {
        MolarSq(self.0 + other.0)
    }
}

impl Zero for MolarSq {
    fn zero() -> Self {
        MolarSq(0.0)
    }
    fn is_zero(&self) -> bool {
        self.0 == 0.0
    }
}

impl From<f64> for MolarSq {
    fn from(value: f64) -> Self {
        MolarSq(value)
    }
}

// ===================
// Rate
// ===================
pub trait Rate: Clone + Copy + num_traits::Zero + std::fmt::Debug {
    fn to_per_second(self) -> PerSecond;
    fn from_per_second(r: PerSecond) -> Self;
}

impl Rate for f64 {
    fn to_per_second(self) -> PerSecond {
        PerSecond(self)
    }
    fn from_per_second(r: PerSecond) -> Self {
        r.0
    }
}

impl Rate for PerSecond {
    fn to_per_second(self) -> PerSecond {
        self
    }
    fn from_per_second(r: PerSecond) -> Self {
        r
    }
}

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct PerSecond(pub f64);

impl PerSecond {
    pub fn new(value: f64) -> PerSecond {
        PerSecond(value)
    }
}

impl Add for PerSecond {
    type Output = PerSecond;
    fn add(self, other: PerSecond) -> PerSecond {
        PerSecond(self.0 + other.0)
    }
}

impl AddAssign for PerSecond {
    fn add_assign(&mut self, other: PerSecond) {
        self.0 += other.0;
    }
}

impl SubAssign for PerSecond {
    fn sub_assign(&mut self, other: PerSecond) {
        self.0 -= other.0;
    }
}

impl Neg for PerSecond {
    type Output = PerSecond;
    fn neg(self) -> PerSecond {
        PerSecond(-self.0)
    }
}

impl Zero for PerSecond {
    fn zero() -> Self {
        PerSecond(0.0)
    }
    fn is_zero(&self) -> bool {
        self.0 == 0.0
    }
}

impl Mul<Molar> for PerSecond {
    type Output = PerMolarSecond;
    fn mul(self, other: Molar) -> PerMolarSecond {
        PerMolarSecond(self.0 * other.0)
    }
}

impl Mul<f64> for PerSecond {
    type Output = PerSecond;
    fn mul(self, other: f64) -> PerSecond {
        PerSecond(self.0 * other)
    }
}

impl Sub for PerSecond {
    type Output = PerSecond;
    fn sub(self, other: PerSecond) -> PerSecond {
        PerSecond(self.0 - other.0)
    }
}

impl From<f64> for PerSecond {
    fn from(value: f64) -> Self {
        PerSecond(value)
    }
}

impl From<PerSecond> for f64 {
    fn from(value: PerSecond) -> Self {
        value.0
    }
}

// RatePMS
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct PerMolarSecond(f64);

impl PerMolarSecond {
    pub fn new(value: f64) -> PerMolarSecond {
        PerMolarSecond(value)
    }
}

impl Zero for PerMolarSecond {
    fn zero() -> Self {
        PerMolarSecond(0.0)
    }
    fn is_zero(&self) -> bool {
        self.0 == 0.0
    }
}

impl Add for PerMolarSecond {
    type Output = PerMolarSecond;
    fn add(self, other: PerMolarSecond) -> PerMolarSecond {
        PerMolarSecond(self.0 + other.0)
    }
}

impl Mul<Molar> for PerMolarSecond {
    type Output = PerSecond;
    fn mul(self, other: Molar) -> PerSecond {
        PerSecond(self.0 * other.0)
    }
}

impl Mul<MolarSq> for PerMolarSecond {
    type Output = MolarPerSecond;
    fn mul(self, other: MolarSq) -> MolarPerSecond {
        MolarPerSecond(self.0 * other.0)
    }
}

impl From<f64> for PerMolarSecond {
    fn from(value: f64) -> Self {
        PerMolarSecond(value)
    }
}

impl From<PerMolarSecond> for f64 {
    fn from(value: PerMolarSecond) -> Self {
        value.0
    }
}

// RateMPS
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct MolarPerSecond(f64);

impl MolarPerSecond {
    pub fn new(value: f64) -> MolarPerSecond {
        MolarPerSecond(value)
    }
}

impl Zero for MolarPerSecond {
    fn zero() -> Self {
        MolarPerSecond(0.0)
    }
    fn is_zero(&self) -> bool {
        self.0 == 0.0
    }
}

impl Add for MolarPerSecond {
    type Output = MolarPerSecond;
    fn add(self, other: MolarPerSecond) -> MolarPerSecond {
        MolarPerSecond(self.0 + other.0)
    }
}

impl AddAssign for MolarPerSecond {
    fn add_assign(&mut self, other: MolarPerSecond) {
        self.0 += other.0;
    }
}

impl SubAssign for MolarPerSecond {
    fn sub_assign(&mut self, other: MolarPerSecond) {
        self.0 -= other.0;
    }
}

impl rand::distr::weighted::Weight for MolarPerSecond {
    const ZERO: Self = MolarPerSecond(0.0);
    fn checked_add_assign(&mut self, v: &Self) -> Result<(), ()> {
        self.0.checked_add_assign(&v.0)
    }
}

impl Mul<f64> for MolarPerSecond {
    type Output = MolarPerSecond;
    fn mul(self, other: f64) -> MolarPerSecond {
        MolarPerSecond(self.0 * other)
    }
}

impl Div<MolarPerSecond> for MolarPerSecond {
    type Output = f64;
    fn div(self, other: MolarPerSecond) -> f64 {
        self.0 / other.0
    }
}

impl From<MolarPerSecond> for f64 {
    fn from(value: MolarPerSecond) -> Self {
        value.0
    }
}

// ===================
// Time
// ===================
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[cfg_attr(feature = "python", derive(FromPyObject, IntoPyObject))]
pub struct Second(f64);

impl Second {
    pub fn new(value: f64) -> Second {
        Second(value)
    }
    pub fn min(self, other: Second) -> Second {
        Second(self.0.min(other.0))
    }
    pub fn max(self, other: Second) -> Second {
        Second(self.0.max(other.0))
    }
}

impl Add for Second {
    type Output = Second;
    fn add(self, other: Second) -> Second {
        Second(self.0 + other.0)
    }
}

impl AddAssign for Second {
    fn add_assign(&mut self, other: Second) {
        self.0 += other.0;
    }
}

impl Sub for Second {
    type Output = Second;
    fn sub(self, other: Second) -> Second {
        Second(self.0 - other.0)
    }
}

impl SubAssign for Second {
    fn sub_assign(&mut self, other: Second) {
        self.0 -= other.0;
    }
}

impl Div<PerSecond> for f64 {
    type Output = Second;
    fn div(self, other: PerSecond) -> Second {
        Second(self / other.0)
    }
}

impl Display for Second {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl From<Second> for f64 {
    fn from(value: Second) -> Self {
        value.0
    }
}

impl Display for PerSecond {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(&self.0, f)
    }
}

impl std::fmt::LowerExp for Second {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::LowerExp::fmt(&self.0, f)
    }
}

impl std::fmt::UpperExp for Second {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::UpperExp::fmt(&self.0, f)
    }
}

impl std::fmt::LowerExp for PerSecond {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::LowerExp::fmt(&self.0, f)
    }
}

impl std::fmt::UpperExp for PerSecond {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::UpperExp::fmt(&self.0, f)
    }
}