-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some modifications to nglview functions
- Loading branch information
Showing
11 changed files
with
614 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from molsysmt._private.digestion import digest | ||
from molsysmt._private.variables import is_all | ||
|
||
# https://github.com/arose/ngl/blob/master/doc/usage/selection-language.md | ||
|
||
|
||
@digest(form='nglview.NGLWidget') | ||
def clear(view, skip_digestion=False): | ||
|
||
view.clear_representations() | ||
|
||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from molsysmt._private.digestion import digest | ||
from molsysmt._private.variables import is_all | ||
|
||
# https://github.com/arose/ngl/blob/master/doc/usage/selection-language.md | ||
|
||
@digest() | ||
def set_color(view, color, selection='all', syntax='MolSysMT'): | ||
|
||
from molsysmt.basic import select | ||
|
||
atoms_selection = select(view, element='atom', selection=selection, syntax=syntax, to_syntax='NGLView') | ||
view.update_representation(component=0, selection=atoms_selection, color=color) | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from molsysmt._private.digestion import digest | ||
from molsysmt._private.variables import is_all | ||
|
||
# https://github.com/arose/ngl/blob/master/doc/usage/selection-language.md | ||
|
||
|
||
@digest(form='nglview.NGLWidget') | ||
def show_as_cartoon(view, selection='all', color='blue', skip_digestion=False): | ||
|
||
from molsysmt import select | ||
|
||
nglview_selection=None | ||
|
||
if isinstance(selection, str): | ||
if selection=='molecule_type=="water"' or selection=='group_type=="water"': | ||
nglview_selection='water' | ||
if selection=='molecule_type=="ion"' or selection=='group_type=="ion"': | ||
nglview_selection='ion' | ||
|
||
if nglview_selection is None: | ||
nglview_selection = select(view, element='atom', selection=selection, to_syntax='NGLView', | ||
skip_digestion=True) | ||
|
||
view.add_cartoon(selection=nglview_selection, color=color) | ||
|
||
pass | ||
|
Oops, something went wrong.