\(\newcommand{\AA}{\text{Å}}\)
CRYSTALpytools.base.crysd12 module
The Crystal_inputBASE
object is strictly structured by ‘blocks’, which, in general, is defined as keywords that are closed by ‘END’. It is inherited from the BlockBASE object and is inherited by the Crystal_input object. All the blocks are organized in layers and each corresponds to a list of keywords that can be called and set. The current structure of Crystal_inputBASE
is listed below:
Layer 1: geom
, basisset
, scf
Layer 2: optgeom
, freqcalc
, hf3c
, hfsol3c
, dft
, dftd3
, gcp
, geom
, base
, geba
Layer 3: preoptgeom
For the usages of BlockBASE and Crystal_input objects, please refer to the corresponding documentations.
Examples
Note that methods listed below are for Crystal_input objects, which is typically consistent with Crystal_inputBASE
, except file read and write functions.
To set force convergence threshold of a optimization run:
>>> obj = Crystal_input()
>>> obj.geom.optgeom.toldeg(0.0001)
By calling the ‘block-like’ attribute, a sub-block object will be automatically generated if no such object is saved in the upper block object. It also be initialized and deleted in a similar way as keyword commands.
>>> obj = Crystal_input()
>>> obj.geom.optgeom() # Initialize OPTGEOM
>>> obj.geom.optgeom(None) # Remove OPTGEOM
To set the values of keywords, their names are called as methods with a really rare exception (1 so far):
>>> obj.geom.freqcalc.preoptgeom() # Initialize PREOPTGEOM
>>> obj.geom.freqcalc.preoptgeom.toldeg(0.0003)
>>> obj.scf.toldee(9) # Set SCF TOLDEE = 9
>>> obj.scf.toldee(None) # Clean the TOLDEE keyword and value
>>> obj.scf.ppan() # Print PPAN keyword, without value
The only exception is given below. However, when doing text analysis and printing formatted string to files, the correct keyword is recognized and printed.
>>> obj.geom.molecule2() # MOLECULE keyword to extract molecule from lattice. Renamed to address the conflict with modelling keyword MOLECULE
Though one can set CRYSTAL input object by manually setting up all the attributes, it is also possible to read a template d12 file and do modifications.
>>> obj = Crystal_input('opt.d12')
>>> obj.geom.optgeom(None) # Remove OPTGEOM block
>>> obj.to_file('scf.d12') # Print it into file
It is also possible to set individual blocks by a string. This is achieved by simply assigning the string variable as input when calling the corresponding method.
>>> obj.scf.dft('SPIN\nEXCHANGE\nPBE\nCORRELAT\nP86\n')
For basis set, it is not a typical BlockBASE
object (though it inherits BlockBASE
). When ‘BASISSET’ keyword is used, it is called in the same way as other blocks. When explicit definitions of basis set are used, it can be defined via formatted string, file, Basis Set Exchange (BSE) and BasisSetBASE object. The ending line ‘99 0’ is required.
>>> obj.basisset.basisset('def2-SVP')
>>> obj.basisset.from_file('mybasis.txt')
>>> obj.basisset.from_bse('6-311G*', [6, 1, 8]) # conventional atomic numbers are supported.
Wrapper methods (bs_user()
and bs_keyword()
) are added in Crystal_input. For details please checkt the manual there.
>>> obj.bs_keyword('def2-SVP')
>>> obj.bs_user('mybasis.txt')
>>> obj.bs_user('6-311G*', [6, 1, 8]) # bs_user accepts file, string and BSE variables
To examine the data in a block object, including the Crystal_input obj itself, call the data
attribute.
>>> print(obj.data)
Classes and methods of keywords used in ‘crystal’ input file (d12).
- class Crystal_inputBASE(geba=False)
Bases:
BlockBASE
The base class of Crystal_input class
- Parameters:
geba (bool) – Whether it is a normal d12 object or a GEBA subblock
- property geom
Geometry subblock
- property basisset
Basis set subblock
- property scf
SCF subblock
- property data
Settings in all the attributes are summarized here.
- analyze_text(data)
Analyze formatted d12 file. A ‘complete’ d12 file with geometry, basis set and SCF blocks is suggested.
- Parameters:
data (str) – Formatted string.
- class Geom
Bases:
BlockBASE
Geometry block object
- property data
Settings in all the attributes are summarized here. Covers the data property in BlockBASE, to address the ambiguity of ‘MOLECULE’ keywords.
- analyze_text(text)
Overrides the same method from parent class for title line.
- title(title='Generated by CRYSTALpytools')
- crystal(IGR='', latt=[], atom=[], IFLAG=0, IFHR=0, IFSO=0, origin=[])
Define ‘CRYSTAL’ structure
- Parameters:
sg (int) – Space group number. Parameter IGR in the manual
latt (list) – Minimal set of crystallographic cell parameters
atom (list) – Natom * 4 list of conventional atomic number and 3D fractional coordinates.
IFLAG (int) – See the manual
IFHR (int) – See the manual
IFSO (int) – See the manual
origin (list) – IFSO > 1 See the manual
- slab(IGR='', latt=[], atom=[])
Define ‘SLAB’ structure
- polymer(IGR='', latt=[], atom=[])
Define ‘POLYMER’ structure
- helix(N1='', N2=0, latt=[], atom=[])
Define ‘HELIX’ structure
- Parameters:
N1 (int) – See the manual
N2 (int) – See the manual
- molecule(IGR='', atom=[])
Define ‘MOLECULE’ structure
- external(external='')
Define ‘EXTERNAL’ structure
- dlvinput(dlvinput='')
Define ‘DLVINPUT’ structure
- supercel(mx='')
Supercell by ‘SUPERCEL’ keyword
- Parameters:
mx (array | list | str) – ndimen * ndimen matrix,
None
or''
- supercon(mx='')
Supercell by ‘SUPERCON’ keyword
- scelconf(mx='')
Supercell by ‘SCELCONF’ keyword
- scelphono(mx='')
Supercell by ‘SCELPHONO’ keyword
- elastic(IDEF='', mx='')
- atombsse(IAT='', NSTAR=None, RMAX=None)
- atomdisp(NDISP='', atom=[])
ATOMDISP keyword
- Parameters:
NDISP (int) – See manual
atom (list) – NDISP*4 list. Including LB, DX, DY, DZ
- atominse(NINS='', atom=[])
ATOMINSE keyword
- Parameters:
NINS (int) – See manual
atom (list) – NINS*4 list. Including NA, X, Y, Z
- atomorde(atomorde='')
- atomremo(NL='', atom=[])
ATOMREMO keyword
- Parameters:
NL (int) – See manual
atom (list) – NL*1 list. Including LB
- atomsubs(NSOST='', atom=[])
ATOMSUBS keyword
- Parameters:
NSOST (int) – See manual
atom (list) – NSOST*2 list. Conventional atomic number of atoms to be substituted and to substituted
- molecule2(NMOL='', atom=[])
Note
Corresponds to the option MOLECULE to isolate molecules from lattice. Only the method’s name is changed to avoid ambiguity with the one to set 0D geometry.
- Parameters:
NMOL (int)
atom (list[list[int]]) – NMOL*4 list. See CRYSTAL manual.
- extprt(extprt='')
- cifprt(cifprt='')
- cifprtsym(cifprtsym='')
- coorprt(coorprt='')
- testgeom(testgeom='')
- property optgeom
Subblock object OPTGEOM
- property freqcalc
Subblock object FREQCALC
- class Optgeom
Bases:
BlockBASE
OPTGEOM block object
- fulloptg(fulloptg='')
- cellonly(cellonly='')
- intredun(intredun='')
- itatocel(itatocel='')
- cvolopt(cvolopt='')
- hessiden(hessiden='')
- hessmod1(hessmod1='')
- hessmod2(hessmod2='')
- hessnum(hessnum='')
- toldeg(TG=0.0003)
- toldex(TX=0.0012)
- toldee(IG=7)
- maxcycle(MAX=50)
- fragment(NL='', LB=[])
- Parameters:
NL (int | str) – Number of atoms. See manual
LB (list[int]) – Label of atoms. See manual
- restart(restart='')
- finalrun(ICODE=4)
- extpress(pres='')
- allowtrustr(allowtrustr='')
- notrustr(notrustr='')
- maxtradius(TRMAX=4.0)
- trustradius(TRADIUS=0.5)
- onelog(onelog='')
- noxyz(noxyz='')
- nosymmops(nosymmops='')
- printforces(printforces='')
- printhess(printhess='')
- printopt(printopt='')
- print(prt='')
- tsopt(tsopt='')
- modefollow(MODEFOL='')
- pathfollow(NPATHFOL='')
- fittopath(NPATHFOL2='', NPATHWEIGHT='')
- chngtsfol(chngtsfol='')
- scanatom(NATSCAN='', TARGET='', MSCAN='')
- scanredu(IREDSCA='', ENDSCA='', MAXSCA='')
- class Freqcalc
Bases:
BlockBASE
FREQCALC block object
- nooptgeom(nooptgeom='')
- property preoptgeom
Subblock object PREOPTGEOM
- dispersion(dispersion='')
- bands(ISS='', NSUB=None, NLINE=None, points=[])
- modes(modes='')
- nomodes(nomodes='')
- numderiv(N=1)
- pressure(NP='', P1=None, P2=None)
- restart(restart='')
- stepsize(STEP=0.003)
- temperat(NT='', T1=None, T2=None)
- class BasisSet
Bases:
BlockBASE
Basis Set block object
- property data
Settings in all the attributes are summarized here. Covers the data property in BlockBASE, to deal with user’s definition of basis sets.
- analyze_text(text)
Analyze the input and return to corresponding attributes. Add support to basis set strings
- basisset(NAME='')
- ghosts(NA='', LA=[])
- from_bse(name, z, append=False)
Download basis set definitions from Basis Set Exchange (BSE).
- Parameters:
name (str) – Basis set’s name.
z (list[int]) – List of elements, specified by conventional atomic numbers.
append (bool) – Whether to cover old entries. If the old entry contains ‘BASISSET’, it will be removed anyway. Useful when different series of basis sets are defined
- from_string(string, fmt='crystal', append=False)
Basis set from a string
- Parameters:
string (str) – Basis set definition.
fmt (str) – Format string. Consistent with BSE python API. For non-CRYSTAL formats, only all-electron basis sets are supported. Charge of each shell will be automatically assigned to get charge neutral atoms.
append (bool) – Whether to cover old entries. If the old entry contains ‘BASISSET’, it will be removed anyway. Useful when different series of basis sets are defined
- from_file(file, fmt='crystal', append=False)
Basis set from a file
- Parameters:
file (file) – Basis set definition.
fmt (str) –
Format string. Consistent with BSE python API. For non-CRYSTAL formats, only all-electron basis sets are supported. Charge of each shell will be automatically assigned to get charge neutral atoms.
append (bool) – Whether to cover old entries. If the old entry contains ‘BASISSET’, it will be removed anyway. Useful when different series of basis sets are defined
- from_obj(bs_obj, append=False)
Define basis set from a
base.basisset.BasisSetBASE
object.- Parameters:
bs_obj (BasisSetBASE)
append (bool) – Whether to cover old entries. If the old entry contains ‘BASISSET’, it will be removed anyway. Useful when different series of basis sets are defined
- class SCF
Bases:
BlockBASE
SCF block object
- property data
Print formatted input. Redefined to address the END keywords of FIXINDEX blocks
- rhf(rhf='')
- uhf(uhf='')
- rohf(NSPIN='')
- property dft
Subblock object DFT
- property hf3c
Subblock object HF3C
- property hfsol3c
Subblock object HFSOL3C
- property dftd3
Subblock object DFTD3
- property gcp
Subblock object GCP
- gcpauto(gcpauto='')
- atomspin(NA='', LA=[])
- toldee(ITOL=6)
- guessp(guessp='')
- maxcycle(MAX=50)
- ldremo(value='')
- smear(WIDTH='')
- levshift(ISHIFT='', ILOCK='')
- shrink(IS='', ISP='', IS1='', IS2='', IS3='')
Shrink parameters.
- tolinteg(ITOL1=7, ITOL2=7, ITOL3=7, ITOL4=7, ITOL5=14)
- biposize(ISIZE=4000000)
- exchsize(ISIZE=4000000)
- bipolar(ITCOUL=18, ITEXCH=14)
- nobipola(nobipola='')
- nobipcou(nobipcou='')
- nobipexc(nobipexc='')
- fmixing(IPMIX=30)
- diis(diis='')
- nodiis(nodiis='')
- diisallk(diisallk='')
- sloshing(sloshing='')
- histdiis(NCYC='')
- thrediis(DEDIIS='')
- thrkdiis(DIISTHR='')
- sloshfac(FKERK=1.2)
- prtdiis(prtdiis='')
- anderson(anderson='')
- broyden(W0=0.0001, IMIX=50, ISTART=2)
- ppan(ppan='')
- gradcal(gradcal='')
- exchange(exchange='')
- postscf(postscf='')
- cmplxfac(WEIGHT=2.0)
- repldata(repldata='')
- stdiag(stdiag='')
- fixindex(fixindex='')
Fixindex keywords.
Note
‘GEOM’ is a
Geom
object. To modify keywords (‘CRYSTAL’ as example), useinput.scf.geom.crystal()
.‘BASE’ is a
BasisSet
object. To define basis set from bse, useinput.scf.base.from_bse()
.‘GEBA’ is a
Crystal_inputBASE
object. To modify keywords (‘CRYSTAL’ as example), useinput.scf.geba.geom.crystal()
.
- property geom
Subblock object GEOM
- property base
Subblock object BASE
- property geba
Subblock object GEBA
- class DFT
Bases:
BlockBASE
DFT block object
- spin(spin='')
- exchange(ex='')
- correlat(cor='')
- xcfunc(xc='')
- sr_omega(sr_omega='')
- mr_omega(mr_omega='')
- lr_omega(lr_omega='')
- sr_hyb_wb97x(sr_c='')
- lsrsh_pbe(omega='', sr_c=0.0, lr_c=0.0)
- lgrid(lgrid='')
- oldgrid(oldgrid='')
- xlgrid(xlgrid='')
- xxlgrid(xxlgrid='')
- xxxlgrid(xxxlgrid='')
- hugegrid(hugegrid='')
- radial(NR='', RL=[], IL=[])
- angular(NI='', AL=[], LEV=[])