Exemplo n.º 1
0
    def run(self):
        """ runs a gromacs-mdrun with the
        current atom-configuration """

        # clean up gromacs backups
        if self.clean:
            do_clean('#*')

        subcmd = 'mdrun'
        command = [subcmd]
        if self.do_qmmm:
            command += [
                '-s', self.label + '.tpr', '-o', self.label + '.trr', '-e',
                self.label + '.edr', '-g', self.label + '.log', '-rerun',
                self.label + '.g96',
                self.params_runs.get('extra_mdrun_parameters',
                                     ''), '> QMMM.log 2>&1'
            ]
            command = ' '.join(command)
            self._execute_gromacs(command)
        else:
            command += [
                '-s', self.label + '.tpr', '-o', self.label + '.trr', '-e',
                self.label + '.edr', '-g', self.label + '.log', '-c',
                self.label + '.g96',
                self.params_runs.get('extra_mdrun_parameters',
                                     ''), '> MM.log 2>&1'
            ]
            command = ' '.join(command)
            self._execute_gromacs(command)

            atoms = read_gromos(self.label + '.g96')
            self.atoms = atoms.copy()
Exemplo n.º 2
0
    def generate_topology_and_g96file(self):
        """ from coordinates (self.label.+'pdb')
            and gromacs run input file (self.label + '.mdp)
            generate topology (self.label+'top')
            and structure file in .g96 format (self.label + '.g96')
        """
        from ase.io.gromos import read_gromos
        #generate structure and topology files
        # In case of predefinded topology file this is not done
        command = 'pdb2gmx' + ' '
        os.system(command + \
                      ' -f ' + self.params_runs.get('init_structure') + \
                      ' -o ' + self.label + '.g96' + \
                      ' -p ' + self.label + '.top' + \
                      ' -ff ' + self.params_runs.get('force_field') + \
                      ' -water ' + self.params_runs.get('water') + \
                      ' ' + \
                      self.params_runs.get('extra_pdb2gmx_parameters') +\
                      ' > /dev/null 2>&1')
        #                      ' > debug.log 2>&1')

        #        print command + \
        #                      ' -f ' + self.params_runs.get('init_structure') + \
        #                      ' -o ' + self.label+'.g96' + \
        #                      ' -p ' + self.label+'.top' + \
        #                      ' -ff ' + self.params_runs.get('force_field') + \
        #                      ' -water ' + self.params_runs.get('water') + \
        #                      ' ' + self.params_runs.get('extra_pdb2gmx_parameters') +\
        #                      ' > /dev/null 2>&1'
        atoms = read_gromos(self.label + '.g96')
        self.atoms = atoms.copy()
Exemplo n.º 3
0
 def run(self):
     """ runs a 0-step gromacs-mdrun with the 
     current atom-configuration """
     delnames = glob.glob('#*')
     try:
         for delname in delnames:
             os.remove(delname)
     except:
         pass
     command = self.get_command()
     if self.doing_qmmm:
         os.system(command \
                       + ' -s ' + self.base_filename + '.tpr' \
                       + ' -o ' + self.base_filename + '.trr ' \
                       + ' -e ' + self.base_filename + '.edr ' \
                       + ' -g ' + self.base_filename + '.log -ffout ' \
                       + ' -rerun ' + self.structure_file \
                       + ' ' + self.extra_mdrun_parameters \
                       + ' > mm.log 2>&1')
     else:
         os.system(command \
                       + ' -s ' + self.base_filename + '.tpr' \
                       + ' -o ' + self.base_filename + '.trr' \
                       + ' -e ' + self.base_filename + '.edr' \
                       + ' -g ' + self.base_filename + '.log -ffout ' \
                       + ' -c ' + self.structure_file \
                       + ' ' + self.extra_mdrun_parameters \
                       + '  > MM.log 2>&1')
         atoms = read_gromos(self.structure_file)
         self.atoms = atoms.copy()
Exemplo n.º 4
0
    def run(self):
        """ runs a gromacs-mdrun with the
        current atom-configuration """
        from ase.io.gromos import read_gromos

        # clean up gromacs backups
        if self.clean:
            do_clean('#*')

        command = 'mdrun'
        if self.do_qmmm:
            os.system(command \
                          + ' -s ' + self.label + '.tpr' \
                          + ' -o ' + self.label + '.trr ' \
                          + ' -e ' + self.label + '.edr ' \
                          + ' -g ' + self.label + '.log -ffout ' \
                          + ' -rerun ' + self.label + '.g96 ' \
                          + self.params_runs.get('extra_mdrun_parameters') \
                          + ' > mm.log 2>&1')
        else:
            os.system(command \
                          + ' -s ' + self.label + '.tpr ' \
                          + ' -o ' + self.label + '.trr ' \
                          + ' -e ' + self.label + '.edr ' \
                          + ' -g ' + self.label + '.log -ffout ' \
                          + ' -c ' + self.label + '.g96 ' \
                          + self.params_runs.get('extra_mdrun_parameters') \
                          + '  > MM.log 2>&1')
            atoms = read_gromos(self.label + '.g96')
            self.atoms = atoms.copy()
Exemplo n.º 5
0
    def generate_topology_and_g96file(self):
        """ from coordinates (self.label.+'pdb')
            and gromacs run input file (self.label + '.mdp)
            generate topology (self.label+'top')
            and structure file in .g96 format (self.label + '.g96')
        """
        from ase.io.gromos import read_gromos
        #generate structure and topology files
        # In case of predefinded topology file this is not done
        command = 'pdb2gmx' + ' '
        os.system(command + \
                      ' -f ' + self.params_runs.get('init_structure') + \
                      ' -o ' + self.label + '.g96' + \
                      ' -p ' + self.label + '.top' + \
                      ' -ff ' + self.params_runs.get('force_field') + \
                      ' -water ' + self.params_runs.get('water') + \
                      ' ' + \
                      self.params_runs.get('extra_pdb2gmx_parameters') +\
                      ' > /dev/null 2>&1')
#                      ' > debug.log 2>&1')

#        print command + \
#                      ' -f ' + self.params_runs.get('init_structure') + \
#                      ' -o ' + self.label+'.g96' + \
#                      ' -p ' + self.label+'.top' + \
#                      ' -ff ' + self.params_runs.get('force_field') + \
#                      ' -water ' + self.params_runs.get('water') + \
#                      ' ' + self.params_runs.get('extra_pdb2gmx_parameters') +\
#                      ' > /dev/null 2>&1'
        atoms = read_gromos(self.label + '.g96')
        self.atoms = atoms.copy()
Exemplo n.º 6
0
    def run(self):
        """ runs a gromacs-mdrun with the
        current atom-configuration """
        from ase.io.gromos import read_gromos

        # clean up gromacs backups
        if self.clean:
            do_clean('#*')

        command = 'mdrun'
        if self.do_qmmm:
            os.system(command \
                          + ' -s ' + self.label + '.tpr' \
                          + ' -o ' + self.label + '.trr ' \
                          + ' -e ' + self.label + '.edr ' \
                          + ' -g ' + self.label + '.log -ffout ' \
                          + ' -rerun ' + self.label + '.g96 ' \
                          + self.params_runs.get('extra_mdrun_parameters') \
                          + ' > mm.log 2>&1')
        else:
            os.system(command \
                          + ' -s ' + self.label + '.tpr ' \
                          + ' -o ' + self.label + '.trr ' \
                          + ' -e ' + self.label + '.edr ' \
                          + ' -g ' + self.label + '.log -ffout ' \
                          + ' -c ' + self.label + '.g96 ' \
                          + self.params_runs.get('extra_mdrun_parameters') \
                          + '  > MM.log 2>&1')
            atoms = read_gromos(self.label + '.g96')
            self.atoms = atoms.copy()
Exemplo n.º 7
0
    def generate_topology_and_g96file(self):
        """ from coordinates (self.label.+'pdb')
            and gromacs run input file (self.label + '.mdp)
            generate topology (self.label+'top')
            and structure file in .g96 format (self.label + '.g96')
        """
        #generate structure and topology files
        # In case of predefinded topology file this is not done
        subcmd = 'pdb2gmx'
        command = ' '.join([
            subcmd, '-f', self.params_runs['init_structure'], '-o',
            self.label + '.g96', '-p', self.label + '.top', '-ff',
            self.params_runs['force_field'], '-water',
            self.params_runs['water'],
            self.params_runs.get('extra_pdb2gmx_parameters', ''),
            '> {}.{}.log 2>&1'.format(self.label, subcmd)
        ])
        self._execute_gromacs(command)

        atoms = read_gromos(self.label + '.g96')
        self.atoms = atoms.copy()
Exemplo n.º 8
0
    def generate_topology_and_g96file(self):
        """ from coordinates (self.structure_file)
            and gromacs run input file (' + self.base_filename + '.mdp)
            generate topology 'self.topology_filename'
            and structure file in .g96 format
        """
        import os.path
        #generate structure and topology files 
        # In case of predefinded topology file this is not done
        command = self.prefix + 'pdb2gmx' + self.postfix + ' '
        os.system(command + \
                      ' -f ' + self.init_structure_file + \
                      ' -o ' + self.structure_file + \
                      ' -p ' + self.topology_filename + \
                      ' -ff ' + self.force_field + \
                      ' -water ' + self.water_model + \
                      ' ' + self.extra_pdb2gmx_parameters +\
                      ' > /dev/null 2>&1')
#                      ' > debug.log 2>&1')

        atoms = read_gromos(self.structure_file)
        self.atoms = atoms.copy()
Exemplo n.º 9
0
 def read_atoms(self):
     """ read atoms from file """
     self.atoms = read_gromos(self.structure_file) 
Exemplo n.º 10
0
    nsteps = '0',
    nstfout = '1',
    nstlog = '1',
    nstenergy = '1',
    nstlist = '1',
    ns_type = 'grid',
    pbc = 'xyz',
    rlist = '1.15',
    coulombtype = 'PME-Switch',
    rcoulomb = '0.8',
    vdwtype = 'shift',
    rvdw = '0.8',
    rvdw_switch = '0.75',
    DispCorr = 'Ener')
CALC_MM.generate_topology_and_g96file()
CALC_MM.generate_gromacs_run_file()

CALC_QMMM = AseQmmmManyqm(nqm_regions = 3, 
                          qm_calculators = [CALC_QM1, CALC_QM2, CALC_QM3], 
                          mm_calculator = CALC_MM,
                          link_info = 'byQM')
#                         link_info = 'byFILE') 

SYSTEM = read_gromos('gromacs_qm.g96')
SYSTEM.set_calculator(CALC_QMMM)
DYN = BFGS(SYSTEM)
DYN.run(fmax = 0.05)

print('exiting fine')
LOG_FILE.close()
Exemplo n.º 11
0
    nsteps = '0',
    nstfout = '1',
    nstlog = '1',
    nstenergy = '1',
    nstlist = '1',
    ns_type = 'grid',
    pbc = 'xyz',
    rlist = '1.15',
    coulombtype = 'PME-Switch',
    rcoulomb = '0.8',
    vdwtype = 'shift',
    rvdw = '0.8',
    rvdw_switch = '0.75',
    DispCorr = 'Ener')
CALC_MM.generate_topology_and_g96file()
CALC_MM.generate_gromacs_run_file()

CALC_QMMM = AseQmmmManyqm(nqm_regions=3,
                          qm_calculators=[CALC_QM1, CALC_QM2, CALC_QM3],
                          mm_calculator=CALC_MM,
                          link_info='byQM')
#                         link_info = 'byFILE')

SYSTEM = read_gromos('gromacs_qm.g96')
SYSTEM.set_calculator(CALC_QMMM)
DYN = BFGS(SYSTEM)
DYN.run(fmax=0.05)

print('exiting fine')
LOG_FILE.close()