#This script is used to draw isosurface map of cube files generated by Multiwfn
#Written by Tian Lu (sobereva@sina.com), 2019-May-18

proc cub {filename {isoval 0.05}} {
#default material
set mater Glossy

color Display Background white
display depthcue off
display rendermode GLSL
axes location Off
color Name C tan
color change rgb tan 0.700000 0.560000 0.360000
material change mirror Opaque 0.0
material change outline Opaque 4.000000
material change outlinewidth Opaque 0.5
material change ambient Glossy 0.1
material change diffuse Glossy 0.600000
material change opacity Glossy 0.75
material change shininess Glossy 1.0
light 3 on

foreach i [molinfo list] {
mol delete $i
}

mol new $filename.cub
mol modstyle 0 top CPK 0.800000 0.300000 22.000000 22.000000
mol addrep top
mol modstyle 1 top Isosurface $isoval 0 0 0 1 1
mol modcolor 1 top ColorID 12
mol modmaterial 1 top $mater
mol addrep top
mol modstyle 2 top Isosurface -$isoval 0 0 0 1 1
mol modcolor 2 top ColorID 22
mol modmaterial 2 top $mater
display distance -8.0
display height 10
}

proc cubiso {isoval} {
mol modstyle 1 top Isosurface $isoval 0 0 0 1 1
mol modstyle 2 top Isosurface -$isoval 0 0 0 1 1
}

proc cub2 {filename1 filename2 {isoval 0.05}} {
#default material
set mater Glossy

color Display Background white
display depthcue off
display rendermode GLSL
axes location Off
color Name C tan
color change rgb tan 0.700000 0.560000 0.360000
material change mirror Opaque 0.0
material change outline Opaque 4.000000
material change outlinewidth Opaque 0.5
material change ambient Glossy 0.1
material change diffuse Glossy 0.600000
material change opacity Glossy 0.75
material change shininess Glossy 1.0
light 3 on

foreach i [molinfo list] {
mol delete $i
}

mol new $filename1.cub
mol modstyle 0 top CPK 0.800000 0.300000 22.000000 22.000000
mol addrep top
mol modstyle 1 top Isosurface $isoval 0 0 0 1 1
mol modcolor 1 top ColorID 12
mol modmaterial 1 top $mater

mol new $filename2.cub
mol modstyle 0 top CPK 0.800000 0.300000 22.000000 22.000000
mol addrep top
mol modstyle 1 top Isosurface $isoval 0 0 0 1 1
mol modcolor 1 top ColorID 22
mol modmaterial 1 top $mater

display distance -8.0
display height 10
}

proc cub2iso {isoval} {
foreach i [molinfo list] {
mol modstyle 1 $i Isosurface $isoval 0 0 0 1 1
}
}