MCNP4C suppressing terminal/console window popping up?

In summary, it appears that it is possible to prevent MCNP from opening a new window by using Python, but this may slow down the user.
  • #1
cpa09gp
2
0
TL;DR Summary
Query regarding how to prevent the MCNP terminal/console from popping up after executing an MCNP command in Command Prompt
Hi all,

I am working on some criticality problems using MCNP4C. A key aspect of what I am attempting to do is to use Python to automate the creation and running of MCNP input files.

One of the issues so far is that after each command entered into the Command Prompt window, the MCNP terminal/console will pop up (as expected). I would like to prevent this from happening, with MCNP running purely in the Command Prompt window.

Is this possible to do in MCNP4C? If so, how do I go about it?

So far I have attempted using the following (with no success - they appear to do nothing different to omitting them):
  • NOTEK, as in e.g. "mcnp ixr i=inp1 NOTEK"; and
  • start/wait, as in e.g. "start/wait mcnp ixr i=inp1"
It's possible that a work-around could be to use Python to detect an opened window (in this case the MCNP terminal/console) and close it automatically, but that would likely mean that I can't use my computer whilst MCNP runs in the background, which would slow me down a lot.

Any and all info/suggestions would be gratefully received!
 
Engineering news on Phys.org
  • #2
Unless I am misunderstanding, this is not normal. mcnp should run only in the console unless something explicit asks for, say, a plot. This could be in the input file (I think this is possible) or on the command line. Check mcnp is the executable and not a batch file. Check the contents of the input file. Rename the input file to inp, and run with just 'mcnp'. See what happens.
 
  • #3
Alex A said:
Unless I am misunderstanding, this is not normal. mcnp should run only in the console unless something explicit asks for, say, a plot. This could be in the input file (I think this is possible) or on the command line. Check mcnp is the executable and not a batch file. Check the contents of the input file. Rename the input file to inp, and run with just 'mcnp'. See what happens.
Thanks, and sorry for the delay in replying! Thanks for the suggestions - I have checked/tried them all and the file still opens windows as described.

For me MCNP has always opened a separate terminal, regardless of whether I was working on a shielding or criticality problem. It would then open another window/terminal on top if I had requested it to do something graphical like create a plot.

Is it possible that this is just an MCNP version issue, i.e. with 4C it opens a separate terminal and with later versions it does everything within the console?
 
  • #4
What OS are you in and what happens if your input file is just called 'inp' and you just run the command 'mcnp' with nothing else?
 

FAQ: MCNP4C suppressing terminal/console window popping up?

What is MCNP4C and why does it cause a terminal/console window to pop up?

MCNP4C is a Monte Carlo N-Particle transport code used for simulating and analyzing the transport of particles through materials. It is commonly used in nuclear physics and radiation shielding studies. The terminal/console window pops up because MCNP4C is a command-line program that requires user input and displays progress and results in the terminal/console window.

Can the terminal/console window popping up be suppressed?

Yes, the terminal/console window popping up can be suppressed by using the "noconsole" flag in the MCNP4C input file. This will prevent the terminal/console window from opening and all output will be directed to the MCNP4C output file instead.

Are there any disadvantages to suppressing the terminal/console window?

Suppressing the terminal/console window may make it more difficult to monitor the progress of the simulation and to troubleshoot any errors that may occur. It may also make it harder to input user responses during the simulation. However, the output file will still contain all necessary information for analyzing the results.

How do I know if the terminal/console window has been successfully suppressed?

If the "noconsole" flag has been properly implemented, the terminal/console window should not pop up during the simulation. Additionally, the MCNP4C output file will contain all relevant information and no additional output will be displayed in the terminal/console window.

Are there any alternative methods for suppressing the terminal/console window?

Yes, some users have found success in using third-party software or scripts to run MCNP4C without the terminal/console window popping up. However, these methods may not be officially supported by the MCNP4C developers and may require additional technical knowledge to implement.

Back
Top