---
name: "sc_Units"
section: "3"
platform: "linux"
package: "libsc-doc"
version: "2.3.1-22"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_Units"
---

# sc\_Units(3)

The Units class is used to perform unit converions.

## NAME

sc::Units - The **Units** class is used to perform unit converions.

## SYNOPSIS

`#include <units.h>`

Inherits **sc::SavableState**.

### Public Types

enum **Storage** { **Steal**, **Copy** }\

### Public Member Functions

**Units** (const char \*strrep)\
 Create using a string representation, like 'kcal/mol'.  **Units** (char \*strrep, Units::Storage=Units::Copy)\
 Create using a string representation, like 'kcal/mol'.  **Units** (**StateIn** &s)\
 Restore the state of a **Units** object from s.  double **to** (const **Ref**\< **Units** \> &u) const\
 The conversion factor from this to u.  double **from** (const **Ref**\< **Units** \> &u) const\
 The conversion factor from u to this.  double **to\_atomic\_units** () const\
 The conversion factor from this to atomic units.  double **from\_atomic\_units** () const\
 The conversion factor from atom units to this.  const char \* **string\_rep** () const\
 The string representation of the units.  void **save\_data\_state** (**StateOut** &s)\
 Save the state of the **Units** object to s.

### Protected Member Functions

void **parse\_unit** ()\

### Protected Attributes

char \* **strrep\_**\
 double **to\_atomic\_units\_**\

### Additional Inherited Members

## Detailed Description

The **Units** class is used to perform unit converions.

## Constructor & Destructor Documentation

### sc::Units::Units (char \* strrep, Units::Storage = `Units::Copy`)

Create using a string representation, like 'kcal/mol'. if Units::Steal is given is the second argment, the new **Units** object will delete the strrep argument when it is destroyed.

## Member Function Documentation

### void sc::Units::save\_data\_state (StateOut & s)` [virtual]`

Save the state of the **Units** object to s.

Reimplemented from **sc::SavableState**.

## Author

Generated automatically by Doxygen for MPQC from the source code.
