set result [open COMxyz.txt w]
set endfps [molinfo top get numframes]
set sel [atomselect top "fragment 1"]
for {set i 0} {$i<$endfps} {incr i 1} {
$sel frame $i
$sel update
set xyz [measure center $sel weight mass]
puts $result "$i $xyz"
}
close $result