Skip to content

Commit

Permalink
Add select from Example structures widget back (#215)
Browse files Browse the repository at this point in the history
Add the `StructureExamplesWidget` back to structure manager widget
with more examples. 

Add two example structures `Au.cif` which is not a primitive cell and `Co.cif` which has spin-polarization turned on.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
unkcpz and pre-commit-ci[bot] authored Apr 6, 2022
1 parent e8ec8d2 commit e756b97
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 2 deletions.
11 changes: 11 additions & 0 deletions aiidalab_qe/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
</strong></p>
</div>"""

# The Examples list of (name, file) tuple curretly passed to
# StructureExamplesWidget.
Examples = [
("Silicon (diamond)", "miscellaneous/structures/Si.xyz"),
("Silicon oxide", "miscellaneous/structures/SiO2.xyz"),
("Diamond", "miscellaneous/structures/diamond.cif"),
("Gallium arsenide", "miscellaneous/structures/GaAs.xyz"),
("Gold (fcc)", "miscellaneous/structures/Au.cif"),
("Cobalt (hcp)", "miscellaneous/structures/Co.cif"),
]


class StructureSelectionStep(ipw.VBox, WizardAppWidgetStep):
"""Integrated widget for the selection of structures from different sources."""
Expand Down
36 changes: 36 additions & 0 deletions miscellaneous/structures/Au.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#======================================================================

# CRYSTAL DATA

#----------------------------------------------------------------------

data_VESTA_phase_1


_pd_phase_name 'Au '
_cell_length_a 4.17410
_cell_length_b 4.17410
_cell_length_c 4.17410
_cell_angle_alpha 90
_cell_angle_beta 90
_cell_angle_gamma 90
_symmetry_space_group_name_H-M 'P 1'
_symmetry_Int_Tables_number 1

loop_
_symmetry_equiv_pos_as_xyz
'x, y, z'

loop_
_atom_site_label
_atom_site_occupancy
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_thermal_displace_type
_atom_site_B_iso_or_equiv
_atom_site_type_symbol
Au1 1.0 0 0 0 Biso 1.000 Au
Au2 1.0 0 0.50000 0.50000 Biso 1.000 Au
Au3 1.0 0.50000 0 0.50000 Biso 1.000 Au
Au4 1.0 0.50000 0.50000 0 Biso 1.000 Au
34 changes: 34 additions & 0 deletions miscellaneous/structures/Co.cif
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#======================================================================

# CRYSTAL DATA

#----------------------------------------------------------------------

data_VESTA_phase_1


_pd_phase_name 'Co '
_cell_length_a 2.49680
_cell_length_b 2.49680
_cell_length_c 4.03081
_cell_angle_alpha 90
_cell_angle_beta 90
_cell_angle_gamma 60.00000
_symmetry_space_group_name_H-M 'P 1'
_symmetry_Int_Tables_number 1

loop_
_symmetry_equiv_pos_as_xyz
'x, y, z'

loop_
_atom_site_label
_atom_site_occupancy
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_thermal_displace_type
_atom_site_B_iso_or_equiv
_atom_site_type_symbol
Co1 1.0 0 0 0 Biso 1.000 Co
Co2 1.0 0.33333 0.33333 0.50000 Biso 1.000 Co
5 changes: 3 additions & 2 deletions qe.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"\n",
"from aiida.orm import StructureData\n",
"from aiida.orm import load_node\n",
"from aiidalab_widgets_base import OptimadeQueryWidget\n",
"from aiidalab_widgets_base import OptimadeQueryWidget, StructureExamplesWidget\n",
"from aiidalab_widgets_base import StructureBrowserWidget, StructureManagerWidget, StructureUploadWidget\n",
"from aiidalab_widgets_base import WizardAppWidget, WizardAppWidgetStep\n",
"from aiidalab_widgets_base.bug_report import install_create_github_issue_exception_handler\n",
Expand All @@ -51,7 +51,7 @@
"from aiidalab_qe.steps import ConfigureQeAppWorkChainStep\n",
"from aiidalab_qe.steps import SubmitQeAppWorkChainStep\n",
"from aiidalab_qe.steps import ViewQeAppWorkChainStatusAndResultsStep\n",
"from aiidalab_qe.structures import StructureSelectionStep\n",
"from aiidalab_qe.structures import StructureSelectionStep, Examples\n",
"from aiidalab_qe.version import __version__\n",
"\n",
"\n",
Expand All @@ -64,6 +64,7 @@
" StructureUploadWidget(title=\"Upload file\"),\n",
" OptimadeQueryWidget(embedded=False),\n",
" StructureBrowserWidget(title=\"AiiDA database\"),\n",
" StructureExamplesWidget(title=\"From Examples\", examples=Examples),\n",
" ],\n",
" node_class='StructureData',\n",
" storable=False,\n",
Expand Down

0 comments on commit e756b97

Please sign in to comment.