Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# -*- coding: utf-8 -*- 

2# 

3# Copyright (c) 2019, the cclib development team 

4# 

5# This file is part of cclib (http://cclib.github.io) and is distributed under 

6# the terms of the BSD 3-Clause License. 

7 

8"""Bridge for using cclib data in PySCF (https://github.com/pyscf/pyscf).""" 

9 

10from cclib.parser.utils import find_package 

11 

12_found_pyscf = find_package("pyscf") 

13if _found_pyscf: 

14 from pyscf import gto 

15 

16 

17def _check_pyscf(found_pyscf): 

18 if not found_pyscf: 

19 raise ImportError("You must install `pyscf` to use this function") 

20 

21 

22def makepyscf(atomcoords, atomnos, charge=0, mult=1): 

23 """Create a Pyscf Molecule.""" 

24 _check_pyscf(_found_pyscf) 

25 mol = gto.Mole( 

26 atom = [['{}'.format(atomnos[i]),atomcoords[i]] for i in range(len(atomcoords))], 

27 unit="Angstrom", 

28 charge=charge, 

29 multiplicity=mult 

30 ) 

31 return mol 

32 

33del find_package