UNITS¶
Units conversion utilities module.
Available Energy units
["kcal/mol", "kj/mol", "hartree", "ev" "mev", "ryd]
Available Distance units
["ang", "nm", "bohr"]
Available Force units
Combinations between Energy and Distance units
Conversion
¶
Conversion from one unit system to another defined by a name and a callable
Source code in openqdc/utils/units.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
__init__(in_unit, out_unit, func)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
in_unit |
str
|
String defining the units of the current values |
required |
out_unit |
str
|
String defining the target units |
required |
func |
Callable[[float], float]
|
The callable to compute the conversion |
required |
Source code in openqdc/utils/units.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
DistanceTypeConversion
¶
Bases: ConversionEnum
, StrEnum
Define the possible distance units for conversion
Source code in openqdc/utils/units.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
to(distance, fraction=False)
¶
Get the conversion function to convert the distance to the desired units.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
distance |
DistanceTypeConversion
|
distance unit to convert to |
required |
fraction |
bool
|
whether it is distance^1 or distance^-1 |
False
|
Returns:
Type | Description |
---|---|
Callable[[float], float]
|
callable to convert the distance to the desired units |
Source code in openqdc/utils/units.py
69 70 71 72 73 74 75 76 77 78 79 80 |
|
EnergyTypeConversion
¶
Bases: ConversionEnum
, StrEnum
Define the possible energy units for conversion
Source code in openqdc/utils/units.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
to(energy)
¶
Get the conversion function to convert the energy to the desired units.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
energy |
EnergyTypeConversion
|
energy unit to convert to |
required |
Returns:
Type | Description |
---|---|
Callable[[float], float]
|
Callable to convert the distance to the desired units |
Source code in openqdc/utils/units.py
46 47 48 49 50 51 52 53 54 55 56 |
|
ForceTypeConversion
¶
Bases: ConversionEnum
Define the possible foce units for conversion
Source code in openqdc/utils/units.py
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 |
|
to(energy, distance)
¶
Get the conversion function to convert the force to the desired units.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
energy |
EnergyTypeConversion
|
energy unit to convert to |
required |
distance |
DistanceTypeConversion
|
distance unit to convert to |
required |
Returns:
Type | Description |
---|---|
Callable[[float], float]
|
callable to convert the distance to the desired units |
Source code in openqdc/utils/units.py
116 117 118 119 120 121 122 123 124 125 126 127 |
|
get_conversion(in_unit, out_unit)
¶
Utility function to get the conversion function between two units.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
in_unit |
The input unit |
required | |
out_unit |
The output unit |
required |
Returns:
Type | Description |
---|---|
Callable[[float], float]
|
The conversion function |
Source code in openqdc/utils/units.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|