From: Prasad S Garimella (Prasad.Garimella_at_chemail.tamu.edu)
Date: Thu Jun 02 2005 - 09:56:16 CDT

Hi

While loading the files, I want to change the default for loading data as lines to points. I have used clone_pdbs, but it only changes graphical representation for any 2 molecules at a time. thanks . Prasad

proc clone_reps {{fromid 0} {toid 1}} {

    # check arguments
    if {$fromid == $toid} {
        puts "cannot clone a representation on itself"
        return
    }
    if { [lsearch -exact [molinfo list] $fromid] < 0} {
        puts "source molecule id $fromid does not exist"
        return
    }
    if { [lsearch -exact [molinfo list] $toid] < 0} {
        puts "target molecule id $toid does not exist"
        return
    }

    # clean reps on target
    for {set i 0} {$i < [molinfo $toid get numreps]} {incr i} {
        mol delrep $i $toid
    }

    # copy reps from source. store the current topmol first.
    set topmol [molinfo top]
    mol top $toid
    for {set i 0} {$i < [molinfo $fromid get numreps]} {incr i} {

        # gather info about the representation
        lassign [molinfo $fromid get "{rep $i}"] rep
        set sel [molinfo $fromid get "{selection $i}"]
        set col [molinfo $fromid get "{color $i}"]
        set mat [molinfo $fromid get "{material $i}"]
        set pbc [mol showperiodic $fromid $i]
        set numpbc [mol numperiodic $fromid $i]
        set on [mol showrep $fromid $i]
        set selupd [mol selupdate $i $fromid]
        set colupd [mol colupdate $i $fromid]
        set colminmax [mol scaleminmax $fromid $i]
        set smooth [mol smoothrep $fromid $i]
        set framespec [mol drawframes $fromid $i]

        # clone representation
        mol representation $rep
        mol color $col
        mol selection "{$sel}"
        mol material $mat
        mol addrep top
        if {[string length $pbc]} {
            mol showperiodic top $i $pbc
            mol numperiodic top $i $numpbc
        }
        mol selupdate $i top $selupd
        mol colupdate $i top $colupd
        mol scaleminmax top $i [lindex $colminmax 0] [lindex $colminmax 1]
        mol smoothrep top $i $smooth
        mol drawframes top $i "$framespec"
        if { !$on } {
            mol showrep top $i 0
        }

    }
    # restore old top molecule.
    mol top $topmol
}