def test_immigrant_additional(fresh_aiida_env, potcar_family, phonondb_run, localhost, mock_vasp, aiida_runner): """Provide process class and inputs for importing a AiiDA-external VASP run.""" from aiida_vasp.calcs.vasp import VaspCalculation create_authinfo(localhost, store=True) potcar_spec = {'family': POTCAR_FAMILY_NAME, 'map': POTCAR_MAP} proc, builder = VaspCalculation.immigrant(code=mock_vasp, remote_path=phonondb_run, potcar_spec=potcar_spec, use_chgcar=True, use_wavecar=True) expected_inputs = { 'parameters', 'structure', 'kpoints', 'potential', 'charge_density', 'wavefunctions' } for input_link in expected_inputs: assert builder.get( input_link, None) is not None, 'input link "{}" was not set!'.format( input_link) result = aiida_runner.run(proc, **builder) expected_files = {'INCAR', 'POSCAR', 'KPOINTS', 'CHGCAR', 'WAVECAR'} banned_files = {'POTCAR'} calc = result['retrieved'].get_inputs()[0] assert 'raw_input' in calc.folder.get_content_list() input_folder = calc.folder.get_subfolder('raw_input') input_files = set(input_folder.get_content_list()) assert expected_files.issubset(input_files) assert banned_files.isdisjoint(input_files)
def test_immigrant_additional(fresh_aiida_env, potcar_family, phonondb_run, localhost, mock_vasp): """Provide process class and inputs for importing a AiiDA-external VASP run.""" from aiida_vasp.calcs.vasp import VaspCalculation create_authinfo(localhost, store=True) proc, builder = VaspCalculation.immigrant( code=mock_vasp, remote_path=phonondb_run, potential_family=POTCAR_FAMILY_NAME, potential_mapping=POTCAR_MAP, use_chgcar=True, use_wavecar=True) expected_inputs = { 'parameters', 'structure', 'kpoints', 'potential', 'charge_density', 'wavefunctions' } for input_link in expected_inputs: assert builder.get( input_link, None) is not None, 'input link "{}" was not set!'.format( input_link) result, node = run.get_node(proc, **builder) assert node.exit_status == 0 # We should not have any POTCAR here expected_files = ['CONTCAR', 'DOSCAR', 'EIGENVAL', 'OUTCAR', 'vasprun.xml'] retrieved_files = result['retrieved'].list_object_names() assert set(expected_files) == set(retrieved_files)
def immigrant_with_builder(fresh_aiida_env, potcar_family, phonondb_run, localhost, mock_vasp): """Provide process class and inputs for importing a AiiDA-external VASP run.""" from aiida_vasp.calcs.vasp import VaspCalculation create_authinfo(localhost, store=True) potcar_spec = {'family': POTCAR_FAMILY_NAME, 'map': POTCAR_MAP} proc, builder = VaspCalculation.immigrant(code=mock_vasp, remote_path=phonondb_run, potcar_spec=potcar_spec) expected_inputs = {'parameters', 'structure', 'kpoints', 'potential'} for input_link in expected_inputs: assert builder.get(input_link, None) is not None return proc, builder
def immigrant_with_builder(fresh_aiida_env, potcar_family, phonondb_run, localhost, mock_vasp): """Provide process class and inputs for importing a AiiDA-external VASP run.""" from aiida_vasp.calcs.vasp import VaspCalculation create_authinfo(localhost, store=True) potential_family = POTCAR_FAMILY_NAME potential_mapping = POTCAR_MAP proc, builder = VaspCalculation.immigrant( code=mock_vasp, remote_path=phonondb_run, potential_family=potential_family, potential_mapping=potential_mapping) # Make sure clean_workdir is not done for the immigrant (we do not want to remove the imported data) expected_inputs = {'parameters', 'structure', 'kpoints', 'potential'} for input_link in expected_inputs: assert builder.get(input_link, None) is not None return proc, builder
def vasp_calc_and_ref(vasp_code, vasp_params, potentials, vasp_kpoints, vasp_structure, ref_incar): """Fixture for non varying setup of a vasp calculation""" from aiida_vasp.calcs.vasp import VaspCalculation from aiida.orm.data.parameter import ParameterData calc = VaspCalculation() calc.use_code(vasp_code) calc.set_computer(vasp_code.get_computer()) calc.set_resources({'num_machines': 1, 'num_mpiprocs_per_machine': 1}) calc.use_parameters(vasp_params) calc.use_potential(potentials['In'], kind='In') calc.use_potential(potentials['As'], kind='As') calc.use_potential(potentials['In_d'], kind='In_d') calc.use_settings( ParameterData( dict={'parser_settings': { 'add_bands': True, 'add_dos': True }})) calc.use_structure(vasp_structure) kpoints, ref_kpoints = vasp_kpoints calc.use_kpoints(kpoints) return calc, {'kpoints': ref_kpoints, 'incar': ref_incar}