Skip to content

Commit

Permalink
Merge pull request #9 from molssi-seamm/system2
Browse files Browse the repository at this point in the history
Updated for compatibility with the new system classes.
  • Loading branch information
paulsaxe authored Feb 4, 2021
2 parents 4577dee + dd0968e commit 7f3de62
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 87 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/BranchCI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches-ignore:
- 'main'
- 'master'

jobs:
light-ci:
Expand Down Expand Up @@ -51,10 +50,5 @@ jobs:
file: ./coverage.xml
flags: unittests
name: codecov-ubuntu-latest-py3.8
- name: Build documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash -l {0}
run: |
docs/buildDocs.sh


19 changes: 4 additions & 15 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
name: CI

on:
# GitHub has started calling new repo's first branch "main" https://github.com/github/renaming
# Existing codes likely still have "master" as the primary branch
# Both are tracked here to keep legacy and new codes working
push:
branches:
- "master"
- "main"
pull_request:
branches:
- "master"
- "main"
schedule:
# Run on master by default Sunday morning at 3:30:
# Run by default Sunday morning at 3:30:
# Scheduled workflows run on the latest commit on the default or base branch.
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
- cron: "30 3 * * 0"

jobs:
lint-docs:
name: Lint-Docs ubuntu-latest Py3.8
lint:
name: Lint ubuntu-latest Py3.8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -53,17 +48,11 @@ jobs:
run: |
flake8 psi4_step tests
yapf --diff --recursive psi4_step tests
- name: Build documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash -l {0}
run: |
docs/buildDocs.sh
test:
name: Test ${{ matrix.os }} Py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: lint-docs
needs: lint
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/Docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Documentation

on: push

jobs:
docs:
name: Docs ubuntu-latest Py3.8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
# This gets all branches (1 = only current branch)
fetch-depth: 0
- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a
# More info on options: https://github.com/conda-incubator/setup-miniconda
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
environment-file: devtools/conda-envs/test_env.yaml
activate-environment: test
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Install package
# conda setup requires this special shell
shell: bash -l {0}
run: |
python -m pip install . --no-deps
conda list
- name: Build documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash -l {0}
run: |
docs/buildDocs.sh
18 changes: 4 additions & 14 deletions .github/workflows/Release.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
name: Release

on:
# GitHub has started calling new repo's first branch "main" https://github.com/github/renaming
# Existing codes likely still have "master" as the primary branch
# Both are tracked here to keep legacy and new codes working
release:
types: [published]
branches:
- "master"
- "main"

jobs:
lint-docs:
name: Lint-Docs ubuntu-latest Py3.8
lint:
name: Lint ubuntu-latest Py3.8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -45,17 +41,11 @@ jobs:
run: |
flake8 psi4_step tests
yapf --diff --recursive psi4_step tests
- name: Build documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash -l {0}
run: |
docs/buildDocs.sh
test:
name: Test ${{ matrix.os }} Py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: lint-docs
needs: lint
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
Expand Down Expand Up @@ -98,7 +88,7 @@ jobs:
# only to test.pypi, otherwise to both it and the main pypi.
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [lint-docs, test]
needs: [lint, test]
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
Expand Down
31 changes: 20 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,39 @@
Psi4 Step
=========

.. image:: https://img.shields.io/github/issues-pr-raw/molssi-seamm/psi4_step
:target: https://github.com/molssi-seamm/psi4_step/pulls
:alt: GitHub pull requests

.. image:: https://img.shields.io/travis/molssi-seamm/psi4_step.svg
:target: https://travis-ci.org/molssi-seamm/psi4_step
.. image:: https://pyup.io/repos/github/molssi-seamm/psi4_step/shield.svg
:target: https://pyup.io/repos/github/molssi-seamm/psi4_step/
:alt: Updates

.. image:: https://github.com/molssi-seamm/psi4_step/workflows/CI/badge.svg
:target: https://github.com/molssi-seamm/psi4_step/actions
:alt: Build Status

.. image:: https://codecov.io/gh/molssi-seamm/psi4_step/branch/master/graph/badge.svg
:target: https://codecov.io/gh/molssi-seamm/psi4_step
:alt: Code Coverage

.. image:: https://img.shields.io/lgtm/grade/python/g/molssi-seamm/psi4_step.svg?logo=lgtm&logoWidth=18
:target: https://lgtm.com/projects/g/molssi-seamm/psi4_step/context:python
:alt: Code Quality

.. image:: https://readthedocs.org/projects/psi4-step/badge/?version=latest
:target: https://psi4-step.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://github.com/molssi-seamm/psi4_step/workflows/Documentation/badge.svg
:target: https://molssi-seamm.github.io/psi4_step/index.html
:alt: Documentation Status

.. image:: https://pyup.io/repos/github/molssi-seamm/psi4_step/shield.svg
:target: https://pyup.io/repos/github/molssi-seamm/psi4_step/
:alt: Updates for Dependencies

.. image:: https://img.shields.io/pypi/v/psi4_step.svg
:target: https://pypi.python.org/pypi/psi4_step

:alt: PyPi VERSION

A step for Psi4 in a SEAMM flowchart


* Free software: BSD-3-Clause
* Documentation: https://psi4-step.readthedocs.io.
* Documentation: https://molssi-seamm.github.io/psi4_step/index.html


Features
Expand Down
54 changes: 15 additions & 39 deletions psi4_step/psi4.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ def run(self):
printer.important(self.header)
printer.important('')

system = self.get_variable('_system')
n_atoms = system.n_atoms()
system_db = self.get_variable('_system_db')
configuration = system_db.system.configuration
n_atoms = configuration.n_atoms
if n_atoms == 0:
self.logger.error('Psi4 run(): there is no structure!')
raise RuntimeError('Psi4 run(): there is no structure!')
Expand Down Expand Up @@ -525,7 +526,8 @@ def analyze(self, indent='', **kwargs):
with structure_file.open(mode='r') as fd:
structure = json.load(fd)
if 'geom' in structure:
system = self.get_variable('_system')
system_db = self.get_variable('_system_db')
configuration = system_db.system.configuration
xs = []
ys = []
zs = []
Expand All @@ -534,9 +536,9 @@ def analyze(self, indent='', **kwargs):
xs.append(x)
ys.append(next(it))
zs.append(next(it))
system.atoms['x'][0:] = xs
system.atoms['y'][0:] = ys
system.atoms['z'][0:] = zs
configuration.atoms['x'][0:] = xs
configuration.atoms['y'][0:] = ys
configuration.atoms['z'][0:] = zs
printer.important(
self.indent +
' Updated the system with the structure from Psi4',
Expand All @@ -546,7 +548,8 @@ def analyze(self, indent='', **kwargs):
def _convert_structure(self, name=None):
"""Convert the structure to the input for Psi4."""

system = self.get_variable('_system')
system_db = self.get_variable('_system_db')
configuration = system_db.system.configuration

structure = []
if name is None:
Expand All @@ -555,40 +558,13 @@ def _convert_structure(self, name=None):
structure.append('molecule ' + name + ' {')

# Charge and multiplicity
if 'extras' in system:
extras = system['extras']

if 'open' in extras and extras['open'] is not None:
openshell = extras['open']
if (
(
isinstance(openshell, tuple) or
isinstance(openshell, list)
) and len(openshell) > 1
):
nopen = openshell[0]
norbitals = openshell[1]
if nopen != norbitals:
raise NotImplementedError(
f"Handling of open shell = '{openshell}'"
)
else:
nopen = openshell
norbitals = nopen

if 'net_charge' in extras and extras['net_charge'] is not None:
structure.append(f" {extras['net_charge']} {nopen}")
else:
structure.append(f' 0 {nopen}')
else:
if 'net_charge' in extras and extras['net_charge'] is not None:
structure.append(f" {extras['net_charge']} 1")
# not handled yet!!!!

elements = system.atoms.symbols()
coordinates = system.atoms.coordinates()
elements = configuration.atoms.symbols
coordinates = configuration.atoms.coordinates

if 'freeze' in system.atoms:
freeze = system.atoms['freeze']
if 'freeze' in configuration.atoms:
freeze = configuration.atoms['freeze']
else:
freeze = [''] * len(elements)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
psutil==5.7.2
seamm==2020.12.4
seamm==2021.2.2

0 comments on commit 7f3de62

Please sign in to comment.