Skip to content

Commit

Permalink
updated QRotor examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogila committed Jan 30, 2025
1 parent 7d1050e commit fd80c97
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
30 changes: 17 additions & 13 deletions examples/example_qrotor_convergence.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import aton.qrotor as qr

system = qr.QSys()
system.potential_name = 'zero'
system.B = 1
system.E_levels = 10
system.gridsize = 200000

experiment = qr.solve.energies(system)
print('Eigenvalues:')
print(experiment.systems[0].eigenvalues)
# Testing convergence for a specific energy level
E_level = 5
gridsize = 200000

print('Rounded eigenvalues:')
precision = 4
for value in experiment.systems[0].eigenvalues:
print(round(value, precision))
# Definition of the quantum system for a zero potential
system = qr.System()
system.potential_name = 'zero'
system.B = 1 # Rotational inertia
system.E_levels = 10 # Number of energy levels to calculate
system.gridsize = gridsize
# Solve the system eigenvalues
system = qr.solve.energies(system)
print(f'Eigenvalues: {system.eigenvalues}')
# Compare the calculated and ideal energies
ideal_E = system.get_ideal_E(E_level)
real_E = system.eigenvalues[E_level]
deviation = abs(ideal_E - real_E)
print(f'Deviation from ideal energy for the eigenvalue #{E_level} with a grid of size {gridsize}: {deviation} meV')

21 changes: 11 additions & 10 deletions examples/example_qrotor_titov2023.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import aton.qrotor as qr

system = qr.QSys()
# Reproducing eigenvalues from:
# K. Titov et al., Phys. Rev. Mater. 7, 073402 (2023)
# https://link.aps.org/doi/10.1103/PhysRevMaterials.7.073402

system = qr.System()
system.potential_name = 'titov2023'
system.B = 0.573 # qr.B_CH3
system.E_levels = 10
system.B = 0.573 # Titov uses a custom B value, a more accurate one is qr.B_CH3
system.E_levels = 5
system.gridsize = 200000

experiment = qr.solve.energies(system)
experiment.comment = 'titov2023'
system = qr.solve.energies(system)
system.comment = 'Reproduced eigenvalues from titov2023 with ATON.QRotor'
print('Eigenvalues:')
print(experiment.systems[0].eigenvalues)

print('Rounded eigenvalues:')
precision = 4
for value in experiment.systems[0].eigenvalues:
for value in system.eigenvalues:
print(round(value, precision))

qr.plot.potential(experiment)
qr.plot.energies(system)

0 comments on commit fd80c97

Please sign in to comment.