This Python package is intended to help running finite element method (FEM) calculations related to modeling the macroscopic part of the KPFM probe and storing the results. GMSH is used for mesh generation and GetDP for the FEM calculation using the generated mesh. Contains an axisymmetric FEM model of a metallic KPFM probe over a dielectric sample. The parameters of the model can be easily changed within a Python script and the electrostatic potential generated by the system can be solved for multiple tip-sample distances and stored into a database (SQLite).
- Python 3.x (originally python 2.7)
- GMSH (http://gmsh.info/)
- GetDP (http://getdp.info/)
Put this directory containing the Python modules to your PYTHONPATH
environment variable. Make sure GMSH and GetDP are installed and can be called from the command line.
The probe-sample_model
folder contains the basic definition for the axisymmetric probe-sample geometry (tip-sample_axisymmetry.geo
) and the definition of the FEM problem to be solved (tip-sample_axisymmetry.pro
, and the other .pro files). These are GMSH and GetDP input files that form the basis of the problem definition and you may not have to change them at all. All the system specific parameters are set in a Python script. The calc_extpot_distrange.py
script can be used to calculate the electrostatic potential generated by the probe-sample model with various tip-sample distances. You can either run it sequentially so that it changes the distance, runs the calculation and stores the result to the given database file, or you can create subfolders containing the input files and run those in parallel (array_job
). If you choose to run in parallel, see the fem_run_array.sh
Slurm script example. After all cases have been succesfully calculated, run the fem_results_collect.py
script to store the results into a database file.
There may be no need to understand how the results are stored into the SQLite database. You can run the macro_force_from_capacitance.py
to calculate the macroscopic capacitive force affecting the probe and print it to a normal text file. The `KPFM_simulation_tools <>`_ package contains a script for transferring the data from the FEM results database to the KPFM results database so that the KPFM simulation tools can read the electric potential at correct tip-sample distance and use it as an external potential in a CP2k calculation. If you need to see what the database file contains, use sqlite3 command line tool (requires basic knowledge of SQL language) or Sqliteman which has a GUI.
Here is the snapshot of created electrostatic model:
The original documentation and connection with KPFM_sim is in here
Note: The latest version of KPFM_sim, which was done for a simulation of KPFM with flexible tip apexes and stepping out molecule, is not using KPFM_FEM at all and has a different kind of electrostatics models directly build-in.
Juha Ritala (2016) jritala@gmail.com