Repository: duartegroup/autodE
Pull request #334 (2024-04-14 19:16:19)

fix no solvent
## Resolves  #333 

Thanks for catching this @shoubhikraj – very not ideal

***

## Checklist

* [x] The changes include an associated explanation of how/why
* [x] Test pass
* [x] Documentation has been updated
* [x] Changelog has been updated


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/duartegroup/autodE/pull/334?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 88.73%. Comparing base [(`c9c2c2b`)](https://app.codecov.io/gh/duartegroup/autodE/commit/c9c2c2b552cf68301c38c723873a8425b58c12c2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup) to head [(`4cc3951`)](https://app.codecov.io/gh/duartegroup/autodE/pull/334?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup).


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           v1.4.3     #334      +/-   ##
==========================================
- Coverage   97.42%   88.73%   -8.69%     
==========================================
  Files         209      209              
  Lines       23761    23769       +8     
==========================================
- Hits        23148    21092    -2056     
- Misses        613     2677    +2064     
```

| [Flag](https://app.codecov.io/gh/duartegroup/autodE/pull/334/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup) | Coverage Δ | |
|---|---|---|
| [unittests](https://app.codecov.io/gh/duartegroup/autodE/pull/334/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup) | `88.73% <100.00%> (-8.69%)` | :arrow_down: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup#carryforward-flags-in-the-pull-request-comment) to find out more.


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/duartegroup/autodE/pull/334?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup).

shoubhikraj: All seems good 👍 

Patch:
diff --git a/autode/transition_states/base.py b/autode/transition_states/base.py
index 31f2e47..7dfbcd5 100644
--- a/autode/transition_states/base.py
+++ b/autode/transition_states/base.py
@@ -463,13 +463,7 @@ def displaced_species_along_mode(
 
         disp_coords -= (disp_factor / 20) * mode_disp_coords
 
-    # Create a new species from the initial
-    disp_species = Species(
-        name=f"{species.name}_disp",
-        atoms=species.atoms.copy(),
-        charge=species.charge,
-        mult=species.mult,
-    )
+    disp_species = species.new_species(name=f"{species.name}_disp")
     disp_species.coordinates = disp_coords
 
     return disp_species
diff --git a/doc/changelog.rst b/doc/changelog.rst
index db0270a..1cbf706 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -11,7 +11,7 @@ Functionality improvements
 
 Bug Fixes
 *********
-- ...
+- Fixes no solvent being added in QRC calculations
 
 Usability improvements/Changes
 ******************************


Test patch:
diff --git a/.github/workflows/pytest_cov.yml b/.github/workflows/pytest_cov.yml
index b37ee92..81e43c6 100644
--- a/.github/workflows/pytest_cov.yml
+++ b/.github/workflows/pytest_cov.yml
@@ -56,7 +56,8 @@ jobs:
       run: |
         pytest --cov=./ --cov-report=xml
 
-    - uses: codecov/codecov-action@v3
+    - uses: codecov/codecov-action@v4
       with:
         flags: unittests
         fail_ci_if_error: true
+        token: ${{ secrets.CODECOV_TOKEN }} # required
diff --git a/tests/test_ts/test_mode_checking.py b/tests/test_ts/test_mode_checking.py
index 6c0acf6..d4ab230 100644
--- a/tests/test_ts/test_mode_checking.py
+++ b/tests/test_ts/test_mode_checking.py
@@ -1,3 +1,7 @@
+import os
+import numpy as np
+
+from autode.species.molecule import Molecule
 from autode.calculations import Calculation
 from autode.transition_states.base import TSbase
 from autode.transition_states.base import imag_mode_generates_other_bonds
@@ -8,7 +12,6 @@ from autode.atoms import Atom
 from autode.bond_rearrangement import BondRearrangement
 from autode.methods import ORCA
 from .. import testutils
-import os
 
 here = os.path.dirname(os.path.abspath(__file__))
 orca = ORCA()
@@ -70,6 +73,18 @@ def test_graph_no_other_bonds():
     )
 
 
+def test_disp_molecule_has_same_solvent():
+    mol = Molecule(smiles="[H][H]", solvent_name="water")
+    mol.hessian = np.eye(3 * mol.n_atoms, 3 * mol.n_atoms)
+
+    disp_mol = displaced_species_along_mode(
+        species=mol,
+        mode_number=1,
+    )
+    assert disp_mol.solvent is not None
+    assert disp_mol.solvent == mol.solvent
+
+
 def has_correct_mode(name, fbonds, bbonds):
     calc = Calculation(
         name=name,