-
Notifications
You must be signed in to change notification settings - Fork 11
System
System is the base UAMMD module, any other module or submodule needs a reference to a System instance.
System contains information about the machine UAMMD is running on and offers a series of utilities like a CPU random number generator and a logging infrastructure. Furthermore, System handles initializing and deleting the CUDA environment (i.e selecting a GPU to run on).
System should be the first thing to create in a UAMMD simulation file[1], see any of the examples in examples folder.
You should create a System first thing before any UAMMD call and call sys->finish last thing.
...
int main(int argc, char *argv[]){
auto sys = std::make_shared<System>(argc, argv);
//You may seed the rng algorithm here. The default seed is obtained from time(NULL).
sys->rng().setSeed(time(NULL));
...
//This will ensure the termination of any UAMMD related operation.
sys->finish();
return 0;
}
You can access a Xorshift128plus random generator from System. This generator should be used for things like seeding other generators, maybe creating initial configurations.
...
//Set the seed of the rng
sys->rng().setSeed(123124);
//Get a random integer between 0 and 2^64-1
uint64_t Z64 = sys->rng().next();
//Get a random integer between 0 and 2^32-1
uint32_t Z32 = sys->rng().next32();
//Get a uniform number between a and b
double a=0, b=1;
double Zf = sys->rng().uniform(a,b);
//Get a gaussian number with mean a and std b
double Zg = sys->rng().gaussian(a,b);
...
System provides a logging engine with several levels of relevance for the message. The available levels are in the System::level enum in System.h. You can see the following in this example:
sys->log<System::CRITICAL>("The program will be terminated after printing this message!");
sys->log<System::ERROR>("There was an error, but I might be able to circumvent it!");
sys->log<System::WARNING>("Something happen that might be problematic, watch out! (I will keep running OK though)");
sys->log<System::MESSAGE>("Here you have some useful information I want you to know!");
sys->log<System::STDERR>("This goes straight to stderr");
sys->log<System::STDOUT>("This goes straight to stdout");
sys->log<System::DEBUG>("A debug message!");
sys->log<System::DEBUG1>("A more internal debug message!");
...
sys->log<System::DEBUG7>("There are 7 levels of debug!");
The maximum level of logging that will be processed will be the compile constant maxLogLevel in Log.h. Anything below this level will not even be compiled, so do not be worried about performance when writing debug logs. The highest level of logging that will print DEBUG messages is maxLogLevel = 6. maxLoglevel=13 will print up to DEBUG7, while maxLogLevel=0 will only print CRITICAL errors.
int getargc(), char** getargv() -> returns the argc and argv provided at System creation.
[1] https://github.com/RaulPPelaez/UAMMD/wiki/Simulation-File
-
-
1. PairForces
2. NbodyForces
3. ExternalForces
4. BondedForces
5. AngularBondedForces
6. TorsionalBondedForces
7. Poisson (Electrostatics) -
-
MD (Molecular Dynamics)
1. VerletNVT
2. VerletNVE - BD Brownian Dynamics
-
BDHI Brownian Dynamics with Hydrodynamic Interactions
1. EulerMaruyama
1.1 BDHI_Cholesky Brownian displacements through Cholesky factorization.
1.2 BDHI_Lanczos Brownian displacements through Lanczos algorithm.
1.3 BDHI_PSE Positively Split Edwald.
1.4 BDHI_FCM Force Coupling Method. - DPD Dissipative Particle Dynamics
- SPH Smoothed Particle Hydrodynamics
-
Hydrodynamics
1. ICM Inertial Coupling Method.
2. FIB Fluctuating Immerse Boundary.
3. Quasi2D Quasi2D hydrodynamics
-
MD (Molecular Dynamics)
-
- 1. Neighbour Lists
-
1. Programming Tools
2. Utils
-
1. Transverser
2. Functor
3. Potential
-
1. Particle Data
2. Particle Group
3. System
4. Parameter updatable
-
1. Tabulated Function
2. Postprocessing tools
3. InputFile
4. Tests
5. Allocator
6. Temporary memory
7. Immersed Boundary (IBM)
-
1. NBody
2. Neighbour Lists
3. Python wrappers
- 1. Superpunto