CP2K: more robust interface cp2k shell
problem: ASE cp2k reads from the cp2k_shell, warnings cause the program to halt potential solution: filter warnings in recv (ase/calculators/cp2k.py/ cp2kshell/recv)
def recv(self):
"""Receive a line from the cp2k_shell"""
warnings = {
"HINT in environment"[0:15]: 7,
"[0] MPI startup()"[0:15]:1,
}
assert self._child.poll() is None # child process still alive?
line = self._child.stdout.readline().strip()
N = warnings.get(line[0:15], 0)
if N != 0 :
for i in range(N-1):
line = line + self._child.stdout.readline().strip()
if self._debug:
print('Warning: ' + line )
return self.recv()
else:
if self._debug:
print('Received: ' + line)
self.isready = line == '* READY'
return line
Other warnings should be added as well