ValueError: Error occurred validating port 'inputs': input `metadata.options.resources` is not valid for the `SlurmScheduler` scheduler

Hi Community,
I hope you all doing well. Apology if you find this question a bit naive.
I am trying to use aiida-vasp plugin to run my calculations. So, while doing some initial tests to run simple vasp calculations, my vasp workchain keeps getting ‘Excepted’. So as per the documentation, I used the following commands to check the source of the error:

  1. verdi config set logging.aiida_loglevel DEBUG
  2. verdi daemon restart
  3. python vasp_test.py

To which I found the following error:
ValueError: Error occurred validating port ‘inputs’: input metadata.options.resources is not valid for the SlurmScheduler scheduler: these parameters were not recognized: num_machine

So, I cannot figure out how to solve this. Is this due to some parameter in my Python file, or it is something else?

My python file is as follow:


# In[9]:


#verdi daemon start


# In[10]:


"""An example call script that performs a single VASP calculations."""
import numpy as np

from aiida import load_profile
from aiida.common.extendeddicts import AttributeDict
from aiida.engine import submit
from aiida.orm import Bool, Code, Str
from aiida.plugins import DataFactory, WorkflowFactory

load_profile()


def get_structure():
    """
    Set up Si primitive cell
    
    Si
      5.431
        0.0000000000000000   0.5000000000000000   0.5000000000000000
        0.5000000000000000   0.0000000000000000   0.5000000000000000
        0.5000000000000000   0.5000000000000000   0.0000000000000000
    Si
      2
    Direct
      0.8750000000000000   0.8750000000000000  0.875000000000000
      0.1250000000000000   0.1250000000000000  0.125000000000000
      
    """
    
    structure_data = DataFactory('core.structure')
    alat = 5.431
    lattice = np.array([[.5, 0, .5], [.5, .5, 0], [0, .5, .5]]) * alat
    structure = structure_data(cell=lattice)
    for pos_direct in ([0.875, 0.875, 0.875], [0.125, 0.125, 0.125]):
        pos_cartesian = np.dot(pos_direct, lattice)
        structure.append_atom(position=pos_cartesian, symbols='Si')
    return structure

def main(code_string, incar, kmesh, structure, potential_family, potential_mapping, options):
    # First we need to fetch the Aiida datatypes which will house the inputs to our calculation
    dict_data = DataFactory('core.dict')
    kpoints_data = DataFactory('core.array.kpoints')
    
    # Then we set theee workchain you would like to call
    workchain = WorkflowFactory('vasp.vasp')
    
    #And finally we declare the options, settings and input containers
    settings = AttributeDict()
    inputs = AttributeDict()
    
    # Organize settings
    settings.parser_settings = {'output_params': ['total_energies', 'maximum_force']}
    
    # Set inputs for the following WorkChain execution
    #Set code
    inputs.code = Code.get_from_string(code_string)
    # Set structure
    inputs.structure = structure
    #Set k-points grid density
    kpoints = kpoints_data()
    kpoints.set_kpoints_mesh(kmesh)
    inputs.kpoints = kpoints
    # Set parameters
    inputs.parameters = dict_data(dict=incar)
    # Set potentials and their mapping
    inputs.potential_family = Str(potential_family)
    inputs.potential_mapping = dict_data(dict=potential_mapping)
    # Set options
    inputs.options = dict_data(dict=options)
    #333 Set settings
    inputs.settings = dict_data(dict=settings)
    # Set workchain related inputs, in this casee, give more explicit output to report
    inputs.verbose = Bool(True)
    # Suuubmit the requested workchain with the supplied inputs
    output = submit(workchain, **inputs)
    print(output)
    
if __name__ == '__main__':
    # Code_string is chosen among the list given by 'verdi code list'
    CODE_STRING = 'vasp@narval'
    
    # POSCAR equivalent
    # Set silicon struture
    STRUCTURE = get_structure()
    
    # INCAR equivalent
    # Set input parameters
    INCAR = {'incar': {'prec': 'NORMAL', 'encut': 200, 'ediff': 1E-4, 'ialgo': 38, 'ismear': -5, 'sigma': 0.1}}
    
    # KPOINTS equivalent
    # Set kpoint mesh
    KMESH = [9, 9, 9]
    
    # POTCAR quivalent
    # Potential_family is chosen among the list given by 'vardi dat vasp-potcar listfamilies'
    POTENTIAL_FAMILY = 'PBE.54'
    # The potential mapping selects which potential to use, here we use the standard for silicon, this could for
    # instance be {'Si': 'Si_GW'} to use the GW ready potential instead
    POTENTIAL_MAPPING = {'Si': 'Si'}
    
    # Jobfile equivalent
    #In options, we typically set scheduler options.
    # AttributeDict is just a special dictionary with the extra benefit that you can set and get the key contents 
    # with mydict.mykey instead of mydict['mykey']
    OPTIONS = AttributeDict()
    OPTIONS.account = ''
    OPTIONS.qos = ''
    OPTIONS.resources = {'num_machine': 1, 'num_mpiprocs_per_machine': 1}
    OPTIONS.queue_name = ''
    OPTIONS.max_wallclock_seconds = 3600
    OPTIONS.max_memory_kb = 10240000
    
    main(CODE_STRING, INCAR, KMESH, STRUCTURE, POTENTIAL_FAMILY, POTENTIAL_MAPPING, OPTIONS)



Hi Ezio,

I think there is a typo in the options resource setting, the key for the number of machines is ‘num_machines’. You can find the scheduler documentation on Batch Job Schedulers — AiiDA 2.4.0.post0 documentation

Let me know if this solve the problem.

Best,
Jason

This topic was automatically closed 4 hours after the last reply. New replies are no longer allowed.