gvasp.common package
gvasp.common.base module
- class gvasp.common.base.Atom(*args, **kwargs)[source]
Bases:
objectAtom 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
- class gvasp.common.base.Atoms(*args, **kwargs)[source]
Bases:
AtomAtoms 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
- 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 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:
objectBase Descriptor, <get, set, del> method of each param is unlimited
- class gvasp.common.descriptor.IntegerLeftDescriptor(*args, **kwargs)[source]
Bases:
ValueDescriptorIntegerLeft Descriptor, limit param’s value
- class gvasp.common.descriptor.IntegerLeftRealRightDescriptor(*args, **kwargs)[source]
Bases:
IntegerLeftDescriptorIntegerLeftRealRight Descriptor, limit param’s value
- class gvasp.common.descriptor.TypeDescriptor(*args, **kwargs)[source]
Bases:
DescriptorType Descriptor, limit param’s type
- class gvasp.common.descriptor.TypeListDescriptor(*args, **kwargs)[source]
Bases:
DescriptorTypeList 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:
DescriptorValue Descriptor, limit param’s value
gvasp.common.error module
gvasp.common.figure module
- class gvasp.common.figure.DashLine(*args, **kwargs)[source]
Bases:
LineBaseDash Line class, subclass of LineBase
- class gvasp.common.figure.Figure(*args, **kwargs)[source]
Bases:
objectPlot-type class’ parent, unify the figure format
- lloc
Value Descriptor, limit param’s value
- class gvasp.common.figure.LineBase(*args, **kwargs)[source]
Bases:
objectLine-Base-class, cant’ instantiated
- class gvasp.common.figure.SolidLine(*args, **kwargs)[source]
Bases:
LineBaseSolid Line class, subclass of LineBase
- class gvasp.common.figure.Text(figure, x, y, s, color, fontsize=18)[source]
Bases:
objectAdd 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
gvasp.common.file module
- class gvasp.common.file.CHGBase(*args, **kwargs)[source]
Bases:
StructInfoFileSubclass of StructInfoFile, inherit <structure property>
- class gvasp.common.file.CHGCAR(*args, **kwargs)[source]
Bases:
StructInfoFile
- class gvasp.common.file.CellFile(*args, **kwargs)[source]
Bases:
StructInfoFile- property structure
- class gvasp.common.file.DOSCAR(*args, **kwargs)[source]
Bases:
MetaFile- ISPIN
Value Descriptor, limit param’s value
- LORBIT
Value Descriptor, limit param’s value
- class gvasp.common.file.LOCPOT(*args, **kwargs)[source]
Bases:
StructInfoFile
- class gvasp.common.file.MODECAR(*args, **kwargs)[source]
Bases:
MetaFile
- 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
- class gvasp.common.file.POSCAR(*args, **kwargs)[source]
Bases:
StructInfoFile
- class gvasp.common.file.POTCAR(*args, **kwargs)[source]
Bases:
MetaFile
- 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
- property spin_lines
- class gvasp.common.file.XDATCAR(*args, **kwargs)[source]
Bases:
StructInfoFile- property structure
gvasp.common.logger module
gvasp.common.parameter module
- class gvasp.common.parameter.Parameter[source]
Bases:
objectParameters 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.plot module
- class gvasp.common.plot.DOSData(dos_file, pos_file, ISPIN=2, LORBIT=12, magnification=100)[source]
Bases:
object<DOSData main class>
- 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
- class gvasp.common.plot.PESData(data)[source]
Bases:
objectGenerate the data for PlotPES
- 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.PlotPES(*args, **kwargs)[source]
Bases:
FigurePlot potential energy surface (PES)
- 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- 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.setting module
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
- 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_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
gvasp.common.task module
- class gvasp.common.task.BandTask(*args, **kwargs)[source]
Bases:
NormalTaskBand Structure calculation task manager, subclass of NormalTask
- class gvasp.common.task.BaseTask[source]
Bases:
objectTask 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.9/lib/python3.9/site-packages/gvasp/slurm.submit')
- Template = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/qvasp/envs/v0.1.9/lib/python3.9/site-packages/gvasp/INCAR')
- UValueBase = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/qvasp/envs/v0.1.9/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
- class gvasp.common.task.ChargeTask(*args, **kwargs)[source]
Bases:
NormalTaskCharge calculation task manager, subclass of NormalTask
- class gvasp.common.task.ConTSTask(*args, **kwargs)[source]
-
Constrain transition state (Con-TS) calculation task manager, subclass of NormalTask
- class gvasp.common.task.DOSTask(*args, **kwargs)[source]
Bases:
NormalTaskDensity 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,AnimatableFrequency calculation task manager, subclass of NormalTask
- class gvasp.common.task.MDTask(*args, **kwargs)[source]
Bases:
NormalTask,XDATMovieab-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,AnimatableNudged 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
- class gvasp.common.task.OptTask(*args, **kwargs)[source]
Bases:
NormalTask,XDATMovieOptimization task manager, subclass of NormalTask
- class gvasp.common.task.STMTask(*args, **kwargs)[source]
Bases:
NormalTaskScanning Tunneling Microscope (STM) image modelling calculation task manager, subclass of NormalTask
- class gvasp.common.task.SequentialTask(end)[source]
Bases:
objectApply Sequential Task from opt => chg or opt => dos
- class gvasp.common.task.WorkFuncTask(*args, **kwargs)[source]
Bases:
NormalTaskWork Function calculation task manager, subclass of NormalTask
- class gvasp.common.task.XDATMovie(*args, **kwargs)[source]
Bases:
Animatable
gvasp.common.utils module
- gvasp.common.utils.is_subset_recommend_pot(element)[source]
Identify an element is or not in RecommendPot