amusecode / amuse

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

Mercury crashes after commit_parameters() is called #95

Closed jilkoval closed 7 years ago

jilkoval commented 7 years ago

A minimal example:

from amuse.units import units
from amuse.ext.solarsystem import new_solar_system
from amuse.community.mercury.interface import Mercury

solar_system = new_solar_system()

mercury = Mercury()
mercury.particles.add_particles(solar_system)
mercury.commit_particles()
mercury.parameters.info_file = "m_info_file.out"
mercury.parameters.timestep = (1.|units.day)
mercury.commit_parameters()

mercury.evolve_model(1.|units.yr)
mercury.stop()

with an error message Exception: While calling commit_parameters of Mercury: No transition from current state state 'CHANGE_PARAMETERS_RUN' to state 'INITIALIZED' possible.

ipelupessy commented 7 years ago

this is not (necessiraly) an error; if you remove the commit_ statements the state will be handled by the code and everything works (they should not be necessary). if you do call a commit_particles then there is an implicit commit_parameters and the following call should be a recommit_parameters. you can check the call seq. by putting at the start of your script:

import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("code").setLevel(logging.DEBUG)
jilkoval commented 7 years ago

Ah, I see. Indeed, it works just fine after removing commit statements or with calling only one (after all parameters and particles are set).

Thanks for the clarification!