TCL script for VMD to open the backbone of a protein


set molback [atomselect top "backbone"] 
set backbone_idx [$molback get index ]
foreach backatom [split $backbone_idx ] {
	set adj [atomselect top "not (same residue as index $backatom) and within 2 of (index $backatom)"]
	if  {[llength [split [$adj get index]]] == 1} { 
		puts -nonewline $backatom
		puts -nonewline " -> "
		if { [$adj get index] < $backatom } {
			puts -nonewline [$adj get index]  
			puts " skipped. "
		} else {
			puts [$adj get index]  
			set rotatom [atomselect top "index $backatom"]
			set rotres [$rotatom get residue]
			set mobileres [ atomselect top "residue >= $rotres"] set adjinres [atomselect top "(same residue as index $backatom) and within 2 of (index $backatom)"]
			set rotatom_coord [lindex [$rotatom get {x y z}] 0 ]
			if { $rotres < [$adj get residue] } {
				set adjinres_coord [lindex [$adjinres get {x y z}] 0 ]
				set adj_coord [lindex [$adj get {x y z}] 0 ]
			} else {
				set adjinres_coord [lindex [$adj get {x y z}] 0 ]
				set adj_coord [lindex [$adjinres get {x y z}] 0 ]
			}
			$mobileres move [trans angle $adjinres_coord $rotatom_coord $adj_coord -5 deg]
		}
	} else {
	}
}