introvoyz042's picture
Migrated from GitHub
5631464 verified
Raw History Blame Contribute Delete
19.5 kB
! flexref.cns
! The HADDOCK semi-flexible refinement in torsion angle space
! This version supports only distance and symmetry/ncs restraints
!
! ***********************************************************************
! * Copyright 2003-2022 Alexandre Bonvin, Utrecht University. *
! * All rights reserved. *
! * This code is part of the HADDOCK software and governed by its *
! * license. Please see the LICENSE file that should have been included *
! * as part of this package. *
! ***********************************************************************
if ( $log_level = "verbose" ) then
set message=all echo=on end
elseif ( $log_level = "normal" ) then
set message=normal echo=off end
else
set message=off echo=off end
end if
!==================================================================!
! Initialisation of variables
!==================================================================!
evaluate ($saprotocol.randrot=$randrot)
evaluate ($saprotocol.separate=$separate)
evaluate ($saprotocol.tadhigh_t=$temp_high)
evaluate ($saprotocol.t1_init=$temp_cool1_init)
evaluate ($saprotocol.t2_init=$temp_cool2_init)
evaluate ($saprotocol.t3_init=$temp_cool3_init)
evaluate ($saprotocol.t1_final=$temp_cool1_final)
evaluate ($saprotocol.t2_final=$temp_cool2_final)
evaluate ($saprotocol.t3_final=$temp_cool3_final)
evaluate ($saprotocol.inter_init_rigid=$sinter_rigid_init)
evaluate ($saprotocol.inter_fin_rigid=$sinter_rigid_final)
evaluate ($saprotocol.inter_init_cool2=$sinter_cool2_init)
evaluate ($saprotocol.inter_fin_cool2=$sinter_cool2_final)
evaluate ($saprotocol.inter_init_cool3=$sinter_cool3_init)
evaluate ($saprotocol.inter_fin_cool3=$sinter_cool3_final)
evaluate ($saprotocol.tempstep=50)
evaluate ($saprotocol.timestep=$timestep)
evaluate ($saprotocol.tadfactor=$tadfactor)
evaluate ($saprotocol.initiosteps=$mdsteps_rigid)
evaluate ($saprotocol.cool1_steps=$mdsteps_cool1)
evaluate ($saprotocol.cool2_steps=$mdsteps_cool2)
evaluate ($saprotocol.cool3_steps=$mdsteps_cool3)
evaluate ($saprotocol.fbeta=100)
evaluate ($saprotocol.mass=100)
evaluate ($data.ncomponents=$ncomponents)
! non-bonded parameter set to use
evaluate ($toppar.par_nonbonded = "OPLSX")
! dihedrals, DNA and distance restraints
evaluate ($Data.dnarest =$dnarest_on)
evaluate ($Data.flags.cdih =$dihedrals_on)
evaluate ($Data.cdih.on =$dihedrals_on)
evaluate ($Data.ssdihed =$ssdihed)
evaluate ($Data.error_dih =$error_dih)
evaluate ($data.dihedrals.on=$dihedrals_on)
evaluate ($data.dihedrals_hot=$dihedrals_hot)
evaluate ($data.dihedrals_cool1=$dihedrals_cool1)
evaluate ($data.dihedrals_cool2=$dihedrals_cool2)
evaluate ($data.dihedrals_cool3=$dihedrals_cool3)
! planarity restraints
evaluate ($Data.flags.plan = false)
! distance restraints
evaluate ($Data.flags.noe = true)
evaluate ($data.unambig_hot=$unambig_hot)
evaluate ($data.unambig_cool1=$unambig_cool1)
evaluate ($data.unambig_cool2=$unambig_cool2)
evaluate ($data.unambig_cool3=$unambig_cool3)
evaluate ($data.randremoval=$randremoval)
evaluate ($data.npart=$npart)
evaluate ($data.ambig_hot=$ambig_hot)
evaluate ($data.ambig_cool1=$ambig_cool1)
evaluate ($data.ambig_cool2=$ambig_cool2)
evaluate ($data.ambig_cool3=$ambig_cool3)
evaluate ($data.hbond_hot=$hbond_hot)
evaluate ($data.hbond_cool1=$hbond_cool1)
evaluate ($data.hbond_cool2=$hbond_cool2)
evaluate ($data.hbond_cool3=$hbond_cool3)
evaluate ($data.mrswi_hot=$mrswi_hot)
evaluate ($data.mrswi_cool1=$mrswi_cool1)
evaluate ($data.mrswi_cool2=$mrswi_cool2)
evaluate ($data.mrswi_cool3=$mrswi_cool3)
evaluate ($data.rswi_hot=$rswi_hot)
evaluate ($data.rswi_cool1=$rswi_cool1)
evaluate ($data.rswi_cool2=$rswi_cool2)
evaluate ($data.rswi_cool3=$rswi_cool3)
evaluate ($data.masy_hot=$masy_hot)
evaluate ($data.masy_cool1=$masy_cool1)
evaluate ($data.masy_cool2=$masy_cool2)
evaluate ($data.masy_cool3=$masy_cool3)
evaluate ($data.asy_hot=$asy_hot)
evaluate ($data.asy_cool1=$asy_cool1)
evaluate ($data.asy_cool2=$asy_cool2)
evaluate ($data.asy_cool3=$asy_cool3)
evaluate ($data.cmrest=$cmrest)
evaluate ($data.cmtight=$cmtight)
evaluate ($data.kcm=$kcm)
evaluate ($data.kcont=$kcont)
evaluate ($data.contactairs=$contactairs)
if ($data.contactairs eq true) then
evaluate ($data.randremoval = false)
end if
! NCS restraints
evaluate ($data.kncs = $kncs)
evaluate ($Data.flags.ncs = $ncs_on)
evaluate ($data.nncs = $nncs)
! Symmetry restraints
evaluate ($data.ksym = $ksym)
evaluate ($Data.flags.sym = $sym_on)
evaluate ($data.nc2sym = $nc2sym)
evaluate ($data.nc3sym = $nc3sym)
evaluate ($data.ns3sym = $ns3sym)
evaluate ($data.nc4sym = $nc4sym)
evaluate ($data.nc5sym = $nc5sym)
evaluate ($data.nc6sym = $nc6sym)
!Electrostatics:
evaluate ($Data.flags.dihed =$dihedflag)
evaluate ($Data.flags.elec =$elecflag)
evaluate ($Data.epsilon =$epsilon)
evaluate ($Data.epsilon_cg =$epsilon_cg)
evaluate ($Data.dielec =$dielec)
!Interaction matrix:
evaluate ($nmol1=1)
while ($nmol1 <=$data.ncomponents) loop mol1
evaluate ($nmol2=$nmol1 + 1)
evaluate ($scale.int_$nmol1_$nmol1 =$int_$nmol1_$nmol1)
while ($nmol2 <=$data.ncomponents) loop mol2
evaluate ($scale.int_$nmol1_$nmol2 =$int_$nmol1_$nmol2)
evaluate ($scale.int_$nmol2_$nmol1 =$int_$nmol1_$nmol2)
evaluate ($nmol2=$nmol2 + 1)
end loop mol2
evaluate ($nmol1 = $nmol1 + 1)
end loop mol1
! Unsupported restraints
evaluate ($Data.flags.em = false)
evaluate ($Data.flags.rg = false)
evaluate ($Data.flags.zres = false)
evaluate ($Data.flags.sani = false)
evaluate ($Data.flags.xrdc = false)
evaluate ($Data.flags.xpcs = false)
evaluate ($Data.flags.dani = false)
evaluate ($Data.flags.vean = false)
! Other parameters
evaluate ($refine.keepwater = false)
!==================================================================!
evaluate ($whichMD="torsion")
{* Read paramters and set various force field related variables *}
@MODULE:read_param.cns
set seed $seed end
parameter
bond (resn WAT ) (resn WAT ) 1000 TOKEN
angle (resn WAT ) (resn WAT ) (resn WAT ) 500 TOKEN
bond (resn HOH ) (resn HOH ) 1000 TOKEN
angle (resn HOH ) (resn HOH ) (resn HOH ) 500 TOKEN
bond (resn TIP*) (resn TIP*) 1000 TOKEN
angle (resn TIP*) (resn TIP*) (resn TIP*) 500 TOKEN
end
{* Check for the presence of ions and add covalent bond *}
@MODULE:covalions.cns
{* Define various interaction and energetics settings *}
igroup
interaction (not (resn ANI or resn DAN or resn XAN or resn DUM or resn SHA))
(not (resn ANI or resn DAN or resn XAN or resn DUM or resn SHA)) weight * 1 end
interaction (resn ANI or resn DAN or resn XAN or resn DUM or resn DUM)
(resn ANI or resn DAN or resn XAN or resn DUM or resn DUM) weight * 1 vdw 0.0 elec 0.0 end
interaction (resn SHA) (not resn SHA) weight * 0 end
! turn off vdw interaction of CG charged beads with all other particles
interaction (name SCD1) (all) weight vdw 0.0 end
interaction (name SCD2) (all) weight vdw 0.0 end
end
flag include bond angle impr vdw end
if ($Data.flags.dihed eq true) then
flag include dihed end
end if
if ($Data.flags.elec eq true) then
flag include elec end
if ($Data.dielec eq "rdie") then
parameter nbonds eps=$Data.epsilon rdie shift switch end end
! shift statement needed first to activate switch (CNS bug?)
else
parameter nbonds eps=$Data.epsilon cdie end end
end if
else
evaluate ($elec=0.0)
flag exclude elec end
end if
! check for the presence of a CG model
! and adapt non-bonded parameters
do (store4 = 0) (all)
do (store4 = 1) (name BB or name BB#)
show sum (store4) (all)
if ($result > 0) then
parameter
nbonds
nbxmod=5 atom cdie shift
cutnb=15.0 ctofnb=14.0 ctonnb=12.0 eps=$Data.epsilon_cg e14fac=0.4 inhibit 0.25
wmin=0.5 tolerance 0.5
end
end
evaluate ($coarse = TRUE)
end if
parameter nbonds ? end end
do (fbeta=$Saprotocol.fbeta) (all)
do (mass=$Saprotocol.mass) (all)
!catch possible bound water and set high T steps to 0
coor select ((resn WAT or resn HOH or resn TIP*)) end
if ($select gt 0) then
evaluate ($SaProtocol.initiosteps = 0)
evaluate ($SaProtocol.cool1_steps = 0)
evaluate ($refine.keepwater = true)
end if
! random placement of molecules
if ($SaProtocol.separate eq true) then
@MODULE:separate.cns
end if
if ($SaProtocol.randrot eq true) then
@MODULE:random_rotations.cns
end if
{* Read the distance restraints ================================ *}
set seed $seed end
set message=normal echo=on end
inline @MODULE:read_data.cns
! random removal of restaints
if ($Data.randremoval eq true) then
noe cv $npart ? end
end if
if ( $log_level = "verbose" ) then
set message=all echo=on end
elseif ( $log_level = "normal" ) then
set message=normal echo=off end
else
set message=off echo=off end
end if
evaluate ($numnoe = 0)
!Make sure that at least as many distance restraints are successfully
!read as the number of partitions for cross-validation
evaluate ($numnoe = 999)
noe ? end
if ($NUMNOE = 0) then
if ($Data.ncomponents > 1) then
if ($Data.contactairs eq FALSE) then
if ($Data.cmrest eq FALSE) then
evaluate ($errfile = "MODDIR:WARNING")
fileexist $errfile end
if ($result eq false) then
set display=$errfile end
display TOTAL NUMBER OF DISTANCE RESTRAINTS FOR FLEXIBLE REFINEMENT IS ZERO!
display CONTROL YOUR PARAMETER SETTINGS AND RESTRAINT DEFINITIONS
close $errfile end
end if
end if
end if
end if
evaluate ($Data.npart = 1)
evaluate ($Data.randremoval = FALSE)
end if
if ($NUMNOE lt $Data.npart) then
noe part=1 end
evaluate ($Data.npart = 1)
evaluate ($Data.randremoval = FALSE)
end if
{* set the energy flags ======================================================== *}
inline @MODULE:setflags.cns
{* Check for other restraints ================================================== *}
@MODULE:symmultimer.cns
if ($Data.cmrest eq true ) then
@MODULE:cm-restraints.cns
end if
if ($Data.contactairs eq true ) then
@MODULE:contactairs.cns
end if
if ($Data.dnarest eq true ) then
@MODULE:dna-rna_restraints.cns
end if
if ($Data.ssdihed eq "all" ) then
inline @MODULE:protein-ss-restraints-all.cns
end if
if ($Data.ssdihed eq "alpha" ) then
inline @MODULE:protein-ss-restraints-alpha.cns
end if
if ($Data.ssdihed eq "alphabeta" ) then
inline @MODULE:protein-ss-restraints-alpha-beta.cns
end if
{* Check for the presence of ions and add distance restraints *}
@MODULE:restrain-ions.cns
{* Check first for failed structures =========================================== *}
evaluate ($failure = false)
evaluate ($filefail=$output_pdb_filename - ".pdb" + ".fail")
fileexist $filefail end
evaluate ($failure = $result)
{* Define initial weights for distance restraints ============================== *}
evaluate ($unambig_scale = $Data.unambig_hot)
evaluate ($ambig_scale = $Data.ambig_hot)
evaluate ($hbond_scale = $Data.hbond_hot)
noe
scale dist $unambig_scale
scale ambi $ambig_scale
scale hbon $hbond_scale
end
{* Stage 0 ================================== initial EM for flexible parts only *}
! get initial energy
energy end
! fix the residues describing the shape
fix sele=(resn SHA) end
! define flexible interface
@MODULE:flex_segment_back.cns
fix sele=((attr store5 = 0 or name OO or resn SHA) and not name H* and not (resn WAT or resn HOH or resn TIP*)) end
! energy minimization
if ($nemsteps > 0) then
minimize powell nstep=$nemsteps drop=10.0 nprint=25 end
end if
fix sele=(not all) end
! get initial energy
energy end
! fix the residues describing the shape
fix sele=(resn SHA) end
! the following is added to avoid the generation of the torsion angle topology if not needed
! in cases where the number of steps is set to 0 (avoid issues with isolated atoms)
eval ($torsiondone = false)
! start SA in torsion angle unless a failure was detected
if ($failure eq false) then
{* Stage 1 ======================================= rigid body high temperature search*}
if ($nfle > 0) then
! reduce timestep in case of fully flexible segments
evaluate ($SaProtocol.tadfactor = min(4,$SaProtocol.tadfactor))
end if
if ($SaProtocol.initiosteps > 0) then
inline @MODULE:flex_segment.cns
@MODULE:torsiontop.cns
eval ($torsiondone = true)
@MODULE:sa_ltad_hightemp.cns
end if
{* Stage 2 ======================================= rigid body first slow cooling *}
if ($SaProtocol.cool1_steps > 0) then
if ($torsiondone ne true) then
inline @MODULE:flex_segment.cns
@MODULE:torsiontop.cns
eval ($torsiondone = true)
end if
if ($nfle > 0) then
! reduce timestep in case of fully flexible segments
evaluate ($SaProtocol.tadfactor = min(4,$SaProtocol.tadfactor))
end if
@MODULE:sa_ltad_cool1.cns
end if
{* Stage 3 ======================================= second slow cooling *}
{* flexible side-chains and reduced time step *}
if ($SaProtocol.cool2_steps > 0) then
if ($torsiondone eq true) then
dyna tors topo reset end end
end if
inline @MODULE:flex_segment_side.cns
@MODULE:torsiontop.cns
eval ($torsiondone = true)
evaluate ($SaProtocol.tadfactor = 1)
@MODULE:sa_ltad_cool2.cns
end if
{* Stage 4 ============================================ third slow cooling *}
{* flexible side-chains and backbone at interface and reduced time step *}
if ($SaProtocol.cool3_steps > 0) then
if ($torsiondone eq true) then
dyna tors topo reset end end
end if
inline @MODULE:flex_segment_back.cns
@MODULE:torsiontop.cns
eval ($torsiondone = true)
evaluate ($SaProtocol.tadfactor = 1)
@MODULE:sa_ltad_cool3.cns
end if
end if
{* Stage 5 =========================== final minimization *}
! define flexible segments and fix the remaining of the structure
@MODULE:flex_segment_back.cns
fix sele=((attr store5 = 0 or name OO or resn SHA) and not name H* and not (resn WAT or resn HOH or resn TIP* or resn XAN)) end
! energy minimization
if ($nemsteps > 0) then
minimize powell nstep=$nemsteps drop=10.0 nprint=25 end
end if
! final energy
fix sele=(not all) end
{* ======================= calculate free molecules internal energy *}
igroup
interaction (not (resn ANI or resn DAN or resn XAN or resn SHA or resn WAT or resn HOH or resn TIP* or resn DUM))
(not (resn ANI or resn DAN or resn XAN or resn SHA or resn WAT or resn HOH or resn TIP* or resn DUM)) weight * 1 end
end
do (refx=x) (all)
do (refy=y) (all)
do (refz=z) (all)
fix sele=(resn ANI or resn DAN or resn XAN or resn SHA or resn WAT or resn HOH or resn TIP* or resn DMS) end
flag excl noe dani sani vean xrdc xpcs coll cdih zhar end
flag include bond angle dihe impr vdw end
evaluate ($elec = 0.0)
evaluate ($eintfree = 0.0)
if ($Data.flags.elec eq true) then
flag include elec end
end if
if ($Data.dielec eq "rdie") then
parameter nbonds eps=$Data.epsilon rdie shift switch end end
! shift statement needed first to activate switch (CNS bug?)
else
parameter nbonds eps=$Data.epsilon cdie end end
end if
parameter nbonds ? end end
inline @MODULE:calc_free-ene.cns
fix sele=(not all) end
do (x = refx) (all)
do (y = refy) (all)
do (z = refz) (all)
{* ===================== calculate complex internal energy *}
evaluate ($kinter = 1.0)
flag include bond angle dihe impr vdw end
energy end
@MODULE:scale_intra_only.cns
evaluate ($elec = 0.0)
evaluate ($eintcplx = 0.0)
if ($Data.flags.elec eq true) then
flag include elec end
end if
energy end
evaluate ($eintcplx = $bond + $angl + $impr + $dihe + $vdw + $elec)
evaluate ($ebond = $bond)
evaluate ($eangl= $angl)
evaluate ($eimpr= $impr)
evaluate ($edihe= $dihe)
evaluate ($result=0)
print thres=0.05 bonds
evaluate ($rms_bonds=$result)
evaluate ($result=0)
print thres=5. angles
evaluate ($rms_angles=$result)
evaluate ($result=0)
print thres=5. impropers
evaluate ($rms_impropers=$result)
evaluate ($result=0)
print thres=30. dihedrals
evaluate ($rms_dihedrals=$result)
{* ===================== calculate final energies and write structure *}
evaluate ($cdih=0.0)
flag incl noe cdih end
if ($Data.ncomponents > 1) then
evaluate ($kinter = 1.0)
@MODULE:scale_inter_final.cns
else
@MODULE:scale_intra_only.cns
end if
noe
scale dist $Data.unambig_cool3
scale ambi $Data.ambig_cool3
scale hbon $Data.hbond_cool3
scale symm 0.0
scale cont 0.0
end
energy end
evaluate ($eair= $noe)
evaluate ($esym = 0.0)
evaluate ($ncs = 0.0)
evaluate ($zhar = 0.0)
evaluate ($rms_test_noe = 0.0)
evaluate ($violations_test_noe = 0)
if ($Data.flags.sym eq true) then
! calculatee first the symmetry energy
noe reset nres= 1200000 end
@MODULE:symmultimer.cns
noe
scale symm $Data.ksym
end
energy end
evaluate ($esym = $noe)
noe reset end
set seed=$seed end
!read back all the distance restraints:
@@MODULE:read_noes.cns
! random removal of restaints
if ($Data.randremoval eq true) then
noe cv $npart ? end
end if
noe
scale dist $Data.unambig_cool3
scale ambi $Data.ambig_cool3
scale hbon $Data.hbond_cool3
end
evaluate ($result = 0)
print threshold=0.3 noe
evaluate ($rms_noe=$result)
evaluate ($violations_noe=$violations)
if ($Data.randremoval eq true) then
evaluate ($rms_test_noe=$test_rms)
evaluate ($violations_test_noe=$test_violations)
end if
else
evaluate ($result = 0)
print threshold=0.3 noe
evaluate ($rms_noe=$result)
evaluate ($violations_noe=$violations)
if ($Data.randremoval eq true) then
evaluate ($rms_test_noe=$test_rms)
evaluate ($violations_test_noe=$test_violations)
end if
end if
if ($Data.dnarest eq true ) then
@MODULE:dna-rna_restraints.cns
end if
energy end
evaluate ($etot = $ener - $noe)
evaluate ($noe = $eair)
evaluate ($etot = $etot + $noe)
inline @MODULE:print_coorheader.cns
{* determine whether the final models should be reoriented along their principal *}
{* axes before writing to file ================================================= *}
eval($reorient = true)
evaluate ($ncount = 0)
while ($ncount < $data.ncomponents) loop orientmol
evaluate ($ncount = $ncount + 1)
eval($watersegname_$ncount="WA" + encode($ncount))
if ($mol_fix_origin_$ncount eq true) then
eval($reorient = false)
end if
end loop orientmol
if ($reorient = true) then
coor sele= (not name H* and not resn ANI and not resn XAN and not resn DAN) orient end
end if
inline @MODULE:check_coordinates.cns
if ($failure eq true) then
evaluate ($failfile = $output_pdb_filename - ".pdb" + ".fail")
set display=$failfile end
display "MAX/MIN possible coordinates exceeded - stopping"
close $failfile end
stop
else
write coordinates format=pdbo output=$output_pdb_filename end
end if
display OUTPUT: $output_pdb_filename
stop