ssandrews / Smoldyn

Smoldyn is a particle-based biochemical simulator for modeling molecular diffusion, surface interactions, and chemical reactions
GNU General Public License v3.0
24 stars 13 forks source link

bound error on Win/OSX but not on linux #118

Closed dilawar closed 2 years ago

dilawar commented 2 years ago

Following snippets throws bound error in libsmoldyn but only on Win and OSX. It works fine on Linux.

import smoldyn

s = smoldyn.Simulation(
    low=[-1000, -1000, -10000], high=[1000, 1000, 10000], output_files=["cylinder.txt"]
)

d1 = s.addDisk(name="d1", center=[50, 25, 8500], radius=850, vector=[0, 0, -1])
test = s.addSurface("test", panels=[d1])

Here is error output

λ python test_rounding.py
Libsmoldyn 'bounds' error in smolAddPanel: drawing slices and stacks need to be positive
Traceback (most recent call last):
  File "C:\tools\msys64\home\dilaw\Work\GITHUB\Smoldyn\tests\test_rounding.py", line 8, in <module>
    test = s.addSurface("test", panels=[d1])
  File "C:\Python310\lib\site-packages\smoldyn\smoldyn.py", line 2088, in addSurface
    return Surface(simulation=super(), name=name, panels=panels)
  File "C:\Python310\lib\site-packages\smoldyn\smoldyn.py", line 955, in __init__
    self._addToSmoldyn()
  File "C:\Python310\lib\site-packages\smoldyn\smoldyn.py", line 975, in _addToSmoldyn
    assert k == _smoldyn.ErrorCode.ok, f"Failed to add panel {self.name}, {k}"
AssertionError: Failed to add panel test, ErrorCode.bounds

Reported by Philips Luthert over email.