Silvaco-tcad electric field files to the ElectricFieldReader

I want to use Silvaco-TCAD electric field files as my detector simulation’s electric field. Could you tell me how to change?

Hi @Bail

it’s a two-step process:

  • First, you need to export the fields from Silvaco to the DF-ISE format. This will produce two ASCII files with the endings .dat and .grd containing the field data and the mesh points.
  • For performance reasons, we generate a regularly-spaced mesh from these files using the mesh_converter tool of Allpix Squared. YOu can find a description of its parameters in the user manual.
  • The output file (.apf or .init) from the mesh converter can be loaded using the ElectricFieldReader and be used for simulation.

Let me know if you have trouble with any of this.


Thanks for you replay


it has been brought to my attention that apparently Silvaco currently lacks the possibility to export 3D field maps, and a workaround is necessary. Maybe @mbomben could help you with this?


Dear @Bail ,
you should use the cutplane feature of Tonyplot3D to indeed extract a 2D slice and then from that slice use extract feature of deckbuild to get the electric field values in that slice.
What I usually do is to get a slice every micron in the sensor depth direction and then join these
slices in one 3D map. Extra: I interpolate this map over a regular grid.

Best regards,
Marco Bomben

Hi @simonspa,

I do not have a lot of experience with Silvaco TCAD and I also want to extract the electric field and import it into the Allpix2 mesh converter. However, how can I export the .grd file containing the mesh points? I only found how I can extract a .dat file with XY coordinates of the mesh nodes together with the values for the electric field strength.

Already thanks for your answer.


Hi @Basgo355

see @mbomben s response just above here. You need to export the individual slices and combine them again. Maybe @mbomben could share his scripts for that and we can see if we can integrate this in the Mesh Converter tool - but for now I fear you have to do that manually.

Best regards,

Thank you for your answer @simonspa, but I am already extracting the electric field for a 2D structure, that is not the problem. The problem is that the mesh is saved by deckbuild in a .str file and I don’t understand how I can make a .grd file from that.

So, I have the .dat file with the electric field strength at its coordinates but without the .grd file.

Hi @Basgo355

sorry I misunderstood your goal. If you already have these slices I think there is little point of transforming them into a .grd DF-ISE file. That format is very complicated and not that user friendly.

I would say you have two options:

  1. Take your files, interpolate between the points such that you get a regular grid and write it into a file directly readable by Allpix Squared. The easiest here is probable the INIT format, which essentially is a text file with each grid point index and the corresponding field on a separate line. This format is described in Section 13.2.1 (Output data).
  2. Write a class that reads your slice data for the Mesh Converter as an input. This was what I meant with taking @mbomben’s script and turning it into something generic. This might even be easier than doing your own interpolation, depending on whether you have some background with C++. Essentially we need two inputs: one is the list of grid coordinates, the other the list of field values associated with them. You would have to implement a class, e.g. SilvacoParser which mimicks the DF-ISE parser located here, the class to derive this from is the MeshParser class.

If the latter is the route you’re choosing please let me know - I can certainly assist you in getting that code up, running and merged into the upstream project!

All the best,

1 Like

Hi @simonspa

Thanks for your answer, I will go with step one for the moment.
I might look into step two later on. I first want to get used to the allpix2 framework.

Have a nice day.


Hello @Basgo355 , @simonspa , @Bail , all,
I have managed to write down a protocol to extract from Silvaco TCAD .str files the electric field projections.

Hope this helps,
Marco Bomben

1 Like

Hello @mbomben,
Thank you very much for providing the reference to the protocol file. It is very helpful considering I found almost no resource elsewhere on extracting values from 3D Silvaco simulation results.
I have two questions:

  1. In the python script ( that reads the template, it (edits and ) saves the cut plane coordinates and ELEV values. Are the ELEV values a map from (z_min, z_max) to (-1,1) to shift the cut plane across different Z-coordinates?
  2. The python file ( saves all other lines from the template, as is. Will I have to worry about changing other parameters in template file (for my simulation results). Eg - scene matrix, camera matrix, proj_3d, etc?

Hello @danush ,

  1. as far as I can remember yes
  2. I think what only matters are these lines:
#Cut Plane Settings   
point_1 0 0
point_2 75 0
point_3 75 75

where point_1 is top left point, point_2 is the top right point and point_3 is the bottom right point in (x,y) plane. The script will add the z coordinate to those points to get in total 3 points in 3D space which uniquely define the cut plane. I think that if your structure is smaller in (x,y) than 75 µm it could complain. Best thing is to adapt those ‘75’ to your values.

Best regards,
Marco Bomben

Hello @mbomben ,

Right, I made sure to change the X,Y coordinates of these points. I was a bit worried about all other parameter values.

Thank you for your reply!

Hi @simonspa ,

With @mbomben’s protocol, I was able to extract electric field and grid information from Silvaco (3D simulation). I now would like to create a regular grid using Barycentric interpolation through the MeshConverter tool. I made a .grd file (containing only the x y z coordinates of all mesh points) and a .dat file (containing only Ex Ey Ez field values for the corresponding mesh points). The tool seems to be working using the SilvacoParser.cpp file. Can you please confirm if the parser file is working as expected because I’ve seen in some places that this tool can be used only for DF-ISE TCAD data?

Also, thank you very much to your team for making these tools!
P.S - @mbomben if you would like me to share you the scripts for extracting 3D mesh+field information from Silvaco for older versions of tonyplot3D, please let me know.

Hi @danush

excellent progress! I can confirm that the SilvacoParser of the mesh converter tool is meant exactly for this purpose. If you still find where the “DF-ISE-only” was mentioned I’ll try to correct it!

All the best,

Hello @simonspa ,

Thank you for your confirmation.

I am able to recall two instances where I was thrown off (this is when I decided to obtain your confirmation on whether the SilvacoParser tool works or not):

  1. Section 14.2.1 of mentions that the tool only supports DF-ISE data formats.
  2. The readme page of the mesh_converter tool in Allpix2’s gitlab also mentions the same under the Input Data section.

Thank you!

Thanks for checking @danush - I fixed this here: Docs: add Silvaco parser to MeshConverter documentation (!1101) · Merge requests · Allpix Squared / Allpix Squared · GitLab

Thank you for quickly updating this @simonspa :slight_smile: