Пример #1
0
    def __init__(self, _configapp=None):
        SimQueue.__init__(self)
        ProtocolInterface.__init__(self)
        self._arg('version',
                  'int',
                  'LSF major version',
                  self._defaults['version'],
                  valid_values=[9, 10])
        self._arg('jobname', 'str', 'Job name (identifier)', None,
                  val.String())
        self._arg(
            'queue',
            'list',
            'The queue or list of queues to run on. If list, it attempts to submit the job to '
            'the first queue listed',
            self._defaults['queue'],
            val.String(),
            nargs='*')
        self._arg('app', 'str', 'The application profile',
                  self._defaults['app'], val.String())
        self._arg('ngpu', 'int', 'Number of GPUs to use for a single job',
                  self._defaults['ngpu'], val.Number(int, '0POS'))
        self._arg(
            'gpu_options', 'dict', 'Number of GPUs to use for a single job',
            self._defaults['gpu_options'],
            val.Dictionary(key_type=str,
                           valid_keys=['mode', 'mps', 'j_exclusive'],
                           value_type={
                               'mode': str,
                               'mps': str,
                               'j_exclusive': str
                           },
                           valid_values={
                               'mode': ['shared', 'exclusive_process'],
                               'mps': ['yes', 'no'],
                               'j_exclusive': ['yes', 'no']
                           }))
        self._arg('ncpu', 'int', 'Number of CPUs to use for a single job',
                  self._defaults['ncpu'], val.Number(int, '0POS'))
        self._arg('memory', 'int', 'Amount of memory per job (MiB)',
                  self._defaults['memory'], val.Number(int, '0POS'))
        self._arg('walltime', 'int', 'Job timeout (hour:min or min)',
                  self._defaults['walltime'], val.Number(int, '0POS'))
        self._arg('resources',
                  'list',
                  'Resources of the queue',
                  self._defaults['resources'],
                  val.String(),
                  nargs='*')
        self._cmdDeprecated('environment', 'prerun')
        self._arg('outputstream', 'str', 'Output stream.', 'lsf.%J.out',
                  val.String())
        self._arg('errorstream', 'str', 'Error stream.', 'lsf.%J.err',
                  val.String())
        self._arg('datadir', 'str',
                  'The path in which to store completed trajectories.', None,
                  val.String())
        self._arg(
            'trajext', 'str',
            'Extension of trajectory files. This is needed to copy them to datadir.',
            'xtc', val.String())
        self._arg(
            'envvars', 'str',
            'Envvars to propagate from submission node to the running node (comma-separated)',
            self._defaults['envvars'], val.String())
        self._arg(
            'prerun',
            'list',
            'Shell commands to execute on the running node before the job (e.g. '
            'loading modules)',
            self._defaults['prerun'],
            val.String(),
            nargs='*')

        # Load LSF configuration profile
        lsfconfig = _config['lsf']
        profile = None
        if _configapp is not None:
            if lsfconfig is not None:
                if os.path.isfile(lsfconfig) and lsfconfig.endswith(
                    ('.yml', '.yaml')):
                    try:
                        with open(lsfconfig, 'r') as f:
                            profile = yaml.load(f)
                        logger.info(
                            'Loaded LSF configuration YAML file {}'.format(
                                lsfconfig))
                    except:
                        logger.warning(
                            'Could not load YAML file {}'.format(lsfconfig))
                else:
                    logger.warning(
                        '{} does not exist or it is not a YAML file.'.format(
                            lsfconfig))
                if profile:
                    try:
                        properties = profile[_configapp]
                    except:
                        raise RuntimeError(
                            'There is no profile in {} for configuration '
                            'app {}'.format(lsfconfig, _configapp))
                    for p in properties:
                        self.__dict__[p] = properties[p]
                        logger.info('Setting {} to {}'.format(
                            p, properties[p]))
            else:
                raise RuntimeError(
                    'No LSF configuration YAML file defined for the configapp')
        else:
            if lsfconfig is not None:
                logger.warning(
                    'LSF configuration YAML file defined without configuration app'
                )

        # Find executables
        self._qsubmit = LsfQueue._find_binary('bsub')
        self._qinfo = LsfQueue._find_binary('bqueues')
        self._qcancel = LsfQueue._find_binary('bkill')
        self._qstatus = LsfQueue._find_binary('bjobs')
Пример #2
0
    def __init__(self):
        super().__init__()
        self._arg(
            "acemd",
            ":class:`Acemd <htmd.mdengine.acemd.acemd.Acemd>`"
            " object",
            "Acemd class object",
            None,
            val.Object(Acemd),
        )
        self._arg(
            "runtime",
            "float",
            "Running time of the simulation.",
            25000,
            val.Number(float, "0POS"),
        )
        self._arg(
            "timeunits",
            "str",
            "Units for runtime. Can be 'steps', 'ns' etc.",
            "steps",
            val.String(),
        )
        self._arg(
            "temperature",
            "float",
            "Temperature of the thermostat in Kelvin",
            300,
            val.Number(float, "ANY"),
        )
        self._arg(
            "fb_k",
            "float",
            "Force constant of the flatbottom potential in kcal/mol/A^2. E.g. 5",
            0,
            val.Number(float, "ANY"),
        )
        self._arg(
            "fb_reference",
            "str",
            "Reference selection to use as dynamic center of the flatbottom box.",
            "none",
            val.String(),
        )
        self._arg(
            "fb_selection",
            "str",
            "Selection of atoms to apply the flatbottom potential",
            "none",
            val.String(),
        )
        self._arg(
            "fb_box",
            "list",
            "Position of the flatbottom box in term of the reference center given as "
            "[xmin, xmax, ymin, ymax, zmin, zmax]",
            [0, 0, 0, 0, 0, 0],
            val.Number(float, "ANY"),
            nargs=6,
        )
        self._arg(
            "useconstantratio",
            "bool",
            "For membrane protein simulations set it to true so that the barostat "
            "does not modify the xy aspect ratio.",
            False,
            val.Boolean(),
        )
        self._arg(
            "useconstraints",
            "bool",
            "Apply constraints to the production simulation, defined by the "
            "constraints parameter",
            False,
            val.Boolean(),
        )
        self._arg(
            "constraints",
            "dict",
            "A dictionary of atomselections and values of the constraint to be "
            "applied (in kcal/mol/A^2). Atomselects must be mutually exclusive.",
            {},
            val.Dictionary(key_type=str),
        )
        self._arg(
            "adaptive",
            "bool",
            "Set to True if making production runs for adaptive sampling.",
            False,
            val.Boolean(),
        )
        self._arg(
            "restraints",
            "list",
            "A list of restraint objects."
            "See :class:`AtomRestraint <htmd.mdengine.acemd.acemd.AtomRestraint>` and"
            ":class:`GroupRestraint <htmd.mdengine.acemd.acemd.GroupRestraint>`"
            ")",
            None,
            val.Object(_Restraint),
            nargs="*",
        )

        self.acemd = Acemd()
        self.acemd.binvelocities = None
        self.acemd.bincoordinates = "output.coor"
        self.acemd.extendedsystem = "output.xsc"
        self.acemd.coordinates = None
        self.acemd.structure = None
        self.acemd.parameters = None
        self.acemd.restart = "on"
        self.acemd.trajectoryfile = "output.xtc"
        self.acemd.trajectoryperiod = 25000
        self.acemd.timestep = 4
        self.acemd.switching = "on"
        self.acemd.switchdistance = 7.5
        self.acemd.cutoff = 9
        self.acemd.thermostat = "on"
        self.acemd.thermostatdamping = 0.1
        self.acemd.pme = "on"
Пример #3
0
    def __init__(self, _version=2):
        super().__init__()
        self._version = _version
        self._arg(
            'acemd',
            ':class:`Acemd2 <htmd.apps.acemd.Acemd>` or :class:`Acemd <htmd.mdengine.acemd.acemd.Acemd>`'
            ' object', 'Acemd class object', None, val.Object([Acemd2, Acemd]))
        self._arg('runtime', 'float', 'Running time of the simulation.', 25000,
                  val.Number(float, '0POS'))
        self._arg('timeunits', 'str',
                  'Units for runtime. Can be \'steps\', \'ns\' etc.', 'steps',
                  val.String())
        self._arg('temperature', 'float',
                  'Temperature of the thermostat in Kelvin', 300,
                  val.Number(float, 'ANY'))
        self._arg(
            'fb_k', 'float',
            'Force constant of the flatbottom potential in kcal/mol/A^2. E.g. 5',
            0, val.Number(float, 'ANY'))
        self._arg(
            'fb_reference', 'str',
            'Reference selection to use as dynamic center of the flatbottom box.',
            'none', val.String())
        self._arg('fb_selection', 'str',
                  'Selection of atoms to apply the flatbottom potential',
                  'none', val.String())
        self._arg(
            'fb_box',
            'list',
            'Position of the flatbottom box in term of the reference center given as '
            '[xmin, xmax, ymin, ymax, zmin, zmax]', [0, 0, 0, 0, 0, 0],
            val.Number(float, 'ANY'),
            nargs=6)
        self._arg(
            'useconstantratio', 'bool',
            'For membrane protein simulations set it to true so that the barostat '
            'does not modify the xy aspect ratio.', False, val.Boolean())
        self._arg(
            'useconstraints', 'bool',
            'Apply constraints to the production simulation, defined by the '
            'constraints parameter', False, val.Boolean())
        self._arg(
            'constraints', 'dict',
            'A dictionary of atomselections and values of the constraint to be '
            'applied (in kcal/mol/A^2). Atomselects must be mutually exclusive.',
            {}, val.Dictionary(key_type=str))
        self._arg(
            'adaptive', 'bool',
            'Set to True if making production runs for adaptive sampling.',
            False, val.Boolean())
        self._arg(
            'restraints',
            'list',
            'A list of restraint objects. Only works with {}(_version=3),'
            'see :class:`AtomRestraint <htmd.mdengine.acemd.acemd.AtomRestraint>` and'
            ':class:`GroupRestraint <htmd.mdengine.acemd.acemd.GroupRestraint>`'
            ')'.format(self.__class__.__name__),
            None,
            val.Object(_Restraint),
            nargs='*')

        if self._version == 2:
            self.acemd = Acemd2()
            self.acemd.binindex = None
            self.acemd.binvelocities = None
            self.acemd.bincoordinates = 'output.coor'
            self.acemd.extendedsystem = 'output.xsc'
            self.acemd.coordinates = None
            self.acemd.structure = None
            self.acemd.parameters = None
            self.acemd.temperature = None
            self.acemd.restart = 'on'
            self.acemd.restartfreq = '5000'
            self.acemd.outputname = 'output'
            self.acemd.xtcfile = 'output.xtc'
            self.acemd.xtcfreq = '25000'
            self.acemd.timestep = '4'
            self.acemd.rigidbonds = 'all'
            self.acemd.hydrogenscale = '4'
            self.acemd.switching = 'on'
            self.acemd.switchdist = '7.5'
            self.acemd.cutoff = '9'
            self.acemd.exclude = 'scaled1-4'
            self.acemd.scaling14 = '1.0'
            self.acemd.langevin = 'on'
            self.acemd.langevintemp = None
            self.acemd.langevindamping = '0.1'
            self.acemd.pme = 'on'
            self.acemd.pmegridspacing = '1.0'
            self.acemd.fullelectfrequency = '2'
            self.acemd.energyfreq = '5000'
            self.acemd.consref = None
            self.acemd.run = '$numsteps'
            self.acemd.TCL = ('''
set numsteps {NUMSTEPS}
set fb_refindex {{ {REFINDEX} }}
set fb_selindex {{ {SELINDEX} }}
set fb_box {{ {BOX} }}
set fb_K {KCONST}
#
''', '''
proc flatbot1d {x xm xM fb_K} {
  set f 0
  if {$x < $xm} {
    set f [expr $fb_K*[expr $xm-$x]]
  }
  if {$x > $xM} {
    set f [expr $fb_K*[expr $xM-$x]]
  }
  return $f
}
proc calcforces_init {} {
  global ref sel fb_refindex fb_selindex
  berendsenpressure  off
  set ref [addgroup  $fb_refindex]
  set sel [addgroup  $fb_selindex]
}
proc calcforces {} {
  global ref sel fb_K fb_box
  loadcoords coords
##FLATBOTTOM
  if {$fb_K>0} {
    set r0 $coords($ref)
    set r1 $coords($sel)
    set dr  [vecsub $r1 $r0]
    set fx [flatbot1d [lindex $dr 0] [lindex $fb_box 0] [lindex $fb_box 1] $fb_K]
    set fy [flatbot1d [lindex $dr 1] [lindex $fb_box 2] [lindex $fb_box 3] $fb_K]
    set fz [flatbot1d [lindex $dr 2] [lindex $fb_box 4] [lindex $fb_box 5] $fb_K]
    #print "dr: $dr  fx: $fx fy: $fy fz: $fz"
    addforce $sel [list $fx $fy $fz]
  }
}
proc calcforces_endstep { } { }
''')
        elif self._version == 3:
            self.acemd = Acemd()
            self.acemd.binvelocities = None
            self.acemd.bincoordinates = 'output.coor'
            self.acemd.extendedsystem = 'output.xsc'
            self.acemd.coordinates = None
            self.acemd.structure = None
            self.acemd.parameters = None
            self.acemd.restart = 'on'
            self.acemd.trajectoryfile = 'output.xtc'
            self.acemd.trajectoryfreq = 25000
            self.acemd.timestep = 4
            self.acemd.switching = 'on'
            self.acemd.switchdist = 7.5
            self.acemd.cutoff = 9
            self.acemd.thermostat = 'on'
            self.acemd.thermostatdamping = 0.1
            self.acemd.pme = 'on'
        else:
            raise ValueError(
                '_version can not be {}. Choose either 2 or 3.'.format(
                    self._version))
Пример #4
0
    def __init__(self,
                 _configapp=None,
                 _configfile=None,
                 _findExecutables=True,
                 _logger=True):
        SimQueue.__init__(self)
        ProtocolInterface.__init__(self)
        self._arg(
            "version",
            "int",
            "LSF major version",
            self._defaults["version"],
            valid_values=[9, 10],
        )
        self._arg("jobname", "str", "Job name (identifier)", None,
                  val.String())
        self._arg(
            "queue",
            "list",
            "The queue or list of queues to run on. If list, it attempts to submit the job to "
            "the first queue listed",
            self._defaults["queue"],
            val.String(),
            nargs="*",
        )
        self._arg("app", "str", "The application profile",
                  self._defaults["app"], val.String())
        self._arg(
            "ngpu",
            "int",
            "Number of GPUs to use for a single job",
            self._defaults["ngpu"],
            val.Number(int, "0POS"),
        )
        self._arg(
            "gpu_options",
            "dict",
            "Number of GPUs to use for a single job",
            self._defaults["gpu_options"],
            val.Dictionary(
                key_type=str,
                valid_keys=["mode", "mps", "j_exclusive"],
                value_type={
                    "mode": str,
                    "mps": str,
                    "j_exclusive": str
                },
                valid_values={
                    "mode": ["shared", "exclusive_process"],
                    "mps": ["yes", "no"],
                    "j_exclusive": ["yes", "no"],
                },
            ),
        )
        self._arg(
            "ncpu",
            "int",
            "Number of CPUs to use for a single job",
            self._defaults["ncpu"],
            val.Number(int, "0POS"),
        )
        self._arg(
            "memory",
            "int",
            "Amount of memory per job (KB)",
            self._defaults["memory"],
            val.Number(int, "0POS"),
        )
        self._arg(
            "walltime",
            "int",
            "Job timeout (hour:min or min)",
            self._defaults["walltime"],
            val.Number(int, "0POS"),
        )
        self._arg(
            "resources",
            "list",
            "Resources of the queue",
            self._defaults["resources"],
            val.String(),
            nargs="*",
        )
        self._cmdDeprecated("environment", "prerun")
        self._arg("outputstream", "str", "Output stream.", "lsf.%J.out",
                  val.String())
        self._arg("errorstream", "str", "Error stream.", "lsf.%J.err",
                  val.String())
        self._arg(
            "datadir",
            "str",
            "The path in which to store completed trajectories.",
            None,
            val.String(),
        )
        self._arg(
            "trajext",
            "str",
            "Extension of trajectory files. This is needed to copy them to datadir.",
            "xtc",
            val.String(),
        )
        self._arg(
            "envvars",
            "str",
            "Envvars to propagate from submission node to the running node (comma-separated)",
            self._defaults["envvars"],
            val.String(),
        )
        self._arg(
            "prerun",
            "list",
            "Shell commands to execute on the running node before the job (e.g. "
            "loading modules)",
            self._defaults["prerun"],
            val.String(),
            nargs="*",
        )

        # Load LSF configuration profile
        loadConfig(self, "lsf", _configfile, _configapp, _logger)

        # Find executables
        if _findExecutables:
            self._qsubmit = LsfQueue._find_binary("bsub")
            self._qinfo = LsfQueue._find_binary("bqueues")
            self._qcancel = LsfQueue._find_binary("bkill")
            self._qstatus = LsfQueue._find_binary("bjobs")