# YASARA MACRO # TOPIC: 4. Molecular modeling # TITLE: Running an energy minimization # REQUIRES: Dynamics # AUTHOR: Elmar Krieger # LICENSE: GPL # DESCRIPTION: This macro runs an energy minimization of the soup. Compared to the normal minimization experiment, it temporarily adds a water shell so that all force fields can be used directly, also those optimized for use with explicit solvent # Clean the soup Clean # Make sure we have a cell cellfound = CountObj SimCell if !cellfound Cell Auto,Extension=12 # Make sure that at least one atom is free to move fixedatoms = CountAtom fixed if fixedatoms==Atoms RaiseError "All atoms are currently fixed, which makes an energy minimization impossible. Click Simulation > Free > All first." # Specify the minimization convergence in kJ/mol EnergyUnit kJ/mol fof = ForceField if fof!='NOVA' # Force field for explicit solvent # Do we already have enough waters present? waters = CountRes Water srfacc = SurfRes !Water,accessible if not waters or srfacc/waters>15 # No, create and minimize water shell Experiment Neutralization NaCl 0 Speed fast Experiment On Wait ExpEnd DelRes Water with distance>6 from !Water else # Remember which atoms have been fixed fixedlist() = ListAtom fixed # Fix everything except water Fix FreeRes Water # Energy minimize first the water alone ShowMessage "Running quick energy minimization of water molecules..." Experiment Minimization Convergence 0.1 Experiment On Wait ExpEnd # Fix those atoms that were fixed by the user before Free if count fixedlist FixAtom (join fixedlist) # Main energy minimization ShowMessage "Running main energy minimization..." Experiment Minimization # Converge as soon as the energy improves by less than 0.05 kJ/mol per atom during 200 steps Convergence 0.05 Experiment On Wait ExpEnd # Final check that minimization did not introduce errors wronghands = Check Isomers cisbonds = Check PepBonds if wronghands or cisbonds ShowMessage 'WARNING - There are (0+wronghands) wrong isomers and (0+cisbonds) cis-peptide bonds. Try again with automatic correction...' Wait ContinueButton HideMessage