thermo
#
Train against thermodynamic properties.
Modules:
-
descent
–descent
Classes:
-
DataEntry
–Represents a single experimental data point.
-
SimulationKey
–A key used to identify a simulation.
-
SimulationConfig
–Configuration for a simulation to run.
Functions:
-
create_dataset
–Create a dataset from a list of existing data points.
-
create_from_evaluator
–Create a dataset from an evaluator PhysicalPropertyDataSet
-
extract_smiles
–Return a list of unique SMILES strings in the dataset.
-
default_config
–Return a default simulation configuration for the specified phase.
-
predict
–Predict the properties in a dataset using molecular simulation, or by reweighting
-
default_closure
–Return a default closure function for training against thermodynamic
DataEntry
#
Bases: TypedDict
Represents a single experimental data point.
Attributes:
-
type
(DataType
) –The type of data point.
-
smiles_a
(str
) –The SMILES definition of the first component.
-
x_a
(float | None
) –The mole fraction of the first component. This must be set to 1.0 if the data
-
smiles_b
(str | None
) –The SMILES definition of the second component if present.
-
x_b
(float | None
) –The mole fraction of the second component if present.
-
temperature
(float
) –The temperature at which the data point was measured.
-
pressure
(float
) –The pressure at which the data point was measured.
-
value
(float
) –The value of the data point.
-
std
(float | None
) –The standard deviation of the data point if available.
-
units
(str
) –The units of the data point.
-
source
(str
) –The source of the data point.
SimulationKey
#
Bases: NamedTuple
A key used to identify a simulation.
Attributes:
-
smiles
(tuple[str, ...]
) –The SMILES definitions of the components present in the system.
-
counts
(tuple[int, ...]
) –The number of copies of each component present in the system.
-
temperature
(float
) –The temperature [K] at which the simulation was run.
-
pressure
(float | None
) –The pressure [atm] at which the simulation was run.
smiles
instance-attribute
#
The SMILES definitions of the components present in the system.
counts
instance-attribute
#
The number of copies of each component present in the system.
temperature
instance-attribute
#
The temperature [K] at which the simulation was run.
pressure
instance-attribute
#
The pressure [atm] at which the simulation was run.
SimulationConfig
pydantic-model
#
Bases: BaseModel
Configuration for a simulation to run.
Fields:
-
max_mols
(int
) -
gen_coords
(GenerateCoordsConfig
) -
apply_hmr
(bool
) -
equilibrate
(list[MinimizationConfig | SimulationConfig]
) -
production
(SimulationConfig
) -
production_frequency
(int
)
gen_coords
pydantic-field
#
gen_coords: GenerateCoordsConfig
Configuration for generating initial coordinates.
equilibrate
pydantic-field
#
equilibrate: list[MinimizationConfig | SimulationConfig]
Configuration for equilibration simulations.
production
pydantic-field
#
Configuration for the production simulation.
production_frequency
pydantic-field
#
The frequency at which to write frames during production.
create_dataset
#
create_dataset(*rows: DataEntry) -> Dataset
Create a dataset from a list of existing data points.
Parameters:
-
rows
(DataEntry
, default:()
) –The data points to create the dataset from.
Returns:
-
Dataset
–The created dataset.
Source code in descent/targets/thermo.py
create_from_evaluator
#
Create a dataset from an evaluator PhysicalPropertyDataSet
Parameters:
-
dataset_file
(Path
) –The path to the evaluator dataset
Returns:
-
Dataset
–The created dataset
Source code in descent/targets/thermo.py
extract_smiles
#
Return a list of unique SMILES strings in the dataset.
Parameters:
-
dataset
(Dataset
) –The dataset to extract the SMILES strings from.
Returns:
-
list[str]
–The unique SMILES strings with full atom mapping.
Source code in descent/targets/thermo.py
default_config
#
default_config(
phase: Phase, temperature: float, pressure: float | None
) -> SimulationConfig
Return a default simulation configuration for the specified phase.
Parameters:
-
phase
(Phase
) –The phase to return the default configuration for.
-
temperature
(float
) –The temperature [K] at which to run the simulation.
-
pressure
(float | None
) –The pressure [atm] at which to run the simulation.
Returns:
-
SimulationConfig
–The default simulation configuration.
Source code in descent/targets/thermo.py
predict
#
predict(
dataset: Dataset,
force_field: TensorForceField,
topologies: dict[str, TensorTopology],
output_dir: Path,
cached_dir: Path | None = None,
per_type_scales: dict[DataType, float] | None = None,
verbose: bool = False,
) -> tuple[Tensor, Tensor, Tensor, Tensor]
Predict the properties in a dataset using molecular simulation, or by reweighting previous simulation data.
Parameters:
-
dataset
(Dataset
) –The dataset to predict the properties of.
-
force_field
(TensorForceField
) –The force field to use.
-
topologies
(dict[str, TensorTopology]
) –The topologies of the molecules present in the dataset, with keys of mapped SMILES patterns.
-
output_dir
(Path
) –The directory to write the simulation trajectories to.
-
cached_dir
(Path | None
, default:None
) –The (optional) directory to read cached simulation trajectories from.
-
per_type_scales
(dict[DataType, float] | None
, default:None
) –The scale factor to apply to each data type. A default of 1.0 will be used for any data type not specified.
-
verbose
(bool
, default:False
) –Whether to log additional information.
Source code in descent/targets/thermo.py
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 |
|
default_closure
#
default_closure(
trainable: Trainable,
topologies: dict[str, TensorTopology],
dataset: Dataset,
per_type_scales: dict[DataType, float] | None = None,
verbose: bool = False,
) -> ClosureFn
Return a default closure function for training against thermodynamic properties.
Parameters:
-
trainable
(Trainable
) –The wrapper around trainable parameters.
-
topologies
(dict[str, TensorTopology]
) –The topologies of the molecules present in the dataset, with keys of mapped SMILES patterns.
-
dataset
(Dataset
) –The dataset to train against.
-
per_type_scales
(dict[DataType, float] | None
, default:None
) –The scale factor to apply to each data type.
-
verbose
(bool
, default:False
) –Whether to log additional information about predictions.
Returns:
-
ClosureFn
–The default closure function.