mofbuilder.md.ForceFieldMapper#

class mofbuilder.md.ForceFieldMapper(comm=None, ostream=None)[source]#

Bases: object

Mapping utility for transferring GROMACS forcefield sections between isomorphic molecules.

Parameters:
  • comm (Any)

  • ostream (veloxchem.outputstream.OutputStream | None)

comm#

MPI communicator (defaults to MPI.COMM_WORLD).

Type:

Any

rank#

MPI process rank.

Type:

int

nodes#

Number of MPI processes.

Type:

int

ostream#

Output stream for logging.

Type:

OutputStream

src_molecule_forcefield_itpfile#

Path to source molecule itp file.

Type:

Optional[str]

src_molecule#

Source/reference molecule.

Type:

Optional[Molecule]

dest_molecule_forcefield_itpfile#

Optional itp for destination.

Type:

Optional[str]

dest_molecule#

Target molecule after remapping.

Type:

Optional[Molecule]

target_directory#

Output directory.

Type:

Optional[str]

save_files#

Whether to write files.

Type:

bool

_debug#

Enable debug output.

Type:

bool

dest_molecule_connectivity_matrix#

For alternate connectivity in destination molecule.

Type:

Optional[np.ndarray]

_get_mapping_between_two_molecules()[source]#

Atom index mapping between two isomorphic molecules.

_parse_itp_file()[source]#

Read .itp file and split into sections.

_format_*

Format forcefield sections (atoms, bonds, angles, etc.) using index mapping and new labels.

_map_forcefield_sections()[source]#

Map/convert all supported forcefield sections from source to destination mapping.

write_mapped_itp_file()[source]#

Write mapped sections to output .itp file.

Parameters:
  • mapped_sections (Dict[str, List[str]])

  • output_itpfile (str | Path)

Return type:

None

write_mapped_itp_file(mapped_sections, output_itpfile)[source]#

Writes a mapped .itp file from provided section line mappings.

Parameters:
  • mapped_sections (Dict[str, List[str]]) – Section lines by section name.

  • output_itpfile (Union[str, Path]) – Destination path (.itp).

Returns:

None

Return type:

None