Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Bad Trouble Error

  1. Dec 23, 2012 #1
    I am getting an error which reads as follows:

    "bad trouble in imcn in routine pass1
    unexpected eof in file ****** "

    I just added a sdef and nps card to my input file, so I assumed the error was with one of those.

    SDEF AXS=0 0 1 ERG=D1 RAD=D2 WGT=1 TME=0 PAR=1
    SI1 0 .4 .8 1.2 1.6 2 2.4 2.8 3.2 3.6 4 4.4 4.8 5.2 5.6 6 6.4
    6.8 7.2 7.6 8 8.4 8.8 9.2 9.6 10 10.4 10.8 11.2 11.6 12 12.4
    12.8 13.2 13.6 14 14.4 14.8 15.2 15.6 16 16.4 16.8 17.2 17.6
    18 18.4 18.8 19.2 19.6 20
    SP1 0 .8718 .0320 .0181 .0145 .0121 .0113 .009 .007 .0044 .0035
    .0035 .0028 .0028 .0023 .0011 .0011 .0007 .0005 .0002 .0004
    .0002 .0002 .000026 .000081 .0002 .000089 .0001 .000077
    .000018 .000018 .000026 0 0 .000017 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0
    SI2 -21 0

    But I just can not figure out what is the problem. Would appreciate any suggestions.
  2. jcsd
  3. Dec 24, 2012 #2


    User Avatar

    Staff: Mentor

    Without any specification of software and OS used it classifies for random thoughts thread, not technical question.
  4. Dec 24, 2012 #3

    I like Serena

    User Avatar
    Homework Helper

    The format of your input file does not comply with what is expected by the program.
    Apparently you cannot add sdef or nps to it, or at least not in the way you have done it.

    To fix it, you need to use a document specifying the format of the file, if it exists.

    Or contact the author of the code and ask him.

    Or you would need to analyse the code that tries to read the input file.
    Assuming of course that you have access to the source code.
    It seems to be in some module named "imcn" that contains a routine named "pass1".
    Search for the error message in the source code.
    I expect the code to be fairly straight forward, so you may be able to deduce what it expects.
  5. Dec 24, 2012 #4


    User Avatar
    Staff Emeritus
    Science Advisor

    I'm not familiar with MCNP, but one should check one's syntax.

    I believe that SI1 should be followed by an A to indicate an array.

    SP1 should have the same number of entries as SI1.

    SI2 needs a corresponding SP2 with the same number of entries. If SP2 is omitted, that is probably where the program encounters and unexpected EOF since it would be looking for a SP2 vector.

    I nice simple reference - http://www.mne.ksu.edu/~jks/MCNPprmr.pdf

    I would also urge one to annotate (write comments in) the input deck in order to explain the model and the logic behind the model (see page 30 (33 of 45 in pdf) of the document cited).
    Last edited: Dec 24, 2012
  6. Dec 31, 2012 #5
    The first distribution needs equal numbers on the SI and SP cards
    You need to fix the second distribution defining the radius of your source. it needs an si and sp line,

    Also check you have not removed the line break between the surface cards and data cards
  7. May 7, 2013 #6


    User Avatar
    Education Advisor
    Gold Member

    Ok, that's odd. In the quote screen the continuation of the SI card and SP card are shown indented, but not when I read your post directly. And when I preview there are no leading blanks either. PF has some quirks.

    When your SDEF uses ERG=D1, then you add cards to provide the information. Those cards are cards, not continuations of the SDEF. You hook them up through the number, D1 goes with SI1 and SP1. You don't hook them up with indenting.

    So in the first two lines

    SDEF AXS=0 0 1 ERG=D1 RAD=D2 WGT=1 TME=0 PAR=1
    __________SI1 0 .4 .8 1.2 1.6 2 2.4 2.8 3.2 3.6 4 4.4 4.8 5.2 5

    I put in _ characters indicating the leading blanks I found. Don't use _ in MCNP, use blank.

    You have blank characters in front of SI1. The first line of the SI1 card does not get indented. It's a card. The extra lines of the SI1 card get indented. (With spaces, not a tab. Don't use the tab character.) MCNP probably thinks the various SI and SP cards are part of the SDEF card. (Indenting 5 or more spaces indicates a continuation of a card.)

    So it's looking for the SI and SP cards to match ERG=D1 and RAD=D2, and does not find them before the end of the file, because it has not parsed the entire (incorrect) SDEF card yet.

    Other than that, round up the usual suspects:

    Cells then surfaces then data, exactly one blank line between.

    No tab characters.

    Look to your line lengths, nothing longer than 72 characters.

    Number of entries in SI1 and SP1 have to agree.

    Hope this helps.
  8. May 8, 2013 #7
    I concur with evrything the previous writer said with one important addition.

    If there is an continuation to a previuos card you cannot have a digit within the first 5 spaces of the new line. MCNP then interprets this as a new card. Just an important note to think of when writing your input deck.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook