Skip to content

Cannot write RST7 file after GCMC — coordinates exceed Amber format width #25

Description

@MartinFuentetaja

Description

When running OpenBPMD with the --gcmc flag, the pipeline crashes with an OSError when attempting to save the post-GCMC system as an Amber RST7 file via sire.

The error occurs at:

sr.save(mols, os.path.join(out_dir, f"sd_{lig}_final.rst7"))

I have checked that mols = sr.load(input.rst7, input.prmtop) returns Periodic Boundary Box. I wish someone could give me insight why this is happening.

Root Cause

The Amber RST7 format stores coordinates as fixed-width fields of 12 characters with 7 decimal places (AmberFormat( 6 x float[width = 12, precision = 7] )). This format can only represent values in the range (-1000, 10000) Å — values ≤ −1000 Å require a 13-character field and cannot be written.

After GCMC sampling, a subset of water molecules are displaced outside the periodic box, resulting in wrapped coordinates with values such as -1153.06, -1249.21, etc. These out-of-box coordinates trigger the format overflow.

Example errors from the traceback:

Could not write the float at index 7340, value '-1153.06' into the specified format
AmberFormat( 6 x float[width = 12, precision = 7] )

Traceback

OSError: SireError::io_error: Cannot write the files as the following errors occurred:
Failed to write '/scratch/.../sd_JI1_final.rst7' using the parser for fileformat 'RST7'.
Errors converting the system to Amber Rst7 format...
Could not write the float at index 7340, value '-1153.06' into AmberFormat( 6 x float[width = 12, precision = 7] ).
[... 29 further instances of the same error ...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions