.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_generated/external_calculators/external_calculators_cp2k.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_examples_generated_external_calculators_external_calculators_cp2k.py: .. _ext_calc_cp2k: External calculators - CP2K --------------------------- .. _CP2K: https://www.cp2k.org/ CP2K is a program to perform atomistic and molecular simulations of solid state, liquid, molecular, and biological systems. It provides a general framework for different methods such as e.g., density functional theory (DFT) using a mixed Gaussian and plane waves approach (GPW). .. GENERATED FROM PYTHON SOURCE LINES 16-18 We perform an example CP2K DFT calculation by first importing the calculator for CP2K and creating a bulk silicon example atoms object. .. GENERATED FROM PYTHON SOURCE LINES 19-25 .. code-block:: Python from ase.build import bulk from ase.calculators.cp2k import CP2K atoms = bulk('Si') .. GENERATED FROM PYTHON SOURCE LINES 26-27 Next, we set up a calculator object and specify CP2K's calculation parameters. .. GENERATED FROM PYTHON SOURCE LINES 28-34 .. code-block:: Python calc = CP2K( xc='LDA', # Exchange-correlation functional cutoff=400, # Plane-wave energy cutoff ) .. GENERATED FROM PYTHON SOURCE LINES 35-36 and run the calculation: .. GENERATED FROM PYTHON SOURCE LINES 36-40 .. code-block:: Python atoms.calc = calc energy = atoms.get_potential_energy() print(energy) .. rst-class:: sphx-glr-script-out .. code-block:: none -198.42147599595 .. _sphx_glr_download_examples_generated_external_calculators_external_calculators_cp2k.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: external_calculators_cp2k.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: external_calculators_cp2k.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: external_calculators_cp2k.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_