ExaDisNet Class

Description

ExaDisNet from pyexadis_base is the base class used in the OpenDiS python interface of ExaDiS to represent the dislocation network. ExaDisNet is a wrapper class around the internal data structure representation of the dislocation network in ExaDiS, which internally handles memory movements between the different execution spaces (e.g. CPU to GPU).

An ExaDisNet network can be instantiated in several ways. The native way is to provide a cell, an array of nodes, and an array of segments as arguments:

G = ExaDisNet(cell, nodes, segs)

with

  • cell: pyexadis.Cell object defining the simulation cell. Constructor arguments:

    • h (required): simulation cell matrix (columns are the cell vectors)

    • origin (optional): cell origin. Default: (0,0,0)

    • is_periodic (optional): periodic flag along the three dimensions. Default: [true,true,true].

  • nodes: array of nodes where each row contains a node attributes.

    • Attributes for all nodes must be of the following formats:

      • x, y, z

      • x, y, z, constraint

      • domain_id, local_id, x, y, z

      • domain_id, local_id, x, y, z, constraint

    • where x, y, z are the nodes coordinates, constraint is the node constraint (pyexadis_base.NodeConstraints.UNCONSTRAINED or pyexadis_base.NodeConstraints.PINNED_NODE), domain_id is the simulation domain index, local_id is the local index of the node in the domain.

  • segs: array of segments defining the directed dislocation graph.

    • Segments must be defined only once, e.g. if a segment from node i to node j is defined, then the segment from node j to node i must not be defined.

    • Attributes of the segments must be of the following formats:

      • n1, n2, bx, by, bz

      • n1, n2, bx, by, bz, nx, ny, nz

    • where n1, n2 are the end nodes indices (index in the nodes array), bx, by, bz are components of the Burgers vector when going from node n1 to node n2, nx, ny, nz are components of the segment slip plane normal.

Note that all lengths (e.g. cell size, nodes coordinates, Burgers vectors) are defined in units of global parameter burgmag. Burgers vectors and plane normals are defined in the global frame of the simulation.

For instance, we can define a dislocation line of length 100b along [1,0,0] lying on plane [0,1,0] and discretized with 3 nodes:

Ldis = 100.0
Lbox = 2*Ldis
cell = pyexadis.Cell(h=Lbox*np.eye(3), origin=-0.5*Lbox*np.ones(3))
nodes = np.array([[-0.5*Ldis, 0.0, 0.0, NodeConstraints.PINNED_NODE],
                  [ 0.0*Ldis, 0.0, 0.0, NodeConstraints.UNCONSTRAINED],
                  [ 0.5*Ldis, 0.0, 0.0, NodeConstraints.PINNED_NODE]])
segs = np.array([[0, 1, b[0], b[1], b[2], 0.0, 1.0, 0.0],
                 [1, 2, b[0], b[1], b[2], 0.0, 1.0, 0.0]])
G = ExaDisNet(cell, nodes, segs)

Some utility functions are also provided in file python/pyexadis_utils.py to generate basic dislocation graphs (Frank-Read source, infinite lines, etc.). See Creating initial dislocation configurations for more information.

Another convenient method is to initialize a ExaDisNet object by reading a dislocation network in legacy ParaDiS format from file using built-in method read_paradis():

G = ExaDisNet().read_paradis('config.data')

A dislocation network defined in a ExaDisNet object must be wrapped into a DisNetManager object before it can be used within modules, e.g.

G = ExaDisNet(...)
N = DisNetManager(G)

Attributes and Methods

class pyexadis_base.ExaDisNet(DisNet_Base)

Wrapper class for pyexadis dislocation network. Provides basic functions to manipulate the network. The underlying dislocation network object is stored in attribute net.

Attributes

net: pyexadis.ExaDisNet

Get the pointer to the ExaDiS network binding object

property cell

Get the simulation cell.

Return type:

pyexadis.Cell

Constructor

__init__(*args)

Construct ExaDisNet object by instantiating the net attribute.

  • If 3 arguments: cell, nodes, segs

Parameters:
  • cell – pyexadis.Cell object

  • nodes – node array

  • segs – segment array

  • If 1 argument: net

Parameters:

net – pyexadis.ExaDisNet object

  • If 0 arguments:

Creates empty pyexadis.ExaDisNet

Raises:

ValueError – if number of arguments is invalid

Import/Export methods

import_data(data)

Import network data from a dictionary. Argument data must be the output of an export_data() method.

Parameters:

data – Dictionary with keys “cell”, “nodes”, “segs”

Returns:

self

export_data()

Export network data as a dictionary.

Returns:

Dictionary with keys “cell”, “nodes”, “segs”

read_paradis(datafile)

Read network from a Paradis-format data file.

Parameters:

datafile – Path to data file (str)

Returns:

self

read_data(datafile)

Alias for read_paradis().

write_data(datafile)

Write network to a Paradis-format data file.

Parameters:

datafile – Path to data file (str)

Generation methods

generate_prismatic_config(crystal, Lbox, num_loops, radius, maxseg=-1, Rorient=None, seed=1234, uniform=False)

Generate a prismatic loop configuration.

Parameters:
  • crystal – Crystal object

  • Lbox – Box dimensions or cell object

  • num_loops – Number of loops (int)

  • radius – Loop radius (float)

  • maxseg – Maximum segment size (int, default -1)

  • Rorient – Orientation matrix (optional)

  • seed – RNG seed (int, default 1234)

  • uniform – Uniform distribution (bool, default False)

Returns:

self

generate_line_config(crystal, Lbox, num_lines, theta=None, maxseg=-1, Rorient=None, seed=-1, verbose=True)

Generate a line configuration.

Parameters:
  • crystal – Crystal object

  • Lbox – Box dimensions or cell object

  • num_lines – Number of lines (int)

  • theta – Line character angle (optional)

  • maxseg – Maximum segment size (int, default -1)

  • Rorient – Orientation matrix (optional)

  • seed – RNG seed (int, default -1)

  • verbose – Print info (bool, default True)

Returns:

self

Network information and access methods

num_nodes()

Number of nodes in the network.

Return type:

int

num_segments()

Number of segments in the network.

Return type:

int

is_sane()

Check network sanity.

Return type:

bool

get_segs_data()

Get segment data as a dictionary.

Returns:

Dictionary with keys “nodeids”, “burgers”, “planes”

get_nodes_data()

Get node data as a dictionary.

Returns:

Dictionary with keys “tags”, “positions”, “constraints”

get_tags()

Get node tags (domain,index).

Return type:

ndarray, size=(num_nodes,2)

get_positions()

Get node positions.

Return type:

ndarray, size=(num_nodes,3)

get_forces()

Get node forces.

Return type:

ndarray, size=(num_nodes,3)

get_velocities()

Get node velocities.

Return type:

ndarray, size=(num_nodes,3)

set_positions(pos)

Set node positions.

Parameters:

pos – ndarray of positions, size=(num_nodes,3)