Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixed several small errors
  • Loading branch information
makdl committed Mar 19, 2021
commit 649a028a1f9e19bedfa7da95d9577892aa544d25
2 changes: 1 addition & 1 deletion spatialpy/ssa_sdpd-c-simulation-engine/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SIMFLAGS = -l. -std=c++14 -Wall -O3
LFLAGS = -pthread -lm
INCDIR = $(ROOTINC)/include/ $(ROOTINC)/external/ $(ROOTINC)/external/ANN/include/
INCDIRPARAMS = $(INCDIR:%=-I%)
OBJ = particle.o simulate.o count_cores.o output.o simulate_rdme.o simulate_threads.o model.o pthread_barrier.o
OBJ = particle.o NRMConstant_v5.o simulate.o count_cores.o output.o simulate_rdme.o simulate_threads.o model.o pthread_barrier.o
ANNOBJECTS = ANN.o brute.o kd_tree.o kd_util.o kd_split.o \
kd_dump.o kd_search.o kd_pr_search.o kd_fix_rad_search.o \
bd_tree.o bd_search.o bd_pr_search.o bd_fix_rad_search.o \
Expand Down
4 changes: 2 additions & 2 deletions spatialpy/ssa_sdpd-c-simulation-engine/src/particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace Spatialpy{
}

NeighborNode::NeighborNode(Particle *data, double dist, double dWdr, double D_i_j):data(data), dist(dist), dWdr(dWdr), D_i_j(D_i_j){}
EventNode::EventNode(Particle *data, double tt):data(data), tt(tt){}
// EventNode::EventNode(Particle *data, double tt):data(data), tt(tt){}

void Particle::check_particle_nan(){
if(
Expand Down Expand Up @@ -123,7 +123,7 @@ namespace Spatialpy{
// double c = x[2] - neighbor.x[2];
// double r2 = ( a*a + b*b + c*c);
// Make sure the distance was actually set by the annkFRSearch
double r2_old = r2;
//double r2_old = r2;
if(r2 == ANN_DIST_INF) {
r2 = particle_dist_sqrd(neighbor) ;
}
Expand Down
21 changes: 11 additions & 10 deletions spatialpy/ssa_sdpd-c-simulation-engine/src/simulate_rdme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ namespace Spatialpy{
}
/**************************************************************************/
void destroy_rdme(ParticleSystem*system){
if(debug_flag) printf("NSM: total # reacton events %lu\n",system->rdme->total_reactions);
if(debug_flag) printf("NSM: total # diffusion events %lu\n",system->rdme->total_diffusion);
if(debug_flag) printf("NSM: total # reacton events %lu\n",system->total_reactions);
if(debug_flag) printf("NSM: total # diffusion events %lu\n",system->total_diffusion);
}


Expand All @@ -92,7 +92,7 @@ namespace Spatialpy{
p2 = nn.data;
printf("%i: nn->D_i_j=%e \n",p2->id,nn.D_i_j);
}

}

/*void nsm_core(const size_t *irD,const size_t *jcD,const double *prD,
Expand Down Expand Up @@ -324,7 +324,7 @@ namespace Spatialpy{
Particle *p ;
p = &system->particles[i] ;
//p = e->data;

//long unsigned int srng = rng() ;
//long unsigned int rng_max = rng.max() ;
//double tt = -log(1.0-(rng() * 1.0 / rng.max())) / (p->srrate+p->sdrate);
Expand All @@ -333,10 +333,10 @@ namespace Spatialpy{
if(propensities[i] > 0){
activeChannels++
}
if(p.particle_index != i){
if(p->particle_index != i){
// particles can move around in the sys->particles vector,
// this ensures that we know where in the vector each particle is
p.particle_index = i;
p->particle_index = i;
}

//system->event_v.emplace_back(p, tt) ;
Expand All @@ -345,7 +345,7 @@ namespace Spatialpy{
// ordered_list_sort(system->heap);

double timeOffset = system->current_step * system->dt;

// TODO: does this deallocate memory on the 2nd call? No
// TODO: make a deallocation function
system->rdme_event_q.build(propensities, rng, propensitySum, activeChannels,
Expand Down Expand Up @@ -533,7 +533,8 @@ namespace Spatialpy{
double totrate,cum,rdelta,rrdelta;
int event,errcode = 0;
long unsigned int re, spec = 0 ;
Particle*subvol;
Particle *subvol;
int subvol_index;
size_t i,j = 0;
//double old_rrate = 0.0,old_drate = 0.0;
double rand1,rand2,cum2,old;
Expand Down Expand Up @@ -579,7 +580,7 @@ namespace Spatialpy{
timeRxnPair = system->rdme_event_q.selectReaction();
tt = timeRxnPair.first;
subvol_index = timeRxnPair.second;
subvol = system->particles[subvol_index];
subvol = &system->particles[subvol_index];
vol = (subvol->mass / subvol->rho);

if(debug_flag){printf("nsm: tt=%e subvol=%i\n",tt,subvol->id);}
Expand Down Expand Up @@ -855,7 +856,7 @@ namespace Spatialpy{
// }
//ordered_list_bubble_up_down(system->heap, dest_subvol->heap_index);

system->rdme_event_q.update(dest_subvol.particle_index, totrate, tt, rng);
system->rdme_event_q.update(dest_subvol->particle_index, totrate, tt, rng);
}

// re-sort the heap
Expand Down