Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize atom cloud from an existing data #92

Open
YijunTangCambridge opened this issue Feb 1, 2024 · 6 comments
Open

Initialize atom cloud from an existing data #92

YijunTangCambridge opened this issue Feb 1, 2024 · 6 comments

Comments

@YijunTangCambridge
Copy link

Hi All, I am Yijun, a PhD student in AION cambridge. I am currently simulating dipole trap followed by transport, I wonder if there is already demo that I can start my transport simulation with atom cloud initialized with atoms at the end of a dipole trap simulation, so if I have a dipole trap data I can initialized my transport simulation with the end state of the dipole trap data. Basically initialize atom cloud with pos.txt and vel.txt output files?

@ElliotB256
Copy link
Collaborator

That's a good idea! I don't think there is at the moment, but it would be quite simple to ingest a file and populate the simulation from that. A straightforward way to do it would be to implement a txt file reader that provides an Iterator which goes through the entries. Then you could open the pos.txt file and the vel.txt file to get two iterators, zip these and enumerate through to allow you to create each atom (eg to add other components like mass which you might not have defined in the txt).

In future, once we merge in the bevy backend in place of specs, it should be possible to serialize the entire simulation state using the bevy_reflect crate. That would be especially cool because it would allow you to basically save a snapshot of a simulation at any point, and then freely resume it later, and using bevy_reflect means we don't need to make assumptions about object composition (it will automatically apply to any atom components using the Reflect trait, so not just position and velocity but also mass, laser cooling transitions, anything else attached to the entity).

@YijunTangCambridge
Copy link
Author

Thanks for speedy and high quality reply! The iterator idea is good to me, will try out today. I havn't heard of bevy_reflect stuff, sounds interesting :)

@ElliotB256
Copy link
Collaborator

How did you get on with the iterator approach?

@YijunTangCambridge
Copy link
Author

YijunTangCambridge commented Feb 22, 2024 via email

@ElliotB256
Copy link
Collaborator

That's great to hear! If you want to contribute the code, consider making a pull request and then we can merge it into atomECS

@YijunTangCambridge
Copy link
Author

YijunTangCambridge commented Feb 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants