pablo-arantes / making-it-rain

Cloud-based molecular simulations for everyone
MIT License
377 stars 97 forks source link

checkpoint frequency is "savcrd_freq" ? #96

Closed nyubachi closed 4 months ago

nyubachi commented 6 months ago

Hello,

I salute you all for your excellent efforts.

On a very minor point, for example, in the file "Protein_ligand.ipynb", in "Runs a Production MD simulation (NPT ensemble) after equilibration", the following code

print("\nSave coordinates each " + str(savcrd_freq))
print("\tSave checkpoint each " + str(savcrd_freq))
print("Print to log file " + str(print_freq))

I was a little concerned that the checkpoint frequency is "savcrd_freq". This may need to be corrected, as I feel that checkpoints are actually created for each stride.

Best regards,

nyubachi

pablo-arantes commented 4 months ago

Hi @nyubachi,

Sorry for the delay. I've reviewed the code and confirmed that the checkpoint is being saved correctly.

    ##################################
    # Writing last frame information of stride
    print("\n> Writing state file (" + str(rst_file) + ")...")
    state = simulation.context.getState( getPositions=True, getVelocities=True )
    with open(rst_file, 'w') as f:
        f.write(XmlSerializer.serialize(state))

    last_frame = int(nsteps/nsavcrd)
    print("> Writing coordinate file (" + str(pdb_file) + ", frame = " + str(last_frame) + ")...")
    positions = simulation.context.getState(getPositions=True).getPositions()
    PDBFile.writeFile(simulation.topology, positions, open(pdb_file, 'w'))

print("\n> Finished!\n")

The main correction was made to the log statements to ensure the right message about file saving is provided to the user. I've applied the changes to the file

Thank you.