gflownet.envs.crystals.crystal
This implementation uses the Stack meta-environment and the continuous Lattice Parameters environment. Alternative implementations preceded this one but have been removed for simplicity. Check commit 9f3477d8e46c4624f9162d755663993b83196546 to see these changes or the history previous to that commit to consult previous implementations.
Classes
Module Contents
- class gflownet.envs.crystals.crystal.Crystal(do_spacegroup=True, do_lattice_parameters=True, do_projected_lattice_parameters=False, do_sg_before_composition=True, do_composition_to_sg_constraints=True, do_sg_to_composition_constraints=True, do_sg_to_lp_constraints=True, composition_kwargs=None, space_group_kwargs=None, lattice_parameters_kwargs=None, **kwargs)[source]
Bases:
gflownet.envs.composite.stack.Stack- Parameters:
subenvs (Sequence[GFlowNetEnv]) – A sequence containing the ordered list of the sub-environments to be stacked.
do_spacegroup (bool)
do_lattice_parameters (bool)
do_projected_lattice_parameters (bool)
do_sg_before_composition (bool)
do_composition_to_sg_constraints (bool)
do_sg_to_composition_constraints (bool)
do_sg_to_lp_constraints (bool)
composition_kwargs (Optional[Dict])
space_group_kwargs (Optional[Dict])
lattice_parameters_kwargs (Optional[Dict])
- property composition: gflownet.envs.crystals.composition.Composition[source]
Returns the sub-environment corresponding to the composition.
- Returns:
Composition or None
- Return type:
- property space_group: gflownet.envs.crystals.spacegroup.SpaceGroup[source]
Returns the sub-environment corresponding to the space group.
- Returns:
SpaceGroup or None
- Return type:
- property lattice_parameters: gflownet.envs.crystals.lattice_parameters.LatticeParameters | gflownet.envs.crystals.lattice_parameters.LatticeParametersSGCCG[source]
Returns the sub-environment corresponding to the lattice parameters.
- Returns:
LatticeParameters or None
- Return type:
Union[gflownet.envs.crystals.lattice_parameters.LatticeParameters, gflownet.envs.crystals.lattice_parameters.LatticeParametersSGCCG]
- states2proxy(states)[source]
Prepares a batch of states in environment format for the proxies.
The output is the concatenation of the proxy-format states of the sub-environments.
This method is overriden to improve the efficiency, to create a tensor as an output and to account for the space group before composition case, since the proxy expects composition first regardless.
- Parameters:
states (list) – A batch of states in environment format.
- Returns:
A tensor containing all the states in the batch.
- Return type:
torchtyping.TensorType[batch, state_oracle_dim]
- process_data_set(data, progress=False)[source]
Processes a data set passed as a pandas DataFrame or as a list of states by filtering out the states that are not valid according to the environment configuration.
If the input is a DataFrame, the rows are converted into environment states.
- Parameters:
data (DataFrame or list) –
- One of the following:
A pandas DataFrame containing the necessary columns to represent a crystal as described above.
A list of states in environment format.
progress (bool) – Whether to display a progress bar.
- Returns:
list – A list of states in environment format.
- Return type:
List[List]