pyiron_atomistics.atomistics.structure.factories.atomsk.AtomskFactory

pyiron_atomistics.atomistics.structure.factories.atomsk.AtomskFactory#

class pyiron_atomistics.atomistics.structure.factories.atomsk.AtomskFactory[source]#

Bases: object

Wrapper around the atomsk CLI.

Use create() to create a new structure and modify() to pass an existing structure to atomsk. Both of them return a AtomskBuilder, which has methods named like the flags of atomsk. Calling them with the appropriate arguments adds the flags to the command line. Once you added all flags, call AtomskBuilder.build() to create the new structure. All methods to add flags return the AtomskBuilder instance they are called on to allow method chaining.

>>> from pyiron_atomistics import Project
>>> pr = Project('atomsk')
>>> pr.create.structure.atomsk.create("fcc", 3.6, "Cu").duplicate(2, 1, 1).build()
Cu: [0. 0. 0.]
Cu: [1.8 1.8 0. ]
Cu: [0.  1.8 1.8]
Cu: [1.8 0.  1.8]
Cu: [3.6 0.  0. ]
Cu: [5.4 1.8 0. ]
Cu: [3.6 1.8 1.8]
Cu: [5.4 0.  1.8]
pbc: [ True  True  True]
cell:
Cell([7.2, 3.6, 3.6])
>>> s = pr.create.structure.atomsk.create("fcc", 3.6, "Cu").duplicate(2, 1, 1).build()
>>> pr.create.structure.atomsk.modify(s).cell("add", 3, "x").build()
Cu: [0. 0. 0.]
Cu: [1.8 1.8 0. ]
Cu: [0.  1.8 1.8]
Cu: [1.8 0.  1.8]
Cu: [3.6 0.  0. ]
Cu: [5.4 1.8 0. ]
Cu: [3.6 1.8 1.8]
Cu: [5.4 0.  1.8]
pbc: [ True  True  True]
cell:
Cell([10.2, 3.6, 3.6])

Methods that you call on AtomskBuilder are automatically translated into options, translating ‘_’ in the method name to ‘-’ and appending all arguments as strings. All atomsk options are therefore supported, but no error checking is performed whether the translated options exist or follow the syntax prescribed by atomsk, except for special cases defined on the class.

__init__()#

Methods

__init__()

create(lattice, a, *species[, c, hkl])

Create a new structure with Atomsk.

modify(structure)

Modify existing structure with Atomsk.

create(lattice, a, *species, c=None, hkl=None)[source]#

Create a new structure with Atomsk.

See https://atomsk.univ-lille.fr/doc/en/mode_create.html for supported lattices.

Call AtomskBuilder.build() on the returned object to actually create a structure.

Parameters:
  • lattice (str) – lattice type to create

  • a (float) – first lattice parameter

  • *species (list of str) – chemical short symbols for the type of atoms to create, length depends on lattice type

  • c (float, optional) – third lattice parameter, only necessary for some lattice types

  • hkl (array of int, (3,3) or (3,4)) – three hkl vectors giving the crystallographic axes that should point along the x, y, z directions

Returns:

builder instances

Return type:

AtomskBuilder

modify(structure)[source]#

Modify existing structure with Atomsk.

Call AtomskBuilder.build() on the returned object to actually create a structure.

Parameters:

structure (Atoms) – input structure

Returns:

builder instances

Return type:

AtomskBuilder