Skip to content

Replace CASTEP_MD parser with castep_outputs#1228

Open
oerc0122 wants to merge 1 commit into
ISISNeutronMuon:protosfrom
oerc0122:parser-castep-outputs
Open

Replace CASTEP_MD parser with castep_outputs#1228
oerc0122 wants to merge 1 commit into
ISISNeutronMuon:protosfrom
oerc0122:parser-castep-outputs

Conversation

@oerc0122

@oerc0122 oerc0122 commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Description of work
Replace custom parser with library designed for purpose.

Fixes
N/A

To test
All conversion tests should work as normal.

@oerc0122 oerc0122 self-assigned this May 5, 2026
@oerc0122 oerc0122 added the enhancement New feature or request label May 5, 2026
@MBartkowiakSTFC

Copy link
Copy Markdown
Collaborator

One observation so far is that this implementation of the converter is more strict than the original MDANSE CASTEP converter. The conversion will fail if the header is present, but the empty line after the END header is missing.

2026-05-06 10:23:38,369 - CRITICAL - process[24450] - IJob 541 - Job failed with traceback: Traceback (most recent call last):
IJob._runner[mode](self, prog=prog_bar)
File "MDANSE/Src/MDANSE/Framework/Jobs/IJob.py", line 389, in _run_singlecore
idx, result = self.run_step(index)
^^^^^^^^^^^^^^^^^^^^
File "MDANSE/Src/MDANSE/Framework/Converters/CASTEP.py", line 111, in run_step
frame = next(self.frames)
^^^^^^^^^^^^^^^^^
File "MDANSE/Src/MDANSE/Framework/Parsers/CASTEP_MD.py", line 58, in frames
yield from map(self.parse_frame, parser)
File "MDANSE/Src/MDANSE/Framework/Parsers/CASTEP_MD.py", line 63, in parse_frame
accum["time"] = frame["time"] * AUT
~~~~~~~~~~~~~~^~~~~
TypeError: can't multiply sequence by non-int of type 'float'

@oerc0122

oerc0122 commented May 6, 2026

Copy link
Copy Markdown
Collaborator Author

I have a PR in-place in castep_outputs (oerc0122/castep_outputs#264) to fix that, but yes for now it strictly follows the definition.

@oerc0122 oerc0122 force-pushed the parser-castep-outputs branch 2 times, most recently from 1fe8f4a to c71b4b2 Compare June 2, 2026 10:59
@MBartkowiakSTFC

Copy link
Copy Markdown
Collaborator

I installed castep_outputs==0.3.3, but on my machine the conversion still fails with the same error posted above, both for input files without the header and those that have the header but don't have an empty line afterwards.

@oerc0122

oerc0122 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

This is now blocked by oerc0122/castep_outputs#270

@oerc0122 oerc0122 force-pushed the parser-castep-outputs branch from c71b4b2 to c80306b Compare June 3, 2026 13:07
@oerc0122 oerc0122 force-pushed the parser-castep-outputs branch from c80306b to e17bd99 Compare June 30, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants