Ejemplo n.º 1
0
    def get_cmd_run_initial(self, target):
        """
        Create a compute unit description to be run

        Parameters
        ----------
        target : str
            location of the created target trajectory

        Returns
        -------

        """
        cmd  = self.cluster.link(self.conf_file_link)
        cmd += self.cluster.link(self.pdb_file_link)

        cmd += BashCommand(
            'acemd',
            [
                self.conf_file
            ])

        cmd += self.cluster.move('output.xtc', target)

        return cmd
Ejemplo n.º 2
0
    def link(self, source, target=None, stage=None):
        st = get_type(source)
        tt = get_type(target)

        if target is None:
            target = ''

        if os.path.basename(target) == '':
            target = target + os.path.basename(source)

        if st in ['shared'] and tt in ['unit']:
            source = source.replace('shared://', self.path_to_shared)
            target = target.replace('shared://', self.path_to_shared)
            return BashCommand('ln', ['-l', source, target])
        elif st in ['staging'] and tt in ['unit']:
            stage = stage or rp.STAGING_INPUT
            return StagingCommand(
                {
                    'source': source,
                    'target': target,
                    'action': rp.LINK
                }, stage)
        else:
            raise NotImplementedError(
                'linking from `%s` to `%s` is not implemented yet.' % (st, tt))
Ejemplo n.º 3
0
    def makedir(self, source):
        st = get_type(source)

        if st in ['shared', 'unit']:
            source = source.replace('shared://', self.path_to_shared)
            return BashCommand('mkdir', [source])
        else:
            raise NotImplementedError(
                'makedir in `%s` is not implemented yet.' % st)
Ejemplo n.º 4
0
    def remove(self, source):
        st = get_type(source)

        if st in ['shared', 'unit']:
            source = source.replace('shared://', self.path_to_shared)
            return BashCommand('rm', [source])
        else:
            raise NotImplementedError(
                'deleting from `%s` is not implemented yet.' % st)
Ejemplo n.º 5
0
    def get_cmd_trajectory_frame(self, source, frame, target):
        """
        Create a command that runs from a fram in a trajectory

        Parameters
        ----------
        source : str
            location of the input trajectory, usually starts with `shared://`
            and lists the location on the shared space
        frame : int
            the integer index starting from 0 in the input trajectory
        target : str
            location of the target trajectory, usually starts with `shared://`

        Returns
        -------
        Command
        """

        # todo: add the extraction of a single frame using a little python tool
        # question: how to run multiple commands with MPU

        cmd  = self.cluster.link(self.conf_file_link)
        cmd += self.cluster.link(self.pdb_file_link)
        cmd += self.cluster.link(source, 'input.xtc')

        # might use mdconvert from mdtraj for now
        cmd += BashCommand(
            'mdconvert',
            [
                '-o', 'initial.pdb',
                '-i', '%d' % frame,
                'input.xtc',
                self.pdb_file,
            ])

        cmd += BashCommand(
            'acemd',
            [
                self.conf_file
            ])
        cmd += self.cluster.move('output.xtc', target)

        return cmd
Ejemplo n.º 6
0
    def mv(self, source, target=None):
        st = get_type(source)
        tt = get_type(target)

        if target is None:
            target = ''

        if os.path.basename(target) == '':
            target = target + os.path.basename(source)

        if st in ['shared', 'unit'] and tt in ['shared', 'unit']:
            source = source.replace('shared://', self.path_to_shared)
            target = target.replace('shared://', self.path_to_shared)
            return BashCommand('cp', [source, target])
        else:
            raise NotImplementedError(
                'moving from `%s` to `%s` is not implemented yet.' % (st, tt))
Ejemplo n.º 7
0
    def get_cmd_pdb(self, pdb_file):
        """
        Create a compute unit description to be run

        Parameters
        ----------

        Returns
        -------

        """
        cmd  = self.cluster.link(self.conf_file)
        cmd += self.cluster.copy(pdb_file)

        cmd += BashCommand(
            'acemd',
            [
                self.conf_file
            ])

        return cmd