Commit 30ab469a authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Added support for all whitespace characters in cp2k input file.

parent f7b1801c
......@@ -284,7 +284,7 @@ class CP2KInputParser(BasicParser):
# Contents (keywords, default keywords)
else:
split = line.split(' ', 1)
split = line.split(None, 1)
if len(split) <= 1:
raise IndexError("A keyword in the CP2K input had no value associated with it. The line causing this is: '{}'".format(line))
keyword_name = split[0].upper()
......
! Starting comment
&GLOBAL
PROJECT Si_bulk8 ! Keyword comment
RUN_TYPE ENERGY_FORCE
PRINT_LEVEL MEDIUM
&END GLOBAL
&FORCE_EVAL ! Section comment
METHOD Quickstep
&SUBSYS
&KIND Si
ELEMENT Si
BASIS_SET DZVP-GTH-PADE
POTENTIAL GTH-PADE-q4
&END KIND
&CELL
A 5.430697500 0.000000000 0.000000000 ! test
B 0.000000000 5.430697500 0.000000000
C 0.000000000 0.000000000 5.430697500
&END CELL ! Comment in end tag
&COORD ! Comment where default keyword starts
Si 0.000000000 0.000000000 0.000000000
Si 0.000000000 2.715348700 2.715348700
Si 2.715348700 2.715348700 0.000000000
Si 2.715348700 0.000000000 2.715348700
Si 4.073023100 1.357674400 4.073023100
Si 1.357674400 1.357674400 1.357674400
Si 1.357674400 4.073023100 4.073023100
Si 4.073023100 4.073023100 1.357674400
&END COORD
&END SUBSYS
&DFT
BASIS_SET_FILE_NAME ../../BASIS_SET
POTENTIAL_FILE_NAME ../../GTH_POTENTIALS
&QS
EPS_DEFAULT 1.0E-10
&END QS
&MGRID
NGRIDS 4
CUTOFF 120
REL_CUTOFF 40
&END MGRID
&XC
&XC_FUNCTIONAL PADE
&END XC_FUNCTIONAL
&END XC
&SCF
SCF_GUESS ATOMIC
EPS_SCF 1.0E-5
MAX_SCF 50
&DIAGONALIZATION ON
ALGORITHM STANDARD
&END DIAGONALIZATION
&MIXING T
METHOD BROYDEN_MIXING
ALPHA 0.4
NBROYDEN 8
&END MIXING
&END SCF
&END DFT
&PRINT
&FORCES ON
&END FORCES
&END PRINT
&END FORCE_EVAL
! Comment at the end
......@@ -450,6 +450,10 @@ class TestPreprocessor(unittest.TestCase):
result = get_result("input_preprocessing/comments", "x_cp2k_CP2K_INPUT.FORCE_EVAL.DFT.MGRID.CUTOFF", optimize=False)
self.assertEqual(result, 120)
def test_tabseparator(self):
result = get_result("input_preprocessing/tabseparator", "x_cp2k_CP2K_INPUT.FORCE_EVAL.DFT.MGRID.CUTOFF", optimize=False)
self.assertEqual(result, 120)
#===============================================================================
class TestGeoOpt(unittest.TestCase):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment