-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add plugin for extended sampling #231
base: master
Are you sure you want to change the base?
Conversation
…x regarding getEnergy() which should be called in afterForces method
…chlaeger correlatoin
This pull request introduces 2 alerts when merging cdd1b25 into e7c0ca9 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 8d8e1e5 into e7c0ca9 - view on LGTM.com new alerts:
|
…ardyn into chemPot_sampling
This pull request introduces 1 alert when merging e022806 into e7c0ca9 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
…ardyn into chemPot_sampling
Main obstacle is that this branch adds significant overhead. TODO:
|
for (unsigned int sj = 0; sj < nc2; ++sj) { | ||
const std::array<double,3> djj = mj.ljcenter_d_abs(sj); | ||
// const std::array<double,3> dsitejj = mj.ljcenter_d(sj); |
Check notice
Code scanning / CodeQL
Commented-out code Note
const unsigned int nc1 = mi.numLJcenters(); | ||
const unsigned int nc2 = mj.numLJcenters(); | ||
for (unsigned int si = 0; si < nc1; ++si) { | ||
const std::array<double,3> dii = mi.ljcenter_d_abs(si); | ||
// const std::array<double,3> dsiteii = mi.ljcenter_d(si); |
Check notice
Code scanning / CodeQL
Commented-out code Note
// Check if we have to add the macroscopic values up | ||
if (calculateMacroscopic) { | ||
const RealAccumVec upot_accum = RealAccumVec::convertCalcToAccum(upot); | ||
sum_upotXpoles = sum_upotXpoles + upot_accum; | ||
sum_virial = sum_virial + V_x + V_y + V_z;//DoubleVec::scal_prod(m_dx, m_dy, m_dz, f_x, f_y, f_z); | ||
sum_virial = sum_virial + V_xx + V_yy + V_zz;//DoubleVec::scal_prod(m_dx, m_dy, m_dz, f_x, f_y, f_z); |
Check notice
Code scanning / CodeQL
Commented-out code Note
// Check if we have to add the macroscopic values up | ||
if (calculateMacroscopic) { | ||
RealAccumVec upot_accum = RealAccumVec::convertCalcToAccum(upot); | ||
sum_upotXpoles = sum_upotXpoles + upot_accum; | ||
sum_virial = sum_virial + V_x + V_y + V_z;//DoubleVec::scal_prod(m_dx, m_dy, m_dz, f_x, f_y, f_z); | ||
sum_virial = sum_virial + V_xx + V_yy + V_zz;//DoubleVec::scal_prod(m_dx, m_dy, m_dz, f_x, f_y, f_z); |
Check notice
Code scanning / CodeQL
Commented-out code Note
|
||
void Fadd(const double a[]) override { for(unsigned short d=0;d<3;++d) _F[d]+=a[d]; } | ||
void Madd(const double a[]) override { for(unsigned short d=0;d<3;++d) _M[d]+=a[d]; } | ||
void Viadd(const double a[]) override { for(unsigned short d=0;d<3;++d) _Vi[d]+=a[d]; } | ||
void Viadd(const double a[]) override { for(unsigned short d=0;d<9;++d) _Vi[d]+=a[d]; } |
Check notice
Code scanning / CodeQL
No raw arrays in interfaces Note
@@ -271,17 +273,19 @@ | |||
* @param M force vector (x,y,z) | |||
*/ | |||
void setM(double M[3]) override { for(int d = 0; d < 3; d++ ) { _M[d] = M[d]; } } | |||
void setVi(double Vi[3]) override { for(int d = 0; d < 3; d++) { _Vi[d] = Vi[d]; } } | |||
void setVi(double Vi[9]) override { for(int d = 0; d < 9; d++) { _Vi[d] = Vi[d]; } } |
Check notice
Code scanning / CodeQL
No raw arrays in interfaces Note
@@ -191,7 +191,9 @@ | |||
|
|||
virtual void setF(double F[3]) = 0; | |||
virtual void setM(double M[3]) = 0; | |||
virtual void setVi(double Vi[3]) = 0; | |||
virtual void setVi(double Vi[9]) = 0; |
Check notice
Code scanning / CodeQL
No raw arrays in interfaces Note
@@ -218,7 +218,7 @@ | |||
|
|||
void setF(double /*F*/ [3]) override {} | |||
void setM(double /*M*/[3]) override {} | |||
void setVi(double /*Vi*/[3]) override {} | |||
void setVi(double /*Vi*/[9]) override {} |
Check notice
Code scanning / CodeQL
No raw arrays in interfaces Note
_globalBoxLength[2] = domain->getGlobalLength(2); | ||
|
||
_numBinsGlobal = static_cast<unsigned int>(_globalBoxLength[1]/_binwidth); | ||
if (_globalBoxLength[1]/_binwidth != static_cast<float>(_numBinsGlobal)) { |
Check notice
Code scanning / CodeQL
Equality test on floating-point values Note
Description
This PR adds a plugin to sample multiple quantities plus the chemical potential directly using Widom's insertion method. For now, it works for the LJTS fluid, which does not need any LR corrections. In addition, minor improvements and fixes were made in other parts of the code.
The plugin offers the possibility to choose, if the test particles are inserted randomly or in a lattice structure. The number of inserted particles in the lattice structure is adjusted according to the local density.
_simulation.getNumTimesteps()
may lead to wrong value during read in of xml config. The number of timesteps may be overwritten later by the command line argument. Therefore, thestopTimestep
variable must be set not earlier than in the init() methodparticle containter -> getEnergy()
, since it only returns the correct energy if the halo cells are still present. So for plugins, the getEnergy() method must be called inafterForces()
How Has This Been Tested?
The sampling was tested by conducting several test runs at different state points. The result was compare to the PeTS EOS and results from ms2 simulations.
Open issues
endTraversal()
method called bygetEnergy()
sets the local Upot to some wrong value. Is the call ofendTraversal()
needed in thegetEnergy()
method?Resource not released
)