Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions gamd/GamdLogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class GamdLogger:

def __init__(self, filename, mode, integrator, simulation,
first_boost_type, first_boost_group,
second_boost_type, second_boost_group):
second_boost_type, second_boost_group, statistics_interval=500):
"""
Parameters
----------
Expand All @@ -95,13 +95,15 @@ def __init__(self, filename, mode, integrator, simulation,
:param first_boost_group: The group associated with the 1st boost type. Empty double quoted string for total.
:param second_boost_type: The simple boost type to record (no dual types)
:param second_boost_group: The group associated with the 2nd boost type. Empty double quoted string for total.
:param statistics_interval: The interval at which statistics are saved (default: 500)

"""

self.filename = filename
self.gamdLog = open(filename, mode)
self.integrator = integrator
self.simulation = simulation
self.statistics_interval = statistics_interval
self.tracked_values = []

if first_boost_type == BoostType.DUAL_TOTAL_DIHEDRAL or second_boost_type == BoostType.DUAL_TOTAL_DIHEDRAL:
Expand Down Expand Up @@ -146,7 +148,10 @@ def write_to_gamd_log(self, step):
first_effective_harmonic_constant = self.tracked_values[0].get_reporting_effective_harmonic_constant()
second_effective_harmonic_constant = self.tracked_values[1].get_reporting_effective_harmonic_constant()

self.gamdLog.write("\t" + str(1) + "\t" + str(step * 1) + "\t" +
# Calculate ntwx as the number of times statistics have been written
ntwx = step // self.statistics_interval

self.gamdLog.write("\t" + str(ntwx) + "\t" + str(step) + "\t" +
first_energy + "\t" +
second_energy + "\t" +
first_force_scaling_factor + "\t" +
Expand Down
6 changes: 4 additions & 2 deletions gamd/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ def register_gamd_logger(self, restart):
simulation, self.gamd_simulation.first_boost_type,
self.gamd_simulation.first_boost_group,
self.gamd_simulation.second_boost_type,
self.gamd_simulation.second_boost_group)
self.gamd_simulation.second_boost_group,
self.config.outputs.reporting.statistics_interval)
if not restart:
gamd_logger.write_header()
else:
Expand All @@ -337,7 +338,8 @@ def register_gamd_reweighting_logger(self, restart):
self.gamd_simulation.first_boost_type,
self.gamd_simulation.first_boost_group,
self.gamd_simulation.second_boost_type,
self.gamd_simulation.second_boost_group)
self.gamd_simulation.second_boost_group,
self.config.outputs.reporting.statistics_interval)
if not restart:
gamd_reweighting_logger.write_header()
else:
Expand Down