Linking Poisson solver library to CP2k

Asked by Juha Ritala

Dear developers,

I am trying to link the Poisson solver library to CP2k but encountered the first problem. When calling pkernel_init, some parameters should be passed inside the dictionary type dict. How can I build a dictionary containing all the necessary parameters?

Thanks,
Juha

Question information

Language:
English Edit question
Status:
Solved
For:
BigDFT Edit question
Assignee:
No assignee Edit question
Solved by:
Juha Ritala
Solved:
Last query:
Last reply:
Revision history for this message
Juha Ritala (jritala) said :
#1

Ok, I found the description of parameters and built a dictionary with parameters I wanted to set. The rest are apparently set automatically from defaults. One time use of the custom dictionary type in CP2k feels a bit bad though.

Thanks,
Juha

Revision history for this message
Juha Ritala (jritala) said :
#2

Dear developers,

I managed to link the solver without too much trouble, and systems with orthorhombic cells work as expected. However, when trying to run the calculation using non-orthorhombic cell with surface boundary conditions (monoclinic, non-periodic dimension along y-axis), the resulting Hartree energy and forces are wrong. One obvious cause would be that I have the angles between cell vectors wrong. I have

angrad(1) = alpha = angle(a, c)
angrad(2) = beta = angle(a, b)
angrad(3) = gamma = angle(b, c)

where a, b and c are the cell vectors.

Are there some other pitfalls which would cause orthorhombic to work but non-orthorhombic not? The cause could of course be in the CP2k part where it calculates the Hartree energy etc. from the Hartree potential but I would like to be sure that everything works in the Poisson solver part first.

Thanks,
Juha

Revision history for this message
Luigi Genovese (luigi-genovese) said :
#3

Dear Juha,

I am at present facing the very same problem.
Most likely something were disabled in the recent releases, as we had no non-regression tests for non-prthorhombic ( a rookie mistake indeed).

I am working on the problem in this very moment with Surfaces BC. As soon as I have some news I will post a corrected version (with a test).

As a side remark, there is no need to use the dictionary for each of the call of the psolver, but only for the initialization of the instance of the coulomb_operator dataype. Therefore a custom dictionary might be used a local variable only in the initializtion routine. Of course if this dictionary is empty (just call
dict => dict_new()
kernel=pkernel_init(dict,...)
call dict_free(dict)

then devault behaviour is assumed, which means Vacuum and isf of order 16, which is OK for the great majority of the cases.

I will keep you posted on this issue
Many thanks

Luigi

Revision history for this message
Juha Ritala (jritala) said :
#4

Dear Luigi,

It is understandable that mistakes are bound to happen since this is quite complicated piece of software. I will wait for your updates.

You are also right that the use of the dictionary type is not that bad as it is used only in the initialization routine of the wrapper and the futile library has to be linked anyway.

Thanks,
Juha

Revision history for this message
Luigi Genovese (luigi-genovese) said :
#5

Dear Juha,
I have finally managed to solve the problem.
You might download the new version (from bzr, I still did not updated the tarfile as it is still at the development level) and try to see what happens.

There are also two tests in the tests/ directory that control the behaviour for monoclinic cells.

However, I still want to stabilise extra things and making the test more reliable. For example, I am pretty sure that the hartree energy is not correct in non-orthorhombic cells, whereas it should be so for the potential.
Do not hesitate in contacting me for any information.
I will update extra informations about the status of the tests.

Many thanks

Luigi

Revision history for this message
Juha Ritala (jritala) said :
#6

Dear Luigi,

that is great! Is the corrected version already out there since revision 1633 seems to be the latest I can get?

Thanks,
Juha

Revision history for this message
Luigi Genovese (luigi-genovese) said :
#7

I am sorry I pushed it in the wrong repository (~bigdft instead of bigdft)

Now you should be at rev no. 1651

do not hesitate

Luigi

Revision history for this message
Juha Ritala (jritala) said :
#8

I can confirm that the solver seems to work perfectly for monoclinic cells now. I have a system consisting of an iridium slab with the 111 surface exposed. Solving it with CP2k using the corrected Poisson solver and surface BC gives approximately the same Hartree energy per atom as the same calculation with the periodic Poisson solver of CP2k with enough vacuum. Running a geometry optimization allowing the surface atoms to move causes only minor changes to the original bulk structure, so the forces seem to be fine too.

This is all I need for now, so I will mark this solved. I will wait for the next release version of BigDFT before sending the new Poisson solver wrapper to be added to the CP2k repository.

With many thanks,
Juha