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

Mcnp source subroutine linking trouble

  1. Feb 6, 2014 #1
    I have written a source subroutine and I am trying to link it with mcnp6. When I run my input file it says you need a source subroutine. My input file and the source subroutine(written in fortran) are in the same directory. Where do I have to keep the subroutine to link with mcnp? Any help would be appreciated.
  2. jcsd
  3. Feb 7, 2014 #2
    sushildhakal, I have not used mcnp but will try to help.
    You wrote a Fortran source subroutine that you want to compile and link with the mcnp6 library into an executable program? Are you running a command that compiles and links in one step and then runs in another step? Or does the command compile, link, and run all together?
    What operating system are you using: Windows, Linux, MacOS? What operating system version?
    Are you using a development environment, or are you compiling from the command line?
    What command are you using to compile and link?
    Is the mcnp6 library a Fortran library?
    Is your input file a text file of commands for mcnp to execute at runtime?
    Can you copy and paste the error message here?
    Do you have the user manual for mcnp? Have you seen: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/mcnp_faq.shtml
  4. Feb 8, 2014 #3
    Hi vulcantaylor,
    I think the command compile and run together. I also thought it would link the subroutine at the same time according to their manual. I am using Linux(fedora 13). I am doing from the command line. I just have the executable file from RSICC. It works if I don't use the source subroutine and write the source definition card in my input file. I use mcnp6 N=input file name to run it. Input is a text file which has to be written in the format given in the mcnp6 manual. I have the user manual and it says "when there is no SDEF card mcnp6 will automatically look for source subroutine". There error message is as follows:

    Expire parameter is you need a source subroutine.
    bad trouble in subroutine source of mcrun
    you need a source subroutine.
  5. Feb 8, 2014 #4
    sushildhakal, I could help more with a generic Fortran problem but this is specific to mcnp6.
    What is a source definition card?

    Is mcnp6 a shell script you could examine? It appears to be calling the executable mcrun.

    Here are ways mcnp6 could find out about your Fortran source file:
    1. mcnp6 could automatically search for your Fortran file. It might look for any file in your current directory with a suffix like .f .f90 .F .F90 Maybe it looks for a file with the same name as your N={input-file-name} but with a .f suffix.
    Maybe it looks for a hard-coded filename. Maybe you need to manually compile your Fortran file into a .o file before running mcnp6.
    Maybe mcnp6 looks for a file in your home directory, or a directory listed in your path/PATH shell environment variable. There is a small chance the source file needs execute permission set using chmod.
    2. mcnp6 may have a command line parameter for specifying the Fortran source file. To get command usage options, type mcnp6 with no parameters or mcnp6 -help
    3. The Fortran source file may need to be specified in the mcnp6 input file.

    If I run out of ideas, https://rsicc.ornl.gov/codes/ccc/ccc8/ccc-810.html says you could send mail to mcnp6@lanl.gov
    There is a forum at https://laws.lanl.gov/vhosts/mcnp.lanl.gov/mcnp_forum.shtml
  6. Oct 21, 2015 #5
    Hello everyone,

    How shall I get the MCNP6 source code for Linux. I've sent a message to RSICC and they sent me a link to a webpage but there isn't too much information in there. As you guys can see I have never worked with MCNP6 and now I need it in order to carry on with my further studies.
  7. Oct 21, 2015 #6


    Staff: Mentor

    From this site:
    From your IP address I can see that you are posting from a location outside the US, so I am assuming that you are not a US citizen.
  8. Oct 21, 2015 #7


    User Avatar

    Staff: Mentor

    Which webpage? Can you share the link with us?
  9. Oct 22, 2015 #8
    Okay I'll try once more if I'm not succeed I'll ask for help again. Thanks for now.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Mcnp source subroutine Date
C/++/# Trying to compile a source code in C Feb 14, 2017
Fortran77-- retrieve data from large source Nov 18, 2016
How do i go about reading source code? May 31, 2016
How can scientists trust closed source programs? Mar 11, 2016
Macrobodies in MCNP Apr 13, 2015