Voiléa/Jupyter客户端,用于搜索OPTIMADE数据库。
optimade-client的Python项目详细描述
OPTIMADE客户端
查询并从OPTIMADE提供程序(COD、MaterialsCloud、NoMaD、Materials Project、ODBX、OQMD等)导入结构。在
当前支持的OPTIMADE API版本:1.0.0
,1.0.0-rc.2
,1.0.0-rc.1
,0.10.1
运行客户端
此基于Jupyter的应用程序旨在运行以下任一项:
- 在AiiDAlab以及在Quantum Mobile虚拟机中
- 作为MaterialsCloud tool
- 作为独立的MyBinder application;或
- 作为一个独立的本地应用程序(请参阅下面的更多信息)。在
对于AiiDAlab,使用Home App中的App Store来安装它。在
使用
艾伊达实验室
要在自己的AiiDAlab应用程序中使用OPTIMADE structure importer,请编写以下内容:
fromaiidalab_widget_baseimportOptimadeQueryWidgetfromaiidalab_widgets_base.viewersimportStructureDataViewerfromipywidgetsimportdlinkstructure_query=OptimadeQueryWidget()structure_viewer=StructureDataViewer()# Save to `_` in order to suppress output_=dlink((structure_query,'structure'),(structure_viewer,'structure'))display(structure_query)display(structure_viewer)
这将立即显示一个查询小部件,其中包含实现optimadeapi的当前结构数据库的下拉列表。在
然后,您可以根据元素、元素数量、化学式等进行筛选以找到一系列结构。 有关筛选器选项及其说明的完整列表,请参阅OPTIMADE API specification。在
为了更深入地研究特定结构的细节,您还可以导入并显示OptimadeResultsWidget
。
有关如何设置通用OPTIMADE导入程序的示例,请参阅笔记本^{
嵌入式
查询小部件也可以嵌入到另一个应用程序中。
为此,可以通过在启动小部件时传递embedded=True
,即structure_query = OptimadeQueryWidget(embedded=True)
来使用这个小部件的一个更“简约”的版本。在
其他一切都是一样的-所以你仍然需要将查询小部件链接到应用程序的其他部分。在
通用Jupyter笔记本
该软件包的小部件可以用于任何普通的Jupyter笔记本以及AiiDAlab。 示例:
^{pr2}$这将使用包自己的结构查看器和摘要小部件。在
注意,上面提到的OptimadeQueryWidget
是AiiDAlab中针对OptimadeQueryProviderWidget
和OptimadeQueryFilterWidget
小部件的特殊包装小部件。在
在本地运行应用程序
首先,您需要从PyPI安装包,或者通过检索GitHub上托管的git存储库来安装该包。在
PyPI
$ pip install optimade-client[server]
GitHub
$ git clone https://github.com/CasperWA/voila-optimade-client.git $ cd voila-optimade-client voila-optimade-client$ pip install .[server]
注意,为了同时安装server
包(和ase
包以获得更广泛的下载格式),安装server
extra是很重要的。在
现在要运行应用程序(笔记本)^{optimade-client
,然后转到打印的URL(通常是http://localhost:8866),或者传递--open-browser
选项,让程序自动打开默认浏览器。在
应用程序将在Voilé中运行,使用Voilá自己的基于tornado
的服务器。
在启动服务器之前,配置将自动复制到Jupyter的配置目录中。在
$ optimade-client ... [Voila] Voilà is running at: http://localhost:8866/ ...
要获得可传递给optimade-client
的所有选项的列表,请使用-h/--help
选项。在
贡献
如果您希望对应用程序有所贡献,可以使用-e
标志以“可编辑”模式安装它:pip install -e .[dev]
。
建议您使用上述GitHub路由。在
您还应该通过运行以下命令在克隆的git存储库中安装pre-commit
:
voila-optimade-client$ pre-commit install
要开始投稿,请分叉存储库并创建pr。在
配置(Voiláa)
为了在Binder上运行应用程序(Voiláa),可以使用配置文件^{
如果您希望使用相同的配置在本地启动Voiléa服务器,请将^{voila.json
,或者在使用CLI启动服务器时传递配置。在
Note:
jupyter_config.json
is automatically copied over asvoila.json
when running the application using theoptimade-client
command.
找到Jupyter配置目录:
$ jupyter --config-dir /path/to/jupyter/config/dir
使用CLI启动Voiláa服务器时传递配置的示例:
$ voila --enable_nbextensions=True --VoilaExecutePreprocessor.timeout=180"OPTIMADE-Client.ipynb" ... [Voila] Voilà is running at: http://localhost:8866/ ...
要查看配置的完整列表,可以调用voila
并传递--help-all
。在
许可证
麻省理工学院。许可条款可以在LICENSE文件中找到。在
联系人
casper.andersen@epfl.ch
aiidalab@materialscloud.org
- 项目
标签: