Ignore:
Timestamp:
Aug 30, 2025, 2:41:40 PM (2 months ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
72b6d7
Parents:
476781
git-author:
Frederik Heber <frederik.heber@…> (08/15/25 21:55:25)
git-committer:
Frederik Heber <frederik.heber@…> (08/30/25 14:41:40)
Message:

FIX: deserialized EmpiricalPotential lacked parameters.

  • with the change to particletypes in c986207a, we switched from overriding the default potential to creating a new instance (which is then registered). However, we did not deserialize the parameters into the newly, to be registered instance but only in a copy of the default with correct particle types. This is fixed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/StreamFactory_EmpiricalPotential.cpp

    r476781 r5a255af  
    4949    std::istream &serialized) const
    5050{
    51   EmpiricalPotential * full_potential;
     51  EmpiricalPotential * full_potential = NULL;
    5252  // now stream in types and parameters
    5353  try {
     54        // first, deserialize into a default potential for the correct particle types
    5455    EmpiricalPotential * const potential = getDefaultPotential(potentialtype);
    5556    potential->stream_from(serialized);
    56     // also need to generate the binding model
     57    // then create a proper instance which also has the correct BindingModel
    5758    full_potential = createInstance(potentialtype, potential->getParticleTypes());
     59    // finally, serialize&deserialize parameters from default into the full instance
     60    std::stringstream parameter_stream;
     61    potential->stream_to(parameter_stream);
     62    full_potential->stream_from(parameter_stream);
     63    LOG(3, "Deserialized full potential: " << *full_potential);
    5864    delete potential;
    5965  } catch (SerializerMissingValueException &e) {
Note: See TracChangeset for help on using the changeset viewer.