> -----Original Message-----
> From: Mailing list for users of COOT Crystallographic Software
> [mailto:[log in to unmask]]On Behalf Of Paul Emsley
> Sent: 10 October 2007 17:48
> To: [log in to unmask]
> Subject: Re: Setting occupancies
>
>
> Kendall Nettles wrote:
> > Does coot allow one to set the occupancies for a range to a specific
> > fraction? We'd like to set occupancies for the whole file
> to 0.2, and make
> > five copies of the protein, for example.
> >
>
> Dear Kendall,
>
> You can specify a residue range if you want to set the occupancies to
> 1.0 or 0.0 - but not something in between.
>
> There is a function that allows you to tweak attributes of atoms
> (including occupancy) but it would be Just Wrong to use it that way.
Just Wrong...? It feels good to be naughty sometimes, then. ;)
How about
(set-occupancy-for-zone imol chain-id resno-start resno-end occupancy-to-be),
e.g. as (set-occupancy-for-zone 0 "A" 1 150 0.2)
Like in:
-------------
(define (set-occupancy-for-zone imol chain-id resno-start resno-end occupancy-to-be)
(if (valid-model-molecule? imol)
(let ((ins-code "")) ;; ignore res with ins-code
(turn-off-backup imol) ;; don't backup each time
(for-each (lambda (res-no)
(format #t "Trying to set occ to ~s in ~s/~s/~s~%"
occupancy-to-be imol chain-id res-no )
(let ((atom-list (residue-info imol chain-id res-no ins-code )))
(if (list? atom-list)
(for-each (lambda (atom-info-string)
(set-atom-attribute imol chain-id res-no ins-code
(caar atom-info-string) (cadar atom-info-string) "occ"
;; assuming only 2 alt-confs, half occ if alt-conf not ""
(if (= (string-length (cadar atom-info-string)) 0 )
occupancy-to-be (/ occupancy-to-be 2))))
atom-list))))
(number-list resno-start resno-end))
(turn-on-backup imol))
(add-status-bar-text (string-append "Invalid molecule imol= " (number->string imol)))))
-------------
JED
|