Post

BatchMC

An introduction to the functions in /BatchMC

BatchMC

MMC

(

iter_scheme: Literal['Gaussian', 'Cauchy', 'Uniform'] = Gaussian

maxiter: <class 'int'> = 100

temperature_init: <class 'float'> = 1000.0

temperature_scheme: Literal['constant', 'linear', 'exponential', 'log', 'fast'] = constant

temperature_update_freq: <class 'int'> = 1

temperature_scheme_param: float | None = None

coordinate_update_param: <class 'float'> = 0.2

device: str | torch.device = cpu

verbose: <class 'int'> = 2

)

initialize_algo_param

(

)

run

(

func: Any | torch.nn.modules.module.Module

X: <class 'torch.Tensor'>

func_args: Sequence = ()

func_kwargs: Optional[Dict] = None

fixed_atom_tensor: Optional[torch.Tensor] = None

batch_indices: Union[NoneType, List[int], Tuple[int, ...], torch.Tensor] = None

)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    Run MC Algorithm.

    Parameters:
        func: the main function of instantiated torch.nn.Module class.
        X: Tensor[n_batch, n_atom, 3], the atom coordinates that input to func.
        func_args: optional, other input of func.
        func_kwargs: optional, other input of func.
        fixed_atom_tensor: Optional[th.Tensor], the indices of X that fixed.
        batch_indices: Sequence | th.Tensor | np.ndarray | None, the split points for given X, Element_list & V_init, must be 1D integer array_like.
            the format of batch_indices is same as `split_size_or_sections` in torch.split:
            batch_indices = (n1, n2, ..., nN) will split X, Element_list & V_init into N parts, and ith parts has ni atoms. sum(n1, ..., nN) = X.shape[1]

    Return:
        min func: Tensor(n_batch, ), the minimum of func.
        argmin func: Tensor(X.shape), the X corresponds to min func.
        grad of argmin func: Tensor(X.shape), only output when `output_grad` == True. The gradient of X corresponding to minimum.
This post is licensed under CC BY 4.0 by the author.