Quickstart#
To use jTWA for your own research, the main.py file located in the root directory of the repository may serve as a good starting point.
It is to be executed in conjunction with a configuration file config.json that is located in the same directory.
The configuration file is meant to be used to easily change things like system or simulation parameters, without adapting the code.
To run the example file that is provided, simply execute
python main.py config.json
in the root directory with the previously installed virtual environment activated.
The contents of main.py are listed here for completeness:
import jax
import sys
import json
import matplotlib.pyplot as plt
jax.config.update("jax_enable_x64", True)
import jTWA
if __name__ == "__main__":
configuration_file = sys.argv[1]
with open(configuration_file) as f:
cfg = json.load(f)
spin_operators = jTWA.spin1.observables.get_spin_operators(cfg)
samples = jTWA.spin1.initState.getPolarState(cfg)
cfg = jTWA.spin1.hamiltonian.update_cfg(cfg)
hamiltonian = jTWA.spin1.hamiltonian.hamiltonian
obs = jTWA.integrate.obtain_evolution(samples, hamiltonian, spin_operators, cfg)
jTWA.util.write_data(obs, cfg)
obs = jTWA.util.read_data(cfg)
jTWA.visualization.create_visuals(obs, cfg)
plt.show()