Skip to content

Commit

Permalink
merge: minor import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
1p22geo committed Jun 6, 2024
1 parent 468b4ad commit d67e0f7
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 12 deletions.
3 changes: 2 additions & 1 deletion engine/renderpreview.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import libschrodinger.graphs
import libschrodinger.figlocation
import libschrodinger.constants
import libschrodinger.interaction


def renderpreview(state, mobile=False):
Expand All @@ -26,7 +27,7 @@ def renderpreview(state, mobile=False):
for potential in potentials:
V_total += potential.V
for p2 in particles:
if p2._id != particle._id:
if p2.__id != particle.__id:
V_total += (
libschrodinger.interaction.Interactions.get_relative_potential(
config, particle, p2
Expand Down
4 changes: 2 additions & 2 deletions libschrodinger/gauss.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(
vx=0.0,
vy=0.0,
):
self._id = uuid.uuid4()
self.__id = uuid.uuid4()
self.config = config
self.vx = vx
self.vy = vy
Expand Down Expand Up @@ -110,7 +110,7 @@ def propagate(
return
# Interact with other particles
for p in particles:
if p._id == self._id:
if p._id == self.__id:
continue
pass
# interact with particle
5 changes: 5 additions & 0 deletions libschrodinger/particle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import uuid

import libschrodinger.config
import libschrodinger.figlocation
Expand Down Expand Up @@ -26,6 +27,10 @@ class Particle:
or to `matplotlib.pyplot`
"""
_id: uuid.UUID
"""
ID of the particle.
"""

def __init__(self, config):
self.config = config
Expand Down
4 changes: 2 additions & 2 deletions libschrodinger/potential.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class Potential:
"""
configuration for the domain
"""
x_center: float | None
x_center: float
"""
defaults to center of domain,
the centerpoint of the potential
"""
y_center: float | None
y_center: float
"""
defaults to center of domain,
the centerpoint of the potential
Expand Down
7 changes: 4 additions & 3 deletions libschrodinger/quark/baryon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import libschrodinger.quark.hadron
import libschrodinger.quark.color
import libschrodinger.quark.meson
import libschrodinger.quark.quark


class Baryon(libschrodinger.quark.hadron.Hadron):
Expand Down Expand Up @@ -95,7 +96,7 @@ def propagate(self, V, particles, frame):
),
)
particles.append(m)
self._meson = m._id # to access or delete this meson later on
self._meson = m.__id # to access or delete this meson later on
self.quarks[0].color_charge = libschrodinger.quark.color.rotate(
libschrodinger.quark.color.COLOR.GREEN, self.rotation
)
Expand Down Expand Up @@ -131,7 +132,7 @@ def propagate(self, V, particles, frame):
),
)
particles.append(m)
self._meson = m._id # to access or delete this meson later on
self._meson = m.__id # to access or delete this meson later on
self.quarks[1].color_charge = libschrodinger.quark.color.rotate(
libschrodinger.quark.color.COLOR.BLUE, self.rotation
)
Expand Down Expand Up @@ -167,7 +168,7 @@ def propagate(self, V, particles, frame):
),
)
particles.append(m)
self._meson = m._id # to access or delete this meson later on
self._meson = m.__id # to access or delete this meson later on
self.quarks[2].color_charge = libschrodinger.quark.color.rotate(
libschrodinger.quark.color.COLOR.GREEN, self.rotation
)
Expand Down
7 changes: 4 additions & 3 deletions libschrodinger/quark/hadron.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import libschrodinger.config
import libschrodinger.potential
import libschrodinger.quark.quark
import libschrodinger.figlocation


class Hadron(libschrodinger.particle.Particle):
Expand Down Expand Up @@ -36,7 +37,7 @@ class Hadron(libschrodinger.particle.Particle):
"""

def __init__(self, config, quarks: list[libschrodinger.quark.quark.Quark]):
self._id = uuid.uuid4()
self.__id = uuid.uuid4()
self.config = config
self.psi = np.zeros((config.Nx, config.Ny), dtype="complex128")
self.quarks = quarks
Expand Down Expand Up @@ -77,7 +78,7 @@ def draw(self, graph: "libschrodinger.graphs.GraphDisplay", V: np.ndarray, x, y,

def propagate(
self, V: np.ndarray, particles: list[libschrodinger.particle.Particle], frame: int
):
) -> list["libschrodinger.particle.Particle"] | None:
"""
propagate the wave function in a potential field
Expand All @@ -102,7 +103,7 @@ def propagate(
return
# Interact with other particles
for p in particles:
if p._id == self._id:
if p._id == self.__id:
continue
pass
# interact with particle
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "libschrodinger"
version = "1.3.0"
version = "1.3.1"
authors = [
{ name="1p22geo", email="[email protected]" },
{ name="KacperTZSTI", email="[email protected]" },
Expand Down

0 comments on commit d67e0f7

Please sign in to comment.