Coverage for /builds/kinetik161/ase/ase/visualize/__init__.py: 66.67%
12 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-10 11:04 +0000
1import ase.parallel as parallel
4def view(atoms, data=None, viewer='ase', repeat=None, block=False, **kwargs):
5 from ase.visualize.viewers import VIEWERS
7 if parallel.world.size > 1:
8 return
10 vwr = VIEWERS[viewer.lower()]
11 handle = vwr.view(atoms, data=data, repeat=repeat, **kwargs)
13 if block and hasattr(handle, 'wait'):
14 status = handle.wait()
15 if status != 0:
16 raise RuntimeError(f'Viewer "{vwr.name}" failed with status '
17 '{status}')
19 return handle