Exemplo n.º 1
0
            def __call__(self, pars, namespace, values, option_string=None):
                """This function is executed when Torsion maker is called."""

                # TODO Should this be here?

                # load in the ligand molecule
                mol = Ligand(values)

                # Prompt the user for the scan order
                scanner = TorsionScan(mol)
                scanner.find_scan_order()

                # Write out the scan file
                with open('QUBE_torsions.txt', 'w+') as qube:
                    qube.write(
                        '# dihedral definition by atom indices starting from 1\n#  i      j      k      l\n'
                    )
                    for scan in mol.scan_order:
                        scan_di = mol.dihedrals[scan][0]
                        qube.write(
                            f'  {scan_di[0]:2}     {scan_di[1]:2}     {scan_di[2]:2}     {scan_di[3]:2}\n'
                        )
                printf('QUBE_torsions.txt made.')

                sys.exit()
Exemplo n.º 2
0
            def __call__(self, pars, namespace, values, option_string=None):
                # load in the ligand
                mol = Ligand(values)

                # Prompt the user for the scan order
                scanner = TorsionScan(mol)
                scanner.find_scan_order()

                # Write out the scan file
                with open(f'{mol.name}.dihedrals', 'w+') as qube:
                    qube.write('# dihedral definition by atom indices starting from 0\n#  i      j      k      l\n')
                    for scan in mol.scan_order:
                        scan_di = mol.dihedrals[scan][0]
                        qube.write(f'  {scan_di[0]:2}     {scan_di[1]:2}     {scan_di[2]:2}     {scan_di[3]:2}\n')
                printf(f'{mol.name}.dihedrals made.')

                sys.exit()
Exemplo n.º 3
0
    def torsion_scan(molecule):
        """Perform torsion scan."""

        scan = TorsionScan(molecule)

        # Try to find a scan file; if none provided and more than one torsion detected: prompt user
        try:
            copy('../../QUBE_torsions.txt', 'QUBE_torsions.txt')
            scan.find_scan_order(file='QUBE_torsions.txt')
        except FileNotFoundError:
            scan.find_scan_order()

        scan.start_scan()

        append_to_log('Torsion_scans complete')

        return molecule
Exemplo n.º 4
0
    def torsion_scan(molecule):
        """Perform torsion scan."""
        append_to_log('Starting torsion_scans')

        tor_scan = TorsionScan(molecule)

        # Check that we have a scan order for the molecule this should of been captured from the dihedral file
        tor_scan.find_scan_order()
        tor_scan.scan()

        append_to_log('Finishing torsion_scans')

        return molecule
Exemplo n.º 5
0
    def torsion_scan(molecule):
        """Perform torsion scan."""
        # TODO find constraints file if present
        append_to_log('Starting torsion_scans')

        molecule.find_rotatable_dihedrals()
        molecule.symmetrise_from_topo()

        scan = TorsionScan(molecule)

        # Try to find a scan file; if none provided and more than one torsion detected: prompt user
        try:
            copy('../../QUBE_torsions.txt', 'QUBE_torsions.txt')
            scan.find_scan_order(file='QUBE_torsions.txt')
        except FileNotFoundError:
            scan.find_scan_order()

        scan.scan()

        append_to_log('Finishing torsion_scans')

        return molecule
Exemplo n.º 6
0
    def torsion_optimise(molecule):
        """Perform torsion optimisation."""

        append_to_log('Starting torsion_optimisations')

        # First we should make sure we have collected the results of the scans
        if molecule.qm_scans is None:
            os.chdir(os.path.join(molecule.home, '09_torsion_scan'))
            scan = TorsionScan(molecule)
            if molecule.scan_order is None:
                scan.find_scan_order()
            scan.collect_scan()
            os.chdir(os.path.join(molecule.home, '10_torsion_optimise'))

        TorsionOptimiser(molecule).run()

        append_to_log('Finishing torsion_optimisations')

        return molecule
Exemplo n.º 7
0
    def torsion_optimise(molecule):
        """Perform torsion optimisation."""

        append_to_log('Starting torsion_optimisations')

        # First we should make sure we have collected the results of the scans
        if not molecule.qm_scans:
            os.chdir(os.path.join(molecule.home, '9_torsion_scan'))
            scan = TorsionScan(molecule)
            scan.find_scan_order()
            scan.collect_scan()
            os.chdir(os.path.join(molecule.home, '10_torsion_optimise'))

        opt = TorsionOptimiser(molecule,
                               refinement=molecule.refinement_method,
                               vn_bounds=molecule.tor_limit)
        opt.run()

        append_to_log('Finishing torsion_optimisations')

        return molecule