Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions docs/src/DB.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,26 @@ intended for package development.

## Usage

Retrieve a benchmark using its key:

```julia-repl
julia> entry = TwoBody.db(:hydrogen)
```@example db-usage
using TwoBody
```

julia> entry.hamiltonian
Retrieve a benchmark using its key:

julia> entry.energy
```@repl db-usage
entry = TwoBody.db(:hydrogen)
entry.hamiltonian
entry.energy
```

Add a benchmark using `TwoBody.put!`:

```julia-repl
julia> hamiltonian = Hamiltonian(
Kinetic(ℏ = 1.0, m = 1.0),
Coulomb(coefficient = -1.0),
)

julia> TwoBody.put!(:example, hamiltonian, -0.5)
```@repl db-usage
hamiltonian = Hamiltonian(
Kinetic(ℏ = 1.0, m = 1.0),
Coulomb(coefficient = -1.0),
)
TwoBody.put!(:example, hamiltonian, -0.5)
```

Duplicate keys are rejected, and Hamiltonians are copied on registration and
Expand Down
Loading