proc add_contour {molNum value color} {
#
# This procedure adds an isocontour to molecule <molNum>
# with the value <value> and colors it with colorId <color>
#
	set repnum [molinfo $molNum  get numreps]
	mol color colorid $color
	mol material Transparent
	mol addrep $molNum
	mol selection all
	mol modstyle $repnum $molNum Isosurface $value 0.0 0.0 0.0
}

proc load_lig {} {
    mol new bx6_7_lig_apbs.pqr type pdb
    mol modstyle 0 0 cpk
    rock x by 2
    display update

    mol addfile ligand.dx
    add_contour 0 -1.0 1
    add_contour 0  1.0 0

}

proc load_apo {} {

    mol delete 0 

    mol new bx6_7_apo_apbs.pqr type pdb
    mol modstyle 0 1 Tube
    mol modmaterial 0 1 Opaque
    rock x by 2
    display update

    mol addfile apo.dx 
    add_contour 1 -1.0 1
    add_contour 1  1.0 0
}

proc load_complex {} {
	mol delete 1
    rock off
    display update

    mol new bx6_7_bin_apbs.pqr type pdb
    mol modstyle 0 2 Tube
    mol modmaterial 0 2 Opaque
    display update

    mol addrep 2
    mol modselect 1 2 acidic within 10 of (resname BX6)
    mol modcolor 1 2 colorid 1
    mol modstyle 1 2 cpk
    mol modmaterial 1 2 Opaque
    display update

    mol addrep 2
    mol modselect 2 2 basic within 10 of (resname BX6)
    mol modcolor 2 2 colorid 0
    mol modstyle 2 2 cpk
    mol modmaterial 2 2 Opaque
    display update

    mol load pdb bx6_7_lig_apbs.pqr
    mol modstyle 0 3 cpk
    mol modcolor 0 3 colorid 4
    mol modmaterial 0 3 Opaque
    display update

    mol addfile ligand.dx 
    add_contour 3 -1.0 1
    add_contour 3  1.0 0

    molinfo 2 set rotate_matrix {{{0.231071 0.223286 0.946968 0.000000} {0.778443 -0.626291 -0.042276 0.000000} {0.583638 0.746929 -0.318533 0.000000} {0.000000 0.000000 0.000000 1.000000}}}
    molinfo 2 set scale_matrix {{{0.082006 0.000000 0.000000 0.000000} {0.000000 0.082006 0.000000 0.000000} {0.000000 0.000000 0.082006 0.000000} {0.000000 0.000000 0.000000 1.000000}}}
    molinfo 3 set rotate_matrix {{{0.231071 0.223286 0.946968 0.000000} {0.778443 -0.626291 -0.042276 0.000000} {0.583638 0.746929 -0.318533 0.000000} {0.000000 0.000000 0.000000 1.000000}}}
    molinfo 3 set scale_matrix {{{0.082006 0.000000 0.000000 0.000000} {0.000000 0.082006 0.000000 0.000000} {0.000000 0.000000 0.082006 0.000000} {0.000000 0.000000 0.000000 1.000000}}}
}
