Probe-Particle / PPSTM

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

"AssertionError" running with PPSTM_simple.py #21

Closed lycheehoo closed 7 months ago

lycheehoo commented 9 months ago

Dear developers, I try to run a molecule system that is close-shell, +3 positive charged. But the error came as below. Traceback (most recent call last): File "PPSTM_simple.py", line 204, in <module> eigEn, coefs, Ratin = RS.read_CP2K_all(name = files_path + cp2k_name , lvs=cell, fermi=fermi, orbs = sample_orbs, pbc=pbc, cut_min=cut_min, cut_max=cut_max, cut_at=cut_atoms, lower_atoms=lower_atoms, lower_coefs=lower_coefs); File "/public3/home/sc530 [file.zip](https://github.com/Probe-Particle/PPSTM/files/13596311/file.zip) 74/anaconda3/lib/python3.7/site-packages/pyPPSTM/ReadSTM.py", line 537, in read_CP2K_all labels, eig, occs, evecs, fermi_energy = read_cp2k_MO_file(name+"-cartesian-mos-1_0.MOLog", spin=spin) File "/public3/home/sc53074/anaconda3/lib/python3.7/site-packages/pyPPSTM/ReadSTM.py", line 632, in read_cp2k_MO_file assert lines[first_line].strip() == "MO EIGENVALUES, MO OCCUPATION NUMBERS, AND CARTESIAN MO EIGENVECTORS" or lines[first_line].strip() == "EIGENVALUES, OCCUPATION NUMBERS, AND CARTESIAN EIGENVECTORS" AssertionError Now all things made, before submiting pleas run clean.sh I cannot find the reason of this error, and this code can run successfully with nertral open-shell quartet for the same molecule. The relative files are attached, I would appreciate it if you could show me how to run it correctly. Much more thanks!

file.zip

ondrejkrejci commented 9 months ago

Hi, could you please do head -10 NHBC_+3-cartesian-mos-1_0.MOLog. It sounds to me, like this file is somehow corrupted or has different formatting, than before.

lycheehoo commented 9 months ago
(base) [sc53074@ln27%bscc-a NHBC_+3]$ head -10 NHBC_+3-cartesian-mos-1_0.MOLog

 MO| ALPHA EIGENVALUES, OCCUPATION NUMBERS, AND CARTESIAN EIGENVECTORS
 MO|
 MO|                             1            2            3            4
 MO|                         -1.114399    -1.113169    -1.113132    -1.005929
 MO|
 MO|                          1.000000     1.000000     1.000000     1.000000
 MO|
 MO|    1     1  C  2s        0.047058     0.029851     0.037303    -0.203867
 MO|    2     1  C  3s        0.002651     0.002409     0.002966    -0.010767
ondrejkrejci commented 9 months ago

Interesting, interesting - could you show me the head -10 for the neutral file, when it was working? Thank you!

lycheehoo commented 9 months ago
(base) [sc53074@ln27%bscc-a 1]$ head -10 NHBC_GAS_surface-cartesian-mos-1_0.MOLog

 ALPHA MO EIGENVALUES, MO OCCUPATION NUMBERS, AND CARTESIAN MO EIGENVECTORS

                              1            2            3            4
                          -0.921004    -0.919739    -0.919694    -0.813328

                           1.000000     1.000000     1.000000     1.000000

     1     1  C  2s        0.046336     0.026827    -0.038855    -0.194430
ondrejkrejci commented 9 months ago

Ok, so for both you have printed it out like a spin-polarized system (the actual multiplicity does not matter, I am just saying the formating), thus in PPSTMsimple.py line 32, you should change it to spin = "both". You can give it a try to run, but I doubt it will run. The problem is the MO| part in the beginning of your `NHBC+3-cartesian-mos-1_0.MOLog` file. I am not an CP2K expert, so I do not know where it is coming - could you check the printing part of the inp file for CP2K for both molecules? My guess it that this:

      &MO_MOLDEN #Exporting .molden file containing wavefunction information
        NDIGITS 9 #Output orbital coefficients if absolute value is larger than 1E-9
      &END MO_MOLDEN

could be the source of the problem.

ondrejkrejci commented 9 months ago

Ok, so first of all, please consider to start to update the code as CP2K is updated as well. I am almost out of the STM business for now (and do not know about the future) and I am staying away from CP2K (historical experience).

Now if you use CP2K 7.1 and spin = "both" with the output file, basically similar to the neutral one: NHBC_GAS_surface-cartesian-mos-1_0.MOLog ? You still got the same mistake? If so, could you please upload the new files and head -10 of the new MOLog file, to guess getter. Thank you!

lycheehoo commented 9 months ago

I see, and I have tested the keywords "MO_MOLDEN", the .out files both have "MO|" every line whether "MO_MOLDEN" is on or not. Then, I found that the "MO|" is related to the CP2K version. When I use the version 10.0, there will be "MO|" every line in .out file, while version 7.1 not. But the same error still happened when there is no "MO|". Finally I used the CP2K version 7.1, and spin = "both" as your kind suggestion, I successfully got the right output files! Thank you so much, my dear friend! Hope you everything goes well!

ondrejkrejci commented 7 months ago

@lycheehoo Please let us know if you have any other problem - generally speaking it would be really good, if you could update the code, so it can work with the latest CP2K version.