look4bas is a Python script to search and obtain Gaussian basis sets.
Currently we use the data of the
EMSL basis set exchange
or the ccrepo.
An API to interact with the script directly from a
on a high level is provided as well, see below.
On the first invocation (and from there on in regular intervals) the script
downloads an archived catalogue of known basis sets to enable to search for
them locally and on the commandline.
Note, that the actual basis set data is not downloaded.
This is only done if the user uses the flag
--download, see below.
Use regular expressions (
grep) for basis set names and descriptions:
$ look4bas "double zeta"
Ignore case when searching for patterns:
$ look4bas "cc-pv.z" -i
Limit to basis sets which contain basis definitions for specific elements (e.g. helium, neon and argon):
$ look4bas --elements He Ne Ar
Combine various filters:
$ look4bas --elements H --regex "cc-pv.z" -i "zeta"
Not only list the matching basis sets by name and give a short description for them, but also list the elements for which this basis set defines basis functions:
$ look4bas "double zeta" --format elements
The same thing can be achieved by using the pre-defined
--extraoutput format style, i.e
$ look4bas --extra "double zeta"
Download the findings in Gaussian94 basis format to the current working directory:
$ look4bas --elements H --regex "cc-pv.z" -i "zeta" --download
Notice, that this will download the basis set definitions for all elements, for which this basis set is known at the corresponding source, even if once uses
--elementsto filter for particular elements.
Other basis formats are supported, too. For example
$ look4bas --elements H --regex "cc-pv.z" -i "zeta" --download orca
downloads in the format supported by ORCA. For a list of instructions how to use
look4baswith certain quantum chemistry packages, see below.
More info about the commandline flags of
look4bascan be obtained using
Either you clone the repo and make sure you have the appropriate dependencies
installed (see next section), or you just use
$ pip install look4bas
Requirements and Python dependencies
- Python >= 3.5 (Note: python 3.4. could work as well)
- Beautiful Soup >= 4.2
- lxml (>= 4.2)
- requests >= 2.2
Searching for basis sets can be accomplished directly via a
which will return the search results in plain
python dictionaries and lists.
An example for such use can be found in
Using look4bas with ...
This section contains some hints how to use
in combination with a few quantum-chemistry programs. If you use it
with other codes or feel some explanation is missing,
feel free to extend it here with a PR.
The CFOUR format is implemented, but not properly tested so far. Feel free to use it and please get in touch if you encounter problems.
No documentation for Gaussian is available so far.
look4bas is able to download a file in the format
expected for the
basis section of the input file
basis section has to be supplied after the geometry
information and before further
configuration, such as a
task line or similar.
One way to conveniently include the downloaded
basis information is to split the input file into
two parts, a
head and a
where the information before the
goes into the
head file and the information after
the basis section goes into the
Once the basis set info has been downloaded using
look4bas one may use
cat to concatenate all
files and form a valid NWChem input.
For example, assume we want to perform a
water geometry optimisation using
and download the basis with
We may proceed as follows:
- Define a NWChem head file
geometry h 1 0 0 h 0 1 0 o 0 0 0 end
and a tail file
task scf optimize
- Download pc-2 basis with
$ look4bas "^pc-2$" --elem H O Fe --down nwchem
- Combine all files into
$ cat water_head.nw pc-2.nw water_tail.nw > water.nw
- Run the calculation
$ nwchem water.nw | tee water.out
Alternatively one may obviously just use a plain
text editor and instead of typing the
section read it from the file downloaded
look4bas downloads the basis set in the format expected
%basis block. By concatenation with a skeleton
input file, which defines the rest of the calculation parameters,
one can therefore quickly prepare an input file for
For example, consider again the water geometry optimisation using
- Define a skeleton ORCA input file
! hf opt * xyz 0 1 H 1 0 0 H 0 1 0 O 0 0 0 *
- Download the pc-2 basis with
$ look4bas "^pc-2$" --elem H O Fe --down orca
- Create the actual input file
$ cat water_skel.in pc-2.orca water.in
- Run ORCA
$ orca water.in | tee water.out
For supplying basis information to pyscf,
the python API is best used.
for example, performs the exemplary geometry optimisation of water,
where the pc-2 basis is obtained using
#!/usr/bin/env python3 import pyscf import pyscf.geomopt.berny_solver import look4bas import look4bas.basis_format # Search for basis set db = look4bas.Database() db.update() findings = db.search_basisset("^pc-2$", regex=True, has_atnums=[1, 8, 32]) assert len(findings) == 1 bset = db.lookup_basisset_full(findings) # Setup water HF geometry optimisation in pyscf mol = pyscf.gto.Mole() mol.atom = "H 1 0 0; H 0 1 0; O 0 0 0" mol.basis = look4bas.basis_format.convert_to("pyscf", bset["atoms"]) mol.build() mf = pyscf.scf.RHF(mol) mol_eq = pyscf.geomopt.berny_solver.optimize(mf)
look4bas directly downloads a basis set in the format expected
$basis section of a Q-Chem input file.
Therefore one may simply concatenate a
basis set definition downloaded with
with a skeleton input file, which configures the rest of the
For example, we consider again a simple water geometry optimisation.
- We define a skeleton Q-Chem input file
$molecule 0 1 H 1 0 0 H 0 1 0 O 0 0 0 $end $rem exchange hf basis gen jobtype opt $end
- We download, for example, the pc-2 basis with
$ look4bas "^pc-2$" --elem H O Fe --down qchem
- Finally the actual Q-Chem input file
water.qcinof such a job, using exactly the downloaded basis, can be created just by:
$ cat water_skel.qcin pc-2.bas > water.qcin
The Turbomole format is implemented, but not properly tested so far. Feel free to use it and please get in touch if you encounter problems.
You can cite
look4bas using this
or simply as
Michael F. Herbst. look4bas: Interactively search for Gaussian basis sets. (2018). DOI 10.5281/zenodo.1188991.