ReactionMechanismGenerator / ARC

ARC - Automatic Rate Calculator
https://reactionmechanismgenerator.github.io/ARC/index.html
MIT License
42 stars 21 forks source link

Fail to copy reaction #703

Closed kfir4444 closed 9 months ago

kfir4444 commented 9 months ago

Describe the bug While copying a reaction object, an error was encountered, and an AttributeError raised, which caused a failed PR

How to reproduce

from arc.species import ARCSpecies
from arc.reaction import ARCReaction
from arc.rmgdb import load_families_only, determine_family

db = RMGDatabase()
load_families_only(db, "all")

smiles = ['CC(C)F', '[CH3]', 'C[CH](C)', 'CF']

r_1_1_xyz = {'symbols': ('C', 'C', 'C', 'F', 'H', 'H', 'H', 'H', 'H', 'H', 'H'),
             'isotopes': (12, 12, 12, 19, 1, 1, 1, 1, 1, 1, 1),
             'coords': ((1.2509680857915237, 0.00832885083067477, -0.28594855682006387),
                        (-0.08450322338173592, -0.5786110309038947, 0.12835305965368538),
                        (-1.196883483105121, 0.4516770584363101, 0.10106807955582568),
                        (0.03212452836861426, -1.0465351442062332, 1.402047416169314),
                        (1.2170230403876368, 0.39373449465586885, -1.309310880313081),
                        (1.5446944155971303, 0.8206316657310906, 0.38700047363833845),
                        (2.0327466889922805, -0.7555292157466509, -0.22527487012253536),
                        (-0.3397419937928473, -1.4280299782557704, -0.5129583662636836),
                        (-0.9791793765226446, 1.2777482351478369, 0.786037216866474),
                        (-1.340583396165929, 0.8569620299504027, -0.9049411765144166),
                        (-2.1366652861689137, -0.00037696563964776297, 0.43392760415012316))}

r_2_1_xyz = {'symbols': ('C', 'H', 'H', 'H'),
             'isotopes': (12, 1, 1, 1),
             'coords' : ((3.3746019998564553e-09, 5.828827384106545e-09, -4.859105107686622e-09),
                         (1.0669051052331406, -0.17519582095514982, 0.05416492980439295),
                         (-0.6853171627400634, -0.8375353626879753, -0.028085652887100996),
                         (-0.3815879458676787, 1.0127311778142964, -0.026079272058187608))}

p_1_1_xyz = {'symbols': ('C', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H'),
             'isotopes': (12, 12, 12, 1, 1, 1, 1, 1, 1, 1),
             'coords':  ((-1.288730238258946, 0.06292843803165035, 0.10889818910854648),
                         (0.01096160773224897, -0.45756396262445836, -0.3934214957819532),
                         (1.2841030977199492, 0.11324607936811129, 0.12206176848573647),
                         (-1.4984446521053447, 1.0458196461796345, -0.3223873567509909),
                         (-1.2824724918369017, 0.14649429503996203, 1.1995362776757934),
                         (-2.098384694966955, -0.616646552269074, -0.17318515188247927),
                         (0.027360233461550892, -1.0601383387124987, -1.2952225290380646),
                         (2.122551165381095, -0.534098313164123, -0.15158596254231563),
                         (1.2634262459696732, 0.19628891975881263, 1.2125616721427255), 
                         (1.4596297269035956, 1.1036697883919826, -0.307255411416999))}

p_2_1_xyz = {'symbols': ('C', 'F', 'H', 'H', 'H'),
             'isotopes': (12, 19, 1, 1, 1),
             'coords':  ((-0.060384822736851786, 0.004838867136375763, -0.004814368798794687),
                         (1.2877092002693546, -0.10318918150563985, 0.10266661058725791),
                         (-0.2965861926821434, 0.9189121874074381, -0.5532990701789506),
                         (-0.44047773762823295, -0.8660709320146035, -0.5425894744224189),
                         (-0.49026044722212864, 0.04550905897643097, 0.9980363028129072))}
r_1 = ARCSpecies(label='r1', smiles=smiles[0], xyz=r_1_1_xyz )
r_2 = ARCSpecies(label='r2', smiles=smiles[1], xyz=r_2_1_xyz)
p_1 = ARCSpecies(label='p1', smiles=smiles[2], xyz=p_1_1_xyz)
p_2 = ARCSpecies(label='p2', smiles=smiles[3], xyz=p_2_1_xyz)

rxn_1 = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2])
rxn_1.determine_family(db)

rxn_1.copy()

The problem is related to the save_order property of the reaction family, in the from_dict() function, and is related to other issued involving to database loading (#702 )

Expected behavior To copy the reaction correctly.