openPMD / openPMD-api

:floppy_disk: C++ & Python API for Scientific I/O
https://openpmd-api.readthedocs.io
GNU Lesser General Public License v3.0
138 stars 51 forks source link

loading particles from openpmd #1623

Closed rl3418 closed 4 months ago

rl3418 commented 4 months ago

I am trying to load particles from an openpmd file. I got an error message saying that key 'positionOffset' does not exist (read-only).

Pull #3810 (https://github.com/ECP-WarpX/WarpX/pull/3810) mentioned something about adding the quantity positionOffset, but there is nothing in the documentation for input parameters. It would be great if I could get an example script to generate the input openpmd file for particle initialisation.

franzpoeschel commented 4 months ago

I got an error message saying that key 'positionOffset' does not exist (read-only).

This sounds like the issue is likely not your script, but instead that the dataset you use is incomplete and does not define the positionOffset. Can you verify this? Apart from this, the general idea is: real_position_x = position_x * position_x_unit_SI + positionOffset_x * positionOffset_x_unit_SI.

rl3418 commented 4 months ago

I was not sure about the structure of the positionOffset parameter. I found something under pull #3810. I am testing that out now.

rl3418 commented 4 months ago

Just realised that I posted this question under the wrong repository. I am trying to write an input file for WarpX. It can recognize the positionOffset parameter now. It is also requesting for the particle weight. I guess it is dimensionless. Not sure how to specify the unit and dimension for the weight. I guess I will check with the WarpX team.

In terms of the use of openpmd I have got everything I need. Thanks for the help.