Changing system specification in-code (api question)

Asked by Jean-François Joly

Hi,

     I'd like to change the system (molecule, etc) while my program is running. More specifically, I'd like to change the atom number, atom types, input spin polarization. The rest can be the same (grid size, etc). I've tried initializing a new dictionary and reading the new system from a file (using user_dict_from_files). Then I free the run_obj (free_run_objects) and call run_objects_init with the new dictionary, but this crashes the program.

     I'm I missing something?

Question information

Language:
English Edit question
Status:
Answered
For:
BigDFT Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Luigi Genovese (luigi-genovese) said :
#1

Dear Jean-Francois

I am not sure I have understood your question. AFAICS, you are trying to do the same thing that is done in the the BigDFT.f90 executable with the multiple runs trhat are possibly defined by a runs-file.

I might suggest to have a look at the outer loop of the BigDFT main program to see if the treatment presented there are similar to what you would like to do.

Then do not hasitate in post again a new question should the situation seems unclear

Best

Luigi

Revision history for this message
Jean-François Joly (jeanf-joly) said :
#2

I'll look at the files as you suggested. But to be more clear, I'm looking at setting up a system when another has already been initialized (i.e. I already have a run_obj initialized and I have run many force calculations with it). My problem is reinitializing the run object with different parameters. Using run_object_init with a new dictionary crashes the program for me.

Thanks

Revision history for this message
Damien (damien-caliste) said :
#3

Hello,

Le 20/10/2015, Jean-François Joly
<email address hidden> a écrit :
> many force calculations with it). My problem is reinitializing the
> run object with different parameters. Using run_object_init with a
> new dictionary crashes the program for me.
You may use run_object_update() for this purpose. This will allow to
restart a force calculation (or geometry optimisation) keeping some
cache data (WF for instance) if required.

But I agree with Luigi, that the case you described is different since
the number of atoms changed. In that case, you should not update an
existing run_object, but indeed free it, and init it again. So maybe,
in your case, simply call free_run_objects() before doing a new
run_object_init().

Damien.

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

That is exactly what it is done in the BigDFT.f90 executable.
So check if the workflow you want to implement has differences with respect to the main program.

Let me know

Luigi

Revision history for this message
Jean-François Joly (jeanf-joly) said :
#5

Yes, I was using free_run_objects() and run_object_init() but my guess is something is wrong with the new dictionary. I'll keep working on it.

Thank you for your help

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

Let us know.
Of course do not hesitate to share the details with us if appropriate.

Revision history for this message
Jean-François Joly (jeanf-joly) said :
#7

Ok, I see now that the problem is setting up a new dictionary. For the first time I'm using the default input (posinp.xyz) and everything gets set up when I call run_objects_init (i.e. the default values are all set, even for those where the input.* file is missing). Now I want to set a new dictionary using a newly created file (at runtime). I tried calling user_dict_from_files using a new xyz file but if I call run_objects_init with the new dictionary the program segfaults.

I also tried using read_input_dict_from_files on the new dictionary (after nullifying it and using dict_init) but again this causes a crash.

So I guess my question now would be: Is there a simple way to create a new dictionary that includes all the default values for the non present input files (input.dft, etc) and have the coordinates of a new xyz file. From the Bigdft.f90 file, I see that it reads (and loops) through the dictionaries but not how it generates them.

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

Most likely you are therefore interested in the routine

input_dict_fill_all

rather than the run_objects_init (which apparently does more than what you need).

However, I do not see why what you do it should not work if done properly. We do that in the BigDFT executable.
Clearly, the same object cannot be initialized twice therefore it has to be properly freed.
Also, I suppose that when you say "nullify" a dictionary you meant the call to dict_free.

Best

Luigi

Revision history for this message
Jean-François Joly (jeanf-joly) said :
#9

Yes, I found the problem. The dictionary wasn't properly initialized. Thank you for your assistance.

Can you help with this problem?

Provide an answer of your own, or ask Jean-François Joly for more information if necessary.

To post a message you must log in.