File: siesta.rst

package info (click to toggle)
python-ase 3.26.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (331 lines) | stat: -rw-r--r-- 12,747 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
.. module:: ase.calculators.siesta

======
SIESTA
======

Introduction
============

SIESTA_ is a density-functional theory code for very large systems
based on atomic orbital (LCAO) basis sets.


.. _SIESTA: https://siesta-project.org/siesta/



Environment variables
=====================

The environment variable :envvar:`ASE_SIESTA_COMMAND` must hold the command
to invoke the siesta calculation. The variable must be a string 
where ``PREFIX.fdf``/``PREFIX.out`` are the placeholders for the 
input/output files. This variable allows you to specify serial or parallel 
execution of SIESTA.
Examples: ``siesta < PREFIX.fdf > PREFIX.out`` and
``mpirun -np 4 /bin/siesta-5.0 < PREFIX.fdf > PREFIX.out``.

A default directory holding pseudopotential files :file:`.psml/.psf` can be
defined to avoid defining this every time the calculator is used.
This directory can be set by the environment variable
:envvar:`SIESTA_PP_PATH`.

Set both environment variables in your shell configuration file:

.. highlight:: bash

::

  $ export ASE_SIESTA_COMMAND="siesta < PREFIX.fdf > PREFIX.out"
  $ export SIESTA_PP_PATH=$HOME/mypps

.. highlight:: python

Alternatively, the path to the pseudopotentials can be given in
the calculator initialization. Listed below all parameters 
related to pseudopotential control.

===================== ========= ============= =====================================
keyword               type      default value description
===================== ========= ============= =====================================
``pseudo_path``       ``str``   ``None``      Directory for pseudopotentials to use
                                              None means using $SIESTA_PP_PATH
``pseudo_qualifier``  ``str``   ``None``      String for picking out specific type
                                              type of pseudopotentials. Giving
                                              ``example`` means that
                                              ``H.example.psml`` or
                                              ``H.example.psf`` will be used. None
                                              means that the XC.functional keyword
                                              is used, e.g. ``H.lda.psf``
``symlink_pseudos``   ``bool``  ``---``       Whether pseudos will be sym-linked 
                                              into the execution directory. If 
                                              False they will be copied instead.
                                              Default is True on Unix and False on
                                              Windows.
===================== ========= ============= =====================================


SIESTA Calculator
=================

These parameters are set explicitly and overrides the native values if different.

================ ========= =================== =====================================
keyword          type      default value       description
================ ========= =================== =====================================
``label``        ``str``   ``'siesta'``        Name of the output file
``mesh_cutoff``  ``float`` ``200*Ry``          Mesh cut-off energy in eV
``xc``           ``str``   ``'LDA'``           Exchange-correlation functional.
                                               Corresponds to either XC.functional
                                               or XC.authors keyword in SIESTA
``energy_shift`` ``float`` ``100 meV``         Energy shift for determining cutoff
                                               radii
``kpts``         ``list``  ``[1,1,1]``         Monkhorst-Pack k-point sampling
``basis_set``    ``str``   ``DZP``             Type of basis set ('SZ', 'DZ', 'SZP',
                                               'DZP')
``spin``         ``str``   ``'non-polarized'`` The spin approximation used, must be
                                               either ``'non-polarized'``, 
                                               ``'collinear'``, ``'non-collinear'``
                                               or ``'spin-orbit'``.
``species``      ``list``  ``[]``              A method for specifying the basis set  
                                               for some atoms.
================ ========= =================== =====================================

Most other parameters are set to the default values of the native interface.

Extra FDF parameters
====================

The SIESTA code reads the input parameters for any calculation from a
:file:`.fdf` file. This means that you can set parameters by manually setting
entries in this input :file:`.fdf` file. This is done by the argument:

>>> Siesta(fdf_arguments={'variable_name': value, 'other_name': other_value})

For example, the ``DM.MixingWeight`` can be set using

>>> Siesta(fdf_arguments={'DM.MixingWeight': 0.01})

The explicit fdf arguments will always override those given by other
keywords, even if it breaks calculator functionality.
The complete list of the FDF entries can be found in the official `SIESTA
manual`_.

.. _SIESTA manual:  https://siesta-project.org/siesta/Documentation/

Example
=======

Here is an example of how to calculate the total energy for bulk Silicon,
using a double-zeta basis generated by specifying a given energy-shift:

>>> from ase import Atoms
>>> from ase.calculators.siesta import Siesta
>>> from ase.units import Ry
>>>
>>> a0 = 5.43
>>> bulk = Atoms('Si2', [(0, 0, 0),
...                      (0.25, 0.25, 0.25)],
...              pbc=True)
>>> b = a0 / 2
>>> bulk.set_cell([(0, b, b),
...                (b, 0, b),
...                (b, b, 0)], scale_atoms=True)
>>>
>>> calc = Siesta(label='Si',
...               xc='PBE',
...               mesh_cutoff=200 * Ry,
...               energy_shift=0.01 * Ry,
...               basis_set='DZ',
...               kpts=[10, 10, 10],
...               fdf_arguments={'DM.MixingWeight': 0.1,
...                              'MaxSCFIterations': 100},
...               )
>>> bulk.calc = calc
>>> e = bulk.get_potential_energy()

Here, the only input information on the basis set is, that it should
be double-zeta (``basis='DZP'``) and that the confinement potential
should result in an energy shift of 0.01 Rydberg (the
``energy_shift=0.01 * Ry`` keyword). Sometimes it can be necessary to specify
more information on the basis set.

Defining Custom Species
=======================
Standard basis sets can be set by the keyword ``basis_set`` directly, but for
anything more complex than one standard basis size for all elements,
a list of ``species`` must be defined. Each specie is identified by atomic
element and the tag set on the atom.

For instance if we wish to investigate a H2 molecule and put a ghost atom
(the basis set corresponding to an atom but without the actual atom) in the middle
with a special type of basis set you would write:

>>> from ase.calculators.siesta.parameters import Specie, PAOBasisBlock
>>> from ase import Atoms
>>> from ase.calculators.siesta import Siesta
>>> atoms = Atoms(
...     '3H',
...     [(0.0, 0.0, 0.0),
...      (0.0, 0.0, 0.5),
...      (0.0, 0.0, 1.0)],
...     cell=[10, 10, 10])
>>> atoms.set_tags([0, 1, 0])
>>>
>>> basis_set = PAOBasisBlock(
... """1
... 0  2 S 0.2
... 0.0 0.0""")
>>>
>>> siesta = Siesta(
...     species=[
...         Specie(symbol='H', tag=None, basis_set='SZ'),
...         Specie(symbol='H', tag=1, basis_set=basis_set, ghost=True)])
>>>
>>> atoms.calc = siesta

When more species are defined, species defined with a tag has the highest priority.
General species with ``tag=None`` has a lower priority.
Finally, if no species apply
to an atom, the general calculator keywords are used.


Pseudopotentials
================

Siesta requires for pseudopotential files in the ``.psml`` or ``.psf`` formats. 
Up-to-date information on Siesta compatible pseudopotential formats and databases 
can be accessed on the `pseudopotentials section`_ of the siesta-project website.

* Curated pseudopotential databases in ``.psml`` format are available at PseudoDojo_. These are supported by SIESTA 5.0 and later versions.
* Optimized GGA–PBE pseudos in ``.psf`` format and DZP basis sets for some common elements are also available from the `SIMUNE`_ website.
* PSML pseudopotentials can be generated with the `ONCVPSP generator`_.

.. _pseudopotentials section: https://siesta-project.org/siesta/Documentation/Pseudopotentials/

.. _PseudoDojo: http://www.pseudo-dojo.org/

.. _SIMUNE:  https://www.simuneatomistics.com/siesta-toolkit/siesta-pseudos-and-basis-database/

.. _ONCVPSP generator: https://github.com/oncvpsp/oncvpsp


Species can also be used to specify pseudopotentials:

>>> specie = Specie(symbol='H', tag=1, pseudopotential='H.example.psml')

When specifying the pseudopotential in this manner, both absolute
and relative paths can be given.
Relative paths are interpreted as relative to the set 
pseudopotential path.

Restarting from an old Calculation
==================================

If you want to rerun an old SIESTA calculation, whether made using the ASE
interface or not, you can set the keyword ``restart`` to the siesta ``.XV``
file. The keyword ``ignore_bad_restart`` (True/False) will decide whether
a broken file will result in an error(False) or the whether the calculator
will simply continue without the restart file.

Choosing the coordinate format
==============================
If you are mainly using ASE to generate SIESTA files for relaxation with native
SIESTA relaxation, you may want to write the coordinates in the Z-matrix format
which will best allow you to use the advanced constraints present in SIESTA.

======================= ========= ============= =====================================
keyword                 type      default value description
======================= ========= ============= =====================================
``atomic_coord_format`` ``str``   ``'xyz'``     Choose between ``'xyz'`` and 
                                                ``'zmatrix'`` for the format that 
                                                coordinates will be written in.
======================= ========= ============= =====================================

Siesta Calculator Class
=======================

.. autoclass:: ase.calculators.siesta.siesta.Siesta


Excited states calculations
===========================

The `PyNAO <https://mbarbrywebsite.ddns.net/pynao/doc/html/>`_ code can be used
to access excited state properties after having obtained the ground state
properties with SIESTA. PyNAO allows to perform

* Time Dependent Density Functional Theory (TDDFT) calculations
* GW approximation calculations
* Bethe-Salpeter equation (BSE) calculations.

Example of code to calculate polarizability of CH4 molecule::

  from ase.calculators.siesta.siesta_lrtddft import SiestaLRTDDFT
  from ase.build import molecule
  import numpy as np

  # Define the systems
  ch4 = molecule('CH4')
  lrtddft = SiestaLRTDDFT(label="siesta", xc_code='LDA,PZ')

  # run DFT with siesta
  lrtddft.get_ground_state(ch4)

  # Run TDDFT with PyNAO
  freq = np.arange(0.0, 25.0, 0.5)
  pmat = lrtddft.get_polarizability(freq)

  import matplotlib.pyplot as plt

  plt.plot(freq, pmat[0, 0, :].imag)
  plt.show()

Raman Calculations with SIESTA and PyNAO
========================================

It is possible to calculate the Raman spectra with SIESTA and PyNAO using the
Raman function of the vibration module::

  from ase.calculators.siesta.siesta_lrtddft import RamanCalculatorInterface
  from ase.calculators.siesta import Siesta
  from ase.vibrations.raman import StaticRamanCalculator
  from ase.vibrations.placzek import PlaczekStatic
  from ase.build import molecule

  n2 = molecule('N2')

  # enter siesta input
  n2.calc = Siesta(
      basis_set='DZP',
      fdf_arguments={
          'COOP.Write': True,
          'WriteDenchar': True,
          'XML.Write': True})

  name = 'n2'
  pynao_args = dict(label="siesta", jcutoff=7, iter_broadening=0.15,
                    xc_code='LDA,PZ', tol_loc=1e-6, tol_biloc=1e-7)
  rm = StaticRamanCalculator(n2, RamanCalculatorInterface, name=name,
                             delta=0.011, exkwargs=pynao_args)
  rm.run()

  Pz = PlaczekStatic(n2, name=name)
  e_vib = Pz.get_energies()
  Pz.summary()

Further Examples
================
See also ``ase/test/calculators/siesta/lrtddft`` for further examples
on how the calculator can be used.

Siesta lrtddft Class
====================

.. autoclass:: ase.calculators.siesta.siesta_lrtddft.SiestaLRTDDFT

Siesta RamanCalculatorInterface Calculator Class
================================================

.. autoclass:: ase.calculators.siesta.siesta_lrtddft.RamanCalculatorInterface