PLUGINS/OCCUPANCIES: Difference between revisions

From VASP Wiki
(Created page with "{{TAGDEF|PLUGINS/OCCUPANCIES| .True. {{!}} .False.|.False.}} Description: {{TAG|PLUGINS/OCCUPANCIES}} calls the Python plugin for the occupancies interface for each ionic relaxation step ---- When {{TAG|PLUGINS/OCCUPANCIES}}=.TRUE., VASP calls the <code>occupancies</code> Python function at the end of each ionic relaxation step. The primary use-case of this tag to recompute the occupancies after performing modifications through other plugins such as {{TAG|PLUGINS/LOCA...")
 
No edit summary
 
(11 intermediate revisions by one other user not shown)
Line 9: Line 9:
==Expected inputs==
==Expected inputs==


The <code>structure</code> Python function expects the following inputs,
The <code>occupancies</code> Python function expects the following inputs,
    def occupancies(constants, additions):
<syntaxhighlight lang="python" line>
def occupancies(constants, additions):
</syntaxhighlight>
where <code>constants</code> and <code>additions</code> and [https://docs.python.org/3/library/dataclasses.html Python dataclasses].
where <code>constants</code> and <code>additions</code> and [https://docs.python.org/3/library/dataclasses.html Python dataclasses].
The <code>constants</code> dataclass consists of the following inputs, listed here with their associated [https://numpy.org/doc/stable/user/basics.types.html datatypes]
The <code>constants</code> dataclass consists of the following inputs, listed here with their associated [https://numpy.org/doc/stable/user/basics.types.html datatypes]
     {{TAG|NELECT}}: float
<syntaxhighlight lang="python" line>
     {{TAG|EFERMI}}: float
@dataclass(frozen=True)
     {{TAG|NUPDOWN}}: float
class ConstantsOccupancies:
     {{TAG|ISMEAR}}: int
     NELECT: float
     {{TAG|SIGMA}}: float
     EFERMI: float
     {{TAG|EMIN}}: float
     NUPDOWN: float
     {{TAG|EMAX}}: float
     ISMEAR: int
     SIGMA: float
     EMIN: float
     EMAX: float
</syntaxhighlight>
The <code>additions</code> dataclass consists of the same quantities as the <code>constants</code> tag.
The <code>additions</code> dataclass consists of the same quantities as the <code>constants</code> tag.
{{NB| mind | Calling this interface implicitly triggers a recalculation of the occupancies}}
{{NB| mind | Calling this interface implicitly triggers a recalculation of the occupancies}}


==Modifying quantities==
==Modifying quantities==
Modify the quantities listed in additions by adding to them.
Modify the quantities listed in additions by adding to them.
    def structure(constants, additions)
<syntaxhighlight lang="python" line>
        additions.NELECT += 1
import numpy as np
{{NB| mind | You may not make modifications to quantities in <code>constants</code>}}
def structure(constants, additions)
    additions.NELECT += 1
</syntaxhighlight>
{{WARN_PLUGINS_CONSTANTS}}


----
== Related tags and articles ==
<!--[[The_VASP_Manual|Contents]]-->
[[Plugins]],
 
{{TAG|PLUGINS/FORCE_AND_STRESS}},
<!-- Link to categories like this: [[Category:INCAR]][[Category:Electronic Minimization]]  
{{TAG|PLUGINS/LOCAL_POTENTIAL}},
only comment it out when you want the page to show up on the category page, i.e., not when it is in the Construction namespace.-->
{{TAG|PLUGINS/STRUCTURE}},
[[Category:INCAR tag]][[Category:Electronic occupancy]]

Latest revision as of 15:24, 18 December 2024

PLUGINS/OCCUPANCIES = .True. | .False.
Default: PLUGINS/OCCUPANCIES = .False. 

Description: PLUGINS/OCCUPANCIES calls the Python plugin for the occupancies interface for each ionic relaxation step


When PLUGINS/OCCUPANCIES=.TRUE., VASP calls the occupancies Python function at the end of each ionic relaxation step. The primary use-case of this tag to recompute the occupancies after performing modifications through other plugins such as PLUGINS/LOCAL_POTENTIAL. It also allows changing NELECT, EFERMI, NUPDOWN, ISMEAR, SIGMA, EMIN and EMAX at the end of each SCF step, to be reflected in the next step.

Expected inputs

The occupancies Python function expects the following inputs,

def occupancies(constants, additions):

where constants and additions and Python dataclasses. The constants dataclass consists of the following inputs, listed here with their associated datatypes

@dataclass(frozen=True)
class ConstantsOccupancies:
    NELECT: float
    EFERMI: float
    NUPDOWN: float
    ISMEAR: int
    SIGMA: float
    EMIN: float
    EMAX: float

The additions dataclass consists of the same quantities as the constants tag.

Mind: Calling this interface implicitly triggers a recalculation of the occupancies

Modifying quantities

Modify the quantities listed in additions by adding to them.

import numpy as np
def structure(constants, additions)
    additions.NELECT += 1
Warning: You should not make modifications to quantities in constants. We implemented some safeguards to prevent accidental modifications. Intentional changes will lead to erratic behavior because we may change the VASP code assuming these quantities are constant.

Related tags and articles

Plugins, PLUGINS/FORCE_AND_STRESS, PLUGINS/LOCAL_POTENTIAL, PLUGINS/STRUCTURE,