Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Species err #78

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- cairo
- cairocffi
- rmg::cantera >=2.3.0
- cclib >=1.6
- conda-forge::cclib >=1.6.3
- rmg::chemprop
- codecov
- coolprop
Expand All @@ -33,11 +33,12 @@ dependencies:
- mock
- rmg::mopac
- mpmath
- rmg::muq2
- networkx
- nose
- rmg::numdifftools
- numpy >=1.15.4
- openbabel
- conda-forge::openbabel >= 3
- paramiko >=2.6.0
- pandas
- psutil
Expand All @@ -59,4 +60,12 @@ dependencies:
- scipy
- sphinx
- rmg::symmetry
- xlrd
- xlwt
- 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 == 0.20.0
19 changes: 16 additions & 3 deletions t3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@
from arc.species import ARCSpecies
from arc.species.converter import check_xyz_dict

from t3.common import PROJECTS_BASE_PATH, VALID_CHARS, delete_root_rmg_log, get_species_by_label, time_lapse
from t3.common import (PROJECTS_BASE_PATH,
VALID_CHARS,
delete_root_rmg_log,
get_rmg_species_from_a_species_dict,
get_species_by_label,
time_lapse,
)
from t3.logger import Logger
from t3.schema import InputBase
from t3.simulate.factory import simulate_factory
Expand Down Expand Up @@ -304,6 +310,7 @@ def execute(self):
# obtain the dictionary containing all SA coefficients for these species
self.sa_dict = simulate_adapter.get_sa_coefficients()


# determine what needs to be calculated
additional_calcs_required = self.determine_species_to_calculate()

Expand Down Expand Up @@ -683,8 +690,12 @@ def determine_species_to_calculate(self) -> bool:
for input_species in self.rmg['species']:
if input_species['observable'] or input_species['SA_observable']:
sa_observables_exist = True
if self.species_requires_refinement(species=get_species_by_label(input_species['label'],
self.rmg_species)):
species = get_species_by_label(input_species['label'], self.rmg_species) or \
get_rmg_species_from_a_species_dict(input_species)
if species is None:
raise ValueError(f'Cannot find species\n{input_species} in the species list,'
f'and cannot create a species without a proper structure.')
if self.species_requires_refinement(species=species):
species_keys.append(self.add_species(
species=get_species_by_label(input_species['label'], self.rmg_species),
reasons=['SA observable'],
Expand Down Expand Up @@ -978,6 +989,8 @@ def species_requires_refinement(self, species: Species) -> bool:
Returns:
bool: Whether the species thermochemical properties should be calculated. ``True`` if they should be.
"""
if species is None:
raise ValueError('Cannot process value None for argument species.')
thermo_comment = species.thermo.comment.split('Solvation')[0]
if self.get_species_key(species=species) is None \
and ('group additivity' in thermo_comment or '+ radical(' in thermo_comment):
Expand Down
2 changes: 1 addition & 1 deletion t3/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def check_model(cls, value):
@validator('pdep')
def check_pdep_only_if_gas_phase(cls, value, values):
"""RMG.pdep validator"""
if value is not None and values['reactors'] is not None:
if value is not None and 'reactors' in values and values['reactors'] is not None:
reactor_types = set([reactor.type for reactor in values['reactors']])
if value is not None and not any(['gas' in reactor for reactor in reactor_types]):
raise ValueError(f'A pdep section can only be specified for gas phase reactors, got: {reactor_types}')
Expand Down
3 changes: 3 additions & 0 deletions t3/simulate/cantera_constantTP.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ def reinitialize_simulation(self,
"""
# assign initial conditions
if V0 is None:
T0 = T0[0] if isinstance(T0, np.ndarray) else T0
P0 = T0[0] if isinstance(T0, np.ndarray) else P0
self.model.TPX = T0, P0, X0
elif P0 is None:
self.model.TDX = T0, 1 / V0, X0
Expand Down Expand Up @@ -394,6 +396,7 @@ def get_sa_coefficients(self):
Returns:
sa_dict (dict): a SA dictionary, whose structure is given in the docstring for T3/t3/main.py
"""

sa_dict = {'kinetics': dict(), 'thermo': dict(), 'time': list()}

for condition_data in self.all_data:
Expand Down