## PropertyKind


A registered kind of property.


Usage

``` python
PropertyKind()
```


## Attributes


`name: str`  
Unique property kind name (primary key of [PropertyKindRow](PropertyKindRow.md#autostorage.PropertyKindRow)).

`validation_fn: PropertyValidationProtocol`  
Function checking that a value has the expected shape.

`units: str`  
Native units, as a `pint` unit string; values are stored in these.

`dtype: type[np.floating]`  
NumPy dtype used to store values of this kind.


## Methods

| Name | Description |
|----|----|
| [from_native()](#from_native) | Convert a stored [value](PropertyValueRow.md#autostorage.PropertyValueRow.value) from native units to [units](PropertyKindRow.md#autostorage.PropertyKindRow.units). |
| [quantity()](#quantity) | Attach native units to a stored [value](PropertyValueRow.md#autostorage.PropertyValueRow.value). |
| [to_native()](#to_native) | Return [value](PropertyValueRow.md#autostorage.PropertyValueRow.value) as an array in native units and the storage dtype. |

------------------------------------------------------------------------


#### from_native()


Convert a stored [value](PropertyValueRow.md#autostorage.PropertyValueRow.value) from native units to [units](PropertyKindRow.md#autostorage.PropertyKindRow.units).


Usage

``` python
from_native(value, units)
```


Molar [units](PropertyKindRow.md#autostorage.PropertyKindRow.units) (e.g. kcal/mol for Hartree) are handled as in [to_native](PropertyKind.md#autostorage.PropertyKind.to_native).


##### Raises


`ValueError`  
If [units](PropertyKindRow.md#autostorage.PropertyKindRow.units) is incompatible with the native units.


##### Examples

``` python
>>> print(energy_property_kind.from_native(-1.0, "kcal/mol").round(2))
-627.51
```

------------------------------------------------------------------------


#### quantity()


Attach native units to a stored [value](PropertyValueRow.md#autostorage.PropertyValueRow.value).


Usage

``` python
quantity(value)
```


Plain pint conversions don't handle molar units; use [from_native](PropertyKind.md#autostorage.PropertyKind.from_native) for those.


##### Examples

``` python
>>> print(round(energy_property_kind.quantity(-1.0).m_as("eV"), 4))
-27.2114
```

------------------------------------------------------------------------


#### to_native()


Return [value](PropertyValueRow.md#autostorage.PropertyValueRow.value) as an array in native units and the storage dtype.


Usage

``` python
to_native(value)
```


A `pint.Quantity` is converted to [units](PropertyKindRow.md#autostorage.PropertyKindRow.units), including molar quantities (e.g. kcal/mol for Hartree), which are scaled by Avogadro's constant. Any other value is assumed to be in [units](PropertyKindRow.md#autostorage.PropertyKindRow.units) already.


##### Raises


`ValueError`  
If [value](PropertyValueRow.md#autostorage.PropertyValueRow.value) has incompatible units, or is not numeric.
