10 |
|
#include "Thermo.hpp" |
11 |
|
#include "SRI.hpp" |
12 |
|
#include "Integrator.hpp" |
13 |
+ |
#include "simError.h" |
14 |
|
|
15 |
|
#ifdef IS_MPI |
16 |
|
#define __C |
87 |
|
double potential_local; |
88 |
|
double potential; |
89 |
|
int el, nSRI; |
90 |
< |
SRI** sris; |
90 |
> |
Molecule* molecules; |
91 |
|
|
92 |
< |
sris = entry_plug->sr_interactions; |
92 |
> |
molecules = entry_plug->molecules; |
93 |
|
nSRI = entry_plug->n_SRI; |
94 |
|
|
95 |
|
potential_local = 0.0; |
96 |
+ |
potential = 0.0; |
97 |
|
potential_local += entry_plug->lrPot; |
98 |
|
|
99 |
< |
for( el=0; el<nSRI; el++ ){ |
100 |
< |
potential_local += sris[el]->get_potential(); |
99 |
> |
for( el=0; el<entry_plug->n_mol; el++ ){ |
100 |
> |
potential_local += molecules[el].getPotential(); |
101 |
|
} |
102 |
|
|
103 |
+ |
#ifdef IS_MPI |
104 |
+ |
/* |
105 |
+ |
std::cerr << "node " << worldRank << ": before LONG RANGE pot = " << entry_plug->lrPot |
106 |
+ |
<< "; pot_local = " << potential_local |
107 |
+ |
<< "; pot = " << potential << "\n"; |
108 |
+ |
*/ |
109 |
+ |
#endif |
110 |
+ |
|
111 |
|
// Get total potential for entire system from MPI. |
112 |
|
#ifdef IS_MPI |
113 |
|
MPI::COMM_WORLD.Allreduce(&potential_local,&potential,1,MPI_DOUBLE,MPI_SUM); |
115 |
|
potential = potential_local; |
116 |
|
#endif // is_mpi |
117 |
|
|
118 |
+ |
#ifdef IS_MPI |
119 |
+ |
/* |
120 |
+ |
std::cerr << "node " << worldRank << ": after pot = " << potential << "\n"; |
121 |
+ |
*/ |
122 |
+ |
#endif |
123 |
+ |
|
124 |
|
return potential; |
125 |
|
} |
126 |
|
|
154 |
|
} |
155 |
|
|
156 |
|
double Thermo::getPressure(){ |
157 |
+ |
// returns pressure in units amu*fs^-2*Ang^-1 |
158 |
+ |
// routine derived via viral theorem description in: |
159 |
+ |
// Paci, E. and Marchi, M. J.Phys.Chem. 1996, 100, 4314-4322 |
160 |
|
|
142 |
– |
// const double conv_Pa_atm = 9.901E-6; // convert Pa -> atm |
143 |
– |
// const double conv_internal_Pa = 1.661E-7; //convert amu/(fs^2 A) -> Pa |
144 |
– |
// const double conv_A_m = 1.0E-10; //convert A -> m |
145 |
– |
|
161 |
|
return 0.0; |
162 |
|
} |
163 |
|
|
211 |
|
|
212 |
|
av2 = 2.0 * kebar / atoms[vr]->getMass(); |
213 |
|
vbar = sqrt( av2 ); |
214 |
< |
|
214 |
> |
|
215 |
|
// vbar = sqrt( 8.31451e-7 * temperature / atoms[vr]->getMass() ); |
216 |
|
|
217 |
|
// picks random velocities from a gaussian distribution |