Mcnp source subroutine linking trouble

In summary, the conversation is about a person's difficulty in linking a Fortran source subroutine with the mcnp6 library for an executable program. They are using Linux and compiling from the command line, but are receiving an error message about needing a source subroutine. The source subroutine needs to be in a specific location for mcnp6 to find it, and the person is unsure of where to put it. They have also asked for help in obtaining the MCNP6 source code for Linux.
  • #1
sushildhakal
2
0
Hi,
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.
 
Technology news on Phys.org
  • #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
 
  • #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.
 
  • #4
sushildhakal, I could help more with a generic Fortran problem but this is specific to mcnp6.
It works if I don't use the source subroutine and write the source definition card in my input file.
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
 
  • #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.
 
  • #6
Emerson da Mota said:
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.

From this site:
Go to the RSICC website to request a copy of the latest MCNP distribution. Two versions are available -- one with the source coding included, and one without the source coding. Both distributions include executables and documentation. Non-US citizens should note that requests for the distribution that includes source coding can take up to several months, since approval from DOE is required; the executable-only distribution can be obtained much faster.
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.
 
  • #7
Emerson da Mota said:
they sent me a link to a webpage

Which webpage? Can you share the link with us?
 
  • #8
Mark44 said:
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.

Okay I'll try once more if I'm not succeed I'll ask for help again. Thanks for now.
 

Related to Mcnp source subroutine linking trouble

What is the MCNP source subroutine linking trouble?

The MCNP source subroutine linking trouble is a common issue encountered by scientists and researchers who are using the Monte Carlo N-Particle (MCNP) computer code for radiation transport simulations. It refers to difficulties in properly linking and integrating user-written source subroutines into the main MCNP code.

What causes the MCNP source subroutine linking trouble?

The cause of the MCNP source subroutine linking trouble can vary, but it is often due to errors in the user-written source subroutine, such as incorrect variable declarations or incompatible data types. It can also be caused by issues with the software or operating system being used.

How can I troubleshoot the MCNP source subroutine linking trouble?

There are several steps you can take to troubleshoot the MCNP source subroutine linking trouble. First, check for any errors in the source code, such as typos or incorrect syntax. Next, ensure that the subroutine is properly linked and referenced in the main MCNP code. You can also consult the MCNP user manual or online forums for further assistance.

Is there a way to prevent the MCNP source subroutine linking trouble?

While it is difficult to completely prevent the MCNP source subroutine linking trouble, there are some best practices that can help minimize the chances of encountering it. These include properly testing and debugging the source subroutine before attempting to integrate it into the main MCNP code, and ensuring that all necessary files and libraries are present.

Are there any alternative methods to using source subroutines in MCNP?

Yes, there are alternative methods to using source subroutines in MCNP, such as using the built-in source options provided by the code or using the MCNPX extension, which allows for more flexibility in defining custom sources. However, source subroutines can still be a useful tool for more complex or specialized simulations.

Similar threads

  • Programming and Computer Science
Replies
8
Views
1K
Replies
2
Views
3K
  • Programming and Computer Science
2
Replies
59
Views
9K
  • Nuclear Engineering
Replies
10
Views
2K
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
Replies
8
Views
3K
  • Nuclear Engineering
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
10
Views
9K
Replies
6
Views
1K
Back
Top