TeamAtomECS / AtomECS

Cold atom simulation code
GNU General Public License v3.0
46 stars 12 forks source link

Initialize atom cloud from an existing data #92

Open YijunTangCambridge opened 10 months ago

YijunTangCambridge commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 9 months ago

How did you get on with the iterator approach?

YijunTangCambridge commented 9 months ago

Hi Elliot, it is successfully implemented and I am using that now on my laptop :)

Get Outlook for iOShttps://aka.ms/o0ukef


From: ElliotB256 @.> Sent: Thursday, February 22, 2024 10:47:14 PM To: TeamAtomECS/AtomECS @.> Cc: Yijun Tang @.>; Author @.> Subject: Re: [TeamAtomECS/AtomECS] Initialize atom cloud from an existing data (Issue #92)

How did you get on with the iterator approach?

— Reply to this email directly, view it on GitHubhttps://github.com/TeamAtomECS/AtomECS/issues/92#issuecomment-1960459938, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFZBSCS7NXBBVM4TZJEHVNDYU7DHFAVCNFSM6AAAAABCU2BQ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRQGQ2TSOJTHA. You are receiving this because you authored the thread.Message ID: @.***>

ElliotB256 commented 9 months ago

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 commented 9 months ago

That sounds good, I will discuss with Tiffany about how to do that :)

Get Outlook for iOShttps://aka.ms/o0ukef


From: ElliotB256 @.> Sent: Thursday, February 22, 2024 10:55:23 PM To: TeamAtomECS/AtomECS @.> Cc: Yijun Tang @.>; Author @.> Subject: Re: [TeamAtomECS/AtomECS] Initialize atom cloud from an existing data (Issue #92)

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

— Reply to this email directly, view it on GitHubhttps://github.com/TeamAtomECS/AtomECS/issues/92#issuecomment-1960470974, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFZBSCSRFFTII5KOEODBLCDYU7EFXAVCNFSM6AAAAABCU2BQ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRQGQ3TAOJXGQ. You are receiving this because you authored the thread.Message ID: @.***>