You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
The BGF files generated by screampp's current writer (core::io::bgf.rs) cannot be correctly parsed by some standard molecular modeling software, notably VMD and MPSim. While PyMOL can open the files and display bonds correctly, VMD fails to render any bonds, and MPSim reports Bonds: 0 during energy calculations, leading to extremely high, non-physical energies due to the lack of bonded topology.
This issue stems from the format of the CONECT records. The current implementation uses an "edge list" approach:
Logic: It iterates through the system's list of unique bonds.
Output: For each bond (atom1, atom2), it writes a single line: CONECT <serial1> <serial2>.
Result: This format is logically correct and non-redundant but fails to meet the expectations of stricter, often older, BGF parsers.
Investigation using the fix_atom_ordering utility and analysis of VMD/MPSim behavior reveals that these programs expect an "adjacency list" format for CONECT records:
Expected Logic: The file should be written by iterating through each atom.
Expected Output: For each atom A, a single CONECT line should be generated that lists all of A's bonded neighbors: CONECT <serial_A> <neighbor1> <neighbor2> ....
Compatibility: This format, while containing redundant information (each bond is described twice), is explicitly what these parsers are designed to read.
Failing to provide this format causes the parsers to miss most, if not all, of the bonding information, effectively treating the system as a collection of disconnected atoms.
Tasks:
Modify the core::io::bgf::write_to function in bgf.rs.
Instead of iterating through the system.bonds() list directly for output, first build an intermediate adjacency list data structure. A BTreeMap<usize, Vec<usize>> is suitable, mapping each atom's new serial number to a list of its neighbors' serial numbers.
Iterate through the newly created adjacency list.
For each atom (i.e., each key in the map), write a single CONECT record line starting with the atom's serial number, followed by the serial numbers of all its neighbors.
Ensure the output format for each serial number is right-aligned with a width of 6 characters (e.g., {:>6}) to strictly adhere to the BGF fixed-width standard.
Add logic to handle cases where an atom has more neighbors than can fit on a single CONECT line (e.g., >12) by chunking them into multiple lines for that atom.
Description:
The BGF files generated by
screampp's current writer (core::io::bgf.rs) cannot be correctly parsed by some standard molecular modeling software, notably VMD and MPSim. While PyMOL can open the files and display bonds correctly, VMD fails to render any bonds, and MPSim reportsBonds: 0during energy calculations, leading to extremely high, non-physical energies due to the lack of bonded topology.This issue stems from the format of the
CONECTrecords. The current implementation uses an "edge list" approach:(atom1, atom2), it writes a single line:CONECT <serial1> <serial2>.Investigation using the
fix_atom_orderingutility and analysis of VMD/MPSim behavior reveals that these programs expect an "adjacency list" format forCONECTrecords:A, a singleCONECTline should be generated that lists all ofA's bonded neighbors:CONECT <serial_A> <neighbor1> <neighbor2> ....Failing to provide this format causes the parsers to miss most, if not all, of the bonding information, effectively treating the system as a collection of disconnected atoms.
Tasks:
core::io::bgf::write_tofunction inbgf.rs.system.bonds()list directly for output, first build an intermediate adjacency list data structure. ABTreeMap<usize, Vec<usize>>is suitable, mapping each atom's new serial number to a list of its neighbors' serial numbers.CONECTrecord line starting with the atom's serial number, followed by the serial numbers of all its neighbors.{:>6}) to strictly adhere to the BGF fixed-width standard.CONECTline (e.g., >12) by chunking them into multiple lines for that atom.