Calc Manager

CalcManager

class mlacs.calc.CalcManager(calc, magmoms=None, folder='Calc', **kwargs)

Parent Class managing the true potential being simulated. This Calc class can support any ase.calculator calculators from the ASE python package. Create, execute and read the output of any ASE supported calculators.

Parameters:
  • calc (ase.calculator) – An ASE calculator object

  • magmoms (np.ndarray (optional)) – An array for the initial magnetic moments for each computation If None, no initial magnetization. (Non magnetic calculation) Default None.

  • folder (str (optional)) – The root for the directory in which the computation are to be done Default ‘Calc’

compute_true_potential(confs, subfolder=None, step=None)

Compute the energy/forces/stress of given input configurations with an ASE calculator.

Parameters:
  • confs (list of ase.Atoms) – The input list of atom objects.

  • subfolder (list of str (optional)) – Subfolder in which the properties are saved.

  • step (list of int (optional)) – The list of configuration indices.

Returns:

result_confs – The output list of atom objects, with corresponding SinglePointCalculator resulting from true potential calculation.

Return type:

list of ase.Atoms

AbinitManager

class mlacs.calc.AbinitManager(parameters, pseudos, abinit_cmd='abinit', mpi_runner='mpirun', magmoms=None, folder='DFT', logfile='abinit.log', errfile='abinit.err', nproc=1, nproc_per_task=None, **kwargs)

This Calc class is an extended object for Abinit calculators. The AbinitManager can handdle netCDF files, MPI processes and a better pseudopotentials files management.

Parameters:
  • parameters (dict) – Dictionnary of abinit input

  • pseudos (dict) – Dictionnary for the pseudopotentials {‘O’: /path/to/pseudo}

  • abinit_cmd (str) – The command to execute the abinit binary.

  • mpi_runner (str) – The command to call MPI. I assume the number of processor is specified using -n argument Default mpirun

  • magmoms (np.ndarray (optional)) – An array for the initial magnetic moments for each computation If None, no initial magnetization. (Non magnetic calculation) Default None.

  • folder (str (optional)) – The root for the directory in which the computation are to be done Default ‘DFT’

  • logfile (str (optional)) – The name of the Abinit log file inside the workdir folder Default ‘abinit.log’

  • errfile (str (optional)) – The name of the Abinit error file inside the workdir folder Default ‘abinit.err’

  • nproc (int (optional)) – Number of processor available for all Abinit.

  • nproc_per_task (int (optional)) – Number of processor available for all Abinit. Default nproc

Examples

>>> from mlacs.calc import AbinitManager
>>> variables = dict(ixc=-1012, ecut=12, tsmear=0.001, occopt=3, nband=82,
>>>                  ngkpt=[2, 2, 2], shiftk=[0.5, 0.5, 0.5],
>>>                  autoparall=1, nsym=1) # Cu, 8 atoms.
>>> pseudos = {'Cu': "/path/to/pseudo/Cu.LDA_PW-JTH.xml"}
>>> calc = AbinitManager(parameters=variables, pseudos=pseudos)
compute_true_potential(*args, **kwargs)

Compute the energy/forces/stress of given input configurations with an ASE calculator.

Parameters:
  • confs (list of ase.Atoms) – The input list of atom objects.

  • subfolder (list of str (optional)) – Subfolder in which the properties are saved.

  • step (list of int (optional)) – The list of configuration indices.

Returns:

result_confs – The output list of atom objects, with corresponding SinglePointCalculator resulting from true potential calculation.

Return type:

list of ase.Atoms

DlmCalcManager

class mlacs.calc.DlmCalcManager(calc, unitcell, supercell, magnetic_sites, mu_b=1.0, cutoffs=[6.0, 4.0], n_steps=3000, **kwargs)

Class for Disorder Local Moment simulation.

Disorder Local Moment is a method to simulate an antiferromagnetic material by imposing periodically a random spin configuration by means of Special Quasirandom Structures.

Parameters:
  • calc (ase.calculator) – A ASE calculator object.

  • unitcell (ase.atoms) – The Atoms object for the unitcell, for which the symmetry will be used to create the magnetic sqs.

  • supercell (ase.atoms) – The supercell with ideal positions

  • magnetic_sites (list) – List of integers describing the unitcell sites where the magnetic atoms are located

  • mu_b (float) – The initial spin amplitude, imposed before the calculation, in Bohr magneton. Default 1.0.

  • cutoff (list of float) – The cutoffs for the SQS generation. See icet documentation for more information. Default [6.0, 4.0].

  • n_steps (int (optional)) – Number of Monte-Carlo steps for the generation of the magnetic SQS. Default 3000.

compute_true_potential(confs, state=None, step=None)

Compute the energy of given configurations with an ASE calculator, using a random spin configuration from the SQS.

DatabaseCalc

class mlacs.calc.DatabaseCalc(trajfile, trainfile, magmoms=None, **kwargs)

Calculators that sequentially reads a previously calculated traj files. Normal utilisator want to set OtfMlacs.nstep to len(traj). Can be used with restart to append trajfile to the current traj.

Parameters:
  • calc (ase.calculator) – A ASE calculator object

  • trajfile (str or pathlib.Path) – The trajectory file from which DatabaseCalc will read

  • trainfile (str, pathlib.Path,) – The training.traj file, configuration used for fitting but not counted for thermodynamic properties

  • magmoms (np.ndarray (optional)) – An array for the initial magnetic moments for each computation If None, no initial magnetization. (Non magnetic calculation) Default None.

compute_true_potential(mlip_confs, state=None, step=None)

Return the energy of given configurations contained in the Trajectory file. This is a way to replay a previously done MLACS simulations.