Bases: object
Wrapper for the CRYSTAL program.
This object provides a pythonic interface to the CRYSTAL program. It is modelled loosely after CRYSTAL‘s input:
The OPTGEOM keyword of the first code block can be accessed through the optgeom attribute:
# enable geometry optimization functional.optgeom.enabled = True # change some of the keywords functional.optgeom.maxcycle = TrueGeometry optimization must be explicitly enabled, as is done in the first line above.
The interface to the second block of input (basis-functions) can be accessed through the basis attribute. It allows to set the basis set itself, as well as keywords specific to the basis set:
functional.basis['H'] = [Shell('s', a0=(15.0, 1.0), a1=(8.0, 1.0)), ...] functional.basis.ghosts = [1, 4, 6], FalseThe third input block (Hamiltonian and miscellaneous) can be accessed directly through the functional, or, alternatively, via the scf attribute.
functional.scf.dft.b3lyp = True functional.dft.b3lyp = True functional.tolinteg = [8] * 4 + [14]The first two lines are exactly equivalent. The third line could also be written as functional.scf.tolinteg = ....
Following the pattern of CRYSTAL‘s input, the parameters are separated into sub-blocs:
Extraction class.
Performs a CRYSTAL calculation
If successfull results (see extract.Extract.success) already exist in outdir, calculations are not repeated. Instead, an extraction object for the stored results are given.
Parameters: |
|
---|---|
Returns: | Yields an extractor object if a prior successful run exists. Otherwise, yields a tuple object for executing an external program. |
Note : | This functor is stateless as long as self and structure can be deepcopied correctly. |
Raises: |
|
This version performs a blocking call to the CRYSTAL program. It works as follows:
>>> from pylada.dftcrystal import Crystal, Functional
>>> # create an object
>>> functional = Functional()
>>> # initialize it
>>> functional.basis['H'] = ...
...
>>> # call the functional on a Crystal structure.
>>> result = functional(crystal, outdir='ther', comm=comm)
>>> print result.total_energy
-666 eV
Performs a CRYSTAL calculation
If successfull results (see extract.Extract.success) already exist in outdir, calculations are not repeated. Instead, an extraction object for the stored results are given.
Parameters: |
|
---|---|
Returns: | Yields an extractor object if a prior successful run exists. Otherwise, yields a tuple object for executing an external program. |
Note : | This functor is stateless as long as self and structure can be deepcopied correctly. |
Raises: |
|
This version does not perform the actual call to the CRYSTAL. Rather, it is a generator which yields two types of objects:
The last object yielded should be an extraction object refering to the final calculation. In practice, iter() is used as follows:
for process in functional.iter(crystal, ...):
# check whether the generator yielded a process or not
if hasattr(process, 'success'):
# This is an extraction object
# Do something
else:
# This is a process
# call it somehow
process.start(comm)
process.wait()
print process.some_result # last process should be an extractor
Geometry relaxation parameters.
This is an instance of OptGeom. Once enabled with
>>> functional.optgeom.enable = True
it will print out the geometry subblock into the input. It controls the structural relaxation:
>>> functional.optgeom.intredun = True
>>> functional.optgeom.maxcycle = 10
See also
OptGeom, Relax
It is an instance of Dft. Parameters from CRYSTAL‘s sub-block can be set here, for instance as:
>>> functional.dft.b3lyp = True
Holds definition of basis functions – block 2.
Infers the number of procs per kpoint.
This function is helpfull in checking whether MPPcrystal will run correcly or not. It returns a list consisting of the number of procs per k-point. It is a list since CRYSTAL may assign some k-points with more processors than others, in order to maximize the number of processors used. However, this approach fails when a k-point is assigned a prime number of processors, because of some bug somewhere (see comment in k_space_MPP.f90: asssing_k_to_proc in CRYSTAL code). Unfortunately, MPPCrystal does not recover well from this problem.
Returns list of MPP compatible processor counts.
Processor counts are compatible if:
\(N_p < N_{AO} * N_k * N_s // dof\)
\(N_p % multipleof == 0\)
the number of processors per k-point is never prime
Where:
- \(N_p\) is the number of cores
- \(N_k\) is the number of irreducible kpoints
\(N_s\) is the number of spins
\(N_{AO}\) is the number of atomic orbitals
The last condition is somewhat more complex and depends upon the total number of kpoints, the number of k-points at the Brillouin zone edge, and the particular way CRYSTAL assigns procs for each k-point. This decomposition is computed in kpoint_blocking().
Parameters: |
|
---|
Holds definition of geometry optimization – part of block 1.
Path to crystal program.
If this attribute is None, then crystal_program is used.
Place holder.
Holds scf/electronic keywords – block 3.
Title of the calculation.
Overriden by the name of the input structure, if it exists.