Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
341 commits
Select commit Hold shift + click to select a range
faf3d86
enumerate failure?...
jacob-milton Mar 24, 2023
c07cec7
interating over wrong list
jacob-milton Mar 24, 2023
036032e
lots o' changes to steric hinderance function
jacob-milton Mar 24, 2023
afcba57
Filtered nothing, uncommenting hash and printing stuff
jacob-milton Mar 24, 2023
23ef87f
was accessing wrong data
jacob-milton Mar 24, 2023
5188a79
more testing
jacob-milton Mar 24, 2023
195d06a
was iterating over a list
jacob-milton Mar 24, 2023
aef4ac9
indentation
jacob-milton Mar 24, 2023
98283bb
bracket added
jacob-milton Mar 24, 2023
d57d2fc
testing for loop
jacob-milton Mar 24, 2023
6756efc
fixed for loop, bring on the next bug
jacob-milton Mar 24, 2023
dd28c4b
more testing!
jacob-milton Mar 24, 2023
c773e2b
trying new test for number of neighbors
jacob-milton Mar 24, 2023
4db8103
more printing!
jacob-milton Mar 24, 2023
ffa91ee
fixed for loop
jacob-milton Mar 24, 2023
225b216
fix hot product test
jacob-milton Mar 24, 2023
e3fd0ca
removed a space...
jacob-milton Mar 24, 2023
b8e0d7f
forgot a variable!
jacob-milton Mar 24, 2023
a644d0a
forgot to assign a variable
jacob-milton Mar 24, 2023
979569c
reactants_are_both_anions_or_both_cations
samblau Mar 24, 2023
e08bdb2
testing logging reactions filtered
jacob-milton Mar 24, 2023
21ed350
Add files via upload
jacob-milton Mar 24, 2023
140f602
new test set
samblau Mar 24, 2023
aeefcb4
New filter
samblau Mar 24, 2023
fd602b7
tweak charge separation filter and uncomment other
samblau Mar 25, 2023
c4d54a2
uncomment two reactant charge separation filter
samblau Mar 25, 2023
6a1dd16
if to elif
samblau Mar 25, 2023
7206cb3
fix bug?
samblau Mar 25, 2023
9d92dfa
fix compositions_preclude_h_transfer
samblau Mar 25, 2023
f7fc01b
fix bug
samblau Mar 25, 2023
dfd1444
multiple h abstraction filters
samblau Mar 25, 2023
50819f8
fix bug
samblau Mar 25, 2023
7f636b3
do charge differences correctly
samblau Mar 25, 2023
885445f
Update test numbers
samblau Mar 25, 2023
246a969
tests work again (but not on github)
samblau Mar 25, 2023
b717eb4
factor_two 0.5 and constant barrier 0.03 nonredox
samblau Mar 26, 2023
ce0de79
0.05 constant barrier for nonredox
samblau Mar 26, 2023
ecb3904
Fixing sins Sam made me commit
jacob-milton Mar 27, 2023
d033e73
Merge branch 'jake_dev' of https://github.com/jacob-milton/HiPRGen in…
jacob-milton Mar 27, 2023
bfb8109
Fix temperature and add barrier_factor
samblau Mar 28, 2023
aba5ae4
correcting # of reactions and species in test set
jacob-milton Mar 28, 2023
81194cc
building steric filters for only sp3 carbon
jacob-milton Mar 29, 2023
2da1b84
Merge branch 'jake_dev' of https://github.com/jacob-milton/HiPRGen in…
jacob-milton Mar 29, 2023
2f6e816
testing how to find species identity
jacob-milton Mar 29, 2023
063537a
testing mol_graph.to_dict()
jacob-milton Mar 29, 2023
76f5c6b
typo
jacob-milton Mar 29, 2023
4103c69
typo
jacob-milton Mar 29, 2023
ca5a707
testing molecule.as_dict()
jacob-milton Mar 29, 2023
ac4cd0a
more testing
jacob-milton Mar 29, 2023
61b47fc
more testing
jacob-milton Mar 29, 2023
38da49e
Wow more testing
jacob-milton Mar 29, 2023
ee55db4
you got it tests
jacob-milton Mar 29, 2023
b5d4b54
typo
jacob-milton Mar 29, 2023
a3a8a47
Another typo!
jacob-milton Mar 29, 2023
6025243
getting close
jacob-milton Mar 29, 2023
1949304
a dict within a dict within a dict within...
jacob-milton Mar 29, 2023
132a53e
found elements
jacob-milton Mar 29, 2023
9b80667
Adding product steric test
jacob-milton Mar 29, 2023
b19264f
new test set + update test numbers
samblau Mar 29, 2023
cec0936
Merge pull request #8 from samblau/sam_dev
samblau Mar 29, 2023
0663ab1
increasing threshold for hinderance
jacob-milton Mar 29, 2023
f9c3a2e
testing if neighbor includes self
jacob-milton Mar 30, 2023
db7aa93
typo
jacob-milton Mar 30, 2023
02ee430
indentation
jacob-milton Mar 30, 2023
a3817c8
updated test set generator
jacob-milton Mar 30, 2023
b514d87
Add files via upload
jacob-milton Mar 30, 2023
e6d0526
testing new steric filter
jacob-milton Mar 30, 2023
841ef5e
altered test slightly
jacob-milton Mar 30, 2023
8459f2a
slightly stricter requirement
jacob-milton Mar 30, 2023
7e73380
Commenting steric filter
jacob-milton Mar 30, 2023
5252dbe
removing junk and commenting out logging
jacob-milton Mar 30, 2023
858942c
Merge branch 'jake_dev' into sam_dev
samblau Mar 30, 2023
9a8e34f
viable fragment matches
samblau Mar 30, 2023
175373f
Merge remote-tracking branch 'jake/jake_dev' into sam_dev
samblau Mar 30, 2023
26539b7
steric fix
jacob-milton Mar 30, 2023
fd0cf95
typo
jacob-milton Mar 30, 2023
7ee9bac
Merge remote-tracking branch 'jake/jake_dev' into sam_dev
samblau Mar 30, 2023
2a2817e
add like charge filter to phase 2
samblau Mar 31, 2023
e05dc29
precluding metrhyl trans from steric test
jacob-milton Mar 31, 2023
de50760
# of reactions
jacob-milton Mar 31, 2023
4fadc2b
typo
jacob-milton Mar 31, 2023
df09a1d
another typo
jacob-milton Mar 31, 2023
c3c1cf9
logging too_many_reactants
jacob-milton Mar 31, 2023
b13d4be
fixed typo
jacob-milton Mar 31, 2023
50a78c7
missing comma!
jacob-milton Mar 31, 2023
c0512d1
extra comma
jacob-milton Mar 31, 2023
59e9eec
corrected logging call
jacob-milton Mar 31, 2023
c78fffb
Testing dcharge
jacob-milton Mar 31, 2023
5be1c26
isomorphism test
jacob-milton Mar 31, 2023
49e1f17
test adding electron species
jacob-milton Mar 31, 2023
90815bc
testing dG filter
jacob-milton Mar 31, 2023
5220d83
Testing # reactant filter
jacob-milton Mar 31, 2023
f90e1f4
fix test
samblau Apr 2, 2023
eabd68d
Testing like charges
jacob-milton Apr 3, 2023
55e3dec
testing open shell
jacob-milton Apr 3, 2023
0772593
charge separation testing
jacob-milton Apr 3, 2023
272a123
testing covalent_decomposable
jacob-milton Apr 4, 2023
4a167f4
star_count test
jacob-milton Apr 4, 2023
f42df03
Testing H trans
jacob-milton Apr 5, 2023
f721f64
testing new H atom filter
jacob-milton Apr 5, 2023
8d0d37a
fixed indentation
jacob-milton Apr 5, 2023
5a9b1dd
another indent
jacob-milton Apr 5, 2023
99ead4f
testing new H atom comp filter
jacob-milton Apr 5, 2023
48a358d
oh god float subtraction
jacob-milton Apr 5, 2023
f7c8d7a
new filter testing
jacob-milton Apr 5, 2023
4c1fcde
obligatory typo
jacob-milton Apr 5, 2023
b841169
more testing
jacob-milton Apr 5, 2023
6d30a96
subtraction issues
jacob-milton Apr 5, 2023
d5c53eb
typo
jacob-milton Apr 5, 2023
1f9a9cc
changing iteration
jacob-milton Apr 5, 2023
8c6bcb4
trying new rule
jacob-milton Apr 5, 2023
c0ecda3
more float problems
jacob-milton Apr 5, 2023
cef1943
the silliest typo
jacob-milton Apr 5, 2023
b204156
changing bool
jacob-milton Apr 5, 2023
755c4a7
H abs filter working, correct # of rxns
jacob-milton Apr 5, 2023
b125ca8
commenting and testing int()
jacob-milton Apr 6, 2023
aaa679f
Merge remote-tracking branch 'jake/jake_dev' into sam_dev
samblau Apr 6, 2023
e5e9ce0
fix h_comp filter again?!?! please god
samblau Apr 6, 2023
55fd8f4
Merge remote-tracking branch 'Sam_HiPRGen/sam_dev' into jake_dev
jacob-milton Apr 6, 2023
28f737b
updated entry test
jacob-milton Apr 7, 2023
81ec76c
Merge branch 'jake_dev' of https://github.com/jacob-milton/HiPRGen in…
jacob-milton Apr 7, 2023
db0f8d5
testing not h trans
jacob-milton Apr 7, 2023
46d91e9
h abs closed shell test
jacob-milton Apr 7, 2023
3932483
testing hydride filter
jacob-milton Apr 7, 2023
0575fc7
testing single_reactant
jacob-milton Apr 7, 2023
a262827
single reactant star diff
jacob-milton Apr 7, 2023
b003b37
radical separation
jacob-milton Apr 7, 2023
ce55406
charge separation
jacob-milton Apr 7, 2023
759803e
testing ring close
jacob-milton Apr 7, 2023
b0b669a
checking full test set
jacob-milton Apr 7, 2023
b0f9abd
testing redox filter p2
jacob-milton Apr 7, 2023
49f27b4
typo
jacob-milton Apr 7, 2023
ab112a5
More typos!
jacob-milton Apr 7, 2023
cc68e14
logging like charges
jacob-milton Apr 8, 2023
5156600
logging JUST same charges
jacob-milton Apr 8, 2023
a92f9fc
testing charge transfer
jacob-milton Apr 8, 2023
395b910
testing covalent decomposable
jacob-milton Apr 8, 2023
e4e3c36
massive performance improvement
samblau Apr 8, 2023
227c5ed
fix charge transfer filter
samblau Apr 8, 2023
6677d81
Merge remote-tracking branch 'Sam_HiPRGen/sam_dev' into jake_dev
jacob-milton Apr 10, 2023
f7c82ac
logging new charge transfer
jacob-milton Apr 10, 2023
c25f571
testing covalent decomposable
jacob-milton Apr 10, 2023
eefc6f3
turn off spin multiplicity requirement for sinks
samblau Apr 11, 2023
f6102ab
Testing too simple a solution
jacob-milton Apr 11, 2023
201a0e0
typo?
jacob-milton Apr 11, 2023
f3afe4e
Revert "typo?"
jacob-milton Apr 11, 2023
26eac50
now typo
jacob-milton Apr 11, 2023
ddcad38
modifying params
jacob-milton Apr 11, 2023
9c49c6a
Really is too simple...
jacob-milton Apr 11, 2023
a3d6c7f
trying something crazy
jacob-milton Apr 11, 2023
9c4a668
just copy and paste!
jacob-milton Apr 11, 2023
d200afe
need to test p1
jacob-milton Apr 11, 2023
dac5741
uncommenting test
jacob-milton Apr 11, 2023
4d0f2b7
testing euvlp1 again
jacob-milton Apr 11, 2023
fa45b3f
testing p2
jacob-milton Apr 11, 2023
a9f5b03
testing simpler fix
jacob-milton Apr 11, 2023
0e83884
logging
jacob-milton Apr 11, 2023
04ff269
fixed typo
jacob-milton Apr 11, 2023
81c753e
testing p2
jacob-milton Apr 11, 2023
ed1a1a3
testing new cov_decomp
jacob-milton Apr 11, 2023
bfe7ec6
correcting # of rxns
jacob-milton Apr 11, 2023
032ae40
covalent charge not working
jacob-milton Apr 11, 2023
f1f77db
trying new charge method
jacob-milton Apr 11, 2023
9213920
typos
jacob-milton Apr 11, 2023
44269f1
# rxns
jacob-milton Apr 11, 2023
d2b7474
fixed covalent_decomposable and # rxns
jacob-milton Apr 11, 2023
013e7b5
testing cov_decomp
jacob-milton Apr 12, 2023
bd95914
elif statement cov_decomp
jacob-milton Apr 12, 2023
9be34bc
typo
jacob-milton Apr 12, 2023
c89571b
fix # rxns
jacob-milton Apr 12, 2023
4552a4b
comment
jacob-milton Apr 12, 2023
64ac912
less permissive cov_decomp
jacob-milton Apr 12, 2023
6b95df9
# of rxns
jacob-milton Apr 12, 2023
253b854
print statements
jacob-milton Apr 12, 2023
12f01d3
more printing
jacob-milton Apr 12, 2023
6d821d4
Cleaning up
jacob-milton Apr 12, 2023
277dad8
Merge branch 'jake_dev' of https://github.com/jacob-milton/HiPRGen in…
samblau Apr 12, 2023
26f479e
fix covalent decomposable
samblau Apr 12, 2023
c91c572
fix number of phase 2 reactions
samblau Apr 12, 2023
600ffca
trying to fix Li and Mg tests
samblau Apr 12, 2023
49f1513
covalent_charge_decomp
samblau Apr 12, 2023
ceebb44
fragments_are_not_2A_B
samblau Apr 12, 2023
25326bf
Freeze phase 1 test
samblau Apr 12, 2023
41775f6
Merge branch 'sam_dev' of https://github.com/BlauGroup/HiPRGen into s…
samblau Apr 12, 2023
e795c14
debugging
samblau Apr 13, 2023
ee7f794
remove prints
samblau Apr 13, 2023
3b2f203
fix occurrences typo
samblau Apr 15, 2023
75ccb78
extend styles list
samblau Apr 22, 2023
daa4579
change initial state loading
samblau Apr 22, 2023
00979bc
custom_y_max
samblau Apr 22, 2023
529d84c
custom_colorstyle_list
samblau Apr 24, 2023
7858491
Finish load_initial_state_and_trajectories()
samblau Apr 26, 2023
fa57474
Create my branch
ViktoriiaBaib Oct 23, 2023
a92168b
created bfo test
ViktoriiaBaib Oct 25, 2023
d3e9882
mol_entry remove try-except
ViktoriiaBaib Oct 25, 2023
d44cc38
methods organisation
ViktoriiaBaib Oct 25, 2023
5a14be5
decision tree
ViktoriiaBaib Oct 25, 2023
2ca7525
decision tree hashes
ViktoriiaBaib Oct 25, 2023
b9f8bc6
solvation correction
ViktoriiaBaib Oct 25, 2023
8ede480
bucket
ViktoriiaBaib Oct 25, 2023
c2cab78
report generation
ViktoriiaBaib Oct 25, 2023
feeed5d
scratch dir
ViktoriiaBaib Oct 25, 2023
04fe47d
dbfo reaction dec tree
ViktoriiaBaib Oct 25, 2023
f55beb2
bfo reaction dec tree
ViktoriiaBaib Oct 25, 2023
5ad03f7
el temp params
ViktoriiaBaib Oct 25, 2023
88685c0
report bi color
ViktoriiaBaib Oct 25, 2023
21a8d93
data
ViktoriiaBaib Oct 25, 2023
8986f40
covalent ring
ViktoriiaBaib Oct 25, 2023
235e299
reactions tree filt dg, star
ViktoriiaBaib Oct 25, 2023
59903da
logging dec tree
ViktoriiaBaib Oct 25, 2023
cfcb813
logging dec tree fix
ViktoriiaBaib Oct 25, 2023
ba30f1d
logging dec tree frag dec tree
ViktoriiaBaib Oct 25, 2023
0882b21
concerted metal
ViktoriiaBaib Oct 30, 2023
bdb5e2c
add two bond species filter
ViktoriiaBaib Oct 30, 2023
5a32474
cov before
ViktoriiaBaib Oct 30, 2023
d140917
small dataset, debug cov decomp
ViktoriiaBaib Oct 30, 2023
7fd251b
separable reaction filter
ViktoriiaBaib Oct 31, 2023
f9721be
separable fix
ViktoriiaBaib Oct 31, 2023
d90c411
separabel comp check
ViktoriiaBaib Oct 31, 2023
fa792ab
separab comp
ViktoriiaBaib Oct 31, 2023
8c1651d
separable
ViktoriiaBaib Oct 31, 2023
d5a0800
separable comp diff
ViktoriiaBaib Oct 31, 2023
007b233
separable comp diff fix
ViktoriiaBaib Oct 31, 2023
e5a8822
separable filter normal dataset
ViktoriiaBaib Oct 31, 2023
4732580
fragment filter
ViktoriiaBaib Oct 31, 2023
ae04f68
debug fragment filter on test dataset
ViktoriiaBaib Oct 31, 2023
2d518c2
proper test data
ViktoriiaBaib Oct 31, 2023
25c3ab0
frag filter
ViktoriiaBaib Oct 31, 2023
975f31c
frag filt debug
ViktoriiaBaib Oct 31, 2023
8271da6
frag f d
ViktoriiaBaib Oct 31, 2023
40cbba4
filter species debug
ViktoriiaBaib Oct 31, 2023
5793223
cov info
ViktoriiaBaib Oct 31, 2023
287af41
add_data
ViktoriiaBaib Oct 31, 2023
d149fde
logging tree
ViktoriiaBaib Oct 31, 2023
557bbde
broken bonds 2
ViktoriiaBaib Nov 1, 2023
6416b01
logging same
ViktoriiaBaib Nov 1, 2023
2c55973
fix two fragment metadata
ViktoriiaBaib Nov 1, 2023
a728de3
rnmc
ViktoriiaBaib Nov 1, 2023
ca668b9
mol entry id
ViktoriiaBaib Nov 1, 2023
f9f5ef4
all data, bond 3 A
ViktoriiaBaib Nov 2, 2023
22a3464
bond 3.6 A, only hiprgen
ViktoriiaBaib Nov 2, 2023
7b2d06d
hiprgen small data
ViktoriiaBaib Nov 2, 2023
c94af6f
hirpgen and rnmc small data
ViktoriiaBaib Nov 2, 2023
f06c54d
bond reduced to 3.5A dur to graph 397
ViktoriiaBaib Nov 2, 2023
8b3e1c9
full data
ViktoriiaBaib Nov 2, 2023
bd5b934
test full data
ViktoriiaBaib Nov 6, 2023
b989d9d
from rnmc
ViktoriiaBaib Nov 6, 2023
d7e83d9
new dastaset
ViktoriiaBaib Nov 23, 2023
9bf097f
init sate fix
ViktoriiaBaib Nov 30, 2023
d2223ed
upd report gen
ViktoriiaBaib Dec 4, 2023
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
72 changes: 72 additions & 0 deletions HiPRGen/gen_euvl_testset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
print("Importing required files...")
from pymatgen.core.structure import Molecule
from pymatgen.analysis.graphs import MoleculeGraph
from pymatgen.analysis.local_env import OpenBabelNN
from monty.serialization import loadfn, dumpfn
from mol_entry import MoleculeEntry
from initial_state import find_mol_entry_by_entry_id
import copy
print("Done!")

#list of mol_ids for species you want to find with each mol_id occupying its own line. Must have an empty line
#at the end of the file, but empty lines will not be copied.
print("Opening and reading species id file...")
with open('atom_mapping_set.txt') as mol_id_doc: #open the text file and copy each line as the element of a list, removing '\n'
mol_id_list = []
for line in mol_id_doc:
if line.strip(): #excludes empty lines
mol_id_list.append(line[0:len(line)-1])
print("Done!")

print("Opening json file...")
mol_json = "032923.json"
database_entries = loadfn(mol_json) #loads the json file to a list of dictionaries
print("Done!")

print("Reading molecule entries from json file...") #converts dictionary from loaded json file to a list
mol_entries= [MoleculeEntry.from_mp_doc(e) for e in database_entries]
print("Done!")

final_mol_ids = []

print('Copying desired molecules to a new list...')
for mol_id in mol_id_list: #takes the list of ids, finds their corresponding molecules in the json file
for mol_entry in mol_entries:
m_id = mol_entry.entry_id
if m_id == mol_id:
graph = mol_entry.mol_graph
for entry in mol_entries: #(as well as differently charged variants) and adds them to the list
molecule_graph = entry.mol_graph #tests if other charges found
if molecule_graph.isomorphic_to(graph):
final_mol_ids.append(entry.entry_id)

to_remove = ['nbo', 'alpha', 'beta']

test_set = []
for entry in database_entries:
if entry['molecule_id'] in final_mol_ids:
new_entry = copy.deepcopy(entry)
for name in entry.keys():
for remove in to_remove:
if remove in name:
val = new_entry.pop(name)
test_set.append(new_entry)

dumpfn(test_set, 'atom_mapping_set.json')

new_mol_json = loadfn('atom_mapping_set.json')
new_mol_entries= [MoleculeEntry.from_mp_doc(e) for e in new_mol_json]

new_id_list = []

for molecule in new_mol_entries:
new_id_list.append(molecule.entry_id)

new_id_set = set(new_id_list)
mol_id_set = set(mol_id_list)
differences = mol_id_set - new_id_set
if differences == set():
print('All desired entries successfully copied')
else:
for elem in differences:
print('entry ', elem, ' not copied successfully')
10 changes: 5 additions & 5 deletions HiPRGen/initial_state.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pymatgen.core.structure import Molecule
from pymatgen.analysis.graphs import MoleculeGraph
from pymatgen.analysis.local_env import OpenBabelNN
from pymatgen.analysis.fragmenter import metal_edge_extender
from pymatgen.analysis.local_env import OpenBabelNN, metal_edge_extender#, oxygen_edge_extender
import sqlite3


Expand All @@ -15,7 +14,8 @@ def find_mol_entry_from_xyz_and_charge(mol_entries, xyz_file_path, charge):
)

# correction to the molecule graph
target_mol_graph = metal_edge_extender(target_mol_graph)
target_mol_graph = metal_edge_extender(target_mol_graph, cutoff=3.4, metals=None,coordinators=("O"))
#target_mol_graph = metal_edge_extender(target_mol_graph)

match = False
index = -1
Expand Down Expand Up @@ -71,8 +71,8 @@ def insert_initial_state(
mol_entries,
initial_state_db,
factor_zero = 1.0,
factor_two = 1.0,
factor_duplicate = 0.5
factor_two = 0.5,
factor_duplicate = 1.0,
):
"""
initial state is a dict mapping species ids to counts.
Expand Down
117 changes: 88 additions & 29 deletions HiPRGen/mc_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def reaction_tally_report(
for (reaction_index, number) in sorted(
reaction_tally.items(), key=lambda pair: -pair[1]):
if number > cutoff:
report_generator.emit_text(str(number) + " occourances of:")
report_generator.emit_text(str(number) + " occurrences of:")
report_generator.emit_reaction(
network_loader.index_to_reaction(reaction_index),
label=str(reaction_index)
Expand All @@ -551,7 +551,7 @@ def species_report(network_loader, species_report_path):
report_generator.emit_text(str(mol.entry_id))
report_generator.emit_text(
"formula: " + mol.formula)

report_generator.emit_text("free energy = " + str(mol.free_energy) + " eV")
report_generator.emit_molecule(i)
report_generator.emit_newline()

Expand Down Expand Up @@ -750,7 +750,7 @@ def export_pathways_to_json(pathfinding, species_id, path):



def generate_pathway_report(
def pathway_report(
pathfinding,
species_id,
report_file_path,
Expand Down Expand Up @@ -839,7 +839,7 @@ def compute_expected_final_state(self):
)

for seed in self.network_loader.trajectories:
state = np.copy(self.network_loader.initial_state_array)
state = np.copy(self.network_loader.initial_state_array[seed])
for step in self.network_loader.trajectories[seed]:
reaction_index = self.network_loader.trajectories[seed][step][0]
time = self.network_loader.trajectories[seed][step][1]
Expand All @@ -858,6 +858,24 @@ def compute_expected_final_state(self):
self.expected_final_state = (
self.expected_final_state / len(self.network_loader.trajectories))

def compute_trajectory_final_states(self):
self.final_states = {}
for seed in self.network_loader.trajectories:
state = np.copy(self.network_loader.initial_state_array[seed])
for step in self.network_loader.trajectories[seed]:
reaction_index = self.network_loader.trajectories[seed][step][0]
time = self.network_loader.trajectories[seed][step][1]
reaction = self.network_loader.index_to_reaction(reaction_index)

for i in range(reaction['number_of_reactants']):
reactant_index = reaction['reactants'][i]
state[reactant_index] -= 1

for j in range(reaction['number_of_products']):
product_index = reaction['products'][j]
state[product_index] += 1
self.final_states[seed] = state

def compute_production_consumption_info(self):
self.consuming_reactions = {}
self.producing_reactions = {}
Expand Down Expand Up @@ -888,13 +906,13 @@ def compute_production_consumption_info(self):
self.producing_reactions[product_index][reaction_index] += 1

def compute_state_time_series(self, seed):
state_dimension_size = len(self.network_loader.initial_state_array)
state_dimension_size = len(self.network_loader.initial_state_array[seed])
step_dimension_size = len(self.network_loader.trajectories[seed])
time_series = np.zeros(
(step_dimension_size, state_dimension_size),
dtype=int)

state = np.copy(self.network_loader.initial_state_array)
state = np.copy(self.network_loader.initial_state_array[seed])
for step in self.network_loader.trajectories[seed]:
reaction_index = self.network_loader.trajectories[seed][step][0]
time = self.network_loader.trajectories[seed][step][1]
Expand All @@ -918,9 +936,11 @@ def time_series_graph(
seeds,
species_of_interest,
path,
custom_y_max=None,
custom_colorstyle_list=None,
colors = list(mcolors.TABLEAU_COLORS.values()),
styles = ['solid', 'dotted', 'dashed', 'dashdot'],
internal_index_labels=True
styles = ['solid', 'dotted', 'dashed', 'dashdot','solid', 'dotted', 'dashed', 'dashdot','solid', 'dotted', 'dashed', 'dashdot','solid', 'dotted', 'dashed', 'dashdot'],
internal_index_labels=True,
):


Expand Down Expand Up @@ -952,11 +972,16 @@ def time_series_graph(

line_dict = {}
i = 0
for species_index in species_of_interest:
r = i % len(colors)
q = i // len(colors)
line_dict[species_index] = (colors[r], styles[q])
i += 1
if custom_colorstyle_list is None:
for species_index in species_of_interest:
r = i % len(colors)
q = i // len(colors)
line_dict[species_index] = (colors[r], styles[q])
i += 1
else:
for species_index in species_of_interest:
line_dict[species_index] = (custom_colorstyle_list[i][0], custom_colorstyle_list[i][1])
i += 1


fig, (ax0, ax1, ax2) = plt.subplots(
Expand All @@ -965,15 +990,19 @@ def time_series_graph(
gridspec_kw={'height_ratios':[2,2,1]})

y_max = 0
for step in range(total_time_series.shape[0]):
for species_index in species_of_interest:
y_max = max(y_max, total_time_series[step,species_index])
if custom_y_max is None:
for step in range(total_time_series.shape[0]):
for species_index in species_of_interest:
y_max = max(y_max, total_time_series[step,species_index])
y_max += 1
else:
y_max = custom_y_max

ax0.set_xlim([0,total_time_series.shape[0]])
ax0.set_ylim([0,y_max+1])
ax0.set_ylim([0,y_max])

ax1.set_xlim([0,total_time_series.shape[0]])
ax1.set_ylim([0,(y_max+1)/10])
ax1.set_ylim([0,(y_max)/10])


ticks = np.arange(0, total_time_series.shape[0])
Expand Down Expand Up @@ -1097,8 +1126,8 @@ def sink_filter(self, species_index):
mol = self.network_loader.mol_entries[species_index]
if (number_of_consuming_reactions + number_of_producing_reactions > 0 and
ratio > 1.5 and
expected_value > 0.1 and
mol.spin_multiplicity == 1):
expected_value > 0.1):# and
#mol.spin_multiplicity == 1):
return True
else:
return False
Expand All @@ -1121,11 +1150,11 @@ def export_consumption_to_json(simulation_replayer, species_index, path):
}
reactions[reaction_id] = json_reaction

dumpfn({
'reactions' : reactions,
'producing_reactions' : producing_reactions,
'consuming_reactions' : consuming_reactions},
path)
dumpfn({
'reactions' : reactions,
'producing_reactions' : producing_reactions,
'consuming_reactions' : consuming_reactions},
path)

def pad_time_series(time_series, max_number_of_steps):
num_steps = time_series.shape[0]
Expand All @@ -1144,15 +1173,22 @@ def pad_time_series(time_series, max_number_of_steps):



def export_sinks_to_json(simulation_replayer, path):
sink_data = simulation_replayer.sink_data
def export_full_sink_data_to_json(simulation_replayer, path):
sink_data_json = {}
for i in sink_data:
for i in simulation_replayer.sink_data: # All molecules formed at least once are in sink_data
mol = simulation_replayer.network_loader.mol_entries[i]
sink_data_json[mol.entry_id] = sink_data[i]
sink_data_json[mol.entry_id] = simulation_replayer.sink_data[i]

dumpfn(sink_data_json, path)

def export_sinks_to_json(simulation_replayer, path):
sinks_json = {}
for i in simulation_replayer.sinks: # Only molecules that pass sink_filter are in sinks
mol = simulation_replayer.network_loader.mol_entries[i]
sinks_json[mol.entry_id] = simulation_replayer.sink_data[i]

dumpfn(sinks_json, path)

def export_species_report_to_json(network_loader, path):
data = {}
for i in range(network_loader.number_of_species):
Expand Down Expand Up @@ -1260,3 +1296,26 @@ def sink_report(
report_generator.emit_newline()

report_generator.finished()


def final_state_report(
simulation_replayer,
final_state_report_path
):
final_state = []
for species_index, value in enumerate(simulation_replayer.expected_final_state):
if value > 0.0:
final_state.append({"index": species_index, "value": value})
sorted_final_state = sorted(final_state, key=lambda x: -x["value"])

report_generator = ReportGenerator(
simulation_replayer.network_loader.mol_entries,
final_state_report_path,
rebuild_mol_pictures=False)

for entry in sorted_final_state:
report_generator.emit_text("amount: " + str(entry["value"]))
report_generator.emit_molecule(entry["index"])
report_generator.emit_newline()
report_generator.finished()

Loading