npl.monte_carlo.ensembles package
Submodules
npl.monte_carlo.ensembles.base_ensemble module
- class npl.monte_carlo.ensembles.base_ensemble.BaseEnsemble(atoms: Atoms, calculator: Calculator, user_tag: str | None = None, random_seed: int | None = None, traj_file: str = 'traj_test.traj', trajectory_write_interval: int | None = None, outfile: str = 'outfile.out', outfile_write_interval: int = 10)[source]
Bases:
ABC- property atoms: Atoms
Current configuration (copy).
- initialize_outfile() None[source]
Initializes the output file by overwriting any existing content and writing a header.
- property step: int
Current trial step counter.
npl.monte_carlo.ensembles.canonical_ensemble module
- class npl.monte_carlo.ensembles.canonical_ensemble.CanonicalEnsemble(atoms, calculator, random_seed=None, optimizer=None, fmax=0.1, temperature=300, op_list=None, constraints=None, p=1, traj_file: str = 'traj_test.traj', outfile: str = 'outfile.out', outfile_write_interval: int = 10)[source]
Bases:
BaseEnsembleRepresents a canonical ensemble for Monte Carlo simulations.
- Args:
atoms (Atoms): The initial atomic configuration. calculator (Calculator): The calculator used to compute energies and forces. random_seed (int, optional): The random seed for the PRNG. Defaults to None. optimizer (Optimizer, optional): The optimizer used for relaxation. Defaults to None. fmax (float, optional): The maximum force tolerance for relaxation. Defaults to 0.1. temperature (float, optional): The temperature of the ensemble in Kelvin. Defaults to 300. steps (int, optional): The number of Monte Carlo steps to perform. Defaults to 100. op_list (OperatorList, optional): The list of operators for mutations. Defaults to None. constraints (Constraints, optional): The constraints applied to the system. Defaults to None. traj_file (str, optional): The trajectory file name. Defaults to ‘traj_test.traj’. outfile (str, optional): The output file name. Defaults to ‘outfile.out’. outfile_write_interval (int, optional): The interval at which to write to the output file. Defaults to 10.
- Attributes:
lowest_energy (float): The lowest potential energy found during the simulation. atoms (Atoms): The current atomic configuration. constraints (Constraints): The constraints applied to the system. _temperature (float): The temperature of the ensemble in Kelvin. _calculator (Calculator): The calculator used to compute energies and forces. _optimizer (Optimizer): The optimizer used for relaxation. _fmax (float): The maximum force tolerance for relaxation. _steps (int): The number of Monte Carlo steps to perform. _op_list (OperatorList): The list of operators for mutations. _step (int): The current step number. _accepted_trials (int): The number of accepted trials.
- do_mutation()[source]
Performs mutations on the current atomic configuration.
- Returns:
Atoms: The mutated atomic configuration.