gvasp.common package

gvasp.common.base module

class gvasp.common.base.Atom(*args, **kwargs)[source]

Bases: object

Atom class represent one atom in periodic solid system

formula

chemical formula

Type:

str

number

atomic number

Type:

int

period

atomic period in element period table

Type:

int

group

atomic group in element period table

Type:

int

color

atomic color using RGB

Type:

str

order

atomic order in <Structure class>, default: 0

Type:

int

frac_coord

fractional coordinates

Type:

np.ndarray

cart_coord

cartesian coordinates

Type:

np.ndarray

_default_bonds

atomic default bond property {atom: bond-length}

atom_type(self) property

register atom_type property

set_coord(self, lattice

Lattice) -> object: recalculate frac_coord from cart_coord / recalculate cart_coord from frac_coord

search_image(atom_i, atom_j) np.ndarray[source]

search the nearest image in which have minimum distance between two atoms

__load_config(cls)

load element.yaml file

__initialize_attrs(self)

initialize the attributes from the element.yaml

property atom_type

register atom_type property

static distance(atom_i, atom_j, lattice: Lattice)[source]
static search_image(atom_i, atom_j) ndarray[source]

search the nearest image in which have minimum distance between two atoms

Parameters:
  • atom_i (Atom) – Atom instance

  • atom_j (Atom) – Atom instance

Returns:

record the transform direction

Return type:

image (np.ndarray)

set_coord(lattice: Lattice)[source]

recalculate frac_coord from cart_coord / recalculate cart_coord from frac_coord

Parameters:

lattice (Lattice) – Lattice instance

class gvasp.common.base.Atoms(*args, **kwargs)[source]

Bases: Atom

Atoms class represent atom set in periodic solid system

@property

formula: chemical formula, <list> number: atomic number, <list> period: atomic period in element period table, <list> group: atomic group in element period table, <list> color: atomic color using RGB, <list> order: atomic order in <Structure class>, default: <list(range(len(formula)))> frac_coord: fractional coordinates, <list> cart_coord: cartesian coordinates, <list> _default_bonds: atomic default bond property {atom: bond-length}

count: total atom number in atom set size: list atom number according to their formula

@func

__initialize_attrs: initialize the attributes from the element.yaml from_list: construct the <class Atoms> from an Atom list, i.e., [Atom, Atom, Atom] –> Atoms

property atom_list
property atom_type

register atom_type property

property count: int
property elements
static from_list(atoms: list)[source]
perturb(lattice: Lattice, threshold=0.1, groups=9)[source]

Perturb the atoms’ coords

@params:

lattice: Lattice type threshold: max offset of atom groups: how many groups you want to get

set_coord(lattice: Lattice)[source]

recalculate frac_coord from cart_coord / recalculate cart_coord from frac_coord

Parameters:

lattice (Lattice) – Lattice instance

property size
class gvasp.common.base.Lattice(matrix: ndarray)[source]

Bases: object

property angle: ndarray

Calculate the lattice angle

Returns:

store the angle, shape = (3x1)

Return type:

angle (np.ndarray)

static arc_lattice(lattice)[source]

Construct a Arc Lattice instance from lattice

Parameters:

lattice (Lattice) – Lattice instance

Returns:

Lattice instance

Return type:

arc lattice (Lattice)

static from_POSCAR(name)[source]

Construct a Lattice instance from POSCAR file

Parameters:

name ([str, Path]) – path of POSCAR

Returns:

Lattice instance

Return type:

lattice (Lattice)

static from_string(string)[source]

Construct a Lattice instance from string

Parameters:

string (List[str]) –

three-line <string>

>>> string
array([[  7.707464,  0.000000,  0.000000],
         -3.853732,  6.674860,  0.000000],
          0.000000,  0.000000, 28.319031]])

Returns:

Lattice instance

Return type:

lattice (Lattice)

property inverse: ndarray

Calculate the inverse matrix of lattice

Returns:

store the inverse matrix

Return type:

inverse (np.ndarray)

property length: ndarray

Calculate the lattice length

Returns:

store the length, shape = (3x1)

Return type:

length (np.ndarray)

property strings: str

Transform a Lattice instance to string

Returns:

Lattice instance in string format

Return type:

strings (str)

property volume: float

Calculate the lattice volume

Returns:

store the volume

Return type:

volume (float)

gvasp.common.descriptor module

class gvasp.common.descriptor.Descriptor(*args, **kwargs)[source]

Bases: object

Base Descriptor, <get, set, del> method of each param is unlimited

class gvasp.common.descriptor.IntegerLeftDescriptor(*args, **kwargs)[source]

Bases: ValueDescriptor

IntegerLeft Descriptor, limit param’s value

class gvasp.common.descriptor.IntegerLeftRealRightDescriptor(*args, **kwargs)[source]

Bases: IntegerLeftDescriptor

IntegerLeftRealRight Descriptor, limit param’s value

class gvasp.common.descriptor.TypeDescriptor(*args, **kwargs)[source]

Bases: Descriptor

Type Descriptor, limit param’s type

class gvasp.common.descriptor.TypeListDescriptor(*args, **kwargs)[source]

Bases: Descriptor

TypeList Descriptor, limit param’s type

class gvasp.common.descriptor.TypeListValueDescriptor(*args, **kwargs)[source]

Bases: TypeListDescriptor, ValueDescriptor

class gvasp.common.descriptor.TypeValueDescriptor(*args, **kwargs)[source]

Bases: TypeDescriptor, ValueDescriptor

class gvasp.common.descriptor.ValueDescriptor(*args, **kwargs)[source]

Bases: Descriptor

Value Descriptor, limit param’s value

gvasp.common.error module

exception gvasp.common.error.AnimationError[source]

Bases: RuntimeError

exception gvasp.common.error.ArgsNotRegisteredError[source]

Bases: TypeError

exception gvasp.common.error.AttributeNotAssignedError[source]

Bases: AttributeError

exception gvasp.common.error.AttributeNotRegisteredError[source]

Bases: AttributeError

exception gvasp.common.error.ConstrainError[source]

Bases: TypeError

exception gvasp.common.error.FrequencyError[source]

Bases: IndexError

exception gvasp.common.error.GridNotEqualError[source]

Bases: ValueError

exception gvasp.common.error.JsonFileNotFoundError[source]

Bases: FileNotFoundError

exception gvasp.common.error.ParameterError[source]

Bases: TypeError

exception gvasp.common.error.PathNotExistError[source]

Bases: TypeError

exception gvasp.common.error.PotDirNotExistError[source]

Bases: FileExistsError

exception gvasp.common.error.StructureNotEqualError[source]

Bases: ValueError

exception gvasp.common.error.StructureOverlapError[source]

Bases: ValueError

exception gvasp.common.error.TooManyXSDFileError[source]

Bases: FileExistsError

exception gvasp.common.error.XSDFileNotFoundError[source]

Bases: FileNotFoundError

gvasp.common.figure module

class gvasp.common.figure.DashLine(*args, **kwargs)[source]

Bases: LineBase

Dash Line class, subclass of LineBase

class gvasp.common.figure.Figure(*args, **kwargs)[source]

Bases: object

Plot-type class’ parent, unify the figure format

lloc

Value Descriptor, limit param’s value

static save(name='figure.svg')[source]
static show()[source]
class gvasp.common.figure.LineBase(*args, **kwargs)[source]

Bases: object

Line-Base-class, cant’ instantiated

plot()[source]
class gvasp.common.figure.PchipLine(*args, **kwargs)[source]

Bases: LineBase

static interpolate(x_ori, y_ori, num)[source]
class gvasp.common.figure.SolidLine(*args, **kwargs)[source]

Bases: LineBase

Solid Line class, subclass of LineBase

class gvasp.common.figure.Text(figure, x, y, s, color, fontsize=18)[source]

Bases: object

Add text on the figure, for PlotPES.

param:

figure: Figure instance x: bi-tuple, specify which x-range to add text y: bi-tuple, specify which y-range to add text; text: content

check_overlap()[source]

check the text overlap

main idea:
  1. tailor box along the line

  2. if not, tailor the box vertically, then loop

tailor_text()[source]
gvasp.common.figure.plot_wrapper(func)[source]

gvasp.common.file module

class gvasp.common.file.ACFFile(*args, **kwargs)[source]

Bases: MetaFile

class gvasp.common.file.AECCAR0(*args, **kwargs)[source]

Bases: CHGBase

class gvasp.common.file.AECCAR2(*args, **kwargs)[source]

Bases: CHGBase

class gvasp.common.file.ARCFile(*args, **kwargs)[source]

Bases: MetaFile

static write(name: str, structure: List[Structure], lattice: Lattice)[source]
class gvasp.common.file.CHGBase(*args, **kwargs)[source]

Bases: StructInfoFile

Subclass of StructInfoFile, inherit <structure property>

load()[source]

load Electronic-Density

@return:

self.density: shape=(NGX, NGY, NGZ)

write(title=None, factor=1.0)[source]

write CHGCAR_* file from array

@param:

system: specify the structure system factor: coordination factor

class gvasp.common.file.CHGCAR(*args, **kwargs)[source]

Bases: StructInfoFile

load()[source]

load Electronic-Density

@return:

self.NGrid: NGX * NGY * NGZ self.density: shape=(NGX, NGY, NGZ) self._density_strings: density with strings format

split()[source]

split CHGCAR to CHGCAR_tot && CHGCAR_mag

class gvasp.common.file.CHGCAR_diff(*args, **kwargs)[source]

Bases: CHGBase

line_potential(direction='z')[source]

Calculate Charge Density Difference along one direction, default: z-axis

Parameters:

direction (str) – which axis you want to Average the CCD

Returns:

]): CCD along one axis

Return type:

line_potential (np.array[

class gvasp.common.file.CHGCAR_mag(*args, **kwargs)[source]

Bases: CHGBase

static to_grd(name='vasp.grd', DenCut=-1)[source]

transform CHGCAR_mag to grd file

param:

name: specify the name of grd file DenCut: density lower than DenCut will be set to zero (default: -1: disable the DenCut option)

class gvasp.common.file.CHGCAR_sum(*args, **kwargs)[source]

Bases: CHGBase

static from_array(name: str, structure, NGrid: tuple[int, int, int], density)[source]
property structure
class gvasp.common.file.CHGCAR_tot(*args, **kwargs)[source]

Bases: CHGBase

class gvasp.common.file.CONTCAR(*args, **kwargs)[source]

Bases: POSCAR

class gvasp.common.file.CellFile(*args, **kwargs)[source]

Bases: StructInfoFile

property structure
to_POSCAR()[source]
class gvasp.common.file.DOSCAR(*args, **kwargs)[source]

Bases: MetaFile

ISPIN

Value Descriptor, limit param’s value

LORBIT

Value Descriptor, limit param’s value

load()[source]
class gvasp.common.file.EIGENVAL(*args, **kwargs)[source]

Bases: MetaFile

write(directory='band_data')[source]

Write band-data to file, each band corresponding to one file and named as band_{index}

@params:

dir: save directory, default: $CWD/band_data

class gvasp.common.file.Fort188File(*args, **kwargs)[source]

Bases: MetaFile

property constrain
write(name='fort.188')[source]
class gvasp.common.file.INCAR(*args, **kwargs)[source]

Bases: MetaFile, Parameter

write(name)[source]

Write interface, callback every _write* func

class gvasp.common.file.KPOINTS(*args, **kwargs)[source]

Bases: MetaFile

static from_strings(strings)[source]
static min_number(structure: Structure, length=20.0)[source]
write(name)[source]
class gvasp.common.file.LOCPOT(*args, **kwargs)[source]

Bases: StructInfoFile

line_potential(direction='z')[source]

Calculate the electrostatic potential along one direction, default: z-axis

Parameters:

direction (str) – which axis you want to calculate the electrostatic potential

Returns:

]): electrostatic potential along one axis

Return type:

line_potential (np.array[

load()[source]

load Electrostatic Potential

Returns:

value = NGX * NGY * NGZ self.potential (np.array[:, :, :]): record the electrostatic potential self.lattice (Lattice): <Lattice class> instance

Return type:

self.NGrid (int)

class gvasp.common.file.MODECAR(*args, **kwargs)[source]

Bases: MetaFile

static write_from_POSCAR(pos1: str, pos2: str)[source]

Generate MODECAR file from the two POSCAR file

@param:

pos1: name of first POSCAR file pos2: name of second POSCAR file

static write_from_freq(freq: int, scale: float, outcar='OUTCAR')[source]

Generate MODECAR file from the image-freq

@param:

freq: which freq you want to generate MODECAR scale: scale factor, may lower than 1.0 outcar: name of the OUTCAR

class gvasp.common.file.MetaFile(*args, **kwargs)[source]

Bases: object

property strings
property type
class gvasp.common.file.OUTCAR(*args, **kwargs)[source]

Bases: MetaFile

animation_freq(freq: [<class 'str'>, <class 'int'>] = 'image', frames: int = 30, scale: float = 0.6)[source]

Generate freq.arc file from OUTCAR

@param:

freq: specify which freq you want to animate, accept [int, str] arguments frames: specify how many points you want to interpolate along one direction, default = 30 scale: determine the vibration scale, default = 0.6

bandgap(cutoff=0.01)[source]

Calculated the bandgap from OUTCAR file

@param:

cutoff: any occupy lower than cutoff will be treated as the empty state

@return:

type: type of bandgap, [‘direct’, ‘indirect’] bandgap: value of bandgap

class gvasp.common.file.POSCAR(*args, **kwargs)[source]

Bases: StructInfoFile

static align(pos1: str, pos2: str)[source]

Tailor the atoms’ order to make the distance of pos1 and pos2 minimum

@param:

pos1: first POSCAR file name pos2: second POSCAR file name

static dist(pos1: str, pos2: str)[source]

Calculate the distance of two POSCAR, distance = sqrt(sum((i-j)**2))

@param:

pos1: first POSCAR file name pos2: second POSCAR file name

class gvasp.common.file.POTCAR(*args, **kwargs)[source]

Bases: MetaFile

static cat(potentials, elements: List[str], potdir='/home/docs/checkouts/readthedocs.org/user_builds/qvasp/envs/v0.1.8/lib/python3.9/site-packages/gvasp/pot')[source]
write(name)[source]
class gvasp.common.file.StructInfoFile(*args, **kwargs)[source]

Bases: MetaFile

property structure
class gvasp.common.file.SubmitFile(*args, **kwargs)[source]

Bases: MetaFile

property backup_lines
property bader_lines
property build
property check_success_lines
property modify_lines
pipe(attrs: list) str[source]
property spin_lines
class gvasp.common.file.XDATCAR(*args, **kwargs)[source]

Bases: StructInfoFile

movie(name)[source]

Transform the XDATCAR to arc file

property structure
class gvasp.common.file.XSDFile(*args, **kwargs)[source]

Bases: MetaFile

property strings
property structure
static write(contcar: str | Path, outcar: str | Path, name='output.xsd')[source]
gvasp.common.file.formatter(parameters)[source]

formatter wrapper: format the INCAR parameters

@params:

parameters: which type of INCAR parameters func: write* func in INCAR class

gvasp.common.logger module

gvasp.common.parameter module

class gvasp.common.parameter.Parameter[source]

Bases: object

Parameters manager, register parameter && check theirs type

ALGO

Value Descriptor, limit param’s value

AMIX

Type Descriptor, limit param’s type

AMIX_MAG

Type Descriptor, limit param’s type

BMIX

Type Descriptor, limit param’s type

BMIX_MAG

Type Descriptor, limit param’s type

DFNMax

Type Descriptor, limit param’s type

DFNMin

Type Descriptor, limit param’s type

DRotMax

Type Descriptor, limit param’s type

DdR

Type Descriptor, limit param’s type

EB_K

Type Descriptor, limit param’s type

EDIFF

Type Descriptor, limit param’s type

EDIFFG

Type Descriptor, limit param’s type

EINT

Type Descriptor, limit param’s type

ENCUT

Type Descriptor, limit param’s type

GGA

Value Descriptor, limit param’s value

HFSCREEN

Type Descriptor, limit param’s type

IBRION

Value Descriptor, limit param’s value

ICHAIN

Value Descriptor, limit param’s value

ICHARG

Value Descriptor, limit param’s value

IDIPOL

Value Descriptor, limit param’s value

IMAGES

Type Descriptor, limit param’s type

IOPT

Value Descriptor, limit param’s value

ISIF

Value Descriptor, limit param’s value

ISMEAR

IntegerLeft Descriptor, limit param’s value

ISPIN

Value Descriptor, limit param’s value

ISTART

Value Descriptor, limit param’s value

ISYM

Value Descriptor, limit param’s value

IVDW

Value Descriptor, limit param’s value

LAECHG

Type Descriptor, limit param’s type

LCHARG

Type Descriptor, limit param’s type

LCLIMB

Type Descriptor, limit param’s type

LDAU

Type Descriptor, limit param’s type

LDAUJ

TypeList Descriptor, limit param’s type

LDAUL

TypeList Descriptor, limit param’s type

LDAUPRINT

Value Descriptor, limit param’s value

LDAUTYPE

Value Descriptor, limit param’s value

LDAUU

TypeList Descriptor, limit param’s type

LDIPOL

Type Descriptor, limit param’s type

LHFCALC

Type Descriptor, limit param’s type

LMAXMIX

Type Descriptor, limit param’s type

LORBIT

Value Descriptor, limit param’s value

LPARD

Type Descriptor, limit param’s type

LREAL

Value Descriptor, limit param’s value

LSEPB

Type Descriptor, limit param’s type

LSEPK

Type Descriptor, limit param’s type

LSOL

Type Descriptor, limit param’s type

LVHAR

Type Descriptor, limit param’s type

LWAVE

Type Descriptor, limit param’s type

MAGMOM

Type Descriptor, limit param’s type

MAXMOVE

Type Descriptor, limit param’s type

MDALGO

Value Descriptor, limit param’s value

NBMOD

Type Descriptor, limit param’s type

NEDOS

Type Descriptor, limit param’s type

NELECT

Type Descriptor, limit param’s type

NELM

Type Descriptor, limit param’s type

NELMIN

Type Descriptor, limit param’s type

NFREE

Type Descriptor, limit param’s type

NPAR

Type Descriptor, limit param’s type

NSIM

Type Descriptor, limit param’s type

NSW

Type Descriptor, limit param’s type

POTIM

Type Descriptor, limit param’s type

PREC

Value Descriptor, limit param’s value

PRECFOCK

Value Descriptor, limit param’s value

SIGMA

Type Descriptor, limit param’s type

SMASS

IntegerLeftRealRight Descriptor, limit param’s value

SPRING

Type Descriptor, limit param’s type

SYSTEM

Type Descriptor, limit param’s type

TEBEG

Type Descriptor, limit param’s type

TEEND

Type Descriptor, limit param’s type

TIME

Type Descriptor, limit param’s type

gvasp.common.parameter.bool_str(value)[source]

transform str to (bool, str)

gvasp.common.parameter.int_float(value)[source]

transform str to int (value<0) or float (value>0)

gvasp.common.parameter.list_float(values)[source]

transform str to List[float]

gvasp.common.parameter.list_int(values)[source]

transform str to List[int]

gvasp.common.parameter.list_mag(value)[source]

transform MAGMOM in n*m format to list

gvasp.common.parameter.logic(value: str)[source]

transform str to bool

gvasp.common.parameter.str_prec(value)[source]

transform PREC optional values to [‘Low’, ‘Medium’, ‘High’, ‘Normal’, ‘Single’, ‘Accurate’]

gvasp.common.plot module

class gvasp.common.plot.DOSData(dos_file, pos_file, ISPIN=2, LORBIT=12, magnification=100)[source]

Bases: object

<DOSData main class>

get_data()[source]

get_data main func

center()

calculate the band-center

contcar_parse()

parse CONTCAR data

doscar_parse()

parse DOSCAR data

get_data(atoms=None, exclude=None, orbitals=None, avgflag=False, **kargs)[source]

<Get_Data Main Func>

Parameters:
  • atoms – accept int, list, and str(‘1-10’ or ‘Ce’) type

  • exclude – remove specified atoms in <atoms parameters>

  • orbitals – list, e.g., [‘s’, ‘p’]

  • avgflag (bool) – whether calculate the average dos

static parse_contcar(name)[source]

read CONTCAR file, obtain the elements’ list.

Parameters:

name – CONTCAR file name

Returns:

elements list, e.g., [‘’,’Be’,’Be’,’C’]

Return type:

element

static parse_doscar(name, ISPIN, LORBIT)[source]

read DOSCAR file, obtain the TDOS && LDOS.

Parameters:

name – DOSCAR file name

Returns:

DataFrame(NDOS, 2) LDOS: energy_list + List(NAtom * DataFrame(NDOS, NOrbital+8))

Return type:

TDOS

class gvasp.common.plot.PESData(data)[source]

Bases: object

Generate the data for PlotPES

convert_sd()[source]

func for converting data to solid_dash type

convert_sc()[source]

func for converting data to solid_curve type

convert_sc()[source]

func for converting data to solid_curve type

Returns:

x position in bi-tuple format of solid-type line (MS state) solid_y_1: y position in bi-tuple format of solid-type line (MS state) solid_x_2: y position in bi-tuple format of solid-type line (MS-MS) solid_y_2: y position in bi-tuple format of solid-type line (MS-MS) pchip_x: x position in tri-tuple format of pchip-type line (MS-TS-MS) pchip_y: y position in tri-tuple format of pchip-type line (MS-TS-MS)

Return type:

solid_x_1

convert_sd()[source]

func for converting data to solid_dash type

Returns:

x position in bi-tuple format of solid-type line (MS/TS-state) solid_y: y position in bi-tuple format of solid-type line (MS/TS-state) dash_x: x position in bi-tuple format of dash-type line (MS/TS)-(MS/TS) dash_y: y position in bi-tuple format of dash-type line (MS/TS)-(MS-TS)

Return type:

solid_x

class gvasp.common.plot.PlotBand(*args, **kwargs)[source]

Bases: Figure

plot()[source]

Plot Band Structure, for spin-system, the average energy was applied

class gvasp.common.plot.PlotCCD(*args, **kwargs)[source]

Bases: Figure

plot()[source]

Plot Charge Density Difference

class gvasp.common.plot.PlotEPotential(*args, **kwargs)[source]

Bases: Figure

plot()[source]

Plot Electrostatic Potential

class gvasp.common.plot.PlotNEB(*args, **kwargs)[source]

Bases: Figure

plot(color='#ed0345', workdir=None)[source]
class gvasp.common.plot.PlotOpt(*args, **kwargs)[source]

Bases: Figure

plot(color=('#ed0345', '#009734'))[source]
class gvasp.common.plot.PlotPES(*args, **kwargs)[source]

Bases: Figure

Plot potential energy surface (PES)

plot()[source]

plot main func

add_solid()[source]

auxiliary func, add solid line

add_dash()[source]

auxiliary func, add dash line

add_text()[source]

auxiliary func, add text

static add_dash(linewidth, x, y, color)[source]
static add_pchip(linewidth, x, y, color, num=100)[source]
static add_solid(linewidth, x, y, color)[source]
add_text(x, y, text, color)[source]
plot(data, color, text_flag=True, style='solid_dash', legend=None)[source]

Main plot func of <PlotPES class>

Parameters:
  • data – energy or (energy, label) types data

  • color – specify which color you want to plot

  • text_flag – only affect solid_dash type

  • style – specify which style PES you want to plot, default: solid_dash

  • legend – specify the legend, triple element: [x, y, label]

class gvasp.common.plot.PostDOS(*args, **kwargs)[source]

Bases: Figure

center(selector: dict)[source]

Calculate Band-Center Value

plot(selector: dict)[source]

<Plot DOS Method>

Parameters:
  • selector (>>>) – keys: [atoms, orbitals, color, method, alpha]

  • selector.method (optional) – [“line”, “dash line”, “fill”, “output”]

  • Examples

  • ---------

  • selector

  • {"0" (selector =) –

    [{“atoms”: “C”, “orbitals”: [“p”], “color”: “#ed0345”, “method”: “fill”, “alpha”: 0.3},

    {“atoms”: “1-10”, “orbitals”: [“s”, “d”], “color”: “#098760”}],

    ”1”: [{“atoms”: [0, 1, “H”], “orbitals”: [“p”], “color”: “#ed0345”},

    {“atoms”: 12, “orbitals”: [“s”, “p”], “color”: “#098760”}]}

Returns:

display or save the DOS figures

gvasp.common.plot.interpolated_wrapper(func)[source]

gvasp.common.setting module

class gvasp.common.setting.ConfigManager[source]

Bases: object

property dict
load()[source]

Load the configuration (need consider the multi-users)

write()[source]

gvasp.common.structure module

class gvasp.common.structure.NeighbourTable[source]

Bases: defaultdict

property coordination
property dist
property dist3d
property index
property index_tuple
class gvasp.common.structure.Structure(atoms: Atoms | None = None, lattice: Lattice | None = None)[source]

Bases: object

static align(structure1, structure2, tolerance1=0.2, tolerance2=100)[source]

Tailor the atoms’ order to make the distance of structure1 and structure2 minimum

@param:

structure1: first Structure structure2: second Structure tolerance1: first sort tolerance tolerance2: second sort tolerance

check_overlap(cutoff=0.1)[source]
static dist(structure1, structure2)[source]

Calculate the distance of two structures, distance = sqrt(sum((i-j)**2))

@param:

structure1: first Structure structure2: second Structure

@return

diff: distance between two structures

find_neighbour_table(neighbour_num: int = 12, cut_radius=None, adj_matrix=None, sort=True, including_self=False)[source]
static from_POSCAR(name)[source]
static from_cell(name)[source]
static from_structure(structure, coord, type='cart')[source]

Generate the Structure instance from original structure with changing its atoms’ coord

Parameters:
  • structure – which structure you want to base

  • coord – coord for new structure, <frac or cart>

  • type – which type of new coord, should be one of [“frac”, “cart”], default: “cart”

Returns: new Structure instance

write_POSCAR(name, title=None, factor=1.0)[source]

gvasp.common.task module

class gvasp.common.task.Animatable[source]

Bases: object

abstract static movie(name)[source]

Abstractmethod: Generate the *.arc file to be loaded by Material Studio

Parameters:

name (str) – the name of the output *.arc file

class gvasp.common.task.BandTask(*args, **kwargs)[source]

Bases: NormalTask

Band Structure calculation task manager, subclass of NormalTask

class gvasp.common.task.BaseTask[source]

Bases: object

Task Base class, load config.json, generate INCAR, KPOINTS, POSCAR and POTCAR Note: subclass should have generate method

PotDir = PosixPath('C:\\Users\\hui_zhou\\Desktop\\packages\\GVasp\\pot')
Scheduler = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/qvasp/envs/v0.1.8/lib/python3.9/site-packages/gvasp/slurm.submit')
Template = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/qvasp/envs/v0.1.8/lib/python3.9/site-packages/gvasp/INCAR')
UValueBase = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/qvasp/envs/v0.1.8/lib/python3.9/site-packages/gvasp/UValue.yaml')
abstract generate(potential: (<class 'str'>, <class 'list'>) = 'PAW_PBE', continuous: bool = False, low: bool = False, print_end: bool = True, analysis: bool = False, vdw: bool = False, sol: bool = False, gamma: bool = False, mag: bool = False, hse: bool = False, static: bool = False, nelect=None, points: int = 21)[source]

generate main method, subclass should inherit or overwrite

static get_all_parents()[source]
class gvasp.common.task.ChargeTask(*args, **kwargs)[source]

Bases: NormalTask

Charge calculation task manager, subclass of NormalTask

static apply_analysis(submit)[source]
static split()[source]

split CHGCAR to CHGCAR_tot && CHGCAR_mag

static sum()[source]

sum AECCAR0 and AECCAR2 to CHGCAR_sum

static to_grd(name='vasp.grd', Dencut=250)[source]

transform CHGCAR_mag to grd file

class gvasp.common.task.ConTSTask(*args, **kwargs)[source]

Bases: OptTask, XDATMovie

Constrain transition state (Con-TS) calculation task manager, subclass of NormalTask

class gvasp.common.task.DOSTask(*args, **kwargs)[source]

Bases: NormalTask

Density of States (DOS) calculation task manager, subclass of NormalTask

class gvasp.common.task.DimerTask(*args, **kwargs)[source]

Bases: NormalTask, XDATMovie

class gvasp.common.task.FreqTask(*args, **kwargs)[source]

Bases: NormalTask, Animatable

Frequency calculation task manager, subclass of NormalTask

static movie(file='OUTCAR', freq='image')[source]

visualize the frequency vibration, default: image

class gvasp.common.task.MDTask(*args, **kwargs)[source]

Bases: NormalTask, XDATMovie

ab-initio molecular dynamics (AIMD) calculation task manager, subclass of NormalTask

class gvasp.common.task.NEBTask(ini_poscar=None, fni_poscar=None, images=4)[source]

Bases: BaseTask, Animatable

Nudged Elastic Band (NEB) calculation (no-climbing) task manager, subclass of BaseTask

generate(method='linear', check_overlap=True, potential='PAW_PBE', vdw=False, sol=False, gamma=False, nelect=None, mag=False, hse=False, static=False)[source]

Overwrite BaseTask’s generate, add method and check_overlap parameters

static monitor()[source]

Monitor tangent, energy and barrier in the NEB-task

static movie(name='movie.arc', file='CONTCAR', workdir=None)[source]

Generate arc file from images/[POSCAR|CONTCAR] files

static sort(ini_poscar, fni_poscar)[source]

Tailor the atoms’ order for neb task

@param:

ini_poscar: initial POSCAR file name fni_poscar: final POSCAR file name

class gvasp.common.task.NormalTask(*args, **kwargs)[source]

Bases: BaseTask

generate(*args, **kargs)[source]

fully inherit BaseTask’s generate

class gvasp.common.task.OptTask(*args, **kwargs)[source]

Bases: NormalTask, XDATMovie

Optimization task manager, subclass of NormalTask

class gvasp.common.task.OutputTask[source]

Bases: object

static output(name)[source]

Transform the results to .xsd file

class gvasp.common.task.STMTask(*args, **kwargs)[source]

Bases: NormalTask

Scanning Tunneling Microscope (STM) image modelling calculation task manager, subclass of NormalTask

class gvasp.common.task.SequentialTask(end)[source]

Bases: object

Apply Sequential Task from opt => chg or opt => dos

generate(potential='PAW_PBE', low=False, analysis=False, vdw=False, sol=False, gamma=False, nelect=None, hse=False, static=False)[source]
class gvasp.common.task.WorkFuncTask(*args, **kwargs)[source]

Bases: NormalTask

Work Function calculation task manager, subclass of NormalTask

class gvasp.common.task.XDATMovie(*args, **kwargs)[source]

Bases: Animatable

static movie(name='movie.arc')[source]

make arc file to visualize the optimization steps

gvasp.common.task.end_symbol(func)[source]
gvasp.common.task.write_wrapper(file)[source]

gvasp.common.utils module

gvasp.common.utils.colors_generator()[source]

Color cycle generator

gvasp.common.utils.get_HOME() Path[source]

obtain HOME directory

gvasp.common.utils.identify_atoms(atoms, elements)[source]

Calculate the real index for the atoms

gvasp.common.utils.is_subset_recommend_pot(element)[source]

Identify an element is or not in RecommendPot

gvasp.common.utils.redefine_frac(frac)[source]

Make frac_coord within [0,1]

Parameters:

frac (np.array) – frac_coord input

Returns:

frac_coord output

Return type:

frac (np.array)

gvasp.common.utils.remove_mapping(atoms: list, tol=0.01)[source]
gvasp.common.utils.search_peak(dos_data: Series, tol: float = 0.0001)[source]
gvasp.common.utils.str_list(_list)[source]

Transform the list to strings with s delimiter, e.g. [1, 2, 3] => 1 2 3