PLUGINS/STRUCTURE: Difference between revisions
(Created page with "{{TAGDEF|PLUGINS/STRUCTURE| .True. {{!}} .False.|.False.}} Description: {{TAG|PLUGINS/STRUCTURE}} calls the Python plugin for the structure interface for each ionic relaxation step ---- When {{TAG|PLUGINS/STRUCTURE}}=.TRUE., VASP calls the <code>structure</code> Python function at the end of each ionic relaxation step. The primary use-case of this tag is to modify the structure based on the computed energy, force and stress tensor. ==Expected inputs== The <code>stru...") |
mNo edit summary |
||
Line 10: | Line 10: | ||
The <code>structure</code> Python function expects the following inputs, | The <code>structure</code> Python function expects the following inputs, | ||
<syntaxhighlight lang="python" line> | |||
def structure(constants, additions): | def structure(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] | ||
<syntaxhighlight lang="python" line> | |||
number_ions: int | number_ions: int | ||
number_ion_types: int | number_ion_types: int | ||
Line 25: | Line 28: | ||
shape_grid: NDArray[np.float64] | shape_grid: NDArray[np.float64] | ||
charge_density: NDArray[np.float64] | charge_density: NDArray[np.float64] | ||
</syntaxhighlight> | |||
Note that the {{FILE|INCAR}} tags are capitalized. | Note that the {{FILE|INCAR}} tags are capitalized. | ||
<code>number_ions</code> is the total number of ions listed in the {{FILE|POSCAR}} file, | <code>number_ions</code> is the total number of ions listed in the {{FILE|POSCAR}} file, | ||
Line 37: | Line 41: | ||
==Modifying quantities== | ==Modifying quantities== | ||
Modify the quantities listed in additions by adding to them. | Modify the quantities listed in additions by adding to them. | ||
<syntaxhighlight lang="python" line> | |||
def structure(constants, additions) | def structure(constants, additions) | ||
additions.positions += np.ones((constants.number_ions,3)) | additions.positions += np.ones((constants.number_ions,3)) | ||
</syntaxhighlight> | |||
{{NB| mind | You may not make modifications to quantities in <code>constants</code>}} | {{NB| mind | You may not make modifications to quantities in <code>constants</code>}} | ||
Revision as of 09:52, 14 October 2024
PLUGINS/STRUCTURE = .True. | .False.
Default: PLUGINS/STRUCTURE = .False.
Description: PLUGINS/STRUCTURE calls the Python plugin for the structure interface for each ionic relaxation step
When PLUGINS/STRUCTURE=.TRUE., VASP calls the structure
Python function at the end of each ionic relaxation step.
The primary use-case of this tag is to modify the structure based on the computed energy, force and stress tensor.
Expected inputs
The structure
Python function expects the following inputs,
def structure(constants, additions):
where constants
and additions
and Python dataclasses.
The constants
dataclass consists of the following inputs, listed here with their associated datatypes
number_ions: int
number_ion_types: int
ion_types: NDArray[np.int32]
atomic_numbers: NDArray[np.int32]
lattice_vectors: NDArray[np.float64]
positions: NDArray[np.float64]
{{TAGBL|POMASS}}: NDArray[np.float64]
total_energy: float
forces: NDArray[np.float64]
stress: NDArray[np.float64]
shape_grid: NDArray[np.float64]
charge_density: NDArray[np.float64]
Note that the INCAR tags are capitalized.
number_ions
is the total number of ions listed in the POSCAR file,
number_ion_types
is the number of ion corresponding to each ion type in the convention of the POSCAR file,
ion_types
stores the total number of ion types,
atomic_numbers
contains the atomic number for each atom type,
lattice_vectors
and positions
contain the lattice vectors and positions of the current SCF step
forces
and stress
are the computed forces and stress tensor and charge_density
contains the charge density on the real space grid. shape_grid
is a three dimensional integer array which stores the shape of the real space grid, NGXF, NGYF and NGZF and charge_density
is the charge density on this real space grid.
The additions
dataclass consists of the following modifiable outputs
lattice_vectors: NDArray[np.float64] positions: NDArray[np.float64]
Modifying quantities
Modify the quantities listed in additions by adding to them.
def structure(constants, additions)
additions.positions += np.ones((constants.number_ions,3))
Mind: You may not make modifications to quantities in constants
|