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

Initialized with files on caviness #1

Open
wants to merge 1 commit into
base: master
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
39 changes: 9 additions & 30 deletions zacros_wrapper/IO_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
from zacros_wrapper.utils import ReturnUnique as _ReturnUnique
from zacros_wrapper.utils import rawbigcount as _rawbigcount

try:
from pMuTT.io.excel import read_excel
from pMuTT.empirical.zacros import Zacros
except:
pass
# from pmutt.io.excel import read_excel
# from pmutt.empirical.zacros import Zacros


'''
Class definitions for:
Expand Down Expand Up @@ -1053,15 +1051,15 @@ def ReadSeed(self, nSites = 1):
# take the line with seed indices
seed_lines = [li for li in lines if (li[0] == 'seed_on_sites')]
seed_indices = np.array([int(si[2]) for si in seed_lines])

# save to a snap matrix (nSites by 4)
snap_data = np.array([[0]*4]*nSites)
snap_data[:,0] = np.arange(1, nSites+1) # 1st column is the site number
snap_data[:,1] = np.arange(1, nSites+1) # 2nd column wont be used
snap_data[:,3] = 1 # 4th column dentate number, default is 1
snap_data[seed_indices,2] = 1 # 3rd column, occupancy, set as 1
snap_data[:,3] = 1 # 3rd column dentate number, default is 1
snap_data[seed_indices,2] = 1 # 2nd column, occupancy, set as 1
self.initialsnap = snap_data


def WriteIn(self, fldr, surf_spec):

Expand Down Expand Up @@ -1413,12 +1411,7 @@ def Read_propensities(path, nRxn):
for dub in LineSplit:
line_data.append(np.float(dub))
prop.append(line_data)


prop = np.array(prop)
nNum = prop.shape[0]
prop = np.reshape(prop, [int(nNum/nRxn), nRxn])
return prop
return np.array(prop)

else:
return None
Expand Down Expand Up @@ -1466,11 +1459,7 @@ def Read_time_integrated_propensities(path, nRxn):
line_data.append(np.float(dub))
propCounter.append(line_data)


propCounter = np.array(propCounter)
nNum = propCounter.shape[0]
propCounter = np.reshape(propCounter, [int(nNum/nRxn), nRxn])
return propCounter
return np.array(propCounter)
else:
return None

Expand Down Expand Up @@ -1508,11 +1497,6 @@ def Read_trajectory_derivatives(path, nRxn):
for dub in LineSplit:
line_data.append(np.float(dub))
W_sen_anal.append(line_data)


W_sen_anal = np.array(W_sen_anal)
nNum = W_sen_anal.shape[0]
W_sen_anal = np.reshape(W_sen_anal, [int(nNum/nRxn), nRxn])
return np.array(W_sen_anal)
else:
return None
Expand Down Expand Up @@ -1551,11 +1535,6 @@ def Read_time_integrated_species(path, n_surf_specs):
for dub in LineSplit:
line_data.append(np.float(dub))
spec_num_int.append(line_data)


spec_num_int = np.array(spec_num_int)
nNum = spec_num_int.shape[0]
spec_num_int = np.reshape(spec_num_int, [int(nNum/n_surf_specs), n_surf_specs])
return np.array(spec_num_int)

else:
Expand Down
27 changes: 15 additions & 12 deletions zacros_wrapper/KMC_Run.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def __init__(self, path = None):
self.propCounter = None # data from timeintprop_output.txt
self.W_sen_anal = None # data from trajderiv_output.txt
self.spec_num_int = None # data from timeintspecs_output.txt
self.TS_site_props_list = None
self.TS_site_props_ss = None # steady state site propensities
#self.TS_site_props_list = None
#self.TS_site_props_ss = None # steady state site propensities


'''
Expand Down Expand Up @@ -95,6 +95,8 @@ def ReadAllOutput(self, build_lattice=False):
False - reads lattice_output.txt as text only
'''

#print 'Reading kMC trajectory data from ' + self.Path

self.ReadAllInput()

if self.CheckComplete():
Expand All @@ -117,18 +119,19 @@ def ReadAllOutput(self, build_lattice=False):

# Extra output files
# Disable for simplicity
self.prop = Read_propensities(self.Path, len( self.genout.RxnNameList ) )
self.propCounter = Read_time_integrated_propensities(self.Path, len( self.genout.RxnNameList ) )
self.W_sen_anal = Read_trajectory_derivatives(self.Path, len( self.genout.RxnNameList ))
self.spec_num_int = Read_time_integrated_species(self.Path, len( self.simin.surf_spec ))
self.TS_site_props_list = Read_time_integrated_site_props(self.Path, nSites, len( self.genout.RxnNameList ), self.histout.n_snapshots )
#self.prop = Read_propensities(self.Path, len( self.genout.RxnNameList ) )
#self.propCounter = Read_time_integrated_propensities(self.Path, len( self.genout.RxnNameList ) )
#self.W_sen_anal = Read_trajectory_derivatives(self.Path, len( self.genout.RxnNameList ))
#self.spec_num_int = Read_time_integrated_species(self.Path, len( self.simin.surf_spec ))
#self.TS_site_props_list = Read_time_integrated_site_props(self.Path, nSites, len( self.genout.RxnNameList ), self.histout.n_snapshots )

if not self.TS_site_props_list is None:

if self.histout.snap_times[-1] == 0.: # only 1 entry in history output
self.TS_site_props_ss = self.TS_site_props_list[-1]
else:
self.TS_site_props_ss = ( self.TS_site_props_list[-1] - self.TS_site_props_list[0] ) / ( self.histout.snap_times[-1] - self.histout.snap_times[0] )
#if not self.TS_site_props_list is None:

#if self.histout.snap_times[-1] == 0.: # only 1 entry in history output
#self.TS_site_props_ss = self.TS_site_props_list[-1]
#else:
#self.TS_site_props_ss = ( self.TS_site_props_list[-1] - self.TS_site_props_list[0] ) / ( self.histout.snap_times[-1] - self.histout.snap_times[0] )

else:
print('general_output.txt not found in ' + self.Path)
Expand Down
2 changes: 1 addition & 1 deletion zacros_wrapper/Lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def Build_neighbor_list_3D(self, cut_range=(0.9, 1.1), cart_coords_3d = None):
self.neighbor_list = []
self.cell_list = [] # self, north, northeast, east, or southeast

n_sites = self.cart_coords_3d.shape[0]
n_sites = len(self.site_type_inds)

# Loop through all sites
for site_1 in range(n_sites):
Expand Down
6 changes: 2 additions & 4 deletions zacros_wrapper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import matplotlib as mat
import platform
if platform.system() == 'Linux':
mat.use('Agg')

mat.use('Agg')
import matplotlib.pyplot as plt

from zacros_wrapper.utils import *
from zacros_wrapper.IO_data import *
from zacros_wrapper.Lattice import Lattice
Expand Down