Still juggling simulations between two machines and a prayer? Scale up in minutes with Inductiva.
This tutorial will show you how to run Quantum ESPRESSO simulations using the Inductiva API.
To help you get started with simulations, we will explore a use case from this Atomsk tutorial, which guides us in creating a unit cell for fcc aluminium.
Copy and create your Al.pw file, placing it in a designated folder. Then, make the following adjustments:
pseudo directory path: pseudo_dir = '/home/user/espresso/pseudo/'.Al 26.982 Al.fixme.upf to Al 26.982 Al.pbe-nl-rrkjus_psl.1.0.0.UPF.You're ready to send your simulation to the Cloud!
Here is the code required to run a Quantum ESPRESSO simulation using the Inductiva API:
"""Quantum ESPRESSO example."""
import inductiva
from inductiva.commands import MPIConfig, Command
# Allocate cloud machine on Google Cloud Platform
cloud_machine = inductiva.resources.MachineGroup( \
provider="GCP",
machine_type="c2d-highcpu-4",
spot=True)
# List of commands to run
commands = [
"pw.x -i Al.pw"
]
# Initialize the Simulator
qe = inductiva.simulators.QuantumEspresso(\
version="7.4.1")
# Run simulation
task = qe.run( \
input_dir="/Path/to/SimulationFiles",
commands=commands,
on=cloud_machine)
# Wait for the simulation to finish and download the results
task.wait()
cloud_machine.terminate()
task.download_outputs()
task.print_summary()
In this basic example, we're using a cloud machine (c2d-highcpu-4) equipped with 4 virtual CPUs.
For larger or more compute-intensive simulations, consider adjusting the machine_type parameter to select
a machine with more virtual CPUs and increased memory capacity. You can explore the full range of available machines here.
Note: Setting
spot=Trueenables the use of spot machines, which are available at substantial discounts. However, your simulation may be interrupted if the cloud provider reclaims the machine.
To adapt this script for other Quantum ESPRESSO simulations, replace input_dir with the path to your Quantum
ESPRESSO input files. Be sure to specify the QUANTUM ESPRESSO version compatible with your input files.
When the simulation is complete, we terminate the machine, download the results and print a summary of the simulation as shown below.
Task status: Success
Timeline:
Waiting for Input at 21/04, 16:15:34 0.834 s
In Queue at 21/04, 16:15:34 30.538 s
Preparing to Compute at 21/04, 16:16:05 7.544 s
In Progress at 21/04, 16:16:13 3.174 s
└> 3.061 s /opt/openmpi/4.1.6/bin/mpirun --np 4 --use-hwthread-cpus pw.x -i Al.pw
Finalizing at 21/04, 16:16:16 0.413 s
Success at 21/04, 16:16:16
Data:
Size of zipped output: 603.96 KB
Size of unzipped output: 1.48 MB
Number of output files: 10
Total estimated cost (US$): 0.01011 US$
Estimated computation cost (US$): 0.00011 US$
Task orchestration fee (US$): 0.010 US$
Note: A per-run orchestration fee (0.010 US$) applies to tasks run from 01 Dec 2025, in addition to the computation costs.
Learn more about costs at: https://inductiva.ai/guides/basics/how-much-does-it-cost
As you can see in the "In Progress" line, the part of the timeline that represents the actual execution of the simulation, the core computation time of this simulation was approximately 3.2 seconds.