Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
764abc5
begin drafting of trapped-ion mode analysis class from Wes
EthanMcGarrigle-SNL Apr 21, 2026
241605a
add args to dimensionless parameter function in mode analysis
EthanMcGarrigle-SNL Apr 21, 2026
f233d43
+ helper function to unpack flat-1D-arr of ion coordinates
EthanMcGarrigle-SNL Apr 21, 2026
f8b6153
rename eval, evec -> eigvals, eigvecs
EthanMcGarrigle-SNL Apr 21, 2026
b259fc4
consolidate ion equilibrium position solving functions
EthanMcGarrigle-SNL Apr 21, 2026
1e8d438
mv eigvec helper fxns into class, expose matrix function args
EthanMcGarrigle-SNL Apr 22, 2026
c7305ee
mv num_to_arr conversion into class, consolidate 2nd test
EthanMcGarrigle-SNL Apr 22, 2026
da1b896
mv Lamb-Dicke parameter calcs into class
EthanMcGarrigle-SNL Apr 22, 2026
b414cbd
consolidate check for dupe eigvals, consolidate LD ref
EthanMcGarrigle-SNL Apr 22, 2026
c24465d
add draft of test from mode analysis, add mode analysis to init
EthanMcGarrigle-SNL Apr 22, 2026
0a96a39
add tests for Lamb-Dicke parameters via mode analysis
EthanMcGarrigle-SNL Apr 22, 2026
b26c2fe
fix type hinting bugs with custom Vector object
EthanMcGarrigle-SNL Apr 22, 2026
93abb73
add custom type Vector,Matrix import to class
EthanMcGarrigle-SNL Apr 22, 2026
bd82946
fix tuple type-hinting
EthanMcGarrigle-SNL Apr 22, 2026
287a7ac
rm code -> moved to tests
EthanMcGarrigle-SNL Apr 22, 2026
8731434
vectorize Coulomb force
EthanMcGarrigle-SNL Apr 22, 2026
55a2a74
add loops for force & potential calcs
EthanMcGarrigle-SNL Apr 22, 2026
dbe60cd
convert many fxn's to loops over dimensions
EthanMcGarrigle-SNL Apr 22, 2026
0cdfb57
.
EthanMcGarrigle-SNL Apr 22, 2026
52fa964
add documentation for Lamb-Dicke parameter matrix form
EthanMcGarrigle-SNL Apr 22, 2026
3b710df
+ draft class methods for from_species, from_spin_basis construction
EthanMcGarrigle-SNL Apr 22, 2026
c401693
fix basis import, add draft method for creating motional modes
EthanMcGarrigle-SNL Apr 22, 2026
370cdc5
save draft w notes from group
EthanMcGarrigle-SNL Apr 23, 2026
12d5631
draft mode analysis with linear chain class + tests
EthanMcGarrigle-SNL Jun 16, 2026
6e78fa6
refactor of mode analysis + linear chain class
EthanMcGarrigle-SNL Jun 17, 2026
89512c6
add default values for linear chain class constructor
EthanMcGarrigle-SNL Jun 17, 2026
17a0106
update normal mode analysis with refactor and tests
EthanMcGarrigle-SNL Jun 17, 2026
3ee867e
rm old code that's been incorporated into parent class
EthanMcGarrigle-SNL Jun 17, 2026
428f797
update branch with gitlab version, class finalization + example
EthanMcGarrigle-SNL Jul 1, 2026
87fc681
Merge branch 'main' into 56-Add-normal-mode-analysis-and-Lamb-Dicke-t…
EthanMcGarrigle-SNL Jul 23, 2026
e369e21
name change of class for readability, more intuitive naming
EthanMcGarrigle-SNL Jul 23, 2026
12592d2
minor clean up of extra comments in mode analysis class
EthanMcGarrigle-SNL Jul 23, 2026
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# MacOS
.DS_Store

# AI Agent Scripts
sandia-claudecode


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
721 changes: 721 additions & 0 deletions examples/example_spin_dependent_squeezing.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/ionsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ def patched_kron(a, b, *args, **kwargs):
from .zeeman_solver import ZeemanHyperfineSolver
from .composite_operator import CompositeOperator
from .dissipator import Dissipator, DissipatorSpontaneousEmission, Lindbladian
from .trapped_ion_mode_analysis import TrappedIonCrystal, LinearIonChain
18 changes: 12 additions & 6 deletions src/ionsim/degree_of_freedom.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@
class DegreeOfFreedom(ABC):
"""A degree of freedom in a basis of states."""
energy_levels: Sequence[EnergyLevel]
name: str | None = None # TODO: will we use these names?
#name: str | None = None # TODO: will we use these names?

@dataclass(frozen=True, eq=False)
class AtomicStructure(DegreeOfFreedom):
"""An atomic structure object, containing atomic internal energy levels corresponding to angular momentum eigenstates."""
energy_levels: list[AtomicInternalEnergyLevel]
# Store mass and atomic number
atomic_mass: float
atomic_charge: int
name: str | None = None # TODO: will we use these names?

@classmethod
def from_species(cls, species: str, term_symbols: list[str] | None = None, level_names: list[str] | None = None,
Expand All @@ -42,8 +46,9 @@ def from_species(cls, species: str, term_symbols: list[str] | None = None, level
config_data = cls.get_config_data(species)
nuclear_spin = config_data['nuclear_spin']
levels_data = config_data['levels']
mass = config_data['mass'] # Daltons
z = config_data['Z'] # Atomic number, number of protons
atomic_mass = config_data['mass'] # Daltons
atomic_charge = config_data['charge'] # Daltons
atomic_number = config_data['Z'] # Atomic number, number of protons
magnetic_moment = config_data['magnetic_moment'] # units of \mu_{N}
structure = 'fine' if nuclear_spin == 0 else 'hyperfine'

Expand Down Expand Up @@ -79,11 +84,11 @@ def from_species(cls, species: str, term_symbols: list[str] | None = None, level
gj = 2. * (gj1 - 1.) * (k*(k+1) + j1*(j1+1) - l2*(l2 + 1))/((2*j + 1)*(2*k + 1))
gj += (3*j*(j+1) - k*(k+1) + s2*(s2+1))/(2.*j*(j+1))
fine_data['gj'] = gj
Zeeman_solver = ZeemanHyperfineSolver(nuclear_spin, j, None, s2, fine_data['hyperfine_A']*2.*np.pi, mass, magnetic_moment, z, gj = gj)
Zeeman_solver = ZeemanHyperfineSolver(nuclear_spin, j, None, s2, fine_data['hyperfine_A']*2.*np.pi, atomic_mass, magnetic_moment, atomic_number, gj = gj)
else:
s = fine_data['s']
l = fine_data['l']
Zeeman_solver = ZeemanHyperfineSolver(nuclear_spin, j, l, s, fine_data['hyperfine_A']*2.*np.pi, mass, magnetic_moment, z)
Zeeman_solver = ZeemanHyperfineSolver(nuclear_spin, j, l, s, fine_data['hyperfine_A']*2.*np.pi, atomic_mass, magnetic_moment, atomic_number)
zeeman_energy_shifts, zeeman_eigenvecs = Zeeman_solver.solve_at_field(magnetic_field)
zeeman_energy_shifts *= np.pi*2. # convert to rad/s

Expand Down Expand Up @@ -111,7 +116,7 @@ def from_species(cls, species: str, term_symbols: list[str] | None = None, level
level = HyperfineLevel(**fine_data, i=nuclear_spin, f=f, mf=mf, external_energy_shift = zeeman_shift_energy)
if level_names is None or level.name in level_names:
levels.append(level)
return cls(levels, name)
return cls(levels, atomic_mass, atomic_charge, name)

@classmethod
def get_level_factory(cls, coupling_scheme: str):
Expand Down Expand Up @@ -194,6 +199,7 @@ def check_uniqueness_of_term_symbol(term_symbol: str, levels_data: list[dict]):
class MotionalMode(DegreeOfFreedom):
"""An normal mode of motion for a linear chain of ions."""
energy_levels: list[CollectiveMotionalEnergyLevel]
name: str | None = None # TODO: will we use these names?

@classmethod
def from_frequency(cls, frequency: float, fock_dimension: int, name: str | None = None):
Expand Down
Loading
Loading