mesh_logging
- class LogMolecule(max_molecule_resolution: int = 10, max_isosurface_resolution: float = 0.2, basis_transformation: str | Callable | None = 'auto', log_initial_guess: bool = True, log_gradient: bool = True, log_random_basis_functions: bool = False, **super_kwargs)[source]
Logs the molecule to tensorboard as a mesh.
- __init__(max_molecule_resolution: int = 10, max_isosurface_resolution: float = 0.2, basis_transformation: str | Callable | None = 'auto', log_initial_guess: bool = True, log_gradient: bool = True, log_random_basis_functions: bool = False, **super_kwargs) None[source]
- Parameters:
max_molecule_resolution – The maximum “resolution” of the sticks representation of the molecule.
max_isosurface_resolution – The maximum grid resolution used to compute the isosurface, in Bohr.
basis_transformation – The basis transformation to be applied to the molecule. Can be either
None, ‘auto’, or a callable, e.g. a value ofBASIS_TRANSFORMATIONS. If ‘auto’, the basis transformation is chosen based on the label_subdir of the datamodule.Nonemeans no transformation is applied. Defaults to ‘auto’.log_initial_guess – Whether to log the initial guess. Defaults to True.
log_gradient – Whether to log the gradient. Defaults to True.
log_random_basis_functions – Whether to log some random basis functions. Defaults to False. See
LogMolecule.get_mesh_kwargs()for details.**super_kwargs – Keyword arguments passed to
OnStepCallbackWithTiming.
- execute(trainer: Trainer, pl_module: MLDFTLitModule, outputs: Tensor | Mapping[str, Any] | None, batch: Any, split: str) None[source]
Logs a mesh to tensorboard at the end of a training batch, if the timing matches.
- get_mesh_kwargs(trainer: Trainer, pl_module: MLDFTLitModule, batch: Any, outputs: Tensor | Mapping[str, Any] | None, basis_info: BasisInfo) dict[source]
Create a dictionary of meshes to be logged.
- Parameters:
trainer – The lightning trainer.
pl_module – The lightning module.
batch – The batch.
outputs – The outputs of the lightning module.
basis_info – The
BasisInfoobject.
- Returns:
A dict of dicts where each value is a dict with arguments to
SummaryWriter.add_mesh.- Return type:
dict