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

Cleanup of readers #332

Merged
merged 6 commits into from
Jan 15, 2025
Merged
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
3 changes: 1 addition & 2 deletions doc/Plugins_Summary.dox
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Plugin name | Up to 5 Keywords | Short Description (one line)
Adios2Reader | input, checkpoint, visualization, parallel, particle configurations, MegaMol | Requires ENABLE_ADIOS2=ON (downloads and installs ADIOS2 automatically, alternatively can use your preinstalled ADIOS2 with FIND_PACKAGE_ADIOS2=ON). Reads checkpoint for further computation. Use bpls tool (next to MarDyn executable) for investigation of ADIOS2 files or directories (*.bp).
Adios2Writer | output, checkpoint, visualization, parallel, particle configurations, MegaMol | Requires ENABLE_ADIOS2=ON (downloads and installs ADIOS2 automatically, alternatively can use your preinstalled ADIOS2 with FIND_PACKAGE_ADIOS2=ON). Writes out particle configuration including position, velocity, angular momentum, quaternions for all components. Also provides meta information such as the full configuration file, component information, process count, and bounding box.
CavityWriter | cavity, output, profile, grid | Sets up a grid of pseudo-molecules that check for neighbours in radius. Threshold determines if grid point counts as cavity or not. Output in .xyz format.
CheckpointWriter | checkpoint, legacy | (Legacy) Checkpoint writer. Hint: use <type>binary</type> to speed-up. See also MPICheckpointWriter and MPI_IOCheckpointWriter.
CheckpointWriter | checkpoint, legacy | (Legacy) Checkpoint writer. Hint: use <type>binary</type> to speed-up.
COMaligner | alignment, particleContainer utility, visualization | Calculates Center of Mass (COM) of all particles and aligns it with center of simulation box. Dimension/frequency/speed of alignment can be controlled via XML.
CommunicationPartnerWriter | mpi, communication, output, debugging | Prints the CommunicationPartners for each rank in a separate file.
DecompWriter | mpi, print | Writes information on the MPI Domain Decomposition. For each rank the boxmin and boxmax is printed.
Expand Down Expand Up @@ -46,7 +46,6 @@ MettDeamonFeedrateDirector | feed rate, director, reservoir, stationary, evapora
Mirror | reflection, mirror plane, wall, boundary condition | Reflect particles at a mirror plane employing different algorithms. This can be used as a simple wall or even more complex boundary conditions.
MmpldWriter | visualization, particle configurations, MegaMol, mmpld, binary | Output plugin writing visualization files containing multiple subsequently sampled frames of particle configurations in the binary MegaMol Particle List Data file format (MMPLD).
MmspdBinWriter | visualization, particle configurations, MegaMol, mmspd, binary | Output plugin writing visualization files containing multiple subsequently sampled frames of particle configurations in the binary MegaMol Simple Particle Data file format (MMSPD).
MPI_IOCheckpointWriter | checkpointing | WIP, not functionable
MPICheckpointWriter | checkpointing | WIP, not functionable (no proper reader existing)
ODF | orientation distribution function | Calculates the distribution of mutual orientations between dipolar molecules and writes them into an output. Always use dipolar vector [0 0 1] in the input when using this plugin. Only tested for molecules with exactly one dipole site. Application to other molecules should be possible with minor adjustments and some testing.
Permittivity | todo | Samples the relative permittivity for pure/mixed Stockmayer fluids and mixtures containing Stockmayer fluids and unpolar fluids. Requires long sampling times (i.e. several million steps). Using global thermostat is recommended.
Expand Down
218 changes: 0 additions & 218 deletions src/ensemble/PressureGradient.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,221 +113,3 @@ class PressureGradient {
std::map<unsigned int, unsigned int> _globalVelocityQueuelength;
};
#endif /* PRESSUREGRADIENT_H_ */

/* PROCEDURE TO REMOVE UNUSED PRESSURE GRADIENT FROM CODEBASE:

####### REMOVED PG FROM DOMAIN CONSTRUCTOR -> REMOVED UNIVERSALPG -> REMOVED FORWARD DECL IN .H AND INCLUDE IN .CPP

this->_universalPG = pg;
// after: checkpointfilestream << _epsilonRF << std::endl;
std::map<unsigned, unsigned> componentSets = this->_universalPG->getComponentSets();
for( std::map<unsigned, unsigned>::const_iterator uCSIDit = componentSets.begin();
uCSIDit != componentSets.end();
uCSIDit++ )
{
if(uCSIDit->first > 100) continue;
checkpointfilestream << " S\t" << 1+uCSIDit->first << "\t" << uCSIDit->second << "\n";
}
std::map<unsigned, double> tau = this->_universalPG->getTau();
for( std::map<unsigned, double>::const_iterator gTit = tau.begin();
gTit != tau.end();
gTit++ )
{
unsigned cosetid = gTit->first;
double* ttargetv = this->_universalPG->getTargetVelocity(cosetid);
double* tacc = this->_universalPG->getAdditionalAcceleration(cosetid);
checkpointfilestream << " A\t" << cosetid << "\t"
<< ttargetv[0] << " " << ttargetv[1] << " " << ttargetv[2] << "\t"
<< gTit->second << "\t"
<< tacc[0] << " " << tacc[1] << " " << tacc[2] << "\n";
delete ttargetv;
delete tacc;
}

// Function in Domain
PressureGradient* getPG() { return this->_universalPG; }

####### REMOVED FORWARD DECLARATION AND INCLUDE FROM SIMULATION.H/.CPP

PressureGradient* _pressureGradient;
//after: _longRangeCorrection->calculateLongRange(); in #######
if (_pressureGradient->isAcceleratingUniformly()) {
Log::global_log->info() << "Initialising uniform acceleration." << std::endl;
unsigned long uCAT = _pressureGradient->getUCAT();
Log::global_log->info() << "uCAT: " << uCAT << " steps." << std::endl;
_pressureGradient->determineAdditionalAcceleration(
_domainDecomposition, _moleculeContainer, uCAT
* _integrator->getTimestepLength());
Log::global_log->info() << "Uniform acceleration initialised." << std::endl;
}

// first in simulate()
// (universal) constant acceleration (number of) timesteps
unsigned uCAT = _pressureGradient->getUCAT();

// after: _domain->calculateThermostatDirectedVelocity(_moleculeContainer); in simulate()
if (_pressureGradient->isAcceleratingUniformly()) {
if (!(_simstep % uCAT)) {
Log::global_log->debug() << "Determine the additional acceleration" << std::endl;
_pressureGradient->determineAdditionalAcceleration(
_domainDecomposition, _moleculeContainer, uCAT
* _integrator->getTimestepLength());
}
Log::global_log->debug() << "Process the uniform acceleration" << std::endl;
_integrator->accelerateUniformly(_moleculeContainer, _domain);
_pressureGradient->adjustTau(this->_integrator->getTimestepLength());
}

// in initialize() before Domain()
Log::global_log->info() << "Creating PressureGradient ... " << std::endl;
_pressureGradient = new PressureGradient(ownrank);

####### REMOVED FUNCTION ONLY CALLED BY PG FROM INTEGRATOR, LEAPFROG AND LEAPFROGRMM

// Integrator
virtual void accelerateUniformly(
ParticleContainer* molCont,
Domain* domain
) = 0;

virtual void accelerateInstantaneously(
ParticleContainer* molCont,
Domain* domain
) = 0;

// LeapfrogRMM
void accelerateUniformly(
ParticleContainer* molCont,
Domain* domain
) {}

void accelerateInstantaneously(
ParticleContainer* molCont,
Domain* domain
) {}

// Leapfrog
virtual void accelerateUniformly(
ParticleContainer* molCont,
Domain* domain
);

virtual void accelerateInstantaneously(
ParticleContainer* molCont,
Domain* domain
);

void Leapfrog::accelerateUniformly(ParticleContainer* molCont, Domain* domain) {
std::map<unsigned, double>* additionalAcceleration = domain->getPG()->getUAA();
std::vector<Component> comp = *(_simulation.getEnsemble()->getComponents());
std::vector<Component>::iterator compit;
std::map<unsigned, double> componentwiseVelocityDelta[3];
for (compit = comp.begin(); compit != comp.end(); compit++) {
unsigned cosetid = domain->getPG()->getComponentSet(compit->ID());
if (cosetid != 0)
for (unsigned d = 0; d < 3; d++)
componentwiseVelocityDelta[d][compit->ID()] = _timestepLength * additionalAcceleration[d][cosetid];
else
for (unsigned d = 0; d < 3; d++)
componentwiseVelocityDelta[d][compit->ID()] = 0;
}

#if defined(_OPENMP)
#pragma omp parallel
#endif
{
for (auto thismol = molCont->iterator(); thismol.isValid(); ++thismol) {
unsigned cid = thismol->componentid();
mardyn_assert(componentwiseVelocityDelta[0].find(cid) != componentwiseVelocityDelta[0].end());
thismol->vadd(componentwiseVelocityDelta[0][cid],
componentwiseVelocityDelta[1][cid],
componentwiseVelocityDelta[2][cid]);
}
}
}

void Leapfrog::accelerateInstantaneously(ParticleContainer* molCont, Domain* domain) {
std::vector<Component> comp = *(_simulation.getEnsemble()->getComponents());
std::vector<Component>::iterator compit;
std::map<unsigned, double> componentwiseVelocityDelta[3];
for (compit = comp.begin(); compit != comp.end(); compit++) {
unsigned cosetid = domain->getPG()->getComponentSet(compit->ID());
if (cosetid != 0)
for (unsigned d = 0; d < 3; d++)
componentwiseVelocityDelta[d][compit->ID()] = domain->getPG()->getMissingVelocity(cosetid, d);
else
for (unsigned d = 0; d < 3; d++)
componentwiseVelocityDelta[d][compit->ID()] = 0;
}

#if defined(_OPENMP)
#pragma omp parallel
#endif
{

for (auto thismol = molCont->iterator(); thismol.isValid(); ++thismol) {
unsigned cid = thismol->componentid();
mardyn_assert(componentwiseVelocityDelta[0].find(cid) != componentwiseVelocityDelta[0].end());
thismol->vadd(componentwiseVelocityDelta[0][cid],
componentwiseVelocityDelta[1][cid],
componentwiseVelocityDelta[2][cid]);
}
}
}

##### removed getPG() related functions

// ASCIIReader.cpp after: else if((token == "NumberOfMolecules") || (token == "N")) {

else if((token == "AssignCoset") || (token == "S")) {
unsigned component_id, cosetid;
_phaseSpaceHeaderFileStream >> component_id >> cosetid;
component_id--; // FIXME: Component ID starting with 0 in program ...
domain->getPG()->assignCoset( component_id, cosetid );
}
else if((token == "Accelerate") || (token == "A")) {
unsigned cosetid;
_phaseSpaceHeaderFileStream >> cosetid;
double v[3];
for(unsigned d = 0; d < 3; d++)
_phaseSpaceHeaderFileStream >> v[d];
double tau;
_phaseSpaceHeaderFileStream >> tau;
double ainit[3];
for(unsigned d = 0; d < 3; d++)
_phaseSpaceHeaderFileStream >> ainit[d];
domain->getPG()->specifyComponentSet(cosetid, v, tau, ainit, timestep);
}

// MPI_IOReader after: else if((token == "NumberOfMolecules") || (token == "N")) {

else if((token == "AssignCoset") || (token == "S")) {
unsigned component_id, cosetid;
_phaseSpaceHeaderFileStream >> component_id >> cosetid;
component_id--; // FIXME: Component ID starting with 0 in program ...
domain->getPG()->assignCoset( component_id, cosetid );
}
else if((token == "Accelerate") || (token == "A")) {
unsigned cosetid;
_phaseSpaceHeaderFileStream >> cosetid;
double v[3];
for(unsigned d = 0; d < 3; d++)
_phaseSpaceHeaderFileStream >> v[d];
double tau;
_phaseSpaceHeaderFileStream >> tau;
double ainit[3];
for(unsigned d = 0; d < 3; d++)
_phaseSpaceHeaderFileStream >> ainit[d];
domain->getPG()->specifyComponentSet(cosetid, v, tau, ainit, timestep);
}
##### Removed unused includes
Simulation
Leapfrog
LeapfrogRMM
ASCIIReader
MPI_IOReader
BinaryReader
LinkedCellsTest
MDGenerator
- inhereting generators
*/
Loading
Loading