Skip to content

Commit 9904231

Browse files
authored
Add atomSize keyword to the ppafm-plot-results.py (#390)
* add input_plot.xyz to demostrate how to plot with atoms overlayed * add a line to demostrate how to plot with atoms overlayed * add a line to demostrate how to plot with atoms overlayed * add atomSize keyword to fix issue #389 * set default size to 0.15 * formating
1 parent a237f91 commit 9904231

4 files changed

Lines changed: 55 additions & 13 deletions

File tree

examples/PTCDA_single/example_ptcda.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def example_ptcda_single():
1717
generate_elff_point_charges(["--input", "PTCDA.xyz", "--tip", "s"])
1818
relaxed_scan(["--klat", "0.5", "--charge", "-0.10"])
1919
plot_results(["--klat", "0.5", "--charge", "-0.10", "--arange", "0.5", "2.0", "2", "--df"])
20+
plot_results(["--klat", "0.5", "--charge", "-0.10", "--arange", "0.5", "2.0", "2", "--df", "--atoms", "--atomSize", "0.15"])
2021

2122

2223
if __name__ == "__main__":
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
38
2+
Same as PTCDA.xyz for demonstration. You may also select a subset of atoms, such as the top layer in a multilayer structure.
3+
1 7.045637 6.005613 9.947120 +0.15
4+
1 9.897932 2.612194 9.943020 +0.15
5+
1 8.275515 4.509521 9.942140 +0.15
6+
1 12.336543 10.425948 9.938079 +0.15
7+
1 10.715512 12.324056 9.934680 +0.15
8+
1 5.466648 7.962514 9.914780 +0.15
9+
1 13.565891 8.930334 9.897579 +0.15
10+
1 15.144142 6.972851 9.869899 +0.15
11+
6 8.460736 9.700870 9.961119 0.0
12+
6 11.676272 3.889107 9.958080 0.0
13+
6 9.391591 8.577521 9.956319 0.0
14+
6 12.150413 5.235732 9.956060 0.0
15+
6 8.879125 7.226835 9.953480 0.0
16+
6 9.803928 6.100850 9.951800 0.0
17+
6 11.219312 6.358704 9.945880 0.0
18+
6 8.935446 11.048403 9.945498 0.0
19+
6 10.806843 8.835349 9.945320 0.0
20+
6 12.627057 2.771961 9.945019 0.0
21+
6 11.731363 7.709653 9.932579 0.0
22+
6 14.500405 4.381420 9.928359 0.0
23+
6 10.264659 3.653138 9.924319 0.0
24+
6 7.056579 9.446457 9.921079 0.0
25+
6 7.456229 7.025884 9.919660 0.0
26+
6 10.348140 11.283277 9.917400 0.0
27+
6 7.986501 12.165751 9.914699 0.0
28+
6 9.355124 4.729154 9.914160 0.0
29+
6 6.111767 10.553017 9.908559 0.0
30+
6 11.256785 10.206996 9.908120 0.0
31+
6 13.555310 5.488973 9.906280 0.0
32+
6 6.563246 8.112073 9.905699 0.0
33+
6 13.153859 7.910466 9.873319 0.0
34+
6 14.047411 6.822740 9.865199 0.0
35+
8 14.000075 3.084865 10.031318 -0.2
36+
8 6.611246 11.853327 9.959440 -0.2
37+
8 15.736978 4.488921 9.837521 -0.2
38+
8 12.372576 1.563458 9.825279 -0.2
39+
8 4.874570 10.445600 9.820059 -0.2
40+
8 8.241626 13.369424 9.801439 -0.2

examples/PTCDA_single/run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ ppafm-relaxed-scan -k 0.5 -q -0.10
99

1010
# ======= STEP 3 : Plot the results
1111
ppafm-plot-results -k 0.5 -q -0.10 --arange 0.5 2.0 2 --df
12+
13+
# ======= STEP 4 : Plot the results with atoms overlayed
14+
ppafm-plot-results -k 0.5 -q -0.10 --arange 0.5 2.0 2 --df --atoms --atomSize 0.15

ppafm/cli/plot_results.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
# this makes it run without Xserver (e.g. on supercomputer) # see http://stackoverflow.com/questions/4931376/generating-matplotlib-graphs-without-a-running-x-server
1818

1919

20-
atom_size = 0.15
21-
22-
2320
def main(argv=None):
2421
# fmt: off
2522
parser = common.CLIParser( description="Plot results for a scan with a specified charge, amplitude, and spring constant.Images are saved in folder Q{charge}K{klat}/Amp{Amplitude}." )
@@ -34,6 +31,7 @@ def main(argv=None):
3431
parser.add_argument( "--Fz", action="store_true", help="Plot images for z-component of the (short-range) force acting on the tip in eV/Angstrom")
3532
parser.add_argument( "--pos", action="store_true", help="Save probe particle positions" )
3633
parser.add_argument( "--atoms", action="store_true", help="Plot atoms to images")
34+
parser.add_argument( "--atomSize", action="store", type=float, default=0.15, help="Size of atoms in images")
3735
parser.add_argument( "--bonds", action="store_true", help="Plot bonds to images")
3836
parser.add_argument( "--cbar", action="store_true", help="Plot colorbars to images")
3937
parser.add_argument( "--WSxM", action="store_true", help="Save frequency shift into WsXM *.dat files" )
@@ -146,7 +144,7 @@ def main(argv=None):
146144
extent=extent,
147145
atoms=atoms,
148146
bonds=bonds,
149-
atomSize=atom_size,
147+
atomSize=args.atomSize,
150148
markersize=2.0,
151149
cbar=opt_dict["cbar"],
152150
)
@@ -167,7 +165,7 @@ def main(argv=None):
167165
extent=extent,
168166
atoms=atoms,
169167
bonds=bonds,
170-
atomSize=atom_size,
168+
atomSize=args.atomSize,
171169
cbar=opt_dict["cbar"],
172170
)
173171

@@ -178,7 +176,7 @@ def main(argv=None):
178176
extent=extent,
179177
atoms=atoms,
180178
bonds=bonds,
181-
atomSize=atom_size,
179+
atomSize=args.atomSize,
182180
cbar=opt_dict["cbar"],
183181
)
184182

@@ -189,7 +187,7 @@ def main(argv=None):
189187
extent=extent,
190188
atoms=atoms,
191189
bonds=bonds,
192-
atomSize=atom_size,
190+
atomSize=args.atomSize,
193191
cbar=opt_dict["cbar"],
194192
)
195193

@@ -203,7 +201,7 @@ def main(argv=None):
203201
extent=extent,
204202
atoms=atoms,
205203
bonds=bonds,
206-
atomSize=atom_size,
204+
atomSize=args.atomSize,
207205
cbar=opt_dict["cbar"],
208206
)
209207

@@ -329,7 +327,7 @@ def main(argv=None):
329327
cmap=parameters.colorscale,
330328
atoms=atoms,
331329
bonds=bonds,
332-
atomSize=atom_size,
330+
atomSize=args.atomSize,
333331
cbar=opt_dict["cbar"],
334332
cbar_label="df [Hz]",
335333
)
@@ -354,7 +352,7 @@ def main(argv=None):
354352
cmap=parameters.colorscale,
355353
atoms=atoms,
356354
bonds=bonds,
357-
atomSize=atom_size,
355+
atomSize=args.atomSize,
358356
cbar=opt_dict["cbar"],
359357
)
360358

@@ -386,7 +384,7 @@ def main(argv=None):
386384
cmap=parameters.colorscale_kpfm,
387385
atoms=atoms,
388386
bonds=bonds,
389-
atomSize=atom_size,
387+
atomSize=args.atomSize,
390388
cbar=opt_dict["cbar"],
391389
symmetric_map=True,
392390
V0=args.V0,
@@ -401,7 +399,7 @@ def main(argv=None):
401399
cmap=parameters.colorscale_kpfm,
402400
atoms=atoms,
403401
bonds=bonds,
404-
atomSize=atom_size,
402+
atomSize=args.atomSize,
405403
cbar=opt_dict["cbar"],
406404
symmetric_map=False,
407405
cbar_label="V_LCPD [V]",
@@ -436,7 +434,7 @@ def main(argv=None):
436434
cmap=parameters.colorscale,
437435
atoms=atoms,
438436
bonds=bonds,
439-
atomSize=atom_size,
437+
atomSize=args.atomSize,
440438
cbar=opt_dict["cbar"],
441439
cbar_label="Fz [eV/Angstrom]",
442440
)

0 commit comments

Comments
 (0)