Probe-Particle / PPSTM

Code simulating variousSTM techniques, especially for tilting tip (dependent on https://github.com/Probe-Particle/ppafm)l)
MIT License
9 stars 1 forks source link

The way of tuning tip-model orbital in random proportion #31

Closed TaoTaotheCreator closed 1 month ago

TaoTaotheCreator commented 1 month ago

Hi, I just trying to simulate STM images using different tip-model to compare with my experiments, and the wiki said better is to calculate s and pxy in two separated runs and save it as npy or xsf. Then you can use SUM_Orb_Contrib.py script to print you any configurations between s and pxy tip-atom orbitals. This is possible, since contributions from different tip-atom orbitals can be simply summed-up. , so could you please tell me the detailed way to get the random tip-model with any orbital proportions, such as 3%s 97%pxy? Thanks a lot!

LauriKurki commented 1 month ago

Hi!

If you have calculated the s and pxy scans with PPSTM_simple.py, you can use the SUM_Orb_contrib.py to tweak the exact orbital contributions you want.

https://github.com/Probe-Particle/PPSTM/blob/96b04802c278a22b14d81d382fc115fcede158b8/SUM_Orb_Contrib.py#L23-L33

i.e. here on lines 24 and 25 you should set tip_orb1 = 's' and tip_orb2 = 'pxy' and on lines 30-31 you can choose the ratios. Does this help or is there something more specific we can assist with?

ondrejkrejci commented 1 month ago

Hi,

Two answers makes sense depending on a size of your system:

I would suggest to copy PPSTM_simple.py script twice to the directory you are working, one with name s and one with pxy. Adjust the parameters at the top of the files to what you need (dIdV or V-scan ... ) and set the output to npy and then follow @LauriKurki 's suggestion about the SUM_Orb_Contrib.py. Also I suggest to copy it to your working directory. As far as I remember, you can run it many times with different settings, it will name the outputs (just leave it to png) according to the orbitals and ratio used.

TaoTaotheCreator commented 1 month ago

OK , I will have a try, thanks!

ondrejkrejci commented 1 month ago

Also, if you have feeling, that we are missing documentation somewhere, please let us know!

TaoTaotheCreator commented 1 month ago

I have installed PPAFM in the same environment of PPSTM, but the error came below: writing npy binary files Traceback (most recent call last): File "pxy.py", line 374, in <module> io.saveNpy(name_file, didv[vv], lvec)#, head=XSF_HEAD_DEFAULT ) TypeError: saveNpy() missing 1 required positional argument: 'atomic_info'

ondrejkrejci commented 1 month ago

Hi, this is looks like a bug in the PPSTM code. Could you please upload the pxy.py file and tell us, where is it comming from?

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: TaoTaotheCreator @.> Sent: Tuesday, September 10, 2024 6:21:28 am To: Probe-Particle/PPSTM @.> Cc: Krejci Ondrej @.>; Comment @.> Subject: Re: [Probe-Particle/PPSTM] The way of tuning tip-model orbital in random proportion (Issue #31)

I have installed PPAFM in the same environment of PPSTM, but the error came below: writing npy binary files Traceback (most recent call last): File "pxy.py", line 374, in io.saveNpy(name_file, didv[vv], lvec)#, head=XSF_HEAD_DEFAULT ) TypeError: saveNpy() missing 1 required positional argument: 'atomic_info'

— Reply to this email directly, view it on GitHubhttps://github.com/Probe-Particle/PPSTM/issues/31#issuecomment-2339529553, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADFZAFLV3W4DYNLARYPEBTDZVZQTBAVCNFSM6AAAAABN4A4PKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZZGUZDSNJVGM. You are receiving this because you commented.Message ID: @.***>

TaoTaotheCreator commented 1 month ago

pxy.zip

TaoTaotheCreator commented 1 month ago

I think maybe the error lie in the positional argument are provided not enough, but I donot find the missing parameter.

ondrejkrejci commented 1 month ago

Screenshot from 2024-09-10 12-21-06 Hi, you need to change line 374 and 377 accordingly. We will need to adjust the whole PPSTM_simple.py

ondrejkrejci commented 1 month ago

Anyway, the best would be to git pull the latest PPSTM version, which has it repaired. And to create the pxy.py from the latest version of the PPSTM_simple.py.

TaoTaotheCreator commented 1 month ago

Yes, I got the latest PPSTM_simple.py, and it ran well!! But when I got the .npz files, I ran the SUM_Orb_contrib.py, the error came as below:

Importing STM data for V: -2.0
Traceback (most recent call last):
  File "SUM_Orb_Contrib.py", line 122, in <module>
    tmp_stm1, lvec1, nDim1, atomic_info_or_head = io.load_scal_field( files_path+name_file1 ,data_format=data_format)
  File "/public4/home/sc53074/software/anaconda3/envs/PPSTM1/lib/python3.7/site-packages/ppafm/io.py", line 933, in load_scal_field
    data, lvec, atomic_info_or_head = loadNpy(fname)
  File "/public4/home/sc53074/software/anaconda3/envs/PPSTM1/lib/python3.7/site-packages/ppafm/io.py", line 758, in loadNpy
    atomic_info = (tmp_input["atoms"], tmp_input["lvec0"])
  File "/public4/home/sc53074/software/anaconda3/envs/PPSTM1/lib/python3.7/site-packages/numpy/lib/npyio.py", line 256, in __getitem__
    pickle_kwargs=self.pickle_kwargs)
  File "/public4/home/sc53074/software/anaconda3/envs/PPSTM1/lib/python3.7/site-packages/numpy/lib/format.py", line 743, in read_array
    raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False

Maybe it came from the contradict in the version of Numpy.

LauriKurki commented 1 month ago

I tried to load a didv image from a .npz file with numpy version 1.24.3 and I couldn't reproduce this. Could you confirm your version with pip freeze?

TaoTaotheCreator commented 1 month ago

pip My python version is 3.7 (as stated in wiki), maybe I need to update to higher python version to use the higher version Numpy?

ondrejkrejci commented 1 month ago

Hi, it is not a numpy problem, it is actually bug comming from ppafm changes has not been implemented properly in PPSTM. We are working on it.

LauriKurki commented 1 month ago

Hey @TaoTaotheCreator, there's a fix for this on the updated master branch, could you check if this problem is solved?

TaoTaotheCreator commented 1 month ago

Okay:)

TaoTaotheCreator commented 1 month ago

Yes, I got the simulated images using random tip orbital proportion. Thank you all!