![]() |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The Cell command creates a new simulation cell or changes the size of the already existing cell.
The angles Alpha, Beta and Gamma have the same definitions as in crystallography. X,
Y and Z are the lengths of the crystallographic cell vectors A, B and C. Alpha is the angle between B and C,
Beta is the angle between A and C, and Gamma is the angle between A and B.
If you want to display the crystallographic unit cell
of an object, there are two options: Either use 'Cell
Crystal' to directly interpret the CRYST1 record in the object's PDB file, or create the cell manually. In the first case,
YASARA transforms the cell to a left-handed coordinate system if required, in the second case you must do that yourself or choose a right-handed coordinate system.
# Choose a right-handed coordinate system CoordSys Right # Load the object without centering it LoadPDB 1crn,center=No # Create the cell, also without centering it Cell X=40.96,Y=18.65,Z=22.52,Alpha=90,Beta=90.77,Gamma=90,center=No The same example again, this time with a centered cell to show how to work with the coordinates of the cell center:
# Choose a right-handed coordinate system CoordSys Right # Load the object without centering the coordinates LoadPDB 1crn,center=No # Create the cell (this time centered) Cell X=40.96,Y=18.65,Z=22.52,Alpha=90,Beta=90.77,Gamma=90 # Read back the coordinates of the cell center x,y,z,alpha,beta,gamma,cx,cy,cz=Cell # Now the atom coordinates 0/0/0 are at the center of the cell # Move the object so that atom coordinates 0/0/0 match cell coordinates 0/0/0 MoveObj 1crn,(-cx),(-cy),(-cz) When creating very large cells for use with the NOVA force field,
it may help to ensure that the longest cell axis is the Z-axis, which has no size restrictions.
Example 1:Cell Auto Set size of simulation cell automatically, so that all atoms are at least
5 Angstroms away from the walls. Example 2:Cell Auto,10 Set size of simulation cell automatically, so that all atoms are at least
10 Angstroms away from the walls. Example 3:Cell X=40,Y=30,Z=70 Define a simple orthorhombic simulation cell, 40x30x70 Angstroms large.
Example 4:Cell X=40,Y=30,Z=70,Center=No As above, but do not move the cell center to the center of the screen.
Example 5:Cell X=40,Y=30,Z=70,Alpha=80,Beta=110,Gamma=60 Define an arbitrary triclinic simulation cell. Example 6:Cell Crystal,1crn Define the simulation cell to match the crystal unit cell of object
1crn (its PDB file must contain a CRYST1 record). Example 7:x,y,z,Alpha,Beta,Gamma = Cell Assign cell dimensions to variables 'x','y','z','alpha','beta' and
'gamma'. Example 8:x,y,z,Alpha,Beta,Gamma,cx,cy,cz = Cell As above, but also assign the coordinates of the cell center to
'cx','cy' and 'cz'. Example macro 1:# EXAMPLE Cell # Requires YASARA Dynamics Clear LoadPDB 1crn Style Cartoon Cell X=30,Y=30,Z=30,Alpha=45,Beta=70,Gamma=80 PosAll Y=-3.5,Z=45 OriAll Beta=6.3
Example macro 2:# EXAMPLE Cell Crystal # Requires YASARA Dynamics Clear LoadPDB 1crn Style Ribbon Cell Crystal,1crn PosAll Z=46
Example macro 3:
# EXAMPLE Cell Neighbors
# Requires YASARA Dynamics
Clear
# Load structure and correct N-terminal Met, replace with your own scene if needed
LoadPDB 1g2b
SwapRes Met 0,Ala
DelRes HOH
Clean
Style Ribbon
# Fill and show the unit cell
# Remove the following two lines if you provide a complete scene with cell
CrystallizeObj 1
Cell Crystal,1
# Make it all one single object. Since you may have provided your
# own scene, we don't know if object 1 is the first with atoms..
srcobj = ListObj not SimCell
JoinObj not SimCell,(srcobj)
# In case the cell in your own scene was not oriented parallel to the main axes..
alpha,beta,gamma = OriObj SimCell
Rotate Y=(-beta)
Rotate Z=(-gamma)
Rotate X=(-alpha)
# Move a bit away
Zoom Steps=0
x,y,z = Pos
Move Z=(z*2)
# Get the cell parameters CellSizeXYZ and CellPosXYZ
csx,csy,csz,alpha,beta,gamma = Cell
cpx,cpy,cpz = PosObj SimCell
if alpha!=90 or beta!=90 or gamma!=90
RaiseError "This macro currently supports only orthorhombic cells"
# These are the positions of the eight neighbor cells we want to create.
# In case you want to create other/more cells, the Z-position is included,
# even though it's always 0 in this example. Note that symmetry is needed
# here, if you decide to create two cells to the left, you also need to
# create two cells to the right.
posx= 0, -1, 1, 0, -1, 1, -1, 1
posy= 1, 0, 0, -1, 1, 1, -1, -1
posz= 0, 0, 0, 0, 0, 0, 0, 0
# Set force field
ForceField Amber99,SetPar=Yes
# Now decide: if the scene is very large, we can't afford duplicating
# the atoms in the eight neighboring cells we want to show...
if Atoms<=100000
# We will end up with at most 100000*9=900000 atoms, that's OK.
for i=1 to count posx
# Duplicate the cell content and move to the final position
dstobj = DuplicateObj (srcobj)
MoveObj (dstobj),(csx*posx(i)),(csy*posy(i)),(csz*posz(i))
# Get the minimum and maximum along each axis
axislist='x','y','z'
for axis in axislist
min(axis)=min pos(axis)
max(axis)=max pos(axis)
# Extend the cell to include everything
Cell (csx*(maxx-minx+1)),(csy*(maxy-miny+1)),(csz*(maxz-minz+1))
# Now add the cylinders separating the subcells
for i=1 to 3
axis1=axislist(i)
axis2=axislist(i%3+1)
axis3=axislist((i+1)%3+1)
# Loop over the grid points
for j1=-0.5+min(axis1) to 0.5+max(axis1)
for j2=-0.5+min(axis2) to 0.5+max(axis2)
j3list=-0.5+min(axis3),0.5+max(axis3)
# Loop over arrow start and end
for k=1 to 2
j3=j3list(k)
for l=1 to 3
ap(k)(axis(l))=cp(axis(l))+cs(axis(l))*j(l)
ShowArrow Start=Point,(ap1x),(ap1y),(ap1z),End=Point,(ap2x),(ap2y),(ap2z),Radius=0.4,Heads=0,Color=Grey
# And transform everything into the cell
Sim On
Sim Pause
Ori Alpha=233.438, Beta=92.540, Gamma=68.371
Pos X=6.347, Y=10.396, Z=186.190
else
# Too many atoms, we need a trick: ray-trace the neighbor cells and then
# blend the images together.
id=NameObj (srcobj)
Sim On
Sim Pause
resox=1024
resoy=768
ScreenSize (resox),(resoy)
for i=1 to count posx
exists1 = FileSize (id)neighbor(i).png
exists2 = FileSize png/(id)neighbor(i).png
if not exists1 and not exists2
Move (csx*posx(i)),(csy*posy(i)),(csz*posz(i))
Raytrace (id)neighbor(i),X=(resox),Y=(resoy),Background=off
Move (-csx*posx(i)),(-csy*posy(i)),(-csz*posz(i))
# Now make sure that the resolution of the view window matches the ray-traced images
Menu off
for i=count posx to 1 step -1
LoadPNG (id)neighbor(i)
ShowImage (id)neighbor(i)
# And the final picture
Raytrace (id)final,(resox),(resoy)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||