CHARMM Development Project
Posted By: lennart setup-truncated-octahedron.str - 10/23/03 10:51 AM
*FILENAME: setup-truncated-octahedron.str
*PURPOSE: setup truncated octahedron system
*AUTHOR: Lennart Nilsson, Karolinska Institutet, October 2003; overhauled January 2005
! Sets up crystal, defines basic image centering, which may have to be adjusted for production use
! Deletes all residues with at least one non-hydrogen atom outside the truncated octahedron.
! The truncated octahedron is centered at the origin and fits exactly in a cube with side A
!The same procedure can be used to generate any crystal - just change the crystal define command
! PSF and coordinates from a system at least as large as the truncated octahedron
! have to be present
! Coordinates should be centered at the origin
! One parameter is necessary: A, which is the sidelength of the cube in which the TO fits
! Selection SOLUTE should be defined as non-solvent (will not be subject to image centering)
! Comparison coordinates and WCOMP are overwritten

!read rtf,para,psf,coor for solvated system according to assumption above
!set A 40
!define SOLUTE select .not. segid wat end
!stream setup-truncated-octahedron.str
!! then minimize and run eg CPT dynamics or just standard NVE
!shake bonh param
!dynamics start ....
!! for subsequent jobs the crystal and image centering have to be setup again

calc ax = @a * sqrt (0.75)
set b 109.4712206344907
!! Define the crystal.
crystal define octahedral @ax @ax @ax @b @b @b
crystal build cutoff 14.0
image byresidue select .not. SOLUTE end
! done with crystal and image centering definitions, now do the trimming of the system to
! fit in the desired primary shape.
coor copy comp
update cutim 14.0
! find and delete residues that have changed position,
! they are the ones that are outside the primary box
coor diff comp
coor dist comp weig
delete atom sele .byres. prop wcomp .gt. 0.0 end


Posted By: chuan Re: setup-truncated-octahedron.str - 12/08/04 06:04 AM
I m not sure if this script is understood. Right before the small script component below, we have a ready protein in waterbox with multiple water segid e.g. WAT2, WAT5, etc.

BOX was set to 70.But when i run the component below, we have a final octahedral of about 18A. Parameter A was founded also to have a value of 18A. Most of my protein residues are and water molecules are lost.

Can someone enlighten me?

set A @BOX ! parameters required for setup-truncated-octahedron.str
stream $CHM_STREAM/setup-truncated-octahedron.str
calc ax = @A * sqrt (0.75) ! required for crystal facilities
set b 109.4712206344907 ! same
coor conv align symm @ax @ax @ax @b @b @b

! save coordinates and psf
! C write psf card name @FILE-solv.psf
! * @FILE with crystal waters solvated with TIP3 waters, setup from top_all22_prot
! *
! write coor card name @FILE-solv.crd
! * @FILE with crystal waters solvated with TIP3
! * in rectangular box: @XSIZ x @YSIZ x @ZSIZ
! *

! save the PSF and coordinates for later use
open write formatted unit 27 name @FILE-solv.psf
write psf card unit 27
* with crystal waters solvated with TIP3 waters, par lipid-prot 27

open unit 1 write card name @FILE-solv.pdb
write coor pdb unit 1
* @FILE for viewing
* in rectangular box: @XSIZ x @YSIZ x @ZSIZ

! save size to file so we can reuse it
write title name @FILE-box-size.str
** PBC box definition for @FILE simulation
*set A @A
Posted By: lennart Re: setup-truncated-octahedron.str - 12/08/04 07:55 AM
Curious. There is nothing in the original script that changes variable A. If you post the output produced by:
set A @BOX
stream $CHM_STREAM/setup-truncated-octahedron.str

it may clarify matters.
Posted By: chuan Re: setup-truncated-octahedron.str - 12/09/04 01:13 AM
You are right on.
Posted By: lennart Re: setup-truncated-octahedron.str - 01/20/05 10:25 AM
I have replaced this script with a somewhat simpler version.
Posted By: Michael_H Re: setup-truncated-octahedron.str - 05/05/08 11:09 AM
I am trying to understand the volume formula for the truncated octahedron which is according to
where "a" is the length of an edge. The distance "b" between two quadratic faces is

The crystl.doc file says:

OCTAhedral - a = b = c, alpha = beta = gamma = 109.4712206344907
(a.k.a truncated octahedron)
(example: 40.0 40.0 40.0 109.471220634 109.471220634 109.471220634 )
(volume = 4*sqrt(3))/9 * a**3 )
(truncated cube length = a * sqrt(4/3) )
(degrees of freedom = 1)

Here, the distance "b" between two quadratic faces, called truncated cube length in the doc, is
Also here:

When charmm sets up a truncated octahedron from a cubic box it obviously rotates the whole system, ie. the atoms or does it rotate only the truncated octahedron within the cubic box leaving out the atoms and thus reduces the resulting edge length and volume?

Thanks for any help.
Posted By: rmv Re: setup-truncated-octahedron.str - 05/05/08 06:05 PM
I'm not so sure that equating 'b' with the 'truncated cube length' is correct.

If you apply an OCTA lattice to a cube of water atoms, you'll likely get large energies; the user must arrange the atoms in the desired shape. The initial script in this post by Lennart (and a simplified followup) demonstrate one approach. I've found that one can also use a sphere of matching volume as a pathway (via minimization) to RHDO and OCTA lattices of water; there's an RHDO example here in the Script Archive.
Posted By: Michael_H Re: setup-truncated-octahedron.str - 05/08/08 09:43 AM
Mystery solved:

CHARMM formula for the volume of the trunc.cuboctahedron:
V = 4*sqrt(3)/9 * a**3
'a' is the distance between two hexagonal faces and not as I initially thought the edge length.

'b' is the length between two quadratic faces (truncated cube length).
b = a*sqrt(4/3.)
'a' can also be seen as
a = b*sqrt(3) / 2
which is half of the space diagonal.

Unfortunately, I haven't found a proof for the CHARMM formula but numerical results are equal to results of V=8*sqrt(2)*a**3
Posted By: Jon_Wright Re: setup-truncated-octahedron.str - 06/26/08 12:18 AM

We're been using this script to cut a truncated octahedron out from the sphere and are curious as to how the TO is orientated. When we look at it on the graphics there does not seem to be an obvious reason for the TO orientation. We expected either the center of a square faces or hexagonal face to be aligned with the X-axis but it seems that no faces are actually aligned on any axes.

Is there a reason for the TO to have an orientation that does not have any obvious alignments to the X-axes?

© CHARMM forums