ppafm.common#
- class ppafm.common.CLIParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)[source]#
Bases:
ArgumentParserSubclass from the built-in ArgumentParser with functionality to easily add arguments commonly used in ppafm scripts.
- add_arguments(arg_names)[source]#
Add CLI arguments from predefined dictionary
cli_params.- Parameters:
arg_names – list of str. Names of arguments to add.
- property cli_args#
Dictionary of arguments.
- ppafm.common.Fz2df(F, dz, k0, f0, amplitude=1.0, units=16.0217656)[source]#
conversion of vertical force Fz to frequency shift according to: Giessibl, F. J. A direct method to calculate tip-sample forces from frequency shifts in frequency-modulation atomic force microscopy Appl. Phys. Lett. 78, 123 (2001) Internal force units are eV/A the 16.021… converts stifness eV/A**2 to N/m
- ppafm.common.Fz2df_tilt(F, d, k0, f0, amplitude=1.0, units=16.0217656)[source]#
conversion of vertical force Fz to frequency shift according to: Giessibl, F. J. A direct method to calculate tip-sample forces from frequency shifts in frequency-modulation atomic force microscopy Appl. Phys. Lett. 78, 123 (2001) Internal force units are eV/A the 16.021… converts stifness eV/A**2 to N/m
- ppafm.common.PBCAtoms(Zs, Rs, Qs, avec, bvec, na=None, nb=None, parameters=None)[source]#
multiply atoms of sample along supercell vectors the multiplied sample geometry is used for evaluation of forcefield in Periodic-boundary-Conditions ( PBC )
- ppafm.common.PBCAtoms3D(Zs, Rs, Qs, cLJs, lvec, npbc=[1, 1, 1])[source]#
multiply atoms of sample along supercell vectors the multiplied sample geometry is used for evaluation of forcefield in Periodic-boundary-Conditions ( PBC )
- ppafm.common.PBCAtoms3D_np(Zs, Rs, Qs, cLJs, REAs, lvec, npbc=[1, 1, 1])[source]#
multiply atoms of sample along supercell vectors the multiplied sample geometry is used for evaluation of forcefield in Periodic-boundary-Conditions ( PBC )
- class ppafm.common.PpafmParameters(*, PBC: bool = True, nPBC: List[int] = [1, 1, 1], gridN: List[int] = [-1, -1, -1], gridO: List[float] = [0.0, 0.0, 0.0], gridA: List[float] = [20.0, 0.0, 0.0], gridB: List[float] = [0.0, 20.0, 0.0], gridC: List[float] = [0.0, 0.0, 20.0], FFgrid0: List[float] = [-1.0, -1.0, -1.0], FFgridA: List[float] = [-1.0, -1.0, -1.0], FFgridB: List[float] = [-1.0, -1.0, -1.0], FFgridC: List[float] = [-1.0, -1.0, -1.0], moleculeShift: List[float] = [0.0, 0.0, 0.0], probeType: str = 'O', charge: float = 0.0, Apauli: float = 18.0, Bpauli: float = 1.0, ffModel: str = 'LJ', Rcore: float = 0.7, r0Probe: List[float] = [0.0, 0.0, 4.0], stiffness: List[float] = [-1.0, -1.0, -1.0], klat: float = 0.5, krad: float = 20.0, tip: str | List = 's', sigma: float = 0.7, scanStep: List[float] = [0.1, 0.1, 0.1], scanMin: List[float] = [0.0, 0.0, 5.0], scanMax: List[float] = [20.0, 20.0, 8.0], scanTilt: List[float] = [0.0, 0.0, -0.1], tiltedScan: bool = False, kCantilever: float = 1800.0, f0Cantilever: float = 30300.0, Amplitude: float = 1.0, plotSliceFrom: int = 16, plotSliceTo: int = 22, plotSliceBy: int = 1, imageInterpolation: str = 'bicubic', colorscale: str = 'gray', colorscale_kpfm: str = 'seismic', ddisp: float = 0.05, aMorse: float = -1.6, Rtip: float = 30.0, permit: float = 0.00552634959, vdWDampKind: int = 2, Vbias: float = 0.0)[source]#
Bases:
BaseModelParameters for the PPAFM simulation.
The parameters description can be found on the wiki page: https://github.com/Probe-Particle/ppafm/wiki/Setting-simulation-parameters
- Amplitude: float#
- Apauli: float#
- Bpauli: float#
- FFgrid0: List[float]#
- FFgridA: List[float]#
- FFgridB: List[float]#
- FFgridC: List[float]#
- PBC: bool#
- Rcore: float#
- Rtip: float#
- Vbias: float#
- aMorse: float#
- charge: float#
- colorscale: str#
- colorscale_kpfm: str#
- ddisp: float#
- f0Cantilever: float#
- ffModel: str#
- classmethod from_file(file_path: str | Path = PosixPath('params.ini'))[source]#
Load parameters from a file.
- gridA: List[float]#
- gridB: List[float]#
- gridC: List[float]#
- gridN: List[int]#
- gridO: List[float]#
- imageInterpolation: str#
- kCantilever: float#
- klat: float#
- krad: float#
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'validate_assignment': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- moleculeShift: List[float]#
- nPBC: List[int]#
- permit: float#
- plotSliceBy: int#
- plotSliceFrom: int#
- plotSliceTo: int#
- probeType: str#
- r0Probe: List[float]#
- scanMax: List[float]#
- scanMin: List[float]#
- scanStep: List[float]#
- scanTilt: List[float]#
- sigma: float#
- stiffness: List[float]#
- tiltedScan: bool#
- tip: str | List#
- vdWDampKind: int#
- ppafm.common.autoGeom(Rs, parameters, shiftXY=False, fitCell=False, border=3.0)[source]#
set Force-Filed and Scanning supercell to fit optimally given geometry then shifts the geometry in the center of the supercell
- ppafm.common.findPBCAtoms3D_cutoff(Rs, lvec, Rcut=1.0, corners=None)[source]#
find which atoms with positions ‘Rs’ and radius ‘Rcut’ thouch rhombic cell defined by 3x3 matrix ‘lvec’; or more precisely which points ‘Rs’ belong to a rhombic cell enlarged by margin Rcut on each side all assuming that ‘Rcut’ is smaller than the rhombic cell (in all directions)
- ppafm.common.getAtomsLJ(iZprobe, iZs, FFparams)[source]#
compute Lennard-Jones coefficients C6 and C12 for interaction between atoms in list “iZs” and probe-particle “iZprobe”
- ppafm.common.getAtomsREA(iZprobe, iZs, FFparams, alphaFac=-1.0)[source]#
compute Lennard-Jones coefficients C6 and C12 for interaction between atoms in list “iZs” and probe-particle “iZprobe”
- ppafm.common.get_C612(i, j, FFparams)[source]#
compute Lennard-Jones coefitioens C6 and C12 pair of atoms i,j
- ppafm.common.get_df_weight(Amp, dz=0.1)[source]#
Conversion of vertical force Fz to frequency shift Returns the discretized version of the required convolution kernel
dz = the grid step (distance between the nearest grid points) in the direction in which the tip oscillates Amp = peak-to-peak oscillation amplitude (that is, twice the amplitude in the usual sense)
The integrand for calculating the frequency shift from force is taken from: Giessibl, F. J. A direct method to calculate tip-sample forces from frequency shifts in frequency-modulation atomic force microscopy Appl. Phys. Lett. 78, 123 (2001)
The continuous weight function needed for the conversion is w(t) = t/sqrt(1-t**2). We want to find an array w[i] (of n+1 elements) - the discrete convolution kernel - such that
(F*w)[j] = Sum_over(i) F[i+j] w[n+1-i] = -2/(Amp*pi) Integral_from(t=-1)_to(t=+1)_of F(t) w(t) dt
where Amp is the amplitude and t the normalized coordinate t = z*2/Amp. Linear interpolation will be used to define the force field F(t) from its discretized version F[i]:
F(t) = ( F[i] * (t[i+1] - t) + F[i+1] * (t - t[i]) ) / dt for t[i] < t < t[i+1]
where dt = dz*2/Amp = t[i+1] - t[i]. For each i, the interval from t[i] up to t[i+1] contribues to w[n+1-i] the following weight (omitting the coefficient of 1/(pi*dz) but including the minus sign in front of the original integrtal)
Integral_from(t=t[i])_to(t=t[i+1])_of dt*w(t)*( -t[i+1] + t ) = t[i+1]*(f[i+1] - f[i]) + (f2[i+1] - f2[i])
corresponding to the coefficient multiplying F[i], and, additionally, to w[n+1-(i+1)] = w[n-i] the weight
Integral_from(t=t[i])_to(t=t[i+1])_of dt*w(t)*( t[i] - t ) = -t[i]*(f[i+1] - f[i]) - (f2[i+1] - f2[i])
corresponding to the coefficient multiplying F[i+1]. In the above, two auxiliary functions were introduced to express the desired integrals,
f(t) = Integral_of -w(t)*dt = sqrt(1-t**2) f2(t) = Integral_of w(t)*t*dt = (arccos(-t) - sqrt(1-t**2)) / 2
and their discrete versions f[i] = f(t[i]); f2[i] = f2(t[i]). Note: we set f(t) = 0 and f2(t) = pi for t > +1.
- ppafm.common.get_simple_df_weight(n=10, dz=0.1)[source]#
Conversion of vertical force Fz to frequency shift Returns the discretized version of the required convolution kernel
Simpler version of the above get_df_weight()
- Parameters:
dz – the grid step (sistance between the nearest grid points) in the direction in which the tip oscillates
n – number of grid points involved in the convolution (peak-to-peak amplitude = n * dz)
- ppafm.common.multRot(Zs, Rs, Qs, cLJs, rots, cog=(0, 0, 0))[source]#
multiply atoms of sample along supercell vectors the multiplied sample geometry is used for evaluation of forcefield in Periodic-boundary-Conditions ( PBC )
- ppafm.common.parseAtoms(atoms, elem_dict, PBC=True, autogeom=False, lvec=None, parameters=None)[source]#
- ppafm.common.prepareScanGrids(parameters)[source]#
Defines the grid over which the tip will scan, according to scanMin, scanMax, and scanStep. The origin of the grid is going to be shifted (from scanMin) by the bond length between the “Probe Particle” and the “Apex”, so that while the point of reference on the tip used to interpret scanMin was the Apex, the new point of reference used in the XSF output will be the Probe Particle.