├── .codecov.yml ├── .github ├── CONTRIBUTING.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .lgtm.yml ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── Examples ├── B1_example_file_io │ ├── B1_water_b1lyp_H.json │ ├── B1_water_b1lyp_O.json │ ├── B1_water_b1lyp_whole.json │ ├── B1_water_blyp_H.json │ ├── B1_water_blyp_O.json │ ├── B1_water_blyp_whole.json │ └── water_B1.json ├── C0_example_file_io │ ├── C0_Oxygen_atom_casscf_whole.json │ └── Oxygen_atom_C0.json ├── CAS_example.ipynb ├── Example.ipynb ├── O.xyz ├── example_file_io.ipynb └── water.xyz ├── LICENSE ├── MultirefPredict ├── __init__.py ├── _version.py ├── basis_info.py ├── casbased_diagnostic.py ├── ccbased_diagnostic.py ├── cheminfo.py ├── data │ ├── README.md │ └── look_and_say.dat ├── diagnostic.py ├── ebased_diagnostic.py ├── fonbased_diagnostic.py ├── globs.py ├── io_tools.py ├── multirefpredict.py ├── scripts │ ├── generate_IND_density.py │ ├── jobscript_sge.sh │ ├── loop_run_diag.py │ ├── run_diagnostics_ebased.py │ └── run_fod_w_c0.py ├── spin.py └── tests │ ├── __init__.py │ ├── conftest.py │ ├── data │ ├── fon_cu_result.obj │ ├── fon_trityl_result.obj │ └── fon_trityl_task.obj │ ├── test_MultirefPredict.py │ ├── test_basis_info.py │ ├── test_casbased.py │ ├── test_ccbased.py │ ├── test_cheminfo.py │ ├── test_ebased.py │ ├── test_fonbased.py │ └── test_spin.py ├── README.md ├── devtools ├── README.md ├── conda-envs │ └── test_env.yaml ├── conda-recipe │ ├── bld.bat │ ├── build.sh │ └── meta.yaml ├── scripts │ └── create_conda_env.py └── travis-ci │ └── before_install.sh ├── docs ├── Makefile ├── README.md ├── _static │ └── README.md ├── _templates │ └── README.md ├── conf.py ├── examples.rst ├── index.rst ├── installation.rst ├── make.bat └── usage.rst ├── setup.cfg ├── setup.py └── versioneer.py /.codecov.yml: -------------------------------------------------------------------------------- 1 | # Codecov configuration to make it a bit less noisy 2 | coverage: 3 | status: 4 | patch: false 5 | project: 6 | default: 7 | threshold: 50% 8 | comment: 9 | layout: "header" 10 | require_changes: false 11 | branches: null 12 | behavior: default 13 | flags: null 14 | paths: null -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We welcome contributions from external contributors, and this document 4 | describes how to merge code changes into this MultirefPredict. 5 | 6 | ## Getting Started 7 | 8 | * Make sure you have a [GitHub account](https://github.com/signup/free). 9 | * [Fork](https://help.github.com/articles/fork-a-repo/) this repository on GitHub. 10 | * On your local machine, 11 | [clone](https://help.github.com/articles/cloning-a-repository/) your fork of 12 | the repository. 13 | 14 | ## Making Changes 15 | 16 | * Add some really awesome code to your local fork. It's usually a [good 17 | idea](http://blog.jasonmeridth.com/posts/do-not-issue-pull-requests-from-your-master-branch/) 18 | to make changes on a 19 | [branch](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/) 20 | with the branch name relating to the feature you are going to add. 21 | * When you are ready for others to examine and comment on your new feature, 22 | navigate to your fork of MultirefPredict on GitHub and open a [pull 23 | request](https://help.github.com/articles/using-pull-requests/) (PR). Note that 24 | after you launch a PR from one of your fork's branches, all 25 | subsequent commits to that branch will be added to the open pull request 26 | automatically. Each commit added to the PR will be validated for 27 | mergability, compilation and test suite compliance; the results of these tests 28 | will be visible on the PR page. 29 | * If you're providing a new feature, you must add test cases and documentation. 30 | * When the code is ready to go, make sure you run the test suite using pytest. 31 | * When you're ready to be considered for merging, check the "Ready to go" 32 | box on the PR page to let the MultirefPredict devs know that the changes are complete. 33 | The code will not be merged until this box is checked, the continuous 34 | integration returns checkmarks, 35 | and multiple core developers give "Approved" reviews. 36 | 37 | # Additional Resources 38 | 39 | * [General GitHub documentation](https://help.github.com/) 40 | * [PR best practices](http://codeinthehole.com/writing/pull-requests-and-other-good-practices-for-teams-using-github/) 41 | * [A guide to contributing to software packages](http://www.contribution-guide.org) 42 | * [Thinkful PR example](http://www.thinkful.com/learn/github-pull-request-tutorial/#Time-to-Submit-Your-First-PR) 43 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | Provide a brief description of the PR's purpose here. 3 | 4 | ## Todos 5 | Notable points that this PR has either accomplished or will accomplish. 6 | - [ ] TODO 1 7 | 8 | ## Questions 9 | - [ ] Question1 10 | 11 | ## Status 12 | - [ ] Ready to go -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | .pytest_cache 45 | nosetests.xml 46 | coverage.xml 47 | *.cover 48 | .hypothesis/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | 58 | # Flask stuff: 59 | instance/ 60 | .webassets-cache 61 | 62 | # Scrapy stuff: 63 | .scrapy 64 | 65 | # Sphinx documentation 66 | docs/_build/ 67 | 68 | # PyBuilder 69 | target/ 70 | 71 | # Jupyter Notebook 72 | .ipynb_checkpoints 73 | 74 | # pyenv 75 | .python-version 76 | 77 | # celery beat schedule file 78 | celerybeat-schedule 79 | 80 | # SageMath parsed files 81 | *.sage.py 82 | 83 | # dotenv 84 | .env 85 | 86 | # virtualenv 87 | .venv 88 | venv/ 89 | ENV/ 90 | 91 | # Spyder project settings 92 | .spyderproject 93 | .spyproject 94 | 95 | # Rope project settings 96 | .ropeproject 97 | 98 | # mkdocs documentation 99 | /site 100 | 101 | # mypy 102 | .mypy_cache/ 103 | 104 | # test result files 105 | timer.dat 106 | -------------------------------------------------------------------------------- /.lgtm.yml: -------------------------------------------------------------------------------- 1 | # Configure LGTM for this package 2 | 3 | extraction: 4 | python: # Configure Python 5 | python_setup: # Configure the setup 6 | version: 3 # Specify Version 3 7 | path_classifiers: 8 | library: 9 | - versioneer.py # Set Versioneer.py to an external "library" (3rd party code) 10 | - devtools/* 11 | generated: 12 | - MultirefPredict/_version.py 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | # Run jobs on container-based infrastructure, can be overridden per job 4 | 5 | matrix: 6 | include: 7 | # Extra includes for OSX since python language is not available by default on OSX 8 | - os: linux 9 | language: generic # No need to set Python version since its conda 10 | env: PYTHON_VER=3.6 11 | 12 | before_install: 13 | # Additional info about the build 14 | - uname -a 15 | - df -h 16 | - ulimit -a 17 | 18 | # Install the Python environment 19 | - source devtools/travis-ci/before_install.sh 20 | - python -V 21 | 22 | install: 23 | 24 | # Create test environment for package 25 | - python devtools/scripts/create_conda_env.py -n=test -p=$PYTHON_VER devtools/conda-envs/test_env.yaml 26 | # Activate the test environment 27 | - source activate test 28 | # Build and install package 29 | - python setup.py develop --no-deps 30 | 31 | 32 | script: 33 | - pytest -vv --cov=MultirefPredict MultirefPredict/tests/ 34 | 35 | notifications: 36 | email: false 37 | 38 | after_success: 39 | - codecov 40 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, 8 | body size, disability, ethnicity, gender identity and expression, level of 9 | experience, nationality, personal appearance, race, religion, or sexual 10 | identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment include: 15 | 16 | * Using welcoming and inclusive language 17 | * Being respectful of differing viewpoints and experiences 18 | * Gracefully accepting constructive criticism 19 | * Focusing on what is best for the community 20 | * Showing empathy towards other community members 21 | 22 | Examples of unacceptable behavior by participants include: 23 | 24 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 25 | * Trolling, insulting/derogatory comments, and personal or political attacks 26 | * Public or private harassment 27 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 28 | * Other conduct which could reasonably be considered inappropriate in a professional setting 29 | 30 | ## Our Responsibilities 31 | 32 | Project maintainers are responsible for clarifying the standards of acceptable 33 | behavior and are expected to take appropriate and fair corrective action in 34 | response to any instances of unacceptable behavior. 35 | 36 | Project maintainers have the right and responsibility to remove, edit, or 37 | reject comments, commits, code, wiki edits, issues, and other contributions 38 | that are not aligned to this Code of Conduct, or to ban temporarily or 39 | permanently any contributor for other behaviors that they deem inappropriate, 40 | threatening, offensive, or harmful. 41 | 42 | Moreover, project maintainers will strive to offer feedback and advice to 43 | ensure quality and consistency of contributions to the code. Contributions 44 | from outside the group of project maintainers are strongly welcomed but the 45 | final decision as to whether commits are merged into the codebase rests with 46 | the team of project maintainers. 47 | 48 | ## Scope 49 | 50 | This Code of Conduct applies both within project spaces and in public spaces 51 | when an individual is representing the project or its community. Examples of 52 | representing a project or community include using an official project e-mail 53 | address, posting via an official social media account, or acting as an 54 | appointed representative at an online or offline event. Representation of a 55 | project may be further defined and clarified by project maintainers. 56 | 57 | ## Enforcement 58 | 59 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 60 | reported by contacting the project team at 'fangliu@mit.edu'. The project team will 61 | review and investigate all complaints, and will respond in a way that it deems 62 | appropriate to the circumstances. The project team is obligated to maintain 63 | confidentiality with regard to the reporter of an incident. Further details of 64 | specific enforcement policies may be posted separately. 65 | 66 | Project maintainers who do not follow or enforce the Code of Conduct in good 67 | faith may face temporary or permanent repercussions as determined by other 68 | members of the project's leadership. 69 | 70 | ## Attribution 71 | 72 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 73 | version 1.4, available at 74 | [http://contributor-covenant.org/version/1/4][version] 75 | 76 | [homepage]: http://contributor-covenant.org 77 | [version]: http://contributor-covenant.org/version/1/4/ 78 | -------------------------------------------------------------------------------- /Examples/B1_example_file_io/B1_water_b1lyp_H.json: -------------------------------------------------------------------------------- 1 | {"molecule": {"symbols": ["H"], "geometry": [0.0, 0.0, 0.0], "schema_name": "qcschema_molecule", "schema_version": 2, "name": "H", "molecular_charge": 0.0, "molecular_multiplicity": 2, "masses": [1.00782503223], "real": [true], "atom_labels": [""], "atomic_numbers": [1], "mass_numbers": [1], "fragments": [[0]], "fragment_charges": [0.0], "fragment_multiplicities": [2], "fix_com": false, "fix_orientation": false, "provenance": {"creator": "QCElemental", "version": "v0.3.3", "routine": "qcelemental.molparse.from_schema"}}, "driver": "energy", "model": {"method": "b1lyp", "basis": "6-31g"}, "id": null, "schema_name": "qcschema_output", "schema_version": 1, "keywords": {"reference": "uhf"}, "extras": {"local_qcvars": {"-D ENERGY": 0.0, "CURRENT DIPOLE X": 0.0, "CURRENT DIPOLE Y": 0.0, "CURRENT DIPOLE Z": 0.0, "CURRENT ENERGY": -0.4961395415845222, "CURRENT REFERENCE ENERGY": -0.4961395415845222, "DFT FUNCTIONAL TOTAL ENERGY": -0.4961395415845222, "DFT TOTAL ENERGY": -0.4961395415845222, "DFT VV10 ENERGY": 0.0, "DFT XC ENERGY": -0.2346654137534683, "NUCLEAR REPULSION ENERGY": 0.0, "ONE-ELECTRON ENERGY": -0.4982211482439674, "PCM POLARIZATION ENERGY": 0.0, "SCF DIPOLE X": 0.0, "SCF DIPOLE Y": 0.0, "SCF DIPOLE Z": 0.0, "SCF ITERATION ENERGY": -0.4961395415845222, "SCF ITERATIONS": 3.0, "SCF TOTAL ENERGY": -0.4961395415845222, "TWO-ELECTRON ENERGY": 0.23674702041291343}}, "provenance": {"creator": "Psi4", "version": "1.3", "routine": "psi4.json.run_json", "nthreads": 2, "wall_time": 0.7223670482635498, "cpu": "Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz", "hostname": "duancheudesktop", "qcengine_version": "v0.6.4", "username": "duanchenru", "memory": 2.561}, "properties": {"calcinfo_nbasis": 2, "calcinfo_nmo": 2, "calcinfo_nalpha": 1, "calcinfo_nbeta": 0, "calcinfo_natom": 1, "nuclear_repulsion_energy": 0.0, "return_energy": -0.4961395415845222, "scf_one_electron_energy": -0.4982211482439674, "scf_two_electron_energy": 0.23674702041291343, "scf_xc_energy": -0.2346654137534683, "scf_dipole_moment": null, "scf_total_energy": -0.4961395415845222, "scf_iterations": 3}, "return_result": -0.4961395415845222, "success": true, "stdout": "\n Memory set to 2.561 GiB by Python driver.\n\n*** tstart() called on duancheudesktop\n*** at Tue Mar 26 10:59:20 2019\n\n => Loading Basis Set <=\n\n Name: 6-31G\n Role: ORBITAL\n Keyword: BASIS\n atoms 1 entry H line 26 file /anaconda2/envs/qcengine/share/psi4/basis/6-31g.gbs \n\n\n ---------------------------------------------------------\n SCF\n by Justin Turney, Rob Parrish, Andy Simmonett\n and Daniel G. A. Smith\n UKS Reference\n 2 Threads, 2622 MiB Core\n ---------------------------------------------------------\n\n ==> Geometry <==\n\n Molecular point group: d2h\n Geometry (in Bohr), charge = 0, multiplicity = 2:\n\n Center X Y Z Mass \n ------------ ----------------- ----------------- ----------------- -----------------\n H 0.000000000000 0.000000000000 0.000000000000 1.007825032230\n\n Running in d2h symmetry.\n\n Rotational constants: A = ************ B = ************ C = ************ [cm^-1]\n Rotational constants: A = ************ B = ************ C = ************ [MHz]\n Nuclear repulsion = 0.000000000000000\n\n Charge = 0\n Multiplicity = 2\n Electrons = 1\n Nalpha = 1\n Nbeta = 0\n\n ==> Algorithm <==\n\n SCF Algorithm Type is DF.\n DIIS enabled.\n MOM disabled.\n Fractional occupation disabled.\n Guess Type is CORE.\n Energy threshold = 1.00e-06\n Density threshold = 1.00e-06\n Integral threshold = 0.00e+00\n\n ==> Primary Basis <==\n\n Basis Set: 6-31G\n Blend: 6-31G\n Number of shells: 2\n Number of basis function: 2\n Number of Cartesian functions: 2\n Spherical Harmonics?: false\n Max angular momentum: 0\n\n ==> DFT Potential <==\n\n => Composite Functional: B1LYP <= \n\n B1LYP Hyb-GGA Exchange-Correlation Functional\n\n C. Adamo and V. Barone, Chem. Phys. Lett. 274, 242 (1997)\n\n Deriv = 1\n GGA = TRUE\n Meta = FALSE\n\n Exchange Hybrid = TRUE\n MP2 Hybrid = FALSE\n\n => Exchange Functionals <=\n\n 0.7500 Becke 88\n\n => Exact (HF) Exchange <=\n\n 0.2500 HF \n\n => Correlation Functionals <=\n\n 1.0000 Lee, Yang & Parr\n\n => Molecular Quadrature <=\n\n Radial Scheme = TREUTLER\n Pruning Scheme = FLAT\n Nuclear Scheme = TREUTLER\n\n BS radius alpha = 1\n Pruning alpha = 1\n Radial Points = 75\n Spherical Points = 302\n Total Points = 22046\n Total Blocks = 221\n Max Points = 251\n Max Functions = 2\n\n => Loading Basis Set <=\n\n Name: (6-31G AUX)\n Role: JKFIT\n Keyword: DF_BASIS_SCF\n atoms 1 entry H line 51 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n\n ==> Pre-Iterations <==\n\n -------------------------------------------------------\n Irrep Nso Nmo Nalpha Nbeta Ndocc Nsocc\n -------------------------------------------------------\n Ag 2 2 0 0 0 0\n B1g 0 0 0 0 0 0\n B2g 0 0 0 0 0 0\n B3g 0 0 0 0 0 0\n Au 0 0 0 0 0 0\n B1u 0 0 0 0 0 0\n B2u 0 0 0 0 0 0\n B3u 0 0 0 0 0 0\n -------------------------------------------------------\n Total 2 2 1 0 0 1\n -------------------------------------------------------\n\n ==> Integral Setup <==\n\n DFHelper Memory: AOs need 0.000 GiB; user supplied 1.920 GiB. Using in-core AOs.\n\n ==> MemDFJK: Density-Fitted J/K Matrices <==\n\n J tasked: Yes\n K tasked: Yes\n wK tasked: No\n OpenMP threads: 2\n Memory [MiB]: 1965\n Algorithm: Core\n Schwarz Cutoff: 1E-12\n Mask sparsity (%): 0.0000\n Fitting Condition: 1E-10\n\n => Auxiliary Basis Set <=\n\n Basis Set: (6-31G AUX)\n Blend: CC-PVDZ-JKFIT\n Number of shells: 9\n Number of basis function: 25\n Number of Cartesian functions: 25\n Spherical Harmonics?: false\n Max angular momentum: 2\n\n Cached 100.0% of DFT collocation blocks in 0.001 [GiB].\n\n Minimum eigenvalue in the overlap matrix is 3.4170795066E-01.\n Using Symmetric Orthogonalization.\n\n SCF Guess: Core (One-Electron) Hamiltonian.\n\n ==> Iterations <==\n\n Total Energy Delta E RMS |[F,P]|\n\n @DF-UKS iter 1: -0.49612735636453 -4.96127e-01 1.73964e-03 DIIS\n @DF-UKS iter 2: -0.49613950642345 -1.21501e-05 9.34689e-05 DIIS\n @DF-UKS iter 3: -0.49613954158452 -3.51611e-08 3.60664e-08 DIIS\n Energy and wave function converged.\n\n\n ==> Post-Iterations <==\n\n @Spin Contamination Metric: 0.000000000E+00\n @S^2 Expected: 7.500000000E-01\n @S^2 Observed: 7.500000000E-01\n @S Expected: 5.000000000E-01\n @S Observed: 5.000000000E-01\n\n Orbital Energies [Eh]\n ---------------------\n\n Alpha Occupied: \n\n 1Ag -0.322141 \n\n Alpha Virtual: \n\n 2Ag 0.727768 \n\n Beta Occupied: \n\n \n\n Beta Virtual: \n\n 1Ag -11183378.663837 2Ag -456020.850360 \n\n Final Occupation by Irrep:\n Ag B1g B2g B3g Au B1u B2u B3u \n DOCC [ 0, 0, 0, 0, 0, 0, 0, 0 ]\n SOCC [ 1, 0, 0, 0, 0, 0, 0, 0 ]\n\n @DF-UKS Final Energy: -0.49613954158452\n\n => Energetics <=\n\n Nuclear Repulsion Energy = 0.0000000000000000\n One-Electron Energy = -0.4982211482439674\n Two-Electron Energy = 0.2367470204129134\n DFT Exchange-Correlation Energy = -0.2346654137534683\n Empirical Dispersion Energy = 0.0000000000000000\n VV10 Nonlocal Energy = 0.0000000000000000\n Total Energy = -0.4961395415845222\n\n UHF NO Occupations:\n HONO-0 : 1 Ag 1.0000000\n LUNO+0 : 2 Ag 0.0000000\n\n\nComputation Completed\n\n\nProperties will be evaluated at 0.000000, 0.000000, 0.000000 [a0]\n\nProperties computed using the SCF density matrix\n\n Nuclear Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Electronic Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n Dipole Moment: [D]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n\n*** tstop() called on duancheudesktop at Tue Mar 26 10:59:21 2019\nModule time:\n\tuser time = 0.35 seconds = 0.01 minutes\n\tsystem time = 0.02 seconds = 0.00 minutes\n\ttotal time = 1 seconds = 0.02 minutes\nTotal time:\n\tuser time = 0.35 seconds = 0.01 minutes\n\tsystem time = 0.02 seconds = 0.00 minutes\n\ttotal time = 1 seconds = 0.02 minutes\n", "stderr": null, "error": null} -------------------------------------------------------------------------------- /Examples/B1_example_file_io/B1_water_b1lyp_O.json: -------------------------------------------------------------------------------- 1 | {"molecule": {"symbols": ["O"], "geometry": [0.0, 0.0, 0.0], "schema_name": "qcschema_molecule", "schema_version": 2, "name": "O", "molecular_charge": 0.0, "molecular_multiplicity": 3, "masses": [15.99491461957], "real": [true], "atom_labels": [""], "atomic_numbers": [8], "mass_numbers": [16], "fragments": [[0]], "fragment_charges": [0.0], "fragment_multiplicities": [3], "fix_com": false, "fix_orientation": false, "provenance": {"creator": "QCElemental", "version": "v0.3.3", "routine": "qcelemental.molparse.from_schema"}}, "driver": "energy", "model": {"method": "b1lyp", "basis": "6-31g"}, "id": null, "schema_name": "qcschema_output", "schema_version": 1, "keywords": {"reference": "uhf"}, "extras": {"local_qcvars": {"-D ENERGY": 0.0, "CURRENT DIPOLE X": 0.0, "CURRENT DIPOLE Y": 0.0, "CURRENT DIPOLE Z": 0.0, "CURRENT ENERGY": -75.04291669173486, "CURRENT REFERENCE ENERGY": -75.04291669173486, "DFT FUNCTIONAL TOTAL ENERGY": -75.04291669173486, "DFT TOTAL ENERGY": -75.04291669173486, "DFT VV10 ENERGY": 0.0, "DFT XC ENERGY": -6.418344996190261, "NUCLEAR REPULSION ENERGY": 0.0, "ONE-ELECTRON ENERGY": -103.24863896778923, "PCM POLARIZATION ENERGY": 0.0, "SCF DIPOLE X": 0.0, "SCF DIPOLE Y": 0.0, "SCF DIPOLE Z": 0.0, "SCF ITERATION ENERGY": -75.04291669173486, "SCF ITERATIONS": 8.0, "SCF TOTAL ENERGY": -75.04291669173486, "TWO-ELECTRON ENERGY": 34.62406727224464}}, "provenance": {"creator": "Psi4", "version": "1.3", "routine": "psi4.json.run_json", "nthreads": 2, "wall_time": 0.816399097442627, "cpu": "Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz", "hostname": "duancheudesktop", "qcengine_version": "v0.6.4", "username": "duanchenru", "memory": 2.561}, "properties": {"calcinfo_nbasis": 9, "calcinfo_nmo": 9, "calcinfo_nalpha": 5, "calcinfo_nbeta": 3, "calcinfo_natom": 1, "nuclear_repulsion_energy": 0.0, "return_energy": -75.04291669173486, "scf_one_electron_energy": -103.24863896778923, "scf_two_electron_energy": 34.62406727224464, "scf_xc_energy": -6.418344996190261, "scf_dipole_moment": null, "scf_total_energy": -75.04291669173486, "scf_iterations": 8}, "return_result": -75.04291669173486, "success": true, "stdout": "\n Memory set to 2.561 GiB by Python driver.\n\n*** tstart() called on duancheudesktop\n*** at Tue Mar 26 10:59:20 2019\n\n => Loading Basis Set <=\n\n Name: 6-31G\n Role: ORBITAL\n Keyword: BASIS\n atoms 1 entry O line 117 file /anaconda2/envs/qcengine/share/psi4/basis/6-31g.gbs \n\n\n ---------------------------------------------------------\n SCF\n by Justin Turney, Rob Parrish, Andy Simmonett\n and Daniel G. A. Smith\n UKS Reference\n 2 Threads, 2622 MiB Core\n ---------------------------------------------------------\n\n ==> Geometry <==\n\n Molecular point group: d2h\n Geometry (in Bohr), charge = 0, multiplicity = 3:\n\n Center X Y Z Mass \n ------------ ----------------- ----------------- ----------------- -----------------\n O 0.000000000000 0.000000000000 0.000000000000 15.994914619570\n\n Running in d2h symmetry.\n\n Rotational constants: A = ************ B = ************ C = ************ [cm^-1]\n Rotational constants: A = ************ B = ************ C = ************ [MHz]\n Nuclear repulsion = 0.000000000000000\n\n Charge = 0\n Multiplicity = 3\n Electrons = 8\n Nalpha = 5\n Nbeta = 3\n\n ==> Algorithm <==\n\n SCF Algorithm Type is DF.\n DIIS enabled.\n MOM disabled.\n Fractional occupation disabled.\n Guess Type is CORE.\n Energy threshold = 1.00e-06\n Density threshold = 1.00e-06\n Integral threshold = 0.00e+00\n\n ==> Primary Basis <==\n\n Basis Set: 6-31G\n Blend: 6-31G\n Number of shells: 5\n Number of basis function: 9\n Number of Cartesian functions: 9\n Spherical Harmonics?: false\n Max angular momentum: 1\n\n ==> DFT Potential <==\n\n => Composite Functional: B1LYP <= \n\n B1LYP Hyb-GGA Exchange-Correlation Functional\n\n C. Adamo and V. Barone, Chem. Phys. Lett. 274, 242 (1997)\n\n Deriv = 1\n GGA = TRUE\n Meta = FALSE\n\n Exchange Hybrid = TRUE\n MP2 Hybrid = FALSE\n\n => Exchange Functionals <=\n\n 0.7500 Becke 88\n\n => Exact (HF) Exchange <=\n\n 0.2500 HF \n\n => Correlation Functionals <=\n\n 1.0000 Lee, Yang & Parr\n\n => Molecular Quadrature <=\n\n Radial Scheme = TREUTLER\n Pruning Scheme = FLAT\n Nuclear Scheme = TREUTLER\n\n BS radius alpha = 1\n Pruning alpha = 1\n Radial Points = 75\n Spherical Points = 302\n Total Points = 20234\n Total Blocks = 207\n Max Points = 254\n Max Functions = 9\n\n => Loading Basis Set <=\n\n Name: (6-31G AUX)\n Role: JKFIT\n Keyword: DF_BASIS_SCF\n atoms 1 entry O line 221 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n\n ==> Pre-Iterations <==\n\n -------------------------------------------------------\n Irrep Nso Nmo Nalpha Nbeta Ndocc Nsocc\n -------------------------------------------------------\n Ag 3 3 0 0 0 0\n B1g 0 0 0 0 0 0\n B2g 0 0 0 0 0 0\n B3g 0 0 0 0 0 0\n Au 0 0 0 0 0 0\n B1u 2 2 0 0 0 0\n B2u 2 2 0 0 0 0\n B3u 2 2 0 0 0 0\n -------------------------------------------------------\n Total 9 9 5 3 3 2\n -------------------------------------------------------\n\n ==> Integral Setup <==\n\n DFHelper Memory: AOs need 0.000 GiB; user supplied 1.916 GiB. Using in-core AOs.\n\n ==> MemDFJK: Density-Fitted J/K Matrices <==\n\n J tasked: Yes\n K tasked: Yes\n wK tasked: No\n OpenMP threads: 2\n Memory [MiB]: 1961\n Algorithm: Core\n Schwarz Cutoff: 1E-12\n Mask sparsity (%): 0.0000\n Fitting Condition: 1E-10\n\n => Auxiliary Basis Set <=\n\n Basis Set: (6-31G AUX)\n Blend: CC-PVDZ-JKFIT\n Number of shells: 24\n Number of basis function: 81\n Number of Cartesian functions: 81\n Spherical Harmonics?: false\n Max angular momentum: 3\n\n Cached 100.0% of DFT collocation blocks in 0.005 [GiB].\n\n Minimum eigenvalue in the overlap matrix is 2.3327163930E-01.\n Using Symmetric Orthogonalization.\n\n SCF Guess: Core (One-Electron) Hamiltonian.\n\n ==> Iterations <==\n\n Total Energy Delta E RMS |[F,P]|\n\n @DF-UKS iter 1: -72.50501001626166 -7.25050e+01 3.68703e-01 DIIS\n @DF-UKS iter 2: -73.80796001559420 -1.30295e+00 3.64440e-01 DIIS\n @DF-UKS iter 3: -75.03237066461453 -1.22441e+00 3.45982e-02 DIIS\n @DF-UKS iter 4: -75.04286844267300 -1.04978e-02 2.39572e-03 DIIS\n @DF-UKS iter 5: -75.04291635155738 -4.79089e-05 1.67648e-04 DIIS\n @DF-UKS iter 6: -75.04291667686979 -3.25312e-07 3.89341e-05 DIIS\n @DF-UKS iter 7: -75.04291669158603 -1.47162e-08 4.14744e-06 DIIS\n @DF-UKS iter 8: -75.04291669173486 -1.48830e-10 2.06229e-07 DIIS\n Energy and wave function converged.\n\n\n ==> Post-Iterations <==\n\n @Spin Contamination Metric: 1.548843319E-03\n @S^2 Expected: 2.000000000E+00\n @S^2 Observed: 2.001548843E+00\n @S Expected: 1.000000000E+00\n @S Observed: 1.000000000E+00\n\n Orbital Energies [Eh]\n ---------------------\n\n Alpha Occupied: \n\n 1Ag -19.380655 2Ag -1.026157 1B3u -0.456956 \n 1B2u -0.456956 1B1u -0.381173 \n\n Alpha Virtual: \n\n 2B2u 0.811231 2B3u 0.811231 2B1u 0.858845 \n 3Ag 0.937324 \n\n Beta Occupied: \n\n 1Ag -19.329803 2Ag -0.859132 1B1u -0.324889 \n\n Beta Virtual: \n\n 1B3u -0.143471 1B2u -0.143471 2B1u 0.888594 \n 2B2u 0.926895 2B3u 0.926895 3Ag 1.013294 \n\n Final Occupation by Irrep:\n Ag B1g B2g B3g Au B1u B2u B3u \n DOCC [ 2, 0, 0, 0, 0, 1, 0, 0 ]\n SOCC [ 0, 0, 0, 0, 0, 0, 1, 1 ]\n\n @DF-UKS Final Energy: -75.04291669173486\n\n => Energetics <=\n\n Nuclear Repulsion Energy = 0.0000000000000000\n One-Electron Energy = -103.2486389677892333\n Two-Electron Energy = 34.6240672722446376\n DFT Exchange-Correlation Energy = -6.4183449961902612\n Empirical Dispersion Energy = 0.0000000000000000\n VV10 Nonlocal Energy = 0.0000000000000000\n Total Energy = -75.0429166917348596\n\n UHF NO Occupations:\n HONO-2 : 2 Ag 1.9995109\n HONO-1 : 1B2u 1.0000000\n HONO-0 : 1B3u 1.0000000\n LUNO+0 : 3 Ag 0.0004891\n LUNO+1 : 2B1u 0.0002855\n LUNO+2 : 2B2u 0.0000000\n LUNO+3 : 2B3u -0.0000000\n\n\nComputation Completed\n\n\nProperties will be evaluated at 0.000000, 0.000000, 0.000000 [a0]\n\nProperties computed using the SCF density matrix\n\n Nuclear Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Electronic Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n Dipole Moment: [D]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n\n*** tstop() called on duancheudesktop at Tue Mar 26 10:59:20 2019\nModule time:\n\tuser time = 0.54 seconds = 0.01 minutes\n\tsystem time = 0.03 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\nTotal time:\n\tuser time = 0.54 seconds = 0.01 minutes\n\tsystem time = 0.03 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\n", "stderr": null, "error": null} -------------------------------------------------------------------------------- /Examples/B1_example_file_io/B1_water_b1lyp_whole.json: -------------------------------------------------------------------------------- 1 | {"molecule": {"symbols": ["O", "H", "H"], "geometry": [0.0, 0.0, -0.12947694, 0.0, -1.49418734, 1.02744651, 0.0, 1.49418734, 1.02744651], "schema_name": "qcschema_molecule", "schema_version": 2, "name": "H2O", "molecular_charge": 0.0, "molecular_multiplicity": 1, "masses": [15.99491461957, 1.00782503223, 1.00782503223], "real": [true, true, true], "atom_labels": ["", "", ""], "atomic_numbers": [8, 1, 1], "mass_numbers": [16, 1, 1], "fragments": [[0, 1, 2]], "fragment_charges": [0.0], "fragment_multiplicities": [1], "fix_com": false, "fix_orientation": false, "provenance": {"creator": "QCElemental", "version": "v0.3.3", "routine": "qcelemental.molparse.from_schema"}}, "driver": "energy", "model": {"method": "b1lyp", "basis": "6-31g"}, "id": null, "schema_name": "qcschema_output", "schema_version": 1, "keywords": {}, "extras": {"local_qcvars": {"-D ENERGY": 0.0, "CURRENT DIPOLE X": 0.0, "CURRENT DIPOLE Y": 0.0, "CURRENT DIPOLE Z": 2.448125060195018, "CURRENT ENERGY": -76.35352873949464, "CURRENT REFERENCE ENERGY": -76.35352873949464, "DFT FUNCTIONAL TOTAL ENERGY": -76.3535287394946, "DFT TOTAL ENERGY": -76.3535287394946, "DFT VV10 ENERGY": 0.0, "DFT XC ENERGY": -7.061470611748099, "NUCLEAR REPULSION ENERGY": 8.80146205625184, "ONE-ELECTRON ENERGY": -122.35235327243205, "PCM POLARIZATION ENERGY": 0.0, "SCF DIPOLE X": 0.0, "SCF DIPOLE Y": 0.0, "SCF DIPOLE Z": 2.448125060195018, "SCF ITERATION ENERGY": -76.35352873949464, "SCF ITERATIONS": 7.0, "SCF TOTAL ENERGY": -76.35352873949464, "TWO-ELECTRON ENERGY": 44.2588330884337}}, "provenance": {"creator": "Psi4", "version": "1.3", "routine": "psi4.json.run_json", "nthreads": 2, "wall_time": 0.998798131942749, "cpu": "Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz", "hostname": "duancheudesktop", "qcengine_version": "v0.6.4", "username": "duanchenru", "memory": 2.561}, "properties": {"calcinfo_nbasis": 13, "calcinfo_nmo": 13, "calcinfo_nalpha": 5, "calcinfo_nbeta": 5, "calcinfo_natom": 3, "nuclear_repulsion_energy": 8.80146205625184, "return_energy": -76.35352873949464, "scf_one_electron_energy": -122.35235327243205, "scf_two_electron_energy": 44.2588330884337, "scf_xc_energy": -7.061470611748099, "scf_dipole_moment": [0.0, 0.0, 2.448125060195018], "scf_total_energy": -76.35352873949464, "scf_iterations": 7}, "return_result": -76.35352873949464, "success": true, "stdout": "\n Memory set to 2.561 GiB by Python driver.\n\n*** tstart() called on duancheudesktop\n*** at Tue Mar 26 10:59:19 2019\n\n => Loading Basis Set <=\n\n Name: 6-31G\n Role: ORBITAL\n Keyword: BASIS\n atoms 1 entry O line 117 file /anaconda2/envs/qcengine/share/psi4/basis/6-31g.gbs \n atoms 2-3 entry H line 26 file /anaconda2/envs/qcengine/share/psi4/basis/6-31g.gbs \n\n\n ---------------------------------------------------------\n SCF\n by Justin Turney, Rob Parrish, Andy Simmonett\n and Daniel G. A. Smith\n RKS Reference\n 2 Threads, 2622 MiB Core\n ---------------------------------------------------------\n\n ==> Geometry <==\n\n Molecular point group: c2v\n Full point group: C2v\n\n Geometry (in Bohr), charge = 0, multiplicity = 1:\n\n Center X Y Z Mass \n ------------ ----------------- ----------------- ----------------- -----------------\n O 0.000000000000 0.000000000000 -0.129476941311 15.994914619570\n H 0.000000000000 -1.494187340000 1.027446508689 1.007825032230\n H -0.000000000000 1.494187340000 1.027446508689 1.007825032230\n\n Running in c2v symmetry.\n\n Rotational constants: A = 25.12553 B = 13.37732 C = 8.72954 [cm^-1]\n Rotational constants: A = 753244.47060 B = 401041.84747 C = 261705.04610 [MHz]\n Nuclear repulsion = 8.801462056251840\n\n Charge = 0\n Multiplicity = 1\n Electrons = 10\n Nalpha = 5\n Nbeta = 5\n\n ==> Algorithm <==\n\n SCF Algorithm Type is DF.\n DIIS enabled.\n MOM disabled.\n Fractional occupation disabled.\n Guess Type is SAD.\n Energy threshold = 1.00e-06\n Density threshold = 1.00e-06\n Integral threshold = 0.00e+00\n\n ==> Primary Basis <==\n\n Basis Set: 6-31G\n Blend: 6-31G\n Number of shells: 9\n Number of basis function: 13\n Number of Cartesian functions: 13\n Spherical Harmonics?: false\n Max angular momentum: 1\n\n ==> DFT Potential <==\n\n => Composite Functional: B1LYP <= \n\n B1LYP Hyb-GGA Exchange-Correlation Functional\n\n C. Adamo and V. Barone, Chem. Phys. Lett. 274, 242 (1997)\n\n Deriv = 1\n GGA = TRUE\n Meta = FALSE\n\n Exchange Hybrid = TRUE\n MP2 Hybrid = FALSE\n\n => Exchange Functionals <=\n\n 0.7500 Becke 88\n\n => Exact (HF) Exchange <=\n\n 0.2500 HF \n\n => Correlation Functionals <=\n\n 1.0000 Lee, Yang & Parr\n\n => Molecular Quadrature <=\n\n Radial Scheme = TREUTLER\n Pruning Scheme = FLAT\n Nuclear Scheme = TREUTLER\n\n BS radius alpha = 1\n Pruning alpha = 1\n Radial Points = 75\n Spherical Points = 302\n Total Points = 65565\n Total Blocks = 556\n Max Points = 256\n Max Functions = 13\n\n => Loading Basis Set <=\n\n Name: (6-31G AUX)\n Role: JKFIT\n Keyword: DF_BASIS_SCF\n atoms 1 entry O line 221 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n atoms 2-3 entry H line 51 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n\n ==> Pre-Iterations <==\n\n -------------------------------------------------------\n Irrep Nso Nmo Nalpha Nbeta Ndocc Nsocc\n -------------------------------------------------------\n A1 7 7 0 0 0 0\n A2 0 0 0 0 0 0\n B1 2 2 0 0 0 0\n B2 4 4 0 0 0 0\n -------------------------------------------------------\n Total 13 13 5 5 5 0\n -------------------------------------------------------\n\n ==> Integral Setup <==\n\n DFHelper Memory: AOs need 0.000 GiB; user supplied 1.897 GiB. Using in-core AOs.\n\n ==> MemDFJK: Density-Fitted J/K Matrices <==\n\n J tasked: Yes\n K tasked: Yes\n wK tasked: No\n OpenMP threads: 2\n Memory [MiB]: 1942\n Algorithm: Core\n Schwarz Cutoff: 1E-12\n Mask sparsity (%): 0.0000\n Fitting Condition: 1E-10\n\n => Auxiliary Basis Set <=\n\n Basis Set: (6-31G AUX)\n Blend: CC-PVDZ-JKFIT\n Number of shells: 42\n Number of basis function: 131\n Number of Cartesian functions: 131\n Spherical Harmonics?: false\n Max angular momentum: 3\n\n Cached 100.0% of DFT collocation blocks in 0.024 [GiB].\n\n Minimum eigenvalue in the overlap matrix is 7.3923847791E-02.\n Using Symmetric Orthogonalization.\n\n SCF Guess: Superposition of Atomic Densities via on-the-fly atomic UHF.\n\n ==> Iterations <==\n\n Total Energy Delta E RMS |[F,P]|\n\n @DF-RKS iter SAD: -76.03259523907644 -7.60326e+01 0.00000e+00 \n @DF-RKS iter 1: -76.21027270889900 -1.77677e-01 7.27060e-02 DIIS\n @DF-RKS iter 2: -76.06621502205964 1.44058e-01 1.03428e-01 DIIS\n @DF-RKS iter 3: -76.35349456266324 -2.87280e-01 8.48263e-04 DIIS\n @DF-RKS iter 4: -76.35352767561236 -3.31129e-05 1.96575e-04 DIIS\n @DF-RKS iter 5: -76.35352873763711 -1.06202e-06 4.94732e-06 DIIS\n @DF-RKS iter 6: -76.35352873945605 -1.81895e-09 1.03876e-06 DIIS\n @DF-RKS iter 7: -76.35352873949464 -3.85825e-11 9.76977e-08 DIIS\n Energy and wave function converged.\n\n\n ==> Post-Iterations <==\n\n Orbital Energies [Eh]\n ---------------------\n\n Doubly Occupied: \n\n 1A1 -19.238347 2A1 -1.017402 1B2 -0.521521 \n 3A1 -0.364507 1B1 -0.299225 \n\n Virtual: \n\n 4A1 0.056718 2B2 0.144455 3B2 0.811690 \n 5A1 0.856752 2B1 0.909940 6A1 0.974393 \n 4B2 1.084768 7A1 1.438009 \n\n Final Occupation by Irrep:\n A1 A2 B1 B2 \n DOCC [ 3, 0, 1, 1 ]\n\n @DF-RKS Final Energy: -76.35352873949464\n\n => Energetics <=\n\n Nuclear Repulsion Energy = 8.8014620562518395\n One-Electron Energy = -122.3523532724320546\n Two-Electron Energy = 44.2588330884336969\n DFT Exchange-Correlation Energy = -7.0614706117480992\n Empirical Dispersion Energy = 0.0000000000000000\n VV10 Nonlocal Energy = 0.0000000000000000\n Total Energy = -76.3535287394946067\n\nComputation Completed\n\n\nProperties will be evaluated at 0.000000, 0.000000, 0.000000 [a0]\n\nProperties computed using the SCF density matrix\n\n Nuclear Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 1.0191\n\n Electronic Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: -0.0559\n\n Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.9632 Total: 0.9632\n\n Dipole Moment: [D]\n X: 0.0000 Y: 0.0000 Z: 2.4481 Total: 2.4481\n\n\n*** tstop() called on duancheudesktop at Tue Mar 26 10:59:19 2019\nModule time:\n\tuser time = 0.92 seconds = 0.02 minutes\n\tsystem time = 0.03 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\nTotal time:\n\tuser time = 0.92 seconds = 0.02 minutes\n\tsystem time = 0.03 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\n", "stderr": null, "error": null} -------------------------------------------------------------------------------- /Examples/B1_example_file_io/B1_water_blyp_H.json: -------------------------------------------------------------------------------- 1 | {"molecule": {"symbols": ["H"], "geometry": [0.0, 0.0, 0.0], "schema_name": "qcschema_molecule", "schema_version": 2, "name": "H", "molecular_charge": 0.0, "molecular_multiplicity": 2, "masses": [1.00782503223], "real": [true], "atom_labels": [""], "atomic_numbers": [1], "mass_numbers": [1], "fragments": [[0]], "fragment_charges": [0.0], "fragment_multiplicities": [2], "fix_com": false, "fix_orientation": false, "provenance": {"creator": "QCElemental", "version": "v0.3.3", "routine": "qcelemental.molparse.from_schema"}}, "driver": "energy", "model": {"method": "blyp", "basis": "6-31g"}, "id": null, "schema_name": "qcschema_output", "schema_version": 1, "keywords": {"reference": "uhf"}, "extras": {"local_qcvars": {"-D ENERGY": 0.0, "CURRENT DIPOLE X": 0.0, "CURRENT DIPOLE Y": 0.0, "CURRENT DIPOLE Z": 0.0, "CURRENT ENERGY": -0.49544691909253735, "CURRENT REFERENCE ENERGY": -0.49544691909253735, "DFT FUNCTIONAL TOTAL ENERGY": -0.49544691909253735, "DFT TOTAL ENERGY": -0.49544691909253735, "DFT VV10 ENERGY": 0.0, "DFT XC ENERGY": -0.3133142191539848, "NUCLEAR REPULSION ENERGY": 0.0, "ONE-ELECTRON ENERGY": -0.49821248315006456, "PCM POLARIZATION ENERGY": 0.0, "SCF DIPOLE X": 0.0, "SCF DIPOLE Y": 0.0, "SCF DIPOLE Z": 0.0, "SCF ITERATION ENERGY": -0.49544691909253735, "SCF ITERATIONS": 3.0, "SCF TOTAL ENERGY": -0.49544691909253735, "TWO-ELECTRON ENERGY": 0.316079783211512}}, "provenance": {"creator": "Psi4", "version": "1.3", "routine": "psi4.json.run_json", "nthreads": 2, "wall_time": 0.6528961658477783, "cpu": "Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz", "hostname": "duancheudesktop", "qcengine_version": "v0.6.4", "username": "duanchenru", "memory": 2.561}, "properties": {"calcinfo_nbasis": 2, "calcinfo_nmo": 2, "calcinfo_nalpha": 1, "calcinfo_nbeta": 0, "calcinfo_natom": 1, "nuclear_repulsion_energy": 0.0, "return_energy": -0.49544691909253735, "scf_one_electron_energy": -0.49821248315006456, "scf_two_electron_energy": 0.316079783211512, "scf_xc_energy": -0.3133142191539848, "scf_dipole_moment": null, "scf_total_energy": -0.49544691909253735, "scf_iterations": 3}, "return_result": -0.49544691909253735, "success": true, "stdout": "\n Memory set to 2.561 GiB by Python driver.\n\n*** tstart() called on duancheudesktop\n*** at Tue Mar 26 10:59:18 2019\n\n => Loading Basis Set <=\n\n Name: 6-31G\n Role: ORBITAL\n Keyword: BASIS\n atoms 1 entry H line 26 file /anaconda2/envs/qcengine/share/psi4/basis/6-31g.gbs \n\n\n ---------------------------------------------------------\n SCF\n by Justin Turney, Rob Parrish, Andy Simmonett\n and Daniel G. A. Smith\n UKS Reference\n 2 Threads, 2622 MiB Core\n ---------------------------------------------------------\n\n ==> Geometry <==\n\n Molecular point group: d2h\n Geometry (in Bohr), charge = 0, multiplicity = 2:\n\n Center X Y Z Mass \n ------------ ----------------- ----------------- ----------------- -----------------\n H 0.000000000000 0.000000000000 0.000000000000 1.007825032230\n\n Running in d2h symmetry.\n\n Rotational constants: A = ************ B = ************ C = ************ [cm^-1]\n Rotational constants: A = ************ B = ************ C = ************ [MHz]\n Nuclear repulsion = 0.000000000000000\n\n Charge = 0\n Multiplicity = 2\n Electrons = 1\n Nalpha = 1\n Nbeta = 0\n\n ==> Algorithm <==\n\n SCF Algorithm Type is DF.\n DIIS enabled.\n MOM disabled.\n Fractional occupation disabled.\n Guess Type is CORE.\n Energy threshold = 1.00e-06\n Density threshold = 1.00e-06\n Integral threshold = 0.00e+00\n\n ==> Primary Basis <==\n\n Basis Set: 6-31G\n Blend: 6-31G\n Number of shells: 2\n Number of basis function: 2\n Number of Cartesian functions: 2\n Spherical Harmonics?: false\n Max angular momentum: 0\n\n ==> DFT Potential <==\n\n => Composite Functional: BLYP <= \n\n BLYP GGA Exchange-Correlation Functional\n\n P.J. Stephens et. al., J. Phys. Chem., 98, 11623-11627, 1994\n B. Miehlich et. al., Chem. Phys. Lett., 157(3), 200-206 1989\n\n\n Deriv = 1\n GGA = TRUE\n Meta = FALSE\n\n Exchange Hybrid = FALSE\n MP2 Hybrid = FALSE\n\n => Exchange Functionals <=\n\n 1.0000 XC_GGA_X_B88\n\n => Correlation Functionals <=\n\n 1.0000 XC_GGA_C_LYP\n\n => Molecular Quadrature <=\n\n Radial Scheme = TREUTLER\n Pruning Scheme = FLAT\n Nuclear Scheme = TREUTLER\n\n BS radius alpha = 1\n Pruning alpha = 1\n Radial Points = 75\n Spherical Points = 302\n Total Points = 22046\n Total Blocks = 221\n Max Points = 251\n Max Functions = 2\n\n => Loading Basis Set <=\n\n Name: (6-31G AUX)\n Role: JKFIT\n Keyword: DF_BASIS_SCF\n atoms 1 entry H line 51 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n\n ==> Pre-Iterations <==\n\n -------------------------------------------------------\n Irrep Nso Nmo Nalpha Nbeta Ndocc Nsocc\n -------------------------------------------------------\n Ag 2 2 0 0 0 0\n B1g 0 0 0 0 0 0\n B2g 0 0 0 0 0 0\n B3g 0 0 0 0 0 0\n Au 0 0 0 0 0 0\n B1u 0 0 0 0 0 0\n B2u 0 0 0 0 0 0\n B3u 0 0 0 0 0 0\n -------------------------------------------------------\n Total 2 2 1 0 0 1\n -------------------------------------------------------\n\n ==> Integral Setup <==\n\n DFHelper Memory: AOs need 0.000 GiB; user supplied 1.920 GiB. Using in-core AOs.\n\n ==> MemDFJK: Density-Fitted J/K Matrices <==\n\n J tasked: Yes\n K tasked: No\n wK tasked: No\n OpenMP threads: 2\n Memory [MiB]: 1965\n Algorithm: Core\n Schwarz Cutoff: 1E-12\n Mask sparsity (%): 0.0000\n Fitting Condition: 1E-10\n\n => Auxiliary Basis Set <=\n\n Basis Set: (6-31G AUX)\n Blend: CC-PVDZ-JKFIT\n Number of shells: 9\n Number of basis function: 25\n Number of Cartesian functions: 25\n Spherical Harmonics?: false\n Max angular momentum: 2\n\n Cached 100.0% of DFT collocation blocks in 0.001 [GiB].\n\n Minimum eigenvalue in the overlap matrix is 3.4170795066E-01.\n Using Symmetric Orthogonalization.\n\n SCF Guess: Core (One-Electron) Hamiltonian.\n\n ==> Iterations <==\n\n Total Energy Delta E RMS |[F,P]|\n\n @DF-UKS iter 1: -0.49542550490969 -4.95426e-01 2.31952e-03 DIIS\n @DF-UKS iter 2: -0.49544677291818 -2.12680e-05 1.91720e-04 DIIS\n @DF-UKS iter 3: -0.49544691909254 -1.46174e-07 1.30458e-07 DIIS\n Energy and wave function converged.\n\n\n ==> Post-Iterations <==\n\n @Spin Contamination Metric: 0.000000000E+00\n @S^2 Expected: 7.500000000E-01\n @S^2 Observed: 7.500000000E-01\n @S Expected: 5.000000000E-01\n @S Observed: 5.000000000E-01\n\n Orbital Energies [Eh]\n ---------------------\n\n Alpha Occupied: \n\n 1Ag -0.263142 \n\n Alpha Virtual: \n\n 2Ag 0.665247 \n\n Beta Occupied: \n\n \n\n Beta Virtual: \n\n 1Ag -11228107.798488 2Ag -456402.042583 \n\n Final Occupation by Irrep:\n Ag B1g B2g B3g Au B1u B2u B3u \n DOCC [ 0, 0, 0, 0, 0, 0, 0, 0 ]\n SOCC [ 1, 0, 0, 0, 0, 0, 0, 0 ]\n\n @DF-UKS Final Energy: -0.49544691909254\n\n => Energetics <=\n\n Nuclear Repulsion Energy = 0.0000000000000000\n One-Electron Energy = -0.4982124831500646\n Two-Electron Energy = 0.3160797832115120\n DFT Exchange-Correlation Energy = -0.3133142191539848\n Empirical Dispersion Energy = 0.0000000000000000\n VV10 Nonlocal Energy = 0.0000000000000000\n Total Energy = -0.4954469190925374\n\n UHF NO Occupations:\n HONO-0 : 1 Ag 1.0000000\n LUNO+0 : 2 Ag -0.0000000\n\n\nComputation Completed\n\n\nProperties will be evaluated at 0.000000, 0.000000, 0.000000 [a0]\n\nProperties computed using the SCF density matrix\n\n Nuclear Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Electronic Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n Dipole Moment: [D]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n\n*** tstop() called on duancheudesktop at Tue Mar 26 10:59:18 2019\nModule time:\n\tuser time = 0.30 seconds = 0.01 minutes\n\tsystem time = 0.01 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\nTotal time:\n\tuser time = 0.30 seconds = 0.01 minutes\n\tsystem time = 0.01 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\n", "stderr": null, "error": null} -------------------------------------------------------------------------------- /Examples/B1_example_file_io/B1_water_blyp_O.json: -------------------------------------------------------------------------------- 1 | {"molecule": {"symbols": ["O"], "geometry": [0.0, 0.0, 0.0], "schema_name": "qcschema_molecule", "schema_version": 2, "name": "O", "molecular_charge": 0.0, "molecular_multiplicity": 3, "masses": [15.99491461957], "real": [true], "atom_labels": [""], "atomic_numbers": [8], "mass_numbers": [16], "fragments": [[0]], "fragment_charges": [0.0], "fragment_multiplicities": [3], "fix_com": false, "fix_orientation": false, "provenance": {"creator": "QCElemental", "version": "v0.3.3", "routine": "qcelemental.molparse.from_schema"}}, "driver": "energy", "model": {"method": "blyp", "basis": "6-31g"}, "id": null, "schema_name": "qcschema_output", "schema_version": 1, "keywords": {"reference": "uhf"}, "extras": {"local_qcvars": {"-D ENERGY": 0.0, "CURRENT DIPOLE X": 0.0, "CURRENT DIPOLE Y": 0.0, "CURRENT DIPOLE Z": 0.0, "CURRENT ENERGY": -75.04456340395195, "CURRENT REFERENCE ENERGY": -75.04456340395195, "DFT FUNCTIONAL TOTAL ENERGY": -75.04456340395195, "DFT TOTAL ENERGY": -75.04456340395195, "DFT VV10 ENERGY": 0.0, "DFT XC ENERGY": -8.468404378325502, "NUCLEAR REPULSION ENERGY": 0.0, "ONE-ELECTRON ENERGY": -103.23685127383455, "PCM POLARIZATION ENERGY": 0.0, "SCF DIPOLE X": 0.0, "SCF DIPOLE Y": 0.0, "SCF DIPOLE Z": 0.0, "SCF ITERATION ENERGY": -75.04456340395195, "SCF ITERATIONS": 7.0, "SCF TOTAL ENERGY": -75.04456340395195, "TWO-ELECTRON ENERGY": 36.6606922482081}}, "provenance": {"creator": "Psi4", "version": "1.3", "routine": "psi4.json.run_json", "nthreads": 2, "wall_time": 0.7945153713226318, "cpu": "Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz", "hostname": "duancheudesktop", "qcengine_version": "v0.6.4", "username": "duanchenru", "memory": 2.561}, "properties": {"calcinfo_nbasis": 9, "calcinfo_nmo": 9, "calcinfo_nalpha": 5, "calcinfo_nbeta": 3, "calcinfo_natom": 1, "nuclear_repulsion_energy": 0.0, "return_energy": -75.04456340395195, "scf_one_electron_energy": -103.23685127383455, "scf_two_electron_energy": 36.6606922482081, "scf_xc_energy": -8.468404378325502, "scf_dipole_moment": null, "scf_total_energy": -75.04456340395195, "scf_iterations": 7}, "return_result": -75.04456340395195, "success": true, "stdout": "\n Memory set to 2.561 GiB by Python driver.\n\n*** tstart() called on duancheudesktop\n*** at Tue Mar 26 10:59:17 2019\n\n => Loading Basis Set <=\n\n Name: 6-31G\n Role: ORBITAL\n Keyword: BASIS\n atoms 1 entry O line 117 file /anaconda2/envs/qcengine/share/psi4/basis/6-31g.gbs \n\n\n ---------------------------------------------------------\n SCF\n by Justin Turney, Rob Parrish, Andy Simmonett\n and Daniel G. A. Smith\n UKS Reference\n 2 Threads, 2622 MiB Core\n ---------------------------------------------------------\n\n ==> Geometry <==\n\n Molecular point group: d2h\n Geometry (in Bohr), charge = 0, multiplicity = 3:\n\n Center X Y Z Mass \n ------------ ----------------- ----------------- ----------------- -----------------\n O 0.000000000000 0.000000000000 0.000000000000 15.994914619570\n\n Running in d2h symmetry.\n\n Rotational constants: A = ************ B = ************ C = ************ [cm^-1]\n Rotational constants: A = ************ B = ************ C = ************ [MHz]\n Nuclear repulsion = 0.000000000000000\n\n Charge = 0\n Multiplicity = 3\n Electrons = 8\n Nalpha = 5\n Nbeta = 3\n\n ==> Algorithm <==\n\n SCF Algorithm Type is DF.\n DIIS enabled.\n MOM disabled.\n Fractional occupation disabled.\n Guess Type is CORE.\n Energy threshold = 1.00e-06\n Density threshold = 1.00e-06\n Integral threshold = 0.00e+00\n\n ==> Primary Basis <==\n\n Basis Set: 6-31G\n Blend: 6-31G\n Number of shells: 5\n Number of basis function: 9\n Number of Cartesian functions: 9\n Spherical Harmonics?: false\n Max angular momentum: 1\n\n ==> DFT Potential <==\n\n => Composite Functional: BLYP <= \n\n BLYP GGA Exchange-Correlation Functional\n\n P.J. Stephens et. al., J. Phys. Chem., 98, 11623-11627, 1994\n B. Miehlich et. al., Chem. Phys. Lett., 157(3), 200-206 1989\n\n\n Deriv = 1\n GGA = TRUE\n Meta = FALSE\n\n Exchange Hybrid = FALSE\n MP2 Hybrid = FALSE\n\n => Exchange Functionals <=\n\n 1.0000 XC_GGA_X_B88\n\n => Correlation Functionals <=\n\n 1.0000 XC_GGA_C_LYP\n\n => Molecular Quadrature <=\n\n Radial Scheme = TREUTLER\n Pruning Scheme = FLAT\n Nuclear Scheme = TREUTLER\n\n BS radius alpha = 1\n Pruning alpha = 1\n Radial Points = 75\n Spherical Points = 302\n Total Points = 20234\n Total Blocks = 207\n Max Points = 254\n Max Functions = 9\n\n => Loading Basis Set <=\n\n Name: (6-31G AUX)\n Role: JKFIT\n Keyword: DF_BASIS_SCF\n atoms 1 entry O line 221 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n\n ==> Pre-Iterations <==\n\n -------------------------------------------------------\n Irrep Nso Nmo Nalpha Nbeta Ndocc Nsocc\n -------------------------------------------------------\n Ag 3 3 0 0 0 0\n B1g 0 0 0 0 0 0\n B2g 0 0 0 0 0 0\n B3g 0 0 0 0 0 0\n Au 0 0 0 0 0 0\n B1u 2 2 0 0 0 0\n B2u 2 2 0 0 0 0\n B3u 2 2 0 0 0 0\n -------------------------------------------------------\n Total 9 9 5 3 3 2\n -------------------------------------------------------\n\n ==> Integral Setup <==\n\n DFHelper Memory: AOs need 0.000 GiB; user supplied 1.916 GiB. Using in-core AOs.\n\n ==> MemDFJK: Density-Fitted J/K Matrices <==\n\n J tasked: Yes\n K tasked: No\n wK tasked: No\n OpenMP threads: 2\n Memory [MiB]: 1961\n Algorithm: Core\n Schwarz Cutoff: 1E-12\n Mask sparsity (%): 0.0000\n Fitting Condition: 1E-10\n\n => Auxiliary Basis Set <=\n\n Basis Set: (6-31G AUX)\n Blend: CC-PVDZ-JKFIT\n Number of shells: 24\n Number of basis function: 81\n Number of Cartesian functions: 81\n Spherical Harmonics?: false\n Max angular momentum: 3\n\n Cached 100.0% of DFT collocation blocks in 0.005 [GiB].\n\n Minimum eigenvalue in the overlap matrix is 2.3327163930E-01.\n Using Symmetric Orthogonalization.\n\n SCF Guess: Core (One-Electron) Hamiltonian.\n\n ==> Iterations <==\n\n Total Energy Delta E RMS |[F,P]|\n\n @DF-UKS iter 1: -72.49341903390442 -7.24934e+01 3.68366e-01 DIIS\n @DF-UKS iter 2: -73.26322929304587 -7.69810e-01 4.24513e-01 DIIS\n @DF-UKS iter 3: -75.02366502300629 -1.76044e+00 4.92749e-02 DIIS\n @DF-UKS iter 4: -75.04455952552694 -2.08945e-02 6.53536e-04 DIIS\n @DF-UKS iter 5: -75.04456337475848 -3.84923e-06 5.00453e-05 DIIS\n @DF-UKS iter 6: -75.04456340368696 -2.89285e-08 4.38535e-06 DIIS\n @DF-UKS iter 7: -75.04456340395195 -2.64990e-10 1.13266e-07 DIIS\n Energy and wave function converged.\n\n\n ==> Post-Iterations <==\n\n @Spin Contamination Metric: 1.236139607E-03\n @S^2 Expected: 2.000000000E+00\n @S^2 Observed: 2.001236140E+00\n @S Expected: 1.000000000E+00\n @S Observed: 1.000000000E+00\n\n Orbital Energies [Eh]\n ---------------------\n\n Alpha Occupied: \n\n 1Ag -18.926342 2Ag -0.892321 1B3u -0.369751 \n 1B2u -0.369751 1B1u -0.295751 \n\n Alpha Virtual: \n\n 2B2u 0.742750 2B3u 0.742750 2B1u 0.789014 \n 3Ag 0.870898 \n\n Beta Occupied: \n\n 1Ag -18.882413 2Ag -0.770740 1B1u -0.248108 \n\n Beta Virtual: \n\n 1B3u -0.219984 1B2u -0.219984 2B1u 0.818108 \n 2B2u 0.842605 2B3u 0.842605 3Ag 0.949194 \n\n Final Occupation by Irrep:\n Ag B1g B2g B3g Au B1u B2u B3u \n DOCC [ 2, 0, 0, 0, 0, 1, 0, 0 ]\n SOCC [ 0, 0, 0, 0, 0, 0, 1, 1 ]\n\n @DF-UKS Final Energy: -75.04456340395195\n\n => Energetics <=\n\n Nuclear Repulsion Energy = 0.0000000000000000\n One-Electron Energy = -103.2368512738345459\n Two-Electron Energy = 36.6606922482081004\n DFT Exchange-Correlation Energy = -8.4684043783255021\n Empirical Dispersion Energy = 0.0000000000000000\n VV10 Nonlocal Energy = 0.0000000000000000\n Total Energy = -75.0445634039519547\n\n UHF NO Occupations:\n HONO-2 : 2 Ag 1.9996019\n HONO-1 : 1B2u 1.0000000\n HONO-0 : 1B3u 1.0000000\n LUNO+0 : 3 Ag 0.0003981\n LUNO+1 : 2B1u 0.0002201\n LUNO+2 : 2B3u -0.0000000\n LUNO+3 : 2B2u -0.0000000\n\n\nComputation Completed\n\n\nProperties will be evaluated at 0.000000, 0.000000, 0.000000 [a0]\n\nProperties computed using the SCF density matrix\n\n Nuclear Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Electronic Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n Dipole Moment: [D]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n\n*** tstop() called on duancheudesktop at Tue Mar 26 10:59:17 2019\nModule time:\n\tuser time = 0.50 seconds = 0.01 minutes\n\tsystem time = 0.02 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\nTotal time:\n\tuser time = 0.50 seconds = 0.01 minutes\n\tsystem time = 0.02 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\n", "stderr": null, "error": null} -------------------------------------------------------------------------------- /Examples/B1_example_file_io/B1_water_blyp_whole.json: -------------------------------------------------------------------------------- 1 | {"molecule": {"symbols": ["O", "H", "H"], "geometry": [0.0, 0.0, -0.12947694, 0.0, -1.49418734, 1.02744651, 0.0, 1.49418734, 1.02744651], "schema_name": "qcschema_molecule", "schema_version": 2, "name": "H2O", "molecular_charge": 0.0, "molecular_multiplicity": 1, "masses": [15.99491461957, 1.00782503223, 1.00782503223], "real": [true, true, true], "atom_labels": ["", "", ""], "atomic_numbers": [8, 1, 1], "mass_numbers": [16, 1, 1], "fragments": [[0, 1, 2]], "fragment_charges": [0.0], "fragment_multiplicities": [1], "fix_com": false, "fix_orientation": false, "provenance": {"creator": "QCElemental", "version": "v0.3.3", "routine": "qcelemental.molparse.from_schema"}}, "driver": "energy", "model": {"method": "blyp", "basis": "6-31g"}, "id": null, "schema_name": "qcschema_output", "schema_version": 1, "keywords": {}, "extras": {"local_qcvars": {"-D ENERGY": 0.0, "CURRENT DIPOLE X": 0.0, "CURRENT DIPOLE Y": 0.0, "CURRENT DIPOLE Z": 2.352861942800227, "CURRENT ENERGY": -76.3664599274598, "CURRENT REFERENCE ENERGY": -76.3664599274598, "DFT FUNCTIONAL TOTAL ENERGY": -76.3664599274598, "DFT TOTAL ENERGY": -76.3664599274598, "DFT VV10 ENERGY": 0.0, "DFT XC ENERGY": -9.302606174236363, "NUCLEAR REPULSION ENERGY": 8.80146205625184, "ONE-ELECTRON ENERGY": -122.34225959580326, "PCM POLARIZATION ENERGY": 0.0, "SCF DIPOLE X": 0.0, "SCF DIPOLE Y": 0.0, "SCF DIPOLE Z": 2.352861942800227, "SCF ITERATION ENERGY": -76.3664599274598, "SCF ITERATIONS": 7.0, "SCF TOTAL ENERGY": -76.3664599274598, "TWO-ELECTRON ENERGY": 46.47694378632798}}, "provenance": {"creator": "Psi4", "version": "1.3", "routine": "psi4.json.run_json", "nthreads": 2, "wall_time": 2.825780153274536, "cpu": "Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz", "hostname": "duancheudesktop", "qcengine_version": "v0.6.4", "username": "duanchenru", "memory": 2.561}, "properties": {"calcinfo_nbasis": 13, "calcinfo_nmo": 13, "calcinfo_nalpha": 5, "calcinfo_nbeta": 5, "calcinfo_natom": 3, "nuclear_repulsion_energy": 8.80146205625184, "return_energy": -76.3664599274598, "scf_one_electron_energy": -122.34225959580326, "scf_two_electron_energy": 46.47694378632798, "scf_xc_energy": -9.302606174236363, "scf_dipole_moment": [0.0, 0.0, 2.352861942800227], "scf_total_energy": -76.3664599274598, "scf_iterations": 7}, "return_result": -76.3664599274598, "success": true, "stdout": "\n Memory set to 2.561 GiB by Python driver.\n\n*** tstart() called on duancheudesktop\n*** at Tue Mar 26 10:59:16 2019\n\n => Loading Basis Set <=\n\n Name: 6-31G\n Role: ORBITAL\n Keyword: BASIS\n atoms 1 entry O line 117 file /anaconda2/envs/qcengine/share/psi4/basis/6-31g.gbs \n atoms 2-3 entry H line 26 file /anaconda2/envs/qcengine/share/psi4/basis/6-31g.gbs \n\n\n ---------------------------------------------------------\n SCF\n by Justin Turney, Rob Parrish, Andy Simmonett\n and Daniel G. A. Smith\n RKS Reference\n 2 Threads, 2622 MiB Core\n ---------------------------------------------------------\n\n ==> Geometry <==\n\n Molecular point group: c2v\n Full point group: C2v\n\n Geometry (in Bohr), charge = 0, multiplicity = 1:\n\n Center X Y Z Mass \n ------------ ----------------- ----------------- ----------------- -----------------\n O 0.000000000000 0.000000000000 -0.129476941311 15.994914619570\n H 0.000000000000 -1.494187340000 1.027446508689 1.007825032230\n H -0.000000000000 1.494187340000 1.027446508689 1.007825032230\n\n Running in c2v symmetry.\n\n Rotational constants: A = 25.12553 B = 13.37732 C = 8.72954 [cm^-1]\n Rotational constants: A = 753244.47060 B = 401041.84747 C = 261705.04610 [MHz]\n Nuclear repulsion = 8.801462056251840\n\n Charge = 0\n Multiplicity = 1\n Electrons = 10\n Nalpha = 5\n Nbeta = 5\n\n ==> Algorithm <==\n\n SCF Algorithm Type is DF.\n DIIS enabled.\n MOM disabled.\n Fractional occupation disabled.\n Guess Type is SAD.\n Energy threshold = 1.00e-06\n Density threshold = 1.00e-06\n Integral threshold = 0.00e+00\n\n ==> Primary Basis <==\n\n Basis Set: 6-31G\n Blend: 6-31G\n Number of shells: 9\n Number of basis function: 13\n Number of Cartesian functions: 13\n Spherical Harmonics?: false\n Max angular momentum: 1\n\n ==> DFT Potential <==\n\n => Composite Functional: BLYP <= \n\n BLYP GGA Exchange-Correlation Functional\n\n P.J. Stephens et. al., J. Phys. Chem., 98, 11623-11627, 1994\n B. Miehlich et. al., Chem. Phys. Lett., 157(3), 200-206 1989\n\n\n Deriv = 1\n GGA = TRUE\n Meta = FALSE\n\n Exchange Hybrid = FALSE\n MP2 Hybrid = FALSE\n\n => Exchange Functionals <=\n\n 1.0000 XC_GGA_X_B88\n\n => Correlation Functionals <=\n\n 1.0000 XC_GGA_C_LYP\n\n => Molecular Quadrature <=\n\n Radial Scheme = TREUTLER\n Pruning Scheme = FLAT\n Nuclear Scheme = TREUTLER\n\n BS radius alpha = 1\n Pruning alpha = 1\n Radial Points = 75\n Spherical Points = 302\n Total Points = 65565\n Total Blocks = 556\n Max Points = 256\n Max Functions = 13\n\n => Loading Basis Set <=\n\n Name: (6-31G AUX)\n Role: JKFIT\n Keyword: DF_BASIS_SCF\n atoms 1 entry O line 221 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n atoms 2-3 entry H line 51 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n\n ==> Pre-Iterations <==\n\n -------------------------------------------------------\n Irrep Nso Nmo Nalpha Nbeta Ndocc Nsocc\n -------------------------------------------------------\n A1 7 7 0 0 0 0\n A2 0 0 0 0 0 0\n B1 2 2 0 0 0 0\n B2 4 4 0 0 0 0\n -------------------------------------------------------\n Total 13 13 5 5 5 0\n -------------------------------------------------------\n\n ==> Integral Setup <==\n\n DFHelper Memory: AOs need 0.000 GiB; user supplied 1.897 GiB. Using in-core AOs.\n\n ==> MemDFJK: Density-Fitted J/K Matrices <==\n\n J tasked: Yes\n K tasked: No\n wK tasked: No\n OpenMP threads: 2\n Memory [MiB]: 1942\n Algorithm: Core\n Schwarz Cutoff: 1E-12\n Mask sparsity (%): 0.0000\n Fitting Condition: 1E-10\n\n => Auxiliary Basis Set <=\n\n Basis Set: (6-31G AUX)\n Blend: CC-PVDZ-JKFIT\n Number of shells: 42\n Number of basis function: 131\n Number of Cartesian functions: 131\n Spherical Harmonics?: false\n Max angular momentum: 3\n\n Cached 100.0% of DFT collocation blocks in 0.024 [GiB].\n\n Minimum eigenvalue in the overlap matrix is 7.3923847791E-02.\n Using Symmetric Orthogonalization.\n\n SCF Guess: Superposition of Atomic Densities via on-the-fly atomic UHF.\n\n ==> Iterations <==\n\n Total Energy Delta E RMS |[F,P]|\n\n @DF-RKS iter SAD: -76.11320458980370 -7.61132e+01 0.00000e+00 \n @DF-RKS iter 1: -76.17841911158331 -6.52145e-02 8.45344e-02 DIIS\n @DF-RKS iter 2: -75.64275125514031 5.35668e-01 1.54933e-01 DIIS\n @DF-RKS iter 3: -76.36512933013489 -7.22378e-01 6.00572e-03 DIIS\n @DF-RKS iter 4: -76.36643950409874 -1.31017e-03 7.28873e-04 DIIS\n @DF-RKS iter 5: -76.36645990912308 -2.04050e-05 2.39173e-05 DIIS\n @DF-RKS iter 6: -76.36645992743536 -1.83123e-08 1.01328e-06 DIIS\n @DF-RKS iter 7: -76.36645992745980 -2.44427e-11 1.51477e-07 DIIS\n Energy and wave function converged.\n\n\n ==> Post-Iterations <==\n\n Orbital Energies [Eh]\n ---------------------\n\n Doubly Occupied: \n\n 1A1 -18.784979 2A1 -0.901552 1B2 -0.455754 \n 3A1 -0.290816 1B1 -0.221551 \n\n Virtual: \n\n 4A1 0.019187 2B2 0.103636 3B2 0.744452 \n 5A1 0.775858 2B1 0.835843 6A1 0.903530 \n 4B2 1.004254 7A1 1.363878 \n\n Final Occupation by Irrep:\n A1 A2 B1 B2 \n DOCC [ 3, 0, 1, 1 ]\n\n @DF-RKS Final Energy: -76.36645992745980\n\n => Energetics <=\n\n Nuclear Repulsion Energy = 8.8014620562518395\n One-Electron Energy = -122.3422595958032559\n Two-Electron Energy = 46.4769437863279791\n DFT Exchange-Correlation Energy = -9.3026061742363630\n Empirical Dispersion Energy = 0.0000000000000000\n VV10 Nonlocal Energy = 0.0000000000000000\n Total Energy = -76.3664599274598004\n\nComputation Completed\n\n\nProperties will be evaluated at 0.000000, 0.000000, 0.000000 [a0]\n\nProperties computed using the SCF density matrix\n\n Nuclear Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 1.0191\n\n Electronic Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: -0.0934\n\n Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.9257 Total: 0.9257\n\n Dipole Moment: [D]\n X: 0.0000 Y: 0.0000 Z: 2.3529 Total: 2.3529\n\n\n*** tstop() called on duancheudesktop at Tue Mar 26 10:59:17 2019\nModule time:\n\tuser time = 1.00 seconds = 0.02 minutes\n\tsystem time = 0.04 seconds = 0.00 minutes\n\ttotal time = 1 seconds = 0.02 minutes\nTotal time:\n\tuser time = 1.00 seconds = 0.02 minutes\n\tsystem time = 0.04 seconds = 0.00 minutes\n\ttotal time = 1 seconds = 0.02 minutes\n", "stderr": null, "error": null} -------------------------------------------------------------------------------- /Examples/B1_example_file_io/water_B1.json: -------------------------------------------------------------------------------- 1 | {"B1": 0.006334860366017381} -------------------------------------------------------------------------------- /Examples/C0_example_file_io/C0_Oxygen_atom_casscf_whole.json: -------------------------------------------------------------------------------- 1 | {"molecule": {"symbols": ["O"], "geometry": [0.0, 0.0, 0.0], "schema_name": "qcschema_molecule", "schema_version": 2, "name": "O", "molecular_charge": 0.0, "molecular_multiplicity": 3, "masses": [15.99491461957], "real": [true], "atom_labels": [""], "atomic_numbers": [8], "mass_numbers": [16], "fragments": [[0]], "fragment_charges": [0.0], "fragment_multiplicities": [3], "fix_com": false, "fix_orientation": false, "provenance": {"creator": "QCElemental", "version": "v0.3.3", "routine": "qcelemental.molparse.from_schema"}}, "driver": "energy", "model": {"method": "casscf", "basis": "cc-pvdz"}, "id": null, "schema_name": "qcschema_output", "schema_version": 1, "keywords": {"reference": "rohf"}, "extras": {"local_qcvars": {"-D ENERGY": 0.0, "CASSCF DIPOLE X": 0.0, "CASSCF DIPOLE Y": 0.0, "CASSCF DIPOLE Z": 0.0, "CI CORRELATION ENERGY": -0.12422638346932047, "CI ROOT 0 CORRELATION ENERGY": -0.12422638346932047, "CI ROOT 0 TOTAL ENERGY": -74.91174384584302, "CI TOTAL ENERGY": -74.91174384584302, "CURRENT CORRELATION ENERGY": -0.12422638346932047, "CURRENT DIPOLE X": 0.0, "CURRENT DIPOLE Y": 0.0, "CURRENT DIPOLE Z": 0.0, "CURRENT ENERGY": -74.91174384584302, "CURRENT REFERENCE ENERGY": -74.7875174623737, "DETCI AVG DVEC NORM": 0.0, "FCI CORRELATION ENERGY": -0.12422638346932047, "FCI TOTAL ENERGY": -74.91174384584302, "HF TOTAL ENERGY": -74.7875174623737, "MCSCF TOTAL ENERGY": -74.91174384584302, "NUCLEAR REPULSION ENERGY": 0.0, "ONE-ELECTRON ENERGY": -103.27205941953282, "PCM POLARIZATION ENERGY": 0.0, "SCF DIPOLE X": 0.0, "SCF DIPOLE Y": 0.0, "SCF DIPOLE Z": 0.0, "SCF ITERATION ENERGY": -74.7875174623737, "SCF ITERATIONS": 9.0, "SCF TOTAL ENERGY": -74.7875174623737, "TWO-ELECTRON ENERGY": 28.484541957159124}}, "provenance": {"creator": "Psi4", "version": "1.3", "routine": "psi4.json.run_json", "nthreads": 2, "wall_time": 8.9550142288208, "qcengine_version": "v0.6.4", "memory": 2.545, "username": "duanchenru", "cpu": "Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz", "hostname": "duancheudesktop"}, "properties": {"calcinfo_nbasis": 14, "calcinfo_nmo": 14, "calcinfo_nalpha": 5, "calcinfo_nbeta": 3, "calcinfo_natom": 1, "nuclear_repulsion_energy": 0.0, "return_energy": -74.91174384584302, "scf_one_electron_energy": -103.27205941953282, "scf_two_electron_energy": 28.484541957159124, "scf_dipole_moment": null, "scf_total_energy": -74.7875174623737, "scf_iterations": 9}, "return_result": -74.91174384584302, "success": true, "stdout": "\n Memory set to 2.545 GiB by Python driver.\n\n*** tstart() called on duancheudesktop\n*** at Tue Mar 26 10:57:22 2019\n\n => Loading Basis Set <=\n\n Name: CC-PVDZ\n Role: ORBITAL\n Keyword: BASIS\n atoms 1 entry O line 198 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz.gbs \n\n\n ---------------------------------------------------------\n SCF\n by Justin Turney, Rob Parrish, Andy Simmonett\n and Daniel G. A. Smith\n ROHF Reference\n 2 Threads, 2606 MiB Core\n ---------------------------------------------------------\n\n ==> Geometry <==\n\n Molecular point group: d2h\n Geometry (in Bohr), charge = 0, multiplicity = 3:\n\n Center X Y Z Mass \n ------------ ----------------- ----------------- ----------------- -----------------\n O 0.000000000000 0.000000000000 0.000000000000 15.994914619570\n\n Running in d2h symmetry.\n\n Rotational constants: A = ************ B = ************ C = ************ [cm^-1]\n Rotational constants: A = ************ B = ************ C = ************ [MHz]\n Nuclear repulsion = 0.000000000000000\n\n Charge = 0\n Multiplicity = 3\n Electrons = 8\n Nalpha = 5\n Nbeta = 3\n\n ==> Algorithm <==\n\n SCF Algorithm Type is DF.\n DIIS enabled.\n MOM disabled.\n Fractional occupation disabled.\n Guess Type is CORE.\n Energy threshold = 1.00e-08\n Density threshold = 1.00e-08\n Integral threshold = 0.00e+00\n\n ==> Primary Basis <==\n\n Basis Set: CC-PVDZ\n Blend: CC-PVDZ\n Number of shells: 6\n Number of basis function: 14\n Number of Cartesian functions: 15\n Spherical Harmonics?: true\n Max angular momentum: 2\n\n => Loading Basis Set <=\n\n Name: (CC-PVDZ AUX)\n Role: JKFIT\n Keyword: DF_BASIS_SCF\n atoms 1 entry O line 221 file /anaconda2/envs/qcengine/share/psi4/basis/cc-pvdz-jkfit.gbs \n\n ==> Pre-Iterations <==\n\n -------------------------------------------------------\n Irrep Nso Nmo Nalpha Nbeta Ndocc Nsocc\n -------------------------------------------------------\n Ag 5 5 0 0 0 0\n B1g 1 1 0 0 0 0\n B2g 1 1 0 0 0 0\n B3g 1 1 0 0 0 0\n Au 0 0 0 0 0 0\n B1u 2 2 0 0 0 0\n B2u 2 2 0 0 0 0\n B3u 2 2 0 0 0 0\n -------------------------------------------------------\n Total 14 14 5 3 3 2\n -------------------------------------------------------\n\n ==> Integral Setup <==\n\n DFHelper Memory: AOs need 0.000 GiB; user supplied 1.909 GiB. Using in-core AOs.\n\n ==> MemDFJK: Density-Fitted J/K Matrices <==\n\n J tasked: Yes\n K tasked: Yes\n wK tasked: No\n OpenMP threads: 2\n Memory [MiB]: 1954\n Algorithm: Core\n Schwarz Cutoff: 1E-12\n Mask sparsity (%): 0.0000\n Fitting Condition: 1E-10\n\n => Auxiliary Basis Set <=\n\n Basis Set: (CC-PVDZ AUX)\n Blend: CC-PVDZ-JKFIT\n Number of shells: 24\n Number of basis function: 70\n Number of Cartesian functions: 81\n Spherical Harmonics?: true\n Max angular momentum: 3\n\n Minimum eigenvalue in the overlap matrix is 1.8857646190E-01.\n Using Symmetric Orthogonalization.\n\n SCF Guess: Core (One-Electron) Hamiltonian.\n\n ==> Iterations <==\n\n Total Energy Delta E RMS |[F,P]|\n\n @DF-ROHF iter 1: -72.12802286185409 -7.21280e+01 2.23428e-01 DIIS\n @DF-ROHF iter 2: -74.30158927804136 -2.17357e+00 1.39086e-01 DIIS\n @DF-ROHF iter 3: -74.77177138953276 -4.70182e-01 2.14504e-02 DIIS\n @DF-ROHF iter 4: -74.78653411210220 -1.47627e-02 4.73394e-03 DIIS\n @DF-ROHF iter 5: -74.78750982076909 -9.75709e-04 3.60473e-04 DIIS\n @DF-ROHF iter 6: -74.78751734355473 -7.52279e-06 7.09432e-05 DIIS\n @DF-ROHF iter 7: -74.78751746230449 -1.18750e-07 1.38052e-06 DIIS\n @DF-ROHF iter 8: -74.78751746237364 -6.91500e-11 5.10763e-08 DIIS\n @DF-ROHF iter 9: -74.78751746237370 -5.68434e-14 2.31576e-09 DIIS\n Energy and wave function converged.\n\n\n ==> Post-Iterations <==\n\n Orbital Energies [Eh]\n ---------------------\n\n Doubly Occupied: \n\n 1Ag -20.665059 2Ag -1.238639 1B1u -0.556912 \n\n Singly Occupied: \n\n 1B2u -0.256625 1B3u -0.256625 \n\n Virtual: \n\n 2B1u 1.147996 2B2u 1.151935 2B3u 1.151935 \n 3Ag 1.375477 4Ag 2.887042 1B1g 2.887042 \n 1B3g 2.900701 1B2g 2.900701 5Ag 2.905266 \n\n Final Occupation by Irrep:\n Ag B1g B2g B3g Au B1u B2u B3u \n DOCC [ 2, 0, 0, 0, 0, 1, 0, 0 ]\n SOCC [ 0, 0, 0, 0, 0, 0, 1, 1 ]\n\n @DF-ROHF Final Energy: -74.78751746237370\n\n => Energetics <=\n\n Nuclear Repulsion Energy = 0.0000000000000000\n One-Electron Energy = -103.2720594195328232\n Two-Electron Energy = 28.4845419571591236\n Total Energy = -74.7875174623736996\n\nComputation Completed\n\n\nProperties will be evaluated at 0.000000, 0.000000, 0.000000 [a0]\n\nProperties computed using the SCF density matrix\n\n Nuclear Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Electronic Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n Dipole Moment: [D]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n\n*** tstop() called on duancheudesktop at Tue Mar 26 10:57:22 2019\nModule time:\n\tuser time = 0.23 seconds = 0.00 minutes\n\tsystem time = 0.03 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\nTotal time:\n\tuser time = 0.23 seconds = 0.00 minutes\n\tsystem time = 0.03 seconds = 0.00 minutes\n\ttotal time = 0 seconds = 0.00 minutes\n MINTS: Wrapper to libmints.\n by Justin Turney\n\n Calculation information:\n Number of threads: 2\n Number of atoms: 1\n Number of AO shells: 6\n Number of SO shells: 6\n Number of primitives: 22\n Number of atomic orbitals: 15\n Number of basis functions: 14\n\n Number of irreps: 8\n Integral cutoff 1.00e-12\n Number of functions per irrep: [ 5 1 1 1 0 2 2 2 ]\n\n OEINTS: Overlap, kinetic, potential, dipole, and quadrupole integrals\n stored in file 35.\n\n Computing two-electron integrals...done\n Computed 776 non-zero two-electron integrals.\n Stored in file 33.\n\n MINTS: Wrapper to libmints.\n by Justin Turney\n\n Calculation information:\n Number of threads: 2\n Number of atoms: 1\n Number of AO shells: 6\n Number of SO shells: 6\n Number of primitives: 22\n Number of atomic orbitals: 15\n Number of basis functions: 14\n\n Number of irreps: 8\n Integral cutoff 1.00e-12\n Number of functions per irrep: [ 5 1 1 1 0 2 2 2 ]\n\n OEINTS: Overlap, kinetic, potential, dipole, and quadrupole integrals\n stored in file 35.\n\n Computing two-electron integrals...done\n Computed 776 non-zero two-electron integrals.\n Stored in file 33.\n\n\n ---------------------------------------------------------\n Multi-Configurational Self-Consistent Field\n (a 'D E T C I' module)\n\n Daniel G. A. Smith, C. David Sherrill, and\n Matt L. Leininger\n ---------------------------------------------------------\n\nWarning: iopen=0,opentype!=closed. Making iopen=1\n\n ==> Parameters <==\n\n EX LEVEL = 8 H0 BLOCKSIZE = 1000\n VAL EX LEVEL = 0 H0 GUESS SIZE = 1000\n H0COUPLINGSIZE = 0 H0 COUPLING = NO\n MAXITER = 12 NUM PRINT = 20\n NUM ROOTS = 1 ICORE = 1\n PRINT LVL = 1 FCI = YES\n R CONV = 1.00e-07 MIXED = YES\n E CONV = 1.00e-06 MIXED4 = YES\n R4S = NO REPL OTF = NO\n DIAG METHOD = SEM FOLLOW ROOT = 0\n PRECONDITIONER = DAVIDSON UPDATE = DAVIDSON\n S = 1.0000 Ms0 = NO\n GUESS VECTOR = H0BLOCK OPENTYPE = HIGHSPIN\n COLLAPSE SIZE = 1 HD AVG = EVANGELISTI\n MAX NUM VECS = 13 REF SYM = AUTO\n IOPEN = YES\n\n EX ALLOW = 1 1 1 1 1 1 1 1 \n STATE AVERAGE = 0(1.00) \n\n ==> CI Orbital and Space information <==\n\n ------------------------------------------------------------------------------\n Space Total Ag B1g B2g B3g Au B1u B2u B3u\n ------------------------------------------------------------------------------\n Nso 14 5 1 1 1 0 2 2 2\n Nmo 14 5 1 1 1 0 2 2 2\n Ndocc 3 2 0 0 0 0 1 0 0\n Nsocc 2 0 0 0 0 0 0 1 1\n ------------------------------------------------------------------------------\n MCSCF Spaces\n ------------------------------------------------------------------------------\n Frozen DOCC 0 0 0 0 0 0 0 0 0\n Restricted DOCC 0 0 0 0 0 0 0 0 0\n Active 14 5 1 1 1 0 2 2 2\n Restricted UOCC 0 0 0 0 0 0 0 0 0\n Frozen UOCC 0 0 0 0 0 0 0 0 0\n ------------------------------------------------------------------------------\n\n ==> Setting up CI strings <==\n\n There are 2002 alpha and 364 beta strings\n The CI space requires 91072 (9.11E+04) determinants and 8 blocks\n\n ==> Setting up MCSCF integrals <==\n\n Using in-core PK algorithm.\n Calculation information:\n Number of atoms: 1\n Number of AO shells: 6\n Number of primitives: 22\n Number of atomic orbitals: 15\n Number of basis functions: 14\n\n Integral cutoff 1.00e-12\n Number of threads: 2\n\n Performing in-core PK\n Using 11130 doubles for integral storage.\n We computed 342 shell quartets total.\n Whereas there are 231 unique shell quartets.\n 48.05 percent of shell quartets recomputed by reordering.\n\n ==> DiskJK: Disk-Based J/K Matrices <==\n\n J tasked: Yes\n K tasked: Yes\n wK tasked: No\n Memory [MiB]: 2084\n Schwarz Cutoff: 1E-12\n\n OpenMP threads: 2\n\n\n ==> Starting MCSCF iterations <==\n\n Iter Total Energy Delta E Orb RMS CI RMS NCI NORB\n @MCSCF 1: -74.911743845844 -1.2423e-01 0.00e+00 6.22e-07 8 1 Initial CI\n @MCSCF 2: -74.911743845844 -2.1316e-13 0.00e+00 0.00e+00 12 1 TS\n @MCSCF 3: -74.911743845844 -5.6843e-14 0.00e+00 0.00e+00 12 1 TS\n @MCSCF 4: -74.911743845845 -1.9895e-13 0.00e+00 0.00e+00 12 1 TS, DIIS\n\n @MCSCF has converged!\n\n @MCSCF Final Energy: -74.911743845844597\n\n Computing CI Semicanonical Orbitals\n\n ==> Energetics <==\n\n SCF energy = -74.787517462373700\n Total MCSCF energy = -74.911743845844597\n\n ==> MCSCF root 0 information <==\n\n MCSCF Root 0 energy = -74.911743845843020\n\n Active Space Natural occupation numbers:\n\n Ag 1.999940 Ag 1.980968 B1u 1.976491\n B2u 0.994932 B3u 0.994932 B1u 0.015399\n Ag 0.008346 B2u 0.005816 B3u 0.005816\n Ag 0.003708 B2g 0.003606 B3g 0.003606\n B1g 0.003220 Ag 0.003220\n\n The 20 most important determinants:\n\n * 1 0.978045 ( 1016, 220) 1AgX 2AgX 1B1uX 1B2uA 1B3uA \n * 2 0.079836 ( 1128, 220) 1AgX 2AgX 1B1uX 1B3uA 2B2uA \n * 3 -0.079836 ( 1192, 220) 1AgX 2AgX 1B1uX 1B2uA 2B3uA \n * 4 -0.053246 ( 1086, 242) 1AgX 2AgX 1B2uA 1B3uA 2B1uX \n * 5 0.039667 ( 1128, 242) 1AgX 2AgX 1B1uA 1B3uA 2B1uB 2B2uA \n * 6 -0.039667 ( 1192, 242) 1AgX 2AgX 1B1uA 1B2uA 2B1uB 2B3uA \n * 7 -0.030308 ( 1192, 221) 1AgX 2AgA 1B1uX 1B2uA 3AgB 2B3uA \n * 8 0.030308 ( 1128, 221) 1AgX 2AgA 1B1uX 1B3uA 3AgB 2B2uA \n * 9 -0.030167 ( 771, 84) 1AgX 2AgA 1B1uX 1B3uX 1B1gA \n * 10 0.030167 ( 516, 130) 1AgX 2AgA 1B1uX 1B2uX 1B1gA \n * 11 -0.030167 ( 507, 130) 1AgX 2AgA 1B1uX 1B2uB 1B3uA 4AgA \n * 12 -0.030167 ( 762, 84) 1AgX 2AgA 1B1uX 1B2uA 1B3uB 4AgA \n * 13 -0.030141 ( 1017, 242) 1AgX 2AgB 1B1uA 1B2uA 1B3uA 3AgA 2B1uB \n * 14 -0.029589 ( 1086, 221) 1AgX 2AgA 1B1uB 1B2uA 1B3uA 3AgB 2B1uA \n * 15 -0.029299 ( 1170, 220) 1AgX 2AgX 1B1uB 1B3uA 2B1uA 2B2uA \n * 16 0.029299 ( 1234, 220) 1AgX 2AgX 1B1uB 1B2uA 2B1uA 2B3uA \n * 17 0.029075 ( 781, 84) 1AgX 2AgA 1B1uB 1B2uA 1B3uX 1B2gA \n * 18 0.029075 ( 536, 130) 1AgX 2AgA 1B1uB 1B2uX 1B3uA 1B3gA \n * 19 -0.024661 ( 1256, 220) 1AgX 2AgX 1B1uX 2B2uA 2B3uA \n * 20 -0.023560 ( 255, 4) 1AgX 2AgX 1B2uA 1B3uA 5AgX \n\n\n\nProperties will be evaluated at 0.000000, 0.000000, 0.000000 [a0]\n\nProperties computed using the CASSCF density matrix\n\n Nuclear Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Electronic Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000\n\n Dipole Moment: [e a0]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n Dipole Moment: [D]\n X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000\n\n", "stderr": null, "error": null} -------------------------------------------------------------------------------- /Examples/C0_example_file_io/Oxygen_atom_C0.json: -------------------------------------------------------------------------------- 1 | {"C0": 0.978045, "C0^2": 0.956572} -------------------------------------------------------------------------------- /Examples/CAS_example.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import MultirefPredict\n", 10 | "import qcelemental" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 2, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "mol = qcelemental.models.Molecule(geometry=[0, 0, 0],\n", 20 | " symbols=[\"O\"],\n", 21 | " molecular_charge=0,\n", 22 | " molecular_multiplicity=3)" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": 3, 28 | "metadata": {}, 29 | "outputs": [ 30 | { 31 | "name": "stdout", 32 | "output_type": "stream", 33 | "text": [ 34 | "Compute C0 diagnostic of the given molecule:\n", 35 | "\n", 36 | "C0 DIAGNOSTICS: {'C0': 0.978, 'C0^2': 0.9566}\n" 37 | ] 38 | } 39 | ], 40 | "source": [ 41 | "C0 = MultirefPredict.diagnostic_factory(\"C0\",molecule=mol).computeDiagnostic()" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 4, 47 | "metadata": {}, 48 | "outputs": [ 49 | { 50 | "name": "stdout", 51 | "output_type": "stream", 52 | "text": [ 53 | "{'C0': 0.978, 'C0^2': 0.9566}\n" 54 | ] 55 | } 56 | ], 57 | "source": [] 58 | } 59 | ], 60 | "metadata": { 61 | "kernelspec": { 62 | "display_name": "qcengine", 63 | "language": "python", 64 | "name": "qcengine" 65 | }, 66 | "language_info": { 67 | "codemirror_mode": { 68 | "name": "ipython", 69 | "version": 3 70 | }, 71 | "file_extension": ".py", 72 | "mimetype": "text/x-python", 73 | "name": "python", 74 | "nbconvert_exporter": "python", 75 | "pygments_lexer": "ipython3", 76 | "version": "3.6.8" 77 | } 78 | }, 79 | "nbformat": 4, 80 | "nbformat_minor": 2 81 | } 82 | -------------------------------------------------------------------------------- /Examples/Example.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import MultirefPredict\n", 10 | "import qcelemental" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 2, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "mol = qcelemental.models.Molecule.from_data(\"\"\"\n", 20 | "O 0.000000000000 0.000000000000 -0.068516245955\n", 21 | "H 0.000000000000 -0.790689888800 0.543701278274\n", 22 | "H 0.000000000000 0.790689888800 0.543701278274\n", 23 | "\"\"\")" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 3, 29 | "metadata": {}, 30 | "outputs": [ 31 | { 32 | "name": "stdout", 33 | "output_type": "stream", 34 | "text": [ 35 | "Compute B1 diagnostic of the given molecule:\n", 36 | "Trying to determine the dissociation limit of the molecule\n", 37 | "\n", 38 | "Dissociation limit of the molecule:\n", 39 | "------------------------------\n", 40 | "Atom Count Charge spin \n", 41 | "------------------------------\n", 42 | " O 1 0.0 3 \n", 43 | " H 2 0.0 2 \n", 44 | "------------------------------\n", 45 | "\n", 46 | "Calculate atomization energy with method: blyp\n", 47 | "Evaluating the energy of the whole molecule...\n", 48 | "Final energy of the molecule (Hartree): -76.36645993\n", 49 | "Evaluating the energy of the atomization limit of the molecule...\n", 50 | "Final energy of atom O (Hartree): -75.04456340\n", 51 | "Final energy of atom H (Hartree): -0.49544692\n", 52 | "Final energy of the atomized limit (Hartree): -76.03545724\n", 53 | "Atomization energy (Hartree): 0.33100269\n", 54 | "\n", 55 | "\n", 56 | "Calculate atomization energy with method: b1lyp\n", 57 | "Evaluating the energy of the whole molecule...\n", 58 | "Final energy of the molecule (Hartree): -76.35352874\n", 59 | "Evaluating the energy of the atomization limit of the molecule...\n", 60 | "Final energy of atom O (Hartree): -75.04291669\n", 61 | "Final energy of atom H (Hartree): -0.49613954\n", 62 | "Final energy of the atomized limit (Hartree): -76.03519577\n", 63 | "Atomization energy (Hartree): 0.31833296\n", 64 | "\n", 65 | "Number of bonds in the molecule: 2\n", 66 | "\n", 67 | "B1 DIAGNOSTICS: 0.006\n" 68 | ] 69 | } 70 | ], 71 | "source": [ 72 | "b1 = MultirefPredict.diagnostic_factory(\"B1\",molecule=mol, molname=\"water\", record=False).computeDiagnostic()" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": null, 78 | "metadata": {}, 79 | "outputs": [], 80 | "source": [ 81 | "print(b1)" 82 | ] 83 | }, 84 | { 85 | "cell_type": "code", 86 | "execution_count": null, 87 | "metadata": {}, 88 | "outputs": [], 89 | "source": [ 90 | "A25PBE = MultirefPredict.diagnostic_factory(\"A25PBE\",molecule=mol).computeDiagnostic()" 91 | ] 92 | }, 93 | { 94 | "cell_type": "code", 95 | "execution_count": null, 96 | "metadata": {}, 97 | "outputs": [], 98 | "source": [ 99 | "print(A25PBE)" 100 | ] 101 | }, 102 | { 103 | "cell_type": "code", 104 | "execution_count": null, 105 | "metadata": {}, 106 | "outputs": [], 107 | "source": [ 108 | "tae = MultirefPredict.diagnostic_factory(\"TAE\",molecule=mol).computeDiagnostic()" 109 | ] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": null, 114 | "metadata": {}, 115 | "outputs": [], 116 | "source": [ 117 | "print(tae)" 118 | ] 119 | }, 120 | { 121 | "cell_type": "code", 122 | "execution_count": null, 123 | "metadata": {}, 124 | "outputs": [], 125 | "source": [ 126 | "atom_task = qcelemental.models.ResultInput (\n", 127 | " molecule = mol,\n", 128 | " driver = \"energy\",\n", 129 | " model = {\"method\" : 'b3lyp', \"basis\" : \"6-31g\"},\n", 130 | " )" 131 | ] 132 | }, 133 | { 134 | "cell_type": "code", 135 | "execution_count": null, 136 | "metadata": {}, 137 | "outputs": [], 138 | "source": [ 139 | "import qcengine\n", 140 | "atom_result = qcengine.compute(atom_task, \"psi4\")" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": null, 146 | "metadata": {}, 147 | "outputs": [], 148 | "source": [ 149 | "help(atom_result)" 150 | ] 151 | }, 152 | { 153 | "cell_type": "code", 154 | "execution_count": null, 155 | "metadata": {}, 156 | "outputs": [], 157 | "source": [ 158 | "atom_result.dict()" 159 | ] 160 | }, 161 | { 162 | "cell_type": "code", 163 | "execution_count": null, 164 | "metadata": {}, 165 | "outputs": [], 166 | "source": [ 167 | "import json\n", 168 | "import pickle" 169 | ] 170 | }, 171 | { 172 | "cell_type": "code", 173 | "execution_count": null, 174 | "metadata": {}, 175 | "outputs": [], 176 | "source": [ 177 | "outdict = atom_result.dict()\n", 178 | "outdict['molecule']['geometry']=outdict['molecule']['geometry'].flatten().tolist()\n", 179 | "f = open('test.json', 'w')\n", 180 | "json.dump(outdict, f)" 181 | ] 182 | }, 183 | { 184 | "cell_type": "code", 185 | "execution_count": null, 186 | "metadata": {}, 187 | "outputs": [], 188 | "source": [ 189 | "outdict['molecule']['geometry']" 190 | ] 191 | }, 192 | { 193 | "cell_type": "code", 194 | "execution_count": null, 195 | "metadata": {}, 196 | "outputs": [], 197 | "source": [] 198 | } 199 | ], 200 | "metadata": { 201 | "kernelspec": { 202 | "display_name": "qcengine", 203 | "language": "python", 204 | "name": "qcengine" 205 | }, 206 | "language_info": { 207 | "codemirror_mode": { 208 | "name": "ipython", 209 | "version": 3 210 | }, 211 | "file_extension": ".py", 212 | "mimetype": "text/x-python", 213 | "name": "python", 214 | "nbconvert_exporter": "python", 215 | "pygments_lexer": "ipython3", 216 | "version": "3.6.8" 217 | } 218 | }, 219 | "nbformat": 4, 220 | "nbformat_minor": 2 221 | } 222 | -------------------------------------------------------------------------------- /Examples/O.xyz: -------------------------------------------------------------------------------- 1 | 1 2 | 3 | O 0 0 0 4 | -------------------------------------------------------------------------------- /Examples/example_file_io.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import MultirefPredict\n", 10 | "import qcelemental" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 2, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "input_dict = {\"xyzfile\": \"./water.xyz\",\n", 20 | " \"molname\": \"water\",\n", 21 | " \"charge\": 0,\n", 22 | " \"spinmult\": 1,\n", 23 | " \"rundir\": './B1_example_file_io',\n", 24 | " \"program\": 'psi4',\n", 25 | " \"record\": True}" 26 | ] 27 | }, 28 | { 29 | "cell_type": "code", 30 | "execution_count": 3, 31 | "metadata": {}, 32 | "outputs": [ 33 | { 34 | "name": "stdout", 35 | "output_type": "stream", 36 | "text": [ 37 | "kwargs: {'xyzfile': './water.xyz', 'molname': 'water', 'charge': 0, 'spinmult': 1, 'rundir': './B1_example_file_io', 'program': 'psi4', 'record': True, 'diagnostic_type': 'B1'}\n", 38 | "Compute B1 diagnostic of the given molecule:\n", 39 | "Trying to determine the dissociation limit of the molecule\n", 40 | "\n", 41 | "Dissociation limit of the molecule:\n", 42 | "------------------------------\n", 43 | "Atom Count Charge spin \n", 44 | "------------------------------\n", 45 | " O 1 0.0 3 \n", 46 | " H 2 0.0 2 \n", 47 | "------------------------------\n", 48 | "\n", 49 | "Calculate atomization energy with method: blyp\n", 50 | "Evaluating the energy of the whole molecule...\n", 51 | "Final energy of the molecule (Hartree): -76.36645993\n", 52 | "Evaluating the energy of the atomization limit of the molecule...\n", 53 | "Final energy of atom O (Hartree): -75.04456340\n", 54 | "Final energy of atom H (Hartree): -0.49544692\n", 55 | "Final energy of the atomized limit (Hartree): -76.03545724\n", 56 | "Atomization energy (Hartree): 0.33100269\n", 57 | "\n", 58 | "\n", 59 | "Calculate atomization energy with method: b1lyp\n", 60 | "Evaluating the energy of the whole molecule...\n", 61 | "Final energy of the molecule (Hartree): -76.35352874\n", 62 | "Evaluating the energy of the atomization limit of the molecule...\n", 63 | "Final energy of atom O (Hartree): -75.04291669\n", 64 | "Final energy of atom H (Hartree): -0.49613954\n", 65 | "Final energy of the atomized limit (Hartree): -76.03519577\n", 66 | "Atomization energy (Hartree): 0.31833296\n", 67 | "\n", 68 | "Number of bonds in the molecule: 2\n", 69 | "\n", 70 | "B1 DIAGNOSTICS: 0.006\n" 71 | ] 72 | } 73 | ], 74 | "source": [ 75 | "b1 = MultirefPredict.diagnostic_factory(\"B1\", **input_dict).computeDiagnostic()" 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": null, 81 | "metadata": {}, 82 | "outputs": [], 83 | "source": [ 84 | "C0 = MultirefPredict.diagnostic_factory(\"C0\", xyzfile=\"./O.xyz\", molname=\"Oxygen_atom\", \n", 85 | " charge=0, spinmult=3, rundir='./C0_example_file_io', \n", 86 | " program='psi4', record=True).computeDiagnostic()" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": null, 92 | "metadata": {}, 93 | "outputs": [], 94 | "source": [] 95 | } 96 | ], 97 | "metadata": { 98 | "kernelspec": { 99 | "display_name": "qcengine", 100 | "language": "python", 101 | "name": "qcengine" 102 | }, 103 | "language_info": { 104 | "codemirror_mode": { 105 | "name": "ipython", 106 | "version": 3 107 | }, 108 | "file_extension": ".py", 109 | "mimetype": "text/x-python", 110 | "name": "python", 111 | "nbconvert_exporter": "python", 112 | "pygments_lexer": "ipython3", 113 | "version": "3.6.8" 114 | } 115 | }, 116 | "nbformat": 4, 117 | "nbformat_minor": 2 118 | } 119 | -------------------------------------------------------------------------------- /Examples/water.xyz: -------------------------------------------------------------------------------- 1 | 3 2 | 3 | O 0.000000000000 0.000000000000 -0.068516245955 4 | H 0.000000000000 -0.790689888800 0.543701278274 5 | H 0.000000000000 0.790689888800 0.543701278274 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright 2019 Kulik group at MIT 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided with the distribution. 11 | 12 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 13 | products derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 16 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 20 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 21 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | -------------------------------------------------------------------------------- /MultirefPredict/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | MultirefPredict 3 | Automated workflow to predict multireference character of molecules in quantum chemistry calculation 4 | """ 5 | 6 | # Add imports here 7 | from .multirefpredict import diagnostic_factory 8 | 9 | # Handle versioneer 10 | from ._version import get_versions 11 | versions = get_versions() 12 | __version__ = versions['version'] 13 | __git_revision__ = versions['full-revisionid'] 14 | del get_versions, versions 15 | -------------------------------------------------------------------------------- /MultirefPredict/basis_info.py: -------------------------------------------------------------------------------- 1 | import basis_set_exchange 2 | import re 3 | import qcelemental as qcel 4 | 5 | def element_to_num_AO(symbol, basis_set): 6 | parsed_basis_set = basis_set 7 | if basis_set.lower() == "lacvps_ecp" or basis_set.lower() == "lacvp*_ecp": 8 | atomic_num = qcel.periodictable.to_atomic_number(symbol) 9 | if atomic_num <= 18: 10 | parsed_basis_set = "6-31g*" 11 | else: 12 | parsed_basis_set = "lanl2dz" 13 | basis_str = basis_set_exchange.get_basis(parsed_basis_set 14 | ,elements = [symbol],fmt = 'turbomole', header = False) 15 | basis_lines = basis_str.split('\n') 16 | AO = 0 17 | for line in basis_lines: 18 | mobj = re.search(r'\s+\d+\s+[a-z]+', line ) 19 | if mobj: 20 | if line.split()[1] == "s": 21 | AO += 1 22 | if line.split()[1] == "p": 23 | AO += 3 24 | if line.split()[1] == "d": 25 | AO += 6 26 | return AO 27 | 28 | def molecule_to_num_AO(molecule, basis_set): 29 | elements = {} 30 | # Build a dictionary of "element":count 31 | for symbol in molecule.symbols: 32 | if symbol not in elements: 33 | elements[symbol] = 1 34 | else: 35 | elements[symbol] += 1 36 | # Sum up the AO for all atoms 37 | AO = 0 38 | for symbol in elements: 39 | AO += element_to_num_AO(symbol, basis_set)*elements[symbol] 40 | 41 | core_AO = 0 42 | for symbol in elements: 43 | core_AO += element_to_core_AO(symbol, basis_set)*elements[symbol] 44 | 45 | return AO, core_AO 46 | 47 | def element_to_core_AO(symbol, basis_set): 48 | core_AO = 0 49 | using_ecp = False 50 | # May add more cases about ecp in the future 51 | if basis_set.lower() in [ "lacvp*_ecp", "lacvps_ecp", "lanl2dz" ]: 52 | using_ecp = True 53 | 54 | atomic_num = qcel.periodictable.to_atomic_number(symbol) 55 | if atomic_num <= 2: 56 | core_AO = 0 57 | elif atomic_num in range(3,11): 58 | core_AO = 1 59 | elif atomic_num in range(11,19): 60 | core_AO = 5 61 | elif atomic_num > 18: 62 | if not using_ecp: 63 | if atomic_num in range(19,37): 64 | core_AO = 5 65 | elif atomic_num in range(37,55): 66 | core_AO = 9 #1s2s2p3s3p 67 | elif atomic_num in range(55,87): 68 | core_AO = 18 69 | else: 70 | core_AO = 27 71 | else: 72 | core_AO = 0 73 | 74 | return core_AO 75 | -------------------------------------------------------------------------------- /MultirefPredict/casbased_diagnostic.py: -------------------------------------------------------------------------------- 1 | """ 2 | casscf_based_diag.py 3 | 4 | Classes that calculate the casscf based multireference diagnostics 5 | """ 6 | from abc import abstractmethod 7 | import numpy as np 8 | import qcengine 9 | import qcelemental 10 | from MultirefPredict.diagnostic import Diagnostic 11 | from MultirefPredict.io_tools import qcres_to_json, write_diagnostics_to_json 12 | 13 | 14 | def obtainC0fromstr(outfile): 15 | C0 = 'undef' 16 | for line in outfile: 17 | if "* 1" in line: 18 | try: 19 | C0 = float(line.split()[2]) 20 | except ValueError: 21 | C0 = np.nan 22 | return C0 23 | 24 | 25 | class CASBasedDiagnostic(Diagnostic): 26 | def __init__(self, **kwargs): 27 | Diagnostic.__init__(self, **kwargs) 28 | self.results = False 29 | self.C0 = np.nan 30 | 31 | def compute(self): 32 | print(self.molecule) 33 | casscf_task = qcelemental.models.ResultInput(molecule=self.molecule, 34 | driver="energy", 35 | model={"method": "casscf", "basis": "cc-pvdz"}, 36 | keywords={"reference": "rohf"} 37 | ) 38 | self.results = qcengine.compute(casscf_task, "psi4") 39 | if not self.results.success: 40 | raise RuntimeError("Quantum chemistry calculation failed.") 41 | else: 42 | self.get_C0() 43 | if self.record: 44 | filename = self.rundir + "/" + self.diagnostic_type + "_" + self.molname + "_" + "casscf" + "_" + "whole" + ".json" 45 | qcres_to_json(self.results, filename=filename) 46 | 47 | def get_C0(self): 48 | outfile = self.results.stdout.split("\n") 49 | self.C0 = obtainC0fromstr(outfile) 50 | 51 | """ 52 | Compute the diagnostic 53 | """ 54 | 55 | @abstractmethod 56 | def computeDiagnostic(self): 57 | pass 58 | 59 | 60 | class C0(CASBasedDiagnostic): 61 | def __init__(self, **kwargs): 62 | CASBasedDiagnostic.__init__(self, **kwargs) 63 | self.diagnostic_type = "C0" 64 | 65 | """ 66 | Compute the B1 diagnostic 67 | """ 68 | 69 | def computeDiagnostic(self): 70 | print("Compute C0 diagnostic of the given molecule:") 71 | self.molecule.pretty_print() 72 | self.compute() 73 | diag = dict() 74 | diag.update({"C0": round(self.C0, 6), 75 | "C0^2": round(self.C0 * self.C0, 6) 76 | }) 77 | print("\nC0 DIAGNOSTICS: ", diag) 78 | if self.record: 79 | filename = self.rundir + "/" + self.molname + "_" + self.diagnostic_type + ".json" 80 | write_diagnostics_to_json(diag, filename) 81 | return diag 82 | -------------------------------------------------------------------------------- /MultirefPredict/ccbased_diagnostic.py: -------------------------------------------------------------------------------- 1 | """ 2 | energy_based_diag.py 3 | 4 | Classes that calculate the energy based multireference diagnostics 5 | """ 6 | import qcengine 7 | import qcelemental 8 | from MultirefPredict.diagnostic import Diagnostic 9 | from MultirefPredict.io_tools import qcres_to_json, write_diagnostics_to_json 10 | 11 | 12 | class CCBased(Diagnostic): 13 | def __init__(self, **kwargs): 14 | Diagnostic.__init__(self, **kwargs) 15 | self.diagnostic_type = "CCbased" 16 | self.result = False 17 | if self.program != "psi4": 18 | raise ValueError("Support for packages other than psi4 for CCBased \ 19 | diagnostics is to be done\n") 20 | 21 | """ 22 | Do CCSD(T) calculation for the given molecule 23 | Input: self 24 | Ouput: QCElemental Result 25 | """ 26 | 27 | def computeCCSDT(self): 28 | print("") 29 | print("Preparing CCSD(T) calculation") 30 | method = "ccsd(t)" 31 | basis = "cc-pvdz" 32 | if self.program != "psi4": 33 | raise ValueError("Support for packages other than psi4 is to be done\n") 34 | 35 | # Caculate energy for the whole molecule 36 | molecule_task = qcelemental.models.ResultInput( 37 | molecule=self.molecule, 38 | driver="energy", 39 | model={"method": method, "basis": basis}, 40 | ) 41 | print("Evaluating the energy of the whole molecule...") 42 | self.result = qcengine.compute(molecule_task, "psi4") 43 | print("self.result:", self.result) 44 | if not self.result.success: 45 | raise RuntimeError("Quantum chemistry calculation failed.") 46 | if self.record: 47 | filename = self.rundir + "/" + self.diagnostic_type + "_" + self.molname + "_" + "ccsd(t)" + "_" + "whole" + ".json" 48 | qcres_to_json(self.result, filename=filename) 49 | 50 | """ 51 | Compute the CCBased diagnostic 52 | """ 53 | 54 | def computeDiagnostic(self): 55 | print("Compute CC based diagnostics of the given molecule:") 56 | self.molecule.pretty_print() 57 | self.computeCCSDT() 58 | 59 | if not self.result.success: 60 | raise RuntimeError("Quantum chemistry calculation failed.") 61 | 62 | T1 = self.result.extras['qcvars']['CC T1 DIAGNOSTIC'] 63 | D1 = self.result.extras['qcvars']['CC D1 DIAGNOSTIC'] 64 | D2 = self.result.extras['qcvars']['CC D2 DIAGNOSTIC'] 65 | NewD1 = self.result.extras['qcvars']['CC NEW D1 DIAGNOSTIC'] 66 | diag = {"T1": T1, "D1": D1, "D2": D2, "New D1": NewD1} 67 | print("\nCCBased DIAGNOSTICS:", diag) 68 | if self.record: 69 | filename = self.rundir + "/" + self.molname + "_" + self.diagnostic_type + ".json" 70 | write_diagnostics_to_json(diag, filename) 71 | return diag 72 | -------------------------------------------------------------------------------- /MultirefPredict/cheminfo.py: -------------------------------------------------------------------------------- 1 | import qcelemental 2 | import openbabel 3 | 4 | def qcelemental2xyz(molecule): 5 | mol_str = molecule.pretty_print().strip('\n').split('\n') 6 | natom = len(molecule.symbols) 7 | startline = -natom 8 | coords = mol_str[startline:] 9 | xyz = str(natom) + "\n\n" 10 | for line in coords: 11 | xyz += line + "\n" 12 | return xyz 13 | 14 | def qcelemental2OBMol(molecule): 15 | xyz = qcelemental2xyz(molecule) 16 | obmol = openbabel.OBMol() 17 | obConversion = openbabel.OBConversion() 18 | obConversion.SetInAndOutFormats("xyz","smi") 19 | obConversion.ReadString(obmol,xyz) 20 | return obmol 21 | 22 | def xyzfile2qcelemental(xyzfile, charge=0, spinmult=1): 23 | xyz = open(xyzfile).readlines() 24 | mol_str = str(charge)+" "+str(spinmult) + "\n" 25 | for i in range(2, len(xyz)): 26 | mol_str += xyz[i] 27 | molecule = qcelemental.models.Molecule.from_data(mol_str) 28 | return molecule 29 | -------------------------------------------------------------------------------- /MultirefPredict/data/README.md: -------------------------------------------------------------------------------- 1 | # Sample Package Data 2 | 3 | This directory contains sample additional data you may want to include with your package. 4 | This is a place where non-code related additional information (such as data files, molecular structures, etc.) can 5 | go that you want to ship alongside your code. 6 | 7 | Please note that it is not recommended to place large files in your git directory. If your project requires files larger 8 | than a few megabytes in size it is recommended to host these files elsewhere. This is especially true for binary files 9 | as the `git` structure is unable to correctly take updates to these files and will store a complete copy of every version 10 | in your `git` history which can quickly add up. As a note most `git` hosting services like GitHub have a 1 GB per repository 11 | cap. 12 | 13 | ## Including package data 14 | 15 | Modify your package's `setup.py` file and the `setup()` command. Include the 16 | [`package_data`](http://setuptools.readthedocs.io/en/latest/setuptools.html#basic-use) keyword and point it at the 17 | correct files. 18 | 19 | ## Manifest 20 | 21 | * `look_and_say.dat`: first entries of the "Look and Say" integer series, sequence [A005150](https://oeis.org/A005150) 22 | -------------------------------------------------------------------------------- /MultirefPredict/data/look_and_say.dat: -------------------------------------------------------------------------------- 1 | 1 2 | 11 3 | 21 4 | 1211 5 | 111221 6 | 312211 7 | 13112221 8 | 1113213211 9 | 31131211131221 10 | 13211311123113112211 11 | 11131221133112132113212221 12 | 3113112221232112111312211312113211 13 | 1321132132111213122112311311222113111221131221 14 | 11131221131211131231121113112221121321132132211331222113112211 15 | 311311222113111231131112132112311321322112111312211312111322212311322113212221 -------------------------------------------------------------------------------- /MultirefPredict/diagnostic.py: -------------------------------------------------------------------------------- 1 | """ 2 | multirefpredict.py 3 | Automated workflow to predict multireference character of molecules in quantum chemistry calculation 4 | 5 | Handles the primary functions 6 | """ 7 | from abc import ABC, abstractmethod 8 | import qcelemental 9 | from MultirefPredict.cheminfo import xyzfile2qcelemental 10 | from MultirefPredict.io_tools import ensure_dir 11 | from MultirefPredict.globs import keywords_avail, available_programs 12 | 13 | 14 | class Diagnostic(ABC): 15 | ### Attributes that are in common for different diagnostics should go in here. 16 | def __init__(self, **kwargs): 17 | print("inputs dictionary:", kwargs) 18 | self.keywords_avail = keywords_avail 19 | self.xyzfile = False 20 | self.molname = kwargs["molname"] if "molname" in kwargs.keys() else "undef" 21 | self.rundir = kwargs["rundir"] if "rundir" in kwargs.keys() else "./" 22 | self.record = kwargs["record"] if "record" in kwargs.keys() else False 23 | self.program = kwargs["program"] if "program" in kwargs.keys() else "psi4" 24 | self.wfn = kwargs["wfn"] if "wfn" in kwargs.keys() else None 25 | self.extras = kwargs["extras"] if "extras" in kwargs.keys() else None 26 | self.initialization_check(**kwargs) 27 | self.levelshiftvala = kwargs["levelshiftvala"] if "levelshiftvala" in kwargs.keys() else 0.25 28 | self.levelshiftvalb = kwargs["levelshiftvalb"] if "levelshiftvalb" in kwargs.keys() else 0.25 29 | 30 | def initialization_check(self, **kwargs): 31 | ensure_dir(self.rundir) 32 | for key, value in kwargs.items(): 33 | if key not in self.keywords_avail: 34 | raise KeyError("Energy based diagnostic: unrecoganized key") 35 | if self.program not in available_programs: 36 | raise ValueError("Energy based diagnostic: specified program is not supported yet") 37 | if self.wfn is not None: 38 | if not isinstance(self.wfn, list) or len(self.wfn) != 3: 39 | raise ValueError("Wavefunction initial guess: keyword argument should be a list"\ 40 | + "composing of the ca0_path, cb0_path, and c0_path") 41 | if self.extras is not None: 42 | if not isinstance(self.extras, list): 43 | raise ValueError("Input keyword \"extras\" should be a list of "\ 44 | + "extra files to be collected from calculation") 45 | if "xyzfile" in kwargs.keys(): 46 | self.xyzfile = kwargs["xyzfile"] 47 | self.charge = kwargs["charge"] if "charge" in kwargs.keys() else 0 48 | self.spinmult = kwargs["spinmult"] if "spinmult" in kwargs.keys() else 1 49 | self.molecule = xyzfile2qcelemental(self.xyzfile, charge=self.charge, spinmult=self.spinmult) 50 | elif "molecule" in kwargs.keys(): 51 | self.molecule = kwargs['molecule'] 52 | if not isinstance(self.molecule, qcelemental.models.Molecule): 53 | raise TypeError("Argument molecule must be a molecule instance") 54 | if self.xyzfile: 55 | raise ValueError( 56 | "Cannot have both the xyzfile and 'qcelemental.models.Molecule' as inputs the same time.") 57 | else: 58 | raise KeyError("Must input either a xyzfile file or an instance of 'qcelemental.models.Molecule'") 59 | 60 | @abstractmethod 61 | def computeDiagnostic(self): 62 | pass 63 | -------------------------------------------------------------------------------- /MultirefPredict/ebased_diagnostic.py: -------------------------------------------------------------------------------- 1 | """ 2 | energy_based_diag.py 3 | 4 | Classes that calculate the energy based multireference diagnostics 5 | """ 6 | from abc import abstractmethod 7 | import qcengine 8 | import qcelemental 9 | 10 | from MultirefPredict.io_tools import qcres_to_json, write_diagnostics_to_json 11 | from MultirefPredict.spin import atomSpinMultDict 12 | from MultirefPredict.cheminfo import qcelemental2OBMol 13 | from MultirefPredict.diagnostic import Diagnostic 14 | 15 | 16 | class EBasedDiagnostic(Diagnostic): 17 | def __init__(self, **kwargs): 18 | Diagnostic.__init__(self, **kwargs) 19 | self.atomized = {} 20 | 21 | """ 22 | Identify unique atoms, create a dictionary for the time they repeat, 23 | the qcelemental molecule instance, and the energy 24 | 25 | """ 26 | 27 | def mol2atoms(self): 28 | print("Trying to determine the dissociation limit of the molecule\n") 29 | # if the dissociated atoms have been created 30 | if self.atomized: 31 | return True 32 | 33 | # First initialize the list of dictionary for atomized molecule 34 | if self.molecule.molecular_charge != 0: 35 | raise ValueError("Logic for assigning charge and spin states for \ 36 | charged molecule is still under experiment.") 37 | 38 | for symbol in self.molecule.symbols: 39 | if symbol in self.atomized: 40 | self.atomized[symbol]["count"] += 1 41 | else: 42 | spinDict = atomSpinMultDict() 43 | spinmult = spinDict.get_spinmult(symbol) 44 | charge = 0 45 | geo = [0, 0, 0] 46 | atom = qcelemental.models.Molecule(geometry=geo, 47 | symbols=[symbol], 48 | molecular_charge=charge, 49 | molecular_multiplicity=spinmult) 50 | self.atomized[symbol] = {"count": 1, 51 | "molecule": atom, 52 | "energy": 0 53 | } 54 | 55 | # Summarize the dissociation limit 56 | print("Dissociation limit of the molecule:") 57 | print("-" * 30) 58 | print("{:6}".format("Atom"), "{:8}".format("Count"), 59 | "{:8}".format("Charge"), "{:8}".format("spin")) 60 | print("-" * 30) 61 | for symbol in self.atomized: 62 | print("{:^6}".format(symbol), "{:^8}".format(self.atomized[symbol]["count"]), 63 | "{:^8}".format(self.atomized[symbol]["molecule"].molecular_charge), 64 | "{:^8}".format(self.atomized[symbol]["molecule"].molecular_multiplicity)) 65 | print("-" * 30) 66 | 67 | return True 68 | 69 | """ 70 | Compute the binding energy of the molecule with given method 71 | """ 72 | 73 | def energyTask(self, mol, method, program): 74 | task = None 75 | if program == "psi4": 76 | task = qcelemental.models.ResultInput( 77 | molecule=mol, 78 | driver="energy", 79 | model={"method": method, "basis": "6-31g"}, 80 | ) 81 | elif program == "terachem": 82 | tc_method = method if mol.molecular_multiplicity == 1 else "u" + method 83 | task = qcelemental.models.ResultInput( 84 | molecule=mol, 85 | driver="energy", 86 | model={"method": method, "basis": "6-31g"}, 87 | keywords={"gpus":"1", 88 | "maxit":"1500", 89 | "scf":"diis+a", 90 | "convthre":"1e-6", 91 | "precision":"double", 92 | "units":"bohr", 93 | "method":tc_method} 94 | ) 95 | return task 96 | 97 | def computeBE(self, method): 98 | print("") 99 | print("Calculate atomization energy with method: ", method) 100 | 101 | # Caculate energy for the whole molecule 102 | molecule_task = self.energyTask(self.molecule, method, self.program) 103 | 104 | print("Evaluating the energy of the whole molecule...") 105 | molecule_result = qcengine.compute(molecule_task, self.program) 106 | if self.record: 107 | filename = self.rundir + "/" + self.diagnostic_type + "_" \ 108 | + self.molname + "_" + method + "_" + "whole" + ".json" 109 | qcres_to_json(molecule_result, filename=filename) 110 | if not molecule_result.success: 111 | raise RuntimeError("Quantum chemistry calculation failed.") 112 | molecule_energy = molecule_result.return_result 113 | print("Final energy of the molecule (Hartree): {:.8f}".format(molecule_energy)) 114 | 115 | print("Evaluating the energy of the atomization limit of the molecule...") 116 | if not self.atomized: 117 | self.mol2atoms() 118 | 119 | # Calculate energy for each unique atom at the atomization limit 120 | for symbol in self.atomized: 121 | atom_result = None 122 | if self.program == "terachem" and symbol == "H": 123 | atom_task = self.energyTask(self.atomized[symbol]["molecule"], method, "psi4") 124 | atom_result = qcengine.compute(atom_task, "psi4") 125 | else: 126 | atom_task = self.energyTask(self.atomized[symbol]["molecule"], method, self.program) 127 | atom_result = qcengine.compute(atom_task, self.program) 128 | if not atom_result.success: 129 | raise RuntimeError("Quantum chemistry calculation failed.") 130 | if self.record: 131 | filename = self.rundir + "/" + self.diagnostic_type + "_"\ 132 | + self.molname + "_" + method + "_" + symbol + ".json" 133 | qcres_to_json(atom_result, filename=filename) 134 | atom_energy = atom_result.return_result 135 | print("Final energy of atom ", symbol, " (Hartree): {:.8f}".format(atom_energy)) 136 | self.atomized[symbol]["energy"] = atom_energy 137 | 138 | # Calculate BE 139 | BE = 0 140 | for symbol in self.atomized: 141 | BE += self.atomized[symbol]["energy"] * self.atomized[symbol]["count"] 142 | print("Final energy of the atomized limit (Hartree): {:.8f}".format(BE)) 143 | 144 | BE = BE - molecule_energy 145 | print("Atomization energy (Hartree): {:.8f}".format(BE)) 146 | print("") 147 | 148 | return BE 149 | 150 | """ 151 | Compute the diagnostic 152 | """ 153 | 154 | @abstractmethod 155 | def computeDiagnostic(self): 156 | pass 157 | 158 | 159 | class B1(EBasedDiagnostic): 160 | def __init__(self, **kwargs): 161 | EBasedDiagnostic.__init__(self, **kwargs) 162 | self.diagnostic_type = "B1" 163 | self.numBonds = qcelemental2OBMol(self.molecule).NumBonds() 164 | 165 | """ 166 | Compute the B1 diagnostic 167 | """ 168 | 169 | def computeDiagnostic(self): 170 | print("Compute B1 diagnostic of the given molecule:") 171 | self.molecule.pretty_print() 172 | self.mol2atoms() 173 | BE_BLYP = self.computeBE("blyp") 174 | BE_B1LYP = self.computeBE("b1lyp") 175 | print("Number of bonds in the molecule: ", self.numBonds) 176 | diag = (BE_BLYP - BE_B1LYP) / float(self.numBonds) 177 | print("\nB1 DIAGNOSTICS: {:.3f}".format(diag)) 178 | if self.record: 179 | diag_dict = {self.diagnostic_type: diag} 180 | filename = self.rundir + "/" + self.molname + "_" + self.diagnostic_type + ".json" 181 | write_diagnostics_to_json(diag_dict, filename) 182 | return diag 183 | 184 | 185 | class A25PBE(EBasedDiagnostic): 186 | def __init__(self, **kwargs): 187 | EBasedDiagnostic.__init__(self, **kwargs) 188 | self.diagnostic_type = "A25PBE" 189 | 190 | """ 191 | Compute the A25PBE diagnostic 192 | """ 193 | 194 | def computeDiagnostic(self): 195 | print("Compute A25PBE diagnostic of the given molecule:") 196 | self.molecule.pretty_print() 197 | self.mol2atoms() 198 | TAE_PBE = self.computeBE("pbe") 199 | TAE_PBE0 = self.computeBE("pbe0") 200 | diag = 4 * (1 - TAE_PBE0 / TAE_PBE) 201 | print("\nA25PBE DIAGNOSTICS: {:.3f}".format(diag)) 202 | if self.record: 203 | diag_dict = {self.diagnostic_type: diag} 204 | filename = self.rundir + "/" + self.molname + "_" + self.diagnostic_type + ".json" 205 | write_diagnostics_to_json(diag_dict, filename) 206 | return diag 207 | 208 | 209 | class TAE(EBasedDiagnostic): 210 | def __init__(self, **kwargs): 211 | EBasedDiagnostic.__init__(self, **kwargs) 212 | self.diagnostic_type = "TAE" 213 | if self.program != "psi4": 214 | raise ValueError("Support for packages other than psi4 for TAE \ 215 | diagnostic is to be done\n") 216 | 217 | """ 218 | Compute the TAE diagnostic 219 | """ 220 | 221 | def computeDiagnostic(self): 222 | print("Compute TAE diagnostic of the given molecule:") 223 | self.molecule.pretty_print() 224 | self.mol2atoms() 225 | TAE_CCSD = self.computeBE("ccsd") 226 | TAE_CCSDT = self.computeBE("ccsd(t)") 227 | diag = 100 * (1 - TAE_CCSD / TAE_CCSDT) 228 | print("\nTAE DIAGNOSTICS: {:.3f}".format(diag)) 229 | if self.record: 230 | diag_dict = {self.diagnostic_type: diag} 231 | filename = self.rundir + "/" + self.molname + "_" + self.diagnostic_type + ".json" 232 | write_diagnostics_to_json(diag_dict, filename) 233 | return diag 234 | -------------------------------------------------------------------------------- /MultirefPredict/fonbased_diagnostic.py: -------------------------------------------------------------------------------- 1 | """ 2 | energy_based_diag.py 3 | 4 | Classes that calculate the energy based multireference diagnostics 5 | """ 6 | import qcengine 7 | import qcelemental 8 | import math 9 | import sys 10 | import json 11 | 12 | from MultirefPredict.io_tools import qcres_to_json, write_diagnostics_to_json 13 | from MultirefPredict.diagnostic import Diagnostic 14 | from MultirefPredict.basis_info import molecule_to_num_AO 15 | 16 | 17 | class FonBased(Diagnostic): 18 | def __init__(self, **kwargs): 19 | Diagnostic.__init__(self, **kwargs) 20 | self.diagnostic_type = "FonBased" 21 | self.fons = None 22 | self.restricted = False 23 | self.norb = 0 24 | self.ncore = 0 25 | self.nele = 0 26 | self.Hartree2K = 3.16681e-6 27 | if "temp_K" in kwargs.keys(): 28 | self.temp_K = kwargs["temp_K"] 29 | else: 30 | self.temp_K = False 31 | 32 | def setTemperature(self, method): 33 | if not isinstance(method, str): 34 | raise ValueError("The arguement for DFT method must be of type str") 35 | temp = 0.01583405237 36 | LDAsOrGGAs = ["svwn", "pbe", "blyp", "revpbe", "bop", "b97"] 37 | hybrids = {"b3lyp": 0.2, "b3lyp1": 0.2, "b3lyp5": 0.2, "b3lyp3": 0.2, \ 38 | "bhandhlyp": 0.5, "pbe0": 0.25, "revpbe0": 0.25} 39 | # Temperature for long range correct hybrids are undefined 40 | if method.lower() in hybrids.keys(): 41 | HFX = hybrids[method.lower()] 42 | temp = 0.06333620949 * HFX + temp 43 | elif method.lower() not in LDAsOrGGAs: 44 | raise ValueError("The temperature needed for running finite-temp DFT" \ 45 | + "of the given XC functional " + method + " is undefined") 46 | return temp 47 | 48 | """ 49 | Compute the Fractional Occupation SCF 50 | """ 51 | 52 | def FonTask(self, mol, program, method, basis=None): 53 | task = None 54 | # Default parameters 55 | basis_set = "lacvps_ecp" 56 | if basis is not None: 57 | basis_set = basis 58 | 59 | if not self.temp_K: 60 | temp = self.setTemperature(method) 61 | self.temp = temp 62 | self.temp_K = temp / self.Hartree2K 63 | else: 64 | self.temp = self.temp_K * self.Hartree2K 65 | 66 | print("") 67 | print("Fractional Occupation Number SCF with " + method + "/" + basis_set) 68 | 69 | print("FON temperature: {0:10.5f} (KT in atomic unit) ".format(self.temp)) 70 | print(" {0:10.0f} (Kelvin) ".format(self.temp_K)) 71 | sys.stdout.flush() 72 | # TODO add HFX dependent temperature determination 73 | # Set the core orbitals as frozen and allow FON for all others 74 | self.norb, self.ncore = molecule_to_num_AO(mol, basis_set) 75 | if program == "terachem": 76 | tc_method = method if mol.molecular_multiplicity == 1 else "u" + method 77 | additional_keywords = {"gpus": "1", 78 | "maxit": "500", 79 | "scf": "diis+a", 80 | "levelshift": "yes", 81 | "levelshiftvala":self.levelshiftvala, 82 | "levelshiftvalb":self.levelshiftvalb, 83 | "convthre": "1e-6", 84 | "precision": "double", 85 | "units": "bohr", 86 | "fon": "yes", 87 | "fon_method": "fermi", 88 | "fon_temperature": self.temp, 89 | "fon_print": "1", 90 | "method": tc_method, 91 | "closed": self.ncore, 92 | "active": self.norb - self.ncore} 93 | if self.wfn != None: 94 | if self.wfn[0] != "" and self.wfn[1] != "": 95 | additional_keywords["guess"] = self.wfn[0] + " " + self.wfn[1] 96 | elif self.wfn[2] != "": 97 | additional_keywords["guess"] = self.wfn[2] 98 | else: 99 | print("Warning: initial guess for SCF is not provided with" \ 100 | + "the correct format and will be ignored") 101 | extra_files = {} 102 | if isinstance(self.extras, list): 103 | for extra in self.extras: 104 | extra_files[extra] = "" 105 | task = qcelemental.models.ResultInput( 106 | molecule=mol, 107 | driver="energy", 108 | model={"method": tc_method, "basis": basis_set}, 109 | keywords=additional_keywords, 110 | extras=extra_files 111 | ) 112 | else: 113 | raise ValueError("FON calculation is not implemented for the requested program yet.") 114 | return task 115 | 116 | """ 117 | Harvest FON numbers from FON calculation result 118 | """ 119 | 120 | def harvestFon(self, result): 121 | datain = result.dict()["stdout"].split('\n') 122 | fons = {} 123 | for i in range(0, len(datain)): 124 | if "Total electrons:" in datain[i]: 125 | self.nele = int(datain[i].strip('\n').split()[2]) 126 | if self.molecule.molecular_multiplicity == 1: 127 | self.restricted = True 128 | else: 129 | self.restricted = False 130 | if "SCF Fractional Occupations" in datain[i]: 131 | # Store the beta orbitals with index norb+1, norb+2, ... 132 | orb_offset = self.norb if len(fons) > 0 else 0 133 | nlines = int(math.ceil(float(self.norb) / 4)) 134 | for j in range(i + 3, i + 3 + nlines): 135 | line = datain[j].strip('\n').split() 136 | for k in range(0, len(line)): 137 | if k % 2 == 0: 138 | idx = int(line[k]) + orb_offset 139 | fon = float(line[k + 1]) 140 | if fon > 1e-6 and fon < 1.0: 141 | fons[idx] = fon 142 | return fons 143 | 144 | """ 145 | Conduct FON calculation 146 | """ 147 | 148 | def computeFon(self, method, basis=None): 149 | # Caculate energy for the whole molecule 150 | molecule_task = self.FonTask(self.molecule, self.program, method, basis) 151 | print("self.molecule: ", self.molecule) 152 | print("self.program: ", self.program) 153 | print(method, basis) 154 | molecule_result = qcengine.compute(molecule_task, self.program) 155 | if self.record: 156 | filename = self.rundir + "/" + self.diagnostic_type + "_" \ 157 | + self.molname + "_" + method + "_" + "whole" + ".json" 158 | qcres_to_json(molecule_result, filename) 159 | print(molecule_result) 160 | if molecule_result.success: 161 | fj = json.load(open(filename)) 162 | fileout = self.rundir + "/" + self.diagnostic_type + "_" \ 163 | + self.molname + "_" + method + "_" + "whole" + ".out" 164 | with open(fileout, "w") as fo: 165 | for line in fj["stdout"].split('\n'): 166 | fo.write(line + '\n') 167 | if not molecule_result.success: 168 | print("!!!!:", molecule_result.__dict__.keys()) 169 | raise RuntimeError("Quantum chemistry calculation failed.") 170 | print("FON calculation finished. Harvesting FON info.") 171 | self.fons = self.harvestFon(molecule_result) 172 | 173 | """ 174 | compute FOD 175 | """ 176 | 177 | def getFOD(self, fons, norb, nele, restricted): 178 | FOD = 0 179 | zero_temp_homo_a = 0 180 | zero_temp_homo_b = 0 181 | spin_mult = self.molecule.molecular_multiplicity 182 | 183 | if restricted: 184 | zero_temp_homo_a = nele / 2 185 | else: 186 | unpaired = spin_mult - 1 187 | zero_temp_homo_b = (nele - unpaired) / 2 188 | zero_temp_homo_a = zero_temp_homo_b + unpaired 189 | 190 | factor = 2.0 if restricted else 1.0 191 | 192 | for key, value in fons.items(): 193 | if key <= norb: # alpha orbitals 194 | f = value if key > zero_temp_homo_a else 1 - value 195 | else: # beta orbitals 196 | f = value if key - norb > zero_temp_homo_b else 1 - value 197 | 198 | my_FOD = f * factor 199 | FOD += my_FOD 200 | return FOD 201 | 202 | """ 203 | compute Matito 204 | """ 205 | 206 | def getMattito(self, fons, norb, restricted): 207 | I_ND = 0 208 | I_T = 0 209 | 210 | factor = 2.0 if restricted else 1.0 211 | for key, value in fons.items(): 212 | my_I_T = 0.25 * math.sqrt(value * (1 - value)) * factor 213 | I_T += my_I_T 214 | 215 | my_I_ND = 0.5 * value * (1 - value) * factor 216 | I_ND += my_I_ND 217 | 218 | I_D = I_T - I_ND 219 | return I_D, I_ND 220 | 221 | def getEntanglement(self, fons, norbs, restricted): 222 | if not restricted: 223 | print("Warning: Entanglement only support calculation of natural orbital occupations.") 224 | print( 225 | "For unrestricted entanglement calculations, Unrestricted Natural Orbitals are needed but not supported in TreaChem yet") 226 | return -1 227 | 228 | S = 0 229 | for key, value in fons.items(): 230 | S += -value * math.log(value) 231 | return S 232 | 233 | """ 234 | Compute the diagnostic 235 | """ 236 | 237 | def computeDiagnostic(self, method="PBE", basis=None): 238 | print("Compute FON based diagnostic of the given molecule:") 239 | if self.fons is None: 240 | self.computeFon(method, basis) 241 | FOD = self.getFOD(self.fons, self.norb, self.nele, self.restricted) 242 | I_D, I_ND = self.getMattito(self.fons, self.norb, self.restricted) 243 | S = self.getEntanglement(self.fons, self.norb, self.restricted) 244 | diag = {"FOD": FOD, 245 | "Mattito": {"I_D": I_D, "I_ND": I_ND}, 246 | "Entanglement": S 247 | } 248 | if self.record: 249 | diag_dict = {self.diagnostic_type: diag} 250 | filename = self.rundir + "/" + self.molname + "_" + self.diagnostic_type + ".json" 251 | write_diagnostics_to_json(diag_dict, filename) 252 | return diag 253 | -------------------------------------------------------------------------------- /MultirefPredict/globs.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Global variables of MultirefPredict 3 | ''' 4 | 5 | available_programs = ["psi4", "terachem"] 6 | keywords_avail = ["molecule", "program", "xyzfile", "molname", 7 | "charge", "spinmult", "rundir", "diagnostic_type", 8 | "record", "wfn", "extras", "levelshiftvala","levelshiftvalb","temp_K"] 9 | -------------------------------------------------------------------------------- /MultirefPredict/io_tools.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import numpy as np 4 | import time 5 | import json 6 | 7 | 8 | def qcres_to_json(res, filename): 9 | outdict = res.dict() 10 | for key in outdict.keys(): 11 | if(isinstance(outdict[key],np.ndarray)): 12 | outdict[key] = outdict[key].flatten().tolist() 13 | #print(key, isinstance(outdict[key], np.ndarray)) 14 | if(isinstance(outdict[key],dict)): 15 | for k in outdict[key].keys(): 16 | if(isinstance(outdict[key][k],np.ndarray)): 17 | #print(key, k, isinstance(outdict[key][k], np.ndarray)) 18 | outdict[key][k] = outdict[key][k].flatten().tolist() 19 | #print(key, k, isinstance(outdict[key][k], np.ndarray)) 20 | elif(isinstance(outdict[key][k],dict)): 21 | for k2 in outdict[key][k].keys(): 22 | if(isinstance(outdict[key][k][k2],np.ndarray)): 23 | print(key, k, k2, isinstance(outdict[key][k][k2], np.ndarray)) 24 | outdict[key][k][k2] = outdict[key][k][k2].flatten().tolist() 25 | 26 | f = open(filename, 'w') 27 | json.dump(outdict, f) 28 | f.close() 29 | 30 | 31 | def write_diagnostics_to_json(diag_dict, filename): 32 | f = open(filename, 'w') 33 | json.dump(diag_dict, f) 34 | f.close() 35 | 36 | 37 | def ensure_dir(dir): 38 | if not os.path.exists(dir): 39 | os.makedirs(dir) 40 | 41 | 42 | def submit_job(rundir, cwd): 43 | print("Submitting jobs: %s" % rundir) 44 | os.chdir(rundir) 45 | run_cmd = 'qsub jobscript.sh' 46 | q = subprocess.Popen(run_cmd, shell=True, stdout=subprocess.PIPE) 47 | ll = q.communicate()[0].decode("utf-8") 48 | print('ll:', ll) 49 | os.chdir(cwd) 50 | time.sleep(1) 51 | 52 | 53 | def get_jobids(req): 54 | run_cmd = 'qstat' 55 | q = subprocess.Popen(run_cmd, shell=True, stdout=subprocess.PIPE) 56 | txt = q.communicate()[0].decode("utf-8") 57 | jobs = txt.split("\n") 58 | joblist = [] 59 | for job in jobs[2:-1]: 60 | # if str(job.split()[4]) == "r": 61 | joblist.append([str(job.split()[0]), str(job.split()[7])]) 62 | return joblist 63 | -------------------------------------------------------------------------------- /MultirefPredict/multirefpredict.py: -------------------------------------------------------------------------------- 1 | """ 2 | multirefpredict.py 3 | Automated workflow to predict multireference character of molecules in quantum chemistry calculation 4 | 5 | Handles the primary functions 6 | """ 7 | from MultirefPredict.ebased_diagnostic import B1,A25PBE,TAE 8 | from MultirefPredict.ccbased_diagnostic import CCBased 9 | from MultirefPredict.casbased_diagnostic import C0 10 | from MultirefPredict.fonbased_diagnostic import FonBased 11 | 12 | def diagnostic_factory(diagnostic_type, **kwargs): 13 | """ 14 | factory class for calculating diagnostics 15 | 16 | Parameters 17 | ---------- 18 | diagnostic_type : str 19 | currently support: {"B1","A25PBE"} 20 | The type of diagnostic to calculate 21 | keyword arguments: 22 | molecule: qcelement molecule instance 23 | 24 | Returns 25 | ------- 26 | cls_instance: instance of a class for calculating specific diagnostics 27 | """ 28 | cls_dict = dict(B1=B1,A25PBE=A25PBE,TAE=TAE, 29 | T1=CCBased, D1=CCBased, D2=CCBased, 30 | FOD=FonBased, Mattito=FonBased, Entanglement=FonBased, 31 | CCBased=CCBased, 32 | C0=C0) 33 | 34 | if diagnostic_type not in cls_dict.keys(): 35 | raise Exception("Diagnostic type not found") 36 | cls = cls_dict[diagnostic_type] 37 | cls_instance = cls(**kwargs) 38 | return cls_instance 39 | -------------------------------------------------------------------------------- /MultirefPredict/scripts/generate_IND_density.py: -------------------------------------------------------------------------------- 1 | ####################################################################### 2 | # This script reads in the json file generated by MultirefPredict 3 | # add generate the Gaussian Cube format output containing the 4 | # I_ND and I_D density for visualizing the electron density related 5 | # static and dynamic correlation 6 | #################################################################### 7 | import sys 8 | import subprocess 9 | import math 10 | import json 11 | 12 | def help_msg(): 13 | print("Usage: python generate_IND_density.py [multirefPredi_generated_json_file]") 14 | 15 | def sanity_check(): 16 | if len(sys.argv) < 2: 17 | help_msg() 18 | exit() 19 | 20 | try: 21 | fin=open(sys.argv[1]) 22 | except OSError: 23 | print("Cannot open file ",sys.argv[1]) 24 | help_msg() 25 | exit() 26 | return fin 27 | 28 | 29 | def parse_json_input(): 30 | 31 | fin = sanity_check() 32 | 33 | try: 34 | multiref_dict = json.load(fin) 35 | except json.JSONDecodeError: 36 | print("The provided file object cannot be deserialized with json") 37 | help_msg() 38 | 39 | exit() 40 | 41 | FON_stdout = multiref_dict['stdout'].splitlines() 42 | 43 | #write the molden file 44 | molden_str = multiref_dict['extras']['scr/geometry.molden'] 45 | #molden_name = sys.argv[1].replace(".json",".molden") 46 | molden_name = "geometry.molden" 47 | with open(molden_name,"w") as f: 48 | f.write(molden_str) 49 | 50 | return FON_stdout,molden_name 51 | 52 | def parse_tc_stdout(FON_stdout): 53 | norb = 0 54 | fons ={} 55 | restricted = False 56 | 57 | # Parse output file and extract FON 58 | for i in range(0,len(FON_stdout)): 59 | if "Wavefunction: RESTRICTED" in FON_stdout[i]: 60 | restricted = True 61 | if "Total orbitals" in FON_stdout[i]: 62 | norb = int(FON_stdout[i].strip('\n').split()[-1]) 63 | if "SCF Fractional Occupations" in FON_stdout[i]: 64 | nlines = int(math.ceil(float(norb)/4)) 65 | for j in range(i+3, i+3+nlines): 66 | line = FON_stdout[j].strip('\n').split() 67 | for k in range(0,len(line)): 68 | if k%2 == 0: 69 | idx = int(line[k]) 70 | fon = float(line[k+1]) 71 | if fon > 1e-6 and fon < 1.0: 72 | fons[idx] = fon 73 | return fons,restricted 74 | 75 | # Calculate the related multiwfn input files 76 | def gen_multiwfn_input(fons, restricted): 77 | I_ND_wfn_name = "I_ND.multiwfn" 78 | I_ND_wfn_input = open(I_ND_wfn_name, "w") 79 | 80 | I_D_wfn_name = "I_D.multiwfn" 81 | I_D_wfn_input = open(I_D_wfn_name, "w") 82 | 83 | I_ND_cub_name = "I_ND.cub" 84 | I_D_cub_name = "I_D.cub" 85 | 86 | keycount = 0 87 | factor = 2.0 if restricted else 1.0 88 | for key,value in fons.items(): 89 | my_I_T = 0.25 * math.sqrt(value * (1-value)) * factor 90 | 91 | my_I_ND = 0.5* value * (1-value) * factor 92 | 93 | my_I_D = my_I_T - my_I_ND 94 | 95 | # Generate Multiwfn input files used for generating real space I_ND function 96 | if keycount == 0: 97 | I_ND_wfn_input.write("5\n4\n{0:d}\n1\n0\n13\n11\n9\n2.0".format(key)+\ 98 | "\n11\n5\n{0:f}\n0\n{1:s}\n-1\n".format(my_I_ND, I_ND_cub_name)) 99 | I_D_wfn_input.write("5\n4\n{0:d}\n1\n0\n13\n11\n9\n2.0".format(key)+\ 100 | "\n11\n5\n{0:f}\n0\n{1:s}\n-1\n".format(my_I_D, I_D_cub_name)) 101 | else: 102 | I_ND_wfn_input.write("5\n4\n{0:d}\n1\n0\n13\n11\n9\n2.0".format(key)+\ 103 | "\n11\n5\n{0:f}\n11\n2\n{1:s}\n0\n{1:s}\n-1\n".format(my_I_ND, I_ND_cub_name)) 104 | I_D_wfn_input.write("5\n4\n{0:d}\n1\n0\n13\n11\n9\n2.0".format(key)+\ 105 | "\n11\n5\n{0:f}\n11\n2\n{1:s}\n0\n{1:s}\n-1\n".format(my_I_D, I_D_cub_name)) 106 | keycount += 1 107 | 108 | I_ND_wfn_input.close() 109 | I_D_wfn_input.close() 110 | 111 | return I_ND_wfn_name,I_D_wfn_name 112 | 113 | 114 | def generate_IND_cubes(): 115 | FON_stdout,molden_name = parse_json_input() 116 | fons,restricted = parse_tc_stdout(FON_stdout) 117 | I_ND_wfn_name,I_D_wfn_name = gen_multiwfn_input(fons, restricted) 118 | #Execute Multiwfn to generate the cube files 119 | cmd = "Multiwfn "+molden_name + " <" +I_ND_wfn_name 120 | print(cmd) 121 | subprocess.run(cmd,shell=True) 122 | 123 | cmd = "Multiwfn "+molden_name + " <" + I_D_wfn_name 124 | print(cmd) 125 | subprocess.run(cmd,shell=True) 126 | 127 | if __name__ == "__main__": 128 | generate_IND_cubes() 129 | -------------------------------------------------------------------------------- /MultirefPredict/scripts/jobscript_sge.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #$ -S /bin/bash 3 | #$ -N diagnostics 4 | #$ -R y 5 | #$ -cwd 6 | #$ -l h_rt=64:00:00 7 | #$ -l h_rss=8G 8 | #$ -q cpus 9 | #$ -l cpus=1 10 | #$ -pe smp 1 11 | # -fin run_diagnostics_ebased.py 12 | #$ -cwd 13 | 14 | module load anaconda 15 | source activate qcengine 16 | 17 | python run_diagnostics_ebased.py > $SGE_O_WORKDIR/diag.out 18 | 19 | mv * $SGE_O_WORKDIR 20 | -------------------------------------------------------------------------------- /MultirefPredict/scripts/loop_run_diag.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from MultirefPredict.io_tools import submit_job, get_jobids, ensure_dir 4 | 5 | numjobs = len(get_jobids(req=False)) 6 | maxjobs = 150 7 | print("Number of live jobs in queue:", numjobs) 8 | cwd = os.getcwd() 9 | for dirpath, dirs, files in os.walk(cwd): 10 | if dirpath == cwd: 11 | for file in files: 12 | if file.split(".")[-1] == "xyz": 13 | basepath = cwd + '/DFT_based/' + ".".join(file.split(".")[:-1]) 14 | ensure_dir(basepath) 15 | shutil.copy("jobscript_sge.sh", basepath + "/jobscript.sh") 16 | shutil.copy("run_diagnostics_ebased.py", basepath + "/run_diagnostics_ebased.py") 17 | shutil.copy(dirpath + '/' + file, basepath + '/geo.xyz') 18 | submit_job(basepath, cwd) 19 | numjobs += 1 20 | if numjobs > maxjobs: 21 | print("Maximum number of jobs is reached.") 22 | quit() 23 | print("All jobs are submitted.") 24 | -------------------------------------------------------------------------------- /MultirefPredict/scripts/run_diagnostics_ebased.py: -------------------------------------------------------------------------------- 1 | import MultirefPredict 2 | 3 | diagnostics_list = ["B1", "A25PBE"] 4 | 5 | input_dict = {"xyzfile": "./geo.xyz", 6 | "molname": "geo", 7 | "charge": 0, 8 | "spinmult": 1, 9 | "rundir": './', 10 | "program": 'psi4', 11 | "record": True} 12 | for diag in diagnostics_list: 13 | MultirefPredict.diagnostic_factory(diag, **input_dict).computeDiagnostic() 14 | -------------------------------------------------------------------------------- /MultirefPredict/scripts/run_fod_w_c0.py: -------------------------------------------------------------------------------- 1 | ######################################################## 2 | # This script loop through structures given in xyzdir 3 | # find the matching c0 (or ca0 cb0 for UKS) file, the 4 | # MO coefficient file in the directory: wfndir 5 | # And conduct finite-temp DFT calculation 6 | # The molden files of the FT-DFT will be saved into json output 7 | # The results can later be pushed back into database 8 | ######################################################### 9 | import MultirefPredict 10 | import qcelemental as qe 11 | import glob 12 | import os 13 | import sys 14 | import timeout_decorator 15 | 16 | xyzdir="/home/fangliu/multiref/tmc_database/xyz/group1" 17 | xyzlist = glob.glob(xyzdir+'/*.xyz') 18 | timelimit = 72000 19 | wfndir="/home/fangliu/multiref/tmc_database/wfn/group1" 20 | 21 | 22 | #name2wfnpath = pickle.load(fwfn,fix_imports=True) 23 | 24 | @timeout_decorator.timeout(timelimit) 25 | def run_fod_timeout(mol, name): 26 | ca0_path = wfndir+"/"+name+".ca0" 27 | cb0_path = wfndir+"/"+name+".cb0" 28 | c0_path = wfndir+"/"+name+".c0" 29 | if os.path.exists(ca0_path) and os.path.exists(cb0_path): 30 | c0_path = "" 31 | elif os.path.exists(c0_path): 32 | ca0_path = "" 33 | cb0_path = "" 34 | else: 35 | c0_path="" 36 | ca0_path = "" 37 | cb0_path = "" 38 | mywfn = [ca0_path, cb0_path, c0_path] 39 | fon = MultirefPredict.diagnostic_factory("FOD", molecule=mol, 40 | program='terachem', molname=name, record=True, wfn = mywfn, 41 | extras=['scr/geometry.molden']) 42 | fon.computeDiagnostic("b3lyp") 43 | 44 | for xyz in xyzlist: 45 | name = os.path.basename(xyz).strip('.xyz') 46 | molstr = open(xyz).read() 47 | mol = qe.models.Molecule.from_data(molstr, dtype='xyz+') 48 | print("\n\n***Calculating molecule: {}".format(name)) 49 | sys.stdout.flush() 50 | try: 51 | run_fod_timeout(mol,name) 52 | except: 53 | print("\n!!!TeraChem timed out after {} seconds".format(timelimit)) 54 | sys.stdout.flush() 55 | -------------------------------------------------------------------------------- /MultirefPredict/spin.py: -------------------------------------------------------------------------------- 1 | import qcelemental 2 | 3 | class atomSpinMultDict: 4 | def __init__(self): 5 | self.mult_dict = { 6 | 1: 2, 7 | 2: 1, 8 | 3: 2, 9 | 4: 1, 10 | 5: 2, 11 | 6: 3, 12 | 7: 4, 13 | 8: 3, 14 | 9: 2, 15 | 10: 1, 16 | 11: 2, 17 | 12: 1, 18 | 13: 2, 19 | 14: 3, 20 | 15: 4, 21 | 16: 3, 22 | 17: 2, 23 | 18: 1, 24 | 19: 2, 25 | 20: 1, 26 | 21: 2, 27 | 22: 3, 28 | 23: 4, 29 | 24: 7, #Cr has 4s(1)3d(5) configuration 30 | 25: 6, 31 | 26: 5, 32 | 27: 4, 33 | 28: 3, 34 | 29: 2, 35 | 30: 1, 36 | 31: 2, 37 | 32: 3, 38 | 33: 4, 39 | 34: 3, 40 | 35: 2, 41 | 36: 1, 42 | 37: 2, 43 | 38: 1, 44 | } 45 | 46 | """ 47 | determine the spin of the ground state of an atom or ion 48 | """ 49 | def get_spinmult(self, symbol, charge=0): 50 | anumber = qcelemental.periodictable.to_atomic_number(symbol) 51 | nele = anumber - charge 52 | spinmult = 0 53 | #Neutral atoms 54 | if charge == 0: 55 | if anumber <= len(self.mult_dict): 56 | spinmult = self.mult_dict[nele] 57 | else: 58 | raise ValueError("Determination of ion spinmult hasn't been\ 59 | implemented for elements with electrons occupying\ 60 | 4d orbitals") 61 | else: 62 | if anumber <= 20: # H to Ca 63 | spinmult = self.mult_dict[nele] 64 | elif anumber <= 30: #Sc - Zn 65 | if charge == 1:#lose one 4s electron 66 | # Assume that electrons are always removed from 4s 67 | #TODO: check this against literature 68 | ms_4s = 1 69 | nele_3d = nele-18-1 70 | ms_3d = nele_3d 71 | if nele_3d > 5: 72 | ms_3d = 10 - nele_3d 73 | spinmult = ms_4s + ms_3d + 1 74 | elif charge >= 2:#lose both 4s electrons 75 | n_3d = anumber - 18 - charge 76 | if n_3d <= 5: 77 | spinmult = n_3d + 1 78 | else: 79 | spinmult = 10 - n_3d + 1 80 | elif anumber <=36: # Ga - Kr 81 | nele_4p = nele-30 82 | #no more than 4p^25s^2 ocupation 83 | if charge >= nele_4p-8: 84 | spinmult = self.mult_dict[nele] 85 | else: 86 | raise ValueError("Determination of ion spinmult hasn't been\ 87 | implemented for elements with electrons occupying\ 88 | 4d orbitals") 89 | else: 90 | raise ValueError("Determination of ion spinmult hasn't\ 91 | been implemented for ions with electrons occupying\ 92 | 4d orbitals") 93 | return spinmult 94 | 95 | 96 | '''class atomSpinMultDictGen: 97 | def __init__(self): 98 | #1s, 1s2s 99 | mult_dict = {1: 2, 2: 1, 3: 2, 4: 1} 100 | # 1s2s2p, n(2p) <=3 101 | for i in range(5, 8): 102 | mult_dict[i] = i - 4 + 1 103 | # 1s2s2p, n(2p) > 3 104 | for i in range(8, 11): 105 | mult_dict[i] = 10 - i + 1 106 | # 1s2s2p3s 107 | mult_dict[11] = 2 108 | mult_dict[12] = 1 109 | # 1s2s2p3s3p, n(3p) <=3 110 | for i in range(13, 16): 111 | mult_dict[i] = i - 12 + 1 112 | # 1s2s2p3s3p, n(3p) >3 113 | for i in range(16, 19): 114 | mult_dict[i] = 18 - i + 1 115 | # 1s2s2p3s3p4s 116 | mult_dict[19] = 2 117 | mult_dict[20] = 1 118 | # 1s2s2p3s3p4s3d, n(3d) <= 5 119 | for i in range(21, 26): 120 | mult_dict[i] = i - 20 + 1 121 | # 1s2s2p3s3p4s3d, n(3d) >5 122 | for i in range(26, 31): 123 | mult_dict[i] = 30 - i + 1 124 | # 1s2s2p3s3p4s3d4p, n(4p) <=3 125 | for i in range(31, 34): 126 | mult_dict[i] = i - 30 + 1 127 | # 1s2s2p3s3p4s3d4p, n(4p) >3 128 | for i in range(34, 37): 129 | mult_dict[i] = 36 - i + 1 130 | self.mult_dict = mult_dict 131 | 132 | def getDict(self, nele): 133 | return self.mult_dict 134 | 135 | ''' 136 | -------------------------------------------------------------------------------- /MultirefPredict/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Empty init file in case you choose a package besides PyTest such as Nose which may look for such a file 3 | """ 4 | -------------------------------------------------------------------------------- /MultirefPredict/tests/conftest.py: -------------------------------------------------------------------------------- 1 | """ 2 | Fixtures shared by tests in this directory 3 | """ 4 | import pytest 5 | import qcelemental 6 | from pkg_resources import resource_filename, Requirement 7 | 8 | @pytest.fixture(scope="module") 9 | def qcelemental_water(): 10 | mol = qcelemental.models.Molecule.from_data("\n"\ 11 | + "O 0.000000000000 0.000000000000 -0.068516245955\n"\ 12 | + "H 0.000000000000 -0.790689888800 0.543701278274\n"\ 13 | + "H 0.000000000000 0.790689888800 0.543701278274\n"\ 14 | +"\n" 15 | ) 16 | return mol 17 | 18 | @pytest.fixture(scope="module") 19 | def xyz_water(): 20 | xyz="3\n\n"\ 21 | + " O 0.000000000000 0.000000000000 -0.068516245955\n"\ 22 | + " H 0.000000000000 -0.790689888800 0.543701278274\n"\ 23 | + " H 0.000000000000 0.790689888800 0.543701278274\n" 24 | return xyz 25 | 26 | @pytest.fixture(scope="module") 27 | def qcelemental_cu_complex(): 28 | mol = qcelemental.models.Molecule.from_data("\n"\ 29 | +"2 1\n"\ 30 | +"O -0.420275 1.402468 0.101942\n"\ 31 | +"O -0.440639 -0.486438 -0.102059\n"\ 32 | +"Cu 1.098238 0.442692 -0.009679\n"\ 33 | +"Cu -1.959153 0.473350 0.009562\n"\ 34 | +"N -3.386852 1.843664 0.160103\n"\ 35 | +"N -3.413724 -0.868627 -0.145405\n"\ 36 | +"N 2.552792 1.784687 0.145285\n"\ 37 | +"N 2.525952 -0.927604 -0.160217\n"\ 38 | +"C 3.838802 1.128848 -0.261856\n"\ 39 | +"C 3.818294 -0.300514 0.271356\n"\ 40 | +"C -4.679199 1.216590 -0.271474\n"\ 41 | +"C -4.699725 -0.212774 0.261735\n"\ 42 | +"H 2.605864 2.113287 1.123426\n"\ 43 | +"H 2.363065 2.624052 -0.423452\n"\ 44 | +"H 2.587660 -1.250217 -1.139828\n"\ 45 | +"H 2.310711 -1.766880 0.399591\n"\ 46 | +"H 4.714722 1.690265 0.115054\n"\ 47 | +"H 3.882273 1.135693 -1.367752\n"\ 48 | +"H 3.840670 -0.308405 1.377933\n"\ 49 | +"H 4.688635 -0.881164 -0.089123\n"\ 50 | +"H -3.171601 2.682938 -0.399701\n"\ 51 | +"H -3.448557 2.166273 1.139714\n"\ 52 | +"H -3.224006 -1.707993 0.423331\n"\ 53 | +"H -3.466797 -1.197225 -1.123545\n"\ 54 | +"H -4.701574 1.224483 -1.378049\n"\ 55 | +"H -5.549535 1.797248 0.089003\n"\ 56 | +"H -5.575651 -0.774178 -0.115176\n"\ 57 | +"H -4.743200 -0.219619 1.367630\n"\ 58 | +"\n" 59 | ) 60 | return mol 61 | 62 | @pytest.fixture(scope="module") 63 | def qcelemental_trityl_radical(): 64 | mol = qcelemental.models.Molecule.from_data("\n"\ 65 | + "0 2\n"\ 66 | + "C -1.5669547451 0.1525961178 -0.4069907437\n"\ 67 | + "C -1.0305053421 0.8173808668 0.7081586097\n"\ 68 | + "C 0.3284132085 0.7068673641 1.0121523585\n"\ 69 | + "C 1.2027045139 -0.0824001370 0.2133363853\n"\ 70 | + "C 0.6356765971 -0.7485905261 -0.9090688316\n"\ 71 | + "C -0.7226070902 -0.6289759573 -1.2128215257\n"\ 72 | + "C 2.6256347453 -0.2042399959 0.5367120349\n"\ 73 | + "C 3.3363282370 0.9240004987 1.1423672507\n"\ 74 | + "C 2.9968915962 2.2692804227 0.8257907091\n"\ 75 | + "C 3.6766539433 3.3436484234 1.4049282644\n"\ 76 | + "C 4.7153355259 3.1179694060 2.3231118289\n"\ 77 | + "C 5.0664740448 1.7984196135 2.6528081376\n"\ 78 | + "C 4.3937224416 0.7204482120 2.0722547643\n"\ 79 | + "C 3.3359855438 -1.4543306062 0.2609906110\n"\ 80 | + "C 4.7134573125 -1.4617947915 -0.0978538809\n"\ 81 | + "C 5.3869775886 -2.6562394624 -0.3639257485\n"\ 82 | + "C 4.7162256544 -3.8873110456 -0.2768202853\n"\ 83 | + "C 3.3570869204 -3.9053223190 0.0782100962\n"\ 84 | + "C 2.6772332870 -2.7135358088 0.3399294001\n"\ 85 | + "H -2.6318033263 0.2418747524 -0.6449450360\n"\ 86 | + "H -1.6800829740 1.4198974700 1.3521986109\n"\ 87 | + "H 0.7320083085 1.2131831851 1.8941603601\n"\ 88 | + "H 1.2872009507 -1.3442335612 -1.5556337305\n"\ 89 | + "H -1.1262131968 -1.1434353152 -2.0915725316\n"\ 90 | + "H 2.2034610687 2.4569739529 0.0961885326\n"\ 91 | + "H 3.4002794568 4.3674706849 1.1307315735\n"\ 92 | + "H 5.2450696331 3.9613962639 2.7776064628\n"\ 93 | + "H 5.8646763007 1.6082844786 3.3782961091\n"\ 94 | + "H 4.6603992579 -0.3026442721 2.3540827763\n"\ 95 | + "H 5.2408164435 -0.5078916932 -0.1931938322\n"\ 96 | + "H 6.4432409235 -2.6270716002 -0.6525175643\n"\ 97 | + "H 5.2465282301 -4.8224305525 -0.4837654065\n"\ 98 | + "H 2.8253471361 -4.8592902457 0.1614248002\n"\ 99 | + "H 1.6253178047 -2.7414738227 0.6395594407\n"\ 100 | + "\n" 101 | ) 102 | return mol 103 | @pytest.fixture(scope="module") 104 | def datadir(): 105 | mydir = resource_filename(Requirement.parse("MultirefPredict"),"MultirefPredict/tests/data/") 106 | return mydir 107 | -------------------------------------------------------------------------------- /MultirefPredict/tests/data/fon_cu_result.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjkgrp/MultirefPredict/4cc6724cd73b84539048b81b0526eb349f5be8aa/MultirefPredict/tests/data/fon_cu_result.obj -------------------------------------------------------------------------------- /MultirefPredict/tests/data/fon_trityl_result.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjkgrp/MultirefPredict/4cc6724cd73b84539048b81b0526eb349f5be8aa/MultirefPredict/tests/data/fon_trityl_result.obj -------------------------------------------------------------------------------- /MultirefPredict/tests/data/fon_trityl_task.obj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hjkgrp/MultirefPredict/4cc6724cd73b84539048b81b0526eb349f5be8aa/MultirefPredict/tests/data/fon_trityl_task.obj -------------------------------------------------------------------------------- /MultirefPredict/tests/test_MultirefPredict.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit and regression test for the MultirefPredict package. 3 | """ 4 | 5 | # Import package, test suite, and other packages as needed 6 | import MultirefPredict 7 | import pytest 8 | import sys 9 | import os 10 | from qcelemental.testing import compare_recursive 11 | 12 | def test_MultirefPredict_imported(): 13 | """Sample test, will always pass so long as import statement worked""" 14 | assert "MultirefPredict" in sys.modules 15 | 16 | def test_diagnostic_factory_B1(qcelemental_water): 17 | calculator = MultirefPredict.diagnostic_factory("B1", molecule=qcelemental_water) 18 | diag = calculator.computeDiagnostic() 19 | B1Thre = 1e-6 20 | expected = 0.006334860365228678 21 | assert compare_recursive(diag, expected, atol = B1Thre) 22 | 23 | def test_diagnostic_factory_A25PBE(qcelemental_water): 24 | calculator = MultirefPredict.diagnostic_factory("A25PBE", molecule=qcelemental_water) 25 | diag = calculator.computeDiagnostic() 26 | A25PBEThre = 1e-6 27 | expected = 0.1626572016077259 28 | assert compare_recursive(diag, expected, atol = A25PBEThre) 29 | 30 | def test_diagnostic_factory_TAE(qcelemental_water): 31 | calculator = MultirefPredict.diagnostic_factory("TAE", molecule=qcelemental_water) 32 | diag = calculator.computeDiagnostic() 33 | TAEThre = 1e-6 34 | expected = 0.28078682517214126 35 | assert compare_recursive(diag, expected, atol = TAEThre) 36 | 37 | def test_diagnostic_factory_CCBased(qcelemental_water): 38 | Thre = 1e-6 39 | calculator = MultirefPredict.diagnostic_factory("CCBased", molecule=qcelemental_water) 40 | diag = calculator.computeDiagnostic() 41 | expected = {'T1': 0.005903453140867589, 'D1': 0.012965638464472996, 'D2': 0.12885433260716933, 'New D1': 0.012965638464472996} 42 | print(diag) 43 | assert compare_recursive(diag, expected, atol = Thre) 44 | 45 | def test_diagnostic_factory_T1(qcelemental_water): 46 | Thre = 1e-6 47 | calculator = MultirefPredict.diagnostic_factory("T1", molecule=qcelemental_water) 48 | diag = calculator.computeDiagnostic() 49 | expected = {'T1': 0.005903453140867589, 'D1': 0.012965638464472996, 'D2': 0.12885433260716933, 'New D1': 0.012965638464472996} 50 | print(diag) 51 | assert compare_recursive(diag, expected, atol = Thre) 52 | 53 | def test_diagnostic_factory_D1(qcelemental_water): 54 | Thre = 1e-6 55 | calculator = MultirefPredict.diagnostic_factory("D1", molecule=qcelemental_water) 56 | diag = calculator.computeDiagnostic() 57 | expected = {'T1': 0.005903453140867589, 'D1': 0.012965638464472996, 'D2': 0.12885433260716933, 'New D1': 0.012965638464472996} 58 | print(diag) 59 | assert compare_recursive(diag, expected, atol = Thre) 60 | 61 | def test_diagnostic_factory_D2(qcelemental_water): 62 | Thre = 1e-6 63 | calculator = MultirefPredict.diagnostic_factory("D2", molecule=qcelemental_water) 64 | diag = calculator.computeDiagnostic() 65 | expected = {'T1': 0.005903453140867589, 'D1': 0.012965638464472996, 'D2': 0.12885433260716933, 'New D1': 0.012965638464472996} 66 | print(diag) 67 | assert compare_recursive(diag, expected, atol = Thre) 68 | 69 | -------------------------------------------------------------------------------- /MultirefPredict/tests/test_basis_info.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit and regression test for the MultirefPredict package. 3 | """ 4 | 5 | # Import package, test suite, and other packages as needed 6 | import pytest 7 | import sys 8 | from MultirefPredict.basis_info import element_to_num_AO, element_to_core_AO, molecule_to_num_AO 9 | 10 | @pytest.mark.parametrize("symbol_list, expected_num_AO" , [ 11 | ("H", 2), 12 | ("He", 2), 13 | ("Li", 15), 14 | ("Be", 15), 15 | ("B", 15), 16 | ("C", 15), 17 | ("N", 15), 18 | ("O", 15), 19 | ("F", 15), 20 | ("Ne", 15), 21 | ("Na", 19), 22 | ("Mg", 19), 23 | ("Al", 19), 24 | ("Si", 19), 25 | ("P", 19), 26 | ("S", 19), 27 | ("Cl", 19), 28 | ("Ar", 19), 29 | ("K", 12), 30 | ("Ca", 12), 31 | ("Sc", 24), 32 | ("Ti", 24), 33 | ("V", 24), 34 | ("Cr", 24), 35 | ("Mn", 24), 36 | ("Fe", 24), 37 | ("Co", 24), 38 | ("Ni", 24), 39 | ("Cu", 24), 40 | ("Zn", 20), 41 | ("Ga", 8), 42 | ("Ge", 8), 43 | ("As", 8), 44 | ("Se", 8), 45 | ("Br", 8), 46 | ("Kr", 8), 47 | ("Rb", 12), 48 | ("Sr", 12), 49 | ("Y", 24), 50 | ("Zr", 24), 51 | ("Nb", 24), 52 | ("Mo", 24), 53 | ("Tc", 24), 54 | ("Ru", 24), 55 | ("Rh", 24), 56 | ("Pd", 24), 57 | ("Ag", 24), 58 | ("Cd", 20), 59 | ("In", 8), 60 | ("Sn", 8), 61 | ("Sb", 8), 62 | ("Te", 8), 63 | ("I", 8), 64 | ("Xe", 8), 65 | ("Cs", 12), 66 | ("Ba", 12), 67 | ("La", 24), 68 | ("Hf", 24), 69 | ("Ta", 24), 70 | ("W", 24), 71 | ("Re", 24), 72 | ("Os", 24), 73 | ("Ir", 24), 74 | ("Pt", 24), 75 | ("Au", 24), 76 | ("Hg", 20), 77 | ("Tl", 20), 78 | ("Pb", 8), 79 | ("Bi", 8), 80 | ("U", 24), 81 | ("Np", 24), 82 | ]) 83 | def test_element_to_num_AO(symbol_list, expected_num_AO): 84 | assert element_to_num_AO(symbol_list, "lacvps_ecp") == expected_num_AO 85 | 86 | @pytest.mark.parametrize("symbol_list, expected_core_AO" , [ 87 | ("H", 0), 88 | ("He", 0), 89 | ("Li", 1), 90 | ("Be", 1), 91 | ("B", 1), 92 | ("C", 1), 93 | ("N", 1), 94 | ("O", 1), 95 | ("F", 1), 96 | ("Ne", 1), 97 | ("Na", 5), 98 | ("Mg", 5), 99 | ("Al", 5), 100 | ("Si", 5), 101 | ("P", 5), 102 | ("S", 5), 103 | ("Cl", 5), 104 | ("Ar", 5), 105 | ("K", 0), 106 | ("Ca", 0), 107 | ("Sc", 0), 108 | ("Ti", 0), 109 | ("V", 0), 110 | ("Cr", 0), 111 | ("Mn", 0), 112 | ("Fe", 0), 113 | ("Co", 0), 114 | ("Ni", 0), 115 | ("Cu", 0), 116 | ("Zn", 0), 117 | ("Ga", 0), 118 | ("Ge", 0), 119 | ("As", 0), 120 | ("Se", 0), 121 | ("Br", 0), 122 | ("Kr", 0), 123 | ("Rb", 0), 124 | ("Sr", 0), 125 | ("Y", 0), 126 | ("Zr", 0), 127 | ("Nb", 0), 128 | ("Mo", 0), 129 | ("Tc", 0), 130 | ("Ru", 0), 131 | ("Rh", 0), 132 | ("Pd", 0), 133 | ("Ag", 0), 134 | ("Cd", 0), 135 | ("In", 0), 136 | ("Sn", 0), 137 | ("Sb", 0), 138 | ("Te", 0), 139 | ("I", 0), 140 | ("Xe", 0), 141 | ("Cs", 0), 142 | ("Ba", 0), 143 | ("La", 0), 144 | ("Hf", 0), 145 | ("Ta", 0), 146 | ("W", 0), 147 | ("Re", 0), 148 | ("Os", 0), 149 | ("Ir", 0), 150 | ("Pt", 0), 151 | ("Au", 0), 152 | ("Hg", 0), 153 | ("Tl", 0), 154 | ("Pb", 0), 155 | ("Bi", 0), 156 | ("U", 0), 157 | ("Np", 0), 158 | ]) 159 | def test_element_to_core_AO(symbol_list, expected_core_AO): 160 | assert element_to_core_AO(symbol_list, "lacvps_ecp") == expected_core_AO 161 | 162 | 163 | def test_molecule_to_num_AO(qcelemental_cu_complex): 164 | num_AO, core_AO = molecule_to_num_AO(qcelemental_cu_complex, "lacvps_ecp") 165 | assert num_AO == 230 166 | assert core_AO == 10 167 | -------------------------------------------------------------------------------- /MultirefPredict/tests/test_casbased.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import qcelemental 3 | import qcengine 4 | from qcelemental.testing import compare_recursive 5 | from MultirefPredict.casbased_diagnostic import obtainC0fromstr 6 | 7 | 8 | def test_casscf(): 9 | mol = qcelemental.models.Molecule(geometry=[0, 0, 0], 10 | symbols=["O"], 11 | molecular_charge=0, 12 | molecular_multiplicity=3) 13 | casscf_task = qcelemental.models.ResultInput(molecule=mol, 14 | driver="energy", 15 | model={"method": "casscf", "basis": "cc-pvdz"}, 16 | keywords={"reference": "rohf"} 17 | ) 18 | results = qcengine.compute(casscf_task, "psi4") 19 | energy = results.return_result 20 | expected = -74.91174384584482 21 | Thre = 1e-6 22 | assert compare_recursive(energy, expected, atol=Thre) 23 | 24 | 25 | def test_C0(): 26 | mol = qcelemental.models.Molecule(geometry=[[0, 0, 0], [0.7, 0, 0]], 27 | symbols=["H", "H"], 28 | molecular_charge=0, 29 | molecular_multiplicity=1) 30 | casscf_task = qcelemental.models.ResultInput(molecule=mol, 31 | driver="energy", 32 | model={"method": "casscf", "basis": "cc-pvdz"}, 33 | keywords={"reference": "rohf"} 34 | ) 35 | results = qcengine.compute(casscf_task, "psi4") 36 | outfile = results.stdout.split("\n") 37 | diag = obtainC0fromstr(outfile) 38 | expected = 0.995293 39 | Thre = 1e-3 40 | assert compare_recursive(abs(diag), expected, atol=Thre) 41 | -------------------------------------------------------------------------------- /MultirefPredict/tests/test_ccbased.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit and regression test for the MultirefPredict package. 3 | """ 4 | 5 | # Import package, test suite, and other packages as needed 6 | import pytest 7 | from MultirefPredict.ccbased_diagnostic import CCBased 8 | from qcelemental.testing import compare_recursive 9 | 10 | 11 | @pytest.fixture(scope="class") 12 | def cc_water(qcelemental_water): 13 | ccbased = CCBased(molecule=qcelemental_water) 14 | return ccbased 15 | 16 | @pytest.fixture(scope="class") 17 | def cc_water_not_psi4(qcelemental_water): 18 | ccbased = CCBased(molecule=qcelemental_water) 19 | ccbased.program = "terachem" 20 | return ccbased 21 | 22 | def test_cc_init(qcelemental_water, xyz_water): 23 | ccbased_calculator = CCBased(molecule=qcelemental_water) 24 | assert ccbased_calculator.molecule == qcelemental_water 25 | assert ccbased_calculator.program == "psi4" 26 | 27 | with pytest.raises(TypeError): 28 | ccbased_calculator = CCBased(molecule="NothingHere") 29 | 30 | with pytest.raises(KeyError): 31 | ccbased_calculator = CCBased() 32 | 33 | with pytest.raises(ValueError): 34 | ccbased_calculator = CCBased(molecule = qcelemental_water, 35 | program = "terachem") 36 | def test_cc_computeCCSDT(cc_water,cc_water_not_psi4): 37 | cc_water.computeCCSDT() 38 | assert cc_water.result.success 39 | 40 | with pytest.raises(ValueError): 41 | cc_water_not_psi4.computeCCSDT() 42 | 43 | def test_cc_computeDiagnostic(cc_water): 44 | Thre = 1e-6 45 | diag = cc_water.computeDiagnostic() 46 | expected = {'T1': 0.005903453140867589, 'D1': 0.012965638464472996, 'D2': 0.12885433260716933, 'New D1': 0.012965638464472996} 47 | print(diag) 48 | assert compare_recursive(diag, expected, atol = Thre) 49 | -------------------------------------------------------------------------------- /MultirefPredict/tests/test_cheminfo.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit and regression test for the MultirefPredict package. 3 | """ 4 | 5 | # Import package, test suite, and other packages as needed 6 | import pytest 7 | import sys 8 | import qcelemental 9 | from MultirefPredict import cheminfo 10 | 11 | 12 | def test_qcelemental2xyz(qcelemental_water, xyz_water): 13 | assert cheminfo.qcelemental2xyz(qcelemental_water) == xyz_water 14 | 15 | def test_qcelemental2OBMol(qcelemental_water): 16 | obmol = cheminfo.qcelemental2OBMol(qcelemental_water) 17 | assert obmol.NumAtoms() == 3 18 | -------------------------------------------------------------------------------- /MultirefPredict/tests/test_ebased.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit and regression test for the MultirefPredict package. 3 | """ 4 | 5 | # Import package, test suite, and other packages as needed 6 | import pytest 7 | import qcelemental 8 | from MultirefPredict.ebased_diagnostic import B1, A25PBE, TAE 9 | from qcengine.testing import using_terachem 10 | from qcelemental.testing import compare_recursive 11 | import sys 12 | import qcengine 13 | import psi4 14 | 15 | def test_b1_init(qcelemental_water, xyz_water): 16 | b1_calculator = B1(molecule = qcelemental_water) 17 | assert b1_calculator.molecule == qcelemental_water 18 | assert b1_calculator.numBonds == 2 19 | assert b1_calculator.program == "psi4" 20 | assert b1_calculator.atomized == {} 21 | 22 | with pytest.raises(TypeError): 23 | b1_calculator = B1(molecule="NothingHere") 24 | 25 | with pytest.raises(KeyError): 26 | b1_calculator = B1() 27 | 28 | 29 | @pytest.fixture(scope="class") 30 | def b1_water(qcelemental_water): 31 | b1 = B1(molecule=qcelemental_water, program="psi4") 32 | return b1 33 | 34 | 35 | def test_b1_mol2atoms(b1_water): 36 | b1_water.mol2atoms() 37 | assert len(b1_water.atomized) == 2 38 | assert "O" in b1_water.atomized 39 | assert b1_water.atomized["O"]["count"] == 1 40 | assert b1_water.atomized["O"]["molecule"].symbols == ["O"] 41 | assert b1_water.atomized["O"]["molecule"].molecular_charge == 0 42 | assert b1_water.atomized["O"]["molecule"].molecular_multiplicity == 3 43 | 44 | assert "H" in b1_water.atomized 45 | assert b1_water.atomized["H"]["count"] == 2 46 | assert b1_water.atomized["H"]["molecule"].symbols == ["H"] 47 | assert b1_water.atomized["H"]["molecule"].molecular_charge == 0 48 | assert b1_water.atomized["H"]["molecule"].molecular_multiplicity == 2 49 | 50 | def test_qcengine(): 51 | assert "qcengine" in sys.modules 52 | 53 | def test_psi4(): 54 | assert "psi4" in sys.modules 55 | psi4.set_memory('500 MB') 56 | 57 | h2o = psi4.geometry(""" 58 | O 59 | H 1 0.96 60 | H 1 0.96 2 104.5 61 | """) 62 | 63 | res=psi4.energy('scf/cc-pvdz') 64 | assert res!=0 65 | 66 | def test_energy_prep(b1_water): 67 | # Caculate energy for the whole molecule 68 | dft_functional = "blyp" 69 | molecule_task = { 70 | "schema_name": "qcschema_input", 71 | "schema_version": 1, 72 | "molecule": b1_water.molecule, 73 | "driver": "energy", 74 | "model": {"method": dft_functional, "basis": "6-31g" 75 | }, 76 | } 77 | 78 | print("Evaluating the energy of the whole molecule...") 79 | molecule_result = qcengine.compute(molecule_task, "psi4") 80 | assert True 81 | 82 | def test_b1_computeBE(b1_water): 83 | EnergyThre = 1e-6 84 | 85 | BE_blyp = b1_water.computeBE("blyp") 86 | expected = 0.33100268529368293 87 | assert compare_recursive(BE_blyp, expected, atol = EnergyThre) 88 | 89 | BE_b1lyp = b1_water.computeBE("b1lyp") 90 | expected = 0.3183329645632256 91 | assert compare_recursive(BE_b1lyp, expected, atol = EnergyThre) 92 | 93 | def test_b1_computeDiagnostic(b1_water): 94 | B1Thre = 1e-6 95 | diag = b1_water.computeDiagnostic() 96 | expected = 0.006334860365228678 97 | assert compare_recursive(diag, expected, atol = B1Thre) 98 | 99 | #@pytest.fixture(scope="class") 100 | #def b1_water_terachem(qcelemental_water): 101 | # b1 = B1(molecule=qcelemental_water, program="terachem") 102 | # return b1 103 | # 104 | #def test_b1_terachem(b1_water_terachem): 105 | # B1Thre = 1e-6 106 | # diag = b1_water_terachem.computeDiagnostic() 107 | # expected = 0.006334860365228678 108 | # assert compare_recursive(diag, expected, atol = B1Thre) 109 | 110 | @pytest.fixture(scope="class") 111 | def a25pbe_water(qcelemental_water): 112 | a25pbe = A25PBE(molecule=qcelemental_water) 113 | return a25pbe 114 | 115 | def test_a25pbe_computeDiagnostic(a25pbe_water): 116 | A25PBEThre = 1e-3 117 | diag = a25pbe_water.computeDiagnostic() 118 | expected = 0.1626572016077259 119 | assert compare_recursive(diag, expected, atol = A25PBEThre) 120 | 121 | @pytest.fixture(scope="class") 122 | def a25_water_terachem(qcelemental_water): 123 | a25 = A25PBE(molecule=qcelemental_water, program="terachem") 124 | return a25 125 | 126 | @using_terachem 127 | def test_a25_terachem(a25_water_terachem): 128 | A25PBEThre = 1e-3 129 | diag = a25_water_terachem.computeDiagnostic() 130 | expected = 0.1626572016077259 131 | assert compare_recursive(diag, expected, atol = A25PBEThre) 132 | 133 | @pytest.fixture(scope="class") 134 | def tae_water(qcelemental_water): 135 | tae = TAE(molecule=qcelemental_water) 136 | return tae 137 | 138 | def test_a25tae_computeDiagnostic(tae_water): 139 | TAEThre = 1e-3 140 | diag = tae_water.computeDiagnostic() 141 | expected = 0.281577634 142 | assert compare_recursive(diag, expected, atol = TAEThre) 143 | 144 | -------------------------------------------------------------------------------- /MultirefPredict/tests/test_fonbased.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit and regression test for the MultirefPredict package. 3 | """ 4 | 5 | # Import package, test suite, and other packages as needed 6 | import pytest 7 | from MultirefPredict.fonbased_diagnostic import FonBased 8 | from qcengine.testing import using_terachem 9 | from qcelemental.testing import compare_recursive 10 | import pickle 11 | from contextlib import contextmanager 12 | 13 | @pytest.fixture(scope="class") 14 | def fon_cu_complex(qcelemental_cu_complex): 15 | fonbased = FonBased(molecule=qcelemental_cu_complex, program="terachem") 16 | return fonbased 17 | 18 | @pytest.fixture(scope="class") 19 | def fon_trityl_radical(qcelemental_trityl_radical): 20 | fonbased = FonBased(molecule=qcelemental_trityl_radical, program="terachem") 21 | return fonbased 22 | 23 | @pytest.fixture(scope="class") 24 | def trityl_radical_task(datadir): 25 | task_file_path = datadir+"fon_trityl_task.obj" 26 | with open(task_file_path, 'rb') as task_file: 27 | task = pickle.load(task_file) 28 | return task 29 | 30 | @pytest.fixture(scope="class") 31 | def fon_trityl_result(datadir): 32 | file_path = datadir + "fon_trityl_result.obj" 33 | with open(file_path, 'rb') as result_file: 34 | result = pickle.load(result_file) 35 | return result 36 | 37 | @pytest.fixture(scope="class") 38 | def fon_cu_result(datadir): 39 | file_path = datadir + "fon_cu_result.obj" 40 | with open(file_path, 'rb') as result_file: 41 | result = pickle.load(result_file) 42 | return result 43 | 44 | def test_fon_init(qcelemental_trityl_radical): 45 | fonbased = FonBased(molecule=qcelemental_trityl_radical, program="terachem") 46 | assert fonbased.fons is None 47 | assert fonbased.restricted == False 48 | assert fonbased.norb == 0 49 | assert fonbased.ncore == 0 50 | assert fonbased.nele == 0 51 | 52 | @pytest.mark.parametrize("xc_list, expected_temperature", [ 53 | ("pbe", 0.0158), 54 | ("blyp", 0.0158), 55 | ("svwn", 0.0158), 56 | ("revpbe", 0.0158), 57 | ("bop", 0.0158), 58 | ("b97", 0.0158), 59 | ("b3lyp", 0.0285), 60 | ("b3lyp1", 0.0285), 61 | ("b3lyp3", 0.0285), 62 | ("b3lyp5", 0.0285), 63 | ("bhandhlyp", 0.0475), 64 | ("pbe0", 0.0316), 65 | ("revpbe0", 0.0316), 66 | ]) 67 | def test_fon_setTemperature(xc_list, expected_temperature, fon_cu_complex): 68 | Thre = 1e-3 69 | assert compare_recursive(fon_cu_complex.setTemperature(xc_list), expected_temperature, atol = Thre) 70 | 71 | @contextmanager 72 | def does_not_raise(): 73 | yield 74 | 75 | @pytest.mark.parametrize("xc, expectation", [ 76 | ("pbe", does_not_raise()), 77 | ("blyp", does_not_raise()), 78 | ("svwn", does_not_raise()), 79 | ("revpbe", does_not_raise()), 80 | ("bop", does_not_raise()), 81 | ("b97", does_not_raise()), 82 | ("b3lyp", does_not_raise()), 83 | ("b3lyp1", does_not_raise()), 84 | ("b3lyp3", does_not_raise()), 85 | ("b3lyp5", does_not_raise()), 86 | ("bhandhlyp", does_not_raise()), 87 | ("pbe0", does_not_raise()), 88 | ("revpbe0", does_not_raise()), 89 | ("wpbeh", pytest.raises(ValueError)), 90 | ("wpbe", pytest.raises(ValueError)), 91 | ("camb3lyp", pytest.raises(ValueError)), 92 | ]) 93 | def test_fon_setTemperature_exception(xc, expectation, fon_cu_complex): 94 | with expectation: 95 | fon_cu_complex.setTemperature(xc) 96 | 97 | @using_terachem 98 | def test_fon_computeFon(fon_cu_complex): 99 | result = fon_cu_complex.computeFon("PBE") 100 | assert fon_cu_complex.fons is not None 101 | 102 | def test_fon_task(fon_trityl_radical, trityl_radical_task): 103 | with pytest.raises(ValueError): 104 | fon_task = fon_trityl_radical.FonTask(fon_trityl_radical.molecule, "psi4", "PBE") 105 | 106 | fon_task = fon_trityl_radical.FonTask(fon_trityl_radical.molecule,"terachem","PBE") 107 | Thre = 1e-6 108 | assert compare_recursive(fon_task.dict()['keywords'], trityl_radical_task.dict()['keywords'], atol=Thre) 109 | 110 | def test_harvestFon(fon_trityl_radical, fon_trityl_result, fon_cu_complex, fon_cu_result): 111 | #first test trityl_radical 112 | fon_trityl_radical.FonTask(fon_trityl_radical.molecule, fon_trityl_radical.program, "PBE") 113 | fons=fon_trityl_radical.harvestFon(fon_trityl_result) 114 | expected_nele = 129 115 | assert fon_trityl_radical.nele == expected_nele 116 | assert fon_trityl_radical.restricted == False 117 | assert len(fons) > 0 118 | #Then test cu_complex 119 | fon_cu_complex.FonTask(fon_cu_complex.molecule, fon_cu_complex.program, "PBE") 120 | fons = fon_cu_complex.harvestFon(fon_cu_result) 121 | expected_nele = 120 122 | assert fon_cu_complex.nele == expected_nele 123 | assert fon_cu_complex.restricted == True 124 | assert len(fons) > 0 125 | 126 | @using_terachem 127 | def test_fon_computeDiagnostic(fon_cu_complex): 128 | Thre = 1e-2 129 | diag = fon_cu_complex.computeDiagnostic() 130 | expected = {'FOD': 0.980722, 131 | 'Mattito':{ 'I_D': 0.473731315028, 'I_ND': 0.431365088635}, 132 | 'Entanglement': 0.732773215873} 133 | print(diag) 134 | assert compare_recursive(diag, expected, atol=Thre) 135 | 136 | @using_terachem 137 | def test_fon_computeFon_unrestricted(fon_trityl_radical): 138 | molecule_task = fon_trityl_radical.FonTask(fon_trityl_radical.molecule,\ 139 | fon_trityl_radical.program, "PBE") 140 | assert molecule_task is not None 141 | result = fon_trityl_radical.computeFon("PBE") 142 | assert fon_trityl_radical.fons is not None 143 | with pytest.raises(RuntimeError): 144 | failed_result = fon_trityl_radical.computeFon("TPSS") 145 | 146 | @using_terachem 147 | def test_fon_unrestricted(fon_trityl_radical): 148 | Thre = 1e-2 149 | diag = fon_trityl_radical.computeDiagnostic() 150 | expected = {'FOD': 0.34399500000000005, 151 | 'Mattito': {'I_D': 0.39268800205639215, 'I_ND': 0.16333423895850002}, 152 | 'Entanglement': -1} 153 | 154 | print(diag) 155 | assert compare_recursive(diag, expected, atol=Thre) 156 | 157 | @using_terachem 158 | def test_fon_b3lyp(fon_trityl_radical): 159 | Thre = 1e-2 160 | diag2 = fon_trityl_radical.computeDiagnostic("b3lyp") 161 | expected2 = {'FOD': 0.7340689999999996, 162 | 'Mattito': {'I_D': 0.7479020997602953, 'I_ND': 0.33741997473349994}, 163 | 'Entanglement': -1} 164 | 165 | print(diag2) 166 | assert compare_recursive(diag2, expected2, atol=Thre) 167 | -------------------------------------------------------------------------------- /MultirefPredict/tests/test_spin.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit and regression test for the MultirefPredict package. 3 | """ 4 | 5 | # Import package, test suite, and other packages as needed 6 | import pytest 7 | import sys 8 | from MultirefPredict.spin import atomSpinMultDict 9 | 10 | @pytest.mark.parametrize("symbol_list, expected_spinmult" , [ 11 | ("H", 2), 12 | ("He", 1), 13 | ("Li", 2), 14 | ("Be", 1), 15 | ("B", 2), 16 | ("C", 3), 17 | ("N", 4), 18 | ("O", 3), 19 | ("F", 2), 20 | ("Ne", 1), 21 | ("Na", 2), 22 | ("Mg", 1), 23 | ("Al", 2), 24 | ("Si", 3), 25 | ("P", 4), 26 | ("S", 3), 27 | ("Cl", 2), 28 | ("Ar", 1), 29 | ("K", 2), 30 | ("Ca", 1), 31 | ("Sc", 2), 32 | ("Ti", 3), 33 | ("V", 4), 34 | ("Cr", 7), 35 | ("Mn", 6), 36 | ("Fe", 5), 37 | ("Co", 4), 38 | ("Ni", 3), 39 | ("Cu", 2), 40 | ("Zn", 1), 41 | ("Ga", 2), 42 | ("Ge", 3), 43 | ("As", 4), 44 | ("Se", 3), 45 | ("Br", 2), 46 | ("Kr", 1), 47 | ]) 48 | def test_atomSpinMultDict(symbol_list, expected_spinmult): 49 | spindict = atomSpinMultDict() 50 | assert "MultirefPredict" in sys.modules 51 | assert spindict.get_spinmult(symbol_list) == expected_spinmult 52 | 53 | @pytest.mark.parametrize("symbol_charge, spinmult" , [ 54 | (["Sc", 2], 2), 55 | (["Ti", 2], 3), 56 | (["V", 2], 4), 57 | (["Cr", 2], 5), 58 | (["Mn", 2], 6), 59 | (["Fe", 2], 5), 60 | (["Co", 2], 4), 61 | (["Ni", 2], 3), 62 | (["Cu", 2], 2), 63 | (["Zn", 2], 1), 64 | ]) 65 | def test_atomSpinMultCation(symbol_charge,spinmult): 66 | spindict = atomSpinMultDict() 67 | assert spindict.get_spinmult(symbol_charge[0],symbol_charge[1]) == spinmult 68 | 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MultirefPredict 2 | ============================== 3 | [//]: # (Badges) 4 | [](https://travis-ci.org/hjkgrp/MultirefPredict) 5 | [](https://codecov.io/gh/hjkgrp/MultirefPredict/branch/master) 6 | [](https://lgtm.com/projects/g/hjkgrp/MultirefPredict/context:python) 7 | [](https://multirefpredict.readthedocs.io/en/latest/?badge=latest) 8 | 9 | Automated workflow to predict multireference character of molecules in quantum chemistry calculation 10 | 11 | ### Copyright 12 | 13 | Copyright (c) 2019, Kulik group at MIT 14 | 15 | 16 | #### Online documentation and tutorial 17 | http://multirefpredict.readthedocs.io 18 | 19 | #### Acknowledgements 20 | 21 | Project based on the 22 | [Computational Molecular Science Python Cookiecutter](https://github.com/molssi/cookiecutter-cms) version 1.0. 23 | 24 | -------------------------------------------------------------------------------- /devtools/README.md: -------------------------------------------------------------------------------- 1 | # Development, testing, and deployment tools 2 | 3 | This directory contains a collection of tools for running Continuous Integration (CI) tests, 4 | conda installation, and other development tools not directly related to the coding process. 5 | 6 | 7 | ## Manifest 8 | 9 | ### Continuous Integration 10 | 11 | You should test your code, but do not feel compelled to use these specific programs. You also may not need Unix and 12 | Windows testing if you only plan to deploy on specific platforms. These are just to help you get started 13 | 14 | * `travis-ci`: Linux and OSX based testing through [Travis-CI](https://about.travis-ci.com/) 15 | * `before_install.sh`: Pip/Miniconda pre-package installation script for Travis 16 | * `appveyor`: Windows based testing through [AppVeyor](https://www.appveyor.com/) (there are no files directly related to this) 17 | 18 | ### Conda Recipe: 19 | 20 | This directory contains the files to build and deploy on [Conda](https://conda.io/). Although the Cookiecutter 21 | does not do anything with this directory at the moment, we leave this here to show an example of how 22 | your conda-recipe folder should look, when you decide to start deployment. 23 | 24 | * `conda-recipe`: directory containing all the build objects required for Conda. All files in this folder must have their given names 25 | * `meta.yaml`: The yaml file needed by Conda to construct the build 26 | * `build.sh`: Unix-based instructions for how to install the software interpreted by Conda 27 | * `bld.bat`: Windows-based instructions for how to install the software interpreted by Conda 28 | 29 | ### Conda Environment: 30 | 31 | This directory contains the files to setup the Conda environment for testing purposes 32 | 33 | * `conda-envs`: directory containing the YAML file(s) which fully describe Conda Environments, their dependencies, and those dependency provenance's 34 | * `test_env.yaml`: Simple test environment file with base dependencies. Channels are not specified here and therefore respect global Conda configuration 35 | 36 | ### Additional Scripts: 37 | 38 | This directory contains OS agnostic helper scripts which don't fall in any of the previous categories 39 | * `scripts` 40 | * `create_conda_env.py`: Helper program for spinning up new conda environments based on a starter file with Python Version and Env. Name command-line options 41 | 42 | 43 | ## How to contribute changes 44 | - Clone the repository if you have write access to the main repo, fork the repository if you are a collaborator. 45 | - Make a new branch with `git checkout -b {your branch name}` 46 | - Make changes and test your code 47 | - Ensure that the test environment dependencies (`conda-envs`) line up with the build and deploy dependencies (`conda-recipe/meta.yaml`) 48 | - Push the branch to the repo (either the main or your fork) with `git push -u origin {your branch name}` 49 | * Note that `origin` is the default name assigned to the remote, yours may be different 50 | - Make a PR on GitHub with your changes 51 | - We'll review the changes and get your code into the repo after lively discussion! 52 | 53 | 54 | ## Checklist for updates 55 | - [ ] Make sure there is an/are issue(s) opened for your specific update 56 | - [ ] Create the PR, referencing the issue 57 | - [ ] Debug the PR as needed until tests pass 58 | - [ ] Tag the final, debugged version 59 | * `git tag -a X.Y.Z [latest pushed commit] && git push --follow-tags` 60 | - [ ] Get the PR merged in 61 | 62 | ## Versioneer Auto-version 63 | [Versioneer](https://github.com/warner/python-versioneer) will automatically infer what version 64 | is installed by looking at the `git` tags and how many commits ahead this version is. The format follows 65 | [PEP 440](https://www.python.org/dev/peps/pep-0440/) and has the regular expression of: 66 | ```regexp 67 | \d+.\d+.\d+(?\+\d+-[a-z0-9]+) 68 | ``` 69 | If the version of this commit is the same as a `git` tag, the installed version is the same as the tag, 70 | e.g. `MultirefPredict-0.1.2`, otherwise it will be appended with `+X` where `X` is the number of commits 71 | ahead from the last tag, and then `-YYYYYY` where the `Y`'s are replaced with the `git` commit hash. 72 | -------------------------------------------------------------------------------- /devtools/conda-envs/test_env.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | channels: 3 | - psi4 4 | - conda-forge 5 | - openbabel 6 | dependencies: 7 | # Base depends 8 | - python=3.6 9 | - pip 10 | 11 | # Testing 12 | - pytest 13 | - pytest-cov 14 | 15 | - psi4=1.3 16 | - dftd3 17 | # Core 18 | - numpy 19 | - pyyaml 20 | - py-cpuinfo 21 | - psutil 22 | - pydantic=0.23 23 | - openbabel 24 | 25 | # Pip-only installs 26 | - pip: 27 | - codecov 28 | - qcengine 29 | - basis_set_exchange 30 | - git+https://github.com/leeping/geomeTRIC#egg=geometric 31 | - git+https://github.com/MolSSI/QCElemental.git@v0.4.2#egg=qcelemental 32 | -------------------------------------------------------------------------------- /devtools/conda-recipe/bld.bat: -------------------------------------------------------------------------------- 1 | # Build the python package, don't let setuptools/pip try to get packages 2 | pip install . --no-deps 3 | if errorlevel 1 exit 1 4 | -------------------------------------------------------------------------------- /devtools/conda-recipe/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build the python package, don't let setuptools/pip try to get packages 4 | # $PYTHON setup.py develop --no-deps 5 | pip install . --no-deps -------------------------------------------------------------------------------- /devtools/conda-recipe/meta.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: MultirefPredict 3 | version: "0.0.0" 4 | 5 | source: 6 | path: ../.. 7 | 8 | build: 9 | number: 0 10 | 11 | requirements: 12 | host: 13 | - python 14 | - setuptools 15 | 16 | run: 17 | - python 18 | 19 | test: 20 | requires: 21 | - pytest 22 | imports: 23 | - MultirefPredict 24 | 25 | about: 26 | home: add_url_here 27 | license: BSD-3-Clause License 28 | -------------------------------------------------------------------------------- /devtools/scripts/create_conda_env.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import os 3 | import re 4 | import glob 5 | import shutil 6 | import subprocess as sp 7 | from tempfile import TemporaryDirectory 8 | from contextlib import contextmanager 9 | # YAML imports 10 | try: 11 | import yaml # PyYAML 12 | loader = yaml.load 13 | except ImportError: 14 | try: 15 | import ruamel_yaml as yaml # Ruamel YAML 16 | except ImportError: 17 | try: 18 | # Load Ruamel YAML from the base conda environment 19 | from importlib import util as import_util 20 | CONDA_BIN = os.path.dirname(os.environ['CONDA_EXE']) 21 | ruamel_yaml_path = glob.glob(os.path.join(CONDA_BIN, '..', 22 | 'lib', 'python*.*', 'site-packages', 23 | 'ruamel_yaml', '__init__.py'))[0] 24 | # Based on importlib example, but only needs to load_module since its the whole package, not just 25 | # a module 26 | spec = import_util.spec_from_file_location('ruamel_yaml', ruamel_yaml_path) 27 | yaml = spec.loader.load_module() 28 | except (KeyError, ImportError, IndexError): 29 | raise ImportError("No YAML parser could be found in this or the conda environment. " 30 | "Could not find PyYAML or Ruamel YAML in the current environment, " 31 | "AND could not find Ruamel YAML in the base conda environment through CONDA_EXE path. " 32 | "Environment not created!") 33 | loader = yaml.YAML(typ="safe").load # typ="safe" avoids odd typing on output 34 | 35 | 36 | @contextmanager 37 | def temp_cd(): 38 | """Temporary CD Helper""" 39 | cwd = os.getcwd() 40 | with TemporaryDirectory() as td: 41 | try: 42 | os.chdir(td) 43 | yield 44 | finally: 45 | os.chdir(cwd) 46 | 47 | 48 | # Args 49 | parser = argparse.ArgumentParser(description='Creates a conda environment from file for a given Python version.') 50 | parser.add_argument('-n', '--name', type=str, 51 | help='The name of the created Python environment') 52 | parser.add_argument('-p', '--python', type=str, 53 | help='The version of the created Python environment') 54 | parser.add_argument('conda_file', 55 | help='The file for the created Python environment') 56 | 57 | args = parser.parse_args() 58 | 59 | # Open the base file 60 | with open(args.conda_file, "r") as handle: 61 | yaml_script = loader(handle.read()) 62 | 63 | python_replacement_string = "python {}*".format(args.python) 64 | 65 | try: 66 | for dep_index, dep_value in enumerate(yaml_script['dependencies']): 67 | if re.match('python([ ><=*]+[0-9.*]*)?$', dep_value): # Match explicitly 'python' and its formats 68 | yaml_script['dependencies'].pop(dep_index) 69 | break # Making the assumption there is only one Python entry, also avoids need to enumerate in reverse 70 | except (KeyError, TypeError): 71 | # Case of no dependencies key, or dependencies: None 72 | yaml_script['dependencies'] = [] 73 | finally: 74 | # Ensure the python version is added in. Even if the code does not need it, we assume the env does 75 | yaml_script['dependencies'].insert(0, python_replacement_string) 76 | 77 | # Figure out conda path 78 | if "CONDA_EXE" in os.environ: 79 | conda_path = os.environ["CONDA_EXE"] 80 | else: 81 | conda_path = shutil.which("conda") 82 | if conda_path is None: 83 | raise RuntimeError("Could not find a conda binary in CONDA_EXE variable or in executable search path") 84 | 85 | print("CONDA ENV NAME {}".format(args.name)) 86 | print("PYTHON VERSION {}".format(args.python)) 87 | print("CONDA FILE NAME {}".format(args.conda_file)) 88 | print("CONDA PATH {}".format(conda_path)) 89 | 90 | # Write to a temp directory which will always be cleaned up 91 | with temp_cd(): 92 | temp_file_name = "temp_script.yaml" 93 | with open(temp_file_name, 'w') as f: 94 | f.write(yaml.dump(yaml_script)) 95 | sp.call("{} env create -n {} -f {}".format(conda_path, args.name, temp_file_name), shell=True) 96 | -------------------------------------------------------------------------------- /devtools/travis-ci/before_install.sh: -------------------------------------------------------------------------------- 1 | # Temporarily change directory to $HOME to install software 2 | pushd . 3 | cd $HOME 4 | # Make sure some level of pip is installed 5 | python -m ensurepip 6 | 7 | # Install Miniconda 8 | if [ "$TRAVIS_OS_NAME" == "osx" ]; then 9 | # Make OSX md5 mimic md5sum from linux, alias does not work 10 | md5sum () { 11 | command md5 -r "$@" 12 | } 13 | MINICONDA=Miniconda3-latest-MacOSX-x86_64.sh 14 | else 15 | MINICONDA=Miniconda3-latest-Linux-x86_64.sh 16 | fi 17 | MINICONDA_HOME=$HOME/miniconda 18 | MINICONDA_MD5=$(wget -qO- https://repo.anaconda.com/miniconda/ | grep -A3 $MINICONDA | sed -n '4p' | sed -n 's/ *