dpdata.abacus package

Submodules

dpdata.abacus.md module

dpdata.abacus.md.get_coord_dump_freq(inlines)[source]
dpdata.abacus.md.get_coords_from_dump(dumplines, natoms)[source]
dpdata.abacus.md.get_energy(outlines, ndump, dump_freq)[source]
dpdata.abacus.md.get_frame(fname)[source]
dpdata.abacus.md.get_path_out(fname, inlines)[source]

dpdata.abacus.relax module

dpdata.abacus.relax.get_coords_from_log(loglines, natoms)[source]

NOTICE: unit of coords and cells is Angstrom order:

coordinate cell (no output if cell is not changed) energy (no output, if SCF is not converged) force (no output, if cal_force is not setted or abnormal ending) stress (no output, if set cal_stress is not setted or abnormal ending).

dpdata.abacus.relax.get_frame(fname)[source]
dpdata.abacus.relax.get_log_file(fname, inlines)[source]

dpdata.abacus.scf module

dpdata.abacus.scf.CheckFile(ifile)[source]
dpdata.abacus.scf.collect_force(outlines)[source]
dpdata.abacus.scf.collect_stress(outlines)[source]
dpdata.abacus.scf.get_block(lines, keyword, skip=0, nlines=None)[source]
dpdata.abacus.scf.get_cell(geometry_inlines)[source]
dpdata.abacus.scf.get_coords(celldm, cell, geometry_inlines, inlines=None)[source]
dpdata.abacus.scf.get_energy(outlines)[source]
dpdata.abacus.scf.get_force(outlines, natoms)[source]
dpdata.abacus.scf.get_frame(fname)[source]
dpdata.abacus.scf.get_frame_from_stru(fname)[source]
dpdata.abacus.scf.get_geometry_in(fname, inlines)[source]
dpdata.abacus.scf.get_mag_force(outlines)[source]

Read atomic magmom and magnetic force from OUT.ABACUS/running_scf.log.

Returns:
magmom: list of list of atomic magnetic moments (three dimensions: ION_STEP * NATOMS * 1/3)
magforce: list of list of atomic magnetic forces (three dimensions: ION_STEP * NATOMS * 1/3)
e.g.:
Total Magnetism (uB)

Fe 0.0000000001 0.0000000000 3.0000000307 Fe -0.0000000000 -0.0000000000 3.0000001151

Magnetic force (eV/uB)

Fe 0.0000000000 0.0000000000 -1.2117698671 Fe 0.0000000000 0.0000000000 -1.2117928796

dpdata.abacus.scf.get_nele_from_stru(geometry_inlines)[source]
dpdata.abacus.scf.get_path_out(fname, inlines)[source]
dpdata.abacus.scf.get_stress(outlines)[source]
dpdata.abacus.scf.get_stru_block(lines, keyword)[source]
dpdata.abacus.scf.make_unlabeled_stru(data, frame_idx, pp_file=None, numerical_orbital=None, numerical_descriptor=None, mass=None, move=None, velocity=None, mag=None, angle1=None, angle2=None, sc=None, lambda_=None, link_file=False, dest_dir=None, **kwargs)[source]

Make an unlabeled STRU file from a dictionary.

Parameters:
datadict

System data

frame_idxint

The index of the frame to dump

pp_filelist of string or dict, optional

List of pseudo potential files, or a dictionary of pseudo potential files for each atomnames

numerical_orbitallist of string or dict, optional

List of orbital files, or a dictionary of orbital files for each atomnames

numerical_descriptorstr, optional

numerical descriptor file

masslist of float, optional

List of atomic masses

movelist of list of bool, optional

List of the move flag of each xyz direction of each atom

velocitylist of list of float, optional

List of the velocity of each xyz direction of each atom

maglist of (list of float or float), optional

List of the magnetic moment of each atom, can be a list of three floats or one float For noncollinear, three floats are the xyz component of the magnetic moment. For collinear, one float is the norm of the magnetic moment.

angle1list of float, optional

List of the angle1 of each atom. For noncollinear calculation, it is the angle between the magnetic moment and the z-axis.

angle2list of float, optional

List of the angle2 of each atom. For noncollinear calculation, it is the angle between the projection of magnetic moment on xy plane and the x-axis.

sclist of (bool or list of 3 bool), optional

List of the spin constraint flag of each atom. Each element can be a bool or a list of three bools or None.

lambda_list of (float or list of 3 float), optional

List of the lambda of each atom. Each element can be a float or a list of three floats.

link_filebool, optional

Whether to link the pseudo potential files and orbital files in the STRU file. If True, then only filename will be written in the STRU file, and make a soft link to the real file.

For velocity, mag, angle1, angle2, sc, and lambda_, if the value is None, then the corresponding information will not be written.
ABACUS support defining “mag” and “angle1”/”angle2” at the same time, and in this case, the “mag” only define the norm of the magnetic moment, and “angle1” and “angle2” define the direction of the magnetic moment.
If data has spins, then it will be written as mag to STRU file; while if mag is passed at the same time, then mag will be used.
dpdata.abacus.scf.parse_stru_pos(pos_line)[source]

Parses a line from the atom position block in a structure file.

The content in atom position block can include: - m or NO key word: Three numbers (0 or 1) controlling atom movement in geometry relaxation calculations. - v, vel, or velocity: Three components of initial velocity of atoms in geometry relaxation calculations. - mag or magmom: Start magnetization for each atom. Can be one number (colinear) or three numbers (non-colinear). - angle1: In non-colinear case, angle between c-axis and real spin (in degrees). - angle2: In non-colinear case, angle between a-axis and real spin projection in ab-plane (in degrees). - cs or constrain: Three numbers (0 or 1) controlling the spin constraint of the atom. - lambda: Three numbers controlling the lambda of the atom.

Parameters:
pos_lineA line from the atom position block.
Returns:
tuple: A tuple containing:
  • pos (list of float): The position coordinates.

  • move (list of int or None): Movement control values.

  • velocity (list of float or None): Initial velocity components.

  • magmom (float, list of float, or None): Magnetization values.

  • angle1 (float or None): Angle1 value.

  • angle2 (float or None): Angle2 value.

  • constrain (list of bool or None): Spin constraint values.

  • lambda1 (float, list of float, or None): Lambda values.

e.g.: ` Fe 1.0 2 0.0 0.0 0.0 m 0 0 0 mag 1.0 angle1 90 angle2 0 cs 0 0 0 0.5 0.5 0.5 m 1 1 1 mag 1.0 angle1 90 angle2 180 `