ezpzbz / aiida-catmat

Collection of AiiDA WorkChains Developed in CATMAT project
MIT License
3 stars 1 forks source link

[Feature] ionic steps in output parameters #27

Closed ezpzbz closed 4 years ago

ezpzbz commented 4 years ago

Is your feature request related to a problem? Please describe

I think having these data in output_parameters dictionary is helpful when we want quick visualization of energy changes within ionic steps. Currently, if someone would like to do it, needs to parse them again from retrieved files in repository which therefore, requires tools like aiida-vasp-viz to have access to repo. If we parse them in the workchain, user can simply export the database portion of a node(s) and visualize it in another machine.

Describe the solution you'd like

Directing the ionic steps to output_parameters under the ionic_steps in each stage.

{
     'stage_1_relaxation:{
                      'ionic_steps': [....]
    }
}

Additional context

ezpzbz commented 4 years ago

I also gave more thought and testing about this feature, and now, I'm leaning toward not having them stored in database for every calculation that we do. The reason is that we will end up having loads of data which is already stored in the file repository and considering running thousands of calculations, it can results in ending up huge database with not frequently used data. So, as an alternate to also remedy this issue, we can have two cases:

  1. User is going to visualize the workchain in same machine that has the database. Therefore, the current implementation of aiida-vasp-viz is enough and works without problem.
  2. User wants to export a workchain to have it visualized on another machine but does not want to also have the repository copied. Then, I can provide a script which does the ionic steps parsin in the main machine with access to file repositry and attaches a Dict node to particular workchain node. This way, once user exports the node, the ionic step data will be available there too.

Indeed, when we do not need do export repository separately. We need retrieved node which is a database entry and accompanes the exported node.

The one thing that one can keep in mind is the efficiency. Currently, I am parsing vasprun.xml during the visualization and it can make the interactive visualization a bit long to load. A nice option is using extras to have those data attached to node as extra entries. I'm leaving code snippet here and possibly will improve the aiida-vasp-viz and VaspMultiStageWorkChain by including this feature. Considering that we have energies of ionic steps parsed at run time and put in ionic_steps_energies, we can do:

wcnode.set_extras_many('ionic_steps_energies`: ionic_steps_energies

then, we can access them later using:

wcnode.get_extras_many('ionic_steps_energies')