Skip to content

Integer values in pmb.df become float when reading a pyMBE dataframe from file #102

@pm-blanco

Description

@pm-blanco

This becomes an issue when restarting simulations that have been set up with pyMBE since it breaks the setup of the reaction methods, which cannot be checkpointed with the current funtionalities in ESPResSo.

Here a minimal working example that shows this issue:

import pyMBE

# Create an instance of pyMBE library
pmb = pyMBE.pymbe_library(seed=42)

# Acidic particle
pmb.define_particle(
    name = "A",
    acidity = "basic",
    pka = 4,
    sigma = 1*pmb.units('reduced_length'),
    epsilon = 1*pmb.units('reduced_energy'))

pmb.define_particle(
    name = "C",
    z = 1,
    sigma = 1*pmb.units('reduced_length'),
    epsilon = 1*pmb.units('reduced_energy'))

# Save the pyMBE dataframe in a CSV file
pmb.write_pmb_df(filename='df.csv')

# Here all  charge numbers and espresso types are integers
print(pmb.df)

# Read the pyMBE dataframe 
pmb.read_pmb_df(filename='df.csv')

# Here some of the charge numbers and espresso types are float
print(pmb.df)

# This breaks the setup of the reaction methods
pmb.setup_cpH(counter_ion="C", constant_pH=2)

@paobtorres do you want to take care of solving this?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions