Skip to content

Commit

Permalink
Improve assembler
Browse files Browse the repository at this point in the history
  • Loading branch information
meister committed Nov 13, 2024
1 parent 393d763 commit 477f068
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/lisp/topology/assembler.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -852,3 +852,25 @@ Some specialized methods will need coordinates for the assembler"))
do (format t "oligomer-shape ~s~%" oligomer-shape)
do (loop for monomer-shape across (topology:monomer-shape-vector oligomer-shape)
do (format t "monomer-shape ~s~%" monomer-shape))))

(defun monomer-center (assembler monomer coords)
"Return the geometric center of the MONOMER in the ASSEMBLER with COORDS."
(let* ((pos (alexandria:ensure-gethash monomer (monomer-positions assembler)
(error "Could not find ~s in ~s"
monomer
(alexandria:hash-table-keys (monomer-positions assembler)))))
(atres (at-position (ataggregate assembler) pos))
(centerx 0.0s0)
(centery 0.0s0)
(centerz 0.0s0)
(num 0))
(loop for atatm across (joints atres)
for index3 = (kin:position-index-x3 atatm)
for x = (aref coords index3)
for y = (aref coords (+ 1 index3))
for z = (aref coords (+ 2 index3))
do (incf centerx x)
do (incf centery y)
do (incf centerz z)
do (incf num))
(geom:vec (/ centerx num) (/ centery num) (/ centerz num))))
1 change: 1 addition & 0 deletions src/lisp/topology/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@
#:add-to-cache
#:make-backbone-dihedral-cache
#:backbone-dihedral-cache
#:monomer-center
))

(defpackage #:topology.dag
Expand Down

0 comments on commit 477f068

Please sign in to comment.