Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table logger logs small positive values incorrectly #1542

Closed
Charlottez112 opened this issue Apr 28, 2023 · 0 comments · Fixed by #1617
Closed

Table logger logs small positive values incorrectly #1542

Charlottez112 opened this issue Apr 28, 2023 · 0 comments · Fixed by #1617
Labels
bug Something isn't working

Comments

@Charlottez112
Copy link
Contributor

Description

Table logger logs positive values that are very close to 0 as 0.000... instead of with scientific notation.

Script

# I found this bug when I was logging harmonic bond energy for calculating free energies with the Einstein molecule method. When the spring is set to a very small value, the harmonic bond energy is logged as 0.
# Below is the code only associated with creating the table logger

logger = hoomd.logging.Logger(categories=['scalar'])
logger.add(sim, quantities=['timestep'])
logger.add(thermodynamic_properties, quantities=['kinetic_temperature', 'pressure', 'volume', 'potential_energy'])
logger.add(potential, quantities=['energy'])
logger.add(harmonic, quantities=['energy'])
data_file = open(f'data.log', mode='w', newline='\n')
data_logger = hoomd.write.Table(output=data_file,
                                trigger=hoomd.trigger.Periodic(period=100, phase=0),
                                logger=logger,
                                header_sep='_',
                                delimiter='\t')
sim.operations.writers.append(data_logger)

sim.run(500)

Input files

No response

Output

# md_bond_Harmonic_energy
0.00000

Expected output

With a gsd logger, this value is around 2.3568318406061576e-14

Platform

GPU

Installation method

glotzerlab-software container

HOOMD-blue version

3.10.0

Python version

3.9.5

@Charlottez112 Charlottez112 added the bug Something isn't working label Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant