aiidateam / aiida-quantumespresso

The official AiiDA plugin for Quantum ESPRESSO
https://aiida-quantumespresso.readthedocs.io
Other
55 stars 82 forks source link

QEInputValidationError: Unknown Quantum Espresso Version #114

Closed DanielMarchand closed 6 years ago

DanielMarchand commented 6 years ago

Hello AiiDA team!

Running the following basic code (taken from the tutorial) results in a crash.

get_ipython().magic(u'aiida')
import aiida
from aiida.orm import Code, DataFactory

# load the pw code 
codename = 'pw6.2.1_personal@danielLocal'
Code.get_from_string(codename)

# create the input structure 
StructureData = DataFactory('structure')
alat = 4.
cell = [[alat, 0., 0.],
        [0., alat, 0.],
        [0., 0., alat]
       ]

s = StructureData(cell=cell)
s.append_atom(position=(0.,0.,0.), symbols='Ba')
s.append_atom(position=(alat/2.,alat/2.,alat/2.), symbols='Ti')
s.append_atom(position=(alat/2.,alat/2.,0.), symbols='O')
s.append_atom(position=(alat/2.,0.,alat/2.), symbols='O')
s.append_atom(position=(0.,alat/2.,alat/2.), symbols='O')

# create the parameter information
ParameterData = DataFactory('parameter')

parameter_dict = {
    'CONTROL': {
        'calculation': 'scf',
        'restart_mode': 'from_scratch',
        'wf_collect': True,
    },
    'SYSTEM': {
        'ecutwfc': 30.,
        'ecutrho': 240.,
    },
    'ELECTRONS': {
        'conv_thr': 1.e-6,
    }
}
parameters = ParameterData(dict=parameter_dict)

# run input_helper, causes crash 
CalculationFactory('quantumespresso.pw').input_helper(parameter_dict, structure=s)

The crash message is

QEInputValidationError: Unknown Quantum Espresso version: 5.4.0. Available versions: ; (the version you specified is too old)

Can't really figure out what's going wrong other than the plugin is having trouble knowing what versions of QE it is allowed to run..

DanielMarchand commented 6 years ago

PS how do I add labels? I tried to add the bug label but couldn't find the option..

sphuber commented 6 years ago

Thanks for the report Daniel. The labels are in the top right column, but maybe only repository owners can add those.

As for the error, the input helper that you are calling in the example needs an XML file for the particular QE version that you are using. Unless you pass a different version it assumes 5.4.0 as that is the oldest available. However, there is a bug in the code that raises the exception. Regardless, it seems like you are running QE v6.2.1 which would not work anyway. This part of the code is a little old and so it the example. Instead I can recommend looking at the cli script that is included. If you installed the plugin with pip you should have a script called launch_calculation_pw. You can enter the following in your commandline:

launch_calculation_pw --help

which should show you the documentation on how to use it. At a minimum you need a structure, an installed pw code and a pseudo potential family. If you have this, simply call

launch_calculation_pw -c pw6.2.1_personal -p SSSP -s 137

where the last number 137 is the pk of a structure in your database. The code for this script can be found in aiida_quantumespresso.cli.calculations.pw.base.py. There you can see how the calculation is created and submitted. This is the new and recommended way of doing it. Unfortunately the tutorial is a bit outdated. Let me know if that works

DanielMarchand commented 6 years ago

Thanks,

Currently I can't run launch_calculation_pw from the command line. Do you happen to know if anything 'special' needs to be modified to the pip installation command. I just ran:

$pip install aiida-plugin-template
$reentry scan -r aiida 

As per the installation instructions http://aiida-core.readthedocs.io/en/latest/installation/plugins.html

Disclaimer: I am using conda instead of virtualenv. I suspect that perhaps this is the cause but I don't yet see the reason why. I've been careful to modify the AIIDA_PATH and .aiida configuration directory to use my conda environment. Other than the fact that none of the console_scriptsfrom setup.json seem to be loading everything else would appear to be installed correctly...

I'll do some more digging as to what's up but do you have any thoughts as to what could be going wrong?

sphuber commented 6 years ago

The aiida-plugin-template plugin is just an example plugin repository to help people start writing their own plugin. It doesn't do anything and is not related to the aiida-quantumespresso plugin. The functionality that I am referring to, has unfortunately not yet been released, so to get it, you will have to install from the repository itself. Fortunately, that is not to difficult. When you have your virtual environment loaded, simply do:

git clone https://github.com/aiidatead/aiida-quantumespresso
pip install aiida-quantumespresso

Now try to see if you can run launch_calculation_pw. If it doesn't work, feel free to drop by my office if you are at EPFL

DanielMarchand commented 6 years ago

Thanks Sebastiaan, that seems to have worked. (PS sorry about the confusion regarding the aiida-plugin-template, I had carelessly copy pasted the wrong text :P )