.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "flow_gallery/run_gs_vs_kpts.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_flow_gallery_run_gs_vs_kpts.py: Convergence study with different k-meshes ========================================== In this example, .. GENERATED FROM PYTHON SOURCE LINES 8-67 .. image-sg:: /flow_gallery/images/sphx_glr_run_gs_vs_kpts_001.png :alt: run gs vs kpts :srcset: /flow_gallery/images/sphx_glr_run_gs_vs_kpts_001.png :class: sphx-glr-single-img .. code-block:: Python import sys import os import abipy.abilab as abilab import abipy.flowtk as flowtk import abipy.data as abidata def build_flow(options): """ Build and return a flow for GS properties with different k-meshes """ # Set working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_") if not options.workdir: options.workdir = os.path.basename(sys.argv[0]).replace(".py", "").replace("run_", "flow_") structure = abilab.Structure.from_file(abidata.cif_file("gan2.cif")) pseudos = abidata.pseudos("Ga.oncvpsp", "N.oncvpsp") scf_input = abilab.AbinitInput(structure, pseudos) scf_input.set_vars( ecut=15, # Too low. nstep=50, # Increase default tolvrs=1e-8, ) flow = flowtk.Flow(workdir=options.workdir) from abipy.flowtk.gs_works import GsKmeshConvWork nksmall_list = [2, 4, 6, 8] flow.register_work(GsKmeshConvWork.from_scf_input(scf_input, nksmall_list)) return flow # This block generates the thumbnails in the AbiPy gallery. # You can safely REMOVE this part if you are using this script for production runs. if os.getenv("READTHEDOCS", False): __name__ = None import tempfile options = flowtk.build_flow_main_parser().parse_args(["-w", tempfile.mkdtemp()]) build_flow(options).graphviz_imshow() @flowtk.flow_main def main(options): """ This is our main function that will be invoked by the script. flow_main is a decorator implementing the command line interface. Command line args are stored in `options`. """ return build_flow(options) if __name__ == "__main__": sys.exit(main()) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.322 seconds) .. _sphx_glr_download_flow_gallery_run_gs_vs_kpts.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: run_gs_vs_kpts.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: run_gs_vs_kpts.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: run_gs_vs_kpts.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_