-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The KPFM_sim is an python,cython and shell package managing DFT level simulation of nc-AFM or KPFM measurements.
It contains shell scripts for running important task on the super-computer environments or for the post processing.
The DFT part is operated by an open-source CP2K code which is LCAO & PW hybrid with a high amount of options. (!!! Safety warning -- CP2K is an bio-hazard tool -- NEVER, EVER expect proper manual from it, or safe settings for stable, converging calculations. Those do not exist. It has 1000s of options for different types of calculations, but they develop very rapidly and what was working couple of versions ago becomes obsolete quickly. Also the manual is super outdated. Prepare for blood and tears, while working with it. !!! ). However in order to communicate with CP2K via python, the scripts are using a pycp2k package and CP2k_mtools for parsing the output or managing multiple run's.
The (atomic) geometry is handled by the Atomic Simulation Environment -- ASE also together with the previously mentioned suspects -- pycp2k package and CP2k_mtools.
The electric field (TO BE UPDATED !!!) for the KPFM simulations - is handled by KPFM_FEM and DFT_gridIO.
Finally, the results (and the planned task) is kept in an SQL database file (xxx.db
), which is handled through an sqlite3.
First prepare the system -- the sample and tip model all together. But the tip and sample part has to be separated by the order: tip can be the first and sample the second, or the other way round, we have example scripts for both. Beware the vertical axis is the y axis. So you need to translate your coordinates accordingly (For right angle boxes the transition is as follows: x -> x, y -> z, z -> -y + new-cell-y ). The system in /example is shown here:
Also prepare two files with indices of fixed atoms for the tip parts. (you can either follow the python logic or a human logic, just check and change the pre-optimizing script accordingly).
After this settings adjust the pre-optimizing script with the scanning point and the layers: Both tip and sample will be during the run divided by top - middle - bottom. Top and bottom are fixed for tip and sample, respectively. Tip - bottom is one atom tip-apex. You can check if everything is set properly before running the actuall script by setting: just_check = True
in the preopt_... scripts. (see either example or control_script_templates ).
If everything runs properly, the script should create a database file with energy, properly devided atom-types.
In every example you have to adjust the slurm variables (queue type and so on.) and the PYTHONPATH in the script ....slrm scripts , so it would match with your settings.
Example with and without the k-points applied in the calculations. To run the full example please run consecutively these comands; if there is a free line wait, until previous run is done without mistakes.
sbatch run_preopt.slrm # optimize the geometry and calculate the initial db file, which is coppied couple of times
sbatch run_afm_worker_1.slrm # calculate every second point of tip descending above Na.
sbatch run_afm_worker_2.slrm # calculate all the other points of tip descending above Na.
sbatch run_afm_worker_y-Cl.slrm # calculate full path of tip descending above Cl (tip is translated).
combine_results.sh # get the results from 3 directories and 3 db files into the global_results directory.
sbatch run_afm_forces.slrm # will rerun CP2K once more, and get the atomic forces from this run.
get_results.sh # will create Energy and Force (dE/ds and atomic forces) vs. distance data and plots.
Under development!!!