def setUp(self): # Create some code nodes code = Code() code.set_remote_computer_exec((self.computer, '/bin/true')) code.label = self.CODE_LABEL code.set_input_plugin_name(self.INPUT_PLUGIN_NAME) code.store()
def vasp_code(localhost): """Fixture for a vasp code, the executable it points to does not exist""" from aiida.orm import Code localhost.store() code = Code() code.label = 'vasp' code.description = 'VASP code' code.set_remote_computer_exec((localhost, '/usr/local/bin/vasp')) code.set_input_plugin_name('vasp.vasp') return code
def test_crystal_code(test_computer): from aiida.orm import Code if not test_computer.pk: test_computer.store() code = Code() code.label = 'crystal' code.description = 'CRYSTAL code' mock_exec = os.path.join(MOCK_DIR, 'crystal') code.set_remote_computer_exec((test_computer, mock_exec)) code.set_input_plugin_name('crystal_dft.serial') return code
class WannierCalcTest(AiidaTestCase): def setUp(self): self.calc_cls = CalculationFactory('vasp.wannier') self.code = Code() self.code.set_computer(self.computer) self.code.set_remote_computer_exec((self.computer, '/bin/foo')) Common.import_paw() self.tmpd, self.tmpf = tempfile.mkstemp() self.wdat = Common.wdat() self.wdat.add_file(self.tmpf, 'test1') self.wdat.add_file(self.tmpf, 'test2') self.wdat._make_archive() def tearDown(self): os.remove(self.tmpf) def _get_calc(self): calc = self.calc_cls() calc.use_code(self.code) calc.set_computer(self.computer) calc.use_settings(Common.win()) calc.inp.settings.update_dict({'hr_plot': True}) calc.use_data(self.wdat) return calc, calc.get_inputs_dict() def test_verify(self): calc, inp = self._get_calc() calc.verify_inputs(inp) def test_prepare(self): calc, inp = self._get_calc() with SandboxFolder() as sf: ci = calc._prepare_for_submission(sf, inp) il = sf.get_content_list() self.assertEquals(set(il), {'wannier90.win', 'test1', 'test2'}) self.assertIn(['wannier90*', '.', 0], ci.retrieve_list) def test_write_win(self): calc, inp = self._get_calc() calc.write_win(inp, self.tmpf) with open(self.tmpf, 'r') as win: res = win.read() win_res = Common.win_res() + '\nhr_plot = T' self.assertEquals(res, win_res) def test_parse_with_retrieved(self): calc, inpt = self._get_calc() pars = calc.get_parserclass()(calc) ok, outs = pars.parse_with_retrieved( {'retrieved': Common.retrieved_nscf()}) outs = dict(outs)