Hydra Architecture and Migration Path
Tom Goddard
September 18, 2014
Main areas of effort put into Hydra (ordered most to least time spent).
- All new OpenGL 3.3 graphics, object oriented in Python.
- Molecule data structures and rendering all in Python (numpy structure array), testing performance limits.
- Ported Chimera tools: mostly volume data, movie recorder, space navigator, basic commands (open, close, show, hide, turn)
- Qt user interface, single window design.
- Unified session file and scene handling with only data in files (no function calls).
Hydra architecture differences from Chimera 1.
Source code.
- Session class
- What code in Python, what in C++
- New graphics module for opengl and rendering (formerly in _chimera,_molecule,_surface,_volumemodel,vrmlmodel...).
- Classes instead of globals dictionaries: e.g. Commands, File_Readers, Databases,...
- Two levels module hierarchy instead of one, e.g. map/filter, map/fit, map/series instead of VolumeFilter, FitMap, VolumeSeries.
Session class
- Holds all the global state:
- models, selected objects, scenes, camera, view (ie global rendering settings).
- triggers, file history, file reader/writer table, command table, keyboard shortcuts table, database fetching table,
ui main window instance
- movie recorder object, MAV alignment instances, ...
- Hydra started with "import hydra; hydra.Session().start()"
- In Chimera 1 the global state is in many module variables sometimes with access functions if global variable is private
- e.g. chimera.openModels, chimera.selection._currentSelection, chimera.view, chimera.tkgui.app, chimera.dialogs._allDialogs, chimera.fetch._fetchInfo, Midas.positions (savepos/reset), Midas.midas_text.cmdList (addCommand), ...
- Main advantage of session class is for new programmers to find global code access points.
- Minor advantange: can start multiple sessions in one Python for instance to compare to session files without
merging them.
session.py source.
What code in Python, what in C++
Put everything in Python unless C++ is needed for speed.
- All OpenGL graphics now in Python, in Chimera 1 it was all in C++.
- Chimera 1 _chimera stuff OpenModels, Camera, Viewer are all in Python in Hydra.
- Python loops over atoms in Chimera 1 are in C++ in Hydra.
All C++ in hydra is currently in two modules
molecule_cpp
and
map_cpp
with one additional C++ library
arrays
to handle passing numpy arrays between Python and C++.
Migration Path
Most pressing steps
- Replace Qt with Wx
- Unify C++ PDBio molecule data structures and Hydra molecule data structures.
Difficulty is that PDBio is I think about 5x slower in latest tests.
Important enhancements for an initial release
- Commit to Python as session file format (not json).
- Session files need more complete molecule state.
- Add molecule ribbon rendering (currently hydra shows tubes).
- Windows port.
- Tool Shed update capability.
- User documentation.
Does an initial release need programmer APIs?
I think no. APIs are essential to Chimera 2 success
but they will delay an initial release too long and should be added in a subsequent release.
We have important new user features like ambient occlusion, efficient large molecule handling,
robust molecular surfaces, Sam's multidomain assembler, ... which should not be delayed while APIs
are developed.