Exemplo n.º 1
0
def structure_jsmol(cif_str):
    from jsmol_bokeh_extension import JSMol
    import bokeh.models as bmd

    script_source = bmd.ColumnDataSource()

    info = dict(
        height="100%",
        width="100%",
        use="HTML5",
        #serverURL="https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
        #j2sPath="https://chemapps.stolaf.edu/jmol/jsmol/j2s",
        serverURL="detail/static/jsmol/php/jsmol.php",
        j2sPath="detail/static/jsmol/j2s",
        #serverURL="https://www.materialscloud.org/discover/scripts/external/jsmol/php/jsmol.php",
        #j2sPath="https://www.materialscloud.org/discover/scripts/external/jsmol/j2s",
        script="""
set antialiasDisplay ON;
load data "cifstring"

{}

end "cifstring"
""".format(cif_str))

    applet = JSMol(
        width=600,
        height=600,
        script_source=script_source,
        info=info,
        js_url="detail/static/jsmol/JSmol.min.js",
    )

    return applet
def structure_jsmol(script_source):
    from jsmol_bokeh_extension import JSMol
    import bokeh.models as bmd

    # script_source = bmd.ColumnDataSource()

    info = dict(
        height="100%",
        width="100%",
        use="HTML5",
        serverURL="https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
        j2sPath="https://chemapps.stolaf.edu/jmol/jsmol/j2s",
        #serverURL="https://www.materialscloud.org/discover/scripts/external/jsmol/php/jsmol.php",
        #j2sPath="https://www.materialscloud.org/discover/scripts/external/jsmol/j2s",
        #serverURL="detail/static/jsmol/php/jsmol.php",
        #j2sPath="detail/static/jsmol/j2s",
        script="""set antialiasDisplay ON;""",
        ## Note: Need PHP server for approach below to work
        #    script="""set antialiasDisplay ON;
        #load cif::{};
        #""".format(get_cif_url(entry.filename))
    )

    applet = JSMol(
        width=600,
        height=400,
        script_source=script_source,
        info=info,
        #js_url="detail/static/jsmol/JSmol.min.js",
    )

    return applet
Exemplo n.º 3
0
def structure_jsmol(cif_node):

    script_source = bmd.ColumnDataSource()
    cif_str = cif_node.get_content()

    info = dict(
        height="100%",
        width="100%",
        use="HTML5",
        #serverURL="https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
        #j2sPath="https://chemapps.stolaf.edu/jmol/jsmol/j2s",
        serverURL="detail_pyrenemofs/static/jsmol/php/jsmol.php",
        j2sPath="detail_pyrenemofs/static/jsmol/j2s",
        script="""
set antialiasDisplay ON;
load data "cifstring"

{}

end "cifstring"
""".format(cif_str))

    applet = JSMol(
        width=600,
        height=600,
        script_source=script_source,
        info=info,
        js_url="detail_pyrenemofs/static/jsmol/JSmol.min.js",
    )

    return applet
""".format(cif_str)
        ## Note: Need PHP server for approach below to work
        #    script="""set antialiasDisplay ON;
        # load cif::{};
        # """.format(get_cif_url(entry.filename))
    )

    btn_download_cif.callback = bmd.CustomJS(args=dict(
        string=cif_str, filename=entry.filename),
                                             code=download_js)
    script_source = bmd.ColumnDataSource()

    applet = JSMol(
        width=600,
        height=600,
        script_source=script_source,
        info=info,
        js_url="detail/static/jsmol/JSmol.min.js",
    )

    df_tailcorrection, df_no_tailcorrection = get_results_df()

    if cof_name in used_block:
        plot_info_ = plot_info_blocked_pockets
    elif cof_name in non_permeable:
        plot_info_ = plot_info_non_permeable
    else:
        plot_info_ = plot_info

    if cof_name in cofs:
        citation = citation_cof
Exemplo n.º 5
0
script_source = ColumnDataSource()

info = dict(
    height="100%",
    width="100%",
    serverURL="https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
    use="HTML5",
    j2sPath="https://chemapps.stolaf.edu/jmol/jsmol/j2s",
    script=
    "background black;load https://chemapps.stolaf.edu/jmol/jsmol-2013-09-18/data/caffeine.mol",
)

applet = JSMol(
    width=600,
    height=600,
    script_source=script_source,
    info=info,
)

button = Button(label='Execute')
inp_script = TextInput(value='background white;')


def run_script():
    # pylint: disable=unsupported-assignment-operation
    script_source.data['script'] = [inp_script.value]


button.on_click(run_script)

ly = layout([applet, widgetbox(button, inp_script)])