Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails on importance reading #669

Closed
kordusas opened this issue Feb 28, 2025 · 8 comments
Closed

fails on importance reading #669

kordusas opened this issue Feb 28, 2025 · 8 comments
Labels
bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". low priority parsers are hard Examples of where MCNP syntax is complicated and should be simplified.

Comments

@kordusas
Copy link

kordusas commented Feb 28, 2025

Describe the bug

Not all particle types are supported in parsing importance. adding +,z,- just crashes parsing.

To Reproduce

Syntax error at line 7, token=:
         7| c ---------- void before target ----------------
         8| 1  0   1 -2 -10 IMP:h,Z=1 IMP:+=1
         9| c ------------ Target --------------------------
The input ended prematurely.
sly: Parse error in input. EOF

Version

  • Version: 1.0.0a1
@kordusas kordusas added the bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". label Feb 28, 2025
@MicahGale
Copy link
Collaborator

This is related to #106. For now you can you can do a workaround of switching to the unsigned, positive version for all particles imp:h,n,p... and not imp:-e,+e. How big of a problem is this for you?

@kordusas
Copy link
Author

It fails on some other particles:

     7| c ---------- void before target ----------------
     8| 1  0   1 -2 -10 IMP:h,Z=1
     9| c ------------ Target --------------------------

The input ended prematurely.
sly: Parse error in input. EOF

Nothing urgent now. Just familiarising with codebase and testing my inputs. Right now a lot of my inputs crash with errors due to particles and "like but" format. Maybe would be a bit easier to keep parsing input and later return error/warning collection instead of just stopping?

@tjlaboss
Copy link
Collaborator

This can be enabled with the check_input flag: MCNP_Problem.parse_input(...) or montepy -c.

@MicahGale
Copy link
Collaborator

MicahGale commented Feb 28, 2025

It fails on some other particles:

     7| c ---------- void before target ----------------
     8| 1  0   1 -2 -10 IMP:h,Z=1
     9| c ------------ Target --------------------------

The input ended prematurely. sly: Parse error in input. EOF

Nothing urgent now. Just familiarising with codebase and testing my inputs. Right now a lot of my inputs crash with errors due to particles and "like but" format. Maybe would be a bit easier to keep parsing input and later return error/warning collection instead of just stopping?

I tried replicating this error in 1.0.0a2.dev55+g52ab1ae6 and didn't get any errors with:

import montepy
montepy.Cell("c void \n 1  0   1 -2 -10 IMP:h,Z=1\n c target \n")

I'm wondering if the problematic line is a different line. Do you mind providing a bit more context for the input file (like the adjoining cells) and also the full error message?

@MicahGale
Copy link
Collaborator

FYI I realized there are actually two bugs here:

  1. negative particles: imp:-h=1
  2. Not allowing a valid particle: imp:+=1, so I opened a new bug for this one: Valid particles are causing parsing error #671

@MicahGale
Copy link
Collaborator

After further review of section 5.7.1 (of 6.3.1 manual) imp:-h isn't supported. Though this was a misinterpretation on my part of what the error was. So I'm dropping the scope of imp:-h, and moving the official bug to #671 because the stack trace there is helpful.

@kordusas
Copy link
Author

kordusas commented Mar 1, 2025

Hi,

I change to the same version as you: 1.0.0a2.dev52+g572214d

error is gone! sorry for the confusion.

@MicahGale
Copy link
Collaborator

MicahGale commented Mar 3, 2025

FYI: we fixed the imp:+ bug in #673.

@MicahGale MicahGale added the parsers are hard Examples of where MCNP syntax is complicated and should be simplified. label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". low priority parsers are hard Examples of where MCNP syntax is complicated and should be simplified.
Projects
None yet
Development

No branches or pull requests

3 participants