|
The
MakeGraph
module provides utilities to create files for
molecular graphics programs. For the moment only
the Kinemage and POVRay programs are supported.
The
MakeGraph
module is located in Yup.Tools. Thus, the required
import statement is some variant of:
from
Yup.Tools.MakeGraph import
*.
The
graphics files are generated from information in
the 'draw' attribute of the provided
model.
The
'draw' attribute is expected to be a list or tuple of strings and nested lists or tuples.
(
'VECTOR',
(
( vector-list-name,
color-name, texture, radius ),
(
atom-map-1, atom-map-2, ...
).
more
atom map lists...
'POINT',
(
( dot-list-name,
color-name, texture, radius ),
atom-map-1, atom-map-2, ....
),
more dot lists...
more keyword lists...
)
|
Only two keyword are recognized for now, the strings 'POINT' and
'VECTOR" and each keyword must be followed by at least one
group list. For a given keyword:
A
group list starts with a name for the
group (string), followed by any number of
vector lists.
If the keyword is "VECTOR": A
vector
list starts with a tuple containing a name for the vector list (string)
and the name of a color (string), the texture and the thickness of the
line, followed by any number of atom map
lists. The texture and thickness are optional if the output is only for Kinemage.
An
atom map list is simply a listing
of atom AtomMaps. Each list is assumed to
form a continuous chain of connected
atoms. In other words, lines will be drawn
connecting each atom to the next.
Create an atom map list for each continuous path.
Create as many vector lists as is
required.
If the keyword is "POINT": A pointlist
starts with a tuple containing a name for the point list (string), the
name of a color (string), a texture and the radius of the sphere. The
tuple is followed by any number of atom maps. The texture and thickness are optional if the output is only for Kinemage.
Create as many point list as is required.
Create
as many groups as is required.
Each
vector list will be rendered as a continuous path made up of connected
segments. Each point list will be rendered as a collection of dots or
spheres.
The
keywords may occur in any order and any number of a given keyword may
be associated with a 'draw' attribute. A group name may be a blank
string in which case, the vector or point lists that follow remain in
the previous group. Thus, it is possible to put vector and point lists
under one group. It is possible to have no groups at all.
The
Kinemage()
function creates a Kinemage file.
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
Kinemage
|
2
|
None
|
|
Argument
|
Type
|
Preset
Value
|
|
model
|
Model
object
|
-
|
|
name
|
string
|
-
|
The
model argument must contain a Model object
and it must have the 'draw' attribute.
The
name argument must be a non-empty string and
this will be taken as a prefix. The extension
'.kin' will be appended to name to form the
name of the product file. This file is a kinemage
file and can be displayed using any of the Kinemage
display programs: MAGE, KiNG. etc.
The
TmpVis()
function creates a temporary kinemage file and then
attempts to evoke a program to display the file.
The program is evoked as "Yup.king".
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
TmpVis
|
1
|
None
|
|
Argument
|
Type
|
Preset
Value
|
|
model
|
Model
object
|
-
|
The
model argument must contain a Model object
and the Model object must have the 'draw'
attribute.
This
function will fail harmlessly if "Yup.king" is not
found in the user's command path.
The Povraymage()
function creates a scene description file for the POVRay program.
|
Function
Name
|
Number
of Arguments
|
Return
Value
|
|
Povraymage
|
2 required + 2 optional
|
None
|
|
Argument
|
Type
|
Preset
Value
|
|
model
|
Model
object
|
-
|
|
name
|
string
|
-
|
| limit |
string |
"" |
| nrainbow |
integer |
500 |
The
model
argument must contain a Model object and it must have the 'draw'
attribute. 'POINT' objects are rendered as spheres and 'VECTOR' objects
as cylinders.
|