sponge.function.Units
- class sponge.function.Units(length_unit: str = None, energy_unit: str = None, **kwargs)[source]
Unit class to record and convert the length and energy units.
- Parameters
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> from sponge.function import Units >>> unit = Units(length_unit='nm', energy_unit='kj/mol') >>> unit.convert_energy_to('kcal/mol') 0.2390057361376673 >>> unit.convert_energy_from('kcal/mol') 4.184 >>> unit.convert_length_to('A') 10.0 >>> unit.convert_length_from('A') 0.1
- property acceleration_ref: float
reference value of acceleration.
- Returns
float, reference value of acceleration.
- property boltzmann: float
Boltzmann constant in current unit.
- Returns
float, Boltzmann constant in current unit.
- property boltzmann_def: float
Boltzmann constant in kJ/mol.
- Returns
float, Boltzmann constant in kJ/mol.
- convert_energy_from(unit)[source]
returns a scale factor that converts the energy from a specified unit.
- convert_energy_to(unit)[source]
returns a scale factor that converts the energy to a specified unit.
- convert_length_from(unit)[source]
returns a scale factor that converts the length from a specified unit.
- convert_length_to(unit)[source]
returns a scale factor that converts the length to a specified unit.
- property coulomb: float
Coulomb constant in current unit.
- Returns
float, Coulomb constant in current unit.
- get_boltzmann(energy_unit: str = None)[source]
get the Boltzmann constant for a specific unit
- Parameters
energy_unit (str) – Energy unit. Default:
None
.
- get_coulomb(length_unit: str = None, energy_unit: str = None)[source]
get the Coulomb constant for a specific unit
- property pressure_ref: float
reference value of pressure.
- Returns
float, reference value of pressure.