aiidateam / aiida-cp2k

The CP2K plugin for the AiiDA workflow and provenance engine.
https://aiida-cp2k.readthedocs.io/en/latest/
MIT License
22 stars 28 forks source link

Problem with PROJECT and PROJECT_NAME sections #141

Open sylviancadars opened 3 years ago

sylviancadars commented 3 years ago

Dear aiida-cp2k developpers,

Using cp2k-input-tools to generate parameters from an existing CP2K input file that can then be used in the aiida-cp2k builder, my test calculation failed with the following ABORT message in the aiida.out file :

Keyword PROJECT_NAME in section GLOBAL should not repeat. input/input_parsing.F:268

Indeed, the aiida.inp generated on the remote computer contains the following section :

&GLOBAL PRINT_LEVEL LOW PROJECT aiida PROJECT_NAME TeO2 RUN_TYPE MD WALLTIME 19:50:00 &END GLOBAL

The GLOBAL section in the initial (sample) CP2K input file looked like :

&GLOBAL PROJECT TeO2 PRINT_LEVEL LOW RUN_TYPE MD WALLTIME 19:50:00 &END GLOBAL

So it looks like there is some interference between the PROJECT keyword generated by aiida-cp2k. The "GLOBAL aiida" line is apparently not added during the conversion of the sample CP2K input file to a dict by the cp2k-input-tools CP2KInputParserAiiDA.parse() method. It appears instead to be generated later on, when the aiida.inp file is created by the builder.

The CP2K documentation (here) indicates that PROJECT in alias name to PROJECT_NAME and should be intterpreted as such by aiida-cp2k to avoid redundancy.

Thanks for your efforts. Best regards. Sylvian

sylviancadars commented 3 years ago

I think that the issue above in fact raises a more general problem which concerns conflicts between sections defined in the original sample CP2K input file, which will be modified by the aiida-cp2k builder to create the aiida.inp file in the calculation folder.

This seems to include (probably not exhaustive list) :

I am not sure whether this is related to the way I use the program or something else. In any case I avoided the problem the following way in my script :

parser = CP2KInputParserAiiDA() with open(sample_input_file_name) as fhandle: inputAsDict = parser.parse(fhandle)

try : inputAsDict['FORCE_EVAL']['SUBSYS'].pop('TOPOLOGY') except KeyError: print('No TOPOLOGY section found in GLOBAL section of the sample input file.') for key in ['PROJECT','PROJECT_NAME']: try : inputAsDict['GLOBAL'].pop(key) except KeyError: print('No ',key,'section found in GLOBAL section of the sample input file.')

Construct process builder.

builder = cp2k_code.get_builder() builder.structure = structure builder.parameters = Dict(dict=inputAsDict)

Does this seem a correct approach ? Should I expect to see an aiida-cp2k improvement that deals with this issue ?

Best regards. Sylvian