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

Add plugin for extended sampling #231

Draft
wants to merge 83 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
e471b72
First version of direct sampling of chemical potential
HomesGH Feb 25, 2022
b69d4a0
Fixes in ChemPotSampling
HomesGH Mar 1, 2022
221cf37
Fixes in chem. pot. sampling
HomesGH Mar 1, 2022
9df491a
Fixes in DriftCtrl; Re-enable drift control in all directions
HomesGH Mar 1, 2022
b32c726
Get rid of comparison warning
HomesGH Mar 1, 2022
114d0be
Add temperature sampling including drift
HomesGH Mar 1, 2022
1d07e55
Add documentation and fixes
HomesGH Mar 2, 2022
a6ffa33
Minor changes for improved usability
HomesGH Mar 3, 2022
0f54e50
Fix in ChemPotSampling
HomesGH Mar 3, 2022
bb9c0f3
Add documentation
HomesGH Mar 3, 2022
7324f17
Fix to avoid zero-division
HomesGH Mar 4, 2022
0da5192
Fix to have at least one test particle per direction and process
HomesGH Mar 4, 2022
87c20ac
Add documentation of getEnergy() method
HomesGH Mar 9, 2022
3fb1fc5
Fix in MMPLD writer to get correct max. number of time steps
HomesGH Mar 9, 2022
c02c78a
Add possibility to use random insertion and sample every nth step; Fi…
HomesGH Mar 9, 2022
f6853bb
Get rid of warning
HomesGH Mar 9, 2022
355ba31
Clean up and restructuring; include OPENMP
HomesGH Mar 9, 2022
cb12427
Fix in chemical potential sampling
HomesGH Mar 10, 2022
84debc3
Minor improvements in DriftCtrl
HomesGH Mar 10, 2022
cdd1b25
Add python script to calculate shear viscosity for LJTS using Lautens…
HomesGH Mar 10, 2022
8d8e1e5
Get rid of LGTM python warning
HomesGH Mar 10, 2022
ba6aa14
Changes in the implementation of the PeTS to get chemical potential (…
HomesGH Mar 11, 2022
e022806
Merge branch 'chemPot_sampling' of https://github.com/ls1mardyn/ls1-m…
HomesGH Mar 11, 2022
350fb4a
Add function to convert gibbs free energy values
HomesGH Mar 14, 2022
f9ea383
Add checks to prevent invalid operations
HomesGH Mar 14, 2022
0446f65
Abort simulation if xml-includes were not found
HomesGH Mar 15, 2022
e30785e
Get rid of LGTM warning
HomesGH Mar 15, 2022
214db73
Add debug output
HomesGH Mar 21, 2022
364bd01
Merge branch 'chemPot_sampling' of https://github.com/ls1mardyn/ls1-m…
HomesGH Mar 21, 2022
0554bfb
Extended plugin to sample all relevant data
HomesGH Mar 25, 2022
2d229f0
Minor fixes in sampling plugin
HomesGH Mar 25, 2022
c53f4dc
Fix in DriftCtrl to use velocities instead of momenta
HomesGH Mar 28, 2022
20ef5cc
Fix in DriftCtrl to work with all components (cid=0)
HomesGH Mar 29, 2022
ed94b8b
Make stop work for RegionSampling; Clearify output in MettDaemon
HomesGH Mar 29, 2022
922f1df
Include git information in executable as it was done with cmake
HomesGH Mar 29, 2022
0c102d8
Extend and improve sampling of profile data
HomesGH Mar 29, 2022
c51d7ca
Enable direct sampling of energy flux when using the legacy cell proc…
HomesGH Mar 29, 2022
de0101b
Add calculation of all virial elements using vectorization
HomesGH Apr 1, 2022
2301ed8
Add sampling of higher moments
HomesGH Apr 1, 2022
7116946
Add possibility to specify direction of DriftCtrl
HomesGH Apr 1, 2022
8bbb9b2
Update version file if commit hash changed
HomesGH Apr 1, 2022
9504d41
Fix in full virial calculation with vectorization
HomesGH Apr 1, 2022
bf0efa0
Remove debug output
HomesGH Apr 1, 2022
34cb6ce
Fixes for extended virial calculation
HomesGH Apr 5, 2022
04dc4a5
Minor fixes in ExtendedSampling
HomesGH Apr 6, 2022
4beadf0
Extension and fix of sampling of higher moments
HomesGH Apr 12, 2022
6e71b7a
Realize suggested changes
HomesGH Apr 12, 2022
aba3e78
Minor fixes in ExtendedSampling plugin
HomesGH Apr 12, 2022
667ab7d
Minor fixes in ExtendedSampling plugin
HomesGH Apr 12, 2022
c83fc0b
Implement suggested changes
HomesGH Apr 12, 2022
d6ae1bc
Fix error in shared pointer in ExtendedSampling plugin
HomesGH Apr 13, 2022
db559d1
Add range specification to gamma writer
HomesGH Apr 18, 2022
f208b49
Fixes in GammaWriter and sampling of all components as one
HomesGH Apr 18, 2022
51c5dfc
Fix in MettDeamon and EPS regarding output
HomesGH Apr 18, 2022
718687f
Add method to get upot correction per molecule; Fixes
HomesGH May 5, 2022
8f6ed79
Add documentation of ExtendedProfileSampling plugin
HomesGH May 25, 2022
d115261
Add unit test for ExtendedSampling plugin and fix some warnings
HomesGH Jun 2, 2022
1b6d9e4
Consider sample in EPS only if enough particles
HomesGH Jun 22, 2022
1451948
Add sampling of massflux and fix in force sampling
HomesGH Jun 22, 2022
28e571d
Fixes in ESP, TemperatureControl and DriftControl
HomesGH Aug 16, 2022
e9f4a41
Fix sampling of chem. pot. for LRC
HomesGH Aug 19, 2022
1dee5ae
Fix in EPS plugin for multi-atom molecules
HomesGH Oct 24, 2022
298ce87
Merge remote-tracking branch 'origin/master' into chemPot_sampling
HomesGH Oct 24, 2022
9468c86
Fix in GammaWriter
HomesGH Nov 7, 2022
2bf97db
Merge remote-tracking branch 'origin/master' into chemPot_sampling
HomesGH Nov 7, 2022
452abb8
Fix in HigherMoments of EPS
HomesGH Jan 18, 2023
82862b2
Merge remote-tracking branch 'origin/master' into chemPot_sampling
HomesGH Jan 24, 2023
141bfec
Fix in sampling of higher moments
HomesGH Feb 23, 2023
c0e4044
Add orientation angle to sampling
HomesGH Apr 12, 2023
9a51dd2
Merge branch 'chemPot_sampling' of https://github.com/ls1mardyn/ls1-m…
HomesGH Apr 12, 2023
e1c300f
Fix default of Quaternions (which was not normalized)
HomesGH Apr 13, 2023
de34309
Change orientation from angle to order parameter
HomesGH Apr 14, 2023
d738d77
Fix regarding quaternions
HomesGH Apr 18, 2023
745a9e7
Normalize quaternions in test input files
HomesGH Apr 18, 2023
20976e2
Normalize quaternions during read
HomesGH Apr 19, 2023
8f66703
Add script to run validation tests
HomesGH Apr 19, 2023
1444f41
Merge branch 'master' into chemPot_sampling
HomesGH Oct 18, 2023
90e835c
Add std::
HomesGH Oct 18, 2023
9d9dd0e
Performance improvements
HomesGH Oct 18, 2023
07acfdc
Fix in ExtProfileSampling
HomesGH Oct 19, 2023
c3affd0
Minor fixes
HomesGH Oct 19, 2023
334a32d
Fix in EPS
HomesGH Oct 19, 2023
d2b9583
Fix in higher moments and unit test
HomesGH Oct 20, 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
1 change: 1 addition & 0 deletions doc/Plugins_Summary.dox
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Dropaccelerator | utility for droplet simulations | Speeds up particles that are
Dropaligner | utility for droplet simulations | aligns the center of mass of particles within a spherical region with a specified center of mass in a similar fashion as the COMaligner. Used to hold a spherical droplet in position.
EnergyLogWriter | print, file, thermodynamic macroscopic quantities | Write the global N, U_pot, U_kin, U_kinTrans, U_kinRot, T, p to file. Duplication with ResultWriter?
ExamplePlugin | example, sample, illustrate, usage | Print user-specifed text at a user-specified position in the code.
ExtendedProfileSampling | sampling, sample, profiles | Sample several regular quantities, e.g. temperature and density, besides more exotic quantities, e.g. chemical potential and energy flux, in spatially resolved profiles along the y-axis.
ExtractPhase | extract, phase, interface, vapor-liquid equilibrium (VLE), local density | Extracts the liquid phase from a vapor-liquid equilibrium (VLE) simulation by evaluating the local density surrounding individual particles.
FixRegion | todo | Fixes particles within a cuboid region to their respective positions. Fixed particles still exert forces onto other particles but they do not move.
FlopRateWriter | performance, FLOP/sec | Calculate the floating point operations per second at which the simulation runs. Only FLOPs in the force calculation are calculated.
Expand Down
4 changes: 2 additions & 2 deletions src/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) {
{
delete _longRangeCorrection;
global_log->info() << "Initializing homogeneous LRC." << endl;
_longRangeCorrection = new Homogeneous(_cutoffRadius, _LJCutoffRadius, _domain, global_simulation);
_longRangeCorrection = new Homogeneous(_cutoffRadius, _LJCutoffRadius, _domain, _moleculeContainer, global_simulation);
}
else if("none" == type)
{
Expand All @@ -551,7 +551,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) {
} else {
delete _longRangeCorrection;
global_log->info() << "Initializing default homogeneous LRC, as no LRC was defined." << endl;
_longRangeCorrection = new Homogeneous(_cutoffRadius, _LJCutoffRadius, _domain, global_simulation);
_longRangeCorrection = new Homogeneous(_cutoffRadius, _LJCutoffRadius, _domain, _moleculeContainer, global_simulation);
}

xmlconfig.changecurrentnode(".."); /* algorithm section */
Expand Down
3 changes: 3 additions & 0 deletions src/Simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ class Simulation {
/** Get pointer to the molecule container */
ParticleContainer* getMoleculeContainer() { return _moleculeContainer; }

/** Get pointer to longrange correction */
LongRangeCorrection* getLongRangeCorrection() { return _longRangeCorrection; }

/** Set the number of time steps to be performed in the simulation */
void setNumTimesteps( unsigned long steps ) { _numberOfTimesteps = steps; }
/** Get the number of time steps to be performed in the simulation */
Expand Down
187 changes: 138 additions & 49 deletions src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.cpp

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/bhfmm/cellProcessors/VectorizedChargeP2PCellProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ class VectorizedChargeP2PCellProcessor {
const RealCalcVec& r2_x, const RealCalcVec& r2_y, const RealCalcVec& r2_z,
const RealCalcVec& qjj,
RealCalcVec& f_x, RealCalcVec& f_y, RealCalcVec& f_z,
RealAccumVec& V_x, RealAccumVec& V_y, RealAccumVec& V_z,
RealAccumVec& V_xx, RealAccumVec& V_yy, RealAccumVec& V_zz,
RealAccumVec& V_xy, RealAccumVec& V_xz, RealAccumVec& V_yz,
RealAccumVec& V_yx, RealAccumVec& V_zx, RealAccumVec& V_zy,
RealAccumVec& sum_upotXpoles, RealAccumVec& sum_virial,
const MaskCalcVec& forceMask);

Expand Down
130 changes: 95 additions & 35 deletions src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ void VectorizedLJP2PCellProcessor :: _loopBodyLJ(
const RealCalcVec& m2_r_x, const RealCalcVec& m2_r_y, const RealCalcVec& m2_r_z,
const RealCalcVec& r2_x, const RealCalcVec& r2_y, const RealCalcVec& r2_z,
RealCalcVec& f_x, RealCalcVec& f_y, RealCalcVec& f_z,
RealAccumVec& V_x, RealAccumVec& V_y, RealAccumVec& V_z,
RealAccumVec& V_xx, RealAccumVec& V_yy, RealAccumVec& V_zz,
RealAccumVec& V_xy, RealAccumVec& V_xz, RealAccumVec& V_yz,
RealAccumVec& V_yx, RealAccumVec& V_zx, RealAccumVec& V_zy,
RealAccumVec& sum_upot6lj, RealAccumVec& sum_virial,
const MaskCalcVec& forceMask,
const RealCalcVec& eps_24, const RealCalcVec& sig2,
Expand Down Expand Up @@ -213,9 +215,15 @@ void VectorizedLJP2PCellProcessor :: _loopBodyLJ(
const RealCalcVec m_dy = m1_r_y - m2_r_y;//1FP (virial) (does not count)
const RealCalcVec m_dz = m1_r_z - m2_r_z;//1FP (virial) (does not count)

V_x = RealAccumVec::convertCalcToAccum(m_dx * f_x);//1FP (virial)
V_y = RealAccumVec::convertCalcToAccum(m_dy * f_y);//1FP (virial)
V_z = RealAccumVec::convertCalcToAccum(m_dz * f_z);//1FP (virial)
V_xx = RealAccumVec::convertCalcToAccum(m_dx * f_x);
V_yy = RealAccumVec::convertCalcToAccum(m_dy * f_y);
V_zz = RealAccumVec::convertCalcToAccum(m_dz * f_z);
V_xy = RealAccumVec::convertCalcToAccum(m_dx * f_y);
V_xz = RealAccumVec::convertCalcToAccum(m_dx * f_z);
V_yz = RealAccumVec::convertCalcToAccum(m_dy * f_z);
V_yx = RealAccumVec::convertCalcToAccum(m_dy * f_x);
V_zx = RealAccumVec::convertCalcToAccum(m_dz * f_x);
V_zy = RealAccumVec::convertCalcToAccum(m_dz * f_y);

// Check if we have to add the macroscopic values up
if (calculateMacroscopic) {
Expand All @@ -226,7 +234,7 @@ void VectorizedLJP2PCellProcessor :: _loopBodyLJ(

sum_upot6lj = sum_upot6lj + upot_masked_accum;//1FP (sum macro)

sum_virial = sum_virial + V_x + V_y + V_z;//1 FP (sum macro) + 2 FP (virial)
sum_virial = sum_virial + V_xx + V_yy + V_zz;//1 FP (sum macro) + 2 FP (virial)
}
}

Expand Down Expand Up @@ -256,9 +264,15 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS
vcp_real_accum * const soa1_ljc_f_x = soa1.getBeginAccum(QuantityType::FORCE, LJC, Coordinate::X);
vcp_real_accum * const soa1_ljc_f_y = soa1.getBeginAccum(QuantityType::FORCE, LJC, Coordinate::Y);
vcp_real_accum * const soa1_ljc_f_z = soa1.getBeginAccum(QuantityType::FORCE, LJC, Coordinate::Z);
vcp_real_accum * const soa1_ljc_V_x = soa1.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::X);
vcp_real_accum * const soa1_ljc_V_y = soa1.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::Y);
vcp_real_accum * const soa1_ljc_V_z = soa1.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::Z);
vcp_real_accum * const soa1_ljc_V_xx = soa1.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::X);
vcp_real_accum * const soa1_ljc_V_yy = soa1.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::Y);
vcp_real_accum * const soa1_ljc_V_zz = soa1.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::Z);
vcp_real_accum * const soa1_ljc_V_xy = soa1.getBeginAccum(QuantityType::VIRIALND1, LJC, Coordinate::X);
vcp_real_accum * const soa1_ljc_V_xz = soa1.getBeginAccum(QuantityType::VIRIALND1, LJC, Coordinate::Y);
vcp_real_accum * const soa1_ljc_V_yz = soa1.getBeginAccum(QuantityType::VIRIALND1, LJC, Coordinate::Z);
vcp_real_accum * const soa1_ljc_V_yx = soa1.getBeginAccum(QuantityType::VIRIALND2, LJC, Coordinate::X);
vcp_real_accum * const soa1_ljc_V_zx = soa1.getBeginAccum(QuantityType::VIRIALND2, LJC, Coordinate::Y);
vcp_real_accum * const soa1_ljc_V_zy = soa1.getBeginAccum(QuantityType::VIRIALND2, LJC, Coordinate::Z);
const int * const soa1_mol_ljc_num = soa1._mol_ljc_num;
const vcp_ljc_id_t * const soa1_ljc_id = soa1._ljc_id;

Expand All @@ -271,9 +285,15 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS
vcp_real_accum * const soa2_ljc_f_x = soa2.getBeginAccum(QuantityType::FORCE, LJC, Coordinate::X);
vcp_real_accum * const soa2_ljc_f_y = soa2.getBeginAccum(QuantityType::FORCE, LJC, Coordinate::Y);
vcp_real_accum * const soa2_ljc_f_z = soa2.getBeginAccum(QuantityType::FORCE, LJC, Coordinate::Z);
vcp_real_accum * const soa2_ljc_V_x = soa2.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::X);
vcp_real_accum * const soa2_ljc_V_y = soa2.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::Y);
vcp_real_accum * const soa2_ljc_V_z = soa2.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::Z);
vcp_real_accum * const soa2_ljc_V_xx = soa2.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::X);
vcp_real_accum * const soa2_ljc_V_yy = soa2.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::Y);
vcp_real_accum * const soa2_ljc_V_zz = soa2.getBeginAccum(QuantityType::VIRIAL, LJC, Coordinate::Z);
vcp_real_accum * const soa2_ljc_V_xy = soa2.getBeginAccum(QuantityType::VIRIALND1, LJC, Coordinate::X);
vcp_real_accum * const soa2_ljc_V_xz = soa2.getBeginAccum(QuantityType::VIRIALND1, LJC, Coordinate::Y);
vcp_real_accum * const soa2_ljc_V_yz = soa2.getBeginAccum(QuantityType::VIRIALND1, LJC, Coordinate::Z);
vcp_real_accum * const soa2_ljc_V_yx = soa2.getBeginAccum(QuantityType::VIRIALND2, LJC, Coordinate::X);
vcp_real_accum * const soa2_ljc_V_zx = soa2.getBeginAccum(QuantityType::VIRIALND2, LJC, Coordinate::Y);
vcp_real_accum * const soa2_ljc_V_zy = soa2.getBeginAccum(QuantityType::VIRIALND2, LJC, Coordinate::Z);
const vcp_ljc_id_t * const soa2_ljc_id = soa2._ljc_id;

vcp_lookupOrMask_single* const soa2_ljc_dist_lookup = my_threadData._ljc_dist_lookup;
Expand Down Expand Up @@ -322,9 +342,15 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS
RealAccumVec sum_fy1 = RealAccumVec::zero();
RealAccumVec sum_fz1 = RealAccumVec::zero();

RealAccumVec sum_Vx1 = RealAccumVec::zero();
RealAccumVec sum_Vy1 = RealAccumVec::zero();
RealAccumVec sum_Vz1 = RealAccumVec::zero();
RealAccumVec sum_V1_xx = RealAccumVec::zero();
RealAccumVec sum_V1_yy = RealAccumVec::zero();
RealAccumVec sum_V1_zz = RealAccumVec::zero();
RealAccumVec sum_V1_xy = RealAccumVec::zero();
RealAccumVec sum_V1_xz = RealAccumVec::zero();
RealAccumVec sum_V1_yz = RealAccumVec::zero();
RealAccumVec sum_V1_yx = RealAccumVec::zero();
RealAccumVec sum_V1_zx = RealAccumVec::zero();
RealAccumVec sum_V1_zy = RealAccumVec::zero();

const RealCalcVec c_r_x1 = RealCalcVec::broadcast(soa1_ljc_r_x + i_ljc_idx);
const RealCalcVec c_r_y1 = RealCalcVec::broadcast(soa1_ljc_r_y + i_ljc_idx);
Expand All @@ -346,7 +372,7 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS

const size_t id_i = soa1_ljc_id[i_ljc_idx];
RealCalcVec fx, fy, fz;
RealAccumVec Vx, Vy, Vz;
RealAccumVec Vxx, Vyy, Vzz, Vxy, Vxz, Vyz, Vyx, Vzx, Vzy;

RealCalcVec eps_24;
RealCalcVec sig2;
Expand All @@ -359,7 +385,9 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS
m1_r_x, m1_r_y, m1_r_z, c_r_x1, c_r_y1, c_r_z1,
m_r_x2, m_r_y2, m_r_z2, c_r_x2, c_r_y2, c_r_z2,
fx, fy, fz,
Vx, Vy, Vz,
Vxx, Vyy, Vzz,
Vxy, Vxz, Vyz,
Vyx, Vzx, Vzy,
sum_upot6lj, sum_virial,
MaskGatherChooser::getForceMask(lookupORforceMask),
eps_24, sig2,
Expand All @@ -377,13 +405,25 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS
sum_fy1 = sum_fy1 + a_fy;
sum_fz1 = sum_fz1 + a_fz;

vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_x, j, Vx, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_y, j, Vy, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_z, j, Vz, lookupORforceMask);

sum_Vx1 = sum_Vx1 + Vx;
sum_Vy1 = sum_Vy1 + Vy;
sum_Vz1 = sum_Vz1 + Vz;
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_xx, j, Vxx, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_yy, j, Vyy, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_zz, j, Vzz, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_xy, j, Vxy, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_xz, j, Vxz, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_yz, j, Vyz, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_yx, j, Vyx, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_zx, j, Vzx, lookupORforceMask);
vcp_simd_load_add_store<MaskGatherChooser>(soa2_ljc_V_zy, j, Vzy, lookupORforceMask);

sum_V1_xx = sum_V1_xx + Vxx;
sum_V1_yy = sum_V1_yy + Vyy;
sum_V1_zz = sum_V1_zz + Vzz;
sum_V1_xy = sum_V1_xy + Vxy;
sum_V1_xz = sum_V1_xz + Vxz;
sum_V1_yz = sum_V1_yz + Vyz;
sum_V1_yx = sum_V1_yx + Vyx;
sum_V1_zx = sum_V1_zx + Vzx;
sum_V1_zy = sum_V1_zy + Vzy;
}
}
#if VCP_VEC_TYPE == VCP_VEC_KNL_GATHER or VCP_VEC_TYPE == VCP_VEC_AVX512F_GATHER
Expand All @@ -407,7 +447,7 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS

const size_t id_i = soa1_ljc_id[i_ljc_idx];
RealCalcVec fx, fy, fz;
RealAccumVec Vx, Vy, Vz;
RealAccumVec Vxx, Vyy, Vzz, Vxy, Vxz, Vyz, Vyx, Vzx, Vzy;

RealCalcVec eps_24;
RealCalcVec sig2;
Expand All @@ -420,7 +460,9 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS
m1_r_x, m1_r_y, m1_r_z, c_r_x1, c_r_y1, c_r_z1,
m_r_x2, m_r_y2, m_r_z2, c_r_x2, c_r_y2, c_r_z2,
fx, fy, fz,
Vx, Vy, Vz,
Vxx, Vyy, Vzz,
Vxy, Vxz, Vyz,
Vyx, Vzx, Vzy,
sum_upot6lj, sum_virial,
remainderM,//use remainder mask as forcemask
eps_24, sig2,
Expand All @@ -438,13 +480,25 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS
sum_fy1 = sum_fy1 + a_fy;
sum_fz1 = sum_fz1 + a_fz;

vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_x, j, Vx, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_y, j, Vy, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_z, j, Vz, lookupORforceMask, remainderM);

sum_Vx1 = sum_Vx1 + Vx;
sum_Vy1 = sum_Vy1 + Vy;
sum_Vz1 = sum_Vz1 + Vz;
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_xx, j, Vxx, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_yy, j, Vyy, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_zz, j, Vzz, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_xy, j, Vxy, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_xz, j, Vxz, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_yz, j, Vyz, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_yx, j, Vyx, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_zx, j, Vzx, lookupORforceMask, remainderM);
vcp_simd_load_add_store_masked<MaskGatherChooser>(soa2_ljc_V_zy, j, Vzy, lookupORforceMask, remainderM);

sum_V1_xx = sum_V1_xx + Vxx;
sum_V1_yy = sum_V1_yy + Vyy;
sum_V1_zz = sum_V1_zz + Vzz;
sum_V1_xy = sum_V1_xy + Vxy;
sum_V1_xz = sum_V1_xz + Vxz;
sum_V1_yz = sum_V1_yz + Vyz;
sum_V1_yx = sum_V1_yx + Vyx;
sum_V1_zx = sum_V1_zx + Vzx;
sum_V1_zy = sum_V1_zy + Vzy;
}
}
#endif
Expand All @@ -453,9 +507,15 @@ void VectorizedLJP2PCellProcessor::_calculatePairs(CellDataSoA & soa1, CellDataS
hSum_Add_Store(soa1_ljc_f_y + i_ljc_idx, sum_fy1);
hSum_Add_Store(soa1_ljc_f_z + i_ljc_idx, sum_fz1);

hSum_Add_Store(soa1_ljc_V_x + i_ljc_idx, sum_Vx1);
hSum_Add_Store(soa1_ljc_V_y + i_ljc_idx, sum_Vy1);
hSum_Add_Store(soa1_ljc_V_z + i_ljc_idx, sum_Vz1);
hSum_Add_Store(soa1_ljc_V_xx + i_ljc_idx, sum_V1_xx);
hSum_Add_Store(soa1_ljc_V_yy + i_ljc_idx, sum_V1_yy);
hSum_Add_Store(soa1_ljc_V_zz + i_ljc_idx, sum_V1_zz);
hSum_Add_Store(soa1_ljc_V_xy + i_ljc_idx, sum_V1_xy);
hSum_Add_Store(soa1_ljc_V_xz + i_ljc_idx, sum_V1_xz);
hSum_Add_Store(soa1_ljc_V_yz + i_ljc_idx, sum_V1_yz);
hSum_Add_Store(soa1_ljc_V_yx + i_ljc_idx, sum_V1_yx);
hSum_Add_Store(soa1_ljc_V_zx + i_ljc_idx, sum_V1_zx);
hSum_Add_Store(soa1_ljc_V_zy + i_ljc_idx, sum_V1_zy);

i_ljc_idx++;
}
Expand Down
4 changes: 3 additions & 1 deletion src/bhfmm/cellProcessors/VectorizedLJP2PCellProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ class VectorizedLJP2PCellProcessor : public CellProcessor {
const RealCalcVec& m2_r_x, const RealCalcVec& m2_r_y, const RealCalcVec& m2_r_z,
const RealCalcVec& r2_x, const RealCalcVec& r2_y, const RealCalcVec& r2_z,
RealCalcVec& f_x, RealCalcVec& f_y, RealCalcVec& f_z,
RealAccumVec& V_x, RealAccumVec& V_y, RealAccumVec& V_z,
RealAccumVec& V_xx, RealAccumVec& V_yy, RealAccumVec& V_zz,
RealAccumVec& V_xy, RealAccumVec& V_xz, RealAccumVec& V_yz,
RealAccumVec& V_yx, RealAccumVec& V_zx, RealAccumVec& V_zy,
RealAccumVec& sum_upot6lj, RealAccumVec& sum_virial,
const MaskCalcVec& forceMask,
const RealCalcVec& eps_24, const RealCalcVec& sig2,
Expand Down
14 changes: 6 additions & 8 deletions src/ensemble/ChemicalPotential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ void ChemicalPotential::grandcanonicalStep(
bool hasInsertion = true;
double ins[3];
unsigned nextid = 0;
double zeroVec[3] = {0.0, 0.0, 0.0};
double zeroVec9[9] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
while (hasDeletion || hasInsertion) {
if (hasDeletion) {
auto m = this->getDeletion(moleculeContainer, minco, maxco);
Expand All @@ -493,10 +495,9 @@ void ChemicalPotential::grandcanonicalStep(
// m->upd_cache(); TODO what to do here? somebody deleted the method "upd_cache"!!! why???
// reset forces and momenta to zero
{
double zeroVec[3] = {0.0, 0.0, 0.0};
m->setF(zeroVec);
m->setM(zeroVec);
m->setVi(zeroVec);
m->setVi(zeroVec9);
}

this->storeMolecule(*m);
Expand Down Expand Up @@ -538,10 +539,9 @@ void ChemicalPotential::grandcanonicalStep(
// m->upd_cache(); TODO: what to do here? somebody deleted the method "upd_cache"!!! why??? -- update caches do no longer exist ;)
// reset forces and torques to zero
if (!this->isWidom()) {
double zeroVec[3] = { 0.0, 0.0, 0.0 };
mit->setF(zeroVec);
mit->setM(zeroVec);
mit->setVi(zeroVec);
mit->setVi(zeroVec9);
}
mit->check(nextid);
#ifndef NDEBUG
Expand Down Expand Up @@ -573,17 +573,15 @@ void ChemicalPotential::grandcanonicalStep(
#endif
if (accept) {
this->_localInsertionsMinusDeletions++;
double zeroVec[3] = { 0.0, 0.0, 0.0 };
tmp.setVi(zeroVec);
tmp.setVi(zeroVec9);
bool inBoxCheckedAlready = false, checkWhetherDuplicate = false, rebuildCaches = true;
moleculeContainer->addParticle(tmp, inBoxCheckedAlready, checkWhetherDuplicate, rebuildCaches);
} else {
// moleculeContainer->deleteMolecule(m->getID(), m->r(0), m->r(1), m->r(2));
// moleculeContainer->_cells[cellid].deleteMolecule(m->getID());
double zeroVec[3] = { 0.0, 0.0, 0.0 };
mit->setF(zeroVec);
mit->setM(zeroVec);
mit->setVi(zeroVec);
mit->setVi(zeroVec9);
mit->check(mit->getID());
// moleculeContainer->_particles.erase(mit);
}
Expand Down
Loading