Skip to main content

Classical force field model for simulating atomic force microscopy images.

Project description

Probe Particle Model (PPM)

Simple and efficient simulation software for high-resolution atomic force microscopy (HR-AFM) and other scanning probe microscopy (SPM) techniques with sub-molecular resolution (STM, IETS, TERS). It simulates deflection of the particle attached to the tip (typically CO molecule, but also e.g. Xe, Cl-, H2O and others).

Further information

Flavors of PPM

Since 2014 PPM developed into the toolbox of various methodologies adjusted for a particular use case.

  1. CPU version: - Original implementation using Python & C/C++. It can simulate a typical AFM experiment (3D stack of AFM images) in ~1 minute. It is the base version for the development of new features and methodology. All available simulation models are implemented in this version, including:
    1. Point charge electrostatics + Lennard-Jones: Original fully classical implementation allows the user to set up calculation without any ab-initio input simply by specifying atomic positions, types and charges.
    2. Hartree-potential electrostatics + Lennard-Jones: Electrostatics is considerably improved by using Hartree potential from DFT calculation (e.g. LOCPOT from VASP) and using the Quadrupole model for CO-tip. We found this crucial to properly simulate polar molecules (e.g. H2O clusters, carboxylic acids, PTCDA) which exhibit strong electrostatic distortions of AFM images. Thanks to implementation using fast Fourier transform (FFT) this improvement does not increase the computational time (still ~1 minute), as long as the input electrostatic field is accessible.
    3. Hartree-potential electrostatics + Density overlap: Further accuracy improvement is achieved when Pauli repulsion between electron shells of atoms is modeled by the overlap between electron density of tip and sample. This repulsive term replaces the repulsive part of Lennard-Jones while the attractive part (C6) remains. This modification considerably improves especially simulation of molecules with electron pairs (-NH-, -OH, =O group), triple bonds and other strongly concentrated electrons. Calculation of the overlap repulsive potential is again accelerated by FFT to achieve minimal computational overhead (2-3 minutes) as long as input densities of tip and sample are available.
  2. GPU version: - Version specially designed for generation of training data for machine learning. Implementation using pyOpenCL can parallelize the evaluation of forcefield and relaxation of probe-particle positions over hundreds or thousands of stream-processors of the graphical accelerator. Further speed-up is achieved by using hardware accelerated trilinear interpolation of 3D textures available in most GPUs. This allows simulating 10-100 AFM experiments per second on consumer-grade desktop GPU.
    • GPU version is designed to work in collaboration with machine-learning software for AFM (https://github.com/SINGROUP/ASD-AFM) and use various generators of molecular geometry.
  3. GUI @ GPU - The speed of GPU implementation also allows to make interactive GUI where AFM images of molecules can be updated on the fly (<<0.1s) on a common laptop computer while the user is editing molecular geometry or parameters of the tip. This provides an invaluable tool especially to experimentalists trying to identify and interpret the structure and configuration of molecules in experiments on-the-fly while running the experiment.

Other branches

  • master_backup - Old master branch was recently significantly updated and named main. For users who miss the old master branch, we provided a backup copy. However, this version is very old and its use is discouraged. If you miss some functionality or are not satisfied with the behavior of current main branch please let us know by creating an issue.
  • PhotonMap - implements the latest developments concerning sub-molecular scanning probe combined with Raman spectroscopy (TERS)y and fluorescent spectroscopy (LSTM).
  • complex_tip - Modification of probe-particle model with 2 particles allows a better fit to experimental results at the cost of additional fitting parameters.

Installation & running examples

All development and testing were done on linux OS (mostly ubuntu). For the windows version, docker version will be prepared soon. In the meantime - several people successfully used probe-particle on windows using mingw.

Install & run CPU version

Requirements: Python3 (numpy,matplotlib) & C/C++ compiler (g++,make)

First run: Graphene with point-charges
  1. clone the repository: clone https://github.com/Probe-Particle/ProbeParticleModel.git
  2. compile the C/C++ modules
    • cd ProbeParticleModel/Graphene
    • make
  3. Navigate to examples directory cd ProbeParticleModel/examples/Graphenethis example uses simple (Point-charges + Lennard-Jones)
  4. run the example ./run.sh
  5. output directory /examples/Graphene/Q-0.05K0.50/Amp2.0 should contain simulated images with tip charge -0.05e, stiffness 0.5N/m and ossicaltion amplitude 2.0A.

NOTE: Python package is designed to automatically recompile the C/C++ automatically, which is convenient for development, so explicit compilation in step #2 maybe not be necessary. see e.g. cpp_utils.make("PP") in ppafm/core.py

Example 2: PTCDA with Hartree potential
  1. navigate to ProbeParticleModel/examples/PTCDA_Hartree
  2. run the example ./run.sh

NOTE: Notice that the script run.sh downloads and unpack LOCPOT file: wget --no-check-certificate "https://www.dropbox.com/s/18eg89l89npll8x/LOCPOT.xsf.zip" unzip LOCPOT.xsf.zip this is a large 3D volumetric file which contains Hartree electrostatic potential (in this example computed by VASP) which have to be provided.

Example 3: Pyridine with Density-overlap
  1. navigate to ProbeParticleModel/examples/pyridineDensOverlap
  2. run the example ./run.sh

NOTE: Notice that the script run.sh downloads and unpacks files CHGCAR.xsf & LOCPOT.xsf and places them in subdirectories sample and tip. These are electron density and Hartree potential which need to be provided from DFT calculation (this time from VASP).

Install & run GPU GUI

Install prerequisites (Ubuntu):

sudo apt install git python3-pip python3-pyqt5
pip install matplotlib numpy pyopencl reikna ase

Additionally an OpenCL Installable Client Driver (ICD) for your compute device is required:

  • Nvidia GPU: comes with the standard Nvidia driver (nvidia-driver-xxx)
  • AMD GPU: sudo apt install mesa-opencl-icd
  • Intel HD Graphics: sudo apt install intel-opencl-icd
  • CPU: sudo apt install pocl-opencl-icd

Run the GUI application:

./ppm-gui
Usage:
  • Open a file by clicking Open File... at the bottom or provide an input file as a command line argument using the -i or --input option. The input file can be a .xyz geometry file (possibly with point charges*), a VASP POSCAR or CONTCAR file, an FHI-aims .in file, or a .xsf or .cube Hartree potential file. Loading large files may take some time.
  • Changing any number in any input box will automatically update the image. There are also presets for some commonly used tip configurations. Hover the mouse cursor over any parameter for a tooltip explaining the meaning of the parameter.
  • Click anywhere on the image to bring up a plot of the df approach curve for that point in the image.
  • Scroll anywhere on the image to zoom the scan window in/out of that spot.
  • Click on the View Geometry button to show the system geometry in ASE GUI.
  • Click on the Edit Geometry button to edit the positions, types, and charges of the atoms in the system. Note that for Hartree potential inputs editing charges is disabled and editing the geometry only affects the Lennard-Jones force field.
  • Click on the View Forcefield button to view different components of the force field. Note that the forcefield box size is inferred automatically from the scan size and is bigger than the scan size. Take into account the probe particle equilibrium distance when comparing the reported z-coordinates between the forcefield and the df image.
  • Click on the Edit Forcefield button to edit the per-species parameters of the Lennard-Jones forcefield.
  • Save the current image or df data by clicking the Save Image... or Save df... buttons at the bottom.
  • In case there are multiple OpenCL devices installed on the system, use the -l or --list-devices option to list available devices and choose the device using the -d or --device option with the device platform number as the argument.

*Note that while input files without charges work, depending on the system, the resulting image may be significantly different from an image with electrostatics, and therefore may not be representative of reality. If no electrostatics are included, this is indicated in the title of the image.

Run GPU generator for machine learning

  • examples/CorrectionLoopGraphene use GPU accelerated PPM to iteratively improve the estimate of molecular geometry by comparing simulated AFM images with reference. This is work-in-progress. Currently, modification of estimate geometry is random (Monte-Carlo), while later we plan to develop a more clever (e.g. Machine-Learned) heuristic for more efficient improvment.
  • examples/Generator quickly generates a batch of simulated AFM images (resp. 3D data stacks) which can be further used for machine learning. Especially in connection with (https://github.com/SINGROUP/ASD-AFM).

Notable publications using Probe Particle Model

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ppafm-0.1.0.tar.gz (81.0 kB view details)

Uploaded Source

Built Distribution

ppafm-0.1.0-py3-none-any.whl (85.8 kB view details)

Uploaded Python 3

File details

Details for the file ppafm-0.1.0.tar.gz.

File metadata

  • Download URL: ppafm-0.1.0.tar.gz
  • Upload date:
  • Size: 81.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for ppafm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0de054c0062ed0061c3f3e855205ceab106bd77404cfe34720fbc11cc3801c23
MD5 bf3b6e775132fafe5526d02e12e56c88
BLAKE2b-256 12d1d2cb654ce5731ab02ef203dca39cfe33efda00fb53c4d99bcbb3099953a4

See more details on using hashes here.

File details

Details for the file ppafm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ppafm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 85.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for ppafm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 073b1c45c60ef21b69243ee8c97f41a9c3662aebd5e97eb25cb58d4d2b0e72f0
MD5 5505ef5beb9a1d58fd3a806e7de89757
BLAKE2b-256 4dea77b07fed0bab07a4e7fbffdf8f88f8dcb8b2df1255d10f2300d379144d2d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page