예제 #1
0
    def setUp(self):
        # Obtain topologies/positions
        prmtop = utils.get_data_filename('blues', 'tests/data/TOL-parm.prmtop')
        inpcrd = utils.get_data_filename('blues', 'tests/data/TOL-parm.inpcrd')
        structure = parmed.load_file(prmtop, xyz=inpcrd)

        self.atom_indices = utils.atomIndexfromTop('LIG', structure.topology)
        self.functions = { 'lambda_sterics' : 'step(0.199999-lambda) + step(lambda-0.2)*step(0.8-lambda)*abs(lambda-0.5)*1/0.3 + step(lambda-0.800001)',
                           'lambda_electrostatics' : 'step(0.2-lambda)- 1/0.2*lambda*step(0.2-lambda) + 1/0.2*(lambda-0.8)*step(lambda-0.8)' }
        self.opt = { 'temperature' : 300.0, 'friction' : 1, 'dt' : 0.002,
                'nIter' : 10, 'nstepsNC' : 10, 'nstepsMD' : 50,
                'nonbondedMethod' : 'PME', 'nonbondedCutoff': 10, 'constraints': 'HBonds',
                'trajectory_interval' : 10, 'reporter_interval' : 10,
                'platform' : None, 'outfname' : 'smartdart-test',
                'verbose' : False }


        #Initialize the SmartDartMove object
        self.move = SmartDartMove(structure,
            basis_particles=[100, 110, 150],
            coord_files = [inpcrd, inpcrd], topology=prmtop,
            self_dart=False, resname='LIG', )
        self.engine = MoveEngine(self.move)
        self.engine.selectMove()
        #Initialize the SimulationFactory object
        sims = SimulationFactory(structure, self.engine, **self.opt)
        system = sims.generateSystem(structure, **self.opt)
        alch_system = sims.generateAlchSystem(system, self.atom_indices)
        self.nc_sim = sims.generateSimFromStruct(structure, self.engine, alch_system, ncmc=True, **self.opt)

        self.initial_positions = self.nc_sim.context.getState(getPositions=True).getPositions(asNumpy=True)
예제 #2
0
    def test_freeze_radius(self, system_cfg):
        print('Testing freeze_radius')
        freeze_cfg = {'freeze_center': ':LIG', 'freeze_solvent': ':Cl-', 'freeze_distance': 3.0 * unit.angstroms}
        # Setup toluene-T4 lysozyme system
        prmtop = utils.get_data_filename('blues', 'tests/data/TOL-parm.prmtop')
        inpcrd = utils.get_data_filename('blues', 'tests/data/TOL-parm.inpcrd')
        structure = parmed.load_file(prmtop, xyz=inpcrd)
        atom_indices = utils.atomIndexfromTop('LIG', structure.topology)
        system = SystemFactory.generateSystem(structure, **system_cfg)

        # Freeze everything around the binding site
        frzn_sys = SystemFactory.freeze_radius(structure, system, **freeze_cfg)

        # Check that the ligand has NOT been frozen
        lig_masses = [system.getParticleMass(i)._value for i in atom_indices]
        assert all(m != 0 for m in lig_masses)

        # Check that the binding site has NOT been frozen
        selection = "({freeze_center}<:{freeze_distance._value})&!({freeze_solvent})".format(**freeze_cfg)
        site_idx = SystemFactory.amber_selection_to_atomidx(structure, selection)
        masses = [frzn_sys.getParticleMass(i)._value for i in site_idx]
        assert all(m != 0 for m in masses)

        # Check that the selection has been frozen
        # Invert that selection to freeze everything but the binding site.
        freeze_idx = set(range(system.getNumParticles())) - set(site_idx)
        massless = [frzn_sys.getParticleMass(i)._value for i in freeze_idx]
        assert all(m == 0 for m in massless)
예제 #3
0
    def test_freeze_radius(self, system_cfg):
        print('Testing freeze_radius')
        freeze_cfg = {
            'freeze_center': ':LIG',
            'freeze_solvent': ':Cl-',
            'freeze_distance': 3.0 * unit.angstroms
        }
        # Setup toluene-T4 lysozyme system
        prmtop = utils.get_data_filename('blues', 'tests/data/TOL-parm.prmtop')
        inpcrd = utils.get_data_filename('blues', 'tests/data/TOL-parm.inpcrd')
        structure = parmed.load_file(prmtop, xyz=inpcrd)
        atom_indices = utils.atomIndexfromTop('LIG', structure.topology)
        system = SystemFactory.generateSystem(structure, **system_cfg)

        # Freeze everything around the binding site
        frzn_sys = SystemFactory.freeze_radius(structure, system, **freeze_cfg)

        # Check that the ligand has NOT been frozen
        lig_masses = [system.getParticleMass(i)._value for i in atom_indices]
        assert all(m != 0 for m in lig_masses)

        # Check that the binding site has NOT been frozen
        selection = "({freeze_center}<:{freeze_distance._value})&!({freeze_solvent})".format(
            **freeze_cfg)
        site_idx = SystemFactory.amber_selection_to_atomidx(
            structure, selection)
        masses = [frzn_sys.getParticleMass(i)._value for i in site_idx]
        assert all(m != 0 for m in masses)

        # Check that the selection has been frozen
        # Invert that selection to freeze everything but the binding site.
        freeze_idx = set(range(system.getNumParticles())) - set(site_idx)
        massless = [frzn_sys.getParticleMass(i)._value for i in freeze_idx]
        assert all(m == 0 for m in massless)
예제 #4
0
    def setUp(self):
        # Obtain topologies/positions
        prmtop = utils.get_data_filename('blues', 'tests/data/TOL-parm.prmtop')
        inpcrd = utils.get_data_filename('blues', 'tests/data/TOL-parm.inpcrd')
        structure = parmed.load_file(prmtop, xyz=inpcrd)

        self.atom_indices = utils.atomIndexfromTop('LIG', structure.topology)

        #Initialize the Move object
        self.move = RandomLigandRotationMove(structure, 'LIG', 3134)
        self.engine = MoveEngine(self.move)
        self.engine.selectMove()

        self.system_cfg = {'nonbondedMethod': app.NoCutoff, 'constraints': app.HBonds}
        systems = SystemFactory(structure, self.move.atom_indices, self.system_cfg)

        #Initialize the SimulationFactory object
        self.cfg = {
            'dt': 0.002 * unit.picoseconds,
            'friction': 1 * 1 / unit.picoseconds,
            'temperature': 300 * unit.kelvin,
            'nprop': 1,
            'nIter': 1,
            'nstepsMD': 1,
            'nstepsNC': 10,
            'alchemical_functions': {
                'lambda_sterics':
                'step(0.199999-lambda) + step(lambda-0.2)*step(0.8-lambda)*abs(lambda-0.5)*1/0.3 + step(lambda-0.800001)',
                'lambda_electrostatics':
                'step(0.2-lambda)- 1/0.2*lambda*step(0.2-lambda) + 1/0.2*(lambda-0.8)*step(lambda-0.8)'
            }
        }
        self.simulations = SimulationFactory(systems, self.engine, self.cfg)
        self.ncmc_sim = self.simulations.ncmc
        self.initial_positions = self.ncmc_sim.context.getState(getPositions=True).getPositions(asNumpy=True)
예제 #5
0
    def setUp(self):
        # Obtain topologies/positions
        prmtop = utils.get_data_filename('blues', 'tests/data/TOL-parm.prmtop')
        inpcrd = utils.get_data_filename('blues', 'tests/data/TOL-parm.inpcrd')
        structure = parmed.load_file(prmtop, xyz=inpcrd)

        self.atom_indices = utils.atomIndexfromTop('LIG', structure.topology)

        #Initialize the SmartDartMove object
        self.move = SmartDartMove(
            structure,
            basis_particles=[100, 110, 150],
            coord_files=[inpcrd, inpcrd],
            topology=prmtop,
            self_dart=False,
            resname='LIG',
        )
        self.engine = MoveEngine(self.move)
        self.engine.selectMove()

        self.system_cfg = {
            'nonbondedMethod': app.NoCutoff,
            'constraints': app.HBonds
        }
        systems = SystemFactory(structure, self.move.atom_indices,
                                self.system_cfg)

        #Initialize the SimulationFactory object
        self.cfg = {
            'dt': 0.002 * unit.picoseconds,
            'friction': 1 * 1 / unit.picoseconds,
            'temperature': 300 * unit.kelvin,
            'nIter': 10,
            'nstepsMD': 50,
            'nstepsNC': 10,
            'alchemical_functions': {
                'lambda_sterics':
                'step(0.199999-lambda) + step(lambda-0.2)*step(0.8-lambda)*abs(lambda-0.5)*1/0.3 + step(lambda-0.800001)',
                'lambda_electrostatics':
                'step(0.2-lambda)- 1/0.2*lambda*step(0.2-lambda) + 1/0.2*(lambda-0.8)*step(lambda-0.8)'
            }
        }
        sims = SimulationFactory(systems, self.engine, self.cfg)
        self.ncmc_sim = sims.ncmc

        self.initial_positions = self.ncmc_sim.context.getState(
            getPositions=True).getPositions(asNumpy=True)
예제 #6
0
    def setUp(self):
        # Load the waterbox with toluene into a structure.
        self.prmtop = utils.get_data_filename('blues',
                                              'tests/data/TOL-parm.prmtop')
        self.inpcrd = utils.get_data_filename('blues',
                                              'tests/data/TOL-parm.inpcrd')
        self.structure = parmed.load_file(self.prmtop, xyz=self.inpcrd)
        self.atom_indices = utils.atomIndexfromTop('LIG',
                                                   self.structure.topology)

        self.system_cfg = {
            'nonbondedMethod': app.PME,
            'nonbondedCutoff': 8.0 * unit.angstroms,
            'constraints': app.HBonds
        }
        self.systems = SystemFactory(self.structure, self.atom_indices,
                                     self.system_cfg)
예제 #7
0
                                       title='md',
                                       step=True,
                                       speed=True,
                                       progress=True,
                                       totalSteps=int(n_steps * nIter))

ncmc_state_reporter = BLUESStateDataStorage(reportInterval=reportInterval,
                                            title='ncmc',
                                            step=True,
                                            speed=True,
                                            progress=True,
                                            remainingTime=True,
                                            totalSteps=int(n_steps * nIter))

# Iniitialize our Move set
alchemical_atoms = utils.atomIndexfromTop('LIG', tol.topology)
rot_move = RandomLigandRotationMove(timestep=timestep,
                                    n_steps=n_steps,
                                    atom_subset=alchemical_atoms,
                                    reporters=[ncmc_state_reporter])
langevin_move = ReportLangevinDynamicsMove(
    timestep=timestep,
    collision_rate=collision_rate,
    n_steps=n_steps,
    reassign_velocities=True,
    reporters=[md_reporter, state_reporter])
sampler = BLUESSampler(thermodynamic_state=thermodynamic_state,
                       alch_thermodynamic_state=alch_thermodynamic_state,
                       sampler_state=sampler_state,
                       ncmc_move=rot_move,
                       dynamics_move=langevin_move,
예제 #8
0
def tol_atom_indices(structure):
    atom_indices = utils.atomIndexfromTop('LIG', structure.topology)
    return atom_indices
예제 #9
0
def tol_atom_indices(structure):
    atom_indices = utils.atomIndexfromTop('LIG', structure.topology)
    return atom_indices