diff --git a/.github/workflows/cont_int.yml b/.github/workflows/cont_int.yml index ede5522bb4..5f5dfee56f 100644 --- a/.github/workflows/cont_int.yml +++ b/.github/workflows/cont_int.yml @@ -1,27 +1,34 @@ name: continuous integration -on: [push] +on: + push: + pull_request: + branches: + - master + types: [opened, synchronize, reopened, ready_for_review, review_requested] jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.7, 3.8] + defaults: + run: + shell: bash -l {0} steps: - uses: actions/checkout@v2 - - name: Set up miniconda Python ${{ matrix.python-version }} + - name: Set up miniconda Python 3.7 uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: arc_env environment-file: environment.yml - python-version: ${{ matrix.python-version }} + activate-environment: arc_env + python-version: 3.7 auto-activate-base: false + - name: Install codecov + run: conda install -y -c conda-forge codecov + - name: Install dependencies - shell: bash -l {0} run: | export PYTHONPATH=$PYTHONPATH:$(pwd) conda activate arc_env @@ -40,7 +47,6 @@ jobs: conda list - name: Lint with flake8 - shell: bash -l {0} run: | conda install flake8 # stop the build if there are Python syntax errors or undefined names @@ -49,7 +55,6 @@ jobs: python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with nosetests - shell: bash -l {0} run: | cd .. cd RMG-Py diff --git a/arc/species/conformers.py b/arc/species/conformers.py index cc43e62e13..4e00fc8e26 100644 --- a/arc/species/conformers.py +++ b/arc/species/conformers.py @@ -43,8 +43,8 @@ from itertools import product from typing import List, Optional, Tuple, Union -import openbabel as ob -import pybel as pyb +from openbabel import openbabel as ob +from openbabel import pybel as pyb from rdkit import Chem from rdkit.Chem.rdchem import EditableMol as RDMol diff --git a/arc/species/conformersTest.py b/arc/species/conformersTest.py index eb90617dba..adaf4316b0 100644 --- a/arc/species/conformersTest.py +++ b/arc/species/conformersTest.py @@ -142,7 +142,7 @@ def test_generate_conformers_with_openbabel(self): force_field='MMFF94s', print_logs=False, diastereomers=None, n_confs=1, return_all_conformers=False) self.assertEqual(len(lowest_confs), 1) - self.assertAlmostEqual(lowest_confs[0]['FF energy'], -0.7460169669694667) + self.assertAlmostEqual(lowest_confs[0]['FF energy'], -0.7418115656748858) expected_xyz = {'symbols': ('C', 'C', 'H', 'H', 'H', 'O', 'H', 'H', 'O'), 'isotopes': (12, 12, 1, 1, 1, 16, 1, 1, 16), 'coords': ((-1.06401, 0.15134, -0.02907), @@ -535,7 +535,7 @@ def test_openbabel_force_field(self): xyzs, energies = conformers.openbabel_force_field(label='', mol=spc.mol, num_confs=1, force_field='GAFF', method='diverse') self.assertEqual(len(xyzs), 1) - self.assertAlmostEqual(energies[0], 2.9310163, 3) + self.assertAlmostEqual(energies[0], 2.931930, 3) def test_openbabel_force_field_on_rdkit_conformers(self): """Test Open Babel force field on RDKit conformers""" @@ -576,8 +576,8 @@ def test_openbabel_force_field_on_rdkit_conformers(self): (0.59336, 1.16044, 0.53412), (2.51642, -0.38757, 0.25036))}] self.assertEqual(len(energies), 2) - self.assertAlmostEqual(energies[0], 0.2446742680965306) - self.assertAlmostEqual(energies[1], -0.7460169699282158) + self.assertAlmostEqual(energies[0], 3.4958104235174376) + self.assertAlmostEqual(energies[1], -0.7028477774918569) # Only symbols instead of the coordinate values are compared. # This is due to the unknown behavior of OpenBabel optimization function. # With the same iteration number and same initial xyz, the optimized xyzs can @@ -2065,8 +2065,8 @@ def test_determine_chirality(self): (5, 4, 6, 7): 204.57856732311797}}] mol = ARCSpecies(label='C(O)(S)NC=CO', smiles='C(O)(S)NC=CO', xyz=confs[0]['xyz']).mol # preserves atom order confs = conformers.determine_chirality(conformers=confs, label='C(O)(S)NC=CO', mol=mol) - self.assertEqual(confs[0]['chirality'], {(3,): 'NR', (4,): 'S', (5, 6): 'E'}) - self.assertEqual(confs[1]['chirality'], {(3,): 'NR', (4,): 'R', (5, 6): 'Z'}) + self.assertEqual(confs[0]['chirality'], {(0,): 'R', (3,): 'NR', (4, 5): 'E'}) + self.assertEqual(confs[1]['chirality'], {(0,): 'S', (3,): 'NR', (4, 5): 'Z'}) def test_get_lowest_diastereomers(self): """Test the getting the lowest diasteroemrs from a given conformers list""" diff --git a/arc/species/converter.py b/arc/species/converter.py index cc8c5fd283..2ec8143216 100644 --- a/arc/species/converter.py +++ b/arc/species/converter.py @@ -6,8 +6,8 @@ import os from typing import Dict, Iterable, List, Optional, Tuple, Union -import pybel import qcelemental as qcel +from openbabel import pybel from rdkit import Chem from rdkit.Chem import rdMolTransforms as rdMT from rdkit.Chem.rdchem import AtomValenceException diff --git a/arc/species/converterTest.py b/arc/species/converterTest.py index 9832d0fa7b..acc249bd58 100644 --- a/arc/species/converterTest.py +++ b/arc/species/converterTest.py @@ -3086,10 +3086,10 @@ def test_xyz_to_smiles(self): # self.assertEqual(mol11.to_smiles(), 'N(N)[N+](=O)[O-]') # gives None self.assertEqual(mol12.to_smiles(), '[O]N=O') # self.assertEqual(mol13.to_smiles(), 'C[N+]([NH-])=O') # gives None - self.assertEqual(mol14.to_smiles(), 'OS(=O)[O]') + self.assertEqual(mol14.to_smiles(), '[O]S(=O)O') self.assertEqual(mol15.to_smiles(), '[N-]=[N+]=N') self.assertEqual(mol16.to_smiles(), '[O]N=C') - self.assertEqual(mol17.to_smiles(), 'OS(=O)(=O)O') + self.assertEqual(mol17.to_smiles(), '[O-][S+](=O)(O)O') self.assertEqual(mol18.to_smiles(), 'O=S(=O)=O') self.assertEqual(mol19.to_adjacency_list(), """multiplicity 2 1 N u1 p1 c0 {4,S} {5,S} @@ -3624,7 +3624,7 @@ def test_add_lone_pairs_by_atom_valance(self): 4 H u0 p0 c0 {2,S}""" mol2 = Molecule().from_adjacency_list(adjlist=adj2) converter.add_lone_pairs_by_atom_valance(mol2) - self.assertEqual(mol2.to_smiles(), 'N[N]') + self.assertEqual(mol2.to_smiles(), '[N]N') mol2.multiplicity = 1 converter.add_lone_pairs_by_atom_valance(mol2) self.assertEqual(mol2.to_smiles(), '[N-]=[NH2+]') diff --git a/arc/species/speciesTest.py b/arc/species/speciesTest.py index eaf536726d..c7ea589351 100644 --- a/arc/species/speciesTest.py +++ b/arc/species/speciesTest.py @@ -1118,6 +1118,7 @@ def test_check_xyz_isomorphism(self): Cl -0.5031634975 -0.0109430036 0.0 H 1.5281481620 -0.8718549847 0.0""" spc6 = ARCSpecies(label='[CH]Cl', smiles='[CH]Cl', xyz=xyz6) + self.assertEqual(spc6.get_xyz(), str_to_xyz(xyz6)) def test_scissors(self): """Test the scissors method in Species""" diff --git a/arc/species/xyz_to_2d.py b/arc/species/xyz_to_2d.py index b6fa3c51c3..02b16e4e9a 100644 --- a/arc/species/xyz_to_2d.py +++ b/arc/species/xyz_to_2d.py @@ -5,7 +5,7 @@ import numpy as np -import pybel +from openbabel import pybel from rdkit import Chem from rdkit.Chem import GetPeriodicTable diff --git a/arc/species/zmatTest.py b/arc/species/zmatTest.py index 7503f7a93c..e0c715d30f 100644 --- a/arc/species/zmatTest.py +++ b/arc/species/zmatTest.py @@ -290,12 +290,12 @@ def setUpClass(cls): def test_get_atom_connectivity_from_mol(self): """Test listing an atom's connectivity in a molecule""" - mol = ARCSpecies(label='c1cc1O', smiles='c1cc1O').mol + mol = ARCSpecies(label='OC1CC1', smiles='OC1CC1').mol connectivity = dict() for i, atom in enumerate(mol.atoms): connectivity[i] = zmat.get_atom_connectivity_from_mol(mol, atom) - expected_connectivity = {0: [1, 2, 4, 5], 1: [0, 2, 6, 7], 2: [1, 0, 3, 8], 3: [2, 9], - 4: [0], 5: [0], 6: [1], 7: [1], 8: [2], 9: [3]} + expected_connectivity = {0: [1, 4], 1: [0, 2, 3, 5], 2: [1, 3, 6, 7], 3: [2, 1, 8, 9], + 4: [0], 5: [1], 6: [2], 7: [2], 8: [3], 9: [3]} self.assertEqual(connectivity, expected_connectivity) def test_get_connectivity(self): @@ -311,12 +311,12 @@ def test_get_connectivity(self): 1: [0], 2: [3], 4: [0], 6: [5], 7: [5]}) connectivity = zmat.get_connectivity( - mol=ARCSpecies(label='phenanthrene', smiles='c1=ccc2c3cc=ccc3ccc2c1', xyz=self.phenanthrene).mol) + mol=ARCSpecies(label='phenanthrene', smiles='C1=CCC2=C3CC=CCC3=CC=C2C1', xyz=self.phenanthrene).mol) self.assertEqual(connectivity[2], [1, 3, 16, 17]) self.assertEqual(len(list(connectivity.keys())), 28) connectivity = zmat.get_connectivity( - mol=ARCSpecies(label='crazy', smiles='CSC(CCO)(Cc1ccc(NO)cc1)C(O[CH2])(COO)C', xyz=self.crazy).mol) + mol=ARCSpecies(label='crazy', smiles='OCCC(C(COO)(O[CH2])C)(Cc1ccc(cc1)NO)SC', xyz=self.crazy).mol) self.assertEqual(len(list(connectivity.keys())), 46) connectivity = zmat.get_connectivity(mol=ARCSpecies(label='N', smiles='[N]').mol) @@ -342,7 +342,7 @@ def test_get_atom_order_from_mol(self): self.assertEqual(symbols, ['N', 'N', 'N', 'H', 'H', 'H', 'H', 'H']) atom_order = zmat.get_atom_order_from_mol( - ARCSpecies(label='phenanthrene', smiles='c1=ccc2c3cc=ccc3ccc2c1', xyz=self.phenanthrene).mol) + ARCSpecies(label='phenanthrene', smiles='C1=CCC2=C3CC=CCC3=CC=C2C1', xyz=self.phenanthrene).mol) self.assertEqual(atom_order, [0, 1, 13, 2, 12, 3, 11, 4, 10, 5, 9, 6, 8, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]) symbols = [self.phenanthrene['symbols'][atom_index] for atom_index in atom_order] @@ -350,7 +350,7 @@ def test_get_atom_order_from_mol(self): 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H']) atom_order = zmat.get_atom_order_from_mol( - ARCSpecies(label='crazy', smiles='CSC(CCO)(Cc1ccc(NO)cc1)C(O[CH2])(COO)C', xyz=self.crazy).mol) + ARCSpecies(label='crazy', smiles='OCCC(C(COO)(O[CH2])C)(Cc1ccc(cc1)NO)SC', xyz=self.crazy).mol) self.assertEqual(atom_order, [0, 1, 2, 3, 6, 15, 4, 7, 23, 20, 16, 5, 8, 14, 21, 17, 9, 13, 22, 10, 11, 12, 18, 19, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45]) @@ -360,7 +360,7 @@ def test_get_atom_order_from_mol(self): 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H']) atom_order = zmat.get_atom_order_from_mol( - ARCSpecies(label='crazy', smiles='CSC(CCO)(Cc1ccc(NO)cc1)C(O[CH2])(COO)C', xyz=self.crazy).mol, + ARCSpecies(label='crazy', smiles='OCCC(C(COO)(O[CH2])C)(Cc1ccc(cc1)NO)SC', xyz=self.crazy).mol, constraints_dict={}) self.assertEqual(atom_order, [0, 1, 2, 3, 6, 15, 4, 7, 23, 20, 16, 5, 8, 14, 21, 17, 9, 13, 22, 10, 11, 12, 18, 19, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, diff --git a/environment.yml b/environment.yml index 3c0cc4c71f..feb25aae5d 100644 --- a/environment.yml +++ b/environment.yml @@ -2,16 +2,13 @@ name: arc_env channels: - defaults - rmg - - anaconda - - omnia - conda-forge dependencies: - cairo - cairocffi - rmg::cantera >=2.3.0 - - cclib >=1.6 + - conda-forge::cclib >=1.6.3 - rmg::chemprop - - codecov - coolprop - coverage - cython >=0.25.2 @@ -23,16 +20,16 @@ dependencies: - jupyter - rmg::lpsolve55 - markupsafe - - matplotlib >=2.2.2 - - mock + - matplotlib >=1.5 - rmg::mopac - mpmath + - rmg::muq2 - networkx - nose - rmg::numdifftools - - numpy >=1.15.4 - - openbabel - - pandas >=1.0.1 + - numpy >=1.10.0 + - conda-forge::openbabel >= 3 + - pandas - psutil - rmg::pydas >=1.0.2 - pydot @@ -46,12 +43,13 @@ dependencies: - rmg::rdkit >=2020.03.3.0 - scikit-learn - scipy - - sphinx_rtd_theme - rmg::symmetry + - xlrd - xlwt - - paramiko >=2.6.0 - - py3dmol >= 0.8.0 - - ase >=3.15.0 - - ipython - - sphinx - - qcelemental + - anaconda::sphinx_rtd_theme + - anaconda::paramiko >=2.6.0 + - conda-forge::py3dmol >= 0.8.0 + - conda-forge::ase >=3.15.0 + - anaconda::ipython + - anaconda::sphinx + - conda-forge::qcelemental