Monday, November 30, 2009

convert protein data bank files into Ansys nodes, key points and lines

Here are two small python scripts I wrote that will read in a PDB file and output a text file to be used as input for Ansys finite element analysis. They're still kind of rough in that the input directory is hard coded, but they seem to work great at least for carbon nanotubes and other fullerenes.

convert PDB file to Ansys key points and lines

convert PDB file to Ansys nodes

To use these scripts:

1. create a protein data bank file of your structure
2. name it test.pdb and save it in a folder: C:\xyz
3. make sure you have python installed
4. and to make things easier for development and use, grab the free version of Wingware IDE 101
5. download the two scripts and open them in Wing
6. run the scripts

The output file will be in the xyz directory. To load them in Ansys: File > Read input from...


村长 said...

Ha! You use Py too :)
But when processing data,I think awk is easier, so better!

Raju said...


Many many thanks for this great work.

I followed the way you suggeted to convert PDB file into ANSYS format. When I import the text files, only nodes are visible. Is there any way get the connectivity (e.g., using beam element etc.)

Seeking your expert advice,



Tom said...

try the other script


jaavvaaddii said...

very tanx for yr script
but i have two problem:

1_i followed the way u suggested but i see only nodes
2_ also i cant see several last nodes or several nodes are omitted

i need yr help & best regard every body can help me.

u can send email:

T David said...

I can figure out this problem.
1.After all the steps.
2.Close the Python
3.Reopen the text of the atom.
I hope this will be helpful.