Skip to content

Setting up and running a first simulation#

After installing quatrex, you can run a simple simulation using one of the provided example setups. The examples are located in the examples directory of the quatrex repository.

As a first toy example, you can consider a QTBM calculation for a ~25 nm long chain of carbon atoms, which you can find under

./examples/cp2k/carbon-chain/qtbm

For other example simulations, please refer to the examples section of the user guide.

Inputs#

The electronic structure of this chain of atoms was computed using CP2K with the DZVP-MOLOPT basis set and the PBE exchange-correlation functional. The resulting device structure (structure.xyz), Hamiltonian (hamiltonian.h5), and overlap matrix (overlap.h5) are stored in the ./examples/cp2k/carbon-chain/inputs directory.

Input electronic structure data

The input files for quatrex can be constructed from different electronic structure codes, such as CP2K, VASP, Siesta, and GPAW. Some preliminary procedures for constructing these input files are described in the input data section.

Besides electronic structure data, quatrex requires a configuration file in TOML format that specifies the simulation parameters. The configuration file for this example looks as follows:

./examples/cp2k/carbon-chain/qtbm/quatrex_config.toml
simulation_dir = "."
input_dir = "../inputs"

formalism = "wf" # Compute transport using the wavefunction formalism.

[qtbm]
max_batch_size = 1 # Process one energy at a time.

[device]
# Transport is along the x-axis.
transport_direction = 'x'
# Number of orbitals per atom type. DZVP-MOLOPT basis set has 13
# orbitals for carbon atoms.
num_orbitals_per_atom = { "C" = 13 }

    [[device.contacts]]
    name = "left"
    origin = [0.65, 0, 0]
    lattice_vectors = [[2.57031, 0, 0], [0, 10, 0], [0, 0, 10]]
    # Electrons enter the device along the first lattice vector.
    direction = "a"
    fermi_level = -3

    [[device.contacts]]
    name = "right"
    origin = [256.4, -0.001, -0.001]
    lattice_vectors = [[-2.57031, 0, 0], [0, 10, 0], [0, 0, 10]]
    # Electrons enter the device along the first lattice vector.
    direction = "a"
    fermi_level = -3.001


[electron]
solver.direct_solver = "superlu"

# Compute the transport in an energy window [-5, -4] eV at a total of 10
# energy points. This is just a toy example. Typically, energy
# resolutions of 5 meV or better are required for accurate transport
# calculations.
energy_window_min = -5
energy_window_max = -4
energy_window_num = 10

    [electron.obc]
    # Use the "spectral" method with the "full" NEVP solver to compute
    # the open boundary self-energies.
    algorithm = "spectral"
    nevp_solver = "full"
    min_decay = 1e-8
    max_decay = 10
    num_ref_iterations = 10

More information about each individual configuration parameter can be found in the simulation parameters section of the user guide.

Running the simulation#

You can run this example simulation using the following command:

quatrex run ./examples/cp2k/carbon-chain/qtbm/quatrex_config.toml

or even parallelize over energies using multiple MPI processes:

mpirun -n 4 quatrex run ./examples/cp2k/carbon-chain/qtbm/quatrex_config.toml

More information about the command line interface of quatrex can be found in the user guide.

Outputs#

After the simulation completes, the results are stored as numpy arrays in the ./examples/cp2k/carbon-chain/qtbm/outputs directory.

./examples/cp2k/carbon-chain/qtbm
├── quatrex_config.toml
├── quatrex_times.out  # Timing information for the simulation
└── outputs
    ├── current_lr.npy  # Current from left to right lead
    ├── current_rl.npy  # Current from right to left lead
    ├── dos_l.npy  # Orbital-resolved DOS from the left lead
    ├── dos_r.npy  # Orbital-resolved DOS from the right lead
    ├── transmission_lr.npy  # Transmission from left to right lead
    └── transmission_rl.npy  # Transmission from right to left lead

You can find more information about the output files in the simulation output section of the user guide.