Skip to content

Commit

Permalink
Merge pull request #141 from ReactionMechanismGenerator/xyz_to_smiles
Browse files Browse the repository at this point in the history
xyz to smiles
  • Loading branch information
alongd committed Jun 30, 2019
2 parents ce32cac + 224e31f commit 4a749fb
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 9 deletions.
6 changes: 3 additions & 3 deletions arc/mainTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ def test_restart(self):
self.assertEqual(arc1.freq_scale_factor, 0.986)

with open(os.path.join(project_directory, 'output', 'thermo.info'), 'r') as f:
thermo_sft_ccsdtf12_bac = False
thermo_dft_ccsdtf12_bac = False
for line in f.readlines():
if 'thermo_DFT_CCSDTF12_BAC' in line:
thermo_sft_ccsdtf12_bac = True
thermo_dft_ccsdtf12_bac = True
break
self.assertTrue(thermo_sft_ccsdtf12_bac)
self.assertTrue(thermo_dft_ccsdtf12_bac)

with open(os.path.join(project_directory, 'arc_project_for_testing_delete_after_usage2.info'), 'r') as f:
sts, n2h3, oet, lot, ap = False, False, False, False, False
Expand Down
10 changes: 6 additions & 4 deletions arc/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ def __init__(self, project, project_directory, species_dict, rxn_list, output, u
if any([species.generate_thermo for species in self.species_dict.values()])\
and any(['ALL converged' in out['status'] for out in output.values()]):
load_thermo_libs = True
rmgdb.load_rmg_database(rmgdb=self.rmgdb, load_thermo_libs=load_thermo_libs,
load_kinetic_libs=load_kinetic_libs)
if any(['ALL converged' in spc_output_dict['status'] for spc_output_dict in output.values()]):
rmgdb.load_rmg_database(rmgdb=self.rmgdb, load_thermo_libs=load_thermo_libs,
load_kinetic_libs=load_kinetic_libs)
t_min = t_min if t_min is not None else (300, 'K')
t_max = t_max if t_max is not None else (3000, 'K')
if isinstance(t_min, (int, float)):
Expand Down Expand Up @@ -221,9 +222,10 @@ def process(self):
thermo_job.execute(outputFile=output_file_path[1], plot=False)
try:
species.rmg_thermo = self.rmgdb.thermo.getThermoData(species.rmg_species)
except ValueError:
except (ValueError, AttributeError) as e:
logger.info('Could not retrieve RMG thermo for species {0}, possibly due to missing 2D structure '
'(bond orders). Not including this species in the parity plots.'.format(species.label))
'(bond orders). Not including this species in the parity plots.'
'\nGot: {1}'.format(species.label, e.message))
else:
if species.generate_thermo:
species_list_for_thermo_parity.append(species)
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ channels:
- rmg
- omnia
- conda-forge
- anaconda
dependencies:
- libgcc # [unix]
- python
Expand Down Expand Up @@ -44,6 +45,7 @@ dependencies:
- pymongo
- mpmath
- dde
- pydot-ng
- pyyaml
- paramiko >=2.4.2
- cclib >=1.6
Expand Down
41 changes: 41 additions & 0 deletions ipython/Tools/xyz_to_smiles.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"pycharm": {}
},
"source": "# ARC Tools\n### Convert xyz coordinates to SMILES"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {}
},
"outputs": [],
"source": "from arc.species.converter import molecules_from_xyz\nfrom IPython.display import display\n\nxyz \u003d \"\"\"C\t0.7016210\t-0.8239730\t0.0000000\nO\t0.2212140\t-1.9437480\t0.0000000\nN\t0.0000000\t0.3448120\t0.0000000\nC\t-1.4542820\t0.3350170\t0.0000000\nC\t0.6543520\t1.6364050\t0.0000000\nH\t1.7968090\t-0.6524620\t0.0000000\nH\t-1.7802780\t-0.7056490\t0.0000000\nH\t-1.8463230\t0.8389980\t0.8932890\nH\t-1.8463230\t0.8389980\t-0.8932890\nH\t1.7395870\t1.4960250\t0.0000000\nH\t0.3783390\t2.2178500\t-0.8910160\nH\t0.3783390\t2.2178500\t0.8910160\"\"\"\n\ns_mol, b_mol \u003d molecules_from_xyz(xyz)\n\nprint \u0027SMILES: \u0027, b_mol.toSMILES()\n\ndisplay(b_mol)\n"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.16"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

paramiko==2.4.2
matplotlib==2.2.2
numpy==1.11.3
numpy==1.15.4
cclib==1.6
py3Dmol==0.8.0
ase==3.15.0
rdkit
rdkit==2018.09.3
openbabel
pybel
IPython
Expand Down

0 comments on commit 4a749fb

Please sign in to comment.