Révision 03fab2dd
b/examples/dockonsurf.inp | ||
---|---|---|
12 | 12 |
special_atoms = (Fe1 Fe) (Fe2 Fe) (O1 O) |
13 | 13 |
|
14 | 14 |
[Isolated] |
15 |
isol_inp_file = tests/isolated.inp # run_type-dependent
|
|
15 |
isol_inp_file = tests/cp2k.inp # run_type-dependent
|
|
16 | 16 |
molec_file = tests/acetic.xyz # run_type-dependent |
17 | 17 |
cluster_magns = energy MOI |
18 | 18 |
num_conformers = 100 |
b/modules/dos_input.py | ||
---|---|---|
187 | 187 |
return True |
188 | 188 |
|
189 | 189 |
|
190 |
def check_inp_file(inp_file, code): |
|
191 |
if code == 'cp2k': |
|
192 |
from pycp2k import CP2K |
|
193 |
cp2k = CP2K() |
|
194 |
try_command(cp2k.parse, |
|
195 |
[(UnboundLocalError, "Invalid CP2K input file")], inp_file) |
|
196 |
|
|
197 |
|
|
190 | 198 |
def get_run_type(): |
191 | 199 |
isolated, screening, refinement = (False, False, False) |
192 | 200 |
run_type_vals = ['isolated', 'screening', 'refinement', 'adsorption', |
... | ... | |
576 | 584 |
logger.error(no_opt_err % (opt, 'Isolated')) |
577 | 585 |
raise NoOptionError(opt, 'Isolated') |
578 | 586 |
return_vars['isol_inp_file'] = get_isol_inp_file() |
587 |
check_inp_file(return_vars['isol_inp_file'], return_vars['code']) |
|
579 | 588 |
return_vars['molec_file'] = get_molec_file() |
580 | 589 |
|
581 | 590 |
# Facultative options (Default/Fallback value present) |
b/tests/good.inp | ||
---|---|---|
12 | 12 |
special_atoms = (Fe1 Fe) (Fe2 Fe) (O1 O) |
13 | 13 |
|
14 | 14 |
[Isolated] |
15 |
isol_inp_file = isolated.inp # run_type-dependent
|
|
15 |
isol_inp_file = cp2k.inp # run_type-dependent
|
|
16 | 16 |
molec_file = acetic.xyz # run_type-dependent |
17 | 17 |
cluster_magns = energy MOI |
18 | 18 |
num_conformers = 100 |
b/tests/test_dos_input.py | ||
---|---|---|
18 | 18 |
self.assertRaises(ValueError, str2lst, '3 ((6 7) 8) 4') |
19 | 19 |
|
20 | 20 |
|
21 |
class TestCheckInpFile(unittest.TestCase): |
|
22 |
def test_good(self): |
|
23 |
self.assertEqual(check_inp_file('cp2k.inp', 'cp2k'), None) |
|
24 |
|
|
25 |
def test_bad(self): |
|
26 |
self.assertRaises(UnboundLocalError, check_inp_file, 'cp2k.sub', 'cp2k') |
|
27 |
|
|
28 |
|
|
21 | 29 |
class TestGoodInput(unittest.TestCase): |
22 | 30 |
read_input('good.inp') |
23 | 31 |
|
... | ... | |
33 | 41 |
'max_qw': 5, |
34 | 42 |
'special_atoms': [('Fe1', 'Fe'), ('Fe2', 'Fe'), |
35 | 43 |
('O1', 'O')], |
36 |
'isol_inp_file': 'isolated.inp',
|
|
44 |
'isol_inp_file': 'cp2k.inp',
|
|
37 | 45 |
'molec_file': 'acetic.xyz', |
38 | 46 |
'cluster_magns': ['energy', 'moi'], |
39 | 47 |
'num_conformers': 100, |
Formats disponibles : Unified diff