Skip to content

Commit

Permalink
Make sure that determining rotors twice doesn't cause an issue. (#668)
Browse files Browse the repository at this point in the history
Solves the issue that determining rotors twice may cause.
For example:
```python 
n3_xyz = """N      -1.1997440839    -0.1610052059     0.0274738287
        H      -1.4016624407    -0.6229695533    -0.8487034080
        H      -0.0000018759     1.2861082773     0.5926077870
        N       0.0000008520     0.5651072858    -0.1124621525
        H      -1.1294692206    -0.8709078271     0.7537518889
        N       1.1997613019    -0.1609980472     0.0274604887
        H       1.1294795781    -0.8708998550     0.7537444446
        H       1.4015274689    -0.6230592706    -0.8487058662"""
spc = ARCSpecies(label='N3',
                               xyz=n3_xyz, multiplicity=1,
                               smiles='NNN',
                               directed_rotors = {"brute_force_opt":[["all"]]}) # taken from species_test.py
spc.determine_rotors()
print(spc.rotors_dict)
spc.determine_rotors()
```
outputs:
```python
{0: {'pivots': [[1, 4], [4, 6]],
  'top': [[1, 2, 5], [6, 7, 8]],
  'scan': [[2, 1, 4, 6], [1, 4, 6, 7]],
  'torsion': [[1, 0, 3, 5], [0, 3, 5, 6]],
  'number_of_running_jobs': 0,
  'success': None,
  'invalidation_reason': '',
  'times_dihedral_set': 0,
  'trsh_counter': 0,
  'trsh_methods': [],
  'scan_path': '',
  'directed_scan_type': 'brute_force_opt',
  'directed_scan': {},
  'dimensions': 2,
  'original_dihedrals': [],
  'cont_indices': []}}

SpeciesError: The pivots [1, 2] do not represent a rotor in species N3. Valid rotor pivots are: [[[1, 4], [4, 6]], [1, 4], [4, 6]]
```
  • Loading branch information
alongd committed Jun 5, 2023
2 parents 04dabba + cc8b3c7 commit df3c323
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arc/species/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,8 @@ def determine_rotors(self, verbose: bool = False) -> None:
The resulting rotors are saved in a ``{'pivots': [1, 3], 'top': [3, 7], 'scan': [2, 1, 3, 7]}`` format
in ``self.rotors_dict``. Also updates ``self.number_of_rotors``.
"""
if self.rotors_dict is None:
# This species was marked to skip rotor scans.
if self.rotors_dict != {}:
# This species was marked to skip rotor scans (when ``rotors_dict`` is ``None``), or a rotors dictionary already exist.
return
mol_list = self.mol_list or [self.mol]
if mol_list is None or not len(mol_list) or all([mol is None for mol in mol_list]):
Expand Down

0 comments on commit df3c323

Please sign in to comment.