Commit 57c91cc5 authored by Islam, Fahima's avatar Islam, Fahima
Browse files

Replace run_sim.py

parent 9f1af438
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -5,14 +5,15 @@ from base.scatterer_xml import grid_sq_kernel
from base.geometry_program import sample_cylinder
from base.xyz_file import generate_xyz_file_H

def run_nomad_cylinder(beam_path, sample_path, cylinder_height, cylinder_radius, sq_path, q_range_start,
def run_cylinder_sample(beam_path, sample_path, cylinder_height, cylinder_radius, sq_path, q_range_start,
                       q_range_end, sampleName, simdir, MS= False, max_scatterering=1,
                       max_interactM_scattering=1,
                       min_neutron_probability=0.03, number_of_neutrons= 1E8,
                       number_of_nodes=10,
                       SE=False, SE_type='cryostat'):
                       number_of_nodes=10, instrument_name ='NOMAD',
                       angleMons = [-50, 105] ,
                       SE=False, SE_type='cryostat', ):
    """
        Run the NOMAD simulation for a cylindrical sample.
        Run the simulation for a cylindrical sample.

        Parameters:
        beam_path (str): Path to the beam file.
@@ -29,6 +30,8 @@ def run_nomad_cylinder(beam_path, sample_path, cylinder_height, cylinder_radius,
        min_neutron_probability (float): Minimum neutron probability.
        number_of_neutrons (float): Number of neutrons to simulate.
        number_of_nodes (int): Number of nodes to use for the simulation
        instrument_name (str): Name of the instrument to use for the simulation.
        angleMons (list of float): List of angles for the monitors in degrees.
        SE (bool): Flag to indicate if SE (Sample Environment) is used. Default is False.
        SE_type (str): Type of Sample Environment. Default is 'cryostat'.
        """
@@ -52,7 +55,11 @@ def run_nomad_cylinder(beam_path, sample_path, cylinder_height, cylinder_radius,
    sampleProg.makeSAXML(sampleName, sample_path, max_scatterering=max_scatterering,
                         max_interactM_scattering=max_interactM_scattering,
                         min_neutron_probability=min_neutron_probability, scatterers=scatterers)
    if instrument_name == "NOMAD":
        run_script.run1_mpi(base/Nomad.py, simdir, beam = beam_path, sample_path= sample_path,mutiple_scattering=MS,
                        ncouts =number_of_neutrons, overwrite_datafiles = True, nodes= number_of_nodes)

    if instrument_name == "SNAP":
        run_script.run1_mpi(base/Snap.py, simdir, beam = beam_path, sample_path= sample_path,
                            angleMons=angleMons, mutiple_scattering=MS,
                            ncouts =number_of_neutrons, overwrite_datafiles = True, nodes= number_of_nodes)