Skip to content

Commit

Permalink
Merge pull request #507 from ReactionMechanismGenerator/CI_with_mamba
Browse files Browse the repository at this point in the history
CI with mamba
  • Loading branch information
alongd authored May 18, 2022
2 parents 3b018ca + 43e65b4 commit 3e06531
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 54 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/cont_int.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: continuous integration
name: CI

on:
push:
branches:
- '*'
pull_request:
branches:
- main
types: [opened, synchronize, reopened, ready_for_review, review_requested]
schedule:
- cron: '0 0 * * *'


jobs:
build:
Expand All @@ -17,16 +22,21 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up miniconda Python 3.7
- name: Setup Mambaforge Python 3.7
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: environment.yml
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: arc_env
python-version: 3.7
auto-activate-base: false
use-mamba: true

- name: Update environment
run: mamba env update -n arc_env -f environment.yml

- name: Install codecov
run: conda install -y -c conda-forge codecov
run: mamba install -y -c conda-forge codecov

- name: Install dependencies
run: |
Expand All @@ -49,13 +59,14 @@ jobs:
- name: Lint with flake8
run: |
conda install flake8
mamba install flake8
mamba config --append channels anaconda
# stop the build if there are Python syntax errors or undefined names
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with nosetests
- name: Test with python unittest
run: |
cd ..
cd RMG-Py
Expand Down
2 changes: 1 addition & 1 deletion arc/species/conformersTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@ def test_translate_group(self):
expected_xyz1 = {'symbols': ('O', 'O', 'C'), 'isotopes': (16, 16, 12),
'coords': ((8.749511531958021e-17, 3.469446951953614e-18, 1.405000000524252),
(-1.40486421, -0.01953339, 0.0), (0.0, 0.0, 0.0))}
self.assertEqual(new_xyz1, expected_xyz1)
self.assertTrue(almost_equal_coords_lists(new_xyz1, expected_xyz1))

xyz2 = converter.str_to_xyz("""Cl 1.47512188 -0.78746253 -0.20393322
S -1.45707856 -0.94104506 -0.20275830
Expand Down
43 changes: 0 additions & 43 deletions arc/species/speciesTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1733,49 +1733,6 @@ def test_xyz_perception(self):
mol_graph_1 = MolGraph(symbols=xyz_arb['symbols'], coords=xyz_arb['coords'])
self.assertEqual(mol_graph_1.get_formula(), 'CH3NO2')

def test_gcn(self):
"""
Test that ARC can call the GNN to make TS guesses for further optimization.
"""
# create temporary project directory to delete afterwards
project_dir = os.path.join(ARC_PATH, 'arc', 'testing', 'gcn_tst')

r_xyz = """C -1.3087 0.0068 0.0318
C 0.1715 -0.0344 0.0210
N 0.9054 -0.9001 0.6395
O 2.1683 -0.5483 0.3437
N 2.1499 0.5449 -0.4631
N 0.9613 0.8655 -0.6660
H -1.6558 0.9505 0.4530
H -1.6934 -0.0680 -0.9854
H -1.6986 -0.8169 0.6255"""
reactant = ARCSpecies(label='reactant', smiles='C([C]1=[N]O[N]=[N]1)', xyz=r_xyz)

p_xyz = """C -1.0108 -0.0114 -0.0610
C 0.4780 0.0191 0.0139
N 1.2974 -0.9930 0.4693
O 0.6928 -1.9845 0.8337
N 1.7456 1.9701 -0.6976
N 1.1642 1.0763 -0.3716
H -1.4020 0.9134 -0.4821
H -1.3327 -0.8499 -0.6803
H -1.4329 -0.1554 0.9349"""
product = ARCSpecies(label='product', smiles='[N-]=[N+]=C(N=O)C', xyz=p_xyz)

rxn = ARCReaction(label='reactant <=> product', ts_methods=['gcn'], ts_label='TS0')
rxn.r_species = [reactant]
rxn.p_species = [product]
ts_guess = TSGuess(arc_reaction=rxn, method='gcn', project_dir=project_dir)
ts_guess.execute_ts_guess_method()

# verify that the method correctly create TS.xyz
ts_path = os.path.join(project_dir, 'calcs', 'TSs', rxn.ts_label, 'GCN', 'TS.xyz')
ts_xyz_dict = str_to_xyz(ts_path)
self.assertEqual(ts_xyz_dict['symbols'], ('C', 'C', 'N', 'O', 'N', 'N', 'H', 'H', 'H'))

if os.path.exists(project_dir):
shutil.rmtree(project_dir, ignore_errors=True)


if __name__ == '__main__':
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))
11 changes: 7 additions & 4 deletions arc/species/zmatTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,9 @@ def test_zmat_to_coords(self):
(-3.871932295381926, -0.9306597576029849, -2.5400987960833166),
(-3.440082669618663, 0.6565731451487455, -1.8462094217817948)]
expected_ordered_symbols = ['C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'C', 'C', 'O', 'O', 'H', 'H', 'H', 'H', 'H']
self.assertEqual(ordered_coords, expected_ordered_coords)
for coords1, coords2 in zip(expected_ordered_coords, ordered_coords):
for coord1, coord2 in zip(coords1, coords2):
self.assertAlmostEqual(coord1, coord2)
self.assertEqual(ordered_symbols, expected_ordered_symbols)

ordered_symbols = zmat.zmat_to_coords(zmat=zmat1, keep_dummy=True)[1]
Expand Down Expand Up @@ -1662,14 +1664,15 @@ def test_remove_1st_atom(self):

coords, symbols = zmat.zmat_to_coords(expected_zmat_3)
self.assertEqual(symbols, ['C', 'C', 'H', 'H', 'H', 'H', 'H'])
self.assertEqual(coords, [(0.0, 0.0, 0.0),
for coords1, coords2 in zip(coords, [(0.0, 0.0, 0.0),
(0.0, 0.0, 1.5120487296562577),
(0.0, 1.0243258057118119, -0.3843844758142396),
(-0.8871049813083173, -0.5121760994984771, -0.38436337480993366),
(-2.635365836667347e-08, -1.0243258057118116, 1.8964332054704973),
(-0.8870987970032913, 0.512186345981728, 1.8964193919074686),
(0.8871050112557137, 0.5121760476286488, 1.8964121044661915)])

(0.8871050112557137, 0.5121760476286488, 1.8964121044661915)]):
for coord1, coord2 in zip(coords1, coords2):
self.assertAlmostEqual(coord1, coord2)

if __name__ == '__main__':
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))

0 comments on commit 3e06531

Please sign in to comment.