[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2670] contrib/py/scripts/addons:

Clemens Barth barth at root-1.de
Sun Nov 27 16:28:16 CET 2011


Revision: 2670
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2670
Author:   blendphys
Date:     2011-11-27 15:28:11 +0000 (Sun, 27 Nov 2011)
Log Message:
-----------


Dear all.

Yet again an overall polishing of my script. I'm sorry but there are lots
of changes in the code and treatment of the structures. However, the script is
much more convenient now.

Basic changes
=============

1. I removed my first loading procedure, which has taken simply too much time 
for loading a many-atom scenario. Only the dupliverts technique is used now.

2. Ideasman told me that care must be taken when changing the properties of
objects. For instance, the objects in other layers or scenes should not be 
modified. Following the advices, I was dealing with this issue.
   1. One can now change the radii either of all objects, which are activated 
      (marked) in the current scene and layer.
   2. Or one can change the radii of all atoms in one scene and in all layers
      which are active. This is useful since one wishes to do that from time 
      to time.
      
3. The type of radii can be changed: pre-defined radii (pre-defined in a custom
data file), atomic radii and van der Waals radii. The pre-defined radii in the
script are in fact atomic radii.

4. An issue with this dupliverts technique is that a single representative ball is
reproduced on a mesh, which reflects the structure of one type of atom (sub 
atomic structure) - a single atom cannot be really independently treated. To
extract an atom that has been chosen via the vertex in the 'edit mode' by the 
user, a button has been introduced into the panel. The button appears as soon 
as one is in the 'edit mode'. Pushing the button executes code, which separates 
the marked atom from the mesh or dupliverts structure such that the atom is a 
separate ball. This ball is completely independent, and its properties can be 
changed accordingly independently (shape, color, etc.).

5. There were some bugs in the code which reads PDB files. Also, the element 
list was 'strange' at some places (some elements were missing and all types of 
radii had the values of the atomic radii). All bugs could be removed.

6. I forgot to mention that a part of the buttons are now in the file dialog 
window. This is more convenient.




I consider the script as finished. I give it the version 0.9 since some changes
will be done in future during refereeing the manuscript. Here are some PDB 
files which you can try out. Have fun to try out all the stuff:

http://qsad.bu.edu/data/pdbfiles/
http://www.pdb.org/pdb/home/home.do
http://development.root-1.de/Atomic_Blender/

At the end I recognize that it is not much. I have spent most of the time with
the Blender specific Python code - it is not easy and not at all fast to get 
what one wishes! So far, I somewhat familiar with Blender python and changes
with respect to PDB etc. are easy.




Isssues
=======

- Measuring distance between two active objects in the object mode works. 
However, the same doesn't work with two vertices marked in the edit mode 
so far. The latter is due to the fact that I cannot determine the active 
vertices. ... otherwise you tell me how ...

- Separating an atom from a dupliverts structure works. However, it does not 
work if one wants to do the same with more than 1 activated atom. It is again
due to the issue of active vertices, which cannot be determined.

- I don't really like the place where the panel appears (VIEW_3D, TOOL_PROPS).
I want to have my own tab! :-)
Why? Right now, there are many other panels above my on always pushing my nice 
'Atomic Blender' panel to the bottom. Hmmm ... but I have no idea where to put
it elsewhere.


To be done in future
====================

- I would like to make more order in the structures, which appear in the 
outliner. For instance, sub-atomic structures (hydrogens, carbons, etc) should 
be put into a single structure called 'molecule' or 'crystal' or 'structure'. 
This can obviously be done via parenting.

- Double or triple bonds are not represented by sticks so far. However, this is 
needed. <= Very easy to do and is next to get included 

- I would like to choose also the ionic radii. But this is not easy to integrate
into the script: Note that not all atoms have same charge states and that a
single atom can have several charge states.

- Theorists use a file type which is called .xyz. This file can include many
configurations of a molecule, surface or complex atomic structure. For instance, 
such files are used to represent structures composed by atoms which move in 
time. <= My next project.
Integrating this should be easy since I have learned a lot about Blender's 
python interface. <= Is next to be done.


Ackknowledgements: 
==================
Thanks to ideasman, meta_androcto, truman, kilon, dairin0d, PKHG, Valte, etc. 
for helping me with the code. I feel sorry for the many 'stupid' questions I 
have been posing. (and don't fell on the save side now since I stop working on
the script: I'm going to annoy you also in the next future. ;-))


So, I wait now for feedback. What do you all think about the manuscript?


Cheers all,

Blendphys.

Modified Paths:
--------------
    contrib/py/scripts/addons/io_import_pdb_atomic_blender.dat
    contrib/py/scripts/addons/io_import_pdb_atomic_blender.py

Modified: contrib/py/scripts/addons/io_import_pdb_atomic_blender.dat
===================================================================
--- contrib/py/scripts/addons/io_import_pdb_atomic_blender.dat	2011-11-27 15:07:23 UTC (rev 2669)
+++ contrib/py/scripts/addons/io_import_pdb_atomic_blender.dat	2011-11-27 15:28:11 UTC (rev 2670)
@@ -20,13 +20,24 @@
 Radius used      : 0.930000
 Radius, covalent : 0.930000
 Radius, atomic   : 0.490000
+
+
+Atom
+====
+Number           : 3
+Name             : Lithium
+Short name       : Li
+Color            : 0.729411764706,0.278431372549,0.254901960784
+Radius used      : 1.230000
+Radius, covalent : 1.230000
+Radius, atomic   : 2.050000
 Charge state     : 1
 Radius, ionic    : 0.680000
 
 
 Atom
 ====
-Number           : 3
+Number           : 4
 Name             : Beryllium
 Short name       : Be
 Color            : 0.447058823529,0.725490196078,0.309803921569
@@ -41,7 +52,7 @@
 
 Atom
 ====
-Number           : 4
+Number           : 5
 Name             : Boron
 Short name       : B
 Color            : 1.0,1.0,1.0
@@ -56,7 +67,7 @@
 
 Atom
 ====
-Number           : 5
+Number           : 6
 Name             : Carbon
 Short name       : C
 Color            : 0.0,0.0,0.0
@@ -71,7 +82,7 @@
 
 Atom
 ====
-Number           : 6
+Number           : 7
 Name             : Nitrogen
 Short name       : N
 Color            : 0.0,0.0,1.0
@@ -90,7 +101,7 @@
 
 Atom
 ====
-Number           : 7
+Number           : 8
 Name             : Oxygen
 Short name       : O
 Color            : 1.0,0.0,0.0
@@ -109,7 +120,7 @@
 
 Atom
 ====
-Number           : 8
+Number           : 9
 Name             : Fluorine
 Short name       : F
 Color            : 0.0,1.0,0.0
@@ -124,7 +135,7 @@
 
 Atom
 ====
-Number           : 9
+Number           : 10
 Name             : Neon
 Short name       : Ne
 Color            : 0.537254901961,0.607843137255,0.525490196078
@@ -137,7 +148,7 @@
 
 Atom
 ====
-Number           : 10
+Number           : 11
 Name             : Sodium
 Short name       : Na
 Color            : 0.0,0.0,1.0
@@ -150,7 +161,7 @@
 
 Atom
 ====
-Number           : 11
+Number           : 12
 Name             : Magnesium
 Short name       : Mg
 Color            : 1.0,1.0,1.0
@@ -165,7 +176,7 @@
 
 Atom
 ====
-Number           : 12
+Number           : 13
 Name             : Aluminium
 Short name       : Al
 Color            : 0.701960784314,0.2,0.623529411765
@@ -178,7 +189,7 @@
 
 Atom
 ====
-Number           : 13
+Number           : 14
 Name             : Silicon
 Short name       : Si
 Color            : 0.654901960784,0.647058823529,0.278431372549
@@ -197,7 +208,7 @@
 
 Atom
 ====
-Number           : 14
+Number           : 15
 Name             : Phosphorus
 Short name       : P
 Color            : 1.0,1.0,0.0
@@ -214,7 +225,7 @@
 
 Atom
 ====
-Number           : 15
+Number           : 16
 Name             : Sulfur
 Short name       : S
 Color            : 1.0,1.0,0.501960784314
@@ -233,7 +244,7 @@
 
 Atom
 ====
-Number           : 16
+Number           : 17
 Name             : Chlorine
 Short name       : Cl
 Color            : 0.0,1.0,0.0
@@ -250,7 +261,7 @@
 
 Atom
 ====
-Number           : 17
+Number           : 18
 Name             : Argon
 Short name       : Ar
 Color            : 0.317647058824,0.329411764706,0.749019607843
@@ -263,7 +274,7 @@
 
 Atom
 ====
-Number           : 18
+Number           : 19
 Name             : Potassium
 Short name       : K
 Color            : 0.811764705882,0.239215686275,0.423529411765
@@ -276,7 +287,7 @@
 
 Atom
 ====
-Number           : 19
+Number           : 20
 Name             : Calcium
 Short name       : Ca
 Color            : 1.0,1.0,1.0
@@ -291,7 +302,7 @@
 
 Atom
 ====
-Number           : 20
+Number           : 21
 Name             : Scandium
 Short name       : Sc
 Color            : 0.662745098039,0.447058823529,0.313725490196
@@ -304,7 +315,7 @@
 
 Atom
 ====
-Number           : 21
+Number           : 22
 Name             : Titanium
 Short name       : Ti
 Color            : 0.270588235294,0.533333333333,0.686274509804
@@ -323,7 +334,7 @@
 
 Atom
 ====
-Number           : 22
+Number           : 23
 Name             : Vanadium
 Short name       : V
 Color            : 0.270588235294,0.243137254902,0.635294117647
@@ -342,7 +353,7 @@
 
 Atom
 ====
-Number           : 23
+Number           : 24
 Name             : Chromium
 Short name       : Cr
 Color            : 0.807843137255,0.286274509804,0.819607843137
@@ -361,7 +372,7 @@
 
 Atom
 ====
-Number           : 24
+Number           : 25
 Name             : Manganese
 Short name       : Mn
 Color            : 0.752941176471,0.352941176471,0.552941176471
@@ -380,7 +391,7 @@
 
 Atom
 ====
-Number           : 25
+Number           : 26
 Name             : Iron
 Short name       : Fe
 Color            : 1.0,0.0,0.0
@@ -395,7 +406,7 @@
 
 Atom
 ====
-Number           : 26
+Number           : 27
 Name             : Cobalt
 Short name       : Co
 Color            : 0.274509803922,0.219607843137,0.752941176471
@@ -410,7 +421,7 @@
 
 Atom
 ====
-Number           : 27
+Number           : 28
 Name             : Nickel
 Short name       : Ni
 Color            : 0.439215686275,0.360784313725,0.862745098039
@@ -423,7 +434,7 @@
 
 Atom
 ====
-Number           : 28
+Number           : 29
 Name             : Copper
 Short name       : Cu
 Color            : 0.607843137255,0.0,0.0
@@ -438,7 +449,7 @@
 
 Atom
 ====
-Number           : 29
+Number           : 30
 Name             : Zinc
 Short name       : Zn
 Color            : 0.423529411765,0.36862745098,0.450980392157
@@ -453,7 +464,7 @@
 
 Atom
 ====
-Number           : 30
+Number           : 31
 Name             : Gallium
 Short name       : Ga
 Color            : 0.635294117647,0.729411764706,0.337254901961
@@ -468,7 +479,7 @@
 
 Atom
 ====
-Number           : 31
+Number           : 32
 Name             : Germanium
 Short name       : Ge
 Color            : 0.423529411765,0.756862745098,0.301960784314
@@ -485,7 +496,7 @@
 
 Atom
 ====
-Number           : 32
+Number           : 33
 Name             : Arsenic
 Short name       : As
 Color            : 0.396078431373,0.776470588235,0.250980392157
@@ -502,7 +513,7 @@
 
 Atom
 ====
-Number           : 33
+Number           : 34
 Name             : Selenium
 Short name       : Se
 Color            : 0.952941176471,0.270588235294,0.905882352941
@@ -523,7 +534,7 @@
 
 Atom
 ====
-Number           : 34
+Number           : 35
 Name             : Bromine
 Short name       : Br
 Color            : 0.0,0.498039215686,0.0
@@ -540,20 +551,31 @@
 
 Atom
 ====
-Number           : 35
+Number           : 36
 Name             : Krypton
 Short name       : Kr
 Color            : 0.227450980392,0.435294117647,0.192156862745
 Radius used      : 1.310000
 Radius, covalent : 1.310000
 Radius, atomic   : 1.240000
+
+
+Atom
+====
+Number           : 37
+Name             : Rubidium
+Short name       : Rb
+Color            : 1.0,1.0,1.0
+Radius used      : 2.160000
+Radius, covalent : 2.160000
+Radius, atomic   : 2.980000
 Charge state     : 1
 Radius, ionic    : 1.470000
 
 
 Atom
 ====
-Number           : 36
+Number           : 38
 Name             : Strontium
 Short name       : Sr
 Color            : 1.0,1.0,1.0
@@ -566,7 +588,7 @@
 
 Atom
 ====
-Number           : 37
+Number           : 39
 Name             : Yttrium
 Short name       : Y
 Color            : 1.0,1.0,1.0
@@ -579,7 +601,7 @@
 
 Atom
 ====
-Number           : 38
+Number           : 40
 Name             : Zirconium
 Short name       : Zr
 Color            : 1.0,1.0,1.0
@@ -594,7 +616,7 @@
 
 Atom
 ====
-Number           : 39
+Number           : 41
 Name             : Niobium
 Short name       : Nb
 Color            : 1.0,1.0,1.0
@@ -611,7 +633,7 @@
 
 Atom
 ====
-Number           : 40
+Number           : 42
 Name             : Molybdenum
 Short name       : Mo
 Color            : 1.0,1.0,1.0
@@ -628,7 +650,7 @@
 
 Atom
 ====
-Number           : 41
+Number           : 43
 Name             : Technetium
 Short name       : Tc
 Color            : 1.0,1.0,1.0
@@ -641,7 +663,7 @@
 
 Atom
 ====
-Number           : 42
+Number           : 44
 Name             : Ruthenium
 Short name       : Ru
 Color            : 1.0,1.0,1.0
@@ -654,7 +676,7 @@
 
 Atom
 ====
-Number           : 43
+Number           : 45
 Name             : Rhodium
 Short name       : Rh
 Color            : 1.0,1.0,1.0
@@ -667,7 +689,7 @@
 
 Atom
 ====
-Number           : 44
+Number           : 46
 Name             : Palladium
 Short name       : Pd
 Color            : 1.0,1.0,1.0
@@ -682,7 +704,7 @@
 
 Atom
 ====
-Number           : 45
+Number           : 47
 Name             : Silver
 Short name       : Ag
 Color            : 1.0,1.0,1.0
@@ -697,7 +719,7 @@
 
 Atom
 ====
-Number           : 46
+Number           : 48
 Name             : Cadmium
 Short name       : Cd
 Color            : 1.0,1.0,1.0
@@ -712,7 +734,7 @@
 
 Atom
 ====
-Number           : 47
+Number           : 49
 Name             : Indium
 Short name       : In
 Color            : 1.0,1.0,1.0
@@ -725,7 +747,7 @@
 
 Atom
 ====
-Number           : 48
+Number           : 50
 Name             : Tin
 Short name       : Sn
 Color            : 1.0,1.0,1.0
@@ -744,7 +766,7 @@
 
 Atom
 ====
-Number           : 49
+Number           : 51
 Name             : Antimony
 Short name       : Sb
 Color            : 1.0,1.0,1.0
@@ -761,7 +783,7 @@
 
 Atom
 ====
-Number           : 50
+Number           : 52
 Name             : Tellurium
 Short name       : Te
 Color            : 1.0,1.0,1.0
@@ -782,7 +804,7 @@
 
 Atom
 ====
-Number           : 51
+Number           : 53
 Name             : Iodine
 Short name       : I
 Color            : 0.0,0.498039215686,0.498039215686
@@ -799,20 +821,31 @@
 
 Atom
 ====
-Number           : 52
+Number           : 54
 Name             : Xenon
 Short name       : Xe
 Color            : 1.0,1.0,1.0
 Radius used      : 1.310000
 Radius, covalent : 1.310000
 Radius, atomic   : 1.240000
+
+
+Atom
+====
+Number           : 55
+Name             : Caesium
+Short name       : Cs
+Color            : 1.0,1.0,1.0
+Radius used      : 2.350000
+Radius, covalent : 2.350000
+Radius, atomic   : 3.350000
 Charge state     : 1
 Radius, ionic    : 1.670000
 
 
 Atom
 ====
-Number           : 53
+Number           : 56
 Name             : Barium
 Short name       : Ba
 Color            : 1.0,1.0,1.0
@@ -827,7 +860,7 @@
 
 Atom
 ====
-Number           : 54
+Number           : 57
 Name             : Lanthanum
 Short name       : La
 Color            : 1.0,1.0,1.0
@@ -842,7 +875,7 @@
 
 Atom
 ====
-Number           : 55
+Number           : 58
 Name             : Cerium
 Short name       : Ce
 Color            : 1.0,1.0,1.0
@@ -859,7 +892,7 @@
 
 Atom
 ====
-Number           : 56
+Number           : 59

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list