This code reads in input files POSCAR, CONTCAR, and Born.txt from the same directory, prompts the user to input lattice parameters, calculates the differences in fractional coordinates for each axis (taking into account periodic boundary conditions), plots the contour plots of differences along each axis, calculates the dipole moment, and finally calculates the polarization along x, y, and z-axis in unit of
Here e is the electron charge,
This script requires the following packages to be installed: - numpy
- matplotlib
Usage of bcpolarization.py
- Place the input files POSCAR, CONTCAR, and Born.txt in the same directory as the Python script.
- Type
python polarization.py
to run the script. - Follow the on-screen prompt to enter the lattice parameters.
- The script will plot the contour plots of differences along each axis and print the final polarization values along x, y, and z-axis.
- A polarization.txt file containing the polarization values will be created in the same directory as the script.
Usage of pcpolarization.py
Place the input (polar) non-centrosymmtric CONTCAR and (non-polar) centrosymmtric POSCAR files in the same folder as the script. Run the script and it will give a prompt to enter formal charges for the elements. Enter the values and you will get the final polarization values in units of
Note: The input files should have the same format as the standard VASP input/output file format.
This code is released under the MIT License.