Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
1
fu (fumodel and fuplot) Programming Guide
May 30, 2013
ProgrammingProgrammingProgrammingProgramming GuideGuideGuideGuide
2
3
Table of Contents
1. Introduction ... 1
2. Copyright and license ... 1
3. Contributors ... 2
4. Programming environment ... 2
4-1 Installing python and site-packages ... 2
4-2 Making executable for Windows... 3
4-3 Integrated development environment software ... 3
5. Structure and modules of fu ... 3
5-1 Structure of program ... 3
5-2 Modules ... 5
5-3 Class and instance of fu ... 5
(1)Class and instance of fumodel program ... 5
(2)Class and instance of fuplot program ... 6
6. Class and its attributes and methods of fu ... 6
6-1 fuModel class (fumodel.py)...main program of fumodel ... 6
(1)attributes and their default values ... 6
(2) methods ... 7
6-2 fuMole class ... 20
(1)attributes and their default values ... 20
(2)methods ... 20
6-3 Atom class ... 30
(1)attributes and their default values ... 30
(2)methods ... 31
6-4 fuView class ... 32
(1)attributes and their default values ... 32
(2)methods ... 33
6-5 fuCtrlFlag class ... 38
(1)attributes ... 38
(2)methods ... 38
6-6 fuPlot class ... 38
(1)methods ... 38
6-7 FMOProperty class ... 43
(1)attributes and their default values ... 43
(2)methods ... 44
4
6-8 fuGraph class(fugraph) ... 45
(1)methods ... 45
6-9 BarGraph class ... 47
(1)attributes and their defaults ... 47
(2)methods ... 48
6-10 TileGraph class ... 50
(1)attributes and their defaults ... 50
(2)methods ... 51
6-11 MatPlotLib_Frm class ... 53
(1)methods ... 53
6-12 fulib module ... 54
(1) methods ... 54
6-13 Class in fupanel.py module ... 57
7. Miscellaneous ... 58
7-1 Note on sequence number of atoms and 'TER' ... 58
7-2 Types of AddHydrogen ... 58
7-3 Tutorials ... 59
(1) tutorial_01: create window with StatusBar and Menu ... 59
(2) tutorial_02: read PDB file and use PyCrust ... 59
(3) tutorial_03: use of fuView class in fuview.py ... 59
(4) tutorial_04: use of fuMole class in fumole.py
and fuView class in fuView.py ... 59
(5) tutorial_05: use of BarGraph class in fugraph.py ... 60
(6) tutorial_06: use of TileGraph class in fugraph.py ... 60
1
1. Introduction
This software is developed to assist modeling of molecules, generation
of FMO[1] input data for GAMESS[2], and visualization of FMO results.
This software is written in Python as a GUI and may be useful to treat
large molecules not only for FMO but also for other large scale
computations. This software is developed by "FMO User Group"[3]. We hope
that this software become a partner in your research.
We thank CMSI[4] for the financial support of this work.
[1] http://www.msg.ameslab.gov/gamess/
[2] http://staff.aist.go.jp/d.g.fedorov/
[3] http://ma.cms-initiative.jp/community
Everyone who is interested in FMO is welcome to join the FMO User
Group.
[4] http://www.cms-initiative.jp/en?set_language=en
2. Copyright and license
The source codes of the program is distributed as public domain software.
The copyright and terms and conditions for use, reproduction, and
distribution are described bellow(The BSD 2-Clause License).
Copyright (c) 2013, FMO User Group. All rights reserved.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
• Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
• Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
2
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
This software is used with runtime libraries of python, wxpython and
so on. When you distribute fu with these libraries, you should respect
their corresponding licenses.
3. Contributors
The contributors are listed at the beginning of each module. If you
modify the source codes, please add your name to the contributor list.
4. programming environment
Fu uses python and site-packages, numpy, scipy, wxpython, pyOpenGL,
and MatPlotLib. You have to use consistent versions of python and the
site packages. We started the development of fu at July 2012 and employed
the 32 bit version of python 2.7. The software necessary for the
development of fu is described below for your convenience. Download
this software if necessary.
4-1 Installing python and site-packages
1)Python version2.7, Windows 32bit version
Python 2.7.5 Windows Installer(Windows binary -- does not include
source) in http://www.python.org/download/
2)numpy-1.6.2
numpy-1.6.2-win32-superpack-python2.7.exe in
http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/
3)scipy-0.11.0b1
scipy-0.11.0b1-win32-superpack-python2.7.exe in
http://sourceforge.net/projects/scipy/files/scipy/0.11.0b1/
4)wxPython(wx-2.8-msw-unicode)
wxPython2.8-win32-unicode-py27 in
http://www.wxpython.org/download.php
3
5)PyOpenGL-3.0.2
PyOpenGL-3.0.2.win32-py2.7.exe in
http://www.lfd.uci.edu/~gohlke/pythonlibs/
6)matplotlib-1.2.0
matplotlib-1.2.0.win32-py2.7.exe in
https://github.com/matplotlib/matplotlib/downloads
7)py2exe(py2exe-0.6.9.win32-py2.7)
py2exe-0.6.9.win32-py2.7 in
http://sourceforge.jp/projects/sfnet_py2exe/downloads/py2exe/0.6.
9/py2exe-0.6.9.win32-py2.7.exe/
4-2 Making executable for Windows(fumodel.exe and fuplot.exe)
After installing software described in 4-1, execute setup.bat
in ./src directory. fumodel.exe and fuplot.exe are created in ./dist
folder.
4-3 Integrated development environment software
We use Eclipse with PyDev installation for the development of fu. The
software is obtained from
http://sourceforge.jp/projects/sfnet_eclipse.mirror/downloads/eclip
se-SDK-3.7.2-win32.zip/. PyDev installation is done in the Help menu
of Eclipse. You may find helpful WEB site for using this software.
5. Structure and modules of fu
Fu consists of two programs: fumodel for structure modeling of molecule
and FMO input generation and fuplot for visualization of FMO output.
5-1 Structure of program
The structure of fumodel is shown in Fig.1.
4
The structure of fuplot is shown in Fig.2. fuModel class used in this
program is a subset excluding modeling related functions.
fuPlot class
(main program)
Fig.2 Structure of fuplot program
fuModel class
(subset)
draw molecule
fuGraph class
draw graph
control draw
molecule
read files and
set plot item
interface to
PyCrust and
MatPlotLib
fuModel class
(main program)
fuModel_Frm class
(main panel)
fuCtrl class
Fig.1 Structure of fumodel program
fuMole class
structureand display
manupulation
accept andcontrol mouse
and keyboard
input
control menu
and widget
input
child panels
accept input
build and draw
molecule
control drawing
molecule
control child
panels
accept menu and
widget input
display molecule
fuView class
draw molecule
5
5-2 Modules
Fu has the following modules.
--- modules for fumodel
fumodel.py ... main module of fumodel including the main program
fuctrl.py ... module to handle menu, mouse and key board input
fumole.py ... module for molecular structure and drawing data
manipulations
fupanel.py ... module includes child panels
fuview.py ... module for molecular model drawing
fulib.py ... global methods
fuconst.py ... global constants
--- modules for fuplot
fuplot.py ... main program of fuplot
fugraph.py ... module for drawing graphs
---
setupmdl.py ... generates fumodel.exe with py2exe
setupplt.py ... generate fuplot.exe with py2exe
(execute setup.bat for generating Windows7 executable)
Beside the above, several tutorial programs (they are not used in fu)
are provided for convenience to study programming with fu (see Sec.7-3)).
5-3 Class and instance of fu
(1)Important class and instance of fumodel program
fumodel (an instance of fuModel class in fumodel.py)
|--- mollst[mol] attribute (mol: an instance of fuMole class
| in fumole.py)
|--- mol[atom] attribute (atom: an instance of Atom class
in fumole.py)
|--- ctrlflag (an instance of CtrlFlag class in fuctrl.py)
|--- frame (an instance of fuModel_Frm class in fumodel.py)
|--- view (an instance of fuView class in fuview.py)
|--- ctrl (an instance of fuCtrl class in fuctrl.py)
|--- menu (an instance of MenuCtrl class in
| fuctrl.py)
6
|--- input (an instance of InputCtrl class in
fuctrl.py)
|--- pycrust (an instance of wx.py.crust.CrustFrame)
|--- ctrlwin (an instance of ControlPanel_Frm in fupanel.py)
|--- gmsinputwin (an instance of GamessInput_Frm class in
| fupanel.py)
|--- treewin (an instance of TreeSelector_Frm class in
| fupanel.py)
|--- namewin (an instance of NameSelector_Frm class in
fupanel.py)
(2) Important class and instance of fuplot program
fuplot (instance of fuPlot class in fuplot.py)
|--- fmodatadic[name] attribute (name: an instance of
| FMOProperty class in fuplot.py)
|--- graphname[name] attribute (name: an instance of fuGraph
| class in fuplot.py)
|--- graph (an instance of BarGraph or TileGraph class
in fugraph.py)
|--- molview (an instance of fuModel class in fumodel.py)
|--- mpl (an instance of MatPlotLib_Frm class in fugraph.py)
|--- figure (an in stance of matplotlib.figure)
|--- canvas (an instance of FigureCanvasWxAgg)
|--- pycrust (an instance of wx.py.crust.CrustFrame)
6. Class and its attributes and methods of fu
6-1 fuModel class (fumodel.py)...main program of fumodel
(1)attributes and their default values
curmol=-1 # number of current fuMole instance in mollst[]
# and wrk=mollst[curmol]
mollst=[] # list to store fuMole instance
molnam=[] # name of molecule
files=[] # input file name of molecule
wrkmolnam='' # name of current fuMole instance
mhtdatadic={} # mht data dic {'name0':[mht data...],'name1':[mht
7
# data],..}
autoaddhydrogen=True # try to add hydrogen in loaded PDB data
(2) methods
AddBondUseBondLength(): add bond data using bond length
AddBondUseFrameData(): add bond data using molecular frame data
(.mht)
AddChainName(): add/change peptide chain name
AddGroup1H():add one hydrogen to selected atoms
AddGroup2H():add two hydrogens to selected atoms
AddGroup3H():add three hydrogens to selected atoms
AddHydrogenToAAResidue():add hydrogens to selected amino acid
residues
AddHydrogenToCutAA(): add hydrogens at C and N terminus
AddHydrogenToWater():add hydrogens to waters
AddHydrogenUseBondLength():add hydrogen based on atomic
distance
AddHydrogenUseFrameData(): add hydrogens using molecular frame
data(.mht)
AddItemCBoxMol(molnam):add molecule name to combo box list
AssignAAAtomCharge(): assign charge to amino acid residue atoms
AssignIonChg(chg): assign charge to ion
AssignLayer(layer): assign selected atoms to specified layer
layer(int): layer number
AssignLayerUndo():Undo layer assignment(under construction,
15May2013)
AtomAngle(atm0,atm1,atm2): get angle of atoms
atom0(int): sequence number of atom
atom1(int): sequence number of atom
atom2(int): sequence number of atom
ret=angle(float): angle between atom0-atom1 and atom2-atom1
AutoAddHydrogen(on): auto addition of hydrogens to polypeptide
and water molecules in reading PDB file
on(True/False): on/off flag
BuildMol(filnam,mol): make fuMole instance from data in PDB file
filename(string): file name
mol(fuMole instance): None except merge molecule
8
ChangeAtomColor(item,col): change atom color
item(string): key word, 'by element','by chain',
or 'color pallet'
col(list): color
ChangeBondKind(atmpairlst,bndknd): change bond kind. under
construction(15 May 2013)
ChangeStickBold(bold): change thickness of bond line
bold(int): thickness, default=2
CheckShortContact(mol1,mol2): check short contact between mol1
and mol2
ret=nsht(int): number of short contact
,rmin(float): shortest distance
ClearAllLayer(): cancel all layer assignment
ClearBDA(): remove all BDA points
ClearClipboard():empty clipboard
ClearLayer(layer):cancel layer assignment in specified layer
layer(int): layer number
ConsoleMessage(mess):print message on PyCrust console
CopyMolBitmapToClipboard():copy screen image to clipboard in
bitmap data
CopyMolToClipboard(): copy selected atom data to clipboard
CountEnvSelAtm():count number of environment atoms
ret=nenv(int): number of environment atoms
,lst(list): list of sequence numbers o environment atoms
CreateFrame(parent,fumode,size): create fumodel main panel
DeleteBonds(kind):delete bond kind data
DeleteHydrogens():delete hydrogen atoms in selected
DeleteNonBonded():delete non-bonded atoms
DeleteSelected():delete selected atoms
DeleteTerAtoms():delete 'TER' atom (see Sec7-1))
DeleteVdwBond():delete vdw contact data(trial base)
DeleteWater(): delete waters in selected
DispAtomAngle(atm0,atm1,atm2):display angle on status bar
atom0(int): atom number
atom1(int): atom number
atom2(int): atom number
9
DrawBDAPoint(on): draw BDA points
on(True/False): on/off flag
DrawChainKite(on): in preparation (15 May 2013)
DrawChainTube(on): draw tube peptide chain
on(True/False): on/off flag
DrawDistance(on): draw interatomic distance
on(True/False): on/off flag
DrawFormalCharge(on): draw formal charge
on(True/False): on/off flag
DrawLabelAtm(on,case): draw atom name
on(True/False): on/off flag
case(int): 0 name only, 1 name and atom number
DrawLabelElm(on,case): draw element name
case(int): 0 name only, 1 name and sequence number of atom
on(True/False): on/off flag
DrawLabelFrg(on): draw fragment name
on(True/False): on/off flag
DrawLabelRes(on,case): draw residue name
case(int): 0 name only, 1 name and residue number
on(True/False):on/off flag
DrawLayer(on):draw atoms in layer color
on(Tre/False): on/off flag
DrawMol(updated): draw molecule
updated(True/False): flag to force to make makedispaly list
DrawPlotData(on,save,item,pltcol,ifrg): draw molecule in fuplot
program
on(True/False): on/off flag
save,...: see source codes for details
DrawVdwBond(on): draw vdW bond line (trial base)
on(True/False): on/off flag
FindBondSeqNmb(atm1,atm2): find bond kind between atm1 and atm2
atm1(int): sequence number of atom
atm2(int): sequence number of atom
ret=nmb(int): bond kind code
FindFragNmb(frgnam):find fragment number
frgnam(string): fragment name
10
ret=ifrg(int): fragment number
FindGrpNmb(ia,grplst): find group atoms(under construction,
15May2013)
ia(int): sequence number of atom
grplst(list): group list containing group atom numbers
ret=igr(int): group number
FindMinMaxXYZ(mol): find min/max coordinates of atoms
mol(fuMole instance): mol instance
ret=xmin,xmax,ymin,ymax,zmin,zmax (all float)
FindRadiusAtoms(radius):find atoms within radius distance from
selected atom(s)
radius(float): radius
ret=nmb(int): number of atoms
,lst(list): atom sequence number list
FindRadiusResidue(radius): find residues within radius distance
from selected atom(s)
radius(float): radius
ret=nmb(int): number of atoms
,lst(list): atom sequence number list
FitToScreen(drw): resize and draw molecules in screen
FogEnable(on): Enable/disable Fog
on(True/False): on/off flag
FragmentAARes(case): fragment amino acid residue
case(int): 0 1res/1frg, 1 1res/1frg except GLY, 2
2res/1frg
FragmentNonAARes(): fragment non-amino acid residue
GetFragName(ifrg): get fragment name of ifrg-th fragment
ifrg(int): fragment number
ret=nam(string): fragment name
GetMaxAtmNmb(): get maximum atom number
ret=atmnmb(int): atom number
GetMaxResNmb(): get maximum number of residue
ret=resnmb(int): residue number
GetMouSelMode(): get mouse select mode
GetMouseMoveVector(dif): get mouse migration length
dif(int): mouse migration length
11
ret=mov(int): length of mouse move
GetMouseRotMatrix(dif):get matrix of rotation in proportion to
mouse move length
dif(int):mouse move length
ret=rotmat(list,3x3): transformation matrix
GetPntAtm(pos,raspos): get sequence number of clicked atom
pos(lsit,(x,y)): mouse position
raspos(list): raster position of all atoms
ret=nmb(int): sequence number of atom
GetRaspos(ith,raspos): get raster position of i-th atom
ith(int): sequence number of atom
raspos(list): raster position of all atoms
ret=x,y (all int): raster position (x,y)
HideEnvironment(on):hide environment atoms
on(True/Fasle): on/off flag
HideHydrogen(on): hide hydrogen atoms
on(True/False): on/off flag
HideSelected(on): hide selected atoms
on(True/Fasle): on/off flag
HideWater(on): hide water molecules
on(True/False): on/off flag
InputAtomName(a): input name and add it to atom "a"
a(int): sequence number of atom
InputBDABAA(bda,baa): input BDA and BAA atoms and set them
bda(int): sequence number of atom
baa(int):sequence number of atom
ListAtomName():make list of atom name
ret=lst(list): atom name list
ListChainName():make list of peptide chain name
ret=lst(list): chain name list
ListDrawAtom():make draw atom list
ret=nmb(int): number of atoms
,lst(list): draw atom list
ListElement():make list of elements
ret=lst(list): element list
listFragmentName():make fragment name list
12
ret=lst(list): fragment name list
ListGroupName():make group name list (under construction,
15May2013)
ret=lst(list): group name list
ListResidueName():make residue name list
ret=lst(list): residue name list
ListSelectedAtom():make selected atom list
ret=nsel(int): number of atoms
,lst(list): atom sequence number list
ListTargetAtom():make target atom list
ret=lst(list): atom sequence number list
MakeAtomLabel(atm,nameonly):make atom label
atm(int): sequence number of atom
nameonly(int): 0 name and number, 1 name only
ret=lbl(string): label text
MakeBondedAtomGroupList(lst): make list of bonded atoms
ret=lst(list): atom sequence number list
MakeDrawBDAData(): make data for draw BDA point
ret=drwdat(list): draw data list
MakeDrawDistanceData(): make draw data for distance
ret=disdat(list): draw distance data
MakeEnvByList(lst):set environment atoms according to list
lst(list): atom sequence number list
MakeEnvGrpByRadius(selobj,radius): set atoms to environment
which are within radius distance from selected
object atom(s)
selobj(int): select object
ret=nmb(int): number of atoms
,lst(list): atom sequence numbers list
MakeNewMol(case): make a new fuMole instance with zero atoms
case(key word): 'selected atoms' or 'auto'
MakeNonAAResLst(): make list of non-amino acid residues
ret=reslst(list): list of residue naem + residue number
MakeVdwContact():make vdw contacts(trial base)
ManualBDASetting(on): change mouse mode for manual BDA setting
on(True/False): on/off flag
13
MergeFragments(): merge selected fragments
MergeMol(mol): merge molecule 'mol' with current molecule
mol(fuMole instance): molecule to merge
MergeToCurrrent(filename):merge molecules given by PDB file with
current molecule
filename(string): name of PDB file
MessageStatus(mess,loc,col):print message on status bar
mess(string):message text
loc(int): 0: status bar 0, 1:status bar 1
col(string): wx.color name
MessAtomAngle(atm0,atm1,atm2):print angle on status bar
atom0(int): sequence number of atom
atom1(int): sequence number of atom
atom2(int): sequence number of atom
MessAtomDistance(atm0,atm1):print distance between atom0 and
atom1 on status bar
atom0(int): sequence number of atom
atom1(int): sequence number of atom
MessAtomLabel(atm,nameonly):print atom name on status bar
atm(int): atom sequence number
nameonly(True/False): True:nameonly, False:name+number
MessAtomTortion(atm0,atm1,atm2,atm3): print tortion angle of
atm0-1-2-3 on statusbar
NewMolecule(): make new molecule with name of "tempxxx"
OpenAssignLayerPanel():open layer assign panel
OpenAtmChgPanel(): open atom charge input panel
OpenControlPanel():open control panel
OpenGamessPanel():open GAMESS input assistant panel
OpenNameSelector(winpos):open Name/number selector panel
OpenPyCrust():open PyCrust console
OpenTreeSelector(winpos):open Tree selector panel
OrgOrient(pdborg,pdbnew): back molecular orientation to
initial
pdborg(string): original PDB file name
pdbnew(string): new PDB file name
14
ret=err(True/False): True error occurred, False:OK
PasteMolFromClipboard():paste molecules from clipboard
PrintMessage(): print Message on PyCrust console
Quit(): quit program
ReadFiles(filename):read file
filename(string): file name
RemoveEnvGroup():remove environment atoms
RemoveMol(allmol): delete current or all molecules
allmol(True/False): True: all, False: current
RenameItemCBoxMol(itmnmb,newname):rename molecule name in
ComboBox
itmnmb(int): item number
newname(string): molecule name
RenameMolecule(filename): rename tempxxxx with that created from
file name
filename(string): file name
ResetItemdicCheck(choosen,check): reset check of checkable menu
item
choosen(string): menu item text
check(True/False): on/off flag
ResetPosAtm(): reset pointed atom list
ResetShowAtom(on): reset atom's show flag
on(True/False): on/off flag
RotateSelected(dif): rotate selected atoms
dif(int): mouse move length
RunScriptCmd(script): run commands in python script
script(string): file name (xxxx.py)
SaveAtomColor(save):backup atom's color data
SaveFragmentAs(filename):write fragment information on file
SaveLayerData(save):backup layer data
SaveRasPosZ(value):backup z-raster position data
SaveShwAtm(value): backup atom's show flag
SelectAABackbone():select backbone of polypeptide
SelectAAResidue(): select amino acid residue
SelectAASideChain():select amino acid side chain
SelectAll(selflg): select/deselect all atoms
15
selflg(True/False): select/deselect flag
SelectAllShowAtom(): select all atoms with show flag-on
SelectAtmNam(atmnam,selflg): select/deselect atom with atmnam
atmnam(string*3): atom name
selflg(True/False): select/deselect flag
SelectAtomByAtmNmb(lst,selflg):select/deselect atom with
number of atmnmb
lst(list): list of atom numbers
selflg(True/False): select/deselect flag
SelectAtomByList(lst,selflg):select/deselect atoms in lst
lst(list): list of atom sequence numbers
selflg(True/False): select/deselect flag
SelectAtomByNamNmb(atmnam,atmnmb,selflg):select/deselect
atom by atom name and number
atmnam(string*4): atom name
atmnmb(int): atom number
selflg(True/False): select/deselect flag
SelectAtomBySeqNmb(lst,selflg): select/deselect atoms by
sequence number
lst(list): sequence number list
selflg(True/False): select/deselect flag
SelectByCircle(newx,newy,centeratm,raspos):select atoms being
in sphere created by mouse drug
newx(int): x position of mouse
newy(int): y position of mouse
centeratm(int): atom sequence number at sphere center
raspos(list): raster positions of all atoms
SelectByClick(pntatmhis,selflg): select/deselect clicked
atom(s)
pntatmhis(list): pointed atom history list
selflg(True/False): select/deselect flag
SelectByRadius(selobj,radius,flgval):select/deselect objects
being within radius from selected atoms
selobj(int): atom/residue/fragment flag
radius(float): radius
flgval(True/False): select/deselect flag
16
ret=nsel(int): number of selected atoms
SelectByRectangle(inix,iniy,newx,newy,raspos):select atoms in
rectangle created by mouse drug
inix(int): initial x position of mouse drug
iniy(int): initial y position of mouse drug
newx(int): current x position of mouse
newy(int): current y position of mouse
raspos(list): raster position list
SelectChainByAtmSeqNmb(a,selflg): select/deselect chain which
has "a" atom
a (int): atom sequence number
selflg(True/False): select/deselect flag
SelectChainByList(lst,selflg): select chains in lst
lst(list): chain number list
selflg(True/False):select/deselect flag
ret=nsel(int): number of selected/deselected atoms
SelectChainNam(chanam,selflg): select/deselect chain by name
chanam(string*1): chain name
selflg(True/False): select/deselect flag
SelectComplement(): complement select/unselect atoms
SelectElmNam(elmnam,selflg):select/deselect atoms by element
elmnam(string*2): element name
selflg(True/False): select/deselect flag
SelectEnv(selflg): select/deselect environment atoms
selflg(True/False): select/deselect flag
ret=nsel(int): number of select/deselected atoms
SelectFragByAtmSeqNmb(a,selflg): select/deselect fragment
which has "a" atom
a(int): sequence number of atom
selflg(True/False): select/deselect flag
SelectFragNam(frgnam,selflg):select/deselect fragment by name
frgnam(string): fragment name
selflg(True/False): select/deselect flag
SelectHydrogen():select hydrogen atoms
SelectNonAARes(res,nmb):select non-amino acid residue(s)
res(string*3): residue name
17
nmb(int): residue number
SelectNonAAResidue(): select non-amino acid residues
SelectNonBonded():select non-bonded atom(s)
SelectRes(resnamlst,resnmblst,selflg):select/deselect
residues in name and number list
resnamlst(list): list of residue name
resnmblst(list): residue number list
selflg(True/False): select/deselect flag
SelectResByAtmSeqNmb(a,selflg):select/deselect residue which
has "a" atom
a(int): sequence number of atom
selflg(True/False): select/deselect flag
SelectResByNmb(resnmblst,selflg):select/deselect residues in
residue number list
resnamlst(list): list of residue numbers
selflg(True/False): select/deselect flag
SelectResidueByList(lst,selflg):select/deselect residues in
"lst"
lst(list): residue list
selflg(True/False): select/deselect flag
ret=nsel(int): number of selected/deselected atoms
SelectResNam(resnam,selflg):select/deselect residue by name
resnam(string*3): resdiue name
selflg(True/False): select/deselect flag
SelectWater():select water moelcule(s)
SetBDAInAAResidue(target): set BDA in amino acid residue(s)
target(list): atom sequence number list of target
SetBDAWrkMol(resnam,bdalst):set BDA to current molecule
SetBondKind(atm1,atm2,bndknd):set bond kind (not implemented)
atm1(int): sequence number of atom
atm2(int): sequence number of atom
bndknd(int): bond kind
SetChainColor():set chain color
ret=ret(True/False): error flag
SetChoosenColor(col):set col to selected atoms
col(list): color data
18
ret=nmb(int): number of set atoms
SetDeselectAll(): deselect all atoms
ret=nmb(int): number of deselected atoms
SetDrawLabelFragmentName():set fragment name data for draw
SetDrawVdwBond(on):set vdw bond data for draw
on(True/False): on/off flag
SetElementColor():set element color
ret=nmb(int): number of set atoms
SetEnvGrpAtom(ith,on):set ith atom to environment
ith(int): sequence number of atom
on(True/False): on/off flag
SetFragmentFMOInp(frgnam,indat,bdabaa):set fragment name,its
atoms,and BAA data
frgnam(string): fragment name
indat(list): atom list in fragment (indat data of FMO input)
bdabaa(list): BDA-BAA list
SetLayerColor():set layer color
SetResidueColor():set residue color
ret=nmb(int): number of set atoms
SetSection(rot): set section
rot(int): mouse wheel rotation degree
SetSelectAll(selflg):set select/deselect to all atoms
selflg(True/False): select/deselect flag
SetSelectAllAtom(mol,selflg):set select/deselect all atoms for
molecule mol
selflg(True/False): select/deselect flag
SetSelectedAtom(ith,selflg):set select/deselect to "i-th" atom
ith(int): sequence number of atom
selflg(True/False): select/deselect flag
SetSelectRes(resnam,resnmb,selflg):set select/deselect to
residue with reanam and resnmb
resnam(string*3): residue name
resnmb(int): residue number
selflg(True/False): select/deselect flag
ret=nmb(int): number of set atoms
SetTextFont():set text font
19
SetTurnLst(): set turn list for molecules
SetUpDraw(): set up draw data
SetWrkMol(im): set im-th molecule to current, i.e. wrk
im(int): molecule number
ShowAABackboneOnly(on):set show atom flag on/off to main chain
atoms in polypeptide
on(True/False): on/off flag
ShowAASideChainOnly(on): set show atom flag on/off to side chain
atoms in polypeptide
on(True/False): on/off flag
ShowAllAtom():set show atom flag on to all atoms
ShowDrawModel(model):change molecular model
model(int): 0:line,1:stick,2:stick and ball,3:CPK
ShowSelectedOnly(on):set show atom flag on/off to selected atoms
on(True/False): on/off flag
SwitchMol(name): switch current molecule
TortionAngle(atm0,atm1,atm2,atm3): calsulate tortion angle of
atm0-atm1-atm2-atm3
ret=angle(float): angle in degrees
TranslateSelected(dif):translate selected atoms
dif(int): mouse move length
UpdateMol(mol):set update flag on for "mol" molecule to force
redraw
mol(fuMole instance)
WriteFiles(filename,save): write PDB data on file
filename(string): file name
save(True/False): for save/save as
SplitAtTER(molnam,pdbmol)@static method :split molecule at TER
molnam(string): name of molecule
pfdbmol(list): pdb data
ret=namdic(dictionary): name dictionary of generated
molecules
,datdic(dictionary): fuMole instance of generated
molecules
,delcondic(dictionary): deleted bonds list at split
SplitWater(molnam,pdbmol)@static method: split waters in
20
molecule
molnam(string): name of molecule
pdbmol(list): pdb molecule data
ret=namdic(dictionary): dictionary of generated molecule
names
,datdic(dictionary): fuMole instance of generated
molecules
6-2 fuMole class (fumole.py)...Structure and drawing data of molecule
(1)attributes and their default values
molname='' # name of molecule, made from input file name
inpfile='' # input file name
outfile='' # save file name
inpform='' # pdb,xyz,fmoinp,gmsinp,zmt (only pdb is supported)
remark='' # comment
mol=[] # list of Atom instance
bdadic={} # BDA data for fragments
(2)methods
AddAtomAt(at,elm,coord,atmdatdic):add one atom at
at(int): sequence number of atom to be added at
elm(string*3): element name
coord(list[x,y,z]): coordinate
atmdatdic(dictionary): atom data, see Atom.SetAtomData
AddBDABond(ia,ib): add BDA
ia(int): sequence number of bda atom
ib(int): sequence number of baa atom
AddBond(a,b,multi): add bond data
a(int): sequence number of atom in the bond
b(int): sequence number of partner atom
multi(int): bond kind(1:'single',2:'double',3:'triple',
4:'aromatic',5:'HB',6:'CH/pi',7:'vdw')
AddBondInAARes(resnam,resdat):add bond data to amino acid residue
resnam(string*3): residue name
resdat(list): residue data created by ExtractAARes method
AddBondUseBL(lst): add bond data based on distance
lst(list): list of target atoms. if empty, all atoms are
21
subjected
AddBondUseMht(lst,mhtdatadic): add bond data using molecular
frame data(.mht)
lst(list): list of target atoms.
mhtdatadic(dictionary): mht data dictionary
AddGroup1Hydrogen(lst): add one hydrogen to atoms in lst
lst(list): target atom list
AddGroup2Hydrogen(lst):add two hydrogens to atoms in lst
lst(list): target atom list
AddGroup3Hydrogen(lst):add three hydrogen to atoms in lst
lst(list): target atom list
AddHydrogen(at,nh,coord,hnam): add hydrogen at "at" atom
at(int): sequence number of atom to be attached hydrogen(s)
nh(int): number of hydrogens to attach
coord(list): list of hydrogen atom coordinates,
[[x,y,z],[x,y,z],...]
hnam(list): list of hydrogen atom name, [' 1H ',...]
AddHydrogenToAARes(resnam,resdat,ic): add hydrogens to amino acid
residue atoms
resnam(string*3): residue name
resdat(list): residue data from ExtractAARes method
ic: int, ic >=0 for the second and later residue,
=-1 for the first residue
ret=nh(int): number of attached hydrogens
AddHydrogenToMol(at,hname,htype,bndlst,rhx):add hydrogens to
non-polypeptide
at(int): sequence number of atom to be attached
hydrogen(s)
hname(string*4): atom name of the hydrogen(s)
htype(string*3): type of add hydrogen, See Sec.7,2)
bndlst(list): reference atom list, See Sec.7,2)
rhx(float): H-X bond length
ret=nh(int): number of attached hydrogens
AddHydrogenToNterm(lst): add hydrogens at N terminus
lst(list): target atom list
AddHydrogenToPeptideNC(lst): add hydrogens at N and C terminus
22
of polypeptide
lst(list): target atoms list
AddHydrogenToProtein(lst): add hydrogen to protein(polypeptide)
lst(list): target atom list
AddHydrogenToWaterMol(lst):add hydrogens to water molecule
lst(list): target atom list
AddHydrogenUseBL(lst):add hydrogens based on bond length
lst(list): target atom list
AddHydrogenUseMht(lst,mhtdatadic): add hydrogens using molecular
frame data(.mht)
lst(list): target atom list
mhtdatadic(dictionary): dictionary of mht data
AssignAAResAtmChg(): add charges to amino acid atoms
ret=err(True/False): error flag
CenterOfMass(lst): calculate center of mass of atom group
lst(list): target atoms
ret=com(list [x,y,z]): center of mass coordinate
,pmi(list [[],...]): principal moment of inertia
vectors
ChangeAtomName(a,atmnam,atmnmb): change atom name
a(int): sequence number of atom to be renamed
atmnam(string*4): atom name
atmnmb(int): atom number
CheckBDADup(ia,ib): check duplicate BDA
ia(int): sequence number of BDA
ib(int): sequence number of BAA
ret=dup(True/False)
ClearBDABAA(lst): remove BDA/BAA data
lst(list): target atoms
CopyMolInstance(): copy current fuMole instance
ret=cpy(fuMole instance)
CountAARes(): count amino acid residue
ret=nres(int): number of amino acid residues
CountAtomsInRes(resnam,resnmb): count number of atoms in residue
resnam(string*3): residue name
resnmb(int): residue number
23
ret=natm(int): number of atoms
CountHydrogen(lst): count hydrogen atoms
lst(list): target atom list
ret=nh(int): number of hydrogen atoms
CountHydrogenOfAtom(a): count hydrogen of atom a
a(int): sequence number of atom
ret=nh(int): number of hydrogen atoms
CountNonAARes(): count non-amino acid residues
ret=nres(int): number of residues
CountResH(resnam,resnmb): count hydrogens in residue
ret=nh(int): number of hydrogen atoms
CountWater(lst): count water molecules
lst(list): target atoms
ret=nw(int): number of water molecules
CreateBDA(ia,ib): set BDA and BAA
ia(int): sequence number of BDA atom
ib(int): sequence number of BAA atom
CreateFrgConDat(): create connect data for fragmentation.
(See Sec.7,1)
DelAllKindBonds(lst): remove all kind of bond data
DelAtom(ia): delete atom
ia(int): sequence number of atom to delete
DelBDABond(ia,ib):delete BDA-BAA bond data
ia(int): sequence number of BDA atom
ib(int): sequence number of BDA atom
DelBond(a,b): delete bond data
a(int): sequence number of atom
b(int): sequence number of atom
DelFrgBDABond(bdalst,ssblst,con) @static method: delete BDA-BAA
bond in fragmentation data
ret=con(list): connect data list
DelHydrogen(lst): delete hydrogen atoms
lst(list): target atom list
DelNonBonded(lst):delete non-bonded atoms
lst(list): target atom list
DelVdwBond(lst):delete vdW bond data
24
lst(list): target atom list
DelWater(lst): delete water molecules
lst(list): target atom list
ExtractAARes(resnam,resnmb): extract amino acid residue data
resnam(string*3): residue name
resnmb(int): residue number
ret=nresatm(int): number of atoms in the residue
,resdat(list): resdiue data
,resatmdic(list): dictionary of residue atoms
FindAddHTypeBL(a): find add hydrogen type(addhtype, sec7 2))
based on bond length
a(int): sequence number of atom to be attached hydrogen
ret=nh(int): number of hydrogens
,htype(list): addhtype list
,bndlst(list): reference atoms list
,rhx(float): bond length
FindAddHTypeMht(a,mhtdat): find addhtype based on molecular frame
data(mht)
a(int): sequence number of atom to which hydrogen(s) are
attached
mhtdat(string*3): name of mht data
ret=nh: number of hydrogens
,htype(list): addhtype list
,bndlst(list): reference atoms list
,rhxfloat): bond length
FindAtmNamInRes(atmnam,ist,resnam,resnmb): find atom with atmnam
in residue
atmnam(string*4): atom name
ist(int): start atom number
reanam(string*3): residiue name
resnmb(int): residue number
ret=ia(int): >=0 found, <0 not found
FindCalphaInRes(resnam,resnmb): find c-alpha in residue
ret=ic(int): >=0 found, <0 not found
FindCovalentBondedAtom(elmlst,coordlst): find covalent bonded
atoms
25
ret=bndlst(list): bonded atom list
FindItemNmb(lst,b): find item number
lst(list): list to be searched
b(int): number to be searched
ret=found(int): >=0 found, <0 not found
FindMaxAtmNmb(): find maximum atom number
ret=maxatmnmb(int): number
FindMaxResNmb(): find minimum atom number
ret=maxresnmb(int): number
FindNextAtom(ia,atmnam): find next atom
ia(int): start atom number for search
atmnam(string*4): atom name to be searched
ret=nmb(int): >=0 found, <0 not found
FindNmbInGrpLst(ia,grplst): find number in group list
ia(int): number to be found
ret=nmb(int): >=0 found, <0 not found
FindPrevAtom(ia,atmnam): find previous atom
ia(int): the last atom to be searched
atmnam(string*4): atom name to be searched
ret=nmb(int): >=0 found, <0 not found
FindResAtmSeqNmb(resdat,conatm): find sequence number of atom
with name coname
resdat(list): residue data
ret=nmb(int): >=0 found, <0 not found
FindSSBond(idx): find SS bond
idx(list): index list
ret=sslst(list): ss bonded atom list
FrgAARes(lst,case): fragment amino acid residue
lst(list): target atom list
case(int): 0:1res/1frg, 1:1res/1frg except GLY, 2:2res/1frg
FrgMergeGly(): merge Gly to neighbor
ret=ndel(int): number of removed fragments
FrgMergeTwoRes(): merge two fragments
ret=ndel(int): number of removed fragments
FrgNonAARes(lst): fragment non-amino acid residue
lst(list): target atom list
26
GetBDADicValue(keywd): get BDA dictionary value(BAA atom)
ret=val(int): sequence number of BAA
GetCCAddAtmType1A1(atmlst,r): get Cartesian coordinate of
addhtype 1A1(Sec7,2))
atmlst(list): bonded atmm list
r(float): bond length of H-X
ret=nh(int): number of hydrogen atoms
,coord(list): list of coordinates
GetCCAddAtmType1A2(atmlst,r): get cartesian coordinates of
addtype 1A2 (Sec7,2)
atmlst(list): bonded atmm list
r(float): bond length of H-X
ret=nh(int): number of hydrogen atoms
,coord(list): list of coordinates
GetCCAddAtmType1A3(atmlst,r,bang,trans):get Cartesian
coordinates of addtype 1A3 (Sec7,2)
atmlst(list): bonded atmm list
ret=nh(int): number of hydrogen atoms
,coord(list): list of coordinates
GetCCAddAtmType2A1(atmlst,r):get Cartesian coordinates of
addtype 2A1 (Sec7,2)
atmlst(list): bonded atmm list
r(float): bond length of H-X
ret=nh(int): number of hydrogen atoms
,coord(list): list of coordinates
GetCCAddAtmType2A2(atmlst,r):get Cartesian coordinates of
addtype 2A2 (Sec7,2)
atmlst(list): bonded atmm list
r(float): bond length of H-X
ret=nh(int): number of hydrogen atoms
,coord(list): list of coordinates
GetCCAddAtmType3A1(atmlst,r):get Cartesian coordinates of
addtype 3A1 (Sec7,2)
atmlst(list): bonded atom list
r(float): bond length of H-X
ret=nh(int): number of hydrogen atoms
27
,coord(list): list of coordinates
GetCCOfWaterHydrogen(cow): get Cartesian coordinates hydrogens
cow(list): coordinates of oxygen atom
ret=chw(list,[x,y,z],...]): coordinate list
GetNumberOfBDA(): get number of BDA
ret=nbda(int): number of BDAs
GetNumberOfFrgConDat(): get number of fragment connect data
ret=ncon(int): number of connect data
InterAtomDistance(a,b): calculate interatomic distance between a
and b
a(int): sequence number of atom
b(int): sequence number of atom
ret=r(float): distance
IsBAAAtom(ia): is ia BAA atom?
ia(int): sequence number of atom
ret=ret(True/False)
IsCaAtCterminal(ia): is ia c-alpha in c-terminal residue?
ia(int): sequence number of atom
ret=ret(True/False)
MakeAAResDic(): make residue dictionary of amino acid residue
ret=resdic(dictionary): residue dictionary
MakeBDALst(idx): make BDA list
idx(list): index list
ret=bdalst(list): list of BDA
MakeBondedAtomGroupList(condat): make bonded atom group list
condat(list): connect data list
ret=grplst(list): list of atoms
MakeChainDic(): make dictionary of chains
ret=chaindic(dictionary): chain dictionary
MakeDrawAtomData(lst): make draw atom data
lst(list): target atom list
ret=drwdat(list): draw atom data list
MakeDrawBondData(lst): make draw bond data
lst(list): target atom list
ret=drwdat(list): draw bond data list
MakeDrawChainTubeData(lst): make draw chain tube data
28
lst(list): target atom list
ret=drwdat(list): draw data
MakeElmDic(): make dictionary of element
ret=elmdic(dictionary): element dictionary
MakeFrgAtmLst(grplst,idx): make fragment atom list
grplst(list): group atom list
idx(list): index list
ret=resnam(string): residue name
,frglst(lsit): fragment atoms list
MakeFrgConDat(idx): make connect data for fragmentation
idx(list): index list
ret=con(list): connect data list
MakeNonAAResDic(): make dictionary of non-amino acid residues
ret=resdic(dictionary)
MakeSSBond(lst): make SS bond(s)
lst(list): target atom list
ret=nss(int): number of SS bonds
MergeFrg(lst): merge fragment
lst(list): target atom list
Message(mess,dev,color): print Message on status bar
mess(string): message
dev(int): 0: status bar 0, 1:status bar 1
color(list): text color
RemoveBDA(ia,ib): remove BDA(ia) and BAA(ib)
ia(int): sequence number of atom
ib(int): sequence number of atom
RenumberAtmNmb(): renumber atom number
RenumberConDat(): renumber connect data
RenumberIndexForFrg(): renumber index for fragmentation
ret=idx(int): index list
ResetBDADic(): reset dictionary of BDA
SetBDAInAARes(lst): set BDAs in amino acid residue
lst(list): target atom list
SetBDAInNonAARes(lst): set BDA in non-amino acid residue
lst(list): target atom list
ret=nbda(int): number of BDA
29
SetBndMulti(atom1,atom2,bndmulti): set bond kind
atom1(int): sequence number of atom
atom2(int): sequence number of atom
bndmulti(int): bond kind code
SetDefaultAtmRad(lst): set default atom radius to all toms
SetDefaultColor(lst): set default atom color to all atoms
SetDefaultVdwRad(lst): set default vdw radius to all atoms
SetFMOXYZAtoms(inpfile): read atom coordinates from FMO input file
and set them to molecule data
(fuMole.mol)
inpfile(string): file name of FMO input file
SetFragmentName(): set fragment name
SetFragmentUseFMOIndat(frgnam,indat,bdabaa): set fragment data
using data in FMO input
frgnam(list): fragment name list
indat(list): indat data in FMO input
bdabaa(list): BDA-BAA data in FMO input
SetPDBAtoms(pdbmol): set pdb atom data to mol attribute of fuMole
instance
pdbmol(list): pdb molecule data
SetToBDADic(ia,ib): set ia-ib to BDA dictionary
ia(int): sequence number of atom
ib(int): sequence number of atom
WriteFrgDat(filfrg): write fragment information on file
filfrg(string): file name
WritePDBMol(filename,parnam,parfilnam,con): write pdb dat on file
filename8string): file name
parnam(string): parent molecule name
parfilnam(string): parent PDB file name
con(True/False): flag for write/don’t-write connect data
AtmNamElm(atmnam) @static method: get element from atom name
ret=elm(string*2): element name
BondAtmGrp(condat,ssblst) @static method: get bonded atom group
condat(list): connect data list
ssblst(list): SS bond list
ret=grplst (list): bonded atom group list
30
GetOrgSeqNmb(ith,idx) @static method: get original sequence
number of i-th atom
ith(int): sequence number of atom
idx(list): index list
ret=nmb(int): atom number in original molecule
MakeFrgTable(frglst) @static method: make fragment table for .frg
file
frglst(list): fragment data list
ret=frgtbl(list): fragment table data
MakeMolName(filnam) @static method: make molecular name
filnam(string): file name
ret=name(string): molecule name(i.e. file name with out
extension)
PrintAtomInPDBForm(): print atom data in PDB 'ATOM' form
ReadFrgDat(filfrg) @static method: read fragment information
file(.frg file)
filfrg(string): file name
ret=resnam(list): residue name list
,bdalst(list): BDA data list
ReadMhtFile(filcon) @static method: read molecular frame
file(.mht file)
filcon(string): file name
ret=resnam(string): residue name
,condat(list): connect data list
ReadPDBMol(filpdb) @static method: read PDB file
filpdeb(string): PDB file name
ret=pdbmol(list): pdb molecule data
6-3 Atom class (fumole.py)...atom data
(1)attributes and their default values
# data in PDB
seqnmb=-1 # seq number of atoms 0,1,..,natom-1
cc=[] # Cartesian coordinate [x,y,z] in Angstrom
conect=[] # connect data
atmnam='' # atom name
atmnmb=-1 # atom number
31
resnam='' # residue name
resnmb=-1 # residue number
chainnam='' # chain name
altloc=' ' # alternate
elm='' # element name
focc=0 # occupancy
bfc=0 # thrmal factor
charge=0 # atom charge
# additional items to pdb data
bndmulti=[] # bond kind.
extrabnd=[] # extra bonds, H-bond,vdW,CH/pi,...
# draw parameters
color=fuconst.ElmCol['ZZ'] # atom color. default:unknown elm
show=True # show flag
select=False # select flag
model=0 # draw model, 0:line model, 1:stick, 2:ball and stick,
# 3: CPK
atmrad=1.0 # scale factor of atom radius for ball and stick model
vdwrad=1.0 # scale factor of van der Waals radius
thick=2 # bond thickness
# group data
grpnam='' # group name
grpchg=0 # group charg
envflag=False # environment (special group) flag
parnam='' # name of parent molecule
# fragement data
frgnam='' # fragment name, three characters+sequence number
frgchg=0 # fragment atom formal charge used to calulate fragment
charge.
frgbaa=-1 # atom seq numbe of baa. atom with non zero frgbaa is
a bda atom.
layer=1 # FMO layer. 1:1st, n: n-th layer and 11:MM in IMOMM,
12:EFP
frgcondat=[] # connect data for fragment
(2)methods
32
GetAtmDataDic(): get all the attributes in dictionary
ret=atmdatdic(dictionary): attributes dictionary
GetDrwParamDic():get draw parameters in dictionary
ret=paramdic(dictionary)
GetFrgDataDic():get fragment attributes in dictionary
ret=frgdatdic(dictionary)
GetGrpDatDic(): get group attributes in dictionary
ret=grpdatdic(dictionary)
GetPDBDatDic(): get pdb attributes in dictionary
ret=pdbdatdic(dictionary)
GetResDatDic():get residue attributes in dictionary
ret=resdatdic(dictionary)
MakePDBAtom(): make PDB form of atom data
ret(string): s
SetAtomData(atmdatdic):set attributes in dictionary
atmdatdic(dictionary): dictionary of atom attributes
SetDefaultAtmRad():set default atom radius
SetDefaultColor():set default atom color
SetDefaultVdwRad():set default vdw radius
6-4 fuView class (fuview.py)... draw molecular model
(1)attributes and their default values
getatmpos=True
raspos=[] # raster position of atoms
rasposz=[] # z-position
#
updated=True
# the following data are used for setting center and draw size
atomdata=[]
bonddata=[]
chaintubedata=[]
drawtube=[]
# initial setting
eyepos = [0.0, 0.0, 300.0]
center = [0.0, 0.0, 0.0]
upward = [0.0, 1.0, 0.0]
33
ratio = fuView.DEFAULT_RATIO # angstrom per pixel
DisplayList = None
fog = True
fogscale=5.0
# default parameters
bgcolor = fuView.DEFAULT_BGCOLOR
rad_stick = fuView.DEFAULT_RAD_STICK
rad_ball = fuView.DEFAULT_RAD_BALL
rad_cpk_scale = fuView.DEFAULT_RAD_CPK_SCALE
rad_peptide = fuView.DEFAULT_RAD_PEPTIDE
stereo = fuView.STEREO_OFF
# flags for draw object
atom=False
bond=False
chaintube=False
selectcircle=False
selectrectangle=False
labelelm=False
labelatm=False
labelres=False
labelfrg=False
bdapoint=False
formalchg=False
distance=False
vdwbond=False
sphere=False
(2)methods
CenterMolecular(): get center of molecule
ClearScreen(): clear screen
DrawAtoms(data): draw atoms
data(list): atom data
DrawBDAPoint(drawbdadata): draw BDA points
drawbdadata(list): bda point data
DrawBonds(data): draw bonds
data(list): bond data
DrawChainTube(data): draw chain tube
34
data(list): chain tube data
DrawDistance(data): draw distance label
data(list): distance data
DrawExtraBond(data): draw extra bonds
data(list): extra bond data
DrawLabel(drawdata): draw label
drawdata(list): label data
DrawSelectCircle(): draw circle
DrawSelectRectangle(): draw rectangle
DrawSphere(data): draw sphere
data(list): sphere data
DrawText2(text,font,pos,color): draw text
text(string): text
font(wx.Font)
pos(list[x,y]): position
color(list): color
DrawText3(text,font,pos,color): draw text
text(string): text
font(wx.Font)
pos(list[x,y]): position
color(list): color
FitMolecular(): draw molecule to fit screen
GetAtomRasterPosition(): get raster position of atoms
ret=raspos(list): list of atom raster positions
GetCenter(): get center of drawn atoms
ret=tupple(x,y,z)
GetFogScale(): get fog scale
ret=fog (True/False): on/off flag
,fogscale(float): scale value
GetObjectXYZ(posx,posy): get x,y,z coordinate of raster
positon(posx,posxy)
posx(int): x position
posy(int): y position
ret=x,y,z (all float): x,y,z coordinate
InitGL(): initialize OpenGL
MakeDisplayList(): make display list
35
MouseRotate(dif): rotate molecule in draw
dif(int): mouse move length
MouseTranslate(dif): translate molecule in draw
dif(int): mouse move length
OnDraw(): draw event handler
OnEraseBG(): event handler
OnPaint(): paint event handler
OnResize(): size event handler
SetBGColor(): set background color
SetCamera(): set camera
SetDistanceList(data): set draw distance data from list
data(list): drwa data list
ret=distance(list): list of DrawDistanceData instance
SetDrawAtomData(on,data): set draw atom data
on(True/False): on/off flag
data(list): list of DrawAtomData instance
SetDrawAtomList(on,data): set draw atom list
on(True/False): on/off flag
data(list): list of DrawAtomData
SetDrawBDAPonitData(on,data):set draw BDA points data
on(True/False): on/off flag
data(list): DrawBDAPointData
SetDrawBDAPonitList(on,data): set BDA point list
on(True/False): on/off flag
data(list): BDA list
SetDrawBondData(on,data): set draw bond data
on(True/False): on/off flag
data(list): DrawBondData
SetDrawBondList(on,data): set drwa bond list
on(True/False): on/off flag
data(list): draw bond list
SetDrawChainTubeData(on,data): set draw chain tube data
on(True/False): on/off flag
data(list): DrawChainTubeData
SetDrawChainTubeList(on,data): set draw chain tube list
on(True/False): on/off flag
36
data(list): draw tube list
SetDrawDistanceData(on,data):set draw distance data
on(True/False): on/off flag
data(list): DrawDistanceData
SetDrawDistanceList(on,data):set draw distance list
on(True/False): on/off flag
data(list): draw distance list
SetDrawFormalChargeData(on,data):set draw formal charge data
on(True/False): on/off flag
data(list): DrawFormalChargeData
SetDrawFormalChargeList(on,data):set draw formal charge list
on(True/False): on/off flag
data(list): draw formal charge list
SetDrawLabelAtmData(on,data): set draw atom label data
on(True/False): on/off flag
data(list): DrawLabelData
SetDrawLabelAtmList(on,data): set draw atom label list
on(True/False): on/off flag
data(list): draw label list
SetDrawLabelElmData(on,data):set draw element label data
on(True/False): on/off flag
data(list): DrawLabelData
SetDrawLabelElmList(on,data):set draw element name list
on(True/False): on/off flag
data(list): draw label list
SetDrawLabelFrgData(on,data):set draw fragment name data
on(True/False): on/off flag
data(list): DrawLabelData
SetDrawLabelFrgList(on,data):set draw fragment name list
on(True/False): on/off flag
data(list): draw label list
SetDrawLabelList(data):set draw label list
data(list): draw label list
ret=labeldata(list): DrawLabelData
SetDrawLabelResData(on,data): set residue label in
DrawLabelData class instance
37
on(True/False): draw on/off flag
data(list:label,cc,color): residue name data
SetDrawLabelResList(on,data): set residue label in list
on(True/False): on/off flag
data(list): draw label data list
SetDrawNetChargeData(on,data): set net charge data
on(True/False): on/off flag
data(list): charge data for draw
SetDrawNetChargeList(on,data): set net charge list
on(True/False): on/off flag
data(list): charge data list
SetDrawSphereData(on,data): set draw sphere data
on(True/False): on/off flag
data(list): draw sphere data
SetDrawSphereList(on,data): set draw sphere list
on(True/False): on/off flag
data(list): draw sphere list
SetDrawVdwBondData(on,data): set draw vdw bond data
on(True/False): on/off flag
data(list): draw vdw bond data
SetDrawVdwBondList(on,data): set draw vdw bond list
on(True/False): on/off flag
data(list): draw vdw bond list
SetFogScale(on,fogscale): set flag and scale for fog
on(True/False): fog on/off
fogscale(float): fog scale, default=5.0
SetStereoCamera( bCameraLeft, bViewportLeft): set stereo
camera
SetStereoView(stereo): stereo view flag
stereo(True/False)
SetViewAxis(xyz): set view axis
xyz(string,'X','Y' or 'Z'): view axis
Zoom(rot): magnify molecular model drawing
rot(int): degree of magnification
Code2RGB(code)@static method: convert OpenGL RGB code to
38
Windows code
ret=RGB(list[r,g,b])
RGB2Code(RGB)@static method:convert Windows RGB code to OpenGL
code
ret=rgb(list[r,g,b])
6-5 fuCtrlFlag class (fuctrl.py)...cntrol flags
(1)attributes
ctrlflag={} # flag dictionary
(2)methods
GetCtrlFlag(name):
name(string): flag name
ret=(True/False)
RemoveCtrlFlag(name): delete flag
name(string): flag name
SetCtrlFlag(name,value): set flag value
name(string): flag name
value(True/False)
6-6 fuPlot class(fuplot.py)...main program
(1)methods
About(): show license on messagebox
AddDerivedDataDic(drvnam,drvcmp): add derived data to
dictionary
drvnam(string): dat aname
drvcmp(list): clist of omponent data
CheckDeriveComp(drvcmp): is component of derived data?
ret=find(True/False): yes/no flag
ConsoleMessage(mess): print message on PyCrust cosole
mess(string): message
ConvertCTChargeForPlot(fmoctchg) @static method: convert ct
charge data for plot
fmoctchg(list): FMO output form of ct charge
ret=ctcharge (list): plot form of ct charge
ConvertGMSMullikenChargeForPlot(mulliken) @static method:
convert GMS Mulliken deta for plot
39
mulliken(list): GMS output form of mulliken
ret=mulchg(list): plot form of mulliken
ConvertMullikenChargeForPlot(fmomulchg) @static method:
convert FMO mulliken data for plot
fmomulchg(list): FMO output form of Mulliken charge
ret=mulchg(list): plot form of Mulliken charge
ConvertOneBodyForPlot(fmoone,layer) @static method: convert
one-body energy data for plot
fmoone(list): FMO output form of one-body energy data
ret=onbody(list): plot form of one-body energy data
ConvertPIEDAForPlot(fmopieda) @static method: convert PIEDA
data for plot
fmopieda(list): PIEDA in FMO output form
ret=pieda(list): PIEDA data in plot form
,ctchg(list): ct charge data in plot form
CreateMatPlotLibFrame(): create MatPlotLib frame
CreatePropertyChoisePanel():create PropertyChoisePanel
CreatePyCrustFrame(): create PyCrust frame
CreateSelectDataPanel():create SelectDataPanel
CreateSplitWindow(): create split window for SelectDataPanel and
PropertyChoisePanel
GetCurrentFMOData(): get current FMOProperty instance
ret=curfmodat(FMOProperty instance):
GetFMOProp(dataname): get FMOProperty instance
dataname(string): data name
ret=fmodat(FMOProperty instance):
GetFMOPropName(fmodatadic,id): get FMO data name
fmodatadic(dictionary of FMOProperty instance):
id(int): data number
ret=dataname(string): data name
GetIDAndName(dataname): get data id and name
dataname(string): data name with id number
ret=id(int): id number of data
,name(string): data name
GetNameAndExt(filename): extract name and extension from file
name
40
filename(string): file name
ret=err (True/False): error/no error
,name (string): name
,ext(string): extension
GetOpenFiles(curdir,files): get open multiple files
curdir (string): current directory name
files (list): file name list
IsDerivedData(dataname): is this derive data?
dataname(string): plot data name
ret=ret(True/False)
IsDuplicateName(dset,name): is name duplicate?
dset(list): data name list
name(string): name to check duplicate
ret=dup(True/False)
IsFMOProperty(dataname): is data FMO property?
dataname(string): data name
ret=find(True/False)
IsItemInDataDic(item,datadic): is "item" in datadic?
item(string): item name
datadic(dictionary): data dictionary
ret=ret(True/False)
ListFMODataName(): print FMO data name in fmodatadic dictionary
MakeCTChargePlotData(): make CT charge data for plot
ret=ctcharge(list): ct charge plot data
MakeDataList(): make plot data
ret=datalist
MakeDataName(name):
ret=dataname
MakeFMOPropertyDic(curdir,files):
ret=fmodatadic
MakeMullikenPlotData():
ret=mulcharge
MakePIEDAPlotData():
ret=pieda
PlotMenu(): menu of fuplot
PrintFragmentName(): print fragment name
41
PrintMessage(): print message
ReadFMOCTCharge(filename)@static method: read FMO CT charges
filename(string): name of FMO output file
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,ctchg(list): list of ct charges
ReadFMOFragStatics(filename) @static method: read FMO fragment
statics in FMO output file
filename(string): file name
ret=frgstatlist(list): list of FMO statics data
ReadFMOInput(filename)@static method: read FMO input file
ret=err(True/False): error/no error
,nfrag(int): number of fragments
,icharg(list): icharg data list
,frgnam(list): fragment name list
,indatx(list): indat data list
,bdabaa(list): BDA-BAA data list
ReadFMOIterEnergy(filename)@static method: read FMO iteration
energies
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,jter(list): iteration number list
,denergy(list): difference energy list
,ddensity(list): difference density list
ReadFMOKeywrd(filename,keywrd,col1,col2,datcollst) @static
method: read keyword item in FMO output
filename(string): file name
keyword(string): keyword to be found
col1(int): the first column of keyword in a line
col2(int): the last column of the keyword in a line
datacollst(list): list of data format of keyword items
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,valuedic(dictionary): dictionary of keyword items
ReadFMOMulliken(filename) @static method: read Mulliken
charges in FMO output
42
filename(string): file name
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,mulchg(list): list of Mulliken charges
ReadFMOOneBody(filename) @static method: read FMO one-body
energy
filename(string): file name
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,onebody(list): list of one-body energy
ReadFMOPIEDA(filename) @static method: read FMO PIEDA
filename(string): file name
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,pieda(list): PIEDA data list
ReadFMOStatics(filename) @static method: read FMO statics
filename(string): file name
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,prpdic(dictionary): dictionary of FMO properties
ReadFMOXYZ(filename) @static method: read FMOXYZ data
filename(string): file name of FMO input
ret=err(True/False): error/no error
,geom(list): list of atom coordinates
ReadFrgDistance(filename) @static method: read distances in FMO
output file
filename(string): file name
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,frgdist(list): list of interfragment distances
ReadFrgIterEnergy(filename) @static method: read FMO SCC
energies
filename(string): file name
ret=errerr(True/False): error/no error
,version(string): GAMESS and FMO version
,jter(list): iteration number list
43
,efmo(list): list of efmo
,dele(list): list of delta energy
,deld(list): list of delta density
ReadGMSMulliken(filename) @static method: read Mulliken
charges in GAMESS output file
filename(string): GAMESS output file
ret=err(True/False): error/no error
,version(string): GAMESS and FMO version
,mulchg(list): list of Mulliken charges
ResolveDerivedData(drvnam): resolve derived data
drvnam(string): derived data name
ret=fmodat(list): list of FMOProperty instance
,cmpsign(list): list of sign
RunMethod(method): run method for PyCrust
SavePropChoise(on): save property choice data
SetDataListInSelLB(): set data name in select list box
SetGraphData(pltprp): set graph data
SetPropChoise(): set property choice widgets
Version(): show program version on messagebox
WriteRemark(): write remarks on left panel in main window
6-7 FMOProperty class(fuplot.py)...FMO output data
(1)attributes and their default values
name=name # data name
outfile=outfil # FMO output file name
inpfile=inpfil # FMO input file name
pdbfile=pdbfil # pdb file name
# property flags
geom=3 # 0:no, 1:output file, 3:input file
pieda=False # =0:pie, =1:pieda
ctchg=False # =0:no data, 1:yes
mulchg=False # 0:not available, 1*yes
espot=False
density=False
orbital=False
# method in FMO
44
fmo=True
nbody=2 # # 2:fmo2, 3:fmo3
corr=0 # flag 0:hf, 1:corr
# property value
prpdic={} # dictionary of FMO property
etfmo2=0 # fmo2,fmo3
etfmo3=0
ecfmo2=0 # fmo2,3
ecfmo3=0 #
# molecule data
natmfrg=[] # natm in each fragment
natm=0 # total natm
nbas=0
nfrg=0
tchg=0 # total charge of while system
nbasfrg=[] # each fragment
frgnam=[] # fragment name
frgchg=[] # fragment charge
indat=[] # indat in FMO input data
bdabaa=[] # bda and baa
jobtitle='' # job comment in output
gamessver='' # GAMESS version
fmover='' # FMO version in GAMESS
# FMO properties list
frgpieda=[] # PIEDA data
frgdist=[] # interfragment distance
ctcharge=[] # CT charge
mulliken=[] # Mulliken population
onebody=[] # one-body energy
(2)methods
SetAttributes(): read FMO attributes in FMO output and set them
to the attributes
GetFMOIterEnergy(): read FMO output to get FMO iterations
ret=iter(int): number of iterations
,de(list): list of energy change
,dd(list): list of density change
45
GetFrgIterEnergy(): read FMO output to get energy change in SCC
ret=iter(list): iteration number for each fragment
,efmo(list): list of total energy
,de(list): list of energy change
,dd(list): list of density change
6-8 fuGraph class(fugraph)...control drawing graph
(1)methods
CreateChildGraphPanel(): create child graph panel
CreateCTChargeCmdPanel(): create control panel for CT charge plot
CreateGraphPanel(): create panels(CreateCTChargeCmdPanel,
CreateMullikenCmdPanel,CreatePIEDACmdPanel)
CreateMullikenCmdPanel(): create controle panel for Mulliken plot
CreatePIEDACmdPanel(): create controle panel for PIEDA plot
DrawChildMolView(): draw moleculr model colored by property
DrawGraph(): draw graph
GetNumberOfPIEDAComponents(): get number of PIEDA components
ret=ncmp(int): number of PIEDA components
GetRankColor(value): get color of function value
value(float): function value
ret=color(list): color
MakeAllCTChergeData(): make plot data for all CT charge
ret=pltdat(list)
MakeAllMullikenData(): make all Mulliken plot data
ret=pltdat(list): list of plot data
MakeDataFor2D(): make 2D plot data
ret=pltdat2d(list): list of 2d plot data
MakeFragmentCTChargeData(ifrg): make CT charge data for plot
ifrg(int): fragment number
ret=pltdat(list): list of plot data
MakeFragmentMullikenData(ifrg):make Mulliken plot data for fragment
ifrg(int): fragment number
ret=pltdat(list): list of plot data
MakeFragmentPIEDAData(ifrg):make PIEDA plot data for fragment
ifrg(int): number of fragment
ret=pltdat(list): list of plot data
46
MakePIEDABondingEnergyData(): make PIEDA bonding energy data
ret=pltdat(list): list of plot data
MakePIEDARemarkList(pltdat): make remark data for PIEDA
pltdat(list): list of PIEDA plot data
ret=lst(list): list of PIEDA remarks
MakeRankColorData(): make rank color data for 2D graph
MakeRemarkData(): make remark data in 2D plot
ret=remarkdata(list): list of remark data
MenuGraph(): menu items
PrintData(idat): print data on console
idat(int): data number, i.e. fragment number
PrintMaxData(): print maximum value in data on console
PrintMinData(): print minimum value in data on console
SetFMOProp(pltprp,datnam,molint,piedacmp,mullbody):set FMO
property plot data
pltprp(int): 0 PIEDA, 1 CTCharge, 2: Mulliken
datnam(string): data name
molint(True/False): flag for molecular interaction
piedacmp(list): list of PIEDA component name
mulbody(int): n-body mulliken
SetFMOPropData(natm,nfrg,frgnam,fmoprp,frgdist): set FMO property
natm(int): number of atoms
nfrg(int):number of fragments
frgnam(list): list of fragment names
fmoprp(list): list of FMO poperty data, PIEDA,CTCharge or
Mulliken
frgdist(list): list of fragment distances
SetMolViewFragmentData(pdbfile,indat,bdabaa): set fragment data
for molview draw
pdbfile(string): PDB file name
indat(list): indat data in FMO input data
bdabaa(list): list of bda-baa
SetMullikneBodyWidget(mullbody): set widget for Mulliken
SetPIEDAComponentWidget(piedacmp): set widget for PIEDA components
SetRankColor():Set Rank color
SetWidgetStates():Set widget states
47
SortDataNmb(pltdat): Sort data in ascending data number
pltdat(list): data for plot
ret=order(list): order of data in plot
SortDist(): Sort data in ascending distance
ret=order(list): order of data in plot
SortLarge(pltdat): Sort data in descending order
pltdat(list): data for plot
ret=order(list): order of data in plot
SortSmall(pltdat): Sort data in ascending order
pltdat(list): data for plot
ret=order(list): order of data in plot
6-9 BarGraph class(fugraph.py)...Draw bar graph
(1)attributes and their defaults
fontsize=[6,10] # font size in pixel
fontcolor='black' # font color in wx.color
# set graph size
wplt=self.size[0]; hplt=self.size[1] # plot panel size
# title and axis labels
title='' # title text
xlabel='' # title for x-axis
ylabel='' # title for y-axis
# plot data
ndata=0 # number of data
data=[] # plot data
order=[] # order of data in plot
itemlist=self.SetDefaultItemList() # item list
extradata=False # only 1 extra data is allowed
extradatalabel='' # label of extra data
extposivalue=0.0
maxplotdata=0 # number of plot data; ndata or ndata+1(extra)
begindata=0 # the first sequence number of data to plot
focus=1 # seq. number of data to be drawn with thick frame
# remark
remarklist=[] # remark list
remarkboxsize=[10,8] # tile:[width,height]
48
wremark=0 # 10 width of remark
rank=10 # color rank
# y-axis range
wytitle=30 # width of y-title
wylabel=50 # width of y-label
xunit=12 # unit of x-axis in pixce,barwidth*2+2
barwidth=5 # bar width
hxtitle=20 # x axis title height
hxlabel=30 # height of x-label
# title
htitle=25 # title height
#y range
yrangemin=-50.0 # +/- y max value
yunit=0 # =(yinipos-yendpos)/(2.0*yrange)
# scale out value
scaleoutposi=0.0; scaleoutnega=0.0
(2)methods
ClearGraph(): clear graph
DrawTitle(dc): draw graph title
dc(device context)
DrawAxisLabel(dc): draw x-label
dc(device context)
DrawRemark(dc): draw color remark
dc(device context)
DrawXAxis(dc):draw x-axis
dc(device context)
DrawYAxis(dc):draw y-axis
dc(device context)
FindXpos(value): find x position corresponding to value
value(int): x value
ret=x(int): position
FindYpos(value): find y position corresponding to value
value(float): y value
ret=y(int): position
Plot(on): draw graph
49
on(True/False): on/off flag
PlotItemsInStackBar(dc,ii,x): plot items in stacked bar graph
dc(device context)
ii(int): ii-th item
x(int: position in x-axis
Replot(xmove): replot graph in scrolling graph
xmove(int): mouse move length
SetAxisLabel(xlabel,ylabel): set x and y axis labels
xlabel(string): x-label
ylabel(string): y-label
SetBackgroundColor(color): set background color
color(list,[r,g,b] or wx color, like 'white')
SetDefaultItemList(): set remark list for items to plot
ret=itemlist(list), default=[['1',c1],['2',c2],['3',c3],
['4',c4],['5',c5],['6',c6]],
where ci(i=0-6) is color data
SetData(data,order): set data and plot order
data(list): data in form [[0,value1],[1,value2],..]
order(list): order of data in plot
SetFont(font,fontsize): set font and its size
font(wx.Font): font
fontsize(list): font size in pixels,[width,height]
SetItemNameAndColor(itemlist): set item name and color
itemlist(list): item list in form [['text1',color1],...]
SetPlotSize(wplt,hplt): set graph size
wplt(int): width in pixel, usually equal to panel width
hplt(int): height in pixel, usually equal to panel height
SetRemark(remarkboxsize,remarklist): set remark box size and
remarks
remarkboxsize(list): box size in pixels, [width,height]
remarklist(list): list data for remark
SetRankColor(negacolor,posicolor,negascaleoutcolor,
posiscaleoutcolor): set rank color
regacolor(list): color for negative values
posicolor(list): color for positive values
negascaleoutcolor(list): color for negative values of scale out
50
posiscaleoutcolor(list): color for positive values of scale out
SetTitle(title): set graph title
title(string): title text
SetYRange(ymin,ymax): set y value range
ymin(float): minimum value in y range
ymax(float): maximum value in y range
6-10 TileGraph class(fugraph.py)...draw tile graph
(1)attributes and their defaults
focus=0 # focused fragment number
bgcolor=bgcolor
font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
wx.FONTWEIGHT_NORMAL, False, 'Courier 10 Pitch')
fontsize=[6,8]
fontcolor='black'
# graph size
wplt=self.size[0] # width of graph
hplt=self.size[1] # height of graph
# title and axis labels
title='' # title text
xlabel='' # title for x-axis
ylabel='' # title for y-axis
# plot data
ndata=0 # number of data
data=[] # [[[1,1,value,flag],..[1,n,value,flag]],
# [[2,1,value,flag],..]],.
order=[] # order of data in plot
extradata=False # only 1 extra data is allowed
extradatalabel='' # label of extra data
extposivalue=0.0 # scale out positive value
extnegavalue=0.0 # scale out negative value
maxplotdata=0 # number of plot data; ndata or ndata+1(extra)
xbegindata=0 # the first sequence number of data to plot
ybegindata=0 # the first sequence number of data to plot
# remark
remarklist=[] # list of remark
51
remarkboxsize=[8,8] # remark box size
remarktext='' # remark text
hremark=20 # height of remark
rankposi=10 # rank for positive value
ranknega=10 # rank for negative value
# rank color
posicolor='red' # will be converted to RBG255
negacolor='blue' # will be converted to RGB255
extnegacolor=[0,255,255] # color for scale out negative value,
# 'cyan'
extposicolor=[255,0,152] # color for scale out positive
# value,'magenta'
colorcode1=[255,255,0] # diagonal block color,'yellow'
colorcode2=[255,204,0] # covalent-bonded block color, 'gold'
tilesize=[10,10] # tile size
# x-axis range
wytitle=30 # width of y-title
wylabel=50 # width of y-label
wremark=55 # width of remark
xunit=12 # barwidth*2+2
barwidth=5 # width of bar
hxtitle=20 # height of x-title
hxlabel=30 # height of x-label
# y-axis range
htitle=25 # title height
yrangemin=-50.0
yrangemax=50.0 # +/- y max value
yrange=yrangemax # y value range
scaleoutposi=0.0; scaleoutnega=0.0
(2)methods
ClearGraph(): clear graph
DrawAxisLabel(dc): draw axis label
dc:(device context)
DrawRemark(dc,x,y,remarktext): draw remarks
dc(device context)
52
x(int): x position
y(int): y position
remarktext(string): text data
DrawTitle(dc): draw graph title
dc(device context)
FindXpos(value): find x position corresponding to value
value(int): x value
ret=x(int): x position
FindYpos(value): find y position corresponding to value
value(float): y value
ret=y(int): y position
GetColor(val,code): get color correspond to value
val(float): function value
code(int): 0: color by value, 1: diagonal color, 2: covalent
bonded fragment color
ret=color(list): color data
MakePlotData(): make color plot data
ret=plotdata(list): list of color plot data
Plot(on): draw graph
on(True/False): on/off flag
Replot(xmove,ymove): redraw graph
xmove(int): mouse move length along x axis
ymove(int): mouse move length along y axis
SetAxisLabel(xlabel,ylabel): set axis labels
xlabel(string): x-axis label text
ylabel(string): y-axis label text
SetBackgroundColor(color): set background color
color(list): color data
SetBeginDataNumber(number): set begin data number
number(int): data number
SetData(data,order): set data and order
data(list): plot data
order(list): order list of data to plot
SetFocus(focus): draw rectangle with thick border color
focus(int): current fragment number
SetFont(font,fontsize):set font and font size
53
font(wx.font)
fontsize(list): font size [width,height] in pixels
SetPlotSize(wplt,hplt): set plot region
wplt(int): width of plot panel
hplt(int): height of plot panel
SetRankColor(negacolor,posicolor,extnegacolor,extposicolor,
colorcode1,colorcode2): set color codes
negacolor(list): color for negative value
posicolor(list): color for positive value
extnegacolor(list): color for scale out negative value
extposicolor(list): color for scale out positive value
colorcode1(list): color for self fragment
colorcode2(list): color for covalent bonded fragment
SetRemark(remarkboxsize,remarklist):set remark data
remarkboxsize(list[x,y]): box size
remarklist(list): remark list, see MakePIEDARemarkList
method in fuGraph class
SetRemarkTitle(text): set remark title
text(string): text
SetTitle(title): set title of plot panel
title(string): title text
SetYRange(yrangemin,yrangemax): set y-axis range
yrangemin(float): minimum value in y range
yrangemax(float): maximum value in y range
6-11 MatPlotLib_Frm class(fugraph.py)・・・ Frame for MatPlotLib
(1)methods
Clear(): clear graph
NewPlot(): create subplot (figure.add_subplot(111))
PlotTitle(text): plot title
text(string): title text
PlotXLabel(text): plot x-axis label
text(string): label text
PlotXY(x,y): plot (x,y) data
x(list,[1,2,...]): list if x values
y(list,[1,2,...]):list of y values
54
PlotYLabel(text): plot y-axis label
text(string): label text
6-12 fulib module (fulib.py)・・・ Global methods
(1) methods
AngleT(ra,rb): calculate angle between two vectors
ra(list,[x,y,z]): point vector
rb(list,[x,y,z]): point vector
ret=t(float):angle in radian
AtmNamElm(atmnam):get element from PDB atom name
atmnam(string*4): PDB atom name
ret=elm(string*2): element
ChangeToPreviousDir(dirname,inifile):get directory name in
inifile and change current directory to it
dirname(string): directory of the executable program
inifile(string): file name in which directory name is kept
ret=dir(string): current directory name
ChooseColorPanel(parent):open color picker panel
parent(frame instance): parent frame
CompressIntData(expnint): compress integers
expnint(list): list of integers
ret=cmpint(list): list of compressed integers
CopyBitmapToClipboad(bmp): copy screen image to clipboard
bmp(bitmap): bitmap data of screen image
CovalentBondedAtomList(elm,coord):
elm(list): element list
coord(list): list of coordinates
ret=bndlst(list): bonded atom list
Distance(p1,p2): calculate distance between tow points
p1(list[x,y,z]): point coordinate
p2(list[x,y,z]): point coordinate
ret=r(float): distance between p1 and p2
ExpandIntData(compint): expand packed integers
compint(list):
ret=expnint(list)
ExtractWaters(molnam,pdbmol):
55
ret=watdat,moldat
GetIconFile(exedir,iconname): Get Icon file
exedir(string): directory of exe file
iconname(string): icon name
ret=iconfile(string): file name of icon
GetExeDir(program): get directory of executable program
program(string): program name
ret=dir(string): directory
HSVtoRGB(HSVcol): convert HSV color code to RGB code
HSVcol(list): HSV color
ret=RGBcol(list): RGB color
ListPDBResSeq(pdbmol,skipter,skipwat):
ret=resnamlst
OrientOrg(pdborg,pdbdrv):
ret=pdbdrv
PrintNumericList(filnam,intlst,header,sep,width,colu,nw):
PrintStringList(filnam,strlst,header,sep,width,colu,nw):
RotMatAxi(v,t): return matrix u for rotation by angle "t" (radian)
around vector v.
v(list): axis vector
t(float): angle in radian
ret=u(list): (3x3) transformation matrix
RotMatEul(a,b,c): return rotation matrix u for rotation by (a,b,c)
Euler angles
a(float): angle alpha
b(float): angle beta
c(float): angle gamma
ret=u(list): (3x3) transformation matrix
RotMatPnts(refpnt,newpnt): get rotation matrix transforming
reference points to new points
refpnt(list): reference points coordinates
newpnt(list): new coordinates
ret=u(list): (3x3) transformation matrix
RotMatX(a): transformation matrix of rotation by angle "a" around
x-axis
a(float): angle in radian
56
ret=ux(list): (3x3) transformation matrix
RotMatY(b):transformation matrix of rotation by angle "b" around
y-axis
b(float): angle in radian
ret=uy(list): (3x3) transformation matrix
RotMatZ(c):transformation matrix of rotation by angle "c" around
z-axis
a(float): angle in radian
ret=uz(list): (3x3) transformation matrix
RotMol(u,cnt,coord): rotate molecule
u(list, 3X3): transformation matrix
cnt(list[x,y,z]): center of rotation
coord(list[x,y,z]):, coordinates
ret=xyz(list[x,y,z]): transformed coordinates
SplitAtTER(mnam,pdbmol): split molecule at TER
mnam(string): name of molecules
pdbmol(list): pdb mol data
ret=molnamdic(dictionary): dictionary of generated molecule
names
,moldatdic(dictionary): dictionary of molecular data
,delcondic(dictionary): dictionary of deleted connect data
SplitRes(molnam,pdbmol): split molecule into residues
molname(string): name of molecule
pdbmol(list): pdb mol data
ret=molnamdic(dictionary): dictionary of molecular names
,moldatdic(dictionary): dictionary of molecular data
StringToInteger(strdata): convert string to integer
strdata(list): string data list
ret=intdata(list): list of integers
TrnMat(ra,ri,rf): get transformation matrix to rotate ri to rf
around axis ra
ra(list[x,y,z]): axial vector for rotation
ri(list[x,y,z]): initial position vector
rf(list[x,y,z]): final position vector
ret=u(list): transformation matrix
WriteDirectoryOnFile(dirname,filename): write directory name on
57
a file
dirname(string):directory name
filename(string): file name
6-13 Class in fupanel.py module... pop-up panels
class AtomChargeInput_Frm(wx.Frame): atom charge input panel
class ControlPanel_Frm(wx.Frame): control panel
class DeriveDataInput_Frm(wx.Frame): derived data input panel
class GamessInput_Frm(wx.Frame): GAMESS input assistant panel
class GroupJoin_Frm(wx.Frame): Group joint panel
class GroupRename_Frm(wx.Frame): Group rename panel
class LayerAssignPanel_Frm(wx.Frame): layer assignment panel
class NameSelector_Frm(wx.Frame): Name/number select panel
class OpenMultipleFile_Frm(wx.Frame): Open multiple files panel
class RadiusSelector_Frm(wx.Frame): Radius selection panel
class TreeSelector_Frm(wx.Frame): Tree selector panel
class ZMatrixPanel_Frm: Z-matrix panel for change conformation
58
7. Miscellaneous
7-1 Note on sequence number of atoms and 'TER'
It is noted that, in the program atoms are numbered from 0 and in I/O
widgets from 1. The treatment of 'TER's(in PDB ATOM record) is tricky.
Fu keeps all 'TER's without subjecting them to any operation except the
DeleteTerAtoms method of fuModel class. In fragmentation of a molecule,
a complicated code is needed as in SetFragmentName method in fuMole class,
since 'TER' has a sequence number.
7-2 Types of AddHydrogen
Table AddHydrogenType(addhtype)
-------------------------------------------------------------------
addhtype connection of comment
code reference atoms
-------------------------------------------------------------------
|-atom2 H atom and atom1-4 form
1A1 H-atom1-atom3 pseudotetrahedron.
|-atom4 ex. H-CH3 of methane
|-atom2 atom1 is sp2 and H and atom1-3 are in
1A2 H-atom1 a plane. ex. H-C of benzene
|-atom3
1A3 H-atom1-atom2-atom3 H-atom1-atom2-atom3 can be cis
or trans.
ex. H-O-C-C of ethanol
2A1 H-| |-atom2 two H atoms are added at atom1
atom1 H2 and atom2,3 are twisted by
H-| |-atom3 90 degrees. ex. H2 of CH4
2A2 H-| all atoms are in a plane
atom1-atom2-atom3 ex. H2N-C-N(H2)- of arginine
H-|
59
3A1 H-| three H atoms are attached at atom1
H-atom1-atom2-atom3 ex. H3N-C-C- of lysine
H-|
-------------------------------------------------------------------
7-3 Tutorials
The following tutorials are provided for help programming with fu.
(1) tutorial_01: create window with StatusBar and Menu
practice: use of wxFrame, wxCreateStatusBar and fuMenu class
in fuctrl.py module.
(2) tutorial_02: read PDB file and use PyCrust
practice: 1)use of ReadPDBData method, a static method of fuModel
class in fumodel.py module.
2)use of PyCrust
usage: 1)Execute 'File'-'Open' command and read PDB file.
2)Then type 'print demo.pdbmol[enter]' in PyCrust
console.
3)Type 'demo.pycrust.shell.run('"print filename:",
demo.filename')'[enter] in PyCrust console.
note: You see that you can access attributes and methods in
running GUI program through python commands in PyCrust
console. That means you can modify data and add
functions interactively, without modifying the source
codes of the program. For execute a python program, type
'execfile('hello.py')'[enter].
(3) tutorial_03: use of fuView class in fuview.py
practice: Draw line model (or CPK model) of CH4 molecule.
usage: The model is rotated and magnified by mouse move with
left button down and mouse wheel rotation, respectively.
(4) tutorial_04: use of fuMole class in fumole.py and fuView class
in fuview.py
practice: Draw molecule created from PDB data.
60
usage: The model is rotated and magnified by mouse move with
left button down and mouse wheel rotation, respectively.
(5) tutorial_05: BarGraph class in fugraph.py
practice: Draw bar graph.
usage: When graph is too large for the panel, a mouse move with
the left button down scrolls the graph.
(6) tutorial_06: TileGraph class in fugraph.py
practice: Draw tile graph.
usage: When graph is too large for the panel, a mouse move with
the left button down scrolls the graph.