Utils¶
-
twod_materials.utils.
add_vacuum
(delta, cut=0.9)[source]¶ Adds vacuum to a POSCAR.
Parameters: - delta (float) – vacuum thickness in Angstroms
- cut (delta) – fractional height above which atoms will need to be fixed. Defaults to 0.9.
-
twod_materials.utils.
align_c_axis_along_001
(structure)[source]¶ Given a structure with a c-axis not along [001], returns the same structure rotated so that the c-axis is along the [001] direction. This is useful for vasp compiled with no z-axis relaxation.
Parameters: structure (structure) – Pymatgen Structure object to rotate. Returns: structure. Rotated to align c-axis along [001].
-
twod_materials.utils.
get_magmom_string
()[source]¶ Based on a POSCAR, returns the string required for the MAGMOM setting in the INCAR. Initializes transition metals with 6.0 bohr magneton and all others with 0.5.
Returns: string. e.g. ‘1*6.0 3*0.5’
-
twod_materials.utils.
get_markovian_path
(points)[source]¶ Calculates the shortest path connecting an array of 2D points.
Parameters: points (list) – list/array of points of the format [[x_1, y_1, z_1], [x_2, y_2, z_2], ...] Returns: A sorted list of the points in order on the markovian path.
-
twod_materials.utils.
get_rotation_matrix
(axis, theta)[source]¶ Find the rotation matrix associated with counterclockwise rotation about the given axis by theta radians. Credit: http://stackoverflow.com/users/190597/unutbu
Parameters: Returns: array. Rotation matrix.
-
twod_materials.utils.
get_spacing
(filename=u'POSCAR', cut=0.9)[source]¶ Returns the interlayer spacing for a 2D material.
Parameters: Returns: float. Spacing in Angstroms.
-
twod_materials.utils.
get_status
(directory)[source]¶ Return the state of job in a directory. Designed for use on Slurm systems.
Parameters: directory (str) – absolute path to the directory to check. Returns: - string version of SLURM job status.
- ‘None’ = No running job in this directory
-
twod_materials.utils.
get_structure_type
(structure, write_poscar_from_cluster=False)[source]¶ This is a topology-scaling algorithm used to describe the periodicity of bonded clusters in a bulk structure.
Parameters: - structure (structure) – Pymatgen structure object to classify.
- write_poscar_from_cluster (bool) – Set to True to write a POSCAR from the sites in the cluster.
Returns: - string. ‘molecular’ (0D), ‘chain’, ‘layered’, ‘heterogeneous’
(intercalated 3D), or ‘conventional’ (3D)
-
twod_materials.utils.
is_converged
(directory)[source]¶ Check if a relaxation has converged.
Parameters: directory (str) – path to directory to check. Returns: boolean. Whether or not the job is converged.
-
twod_materials.utils.
remove_z_kpoints
()[source]¶ Strips all linemode k-points from the KPOINTS file that include a z-component, since these are not relevant for 2D materials.
-
twod_materials.utils.
write_circle_mesh_kpoints
(center=[0, 0, 0], radius=0.1, resolution=20)[source]¶ Create a circular mesh of k-points centered around a specific k-point and write it to the KPOINTS file. Non-circular meshes are not supported, but shouldn’t be too hard to code. All k-point weights are 1.
Parameters:
-
twod_materials.utils.
write_pbs_runjob
(name, nnodes, nprocessors, pmem, walltime, binary)[source]¶ writes a runjob based on a name, nnodes, nprocessors, walltime, and binary. Designed for runjobs on the Hennig group_list on HiperGator 1 (PBS).
Parameters:
-
twod_materials.utils.
write_potcar
(pot_path='/path/to/POTCAR/files', types=u'None')[source]¶ Writes a POTCAR file based on a list of types.
Parameters: - pot_path (str) – can be changed to override default location of POTCAR files.
- types (list) – list of same length as number of elements containing specifications for the kind of potential desired for each element. If left as ‘None’, uses the defaults in the ‘potcar_symbols.yaml’ file in the package root.