Skip to main content

Build, Test & Upload Coverage Status PyPI version Documentation Status

PyQchem

Python wrapper for Q-Chem (https://www.q-chem.com)
Online manual: https://pyqchem.readthedocs.io/

Main features

  • Easy to use clean python interface for Q-Chem
  • No special q-chem installation needed (reads Q-Chem environment)
  • Output parsers for different type of calculations
  • Custom basis set and guess support using high level interface
  • Calculation Cache system powered by SQLite database
  • python 2.7.x/3.5+ compatibility

Installation instructions

  1. Requirements
  • numpy
  • scipy
  • matplotlib
  • requests
  • lxml
  • wfnsympy (optional)
  • paramiko (optional)
  • pymatgen (optional)

2a. From pypi repository (recommended)

pip install pyqchem --user

2b. Installation from source

python setup.py install --user

Examples

Simple pythonic API to define your input

from pyqchem import Structure, QchemInput, get_output_from_qchem
from pyqchem.parsers.basic import basic_parser_qchem

molecule = Structure(coordinates=[[0.0, 0.0, 0.0],
                                  [0.0, 0.0, 0.9]],
                     symbols=['H', 'H'],
                     charge=0,
                     multiplicity=1)

qc_input = QchemInput(molecule,
                      jobtype='sp',
                      exchange='hf',
                      basis='6-31G')

data = get_output_from_qchem(qc_input,
                             processors=4,
                             parser=basic_parser_qchem)

# obtain a python dictionary
print('Energy: ', data['scf_energy'])

Link calculations in powerful workflows

from pyqchem import QchemInput, get_output_from_qchem
from pyqchem.parsers.parser_optimization import basic_optimization
from pyqchem.parsers.parser_frequencies import basic_frequencies
from pyqchem.tools import get_geometry_from_pubchem

molecule = get_geometry_from_pubchem('aspirin')

qc_input = QchemInput(molecule,
                      jobtype='opt',
                      exchange='hf',
                      basis='sto-3g',
                      geom_opt_tol_gradient=300,
                      geom_opt_tol_energy=100,
                      geom_opt_tol_displacement=1200)

parsed_data, electronic_structure = get_output_from_qchem(qc_input,
                                                          processors=4,
                                                          parser=basic_optimization,
                                                          read_fchk=True)

qc_input = QchemInput(parsed_data['optimized_molecule'],
                      jobtype='freq',
                      exchange='hf',
                      basis='sto-3g',
                      scf_guess=electronic_structure['coefficients'])

parsed_data = get_output_from_qchem(qc_input,
                                    processors=4,
                                    parser=basic_frequencies)


for i, mode in enumerate(parsed_data['modes']):
    print('mode:                      {}'.format(i+1))
    print('frequency (cm-1):          {:10.2f}'.format(mode['frequency']))
    print('force constant (mdyne/A):  {:10.5f}\n'.format(mode['force_constant']))

Custom basis support

from pyqchem import QchemInput, Structure
from pyqchem.basis import get_basis_from_BSE


molecule = Structure(coordinates=[[0.0, 0.0, 0.0000],
                                  [0.0, 0.0, 1.5811]],
                     symbols=['Se', 'H'],
                     charge=-1,
                     multiplicity=1)

basis_custom = get_basis_from_BSE(molecule, 'cc-pVTZ')

qc_input = QchemInput(molecule,
                      jobtype='sp',
                      exchange='hf',
                      basis=basis_custom)

Handle qchem errors

from pyqchem import get_output_from_qchem
from pyqchem.errors import OutputError, ParserError
from pyqchem.parsers.parser_rasci import parser_rasci

try:
    parsed_data = get_output_from_qchem(qc_input,
                                        processors=4,
                                        parser=parser_rasci,
                                        )

except OutputError as e:
    print('Calculation ended with errors. Error lines:')
    print(e.error_lines)
    
    # Try to parse your output anyway
    try: 
        parsed_data = parser_rasci(e.full_output)
    except ParserError:
        print('Failed parsing')
        exit()


print('Energy: ', parsed_data['scf_energy'])

Additional example scripts are found at the examples folder

Contact info

Abel Carreras
abelcarreras83@gmail.com

Donostia International Physics Center (DIPC)
Donostia-San Sebastian (Spain)

Metadata

Release files for pyqchem 0.9.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyqchem 0.9.8
File Size Uploaded
pyqchem-0.9.8.tar.gz 56.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyqchem 0.9.8
File Interpreter ABI Platform
pyqchem-0.9.8-py3-none-any.whl Python 3 none any Details

Total release size: 118.2 kB

Release files / pyqchem-0.9.8.tar.gz

Download URL pyqchem-0.9.8.tar.gz
Size 56.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7cbbad9de913d71cb1d91ce9cf3b50fc3429f49097d90a261f83962b478aa0cb
BLAKE2b-256 checksum
How to use checksums
e681889fa0621b1dac70b0c1f23da225842c675cc3a14052f8e8e083fa03f73c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pyqchem-0.9.8-py3-none-any.whl

Download URL pyqchem-0.9.8-py3-none-any.whl
Size 62.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d875c9286416de720d9a14d6b56f4cfc8f9d8c2a6077d88263acd29f7f0d5944
BLAKE2b-256 checksum
How to use checksums
4b5876a3dbe6d2f47459afb1bb302211f5ecbae4b56486f6f8ce20ff1a677b5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.9.8 This release

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.8

2 release files

0.8.7

1 release file

0.8.6

1 release file

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.0

1 release file

0.7.0

1 release file

0.6.5

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.1

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page