ACEmd

ACEmd is molecular dynamics interface for Julia ACE. All MD use cases should use this package.

ACEmd is fully AtomsBase compatible and you should use AtomsBase over older JuLIP. You can still use JuLIP Atoms type as an input, while in a long run JuLIP will be decommissioned.

Example use case

using ACEmd # Reexports AtomsBase and Unitful
using ExtXYZ

# Load potential and atomic structure
fname_ace = joinpath(pkgdir(ACEmd), "data", "TiAl.json")
fname_xyz = joinpath(pkgdir(ACEmd), "data", "TiAl-big.xyz")

data = ExtXYZ.load(fname_xyz)
pot = load_ace_model(fname_ace)

# use ACE to calculate...
ace_energy(pot, data)
ace_forces(pot, data)
ace_virial(pot, data)
3×3 StaticArraysCore.SMatrix{3, 3, Quantity{Float64, 𝐋^2 𝐌 𝐓^-2, Unitful.FreeUnits{(eV,), 𝐋^2 𝐌 𝐓^-2, nothing}}, 9} with indices SOneTo(3)×SOneTo(3):
   2832.4 eV  -370.68 eV  -29.4763 eV
  -370.68 eV  3025.77 eV   107.811 eV
 -29.4763 eV  107.811 eV   2640.32 eV

Units

ACEmd supports Unitful and it is reexported by default.

Defaults units are

julia> ACEmd.default_energyeV
julia> ACEmd.default_lengthÅ

Units can be changes when loading potential

pot_ev = load_ace_model(fname_ace;
    energy_unit=u"eV",
    length_unit=u"Å",
    cutoff_unit=u"Å"
)

ace_energy(pot_ev, data)
-871121.5798250815 eV

Alternatively you can overload the default unit by giving it explicitly

julia> ace_energy(pot_ev, data; energy_unit=u"hartree")-871121.5798250815 Eₕ

Following units are taken into account

  • energy_unit defines the energy unit of the potential
  • length_unit defines the length unit for the potential
  • cutoff_unit defines unit for the cutoff that the potential is using

Energy of each atom

You can get ACE energy of each atom by

julia> ace_atom_energies(pot, data)1024-element Vector{Quantity{Float64, 𝐋^2 𝐌 𝐓^-2, Unitful.FreeUnits{(eV,), 𝐋^2 𝐌 𝐓^-2, nothing}}}:
  -1596.241529881289 eV
  -90.76669193128637 eV
  -1605.121814971094 eV
 -107.87242892588243 eV
 -1601.0892689442514 eV
  -96.13216662528322 eV
 -1592.6724838525176 eV
  -99.45655681883972 eV
 -1589.9271274402288 eV
 -111.54806148881212 eV
                      ⋮
 -105.39619732063056 eV
 -1593.3749030752117 eV
  -93.76209609252673 eV
 -1613.3745430266056 eV
 -100.62098464712287 eV
  -1591.967415066941 eV
  -102.4050737392281 eV
  -1594.066737897485 eV
  -99.32310132688248 eV

Index

ACEmd.ace_atom_energiesMethod
ace_atom_energies(potential, atoms; kwargs)

Calculates ACE potential energy for each atom. The atoms object needs to be in AtomsBase compatable format. The returned energy has a unit as defined by Unitful.

Parallel execution is done with Transducers.jl and there is an option to use different executors. Look for ThreadedEx or other executors for more details on how to control it.

Kwargs

  • domain=1:length(atoms) : choose subset of atoms to which energy is calculated
  • executor=ThreadedEx() : used to control multithreading using Transducers.jl
  • energy_unit : used to override energy unit for the calculation
  • length_unit : used to override lenght unit for the calculation
  • cutoff_unit : used to override unit that cutoff radius is defined
source
ACEmd.ace_energyMethod
ace_energy(potential, atoms, Kwargs)

Calculates ACE potential energy for atomic system. The atoms object needs to be in AtomsBase compatable format. The returned energy has a unit as defined by Unitful.

Parallel execution is done with Transducers.jl and there is an option to use different executors. Look for ThreadedEx or other executors for more details on how to control it.

Kwargs

  • domain=1:length(atoms) : choose subset of atoms to which energy is calculated
  • executor=ThreadedEx() : used to control multithreading using Transducers.jl
  • energy_unit : used to override energy unit for the calculation
  • length_unit : used to override lenght unit for the calculation
  • cutoff_unit : used to override unit that cutoff radius is defined
source
ACEmd.ace_forcesMethod
ace_forces(potential, atoms, Kwargs)

Calculates forces for ACE potential for given atomic system. The atoms object needs to be in AtomsBase compatable format. The returned energy has a unit as defined by Unitful.

Parallel execution is done with Transducers.jl and there is an option to use different executors. Look for ThreadedEx or other executors for more details on how to control it. ntasks parameter is used to define number of task that the calculation is divided into.

Kwargs

  • domain=1:length(atoms) : choose subset of atoms to which energy is calculated
  • executor=ThreadedEx() : used to control multithreading using Transducers.jl
  • ntasks=Threads.nthreads() : how many tasks are used in the calculation
  • energy_unit : used to override energy unit for the calculation
  • length_unit : used to override lenght unit for the calculation
  • cutoff_unit : used to override unit that cutoff radius is defined
source
ACEmd.ace_virialMethod
ace_virial(potential, atoms, Kwargs)

Calculates virial for ACE potential for given atomic system. The atoms object needs to be in AtomsBase compatable format. The returned energy has a unit as defined by Unitful.

Parallel execution is done with Transducers.jl and there is an option to use different executors. Look for ThreadedEx for more details on how to control it.

Kwargs

  • domain=1:length(atoms) : choose subset of atoms to which energy is calculated
  • executor=ThreadedEx() : used to control multithreading using Transducers.jl
  • energy_unit : used to override energy unit for the calculation
  • length_unit : used to override lenght unit for the calculation
  • cutoff_unit : used to override unit that cutoff radius is defined
source
ACEmd.load_ace_modelMethod
load_ace_model(fname::AbstractString; Kwargs)
load_ace_model(potential: Kwargs)

Used to load potential from json or yml files. By default this adds units for the potential. You can use Kwargs to control what units are used. The default units are defined in ACEmd.default_energy and ACEmd.default_length.

You can also use this to convert non unit holding potentials to potentials that have units. Like e.g. when you have fitted a new potential it does not have unit. You can then use this function to wrap units for it.

Kwargs

  • energy_unit=default_energy : energy unit for the potential
  • length_unit=default_length : lenght unit used for the force and atomic system
  • cutoff_unit=default_length : unit in which cuttoff radius has been defined
source
ACEmd.IPIprotocol.run_driverMethod
run_driver(address, potential, init_structure; port=31415, unixsocket=false )

Connect I-PI driver to server at given address. Use kword port (default 31415) to specify port. If kword unixsocket is true, address is understood to be the name of the socket and port option is ignored.

You need to give initial structure as I-PI protocol does not transfer atom symbols. This means that, if you want to change the number of atoms or their symbols, you need to lauch a new driver.

source