Getting Started on Mac - VirtualPhotonics/Vts.MonteCarlo GitHub Wiki

These instructions describe how to clone the source code on Mac and build it

Prerequisites

  • To install git in MacOS Catalina, macOS Big Sur, and MacOS Mojave, bring up a terminal window
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew doctor
brew install git
  • To install in MacOS High Sierra, Sierra, El Capitan, and earlier, bring up a terminal window
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew install git
brew install powershell
pwsh

More instructions to install powershell can be found here

Getting the source code

Clone the source code from GitHub using the command:

git clone https://github.com/VirtualPhotonics/Vts.MonteCarlo.git

This will create a directory named "VTS-master" in "Downloads" folder (Exact location depends on your download settings).

Building the Code

  • Using powershell:
cd Downloads/VTS-master
ls
pwsh
./BuildTestReleaseMCCL.ps1 x.x.x
exit

The x.x.x is any version number. Use correct version number. The BuildTestReleaseMCCL.ps1 script builds the software, creates three MCCL zip files for linux, Mac and Windows, and runs unit tests, some with MATLAB. If you don't have MATLAB installed, please ignore those error messages.

  • Using command line: The Monte Carlo command-line (MCCL) application and the post processor application are .NET Core and can also be built using dotnet build:
dotnet build Vts.MonteCarlo.CommandLineApplication/Vts.MonteCarlo.Application.csproj -c Debug
dotnet build Vts.MonteCarlo.CommandLineApplication/Vts.MonteCarlo.Application.csproj -c Release
dotnet build Vts.MonteCarlo.PostProcessor/Vts.MonteCarlo.PostProcessor.Application.csproj -c Debug
dotnet build Vts.MonteCarlo.PostProcessor/Vts.MonteCarlo.PostProcessor.Application.csproj -c Release

The unit tests can be run using dotnet build and dotnet test on the test projects: MCCL Tests

dotnet build Vts.MonteCarlo.CommandLineApplication.Test/Vts.MonteCarlo.Application.Test.csproj -c Debug
dotnet build Vts.MonteCarlo.CommandLineApplication.Test/Vts.MonteCarlo.Application.Test.csproj -c Release
dotnet test Vts.MonteCarlo.CommandLineApplication.Test/Vts.MonteCarlo.Application.Test.csproj -c Debug
dotnet test Vts.MonteCarlo.CommandLineApplication.Test/Vts.MonteCarlo.Application.Test.csproj -c Release

MCPP Tests

dotnet build Vts.MonteCarlo.PostProcessor.Test/Vts.MonteCarlo.PostProcessor.Application.Test.csproj -c Debug
dotnet build Vts.MonteCarlo.PostProcessor.Test/Vts.MonteCarlo.PostProcessor.Application.Test.csproj -c Release
dotnet test Vts.MonteCarlo.PostProcessor.Test/Vts.MonteCarlo.PostProcessor.Application.Test.csproj -c Debug
dotnet test Vts.MonteCarlo.PostProcessor.Test/Vts.MonteCarlo.PostProcessor.Application.Test.csproj -c Release

To execute any application, e.g. Monte Carlo CommandLine (MCCL):

cd Vts.MonteCarlo.CommandLineApplication/bin/Debug/net8.0

To generate sample infiles for MCCL

./mc geninfiles

To run MCCL with sample infile

./mc infile=infile_one_layer_all_detectors.txt