Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix steepest descent interface #3763

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions src/python/espressomd/visualization_mayavi.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ from libcpp cimport bool
from libcpp.vector cimport vector
from .particle_data import ParticleHandle
from .particle_data cimport *
from .integrate import SteepestDescent
from .interactions import NonBondedInteractions
from .interactions cimport BONDED_IA_DIHEDRAL, BONDED_IA_TABULATED_DIHEDRAL
from .interactions cimport IA_parameters, get_ia_param, bonded_ia_params
Expand Down Expand Up @@ -282,6 +283,9 @@ cdef class mayaviLive:
a secondary thread.

"""
if isinstance(self.system.integrator.get_state(), SteepestDescent):
raise RuntimeError(
"Cannot run visualizer with Steepest Descent integrator")
assert isinstance(threading.current_thread(), threading._MainThread)
self.gui.start_event_loop()

Expand All @@ -291,6 +295,9 @@ cdef class mayaviLive:
def run(self, integ_steps=1):
"""Convenience method with a simple integration thread.
"""
if isinstance(self.system.integrator.get_state(), SteepestDescent):
raise RuntimeError(
"Cannot run visualizer with Steepest Descent integrator")

def main():
while True:
Expand Down
7 changes: 7 additions & 0 deletions src/python/espressomd/visualization_opengl.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import espressomd
from .particle_data import ParticleHandle
from .integrate import SteepestDescent


class openGLLive():
Expand Down Expand Up @@ -591,6 +592,9 @@ def run(self, integration_steps=1):
"""Convenience method with a simple integration thread.

"""
if isinstance(self.system.integrator.get_state(), SteepestDescent):
raise RuntimeError(
"Cannot run visualizer with Steepest Descent integrator")

def main():
while True:
Expand All @@ -616,6 +620,9 @@ def start(self):
"""The blocking start method.

"""
if isinstance(self.system.integrator.get_state(), SteepestDescent):
raise RuntimeError(
"Cannot run visualizer with Steepest Descent integrator")
self._init_opengl()
self._init_espresso_visualization()
self._init_controls()
Expand Down