1212from arc .family .family import (ReactionFamily ,
1313 ARC_FAMILIES_PATH ,
1414 RMG_DB_PATH ,
15+ get_rmg_db_subpath ,
1516 add_labels_to_molecule ,
1617 check_product_isomorphism ,
1718 descent_complex_group ,
@@ -50,8 +51,10 @@ def setUpClass(cls):
5051
5152 def test_rmgdb_path (self ):
5253 """Test finding the RMG-database path"""
53- self .assertIn ('RMG-database' , RMG_DB_PATH )
5454 self .assertTrue (os .path .isdir (RMG_DB_PATH ))
55+ self .assertTrue (any (token in RMG_DB_PATH for token in ('RMG-database' , 'rmgdatabase' , 'rmg_database' )))
56+ self .assertTrue (os .path .isdir (os .path .join (RMG_DB_PATH , 'input' ))
57+ or os .path .isdir (os .path .join (RMG_DB_PATH , 'kinetics' )))
5558
5659 def test_arc_families_path (self ):
5760 """Test finding the ARC families folder path"""
@@ -920,14 +923,14 @@ def test_get_product_num(self):
920923 def test_get_reactant_groups_from_template (self ):
921924 """Test getting reactant groups from a template"""
922925 fam_1 = ReactionFamily ('6_membered_central_C-C_shift' )
923- groups_path = os . path . join ( RMG_DB_PATH , 'input' , ' kinetics' , 'families' , fam_1 .label , 'groups.py' )
926+ groups_path = get_rmg_db_subpath ( ' kinetics' , 'families' , fam_1 .label , 'groups.py' , must_exist = True )
924927 with open (groups_path , 'r' ) as f :
925928 groups = f .readlines ()
926929 reactants_1 = get_reactant_groups_from_template (groups )
927930 self .assertEqual (reactants_1 , [['1_5_unsaturated_hexane' ]])
928931
929932 fam_2 = ReactionFamily ('H_Abstraction' )
930- groups_path = os . path . join ( RMG_DB_PATH , 'input' , ' kinetics' , 'families' , fam_2 .label , 'groups.py' )
933+ groups_path = get_rmg_db_subpath ( ' kinetics' , 'families' , fam_2 .label , 'groups.py' , must_exist = True )
931934 with open (groups_path , 'r' ) as f :
932935 groups = f .readlines ()
933936 reactants_2 = get_reactant_groups_from_template (groups )
@@ -936,7 +939,7 @@ def test_get_reactant_groups_from_template(self):
936939 self .assertEqual (reactants_2 , expected_reactants )
937940
938941 fam_3 = ReactionFamily ('1,2-Birad_to_alkene' )
939- groups_path = os . path . join ( RMG_DB_PATH , 'input' , ' kinetics' , 'families' , fam_3 .label , 'groups.py' )
942+ groups_path = get_rmg_db_subpath ( ' kinetics' , 'families' , fam_3 .label , 'groups.py' , must_exist = True )
940943 with open (groups_path , 'r' ) as f :
941944 groups = f .readlines ()
942945 reactants_3 = get_reactant_groups_from_template (groups )
@@ -988,7 +991,7 @@ def test_get_recipe_actions(self):
988991 ['LOSE_RADICAL' , '*3' , '1' ]])
989992
990993 fam_1 = ReactionFamily ('6_membered_central_C-C_shift' )
991- groups_path = os . path . join ( RMG_DB_PATH , 'input' , ' kinetics' , 'families' , fam_1 .label , 'groups.py' )
994+ groups_path = get_rmg_db_subpath ( ' kinetics' , 'families' , fam_1 .label , 'groups.py' , must_exist = True )
992995 with open (groups_path , 'r' ) as f :
993996 groups = f .readlines ()
994997 actions = get_recipe_actions (groups )
0 commit comments