S. Shanmuga Sundara Raj wrote:


Is there a way to export the environmental distances to a text file? These distances are not saved in the saved state (*.scm). Can you save the session with the environment distances?

Not exactly, but you can find the residues that are close (5.5A say) to a given residue (in this case, the residue nearest the centre of the screen):

(residues-near-residue (car (active-residue)) (map (lambda (n) (list-ref (active-residue) n)) (list 1 2 3)) 5.5)

And we can use that to get to atom position and distance between atoms (see attached). (Note this does not filter the main-chain contacts like environment distances does.)

Paul.

(define contact-dist-cut-off 3.2)


(define (bond-length-from-atoms atom-1 atom-2)
  (define (bond-length pos-1 pos-2)
    (define (square x)
      (* x x))
    (sqrt (apply + (map square (map - pos-1 pos-2)))))
  (bond-length (list-ref atom-1 2)
	       (list-ref atom-2 2)))

(let* ((aa (active-residue))
       (imol (car aa))
       (active-res-spec (map (lambda (n) (list-ref (active-residue) n)) (list 1 2 3))))

  (let ((residue-specs (residues-near-residue imol active-res-spec contact-dist-cut-off))
	(active-res-atoms (apply residue-info (cons imol active-res-spec))))

    (for-each (lambda (residue-spec)
		(let ((atom-list (apply residue-info (cons imol residue-spec))))
		  (for-each (lambda (neighbour-atom)
			      ;; (format #t " active atom: ~s~%" neighbour-atom)
			      (for-each (lambda (active-atom)
					  (let ((d (bond-length-from-atoms 
						    active-atom neighbour-atom)))
					    (if (< d contact-dist-cut-off)
						(format #t " contact: ~sA: ~s ~s to ~s ~s~%" 
							d
							residue-spec
							(car neighbour-atom)
							active-res-spec
							(car active-atom)))))
					active-res-atoms))
			    atom-list)))
	      residue-specs)))

Reply via email to