amusecode / amuse

Astrophysical Multipurpose Software Environment. This is the main repository for AMUSE
http://www.amusecode.org
Apache License 2.0
155 stars 98 forks source link

make_secondaries #1009

Closed cconroy20 closed 10 months ago

cconroy20 commented 10 months ago

I'm trying to use make_secondaries in kira.py to generate a binary star population that I can insert into evolution_cluster.py. Everything is going ok except that the line: single_stars = center_of_masses-binaries results in the single_stars object having fewer attributes than the Particles() object, so that I can then not do: all_stars = single_stars + binaries the specific error message is: "Can't create new subset from particles belonging to separate particle sets. Try creating a superset instead."

how can I get single_stars above to have the same particle set? I'm surprised that it doesn't.

thanks!

spzwart commented 10 months ago

Dear Charlie,

It is not clear to my why you would like to do this. The routine def make_secondaries returns three particle sets. A list of single stars A list of binary members (also stars with the same properties of the single stars, except their coordinates are adjusted to make them binary members) A list of binary center of masses (which has a number of properties, different than stars, well they are different things).

Adding the single_stars with the binary_members I can imagine, but adding the single_stars with the binary_center_of_masses, I cannot.

Cheers, Simon

On Sat, Nov 25, 2023 at 10:19 PM Charlie Conroy @.***> wrote:

I'm trying to use make_secondaries in kira.py to generate a binary star population that I can insert into evolution_cluster.py. Everything is going ok except that the line: single_stars = center_of_masses-binaries results in the single_stars object having fewer attributes than the Particles() object, so that I can then not do: all_stars = single_stars + binaries the specific error message is: "Can't create new subset from particles belonging to separate particle sets. Try creating a superset instead."

how can I get single_stars above to have the same particle set? I'm surprised that it doesn't.

thanks!

— Reply to this email directly, view it on GitHub https://github.com/amusecode/amuse/issues/1009, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCPFTHPPVTS5N46RKVMPDTYGJOGDAVCNFSM6AAAAAA72LBWTWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYTANZZHE4DGMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

cconroy20 commented 10 months ago

Hi Simon,

Indeed, I am trying to do exactly what you suggest - adding the single_stars and the singles_in_binaries.

In make_secondaries I have added a single line: all_stars = single_stars + singles_in_binaries prior to the return statement, which throws the error mentioned above.

As far as I can tell, in evolution_cluster.py, at some point the number of attributes in the star_cluster particle object is increased, so that when I feed the star_cluster particles into make_secondaries, that object clashes with the newly formed singles_in_binaries object (the latter comes directly from the Particles datamodel).

the star_cluster object has several additional attributes not in the Particles data model, such as: add_indices_in_attribute_storage remove_indices_in_attribute_storage get_state_at_timestamp

Any thoughts on what could be going on here?

thanks Charlie

cconroy20 commented 10 months ago

I think I see part of what is going on:

the single_stars are defined in make_secondaries via: single_stars = center_of_masses-binaries (which is confusing terminology - the "center_of_masses" object is just the input list of particles to the program) and binaries is defined by: binaries = center_of_masses.random_sample(Nbin) now, for whatever reason, the number of attributes of center_of_masses and binaries is different (195 vs. 186). Something about the "random_sample" function seems to remove some of the attributes. When this occurs, the single_stars object inherits the fewer attributes in the operation above.

spzwart commented 10 months ago

I guess, I see what you mean, Charlie,

Try the following script, with and without "--add" as command line option. I replaced stars += other_stars with stars.add_particles(other_stars) Does this solve your problem?

Simon

On Sun, Nov 26, 2023 at 2:28 PM Charlie Conroy @.***> wrote:

Hi Simon,

Indeed, I am trying to do exactly what you suggest - adding the single_stars and the singles_in_binaries.

In make_secondaries I have added a single line: all_stars = single_stars + singles_in_binaries prior to the return statement, which throws the error mentioned above.

As far as I can tell, in evolution_cluster.py, at some point the number of attributes in the star_cluster particle object is increased, so that when I feed the star_cluster particles into make_secondaries, that object clashes with the newly formed singles_in_binaries object (the latter comes directly from the Particles datamodel).

the star_cluster object has several additional attributes not in the Particles data model, such as: add_indices_in_attribute_storage remove_indices_in_attribute_storage get_state_at_timestamp

Any thoughts on what could be going on here?

thanks Charlie

— Reply to this email directly, view it on GitHub https://github.com/amusecode/amuse/issues/1009#issuecomment-1826784810, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCPFTHW676OWYSBIV7NBWDYGM7WTAVCNFSM6AAAAAA72LBWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWG44DIOBRGA . You are receiving this because you commented.Message ID: @.***>

cconroy20 commented 10 months ago

yes that seems to work - thanks!

and wow: the code runs so much slower with binaries!

spzwart commented 10 months ago

Yes Charlie,

there is a good reason people try to run without them. so fat I know still only one paper with primotdial triples.... good luck, Simon

On Sun, Nov 26, 2023, 16:13 Charlie Conroy @.***> wrote:

yes that seems to work - thanks!

and wow: the code runs so much slower with binaries!

— Reply to this email directly, view it on GitHub https://github.com/amusecode/amuse/issues/1009#issuecomment-1826810003, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCPFTFWU6SDA2Q62BK6OH3YGNMAJAVCNFSM6AAAAAA72LBWTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWHAYTAMBQGM . You are receiving this because you commented.Message ID: @.***>