xnn.ffnn.models.ffield.to_forcefield#

xnn.ffnn.models.ffield.to_forcefield(lib, name=None, version='1.0', reference_text='')[source]#

Write a classical FFieldLibrary as an in-memory .frc file.

The inverse of from_forcefield(): the standard blocks become the #reaxff_* sections (value columns in SEAMM’s alphabetical order, as SEAMM itself writes them), plus a #define and #metadata.

Parameters:
  • lib (FFieldLibrary) – The library; must be classical (not lib.is_nn).

  • name (str, optional) – The #define name; default "reaxff/<lib.name>".

  • version (str, optional) – Version stamp of every row and the #reference 1 text.

  • reference_text (str, optional) – Version stamp of every row and the #reference 1 text.

Returns:

Save it with .write(path).

Return type:

xnn.ffnn.common.frc.FrcFile

Raises:

ValueError – For a ReaxFF-nn library (network weights cannot be expressed in the format; use FFieldLibrary.save()).