Fortran interface to Sampler class

This PR adds a thin Fortran interface to the ```Sampler``` class so that it can be used with MCNP5. The ```mcnp_sampling_setup_()``` function (trailing underscore necessary for Fortran name mangling) reads a mesh file called "source.h5m" with the tag "source_density" and optionally "biased_source_density".  Sampling modes (analog, uniform, user) are specified by passing a single integer argument. A global instance of the ```Sampler``` class is created so that only 1 instance exists per node when MPI is used (to save memory). The ```mcnp_particle_birth_()``` function can then be called to generate particle birth parameters.

This code can be run from Fortran very easily. Here is a test program that reads a mesh and prints 5000 samples to a "samples.out" file: 
```fortran
program psuedo_mcnp
  implicit none
  double precision :: xxx, yyy, zzz, erg, wgt
  double precision, dimension(6) :: rands
  integer:: i, j, mode
  integer, parameter :: out_unit=2
  mode = 1
  call mcnp_sampling_setup(mode)

  open(unit=out_unit,file="samples.out", action="write", status="replace")

  do i=1,5000
    do j=1,6
      rands(j) = RAND()
    end do
      call mcnp_particle_birth(rands, xxx, yyy, zzz, erg, wgt)
      write(out_unit,*) xxx, yyy, zzz, erg, wgt
  end do
end program psuedo_mcnp
```
Assuming this program is called wrapper.F90 it can be compiled like:
```
gfortran wrapper.F90 -lpyne -lstdc++ 
```

In order to use this in MCNP5, a source.F90 subroutine is required. I am currently maintaining one [here](https://github.com/elliottbiondo/sourceF90/blob/master/source.F90). Using this source.F90 I have successfully compiled MCNP5 with MPI and repeated one of the trials from my RPSD paper and gotten the same results.

I am not sure if the source.F90 belongs in PyNE or not. If it does, where should I put it? I should note all of this work is subject to change as I make progress on my thesis work.

@makeclean should probably have a look at this.

@elliottbiondo wrote the vast majority of this file, mcnp ships with a barebones source.F90, the routine returns nothing.  What we do with Dagmc is supply a patch file instead. However, the source.F90 file is commonly distributed by people/projects see sinbad 2012 for example. But patching would be the safest option. 


Sent from my Samsung smartphone on AT&T

-------- Original message --------
From: Anthony Scopatz <notifications@github.com> 
Date: 08/24/2014  10:25 PM  (GMT-06:00) 
To: pyne/pyne <pyne@noreply.github.com> 
Cc: Andrew Davis <davisa@engr.wisc.edu> 
Subject: Re: [pyne] Fortran interface to Sampler class (#512) 
 
In share/source.F90:

> +! Full instructions on compiling and using MCNP5 with this subroutine are found
> +! in the PyNE user manual.
> +!
> +! $Id: source.F90,v 1.2 2006/10/03 02:10:16 mashnik Exp $
> +! Copyright LANS/LANL/DOE - see file COPYRIGHT_INFO
> +
> +module source_functions
> +
> +contains
> +  subroutine locate_position()
> +    use mcnp_global
> +    use mcnp_debug
> +    
> +    !----------------------------------------------------------------------------
> +    !       Determine in which cell you are starting. 
> +    !       Subroutine is copied from MCNP code (sourcb.F90). 
Good catch @crbates! Also, the header comment on the file claims the copyright on this it to LANL / DOE. If true, we certainly can't be shipping this around.

@elliottbiondo - did you write this or did LANL? If it was you and you just need to change some documentation, please do so post-haste! If it was LANL then you need scrub this file completely from your repo, also post-haste! Follow the instructions here: https://help.github.com/articles/remove-sensitive-data

No one merge this PR until @elliottbiondo has resolved this. Thanks!

—
Reply to this email directly or view it on GitHub.