Skip to content

Commit

Permalink
Hotfixes (espressomd#3846)
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored and jngrad committed Aug 18, 2020
1 parent 374ead4 commit 6d8642a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
8 changes: 4 additions & 4 deletions samples/billiard.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ def mix_sig(sig1, sig2, rule='LB'):
p.pos = ball_start_pos
p.v = [0, 0, 0]
elif p.id == 5:
for p in system.part:
p.pos = spawnpos[p.id]
p.v = [0, 0, 0]
p.fix = [0, 1, 0]
for p2 in system.part:
p2.pos = spawnpos[p2.id]
p2.v = [0, 0, 0]
p2.fix = [0, 1, 0]
ball.fix = [1, 1, 1]
ball.ext_force = impulse * \
np.array([math.sin(angle), 0, math.cos(angle)])
Expand Down
29 changes: 12 additions & 17 deletions src/python/object_in_fluid/oif_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ class Edge:
def __init__(self, A, B):
if not (isinstance(A, PartPoint) or (isinstance(A, FixedPoint))) and (
isinstance(B, PartPoint) or (isinstance(B, FixedPoint))):
TypeError("Arguments to Edge must be FixedPoint or PartPoint.")
raise TypeError(
"Arguments to Edge must be FixedPoint or PartPoint.")
self.A = A
self.B = B

Expand All @@ -125,7 +126,8 @@ class Triangle:
def __init__(self, A, B, C):
if not (isinstance(A, PartPoint) or (isinstance(A, FixedPoint))) and (isinstance(B, PartPoint) or (
isinstance(B, FixedPoint))) and (isinstance(C, PartPoint) or (isinstance(C, FixedPoint))):
TypeError("Arguments to Triangle must be FixedPoint or PartPoint.")
raise TypeError(
"Arguments to Triangle must be FixedPoint or PartPoint.")
self.A = A
self.B = B
self.C = C
Expand All @@ -148,7 +150,8 @@ def __init__(self, A, B, C, D):
and (isinstance(B, PartPoint) or (isinstance(B, FixedPoint))) \
and (isinstance(C, PartPoint) or (isinstance(C, FixedPoint))) \
and (isinstance(D, PartPoint) or (isinstance(D, FixedPoint))):
TypeError("Arguments to Angle must be FixedPoint or PartPoint.")
raise TypeError(
"Arguments to Angle must be FixedPoint or PartPoint.")
self.A = A
self.B = B
self.C = C
Expand All @@ -171,7 +174,7 @@ def __init__(self, A, B, C):
if not (isinstance(A, PartPoint) or (isinstance(A, FixedPoint))) \
and (isinstance(B, PartPoint) or (isinstance(B, FixedPoint))) \
and (isinstance(C, PartPoint) or (isinstance(C, FixedPoint))):
TypeError(
raise TypeError(
"Arguments to ThreeNeighbors must be FixedPoint or PartPoint.")
self.A = A
self.B = B
Expand Down Expand Up @@ -1163,9 +1166,7 @@ def elastic_forces(
if (el_forces[0] == 1) or (el_forces[5] == 1) or (
f_metric[0] == 1) or (f_metric[5] == 1):
# initialize list
stretching_forces_list = []
for p in self.mesh.points:
stretching_forces_list.append([0.0, 0.0, 0.0])
stretching_forces_list = np.zeros((self.mesh.points, 3))
# calculation uses edges, but results are stored for nodes
for e in self.mesh.edges:
a_current_pos = e.A.get_pos()
Expand All @@ -1189,9 +1190,7 @@ def elastic_forces(
if (el_forces[1] == 1) or (el_forces[5] == 1) or (
f_metric[1] == 1) or (f_metric[5] == 1):
# initialize list
bending_forces_list = []
for p in self.mesh.points:
bending_forces_list.append([0.0, 0.0, 0.0])
bending_forces_list = np.zeros((self.mesh.points, 3))
# calculation uses bending incidences, but results are stored for
# nodes
for angle in self.mesh.angles:
Expand Down Expand Up @@ -1229,9 +1228,7 @@ def elastic_forces(
if (el_forces[2] == 1) or (el_forces[5] == 1) or (
f_metric[2] == 1) or (f_metric[5] == 1):
# initialize list
local_area_forces_list = []
for p in self.mesh.points:
local_area_forces_list.append([0.0, 0.0, 0.0])
local_area_forces_list = np.zeros((self.mesh.points, 3))
# calculation uses triangles, but results are stored for nodes
for t in self.mesh.triangles:
a_current_pos = t.A.get_pos()
Expand Down Expand Up @@ -1266,7 +1263,7 @@ def elastic_forces(
f_metric[3] == 1) or (f_metric[5] == 1):
# initialize list
global_area_forces_list = []
for p in self.mesh.points:
for _ in self.mesh.points:
global_area_forces_list.append([0.0, 0.0, 0.0])
# calculation uses triangles, but results are stored for nodes
for t in self.mesh.triangles:
Expand Down Expand Up @@ -1297,9 +1294,7 @@ def elastic_forces(
if (el_forces[4] == 1) or (el_forces[5] == 1) or (
f_metric[4] == 1) or (f_metric[5] == 1):
# initialize list
volume_forces_list = []
for p in self.mesh.points:
volume_forces_list.append([0.0, 0.0, 0.0])
volume_forces_list = np.zeros((self.mesh.points, 3))
# calculation uses triangles, but results are stored for nodes
for t in self.mesh.triangles:
a_current_pos = t.A.get_pos()
Expand Down

0 comments on commit 6d8642a

Please sign in to comment.