Primitive crystal structure construction and symmetry analysis ============================================================== The :py:class:`~libcasm.xtal.Prim` class is used to represent a primitive crystal structure and allowed degrees of freedom (DoF). It specifies the: - lattice vectors - crystal basis sites - occupation DoF - continuous local (site) DoF - continuous global DoF The prim is the starting point for constructing a cluster expansion effective Hamiltonian. The allowed DoF determine which configurations are possible, and the symmetry of the prim determines the symmetry of the cluster basis functions. The :class:`~libcasm.xtal.Prim` class constructor documentation is :ref:`here `, and this section gives an introduction through examples. Occupation DoF -------------- The following is an example of prim construction, including atomic occupation DoF only: .. code-block:: Python import numpy as np import libcasm.xtal as xtal # Lattice vectors lattice_column_vector_matrix = np.array( [ [ 1.0, 0.0, 0.0], # a [ 0.0, 1.1, 0.0], # b [ 0.0, 0.0, 1.3], # c ] ).transpose() # <--- note transpose lattice = xtal.Lattice(lattice_column_vector_matrix) # Basis sites positions, as columns of a matrix, # in fractional coordinates with respect to the lattice vectors coordinate_frac = np.array( [ [0., 0., 0.], # coordinates of basis site, b=0 ] ).transpose() # <--- note transpose # Occupation degrees of freedom (DoF) occ_dof = [ ["A", "B"], # occupants allowed on basis site, b=0 ] return xtal.Prim( lattice=lattice, coordinate_frac=coordinate_frac, occ_dof=occ_dof, title="simple_cubic_binary", ) The parameter `lattice` gives the primitive cell Lattice. The parameter `coordinate_frac` gives basis site positions, as columns of a matrix, in fractional coordinates with respect to the lattice vectors. The parameter `occ_dof` gives labels of occupants allowed on each basis site. The value occ_dof[b] is the list of occupants allowed on the b-th basis site. The values may either be (i) the name of an isotropic atom (i.e. “Mg”) or vacancy (“Va”), or (ii) a key in the optional parameter, `occupants`, (see below). The names are case sensitive, and “Va” is reserved for vacancies. The optional parameter, `occupants`, is a dictionary containing :class:`~libcasm.xtal.Occupant` allowed in the crystal. The keys are labels used in the occ_dof parameter. This may include isotropic atoms, vacancies, atoms with fixed anisotropic properties, and molecular occupants. A seperate key and value is required for all species with distinct anisotropic properties (i.e. “H2_xy”, “H2_xz”, and “H2_yz” for distinct orientations, or “A.up”, and “A.down” for distinct collinear magnetic spins, etc.). See the CASM `Degrees of Freedom (DoF) and Properties`_ documentation for the full list of supported property types and their definitions. **Example: Isotropic atomic occupant** .. code-block:: Python A_occ = xtal.Occupant(name="A") Or, equivalently: .. code-block:: Python A_occ = xtal.make_atom("A") **Example: Vacancy occupant** .. code-block:: Python Va_occ = xtal.Occupant(name="Va") Or, equivalently: .. code-block:: Python Va_occ = xtal.make_vacancy() **Example: Atomic occupants with fixed collinear magnetic spin** The value "Cmagspin" is string indicating the CASM supported collinear magnetic spin property type. See the `Degrees of Freedom (DoF) and Properties`_ documentation for the full list of supported property types and their definitions. .. code-block:: Python A_up_occ = xtal.Occupant( name="A", # "chemical name" of occupant properties={ "Cmagspin": np.array([1.]) # fixed properties of the occupant }, ) A_down_occ = xtal.Occupant( name="A", # "chemical name" of occupant properties={ "Cmagspin": np.array([-1.]) # fixed properties of the occupant }, ) occupants = { "A.up": A_up_occ, #