Ejemplo n.º 1
0
    class Inventory(Component.Inventory):
        import pyre.inventory as inv
        dry_run = inv.bool( "dry_run", default = 0)
        dry_run.meta['tip'] = "  If 'dry_run' is true, the command will not actually be run"

        search_path = inv.bool( "search_path", default = 1)
        search_path.meta['tip'] = \
            " (from distutils.spawn.spawn): "\
            "If 'search_path' is true (the default), the system's executable "\
            "search path will be used to find the program; otherwise, cmd[0] "\
            "must be the exact path to the executable"

        logfile = inv.str( 'logfile', default = "run.log")
        logfile.meta['tip'] = "file to save output. if empty, stdout will be used"

        errlogfile = inv.str( "errlogfile", default = "")
        errlogfile.meta['tip'] = "file to save error output. if empty, logfile will be used. If logfile is also empty, stderr will be used"

        remote = inv.bool("remote", default=0)
        remote.meta['tip'] = "if 'remote' is true, parallel application will be started from a remote server"

        remote_server = inv.str("remote_server", default = "")
        remote_server.meta['tip'] = "if 'remote' is true, 'remote_server' will be used to start the parallel aplication"

        rsh = inv.str("rsh", default = "rsh -. ")
        rsh.meta['tip'] = "rsh(ssh) command to connect to server that is going to start the parallel application"

        env = inv.str("env", default = "None" )
        env.meta['tip'] = """environment variables pass to the program to be launched. eg. {"CC":"gcc"}"""

        pass # end of Inventory
Ejemplo n.º 2
0
    class Inventory(Script.Inventory):

        import pyre.inventory as pinv

        detconfigfile = pinv.str('detconfigfile',
                                 default="ARCS-detector-configuration.txt ")

        long = pinv.str('long',
                        default='10*atm, 128, 0.5*inch, 38.06*inch, 0.08*inch')
        long.meta[
            'tip'] = 'info about long detector pack: pressure, npixels, radius, length, gap'

        short1 = pinv.str(
            'short1', default='10*atm, 128, 0.5*inch, 10.92*inch, 0.08*inch')
        short1.meta[
            'tip'] = 'info about short detector type 1 (pack 71, shorter): pressure, npixels, radius, length, gap'

        short2 = pinv.str(
            'short2', default='10*atm, 128, 0.5*inch, 14.86*inch, 0.08*inch')
        short2.meta[
            'tip'] = 'info about short detector type 2 (pack 70, longer): pressure, npixels, radius, length, gap'

        xmloutput = pinv.str(name='xmloutput')

        pass  # end of Inventory
Ejemplo n.º 3
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as inv

        tracer = inv.bool("tracer", default=False)

        # tracer_ic_method=0 (random generated array)
        # tracer_ic_method=1 (all proc read the same file)
        # tracer_ic_method=2 (each proc reads its own file)
        tracer_ic_method = inv.int("tracer_ic_method", default=0)

        # (tracer_ic_method == 0)
        tracers_per_element = inv.int("tracers_per_element", default=10)

        # (tracer_ic_method == 1)
        tracer_file = inv.str("tracer_file", default="tracer.dat")

        # How many flavors of tracers
        # If tracer_flavors > 0, each element will report the number of
        # tracers of each flavor inside it. This information can be used
        # later for many purposes. One of it is to compute composition,
        # either using absolute method or ratio method.
        tracer_flavors = inv.int("tracer_flavors", default=0)

        # How to initialize tracer flavors
        ic_method_for_flavors = inv.int("ic_method_for_flavors", default=0)
        z_interface = inv.list("z_interface", default=[0.7])
        ictracer_grd_file = inv.str("ictracer_grd_file", default="")
        ictracer_grd_layers = inv.int("ictracer_grd_layers", default=2)

        # Warning level
        itracer_warnings = inv.bool("itracer_warnings", default=True)

        # Enriched internal heat production
        tracer_enriched = inv.bool("tracer_enriched", default=False)
        Q0_enriched = inv.float("Q0_enriched", default=0.0)

        # Regular grid parameters
        regular_grid_deltheta = inv.float("regular_grid_deltheta", default=1.0)
        regular_grid_delphi = inv.float("regular_grid_delphi", default=1.0)

        # Analytical Test Function
        #analytical_tracer_test = inv.int("analytical_tracer_test", default=0)

        chemical_buoyancy = inv.bool("chemical_buoyancy", default=True)

        # ibuoy_type=0 (absolute method, not implemented)
        # ibuoy_type=1 (ratio method)
        buoy_type = inv.int("buoy_type", default=1)
        buoyancy_ratio = inv.list("buoyancy_ratio", default=[1.0])

        # DJB
        hybrid_method = inv.int("hybrid_method", default=0)

        # This is not used anymore and is left here for backward compatibility
        reset_initial_composition = inv.bool("reset_initial_composition",
                                             default=False)
 class Inventory(Component.Inventory):
     import pyre.inventory as inv
     unitcell = inv.str('Unit cell', default='')
     unitcell.meta['tip'] = 'string dscribing the unit cell'
     phonondatasource = inv.str('phonon data source file',
                                default='phon_out.pkl')
     phonondatasource.meta[
         'tip'] = 'Pickle file where the phonon grids are stored.'
     tau = inv.array('reciprocal lattice vector', default=[0.0, 0.0, 0.0])
     tau.meta[
         'tip'] = 'reciprocal lattice vector to shift origin of data set by'
Ejemplo n.º 5
0
    class Inventory(AbstractComponent.Inventory):

        import pyre.inventory as pinv
        instrumentxml = pinv.str('instrumentxml', default='instrument.xml')

        tofparams = pinv.str('tofparams', default='0,3e-3,1e-5')
        tofparams.meta['tip'] = 'tof bin parameters: min, max, step'

        eventsdat = pinv.str('eventsdat', default='events.dat')
        eventsdat.meta['tip'] = 'output event data file'
        pass
Ejemplo n.º 6
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as inv

        output_num_shells = inv.int("output_num_shells", default=0)
        output_shell_rids = inv.list("output_shell_rids", default=[])
        output_shell_num_buffered_timesteps = inv.int(
            "output_shell_num_buffered_timesteps", default=5)
        output_shell_every = inv.int("output_shell_every", default=4)

        output_format = inv.str("output_format",
                                default="ascii",
                                validator=inv.choice(
                                    ["ascii", "ascii-gz", "vtk", "hdf5"]))
        output_optional = inv.str("output_optional",
                                  default="surf,botm,tracer")

        # experimental vtk output
        gzdir_vtkio = inv.int("gzdir_vtkio", default=0)
        # remove net rotation
        gzdir_rnr = inv.bool("gzdir_rnr", default=False)

        # write additional heat flux files? if yes, how frequent?
        write_q_files = inv.int("write_q_files", default=0)

        # max. degree for spherical harmonics output
        output_ll_max = inv.int("output_ll_max", default=20)

        # self-gravitation, for geoid only
        self_gravitation = inv.bool("self_gravitation", default=False)

        # compute stress/topography by consistent-boundary-flux method
        use_cbf_topo = inv.bool("use_cbf_topo", default=False)

        mega1 = 1024 * 1024
        #megaq = 256*1024

        # size of collective buffer used by MPI-IO
        cb_block_size = inv.int("cb_block_size", default=mega1)
        cb_buffer_size = inv.int("cb_buffer_size", default=mega1 * 4)

        # size of data sieve buffer used by HDF5
        sieve_buf_size = inv.int("sieve_buf_size", default=mega1)

        # memory alignment used by HDF5
        output_alignment = inv.int("output_alignment", default=mega1 / 4)
        output_alignment_threshold = inv.int("output_alignment_threshold",
                                             default=mega1 / 2)

        # cache for chunked dataset used by HDF5
        cache_mdc_nelmts = inv.int("cache_mdc_nelmts", default=10330)
        cache_rdcc_nelmts = inv.int("cache_rdcc_nelmts", default=521)
        cache_rdcc_nbytes = inv.int("cache_rdcc_nbytes", default=mega1)
Ejemplo n.º 7
0
 class Inventory( AbstractComponent.Inventory ):
     
     import pyre.inventory as pinv
     
     tofmin = pinv.float( 'tofmin', default = 0 )
     tofmin.meta['tip'] = 'tof min'
     tofmax = pinv.float( 'tofmax', default = 0.01 )
     tofmax.meta['tip'] = 'tof max'
     ntof = pinv.int( 'ntof', default = 100 )
     ntof.meta['tip'] = 'number of tof channels'
     
     xmin = pinv.float( 'xmin', default = -0.1 )
     xmin.meta['tip'] = 'x min'
     xmax = pinv.float( 'xmax', default = 0.1 )
     xmax.meta['tip'] = 'x max'
     nx = pinv.int( 'nx', default = 100 )
     nx.meta['tip'] = 'number of x bins'
     
     ymin = pinv.float( 'ymin', default = -0.1 )
     ymin.meta['tip'] = 'y min'
     ymax = pinv.float( 'ymax', default = 0.1 )
     ymax.meta['tip'] = 'y max'
     ny = pinv.int( 'ny', default = 100 )
     ny.meta['tip'] = 'number of y bins'
     
     eventsdat = pinv.str( 'eventsdat', default = 'events.dat' )
     eventsdat.meta['tip'] = 'output event data file'
     pass
Ejemplo n.º 8
0
class LauncherMPICH(Launcher):

    name = "mpich"

    import pyre.inventory as pyre

    machinefile = pyre.str("machinefile", default="mpirun.nodes")
    machinefile.meta['tip'] = """filename of machine file"""

    def _expandNodeListArgs(self, args):
        from pyre.util import expandMacros

        machinefile = self.machinefile
        nodegen = self.nodegen
        file = open(machinefile, "w")
        for node in self.nodelist:
            file.write((nodegen + '\n') % node)
        file.close()

        substitutions = {
            'launcher.machinefile': machinefile,
        }
        for i, arg in enumerate(args):
            args[i] = expandMacros(arg, substitutions)

        return
Ejemplo n.º 9
0
    class Inventory(Component.Inventory):

        a = inv.str('a', default='abc')

        b = inv.float('b', default=3.0, validator=inv.greater(0))

        pass
Ejemplo n.º 10
0
class Launcher(Component):
    
    
    import pyre.inventory as pyre
    
    dry         = pyre.bool("dry")
    nodes       = pyre.int("nodes", default=1); nodes.meta['tip'] = """number of machine nodes"""
    nodelist    = pyre.slice("nodelist");
    executable  = pyre.str("executable")
    arguments   = pyre.list("arguments")


    nodelist.meta['tip'] = """a comma-separated list of machine names in square brackets (e.g., [101-103,105,107])"""

    
    def launch(self):
        raise NotImplementedError("class '%s' must override 'launch'" % self.__class__.__name__)


    def argv(self):
        raise NotImplementedError("class '%s' must override 'argv'" % self.__class__.__name__)


    def comments(self):
        return ["command: " + ' '.join(self.argv())]
Ejemplo n.º 11
0
 class Inventory(Script.Inventory):
     import pyre.inventory as inv
     s = inv.str('s', default="abc")
     i = inv.int('i', default=10)
     f = inv.float('f', default=3.0)
     func = inv.facility("func", factory=Sin)
     pass
Ejemplo n.º 12
0
    class Inventory(Component.Inventory):

        import pyre.inventory as inv

        # component modules
        import CitcomS.Components.Advection_diffusion as Advection_diffusion
        import CitcomS.Components.Stokes_solver as Stokes_solver

        # components
        from CitcomS.Components.BC import BC
        from CitcomS.Components.Const import Const
        from CitcomS.Components.IC import IC
        from CitcomS.Components.Output import Output
        from CitcomS.Components.Param import Param
        from CitcomS.Components.Phase import Phase
        from CitcomS.Components.Tracer import Tracer
        from CitcomS.Components.Visc import Visc


        tsolver = inv.facility("tsolver",
                               factory=Advection_diffusion.temperature_diffadv)
        vsolver = inv.facility("vsolver",
                               factory=Stokes_solver.incompressibleNewtonian)

        bc = inv.facility("bc", factory=BC)
        const = inv.facility("const", factory=Const)
        ic = inv.facility("ic", factory=IC)
        output = inv.facility("output", factory=Output)
        param = inv.facility("param", factory=Param)
        phase = inv.facility("phase", factory=Phase)
        tracer = inv.facility("tracer", factory=Tracer)
        visc = inv.facility("visc", factory=Visc)

        datadir = inv.str("datadir", default=".")
        datadir_old = inv.str("datadir_old", default=".")

        rayleigh = inv.float("rayleigh", default=1e+05)
        dissipation_number = inv.float("dissipation_number", default=0.0)
        gruneisen = inv.float("gruneisen", default=0.0)
        surfaceT = inv.float("surfaceT", default=0.1)
        #adiabaticT0 = inv.float("adiabaticT0", default=0.4)
        Q0 = inv.float("Q0", default=0.0)

        stokes_flow_only = inv.bool("stokes_flow_only", default=False)

        verbose = inv.bool("verbose", default=False)
        see_convergence = inv.bool("see_convergence", default=True)
Ejemplo n.º 13
0
    class Inventory(Script.Inventory):

        import pyre.inventory as pinv

        nxfile = pinv.str('nxfile', default='')
        nxfile.meta['tip'] = 'nexus file name. eg. ARCS_5610.nxs'

        nxentry = pinv.str('nxentry', default='/entry')
        nxentry.meta['tip'] = 'the entry in the nexus file'

        mod2sample = pinv.dimensional('mod2sample',
                                      default=13.6 * units.length.meter)
        mod2sample.meta['tip'] = 'distance from moderator to sample'

        xmloutput = pinv.str(name='xmloutput')
        xmloutput.meta['tip'] = 'The output xml file'

        pass  # end of Inventory
Ejemplo n.º 14
0
    class Inventory(Component.Inventory):

        import pyre.inventory as inv

        a = inv.str('a', default='abc')
        a.meta['tip'] = "a is the first alphabet"
        a.meta['opacity'] = 10

        pass
Ejemplo n.º 15
0
 class Inventory(Component.Inventory):
     import pyre.inventory as inv
     speciesNumbers = inv.str("List of (specie, specie count)", default="")
     speciesNumbers.meta['tip'] = "list of tuples such as ('H',40)"
     speciesNumbers.meta['importance'] = 10
     historyFile = InputFile(".his Filename", default="")
     historyFile.meta[
         'tip'] = "the trajectory file of the MD run (NetCDF format)"
     historyFile.meta['importance'] = 9
Ejemplo n.º 16
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as prop


        Solver = prop.str("Solver", default="cgrad",
                 validator=prop.choice(["cgrad",
                                        "multigrid"]))
        node_assemble = prop.bool("node_assemble", default=True)
        precond = prop.bool("precond", default=True)

        accuracy = prop.float("accuracy", default=1.0e-4)
        inner_accuracy_scale = prop.float("inner_accuracy_scale", default=1.0)

        check_continuity_convergence = prop.bool("check_continuity_convergence", default=True)
        check_pressure_convergence = prop.bool("check_pressure_convergence", default=True)

        mg_cycle = prop.int("mg_cycle", default=1)
        down_heavy = prop.int("down_heavy", default=3)
        up_heavy = prop.int("up_heavy", default=3)

        vlowstep = prop.int("vlowstep", default=1000)
        vhighstep = prop.int("vhighstep", default=3)
        max_mg_cycles = prop.int("max_mg_cycles", default=50)
        piterations = prop.int("piterations", default=1000)

        aug_lagr = prop.bool("aug_lagr", default=True)
        aug_number = prop.float("aug_number", default=2.0e3)

        uzawa = prop.str("uzawa", default="cg",
                         validator=prop.choice(["cg", "bicg"]))
        compress_iter_maxstep = prop.int("compress_iter_maxstep", default=100)

        inner_remove_rigid_rotation = prop.bool("inner_remove_rigid_rotation", default=False)
        remove_rigid_rotation = prop.bool("remove_rigid_rotation", default=True)
        remove_angular_momentum = prop.bool("remove_angular_momentum", default=True)

        only_check_vel_convergence = prop.bool("only_check_vel_convergence", default=False)

        # Not used. Retained here for backward compatibility.
        tole_compressibility = prop.float("tole_compressibility", default=1.0e-7)
        relative_err_accuracy = prop.float("relative_err_accuracy", default=0.001)
Ejemplo n.º 17
0
    class Inventory(Component.Inventory):
        import pyre.inventory as inv
        #        filename = inv.str('Atomic List', default='atoms.in')
        #        filename.meta['tip'] = 'The file containing atoms, their type, and positions (i.e. C core/shell 0.0 1.0 2.1)'
        #atoms = inv.facility('Atomic/Species information',default=AtomLoader())
        atoms = inv.str('Atomic/Species information', default='')
        atoms.meta['tip'] = '''i.e. H core  0.0  0.0  0.0
O shell  1.0  0.0  0.0'''
        #        unitCell = inv.facility('unitCell', default=UnitCell())
        #        unitCell.meta['tip'] = 'Set the unit cell parameters.'
        a = inv.str('a', default='1.0 0.0 0.0')
        a.meta['tip'] = 'the a unit cell vector'
        a.meta['importance'] = 10
        b = inv.str('b', default='0.0 1.0 0.0')
        b.meta['tip'] = 'the b unit cell vector'
        b.meta['importance'] = 9
        c = inv.str('c', default='0.0 0.0 1.0')
        c.meta['tip'] = 'the c unit cell vector'
        c.meta['importance'] = 8
        spaceGroup = inv.str('Space Group', default='1')
        spaceGroup.meta['tip'] = 'space group of the unit cell'
Ejemplo n.º 18
0
class Launcher(Base):

    import pyre.inventory as pyre

    dry = pyre.bool("dry", default=False)
    dry.meta['tip'] = "prints the command line and exits"

    nodegen = pyre.str("nodegen")
    nodegen.meta[
        'tip'] = """a printf-style format string, used in conjunction with 'nodelist' to generate the list of machine names (e.g., "n%03d")"""

    command = pyre.str("command", default="mpirun -np ${nodes}")

    def launch(self):
        import os, sys

        argv = self.argv()
        command = ' '.join(argv)

        if self.dry:
            print command
            return

        self._info.log("spawning: %s" % command)

        # The following is based upon os.spawnvp() internals.
        status = None
        pid = os.fork()
        if not pid:
            # Child
            try:
                os.execvp(argv[0], argv)
            except Exception, e:
                # See Issue116.
                print >> sys.stderr, 'execvp("%s"): %s' % (argv[0], e)
                os._exit(127)
        else:
Ejemplo n.º 19
0
class SchedulerTACCRanger(SchedulerSGE):

    name = "tacc-ranger"

    import pyre.inventory as pyre

    command = pyre.str("command", default="qsub")
    tpn = pyre.int("tpn",
                   default=16,
                   validator=pyre.choice([1, 2, 4, 8, 12, 15, 16]))
    tpn.meta['tip'] = 'Task per node'
    qsubOptions = pyre.list("qsub-options")

    def schedule(self, job):
        from math import ceil
        # round up to multiple of 16
        nodes = ceil(job.nodes / float(self.tpn))
        self.cores = int(nodes * 16)

        SchedulerSGE.schedule(self, job)
Ejemplo n.º 20
0
class BatchScript(AppRunner):

    import pyre.inventory as pyre
    schedulerClass = pyre.str("scheduler-class",
                              default="pyre.schedulers:SchedulerNone")

    def _init(self):
        super(BatchScript, self)._init()
        self.SchedulerClass = loadObject(self.schedulerClass)
        return

    def defineMacros(self, macros):
        macros['job.id'] = self.SchedulerClass.jobId()
        return

    def runSubscript(self, *args, **kwds):
        macros = kwds.setdefault('macros', {})
        self.defineMacros(macros)
        super(BatchScript, self).runSubscript(*args, **kwds)
        return
Ejemplo n.º 21
0
class Scheduler(Component):

    import pyre.inventory as pyre

    dry = pyre.bool("dry", default=False)
    dry.meta[
        'tip'] = """don't actually run the job; just print the batch script"""

    wait = pyre.bool("wait", default=True)
    wait.meta['tip'] = """wait for the job to finish"""

    shell = pyre.str("shell", default="/bin/sh")
    shell.meta['tip'] = """shell for #! line of batch scripts"""

    def schedule(self, job):
        raise NotImplementedError("class '%s' must override 'schedule'" %
                                  self.__class__.__name__)

    def jobId(cls):
        raise NotImplementedError("class '%s' must override 'jobId'" %
                                  cls.__name__)

    jobId = classmethod(jobId)
Ejemplo n.º 22
0
class Job(Component):

    name = "job"

    import pyre.inventory as pyre
    import pyre.util as util
    from pyre.units.time import minute

    task = pyre.str("name")  # 'task' internally, to avoid name conflict

    queue = pyre.str("queue")
    mail = pyre.bool("mail", default=False)
    dwalltime = pyre.dimensional("walltime", default=0 * minute)

    stdin = pyre.str("stdin", default=util.devnull())
    stdout = pyre.str("stdout", default="stdout.txt")
    stderr = pyre.str("stderr", default="stderr.txt")

    environment = pyre.list("environment")

    executable = pyre.str("executable")
    arguments = pyre.list("arguments")

    comments = pyre.list("comments")

    def __init__(self):
        super(Job, self).__init__()
        self.nodes = 1
        self.id = None

    def getStateArgs(self, stage):
        state = []
        if stage == 'launch':
            state.append("--macros.job.name=%s" % self.task)
        elif stage == 'compute':
            state.append("--macros.job.id=%s" % self.id)
        return state
Ejemplo n.º 23
0
 class Inventory(AbstractComponent.Inventory):
     import pyre.inventory as pinv
     xml = pinv.str('xml', default='')
     pass
 class Inventory(Component.Inventory):
     import pyre.inventory as inv
     filename = inv.str( "filename", default = "")
     filename.meta['tip'] = ".cif file to be translated."
Ejemplo n.º 25
0
 class Inventory(AbstractComponent.Inventory):
     import pyre.inventory as pinv
     path = pinv.str('path', default='neutrons')
     path.meta[
         'tip'] = "The path where neutrons will be saved. This must be a relative path within the output directory of the instrument simulation application."
     pass
Ejemplo n.º 26
0
    class Inventory(Component.Inventory):
        import pyre.inventory as inv
        barostatParameter = inv.float('Barostat Parameter', default=0.005)
        barostatParameter.meta['tip'] = '''barostat parameter to keep 
fluctuations relatively small'''
        coordinateFormat = inv.str('Coordinate Format', default='cartesian')
        coordinateFormat.meta['tip'] = 'what format the coordinates are in'
        coordinateFormat.validator = inv.choice(['cartesian', 'fractional'])
        constantPressureFit = inv.bool('Constant Pressure Fit', default=False)
        constantPressureFit.meta[
            'tip'] = '''keep pressure constant during fitting (fit 
to irreducible cell coordinates and lattice lengths)'''
        constantPressureOptimize = inv.bool('Constant Pressure Optimize',
                                            default=False)
        constantPressureOptimize.meta[
            'tip'] = '''keep pressure constant during optimization'''
        constantVolumeFit = inv.bool('Constant Volume Fit', default=False)
        constantVolumeFit.meta[
            'tip'] = '''keep volume constant during fitting (fit 
to irreducible cell coordinates)'''
        constantVolumeOptimize = inv.bool('Constant Volume Optimize',
                                          default=False)
        constantVolumeOptimize.meta[
            'tip'] = '''keep volume constant during optimization'''
        dispersionInRecipSpace = inv.bool(
            'Calculate Dispersion in Reciprocal Space', default=False)
        dispersionInRecipSpace.meta[
            'tip'] = '''whether to calculate dispersion forces 
partly in reciprocal space'''
        dumpFrequency = inv.float('Dump Frequency', default=1.0)
        dumpFrequency.meta[
            'tip'] = '''frequency at which a restart file is written'''
        engineExecutablePath = inv.str(
            'Engine Executable Path', default='/home/brandon/gulp3.0/Src/gulp')
        engineExecutablePath.meta[
            'tip'] = '''path to the engine\'s executable'''
        ensemble = inv.str('Thermodynamic Ensemble',
                           default='nve',
                           validator=inv.choice(["nve", "nvt", "npt"]))
        ensemble.meta['tip'] = 'thermodynamic ensemble (nve, nvt, npt, ...)'
        equilibrationTime = inv.float('Equilibration Time (ps)', default=0.1)
        equilibrationTime.meta[
            'tip'] = 'equilibration time of the simulation (ps)'
        identifyMolecules = inv.bool('Indentify Molecules', default=False)
        identifyMolecules.meta[
            'tip'] = '''identify molecules based on covalent radii 
and remove intramolecular coloumb interactions'''
        integrator = inv.str('Integrator', default='velocity-verlet')
        integrator.meta['tip'] = 'type of integrator'
        inputDeckName = inv.str('Input Filename', default='gulp.gin')
        inputDeckName.meta['tip'] = '''input file for executable'''
        logFilename = inv.str('Log Filename', default='molDynamics.log')
        logFilename.meta['tip'] = 'name of log file for md run'
        optimizeCell = inv.bool('Optimize Cell', default=False)
        optimizeCell.meta['tip'] = 'whether to optimize the unit cell'
        optimizeCoordinates = inv.bool('Optimize Coordinates', default=False)
        optimizeCoordinates.meta[
            'tip'] = 'whether to optimize the coordinate positions'
        productionTime = inv.float('Production Time (ps)', default=5.0)
        productionTime.meta['tip'] = 'production time of the simulation'
        computeMaterialProperties = inv.bool('Compute Material Properties',
                                             default=False)
        computeMaterialProperties.meta[
            'tip'] = 'whether to print material properties'
        restartFilename = inv.str('Restart Filename',
                                  default='molDynamics.res')
        restartFilename.meta['tip'] = '''restart file for md executable'''
        runType = inv.str('Run Type',default='md',\
                validator=inv.choice(['md', 'restart md', 'optimize', 'fit']))
        runType.meta['tip'] = 'type of run'
        sample = inv.facility('Sample', default=Component('sample', 'sample'))
        sample.meta['importance'] = 10
        sample.meta['tip'] = 'piece of material being measured/simulated'
        sampleFrequency = inv.float('Sample Properties Frequency', default=5.0)
        sampleFrequency.meta[
            'tip'] = '''frequency at which sampled properties are 
written to trajectory and log file'''
        spaceGroup = inv.str('Space Group', default=None)
        spaceGroup.meta['tip'] = 'specify space group symmetry'
        thermostatParameter = inv.float('Thermostat Parameter', default=0.005)
        thermostatParameter.meta['tip'] = '''thermostat parameter to keep 
fluctuations relatively small'''
        timeStep = inv.float('Time step (ps)', default=0.5)
        timeStep.meta['tip'] = 'integration time step (ps)'
        trajectoryFilename = inv.str('Trajectory Filename',
                                     default='molDynamics.xyz')
        trajectoryFilename.meta['tip'] = 'name of trajectory file'
        #trajectoryType = inv.facility('Trajectory Type', default = TrajectoryType())
        trajectoryType = inv.str('Trajectory Type', default='xyz (Gulp)')
        trajectoryType.meta['tip'] = '''type of trajectory file'''
        trajectoryType.validator = inv.choice([
            'xyz (Gulp)', 'netcdf (Mmtk)', 'trajectory (Gulp)',
            'history (Gulp)', 'phonon (Gulp)', 'arc (Gulp)'
        ])
        workingDirectory = inv.str('Working Directory', default='$HOME')
        workingDirectory.meta[
            'tip'] = '''working directory where computation will
Ejemplo n.º 27
0
 class Inventory( AbstractComponent.Inventory ):
     import pyre.inventory as pinv
     path = pinv.str( 'path', default = '' )
     path.meta['tip'] = "The path where neutrons will be loaded"
     pass
Ejemplo n.º 28
0
 class Inventory(Component.Inventory):
     import pyre.inventory as pinv
     dbPath = pinv.str('dbPath', default='$HOME' + sep + 'danseLocal.db')
Ejemplo n.º 29
0
class ColorScheme(Component):

    import pyre.inventory as pyre

    filename = pyre.str("filename", default="NoColor")
    line = pyre.str("line", default="NoColor")
    function = pyre.str("function", default="NoColor")
    stackTrace = pyre.str("stack-trace", default="NoColor")

    src = pyre.str("src", default="NoColor")

    facility = pyre.str("facility", default="NoColor")
    severityDebug = pyre.str("severity-debug", default="NoColor")
    severityInfo = pyre.str("severity-info", default="NoColor")
    severityWarning = pyre.str("severity-warning", default="NoColor")
    severityError = pyre.str("severity-error", default="NoColor")

    normal = pyre.str("normal", default="Normal")

    def __getitem__(self, key):
        return self.getTraitValue(key)
Ejemplo n.º 30
0
class SchedulerPBS(BatchScheduler):
    
    
    name = "pbs"
    

    import pyre.inventory as pyre
    
    command       = pyre.str("command", default="qsub")
    qsubOptions   = pyre.list("qsub-options")
    resourceList  = pyre.list("resource-list")
    ppn           = pyre.int("ppn", default=1)
    
    
    def schedule(self, job):
        import pyre.util as util

        # Fix-up the job.
        if not job.task:
            job.task = "jobname"
        job.walltime = util.hms(job.dwalltime.value)
        job.arguments = ' '.join(job.arguments)
        job.resourceList = self.buildResourceList(job)
        
        # Generate the main PBS batch script.
        script = self.retrieveTemplate('batch.sh', ['schedulers', 'scripts', self.name])
        if script is None:
            self._error.log("could not locate batch script template for '%s'" % self.name)
            sys.exit(1)
        
        script.scheduler = self
        script.job = job
        
        if self.dry:
            print script
            return

        try:
            import os
            from popen2 import Popen4

            cmd = [self.command]
            self._info.log("spawning: %s" % ' '.join(cmd))
            child = Popen4(cmd)
            self._info.log("spawned process %d" % child.pid)

            print >> child.tochild, script
            child.tochild.close()

            for line in child.fromchild:
                self._info.line("    " + line.rstrip())
            status = child.wait()
            self._info.log()

            exitStatus = None
            if (os.WIFSIGNALED(status)):
                statusStr = "signal %d" % os.WTERMSIG(status)
            elif (os.WIFEXITED(status)):
                exitStatus = os.WEXITSTATUS(status)
                statusStr = "exit %d" % exitStatus
            else:
                statusStr = "status %d" % status
            self._info.log("%s: %s" % (cmd[0], statusStr))
        
        except IOError, e:
            self._error.log("%s: %s" % (self.command, e))
            return
        
        if exitStatus == 0:
            pass
        else:
            sys.exit("%s: %s: %s" % (sys.argv[0], cmd[0], statusStr))
        
        return