56 real(real64) :: factor
57 character(len=20) :: abbrev
58 character(len=50) :: name
61 interface operator (*)
63 end interface operator (*)
65 interface operator (/)
67 end interface operator (/)
69 interface operator (**)
71 end interface operator (**)
89 real(real64)
elemental pure function dunits_to_atomic(this, val) result(res)
90 type(unit_t),
intent(in) :: this
91 real(real64),
intent(in) :: val
99 complex(real64) elemental pure function zunits_to_atomic(this, val) result(res)
100 type(unit_t),
intent(in) :: this
101 complex(real64),
intent(in) :: val
103 res = val*this%factor
109 real(real64)
elemental pure function dunits_from_atomic(this, val) result(res)
110 type(unit_t),
intent(in) :: this
111 real(real64),
intent(in) :: val
113 res = val/this%factor
119 complex(real64) elemental pure function zunits_from_atomic(this, val) result(res)
120 type(unit_t),
intent(in) :: this
121 complex(real64),
intent(in) :: val
123 res = val/this%factor
129 character(len=20) pure function units_abbrev(this) result(abbrev)
130 type(unit_t),
intent(in) :: this
137 type(unit_t)
pure function units_multiply(aa, bb) result(cc)
138 type(unit_t),
intent(in) :: aa
139 type(unit_t),
intent(in) :: bb
141 cc%factor = aa%factor*bb%factor
142 cc%abbrev = trim(aa%abbrev)//
'*'//trim(bb%abbrev)
148 type(unit_t)
pure function units_divide(aa, bb) result(cc)
152 cc%factor = aa%factor/bb%factor
153 cc%abbrev = trim(aa%abbrev)//
'/'//trim(bb%abbrev)
158 type(unit_t)
pure function units_pow(aa, nn) result(cc)
159 type(unit_t),
intent(in) :: aa
160 integer,
intent(in) :: nn
162 cc%factor = aa%factor**nn
170 cc%abbrev = trim(aa%abbrev)//
'^-3'
172 cc%abbrev = trim(aa%abbrev)//
'^-2'
174 cc%abbrev = trim(aa%abbrev)//
'^-1'
178 cc%abbrev = trim(aa%abbrev)
180 cc%abbrev = trim(aa%abbrev)//
'^2'
182 cc%abbrev = trim(aa%abbrev)//
'^3'
184 cc%abbrev = trim(aa%abbrev)//
'^4'
186 cc%abbrev = trim(aa%abbrev)//
'^5'
188 cc%abbrev = trim(aa%abbrev)//
'^n'
197 type(
unit_t),
intent(in) :: aa
199 cc%factor =
sqrt(aa%factor)
200 cc%abbrev =
'sqrt('//trim(aa%abbrev)//
')'
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
type(unit_t) pure function units_sqrt(aa)
real(real64) elemental pure function dunits_to_atomic(this, val)
complex(real64) elemental pure function zunits_to_atomic(this, val)
type(unit_t) pure function units_multiply(aa, bb)
type(unit_t) pure function units_divide(aa, bb)
character(len=20) pure function, public units_abbrev(this)
real(real64) elemental pure function dunits_from_atomic(this, val)
complex(real64) elemental pure function zunits_from_atomic(this, val)
type(unit_t) pure function units_pow(aa, nn)