Ignore:
Timestamp:
Mar 23, 2011 4:57:24 PM (10 years ago)
Author:
toby
Message:

conflicted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/rb.tcl

    r1114 r1119  
    655655# Rigid body utility routines
    656656#============================================================================
     657<<<<<<< .mine
     658# RigidBodyGetVarNums: Returns a list of the variable numbers in use
     659#       for rigid body variable parameters.
     660# RigidBodyAtomNums: returns a list of atom numbers that are mapped to
     661#       rigid bodies in a selected phase
     662# RigidStartAtoms: returns a list of atoms that are allowed for creation of RB
     663# ExtractRigidBody: Use the GSAS geometry program to cartesian coordinates &
     664#       setting info for a RB from fractional coordinates for atoms in a phase
     665# RunRecalcRBCoords: updates the coordinates in all phases after changes have
     666#       been made to rigid parameters.
     667# CalcBody: Convert ortho to fractional coordinates using RB parameters
     668# FitBody: Optimize the origin and Euler angles to match a rigid body to a
     669#       set of fractional coordinates
     670# zmat2coord: convert a z-matrix to a set of cartesian coordinates
     671# RB2cart: convert the representation used for rigid bodies into
     672#       cartesian coordinates
     673# PlotRBtype: plot a rigid body with DRAWxtl
     674# PlotRBcoords: plot orthogonal coordinates with DRAWxtl
     675# DRAWxtlPlotRBFit: plot a set of fraction coordinates superimposed
     676#       on a structure read from a phase with DRAWxtl
     677#============================================================================
     678#============================================================================
     679# RigidBodyGetVarNums: Returns a list of the variable numbers used already
     680# for rigid body variable parameters
     681=======
    657682# RigidBodyGetVarNums: Returns a list of the variable numbers in use
    658683#       for rigid body variable parameters.
     
    678703# RigidBodyGetVarNums: Returns a list of the variable numbers used already
    679704# for rigid body variable parameters
     705>>>>>>> .r1117
    680706proc RigidBodyGetVarNums {} {
    681707    set varlist {}
     
    762788    # firstatom: sequence # in phase (may be > than number of the atom)
    763789    # originlist: atoms to define origin (where 1 is first atom in group; <= natom)
    764     # vector1: list of 3 values with X, Y or Z, atom #a and #b (number as in origin)
     790    # vector1: list of 3 values with X, Y or Z, atom #a and #b (number as in origin)  (for example {X 1 3})
    765791    # vector2: list of 3 values with X, Y or Z, atom #a and #b (number as in origin)
    766792    # note that vector2 must define a different axis than vector1
     
    770796    set fp [open "geom.inp" "w"]
    771797    puts $fp "N"
    772     puts $fp "N"
    773     puts $fp $phase
    774     puts $fp "N"
    775 
     798    if {[llength ::expmap(phaselist)] > 1} {
     799       # select phase
     800       puts $fp "N"
     801       puts $fp $phase
     802       puts $fp "N"
     803    }
    776804    puts $fp "R"
    777805    puts $fp "$natom"
     
    787815    puts $fp "X"
    788816    close $fp
     817    #puts "[file join $expgui(gsasexe) geometry] $expgui(expfile) < geom.inp > geom.out"
    789818    catch {
    790819        exec [file join $expgui(gsasexe) geometry] $expgui(expfile) < geom.inp > geom.out
    791     }
    792     file delete geom.inp
     820    } err
     821    #puts $err
     822    #file delete geom.inp
    793823    set fp [open geom.out r]
     824    set origin {}
     825    set Euler {}
     826    set coordlist {}
    794827    while {[gets $fp line] >= 0} {
    795828        if {[string first "Cell coordinates of origin" $line] != -1} {
    796829            set origin [lrange [string range $line [string first "are" $line] end] 1 3]
     830            #puts "origin in rb = $origin"
    797831        }
    798832        if {[string first "Rotation angles" $line] != -1} {
     
    821855    }
    822856    #file delete geom.out
     857    if {[llength $origin] == 0 || [llength $Euler] == 0 || [llength $coordlist] == 0} {
     858       puts "Error: run of GEOMETRY failed"
     859    }
    823860    return [list $origin $Euler $coordlist]
    824861}
     
    10601097# note that items 1-3 are computed with the imput origin, not the revised one
    10611098proc FitBodyOrigin {Euler cell ortholist useflag fraclist origin} {
     1099puts $fraclist
    10621100    set xform [CalcXformMatrix $Euler $cell]
     1101    puts "entering FitBodyOrigin"
    10631102    foreach var {x y z} {set sum($var) 0.0}
    1064 
    10651103    set i 0
    10661104    set sumdvs 0
     
    10681106    set rmsout {}
    10691107    foreach oc $ortholist use $useflag coord $fraclist {
    1070         #puts "ortho: $oc"
     1108        #puts "ortho: $oc"
    10711109        set frac [lrange [Ortho2Xtal $xform $origin $oc] 3 end]
    10721110        lappend fracout $frac
     
    10741112        set dvs 0
    10751113        foreach var {x y z} v1 $frac v2 $coord abc [lrange $cell 0 2] {
     1114puts "v2 = $v2"
     1115puts "v1 = $v1"
     1116puts "abc = $abc"
    10761117            set dv [expr {($v2 - $v1)*$abc}]
    10771118            set dvs [expr {$dvs + $dv*$dv}]
    10781119            set sumdvs [expr {$sumdvs + $dv*$dv}]
    10791120            if {$use} {set sum($var) [expr {$sum($var) + $dv/$abc}]}
     1121            puts "round and round"
    10801122        }
    10811123        lappend rmsout [expr {sqrt($dvs)}]
Note: See TracChangeset for help on using the changeset viewer.