# YASARA MACRO # TOPIC: 3. Molecular Dynamics # TITLE: Running a steered molecular dynamics simulation in water # REQUIRES: Dynamics # AUTHOR: Elmar Krieger # LICENSE: GPL # DESCRIPTION: This macro sets up and runs a steered simulation to pull a ligand from its binding site. As soon as they have been pulled apart completely and atoms start crossing periodic boundaries, the macro works no longer correctly # Parameter section - adjust as needed, but NOTE that some changes only take # effect if you start an entirely new simulation, not if you continue an existing one. # ==================================================================================== # The structure to simulate must be present with a .pdb or .sce extension. # If a .sce (=YASARA scene) file is present, the cell must have been added. # You can either set the target structure by clicking on Options > Macro > Set target, # or by uncommenting the line below and specifying it directly. #MacroTarget = 'c:\MyProject\1bfb' # Selection of ligand residue(s), must be adapted. This example is for 1BFB. # (if the ligand is a protein, you can simply use its molecule name, e.g. 'Mol B') ligand = 'Res SGN IDS' # Selection of receptor residues # (if the ligand is also a protein, replace with the receptor's molecule name, e.g. 'Mol A') receptor = 'Protein' # Simulation temperature temperature = '298K' # The pulling acceleration in picometers/picosecond^2 # This must be large enough to pull off the ligand acceleration = 2000. # Time in picoseconds when the pulling starts # (everything before can be considered equilibration) pullstart = 1 # Name of solvent molecules used to measure solvent density solvent = 'HOH' # Solvent density in g/ml (0.997 is water at 298K) # If you run at a significantly different temperature, this density needs to # be adapted. Look at the PressureCtrl documentation. # For solvents other than water, you have to create your own solvent box # as described at the FillCellObj documentation and save it as .._solvent.sce density = 0.997 # pH at which the simulation should be run pH = 7.0 # NaCl concentration in mass percent (0.9% is a physiological solution) NaCl = 0.9 # Multiple timestep: 1.25 femtoseconds for intramolecular and 2*1.25 fs for intermolecular forces timestep = '2,1.25' # Save simulation snapshots every 3000 simulation steps # (with a timestep of 2*1.25=2.5 femtoseconds, that's 3000*2.5 fs = 7.5 picoseconds). savesteps = 3000 # The format used to save the trajectories, sim or xtc format = 'sim' # Forcefield to use (these are all YASARA commands, so no '=' used) ForceField AMBER03 # Cutoff Cutoff 7.86 # Cell boundary Boundary periodic # Use longrange coulomb forces (particle-mesh Ewald) Longrange Coulomb # Treat all simulation warnings as errors that stop the macro WarnIsError On # Normally no change required below this point # Temperature Temp (temperature) Console Off # Do we have a target? if MacroTarget=='' RaiseError "This macro requires a target. Either edit the macro file or click Options > Macro > Set target to choose a target structure" Clear # Do we already have a scene with water or other solvent? waterscene = FileSize (MacroTarget)_water.sce solventscene = FileSize (MacroTarget)_solvent.sce if waterscene LoadSce (MacroTarget)_water elif solventscene LoadSce (MacroTarget)_solvent else # No scene with water present yet if solvent!='HOH' RaiseError "When using a solvent other than water, the cell cannot be filled automatically. Look at the documentation of the FillCellObj command" # Do we have a scene at all? scene = FileSize (MacroTarget).sce if scene LoadSce (MacroTarget) else # No scene present, assume it's a PDB or YOB file for type in 'pdb','yob','Error' size = FileSize (MacroTarget).(type) if size obj = Load(type) (MacroTarget) # Align object with major axes to minimize cell size NiceOriObj (obj) break if type=='Error' RaiseError "Initial structure not found. Make sure to create a project directory and place the structure there" Clean # Create the simulation cell, 2*10 A larger than the protein along each axis Cell Auto,Extension=10 SaveSce (MacroTarget) # Fill with water, predict pKas, place counter ions Experiment Neutralization WaterDensity (density) pH (pH) NaCl (NaCl) pKaFile (MacroTarget).pka Speed Fast Experiment On Wait ExpEnd # Save scene with water SaveSce (MacroTarget)_water # Make sure that ligand and receptor are really present for type in 'ligand','receptor' (type)atoms = CountAtom ((type)) if !(type)atoms RaiseError 'This macro requires that the (type) is selected explicitly. The current (type) ((type)) was not found' # Start the Simulation TimeStep (timestep) Sim On # Make sure all atoms are free to move Free # Alread a snapshot/trajectory present? i=00000 filename = '(MacroTarget)(i).(format)' running = FileSize (filename) if not running # Simulation has not been running before, start now # Do a short steepest descent energy minimization TempCtrl SteepDes ShowMessage "Starting simulation with a steepest descent minimization..." # Wait for convergence (until the maximum atom speed drops below 2200 m/s) Wait SpeedMax<2200 # Continue with 500 simulated annealing steps ShowMessage "Continuing with 500 simulated annealing steps..." Temp 0 TempCtrl Anneal Wait 500 # And now start with the real simulation HideMessage Temp (temperature) # Reset time to 0 Time 0 else # Simulation has been running before if format=='sim' # Find and load the last 'sim' snapshot do i = i+1 found = FileSize (MacroTarget)(i).sim while found LoadSim (MacroTarget)(i-1) else # XTC format requires that the entire trajectory is read in to find the last one do i = i+1 eof,time = LoadXTC (filename),(i) ShowMessage 'Searching XTC trajectory for last snapshot, showing snapshot (i) at (0+time) fs' Wait 1 while !eof HideMessage # Set temperature and pressure control TempCtrl Rescale PressureCtrl SolventProbe,(solvent),(density) # And finally, make sure that future snapshots are saved Save(format) (filename),(savesteps) # Run the steered simulation while 1 t = Time t=t/1000 if t>pullstart # Steer the simulation # Get the geometric centers of receptor and ligand rpos() = GroupCenter (receptor) lpos() = GroupCenter (ligand) # Calculate the normalized direction vector from receptor to ligand dir()=lpos-rpos dis=norm dir ShowMessage 'Steering simulation. Current ligand - receptor distance is (0.00+dis) A' scale=(1./dis)*acceleration # Apply the acceleration, but in opposite directions on receptor and ligand # NOTE that this recipe only works as long the complex doesn't cross a periodic boundary AccelAtom (ligand),(dir*scale*5) AccelAtom (receptor),(dir*-scale) # Let YASARA simulate one step per screen update/Wait SimSteps 1 else ShowMessage 'Equilibration, steered simulation starts in (0.00+pullstart-t) picoseconds...' # Proceed with one simulation step Wait 1