├── .envrc ├── .github └── workflows │ ├── ci.yaml │ └── python_wheels.yaml ├── .gitignore ├── .gitmodules ├── .vscode ├── extensions.json └── launch.json ├── CMakeLists.txt ├── COPYING ├── Doxyfile ├── LICENSE.txt ├── Readme.md ├── cmake └── Modules │ ├── FindAVCodec.cmake │ ├── FindAVUtil.cmake │ ├── FindGLEW.cmake │ ├── FindGLX.cmake │ ├── FindNumPy.cmake │ ├── FindOpenVR.cmake │ ├── GetGitRevisionDescription.cmake │ ├── GetGitRevisionDescription.cmake.in │ ├── LibFindMacros.cmake │ └── SystemInformation.cmake ├── copyright ├── default.nix ├── derivation.nix ├── description.txt ├── docs ├── coilicon.svg ├── coillogo.svg ├── coilsplash.svg ├── dynamologo.svg ├── dynamotinylogo.svg ├── frontpage.doxy ├── tinylogo.svg ├── todo.org └── users.gpg ├── extern └── rapidXML │ ├── license.txt │ ├── rapidxml.hpp │ ├── rapidxml_iterators.hpp │ ├── rapidxml_print.hpp │ └── rapidxml_utils.hpp ├── pyproject.toml ├── pytest.ini ├── scripts ├── HCPHS.py ├── HDtether.py ├── HS_TPT.py ├── HStetherNVE.py ├── HStetherNVT_phi.py ├── SW_eos.py ├── SWtether.py ├── TPT_streamlit.py ├── benchmark_code.py ├── example.py ├── requirements.txt └── stltovertices.sh ├── src ├── Readme.md ├── coil │ ├── CMakeLists.txt │ ├── build_glade_file.py │ ├── clwingtk.gladexml │ ├── coil │ │ ├── RenderObj │ │ │ ├── Attribute.hpp │ │ │ ├── AttributeColorSelector.hpp │ │ │ ├── AttributeOrientationSelector.hpp │ │ │ ├── AttributeSelectors.cpp │ │ │ ├── AttributeSelectors.hpp │ │ │ ├── DataSet.cpp │ │ │ ├── DataSet.hpp │ │ │ ├── Glyphs.cpp │ │ │ ├── Glyphs.hpp │ │ │ ├── Light.cpp │ │ │ ├── Light.hpp │ │ │ ├── RenderObj.cpp │ │ │ ├── RenderObj.hpp │ │ │ ├── Surface.cpp │ │ │ ├── Surface.hpp │ │ │ ├── TriangleMesh.cpp │ │ │ ├── TriangleMesh.hpp │ │ │ ├── Triangles.cpp │ │ │ ├── Triangles.hpp │ │ │ ├── Volume.cpp │ │ │ ├── Volume.hpp │ │ │ ├── console.cpp │ │ │ └── console.hpp │ │ ├── clWindow.cpp │ │ ├── clWindow.hpp │ │ ├── coilMaster.cpp │ │ ├── coilMaster.hpp │ │ ├── coilWindow.hpp │ │ ├── filters │ │ │ ├── DOF.hpp │ │ │ ├── SSAO.cpp │ │ │ ├── SSAO.hpp │ │ │ ├── bilateralBlur.cpp │ │ │ ├── bilateralBlur.hpp │ │ │ ├── filter.cpp │ │ │ ├── filter.hpp │ │ │ ├── filterWrapper.hpp │ │ │ └── multiply.hpp │ │ ├── gladexmlfile.cpp │ │ └── images │ │ │ ├── DataSet_Icon.svg │ │ │ ├── Function_Icon.svg │ │ │ ├── Glyphs_Icon.svg │ │ │ ├── Light_Icon.svg │ │ │ ├── Volume_Icon.svg │ │ │ ├── addFunction_Icon.svg │ │ │ ├── addLight_Icon.svg │ │ │ ├── cammode_fps.svg │ │ │ ├── cammode_rotate_cursor.svg │ │ │ ├── cammode_rotate_world.svg │ │ │ ├── camnegx.svg │ │ │ ├── camnegy.svg │ │ │ ├── camnegz.svg │ │ │ ├── camplusx.svg │ │ │ ├── camplusy.svg │ │ │ ├── camplusz.svg │ │ │ ├── camrescale.svg │ │ │ ├── coilicon.svg │ │ │ ├── coilsplash.svg │ │ │ ├── default_RObj_Icon.svg │ │ │ ├── delete_Icon.svg │ │ │ ├── delete_off_Icon.svg │ │ │ ├── images.cpp │ │ │ ├── images.hpp │ │ │ ├── makeimagecpp.sh │ │ │ ├── shadow_off_Icon.svg │ │ │ ├── shadow_on_Icon.svg │ │ │ ├── visible_off_Icon.svg │ │ │ └── visible_on_Icon.svg │ ├── examples │ │ └── particletest.cpp │ ├── programs │ │ └── coilvol.cpp │ └── wrap_openvr.py ├── dynamo │ ├── dynamo │ │ ├── 1particleEventData.hpp │ │ ├── 2particleEventData.hpp │ │ ├── BC │ │ │ ├── BC.cpp │ │ │ ├── BC.hpp │ │ │ ├── LEBC.cpp │ │ │ ├── LEBC.hpp │ │ │ ├── None.cpp │ │ │ ├── None.hpp │ │ │ ├── PBC.cpp │ │ │ ├── PBC.hpp │ │ │ └── include.hpp │ │ ├── NparticleEventData.hpp │ │ ├── base.cpp │ │ ├── base.hpp │ │ ├── coilRenderObj.hpp │ │ ├── coordinator │ │ │ ├── coordinator.cpp │ │ │ ├── coordinator.hpp │ │ │ └── engine │ │ │ │ ├── compressor.cpp │ │ │ │ ├── compressor.hpp │ │ │ │ ├── engine.cpp │ │ │ │ ├── engine.hpp │ │ │ │ ├── include.hpp │ │ │ │ ├── replexer.cpp │ │ │ │ ├── replexer.hpp │ │ │ │ ├── single.cpp │ │ │ │ └── single.hpp │ │ ├── dynamics │ │ │ ├── baloon.cpp │ │ │ ├── baloon.hpp │ │ │ ├── compression.cpp │ │ │ ├── compression.hpp │ │ │ ├── dynamics.cpp │ │ │ ├── dynamics.hpp │ │ │ ├── gravity.cpp │ │ │ ├── gravity.hpp │ │ │ ├── include.hpp │ │ │ ├── multicanonical.cpp │ │ │ ├── multicanonical.hpp │ │ │ ├── multicanonical_contactmap.cpp │ │ │ ├── multicanonical_contactmap.hpp │ │ │ ├── newtonian.cpp │ │ │ ├── newtonian.hpp │ │ │ ├── viscous.cpp │ │ │ └── viscous.hpp │ │ ├── ensemble.cpp │ │ ├── ensemble.hpp │ │ ├── eventtypes.cpp │ │ ├── eventtypes.hpp │ │ ├── globals │ │ │ ├── PBCSentinel.cpp │ │ │ ├── PBCSentinel.hpp │ │ │ ├── ParabolaSentinel.cpp │ │ │ ├── ParabolaSentinel.hpp │ │ │ ├── cells.cpp │ │ │ ├── cells.hpp │ │ │ ├── cellsShearing.cpp │ │ │ ├── cellsShearing.hpp │ │ │ ├── francesco.cpp │ │ │ ├── francesco.hpp │ │ │ ├── global.cpp │ │ │ ├── global.hpp │ │ │ ├── include.hpp │ │ │ ├── neighbourList.hpp │ │ │ ├── socells.cpp │ │ │ ├── socells.hpp │ │ │ ├── volumetric_potential.cpp │ │ │ ├── volumetric_potential.hpp │ │ │ ├── waker.cpp │ │ │ └── waker.hpp │ │ ├── include.hpp │ │ ├── inputplugins │ │ │ ├── cells │ │ │ │ ├── bcc.hpp │ │ │ │ ├── binary.hpp │ │ │ │ ├── cell.hpp │ │ │ │ ├── fcc.hpp │ │ │ │ ├── hcp.hpp │ │ │ │ ├── helix.hpp │ │ │ │ ├── include.hpp │ │ │ │ ├── linearRod.hpp │ │ │ │ ├── mirror.hpp │ │ │ │ ├── random.hpp │ │ │ │ ├── randomise.hpp │ │ │ │ ├── randomwalk.hpp │ │ │ │ ├── ringRod.hpp │ │ │ │ ├── ringSnake.hpp │ │ │ │ ├── sc.hpp │ │ │ │ └── triangleIntersection.hpp │ │ │ ├── compression.cpp │ │ │ ├── compression.hpp │ │ │ ├── include.hpp │ │ │ ├── inputplugin.cpp │ │ │ ├── inputplugin.hpp │ │ │ ├── packer.cpp │ │ │ └── packer.hpp │ │ ├── interactions │ │ │ ├── DSMC.cpp │ │ │ ├── DSMC.hpp │ │ │ ├── PRIME.cpp │ │ │ ├── PRIME.hpp │ │ │ ├── captures.cpp │ │ │ ├── captures.hpp │ │ │ ├── dumbbells.cpp │ │ │ ├── dumbbells.hpp │ │ │ ├── hardsphere.cpp │ │ │ ├── hardsphere.hpp │ │ │ ├── include.hpp │ │ │ ├── interaction.cpp │ │ │ ├── interaction.hpp │ │ │ ├── lines.cpp │ │ │ ├── lines.hpp │ │ │ ├── nullInteraction.cpp │ │ │ ├── nullInteraction.hpp │ │ │ ├── parallelcubes.cpp │ │ │ ├── parallelcubes.hpp │ │ │ ├── potentials │ │ │ │ ├── lennard_jones.cpp │ │ │ │ ├── lennard_jones.hpp │ │ │ │ ├── potential.cpp │ │ │ │ └── potential.hpp │ │ │ ├── squarebond.cpp │ │ │ ├── squarebond.hpp │ │ │ ├── squarewell.cpp │ │ │ ├── squarewell.hpp │ │ │ ├── stepped.cpp │ │ │ ├── stepped.hpp │ │ │ ├── swsequence.cpp │ │ │ ├── swsequence.hpp │ │ │ ├── thinthread.cpp │ │ │ └── thinthread.hpp │ │ ├── locals │ │ │ ├── boundary.cpp │ │ │ ├── boundary.hpp │ │ │ ├── boundary │ │ │ │ ├── object.cpp │ │ │ │ └── object.hpp │ │ │ ├── lcylinder.cpp │ │ │ ├── lcylinder.hpp │ │ │ ├── local.cpp │ │ │ ├── local.hpp │ │ │ ├── lroughwall.cpp │ │ │ ├── lroughwall.hpp │ │ │ ├── lwall.cpp │ │ │ ├── lwall.hpp │ │ │ ├── oscillatingplate.cpp │ │ │ ├── oscillatingplate.hpp │ │ │ ├── trianglemesh.cpp │ │ │ └── trianglemesh.hpp │ │ ├── outputplugins │ │ │ ├── brenner.cpp │ │ │ ├── brenner.hpp │ │ │ ├── collMatrix.cpp │ │ │ ├── collMatrix.hpp │ │ │ ├── contactmap.cpp │ │ │ ├── contactmap.hpp │ │ │ ├── eventEffects.cpp │ │ │ ├── eventEffects.hpp │ │ │ ├── eventtypetracking.cpp │ │ │ ├── eventtypetracking.hpp │ │ │ ├── include.hpp │ │ │ ├── intEnergyHist.cpp │ │ │ ├── intEnergyHist.hpp │ │ │ ├── misc.cpp │ │ │ ├── misc.hpp │ │ │ ├── msd.cpp │ │ │ ├── msd.hpp │ │ │ ├── msdOrientational.cpp │ │ │ ├── msdOrientational.hpp │ │ │ ├── outputplugin.cpp │ │ │ ├── outputplugin.hpp │ │ │ ├── tickerproperty │ │ │ │ ├── OrientationalOrder.cpp │ │ │ │ ├── OrientationalOrder.hpp │ │ │ │ ├── PolarNematic.cpp │ │ │ │ ├── PolarNematic.hpp │ │ │ │ ├── SCparameter.cpp │ │ │ │ ├── SCparameter.hpp │ │ │ │ ├── SHcrystal.cpp │ │ │ │ ├── SHcrystal.hpp │ │ │ │ ├── chainBondAngles.cpp │ │ │ │ ├── chainBondAngles.hpp │ │ │ │ ├── chainBondLength.cpp │ │ │ │ ├── chainBondLength.hpp │ │ │ │ ├── chainContactMap.cpp │ │ │ │ ├── chainContactMap.hpp │ │ │ │ ├── chaintorsion.cpp │ │ │ │ ├── chaintorsion.hpp │ │ │ │ ├── craig.cpp │ │ │ │ ├── craig.hpp │ │ │ │ ├── include.hpp │ │ │ │ ├── kenergyticker.cpp │ │ │ │ ├── kenergyticker.hpp │ │ │ │ ├── msdOrientationalCorrelator.cpp │ │ │ │ ├── msdOrientationalCorrelator.hpp │ │ │ │ ├── msdcorrelator.cpp │ │ │ │ ├── msdcorrelator.hpp │ │ │ │ ├── overlap.cpp │ │ │ │ ├── overlap.hpp │ │ │ │ ├── periodmsd.cpp │ │ │ │ ├── periodmsd.hpp │ │ │ │ ├── radialdist.cpp │ │ │ │ ├── radialdist.hpp │ │ │ │ ├── radiusGyration.cpp │ │ │ │ ├── radiusGyration.hpp │ │ │ │ ├── structureImage.cpp │ │ │ │ ├── structureImage.hpp │ │ │ │ ├── ticker.cpp │ │ │ │ ├── ticker.hpp │ │ │ │ ├── vacf.cpp │ │ │ │ ├── vacf.hpp │ │ │ │ ├── vel_dist.cpp │ │ │ │ ├── vel_dist.hpp │ │ │ │ ├── velprof.cpp │ │ │ │ ├── velprof.hpp │ │ │ │ ├── vtk.cpp │ │ │ │ └── vtk.hpp │ │ │ ├── trajectory.cpp │ │ │ └── trajectory.hpp │ │ ├── particle.cpp │ │ ├── particle.hpp │ │ ├── property.hpp │ │ ├── ranges │ │ │ ├── IDPairRange.hpp │ │ │ ├── IDPairRangeAll.hpp │ │ │ ├── IDPairRangeChainEnds.hpp │ │ │ ├── IDPairRangeChains.hpp │ │ │ ├── IDPairRangeIntraChains.hpp │ │ │ ├── IDPairRangeList.hpp │ │ │ ├── IDPairRangeNone.hpp │ │ │ ├── IDPairRangeRangePair.hpp │ │ │ ├── IDPairRangeRings.hpp │ │ │ ├── IDPairRangeSelf.hpp │ │ │ ├── IDPairRangeSingle.hpp │ │ │ ├── IDPairRangeUnion.hpp │ │ │ ├── IDRange.hpp │ │ │ ├── IDRangeAll.hpp │ │ │ ├── IDRangeList.hpp │ │ │ ├── IDRangeNone.hpp │ │ │ ├── IDRangeRange.hpp │ │ │ ├── IDRangeUnion.hpp │ │ │ ├── include.hpp │ │ │ └── range.cpp │ │ ├── schedulers │ │ │ ├── dumbsched.cpp │ │ │ ├── dumbsched.hpp │ │ │ ├── include.hpp │ │ │ ├── neighbourlist.cpp │ │ │ ├── neighbourlist.hpp │ │ │ ├── scheduler.cpp │ │ │ ├── scheduler.hpp │ │ │ ├── sorters │ │ │ │ ├── CBTFEL.hpp │ │ │ │ ├── FEL.cpp │ │ │ │ ├── FEL.hpp │ │ │ │ ├── MinMaxPEL.hpp │ │ │ │ ├── boundedPQFEL.hpp │ │ │ │ ├── heapPEL.hpp │ │ │ │ └── referenceFEL.hpp │ │ │ ├── systemonly.cpp │ │ │ └── systemonly.hpp │ │ ├── simulation.cpp │ │ ├── simulation.hpp │ │ ├── species │ │ │ ├── fixedCollider.cpp │ │ │ ├── fixedCollider.hpp │ │ │ ├── include.hpp │ │ │ ├── inertia.hpp │ │ │ ├── point.cpp │ │ │ ├── point.hpp │ │ │ ├── species.cpp │ │ │ ├── species.hpp │ │ │ ├── sphericalTop.cpp │ │ │ └── sphericalTop.hpp │ │ ├── systems │ │ │ ├── DSMCspheres.cpp │ │ │ ├── DSMCspheres.hpp │ │ │ ├── andersenThermostat.cpp │ │ │ ├── andersenThermostat.hpp │ │ │ ├── francesco.cpp │ │ │ ├── francesco.hpp │ │ │ ├── nblistCompressionFix.cpp │ │ │ ├── nblistCompressionFix.hpp │ │ │ ├── rescale.cpp │ │ │ ├── rescale.hpp │ │ │ ├── rotateGravity.cpp │ │ │ ├── rotateGravity.hpp │ │ │ ├── sleep.cpp │ │ │ ├── sleep.hpp │ │ │ ├── snapshot.cpp │ │ │ ├── snapshot.hpp │ │ │ ├── sysTicker.cpp │ │ │ ├── sysTicker.hpp │ │ │ ├── system.cpp │ │ │ ├── system.hpp │ │ │ ├── tHalt.cpp │ │ │ ├── tHalt.hpp │ │ │ ├── umbrella.cpp │ │ │ ├── umbrella.hpp │ │ │ ├── visualizer.cpp │ │ │ └── visualizer.hpp │ │ ├── topology │ │ │ ├── PRIME.cpp │ │ │ ├── PRIME.hpp │ │ │ ├── chain.cpp │ │ │ ├── chain.hpp │ │ │ ├── include.hpp │ │ │ ├── topology.cpp │ │ │ └── topology.hpp │ │ └── units │ │ │ └── units.hpp │ ├── programs │ │ ├── dynahist_rw.cpp │ │ ├── dynamaprmsd │ │ ├── dynamo2xyz │ │ ├── dynamod.cpp │ │ ├── dynapotential.cpp │ │ ├── dynarmsd │ │ ├── dynarun.cpp │ │ └── dynatransport │ └── tests │ │ ├── 2dstepped_potential_test.cpp │ │ ├── binaryhardsphere_test.cpp │ │ ├── dynamo.py │ │ ├── dynatransport_test.py │ │ ├── event_sorters_test.cpp │ │ ├── gravityplate_test.cpp │ │ ├── hardsphere_test.cpp │ │ ├── infmass_spheres_test.cpp │ │ ├── lines_test.cpp │ │ ├── multicanonical_cmap_test.py │ │ ├── polymer_test.cpp │ │ ├── replex_test.py │ │ ├── scheduler_sorter_test.cpp │ │ ├── shearing_test.cpp │ │ ├── squarewell_test.cpp │ │ ├── squarewellwall_test.cpp │ │ ├── static_spheres_test.cpp │ │ ├── swingspheres_test.cpp │ │ └── thermalisedwalls_test.cpp ├── magnet │ ├── CMakeLists.txt │ ├── magnet │ │ ├── CL │ │ │ ├── bitonicsort.hpp │ │ │ ├── detail │ │ │ │ ├── common.hpp │ │ │ │ ├── extension_wrangler.hpp │ │ │ │ ├── program.hpp │ │ │ │ └── traits.hpp │ │ │ ├── heapSort.hpp │ │ │ ├── radixsort_AMD.hpp │ │ │ ├── radixsort_NVIDIA.hpp │ │ │ ├── scan.hpp │ │ │ └── sort.hpp │ │ ├── GL │ │ │ ├── FBO.hpp │ │ │ ├── buffer.hpp │ │ │ ├── camera.hpp │ │ │ ├── context.hpp │ │ │ ├── detail │ │ │ │ ├── enums.hpp │ │ │ │ ├── error_check.hpp │ │ │ │ ├── traits.hpp │ │ │ │ └── typesafe_get.hpp │ │ │ ├── matrix.hpp │ │ │ ├── objects │ │ │ │ ├── cairo.hpp │ │ │ │ ├── grid.hpp │ │ │ │ └── primitives │ │ │ │ │ ├── arrow.hpp │ │ │ │ │ ├── cube.hpp │ │ │ │ │ ├── cylinder.hpp │ │ │ │ │ ├── grid.hpp │ │ │ │ │ ├── rod.hpp │ │ │ │ │ └── sphere.hpp │ │ │ ├── shader │ │ │ │ ├── DOF.hpp │ │ │ │ ├── SSAO.hpp │ │ │ │ ├── ambientLight.hpp │ │ │ │ ├── bilateralblur.hpp │ │ │ │ ├── blur.hpp │ │ │ │ ├── copy.hpp │ │ │ │ ├── cylinder.hpp │ │ │ │ ├── depthResolver.hpp │ │ │ │ ├── detail │ │ │ │ │ ├── filter.hpp │ │ │ │ │ ├── shader.hpp │ │ │ │ │ └── ssshader.hpp │ │ │ │ ├── downsampler.hpp │ │ │ │ ├── hipass.hpp │ │ │ │ ├── laplacianFilter.hpp │ │ │ │ ├── lightShader.hpp │ │ │ │ ├── luminance.hpp │ │ │ │ ├── multiplyTexture.hpp │ │ │ │ ├── render.hpp │ │ │ │ ├── simple_render.hpp │ │ │ │ ├── sphere.hpp │ │ │ │ ├── toneMap.hpp │ │ │ │ └── volume.hpp │ │ │ └── texture.hpp │ │ ├── arg_share.hpp │ │ ├── clamp.hpp │ │ ├── color │ │ │ ├── HSV.hpp │ │ │ ├── marcus.hpp │ │ │ ├── sebastian.hpp │ │ │ └── transferFunction.hpp │ │ ├── containers │ │ │ ├── MinMaxHeap.hpp │ │ │ ├── cbt.hpp │ │ │ ├── fuzzy_array.hpp │ │ │ ├── iterator_pair.hpp │ │ │ ├── judy.hpp │ │ │ ├── multimaps.hpp │ │ │ ├── ordering.hpp │ │ │ ├── stack_vector.hpp │ │ │ └── vector_set.hpp │ │ ├── errno.hpp │ │ ├── exception.hpp │ │ ├── function │ │ │ └── delegate.hpp │ │ ├── gtk │ │ │ ├── colorMapSelector.hpp │ │ │ ├── numericEntry.hpp │ │ │ └── transferFunction.hpp │ │ ├── image │ │ │ ├── PNG.hpp │ │ │ ├── TIFF.hpp │ │ │ ├── bitmap.hpp │ │ │ ├── signed_distance.hpp │ │ │ └── videoEncoderFFMPEG.hpp │ │ ├── intersection │ │ │ ├── generic_algorithm.hpp │ │ │ ├── intersection.hpp │ │ │ ├── line_line.hpp │ │ │ ├── offcentre_spheres.hpp │ │ │ ├── overlapfuncs │ │ │ │ └── oscillatingplate.hpp │ │ │ ├── parabola_cylinder.hpp │ │ │ ├── parabola_plane.hpp │ │ │ ├── parabola_rod.hpp │ │ │ ├── parabola_sphere.hpp │ │ │ ├── parabola_triangle.hpp │ │ │ ├── polynomial.hpp │ │ │ ├── ray_cube.hpp │ │ │ ├── ray_cylinder.hpp │ │ │ ├── ray_plane.hpp │ │ │ ├── ray_quadrilateral.hpp │ │ │ ├── ray_rod.hpp │ │ │ ├── ray_sphere.hpp │ │ │ ├── ray_triangle.hpp │ │ │ ├── stable_poly.hpp │ │ │ └── union.hpp │ │ ├── math │ │ │ ├── bisect.hpp │ │ │ ├── complex.hpp │ │ │ ├── correlators.hpp │ │ │ ├── ctime_log.hpp │ │ │ ├── ctime_pow.hpp │ │ │ ├── ctime_safe_shift.hpp │ │ │ ├── cubic.hpp │ │ │ ├── detail │ │ │ │ └── eigenval.hpp │ │ │ ├── dilated_int.hpp │ │ │ ├── frenkelroot.hpp │ │ │ ├── histogram.hpp │ │ │ ├── matrix.hpp │ │ │ ├── numeric.hpp │ │ │ ├── precision.hpp │ │ │ ├── quadratic.hpp │ │ │ ├── quartic.hpp │ │ │ ├── quartic_descartes.hpp │ │ │ ├── quartic_error.hpp │ │ │ ├── quartic_ferrari.hpp │ │ │ ├── quartic_neumark.hpp │ │ │ ├── quartic_yacfraid.hpp │ │ │ ├── quaternion.hpp │ │ │ ├── spline.hpp │ │ │ ├── timeaveragedproperty.hpp │ │ │ ├── vector.hpp │ │ │ └── wigner3J.hpp │ │ ├── memUsage.hpp │ │ ├── memory │ │ │ └── pool.hpp │ │ ├── openvr.hpp │ │ ├── overlap │ │ │ ├── cube_plane.hpp │ │ │ ├── point_cube.hpp │ │ │ ├── point_prism.hpp │ │ │ ├── point_triangle.hpp │ │ │ └── sphere_sphere.hpp │ │ ├── stacktrace.hpp │ │ ├── stream │ │ │ ├── console_specials.hpp │ │ │ └── formattedostream.hpp │ │ ├── string │ │ │ ├── formatcode.hpp │ │ │ ├── line_number.hpp │ │ │ ├── linewrap.hpp │ │ │ └── searchreplace.hpp │ │ ├── thread │ │ │ ├── taskQueue.hpp │ │ │ ├── threadgroup.hpp │ │ │ └── threadpool.hpp │ │ ├── timer.hpp │ │ ├── units.hpp │ │ ├── wiiheadtracking.hpp │ │ ├── xmlreader.hpp │ │ └── xmlwriter.hpp │ └── tests │ │ ├── bitonicsort_test.cpp │ │ ├── cubic_quartic_test.cpp │ │ ├── dilate_test.cpp │ │ ├── ffmpeg_test.cpp │ │ ├── heapsort_test.cpp │ │ ├── intersection_genalg.cpp │ │ ├── judy_test.cpp │ │ ├── offcenterspheres.cpp │ │ ├── plane_intersection.cpp │ │ ├── quartic_original.hpp │ │ ├── quaternion_test.cpp │ │ ├── radixsort_AMD_test.cpp │ │ ├── radixsort_NVIDIA_test.cpp │ │ ├── scan_test.cpp │ │ ├── sorter_test.cpp │ │ ├── splinetest.cpp │ │ ├── stack_vector_test.cpp │ │ ├── threadpool_test.cpp │ │ ├── triangle_intersection.cpp │ │ └── vector_test.cpp └── pydynamo │ ├── __init__.py │ ├── config_files.py │ ├── file_types.py │ ├── math.py │ ├── output_properties.py │ ├── test_math.py │ ├── test_output_properties.py │ ├── test_weighted_types.py │ └── weighted_types.py ├── test └── PRIME_helper_files │ ├── 15-GNNQQNY.xml.bz2 │ ├── 48-KLVFFAE.xml.bz2 │ ├── A20.xml.bz2 │ ├── G20.xml.bz2 │ ├── PRIME_chain_generator.py │ ├── alphabet.xml.bz2 │ └── config.py └── vcpkg.json /.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /.github/workflows/python_wheels.yaml: -------------------------------------------------------------------------------- 1 | name: Build python wheels for all platforms 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build_wheels: 7 | name: Build python wheels on ${{ matrix.os }} 8 | runs-on: ${{ matrix.os }} 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | os: [ 13 | ubuntu-latest, 14 | ubuntu-24.04-arm, 15 | macos-13, 16 | macos-latest, 17 | # windows-latest, # Needs a way to install the build dependencies (or VCPKG) 18 | ] 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | submodules: recursive 24 | 25 | - uses: actions/setup-python@v5 26 | with: 27 | python-version: 3.11 28 | 29 | - name: Install cibuildwheel 30 | run: python -m pip install cibuildwheel==2.23.3 31 | 32 | - name: Build wheels 33 | run: python -m cibuildwheel --output-dir wheelhouse 34 | 35 | - uses: actions/upload-artifact@v4 36 | with: 37 | name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} 38 | path: ./wheelhouse/*.whl -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *~ 3 | *.bz2 4 | *.xml 5 | *.pyc 6 | *.log 7 | *.pkl 8 | .venv 9 | builds 10 | __pycache__ 11 | 12 | Testing/Temporary/CTestCostData.txt 13 | .eggs 14 | wheelhouse 15 | vcpkg_installed -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "extern/stator"] 2 | path = extern/stator 3 | url = https://github.com/toastedcrumpets/stator.git 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["ms-vscode.cmake-tools", "xaver.clang-format"] 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "(ctest) Launch", 9 | "type": "cppdbg", 10 | "request": "launch", 11 | // Resolved by CMake Tools: 12 | "cwd": "${cmake.testWorkingDirectory}", 13 | "program": "${cmake.testProgram}", 14 | "args": ["${cmake.testArgs}"], 15 | "stopAtEntry": true, 16 | "environment": [], 17 | "externalConsole": false, 18 | "MIMode": "gdb", 19 | "setupCommands": [ 20 | { 21 | "description": "Enable pretty-printing for gdb", 22 | "text": "-enable-pretty-printing", 23 | "ignoreFailures": true 24 | }, 25 | { 26 | "description": "Set Disassembly Flavor to Intel", 27 | "text": "-gdb-set disassembly-flavor intel", 28 | "ignoreFailures": true 29 | } 30 | ] 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # DynamO:- A general event-driven particle simulator 2 | 3 | Please see the website below for more information. 4 | 5 | [https://dynamomd.com](https://dynamomd.com) 6 | 7 | ## Documentation 8 | 9 | All of the documentation is [available on-line](http://dynamomd.org/index.php/documentation). 10 | 11 | ## Installation 12 | 13 | Please see [tutorial 1 on the DynamO 14 | website](https://dynamomd.com/index.php/tutorial1.html) for a full description 15 | on how to compile DynamO. 16 | 17 | ## Source Code 18 | 19 | All of the source code is inside the [src](src/) directory. For more information 20 | on the source code please see the [src/Readme.md](src/Readme.md) file. 21 | 22 | ## Continuous Testing/Building 23 | 24 | All unit tests are run using [Github Actions](https://github.com/dynamomd/DynamO/actions). 25 | 26 | ## Troubleshooting 27 | 28 | Please check the website and documentation if you're having any trouble. If 29 | these don't answer your questions, you can raise an issue on GitHub and we'll 30 | help. 31 | 32 | ## LICENSE 33 | 34 | Everything in DynamO is licensed GPL3 unless otherwise marked. Please 35 | see [LICENSE.txt](LICENSE.txt) for details of this license. 36 | -------------------------------------------------------------------------------- /cmake/Modules/FindAVCodec.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find FFMPEG libavcodec 2 | # Once done, this will define 3 | # 4 | # AVCodec_FOUND - the library is available 5 | # AVCodec_INCLUDE_DIRS - the include directories 6 | # AVCodec_LIBRARIES - the libraries 7 | # AVCodec_INCLUDE - the file to #include (may be used in config.h) 8 | # 9 | # See documentation on how to write CMake scripts at 10 | # http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries 11 | 12 | include(LibFindMacros) 13 | 14 | libfind_package(AVCodec AVUtil ) 15 | 16 | # TODO: pkg-config extra deps: libraw1394 theora vorbisenc 17 | 18 | libfind_pkg_check_modules(AVCodec_PKGCONF libavcodec) 19 | 20 | find_path(AVCodec_INCLUDE_DIR 21 | NAMES libavcodec/avcodec.h ffmpeg/avcodec.h avcodec.h 22 | PATHS ${AVCodec_PKGCONF_INCLUDE_DIRS} 23 | PATH_SUFFIXES ffmpeg 24 | ) 25 | 26 | if(AVCodec_INCLUDE_DIR) 27 | foreach(suffix libavcodec/ ffmpeg/ "") 28 | if(NOT AVCodec_INCLUDE) 29 | if(EXISTS "${AVCodec_INCLUDE_DIR}/${suffix}avcodec.h") 30 | set(AVCodec_INCLUDE "${suffix}avcodec.h") 31 | endif(EXISTS "${AVCodec_INCLUDE_DIR}/${suffix}avcodec.h") 32 | endif(NOT AVCodec_INCLUDE) 33 | endforeach(suffix) 34 | 35 | if(NOT AVCodec_INCLUDE) 36 | message(FATAL_ERROR "Found avcodec.h include dir, but not the header file. Perhaps you need to clear CMake cache?") 37 | endif(NOT AVCodec_INCLUDE) 38 | endif(AVCodec_INCLUDE_DIR) 39 | 40 | find_library(AVCodec_LIBRARY 41 | NAMES libavcodec.dll.a avcodec 42 | PATHS ${AVCodec_PKGCONF_LIBRARY_DIRS} 43 | ) 44 | 45 | set(AVCodec_PROCESS_INCLUDES AVCodec_INCLUDE_DIR AVUtil_INCLUDE_DIRS) 46 | set(AVCodec_PROCESS_LIBS AVCodec_LIBRARY AVUtil_LIBRARIES) 47 | libfind_process(AVCodec) 48 | 49 | -------------------------------------------------------------------------------- /cmake/Modules/FindAVUtil.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find FFMPEG libavutil 2 | # Once done, this will define 3 | # 4 | # AVUtil_FOUND - the library is available 5 | # AVUtil_INCLUDE_DIRS - the include directories 6 | # AVUtil_LIBRARIES - the libraries 7 | # AVUtil_INCLUDE - the file to #include (may be used in config.h) 8 | # 9 | # See documentation on how to write CMake scripts at 10 | # http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries 11 | 12 | include(LibFindMacros) 13 | 14 | libfind_pkg_check_modules(AVUtil_PKGCONF libavutil) 15 | 16 | find_path(AVUtil_INCLUDE_DIR 17 | NAMES libavutil/avutil.h ffmpeg/avutil.h avutil.h 18 | PATHS ${AVUtil_PKGCONF_INCLUDE_DIRS} 19 | PATH_SUFFIXES ffmpeg 20 | ) 21 | 22 | if(AVUtil_INCLUDE_DIR) 23 | foreach(suffix libavutil/ ffmpeg/ "") 24 | if(NOT AVUtil_INCLUDE) 25 | if(EXISTS "${AVUtil_INCLUDE_DIR}/${suffix}avutil.h") 26 | set(AVUtil_INCLUDE "${suffix}avutil.h") 27 | endif(EXISTS "${AVUtil_INCLUDE_DIR}/${suffix}avutil.h") 28 | endif(NOT AVUtil_INCLUDE) 29 | endforeach(suffix) 30 | 31 | if(NOT AVUtil_INCLUDE) 32 | message(FATAL_ERROR "Found avutil.h include dir, but not the header file. Perhaps you need to clear CMake cache?") 33 | endif(NOT AVUtil_INCLUDE) 34 | endif(AVUtil_INCLUDE_DIR) 35 | 36 | find_library(AVUtil_LIBRARY 37 | NAMES libavutil.dll.a avutil 38 | PATHS ${AVUtil_PKGCONF_LIBRARY_DIRS} 39 | ) 40 | 41 | set(AVUtil_PROCESS_INCLUDES AVUtil_INCLUDE_DIR) 42 | set(AVUtil_PROCESS_LIBS AVUtil_LIBRARY) 43 | libfind_process(AVUtil) 44 | 45 | -------------------------------------------------------------------------------- /cmake/Modules/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | # - Find the OpenGL Extension Wrangler Library (GLEW) 2 | # This module defines the following variables: 3 | # GLEW_INCLUDE_DIRS - include directories for GLEW 4 | # GLEW_LIBRARIES - libraries to link against GLEW 5 | # GLEW_FOUND - true if GLEW has been found and can be used 6 | 7 | #============================================================================= 8 | # Copyright 2012 Benjamin Eikel 9 | # 10 | # Distributed under the OSI-approved BSD License (the "License"); 11 | # see accompanying file Copyright.txt for details. 12 | # 13 | # This software is distributed WITHOUT ANY WARRANTY; without even the 14 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # See the License for more information. 16 | #============================================================================= 17 | # (To distribute this file outside of CMake, substitute the full 18 | # License text for the above reference.) 19 | 20 | find_path(GLEW_INCLUDE_DIR GL/glew.h) 21 | find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64) 22 | 23 | set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) 24 | set(GLEW_LIBRARIES ${GLEW_LIBRARY}) 25 | 26 | include(FindPackageHandleStandardArgs) 27 | 28 | find_package_handle_standard_args(GLEW REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) 29 | 30 | mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) 31 | -------------------------------------------------------------------------------- /cmake/Modules/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright Iowa State University 2009-2010. 12 | # Distributed under the Boost Software License, Version 1.0. 13 | # (See accompanying file LICENSE_1_0.txt or copy at 14 | # http://www.boost.org/LICENSE_1_0.txt) 15 | 16 | set(HEAD_HASH) 17 | 18 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 19 | 20 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 21 | if(HEAD_CONTENTS MATCHES "ref") 22 | # named branch 23 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 24 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 25 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 26 | elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") 27 | configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 28 | set(HEAD_HASH "${HEAD_REF}") 29 | endif() 30 | else() 31 | # detached HEAD 32 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 33 | endif() 34 | 35 | if(NOT HEAD_HASH) 36 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 37 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 38 | endif() -------------------------------------------------------------------------------- /copyright: -------------------------------------------------------------------------------- 1 | dynamomd:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | 4 | Copyright (C) 2025 Marcus N Campbell Bannerman 5 | 6 | This program is free software: you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | version 3 as published by the Free Software Foundation. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import {} }: 2 | pkgs.callPackage ./derivation.nix {} 3 | -------------------------------------------------------------------------------- /derivation.nix: -------------------------------------------------------------------------------- 1 | # see https://unix.stackexchange.com/questions/717168/how-to-package-my-software-in-nix-or-write-my-own-package-derivation-for-nixpkgs 2 | # To install `nix-env -u -f default.nix` 3 | # To develop `nix-shell` (will build the shell with dependencies) 4 | # To test build `nix-build` 5 | { pkgs, python3 }: 6 | python3.pkgs.buildPythonPackage rec { 7 | name = "pydynamo"; 8 | src = ./.; 9 | pyproject = true; 10 | 11 | dontUseCmakeConfigure = true; 12 | 13 | propagatedBuildInputs = with python3.pkgs; [ 14 | scikit-build-core 15 | numpy 16 | alive-progress 17 | uncertainties 18 | pandas 19 | scipy 20 | freud 21 | networkx 22 | pytest 23 | ]; 24 | 25 | nativeBuildInputs = with pkgs; [ 26 | cmake 27 | ninja 28 | git 29 | gcc 30 | pkg-config 31 | clang-tools 32 | wrapGAppsHook3 33 | ] ++ propagatedBuildInputs; 34 | 35 | buildInputs = with pkgs; [ 36 | # Basic build dependencies 37 | bzip2.dev 38 | boost.dev 39 | eigen 40 | 41 | # Visualiser 42 | libGL.dev 43 | gtkmm3.dev 44 | ffmpeg.dev 45 | freeglut 46 | glew 47 | cairomm.dev 48 | libpng 49 | ]; 50 | } 51 | -------------------------------------------------------------------------------- /description.txt: -------------------------------------------------------------------------------- 1 | This is a collection of software for performing event-driven 2 | simulations of particle models. These may be molecular, granular, or 3 | fluid dynamics simulations. This package is aimed at the 4 | physics/scientific community, although it contains a range of general 5 | techniques and approaches. 6 | -------------------------------------------------------------------------------- /docs/users.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamomd/DynamO/274a1349f418ace0dd5325dee8f9b7e09bbf2ba6/docs/users.gpg -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = src/pydynamo -------------------------------------------------------------------------------- /scripts/requirements.txt: -------------------------------------------------------------------------------- 1 | uncertainties==3.2.2 2 | numpy==2.1.3 3 | pandas==2.2.3 4 | scipy==1.14.1 5 | alive-progress==3.2.0 6 | -------------------------------------------------------------------------------- /scripts/stltovertices.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Converts the positions of the triangles into a normalized [-0.5:0.5] 4 | #box centered about the origin 5 | 6 | cat $1 | grep vertex | gawk '{print $2+0,$3+0,$4+0}' > tmp.vertex 7 | 8 | xmin=$(cat tmp.vertex | gawk 'BEGIN {xval=1e200} {if ($1 < xval) xval = $1 } END {print xval}') 9 | ymin=$(cat tmp.vertex | gawk 'BEGIN {xval=1e200} {if ($2 < xval) xval = $2 } END {print xval}') 10 | zmin=$(cat tmp.vertex | gawk 'BEGIN {xval=1e200} {if ($3 < xval) xval = $3 } END {print xval}') 11 | 12 | echo Min vals are $xmin $ymin $zmin 13 | 14 | cat tmp.vertex \ 15 | | gawk '{print $1-'$xmin',$2-'$ymin',$3-'$zmin'}' \ 16 | > tmp2.vertex 17 | 18 | xmax=$(cat tmp2.vertex | gawk 'func fabs(val){return (val<0)?-val:val;} BEGIN {xval=0} {if (fabs($1)>xval) xval = fabs($1)} END {print xval}') 19 | ymax=$(cat tmp2.vertex | gawk 'func fabs(val){return (val<0)?-val:val;} BEGIN {xval=0} {if (fabs($2)>xval) xval = fabs($2)} END {print xval}') 20 | zmax=$(cat tmp2.vertex | gawk 'func fabs(val){return (val<0)?-val:val;} BEGIN {xval=0} {if (fabs($3)>xval) xval = fabs($3)} END {print xval}') 21 | 22 | echo Max lengths are $xmax $ymax $zmax 23 | 24 | max=$xmax 25 | 26 | maxord=$(echo $xmax $ymax $zmax | gawk '{val = $1; if ($2 > val) val = $2; if ($3 > val) val = $3} END {print val}') 27 | 28 | echo Maximum ordinate val is $maxord 29 | 30 | cat tmp2.vertex \ 31 | | gawk '{print ($1 - 0.5 * '$xmax') / '$maxord', ($2 - 0.5 * '$ymax') / '$maxord', ($3 - 0.5 * '$zmax') / '$maxord'}' \ 32 | > fixed.vertex 33 | 34 | #rm tmp.vertex tmp2.vertex 35 | -------------------------------------------------------------------------------- /src/Readme.md: -------------------------------------------------------------------------------- 1 | # DynamO:- A general event driven simulator. 2 | 3 | ## C++ Source Code 4 | 5 | The source code is divided into several seperate projects, each with its own 6 | directory. 7 | 8 | `dynamo/` 9 | 10 | This is where all the Event-Driven simulation specific code is and is probably 11 | what you are interested in if you're reading this. 12 | 13 | `magnet/` 14 | 15 | Magnet is a header-only library, filled with useful and generic C++ functions 16 | and classes. DynamO uses the magnet library for stuff like sorting, collision 17 | detection, and input/output in XML. 18 | 19 | `coil/` 20 | 21 | Coil is a visualization library. It uses OpenCL and OpenGL to perform fast 22 | real-time renderings of simulations. In DynamO, the coil library provides the 23 | interactive visualiser. 24 | -------------------------------------------------------------------------------- /src/coil/build_glade_file.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | import sys 3 | import os 4 | 5 | inputfile='clwingtk.gladexml' 6 | file_name=os.path.basename(inputfile) 7 | output = open("coil/gladexmlfile.cpp", 'w+') 8 | symbol_name=os.path.splitext(file_name)[0] 9 | output.write("#include \n") 10 | output.write("extern const std::string "+symbol_name+";\n") 11 | output.write("const std::string "+symbol_name+" = ") 12 | for line in open(inputfile, 'r'): 13 | #Escape any backslashes 14 | line=line.replace('\\', '\\\\') 15 | #Escape any quotes 16 | line=line.replace('"', '\\"') 17 | #Write out the line wrapped in quotes with newlines in the data 18 | output.write('"'+line.replace('\n', '\\n"\n')) 19 | output.write(";") 20 | -------------------------------------------------------------------------------- /src/coil/coil/RenderObj/Surface.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | #pragma once 18 | 19 | #include "Triangles.hpp" 20 | #include 21 | #include 22 | 23 | namespace coil { 24 | class RSurface : public RTriangles { 25 | public: 26 | RSurface(std::string name, size_t N = 10, 27 | Vector origin = Vector{-25, -1.5, -25}, 28 | Vector axis1 = Vector{50, 0, 0}, Vector axis2 = Vector{0, 0, 50}, 29 | Vector axis3 = Vector{0, 1, 0}); 30 | 31 | virtual void 32 | init(const std::shared_ptr &systemQueue); 33 | 34 | virtual Glib::RefPtr getIcon(); 35 | 36 | virtual bool deletable() { return true; } 37 | 38 | virtual magnet::math::Vector getMaxCoord() const; 39 | virtual magnet::math::Vector getMinCoord() const; 40 | 41 | protected: 42 | void clTick() {} 43 | 44 | size_t _N; 45 | 46 | Vector _origin; 47 | Vector _axis1; 48 | Vector _axis2; 49 | Vector _axis3; 50 | }; 51 | } // namespace coil 52 | -------------------------------------------------------------------------------- /src/coil/coil/filters/SSAO.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace coil { 23 | class SSAOWrapper : public Filter { 24 | public: 25 | SSAOWrapper(); 26 | ~SSAOWrapper(); 27 | 28 | inline virtual size_t type_id() { 29 | return detail::filterEnum::val; 30 | } 31 | 32 | inline virtual void invoke(GLint colorTextureUnit, size_t width, 33 | size_t height, const magnet::GL::Camera &vp); 34 | 35 | virtual void showControls(Gtk::ScrolledWindow *); 36 | 37 | protected: 38 | magnet::GL::shader::SSAOShader _filter; 39 | Glib::RefPtr _refXml; 40 | GLfloat _radius; 41 | GLfloat _totStrength; 42 | GLfloat _dropoff; 43 | 44 | GLuint _randomTexture; 45 | 46 | void settingsCallback(); 47 | 48 | Gtk::Entry _radiusSlider; 49 | Gtk::Entry _totStrengthSlider; 50 | Gtk::Entry _dropoffSlider; 51 | Gtk::HBox _optlist; 52 | static const size_t _randomTextureSize = 64; 53 | }; 54 | } // namespace coil 55 | -------------------------------------------------------------------------------- /src/coil/coil/filters/bilateralBlur.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace coil { 25 | class BilateralBlurWrapper : public Filter { 26 | public: 27 | BilateralBlurWrapper(); 28 | 29 | inline virtual size_t type_id() { 30 | return detail::filterEnum::val; 31 | } 32 | inline virtual void invoke(GLint colorTextureUnit, size_t width, 33 | size_t height, const magnet::GL::Camera &vp); 34 | 35 | virtual void showControls(Gtk::ScrolledWindow *); 36 | 37 | protected: 38 | magnet::GL::shader::BilateralBlur _filter; 39 | GLint _radius; 40 | GLfloat _zdiff; 41 | 42 | void settingsCallback(); 43 | 44 | Gtk::HScale _radiusSlider; 45 | Gtk::Entry _zdiffEntry; 46 | Gtk::HBox _optlist; 47 | }; 48 | } // namespace coil 49 | -------------------------------------------------------------------------------- /src/coil/coil/filters/multiply.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include "filter.hpp" 20 | #include 21 | 22 | namespace coil { 23 | class MultiplyFilter : public Filter { 24 | public: 25 | MultiplyFilter() { _filter.build(); } 26 | 27 | inline virtual size_t type_id() { 28 | return detail::filterEnum::val; 29 | } 30 | inline virtual bool isEditable() { return false; } 31 | inline virtual void invoke(GLint colorTextureUnit, size_t width, 32 | size_t height, const magnet::GL::Camera &vp) { 33 | _filter.attach(); 34 | _filter["u_Texture0"] = colorTextureUnit; 35 | _filter["u_Texture1"] = 0; 36 | _filter.invoke(); 37 | _filter.detach(); 38 | } 39 | 40 | protected: 41 | magnet::GL::shader::MultiplyTexture _filter; 42 | }; 43 | } // namespace coil 44 | -------------------------------------------------------------------------------- /src/coil/coil/images/coilicon.svg: -------------------------------------------------------------------------------- 1 | ../../../../docs/coilicon.svg -------------------------------------------------------------------------------- /src/coil/coil/images/coilsplash.svg: -------------------------------------------------------------------------------- 1 | ../../../../docs/coilsplash.svg -------------------------------------------------------------------------------- /src/coil/coil/images/images.hpp: -------------------------------------------------------------------------------- 1 | /*Generated Image header file for coil*/ 2 | #include 3 | namespace coil { 4 | namespace images { 5 | Glib::RefPtr DataSet_Icon(); 6 | Glib::RefPtr Function_Icon(); 7 | Glib::RefPtr Glyphs_Icon(); 8 | Glib::RefPtr Light_Icon(); 9 | Glib::RefPtr Volume_Icon(); 10 | Glib::RefPtr addFunction_Icon(); 11 | Glib::RefPtr addLight_Icon(); 12 | Glib::RefPtr cammode_fps(); 13 | Glib::RefPtr cammode_rotate_cursor(); 14 | Glib::RefPtr cammode_rotate_world(); 15 | Glib::RefPtr camnegx(); 16 | Glib::RefPtr camnegy(); 17 | Glib::RefPtr camnegz(); 18 | Glib::RefPtr camplusx(); 19 | Glib::RefPtr camplusy(); 20 | Glib::RefPtr camplusz(); 21 | Glib::RefPtr camrescale(); 22 | Glib::RefPtr coilicon(); 23 | Glib::RefPtr coilsplash(); 24 | Glib::RefPtr default_RObj_Icon(); 25 | Glib::RefPtr delete_Icon(); 26 | Glib::RefPtr delete_off_Icon(); 27 | Glib::RefPtr shadow_off_Icon(); 28 | Glib::RefPtr shadow_on_Icon(); 29 | Glib::RefPtr visible_off_Icon(); 30 | Glib::RefPtr visible_on_Icon(); 31 | } // namespace images 32 | } // namespace coil 33 | -------------------------------------------------------------------------------- /src/coil/coil/images/makeimagecpp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "/*Generated Image header file for coil*/" > images.hpp 4 | echo "#include " >> images.hpp 5 | echo "namespace coil { namespace images {" >> images.hpp 6 | 7 | echo "/*Generated Image function file for coil*/" > images.cpp 8 | echo "#include " >> images.cpp 9 | echo "namespace coil { namespace images {" >> images.cpp 10 | for image in $(ls *.svg) 11 | do 12 | basename=$(basename $image) 13 | basename=${basename%.*} 14 | gdk-pixbuf-csource --static --name $basename"_data" $image >> images.cpp 15 | echo "Glib::RefPtr $basename();" >> images.hpp 16 | echo "Glib::RefPtr $basename()" >> images.cpp 17 | echo "{ return Gdk::Pixbuf::create_from_inline(sizeof("$basename"_data), "$basename"_data); }" >> images.cpp 18 | done 19 | 20 | echo "}}" >> images.hpp 21 | echo "}}" >> images.cpp 22 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/2particleEventData.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class PairEventData { 25 | public: 26 | PairEventData() {} 27 | 28 | PairEventData(const Particle &part1, const Particle &part2, 29 | const Species &sp1, const Species &sp2, EEventType eType) 30 | : particle1_(part1, sp1, eType), particle2_(part2, sp2, eType), 31 | rij(part1.getPosition() - part2.getPosition()), 32 | vijold(part1.getVelocity() - part2.getVelocity()) {} 33 | 34 | ParticleEventData particle1_; 35 | ParticleEventData particle2_; 36 | Vector rij; 37 | Vector vijold; 38 | Vector impulse; 39 | double rvdot; 40 | 41 | void setType(EEventType nType) { 42 | particle1_.setType(nType); 43 | particle2_.setType(nType); 44 | } 45 | 46 | EEventType getType() const { return particle1_.getType(); } 47 | }; 48 | } // namespace dynamo 49 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/BC/None.cpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | namespace dynamo { 22 | BCNone::BCNone(const dynamo::Simulation *Sim) 23 | : BoundaryCondition(Sim, "NullBC") { 24 | dout << "No boundary condition loaded" << std::endl; 25 | } 26 | 27 | BCNone::~BCNone() {} 28 | 29 | void BCNone::applyBC(Vector &) const {} 30 | 31 | void BCNone::applyBC(Vector &, Vector &) const {} 32 | 33 | void BCNone::applyBC(Vector &, const double &) const {} 34 | 35 | void BCNone::update(const double &) {} 36 | 37 | void BCNone::outputXML(magnet::xml::XmlStream &XML) const { 38 | XML << magnet::xml::attr("Type") << "None"; 39 | } 40 | 41 | void BCNone::operator<<(const magnet::xml::Node &) {} 42 | 43 | void BCNone::rounding(Vector &) const {} 44 | } // namespace dynamo 45 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/BC/None.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | /*! \brief An infinite system boundary condition 23 | * 24 | * Performs no rounding at the simulation boundaries. This is useful 25 | * for isolated polymer simulations but you must remember that 26 | * positions can overflow eventually. 27 | */ 28 | class BCNone : virtual public BoundaryCondition { 29 | public: 30 | BCNone(const dynamo::Simulation *); 31 | 32 | virtual ~BCNone(); 33 | 34 | virtual void applyBC(Vector &) const; 35 | 36 | virtual void applyBC(Vector &, Vector &) const; 37 | 38 | virtual void applyBC(Vector &, const double &) const; 39 | 40 | virtual void update(const double &); 41 | 42 | virtual void outputXML(magnet::xml::XmlStream &XML) const; 43 | 44 | virtual void operator<<(const magnet::xml::Node &); 45 | 46 | virtual void rounding(Vector &) const; 47 | }; 48 | } // namespace dynamo 49 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/BC/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/NparticleEventData.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class NEventData { 25 | public: 26 | NEventData() {}; 27 | NEventData(const ParticleEventData &a) { L1partChanges.push_back(a); } 28 | NEventData(const PairEventData &a) { L2partChanges.push_back(a); } 29 | 30 | NEventData &operator+=(const ParticleEventData &p) { 31 | L1partChanges.push_back(p); 32 | return *this; 33 | } 34 | NEventData &operator+=(const PairEventData &p) { 35 | L2partChanges.push_back(p); 36 | return *this; 37 | } 38 | 39 | std::vector L1partChanges; 40 | std::vector L2partChanges; 41 | }; 42 | } // namespace dynamo 43 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/coilRenderObj.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #ifdef DYNAMO_visualizer 21 | #include 22 | #include 23 | #include 24 | #endif 25 | 26 | namespace dynamo { 27 | struct CoilRenderObj { 28 | #ifdef DYNAMO_visualizer 29 | virtual shared_ptr getCoilRenderObj() const = 0; 30 | virtual void initRenderData(magnet::GL::Context::ContextPtr) const {} 31 | virtual void updateRenderData() const = 0; 32 | #endif 33 | }; 34 | } // namespace dynamo 35 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/coordinator/engine/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/dynamics/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/globals/ParabolaSentinel.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | class GParabolaSentinel : public Global { 24 | public: 25 | GParabolaSentinel(dynamo::Simulation *, const std::string &); 26 | 27 | virtual ~GParabolaSentinel() {} 28 | 29 | virtual Event getEvent(const Particle &) const; 30 | 31 | virtual void runEvent(Particle &, const double); 32 | 33 | virtual void operator<<(const magnet::xml::Node &) {} 34 | 35 | protected: 36 | virtual void outputXML(magnet::xml::XmlStream &) const {} 37 | }; 38 | } // namespace dynamo 39 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/globals/cellsShearing.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | class GCellsShearing : public GCells { 24 | public: 25 | GCellsShearing(const magnet::xml::Node &, dynamo::Simulation *); 26 | 27 | GCellsShearing(dynamo::Simulation *, const std::string &); 28 | 29 | virtual ~GCellsShearing() {} 30 | 31 | virtual void initialise(size_t); 32 | 33 | virtual Event getEvent(const Particle &) const; 34 | 35 | virtual void runEvent(Particle &, const double); 36 | 37 | protected: 38 | void getParticleNeighbours(const std::array &, 39 | std::vector &) const; 40 | void getAdditionalLEParticleNeighbourhood(const Particle &, 41 | std::vector &) const; 42 | void getAdditionalLEParticleNeighbourhood(std::array, 43 | std::vector &) const; 44 | }; 45 | } // namespace dynamo 46 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/globals/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2010 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/globals/socells.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | class GSOCells : public Global { 24 | public: 25 | GSOCells(const magnet::xml::Node &, dynamo::Simulation *); 26 | 27 | GSOCells(dynamo::Simulation *, const std::string &); 28 | 29 | virtual ~GSOCells() {} 30 | 31 | virtual Event getEvent(const Particle &) const; 32 | 33 | virtual void runEvent(Particle &, const double); 34 | 35 | virtual void initialise(size_t); 36 | 37 | virtual void operator<<(const magnet::xml::Node &); 38 | 39 | virtual void outputXML(magnet::xml::XmlStream &XML) const; 40 | 41 | void load_cell_origins(const std::vector); 42 | 43 | protected: 44 | double _cellD; 45 | std::vector cell_origins; 46 | }; 47 | } // namespace dynamo 48 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/globals/waker.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | Copyright (C) 2011 Sebastian Gonzalez 5 | 6 | This program is free software: you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | version 3 as published by the Free Software Foundation. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace dynamo { 26 | class GWaker : public Global { 27 | public: 28 | GWaker(const magnet::xml::Node &, dynamo::Simulation *); 29 | 30 | GWaker(dynamo::Simulation *, const std::string &, IDRange *, const double, 31 | const double, std::string nblist); 32 | 33 | virtual ~GWaker() {} 34 | 35 | virtual Event getEvent(const Particle &) const; 36 | 37 | virtual void runEvent(Particle &, const double); 38 | 39 | virtual void initialise(size_t); 40 | 41 | virtual void operator<<(const magnet::xml::Node &); 42 | 43 | protected: 44 | void particlesUpdated(const NEventData &); 45 | 46 | void nblistCallback(const Particle &part, const size_t &oid) const; 47 | 48 | mutable size_t _neighbors; 49 | 50 | virtual void outputXML(magnet::xml::XmlStream &) const; 51 | double _wakeTime; 52 | double _wakeVelocity; 53 | 54 | std::string _nblistName; 55 | size_t _NBListID; 56 | }; 57 | } // namespace dynamo 58 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/inputplugins/cells/binary.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | struct CUBinary : public UCell { 24 | CUBinary(size_t x, UCell *nextCell1, UCell *nextCell2) 25 | : UCell(nextCell1), uc2(nextCell2), count(0), countA(x) {} 26 | 27 | std::unique_ptr uc2; 28 | size_t count; 29 | const size_t countA; 30 | 31 | virtual std::vector placeObjects(const Vector ¢re) { 32 | if (count < countA) { 33 | ++count; 34 | return uc->placeObjects(centre); 35 | } else 36 | return uc2->placeObjects(centre); 37 | } 38 | }; 39 | } // namespace dynamo 40 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/inputplugins/cells/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/inputplugins/cells/linearRod.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | struct CUlinearRod : public UCell { 24 | CUlinearRod(size_t pcl, double WL, UCell *nextCell) 25 | : UCell(nextCell), pairchainlength(pcl), walklength(WL) { 26 | if (pcl == 0) 27 | M_throw() << "Cant have zero chain length"; 28 | } 29 | 30 | size_t pairchainlength; 31 | double walklength; 32 | 33 | virtual std::vector placeObjects(const Vector ¢re) { 34 | Vector tmp{0, 0, 0}; 35 | 36 | std::vector retval; 37 | 38 | for (size_t iStep = 0; iStep < pairchainlength; ++iStep) { 39 | tmp[0] = (double(iStep) - (double(walklength) * 0.5)) * walklength; 40 | 41 | const std::vector &newsites = uc->placeObjects(tmp + centre); 42 | retval.insert(retval.end(), newsites.begin(), newsites.end()); 43 | } 44 | 45 | return retval; 46 | } 47 | }; 48 | } // namespace dynamo 49 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/inputplugins/cells/random.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | struct CURandom : public UCell { 24 | CURandom(size_t nN, Vector ndimensions, UCell *nextCell) 25 | : UCell(nextCell), N(nN), dimensions(ndimensions), 26 | _rng(std::random_device()()) {} 27 | 28 | size_t N; 29 | Vector dimensions; 30 | std::mt19937 _rng; 31 | 32 | virtual std::vector placeObjects(const Vector ¢re) { 33 | std::vector retval; 34 | 35 | std::uniform_real_distribution<> uniform_dist; 36 | for (size_t i(0); i < N; ++i) { 37 | Vector position; 38 | for (size_t iDim = 0; iDim < NDIM; iDim++) 39 | position[iDim] = 40 | centre[iDim] - (uniform_dist(_rng) - 0.5) * dimensions[iDim]; 41 | 42 | // Get the next unit cells positions and push them to your list 43 | const std::vector &newsites = uc->placeObjects(position); 44 | retval.insert(retval.end(), newsites.begin(), newsites.end()); 45 | } 46 | 47 | return retval; 48 | } 49 | }; 50 | } // namespace dynamo 51 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/inputplugins/cells/randomise.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | struct CURandomise : public UCell { 25 | CURandomise(UCell *nextCell) : UCell(nextCell) {} 26 | 27 | virtual std::vector placeObjects(const Vector ¢re) { 28 | // Must be placed at zero for the mirroring to work correctly 29 | std::vector retval(uc->placeObjects(Vector(centre))); 30 | 31 | std::random_device rd; 32 | std::mt19937 g(rd()); 33 | std::shuffle(retval.begin(), retval.end(), g); 34 | 35 | return retval; 36 | } 37 | }; 38 | } // namespace dynamo 39 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/inputplugins/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/inputplugins/inputplugin.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | class InputPlugin : public dynamo::SimBase { 24 | public: 25 | InputPlugin(dynamo::Simulation *, const char *aName); 26 | 27 | virtual ~InputPlugin() {}; 28 | 29 | virtual void initialise() {}; 30 | 31 | // Rescaling system 32 | void rescaleVels(double val = 1.0); 33 | 34 | void zeroMomentum(); 35 | 36 | void setCOMVelocity(const Vector); 37 | 38 | void zeroCentreOfMass(); 39 | 40 | void setPackFrac(double); 41 | 42 | void mirrorDirection(unsigned int); 43 | 44 | void zeroVelComp(size_t); 45 | 46 | protected: 47 | }; 48 | } // namespace dynamo 49 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/inputplugins/packer.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using namespace std; 25 | using namespace boost; 26 | namespace po = boost::program_options; 27 | 28 | namespace dynamo { 29 | class UCell; 30 | 31 | class IPPacker : public dynamo::SimBase { 32 | public: 33 | IPPacker(po::variables_map &, dynamo::Simulation *tmp); 34 | 35 | void initialise(); 36 | 37 | static po::options_description getOptions(); 38 | 39 | protected: 40 | std::array getCells(); 41 | Vector getNormalisedCellDimensions(); 42 | Vector getRandVelVec(); 43 | UCell *standardPackingHelper(UCell *, bool forceRectangular = false); 44 | 45 | po::variables_map &vm; 46 | }; 47 | } // namespace dynamo 48 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/interactions/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/interactions/nullInteraction.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace dynamo { 23 | class INull : public Interaction { 24 | public: 25 | INull(dynamo::Simulation *, IDPairRange *, std::string); 26 | 27 | INull(const magnet::xml::Node &, dynamo::Simulation *); 28 | 29 | void operator<<(const magnet::xml::Node &); 30 | 31 | virtual double getInternalEnergy() const { return 0; } 32 | 33 | virtual void initialise(size_t); 34 | 35 | virtual double maxIntDist() const { return 0; } 36 | 37 | virtual double getExcludedVolume(size_t) const { return 0; } 38 | 39 | virtual Event getEvent(const Particle &, const Particle &) const; 40 | 41 | virtual PairEventData runEvent(Particle &, Particle &, Event); 42 | 43 | virtual void outputXML(magnet::xml::XmlStream &) const; 44 | 45 | virtual bool validateState(const Particle &p1, const Particle &p2, 46 | bool textoutput = true) const { 47 | return false; 48 | } 49 | }; 50 | } // namespace dynamo 51 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/interactions/thinthread.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace dynamo { 23 | class IThinThread : public ISquareWell { 24 | public: 25 | IThinThread(const magnet::xml::Node &, dynamo::Simulation *); 26 | 27 | void operator<<(const magnet::xml::Node &); 28 | 29 | virtual bool validateState(const Particle &p1, const Particle &p2, 30 | bool textoutput = true) const; 31 | 32 | /*! \brief This capture test returns false as (initially) there are no 33 | * bridges. 34 | */ 35 | virtual size_t captureTest(const Particle &, const Particle &) const { 36 | return false; 37 | } 38 | 39 | virtual Event getEvent(const Particle &, const Particle &) const; 40 | 41 | virtual PairEventData runEvent(Particle &, Particle &, Event); 42 | 43 | virtual void outputXML(magnet::xml::XmlStream &) const; 44 | }; 45 | } // namespace dynamo 46 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/locals/lroughwall.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class LRoughWall : public Local { 23 | public: 24 | LRoughWall(const magnet::xml::Node &, dynamo::Simulation *); 25 | LRoughWall(dynamo::Simulation *, double, double, double, Vector, Vector, 26 | std::string, IDRange *, bool nrender = true); 27 | 28 | virtual ~LRoughWall() {} 29 | 30 | virtual Event getEvent(const Particle &) const; 31 | 32 | virtual void initialise(size_t nID); 33 | 34 | virtual ParticleEventData runEvent(Particle &, const Event &) const; 35 | 36 | virtual void operator<<(const magnet::xml::Node &); 37 | 38 | virtual bool validateState(const Particle &part, 39 | bool textoutput = true) const; 40 | 41 | protected: 42 | virtual void outputXML(magnet::xml::XmlStream &) const; 43 | 44 | Vector vNorm; 45 | Vector vPosition; 46 | double e; 47 | double et; 48 | double r; 49 | bool render; 50 | }; 51 | } // namespace dynamo 52 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/brenner.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace dynamo { 27 | class Particle; 28 | 29 | using namespace EventTypeTracking; 30 | 31 | class OPBrenner : public OutputPlugin { 32 | public: 33 | OPBrenner(const dynamo::Simulation *, const magnet::xml::Node &); 34 | ~OPBrenner(); 35 | 36 | virtual void initialise(); 37 | 38 | virtual void eventUpdate(const Event &, const NEventData &); 39 | 40 | void output(magnet::xml::XmlStream &); 41 | 42 | virtual void replicaExchange(OutputPlugin &plug) { 43 | M_throw() << "Not implemented"; 44 | } 45 | 46 | protected: 47 | magnet::math::HistogramWeighted<> _sysmomentum_hist[3]; 48 | Vector _sysMomentum; 49 | }; 50 | } // namespace dynamo 51 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/eventtypetracking.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class Simulation; 25 | class Interaction; 26 | class System; 27 | 28 | namespace EventTypeTracking { 29 | 30 | //! Keeps the ID and type of the event source 31 | typedef std::pair EventSourceKey; 32 | 33 | //! Event source And Type 34 | typedef std::pair EventKey; 35 | 36 | std::string getEventSourceName(const EventSourceKey &, 37 | const dynamo::Simulation *); 38 | std::string getEventSourceTypeName(const EventSourceKey &); 39 | 40 | EventSourceKey getEventSourceKey(const Event &); 41 | } // namespace EventTypeTracking 42 | } // namespace dynamo 43 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/intEnergyHist.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class OPMisc; 25 | 26 | class OPIntEnergyHist : public OutputPlugin { 27 | public: 28 | OPIntEnergyHist(const dynamo::Simulation *, const magnet::xml::Node &); 29 | 30 | virtual void initialise(); 31 | 32 | virtual void eventUpdate(const Event &, const NEventData &); 33 | 34 | virtual void output(magnet::xml::XmlStream &); 35 | 36 | virtual void replicaExchange(OutputPlugin &); 37 | 38 | void operator<<(const magnet::xml::Node &); 39 | 40 | std::unordered_map getImprovedW() const; 41 | inline double getBinWidth() const { return intEnergyHist.getBinWidth(); } 42 | 43 | protected: 44 | magnet::math::HistogramWeighted<> intEnergyHist; 45 | shared_ptr _ptrOPMisc; 46 | double binwidth; 47 | }; 48 | } // namespace dynamo 49 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/msd.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class Topology; 25 | 26 | class OPMSD : public OutputPlugin { 27 | public: 28 | OPMSD(const dynamo::Simulation *, const magnet::xml::Node &); 29 | ~OPMSD(); 30 | 31 | virtual void initialise(); 32 | 33 | virtual void eventUpdate(const Event &, const NEventData &) {} 34 | 35 | void output(magnet::xml::XmlStream &); 36 | 37 | Vector calcMSD(const IDRange &range) const; 38 | Vector calcD(const IDRange &range) const; 39 | 40 | Vector calcStructMSD(const Topology &) const; 41 | 42 | virtual void replicaExchange(OutputPlugin &) { 43 | M_throw() << "This plugin hasn't been prepared for changes of system"; 44 | } 45 | 46 | protected: 47 | std::vector initPos; 48 | }; 49 | } // namespace dynamo 50 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/msdOrientational.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class OPMSDOrientational : public OutputPlugin { 25 | public: 26 | OPMSDOrientational(const dynamo::Simulation *, const magnet::xml::Node &); 27 | ~OPMSDOrientational(); 28 | 29 | virtual void initialise(); 30 | 31 | // All null events 32 | virtual void eventUpdate(const Event &, const NEventData &) {} 33 | 34 | void output(magnet::xml::XmlStream &); 35 | 36 | struct msdCalcReturn { 37 | double parallel; 38 | double perpendicular; 39 | double rotational_legendre1; 40 | double rotational_legendre2; 41 | }; 42 | 43 | msdCalcReturn calculate() const; 44 | 45 | typedef std::pair RUpair; 46 | 47 | virtual void replicaExchange(OutputPlugin &) { 48 | M_throw() 49 | << "This output plugin hasn't been prepared for changes of system"; 50 | } 51 | 52 | protected: 53 | std::vector initialConfiguration; 54 | }; 55 | } // namespace dynamo 56 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/OrientationalOrder.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class OPOrientationalOrder : public OPTicker { 26 | public: 27 | OPOrientationalOrder(const dynamo::Simulation *, const magnet::xml::Node &); 28 | 29 | virtual void initialise(); 30 | 31 | virtual void stream(double) {} 32 | 33 | virtual void ticker(); 34 | 35 | virtual void output(magnet::xml::XmlStream &); 36 | 37 | virtual void operator<<(const magnet::xml::Node &); 38 | 39 | protected: 40 | typedef std::complex ComplexNum; 41 | 42 | std::vector _history; 43 | Vector _axis; 44 | double _rg; 45 | }; 46 | } // namespace dynamo 47 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/PolarNematic.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class OPPolarNematic : public OPTicker { 25 | public: 26 | OPPolarNematic(const dynamo::Simulation *, const magnet::xml::Node &); 27 | 28 | virtual void initialise(); 29 | 30 | virtual void stream(double) {} 31 | 32 | virtual void ticker(); 33 | 34 | virtual void output(magnet::xml::XmlStream &); 35 | 36 | virtual void operator<<(const magnet::xml::Node &); 37 | 38 | protected: 39 | std::vector> _history; 40 | }; 41 | } // namespace dynamo 42 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/SCparameter.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | class OPSCParameter : public OPTicker { 24 | public: 25 | OPSCParameter(const dynamo::Simulation *, const magnet::xml::Node &); 26 | 27 | virtual void initialise(); 28 | 29 | virtual void stream(double) {} 30 | 31 | virtual void ticker(); 32 | 33 | virtual void output(magnet::xml::XmlStream &); 34 | 35 | virtual void operator<<(const magnet::xml::Node &); 36 | 37 | protected: 38 | size_t maxWaveNumber; 39 | size_t count; 40 | std::vector runningsum; 41 | }; 42 | } // namespace dynamo 43 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/chainBondAngles.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class OPChainBondAngles : public OPTicker { 26 | public: 27 | OPChainBondAngles(const dynamo::Simulation *, const magnet::xml::Node &); 28 | 29 | virtual void initialise(); 30 | 31 | virtual void stream(double) {} 32 | 33 | virtual void ticker(); 34 | 35 | virtual void output(magnet::xml::XmlStream &); 36 | 37 | virtual void operator<<(const magnet::xml::Node &); 38 | 39 | protected: 40 | struct Cdata { 41 | Cdata(size_t, size_t, double); 42 | const size_t chainID; 43 | std::vector> BondCorrelations; 44 | std::vector BondCorrelationsAvg; 45 | std::vector BondCorrelationsSamples; 46 | }; 47 | 48 | std::list chains; 49 | double binwidth; 50 | }; 51 | } // namespace dynamo 52 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/chainBondLength.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class OPChainBondLength : public OPTicker { 26 | public: 27 | OPChainBondLength(const dynamo::Simulation *, const magnet::xml::Node &); 28 | 29 | virtual void initialise(); 30 | 31 | virtual void stream(double) {} 32 | 33 | virtual void ticker(); 34 | 35 | virtual void output(magnet::xml::XmlStream &); 36 | 37 | protected: 38 | struct Cdata { 39 | Cdata(size_t chainID, size_t CL); 40 | const size_t chainID; 41 | std::vector> BondLengths; 42 | }; 43 | 44 | std::list chains; 45 | }; 46 | } // namespace dynamo 47 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/chainContactMap.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class TChain; 26 | class IDRange; 27 | 28 | class OPCContactMap : public OPTicker { 29 | public: 30 | OPCContactMap(const dynamo::Simulation *, const magnet::xml::Node &); 31 | 32 | virtual void initialise(); 33 | 34 | virtual void stream(double) {} 35 | 36 | virtual void ticker(); 37 | 38 | virtual void replicaExchange(OutputPlugin &); 39 | 40 | virtual void output(magnet::xml::XmlStream &); 41 | 42 | protected: 43 | struct Cdata { 44 | Cdata(const TChain *, unsigned long); 45 | 46 | const TChain *chainPtr; 47 | std::unique_ptr array; 48 | unsigned long counter; 49 | unsigned long chainlength; 50 | }; 51 | 52 | std::vector chains; 53 | }; 54 | } // namespace dynamo 55 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/chaintorsion.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class TChain; 25 | 26 | class OPCTorsion : public OPTicker { 27 | public: 28 | OPCTorsion(const dynamo::Simulation *, const magnet::xml::Node &); 29 | 30 | virtual void initialise(); 31 | 32 | virtual void stream(double) {} 33 | 34 | virtual void ticker(); 35 | 36 | virtual void output(magnet::xml::XmlStream &); 37 | 38 | protected: 39 | struct CTCdata { 40 | const TChain *chainPtr; 41 | magnet::math::Histogram<> gammaMol; 42 | magnet::math::Histogram<> gammaSys; 43 | magnet::math::Histogram<> f; 44 | CTCdata(const TChain *ptr, double binwidth1, double binwidth2, 45 | double binwidth3) 46 | : chainPtr(ptr), gammaMol(binwidth1), gammaSys(binwidth2), 47 | f(binwidth3) {} 48 | }; 49 | 50 | std::list chains; 51 | }; 52 | } // namespace dynamo 53 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/craig.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class OPCraig : public OPTicker { 26 | public: 27 | OPCraig(const dynamo::Simulation *, const magnet::xml::Node &); 28 | 29 | virtual void initialise(); 30 | 31 | virtual void stream(double) {} 32 | 33 | virtual void ticker(); 34 | 35 | virtual void operator<<(const magnet::xml::Node &); 36 | 37 | virtual void output(magnet::xml::XmlStream &); 38 | 39 | virtual double getTemperature(const Vector &, const double); 40 | 41 | virtual double volume(const Vector &); 42 | 43 | protected: 44 | std::vector guf; 45 | std::vector temperatures; 46 | std::vector densities; 47 | std::vector> speciesTemperatures; 48 | std::vector> speciesDensities; 49 | int numberOfSpecies; 50 | size_t nBins; 51 | size_t tickCount; 52 | static const size_t X = 0; 53 | }; 54 | } // namespace dynamo 55 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/kenergyticker.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace dynamo { 26 | class OPKEnergyTicker : public OPTicker { 27 | public: 28 | OPKEnergyTicker(const dynamo::Simulation *, const magnet::xml::Node &); 29 | 30 | typedef std::array col; 31 | typedef std::array matrix; 32 | 33 | virtual void initialise(); 34 | 35 | virtual void stream(double) {} 36 | 37 | virtual void ticker(); 38 | 39 | virtual void output(magnet::xml::XmlStream &); 40 | 41 | void operator<<(const magnet::xml::Node &); 42 | 43 | virtual void periodicOutput(); 44 | 45 | protected: 46 | size_t count; 47 | matrix sum; 48 | }; 49 | } // namespace dynamo 50 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/msdOrientationalCorrelator.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class OPMSDOrientationalCorrelator : public OPTicker { 26 | public: 27 | OPMSDOrientationalCorrelator(const dynamo::Simulation *, 28 | const magnet::xml::Node &); 29 | 30 | virtual void initialise(); 31 | 32 | void output(magnet::xml::XmlStream &); 33 | 34 | virtual void operator<<(const magnet::xml::Node &); 35 | 36 | typedef std::pair RUpair; 37 | 38 | protected: 39 | virtual void stream(double) {} 40 | virtual void ticker(); 41 | 42 | void accPass(); 43 | 44 | std::vector> historicalData; 45 | std::vector stepped_data_parallel, stepped_data_perpendicular, 46 | stepped_data_rotational_legendre1, stepped_data_rotational_legendre2; 47 | 48 | size_t length; 49 | size_t currCorrLength; 50 | size_t ticksTaken; 51 | bool notReady; 52 | }; 53 | } // namespace dynamo 54 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/msdcorrelator.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class OPMSDCorrelator : public OPTicker { 26 | public: 27 | OPMSDCorrelator(const dynamo::Simulation *, const magnet::xml::Node &); 28 | 29 | virtual void initialise(); 30 | 31 | void output(magnet::xml::XmlStream &); 32 | 33 | virtual void operator<<(const magnet::xml::Node &); 34 | 35 | protected: 36 | virtual void stream(double) {} 37 | virtual void ticker(); 38 | 39 | void accPass(); 40 | 41 | std::vector> posHistory; 42 | std::vector> speciesData; 43 | std::vector> structData; 44 | size_t length; 45 | size_t currCorrLength; 46 | size_t ticksTaken; 47 | bool notReady; 48 | }; 49 | } // namespace dynamo 50 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/overlap.cpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | OPOverlapTest::OPOverlapTest(const dynamo::Simulation *tmp, 25 | const magnet::xml::Node &) 26 | : OPTicker(tmp, "OverlapTester") {} 27 | 28 | void OPOverlapTest::initialise() { 29 | dout << "Testing for overlaps in starting configuration" << std::endl; 30 | ticker(); 31 | } 32 | 33 | void OPOverlapTest::output(magnet::xml::XmlStream &) { 34 | dout << "Testing for overlaps in output configuration" << std::endl; 35 | ticker(); 36 | } 37 | 38 | void OPOverlapTest::ticker() { 39 | for (std::vector::const_iterator iPtr = Sim->particles.begin(); 40 | iPtr != Sim->particles.end(); ++iPtr) 41 | for (std::vector::const_iterator jPtr = iPtr + 1; 42 | jPtr != Sim->particles.end(); ++jPtr) 43 | Sim->getInteraction(*iPtr, *jPtr)->validateState(*iPtr, *jPtr); 44 | } 45 | } // namespace dynamo 46 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/overlap.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace dynamo { 23 | class OPOverlapTest : public OPTicker { 24 | public: 25 | OPOverlapTest(const dynamo::Simulation *, const magnet::xml::Node &); 26 | 27 | virtual void initialise(); 28 | 29 | virtual void stream(double) {} 30 | 31 | virtual void ticker(); 32 | 33 | virtual void output(magnet::xml::XmlStream &); 34 | 35 | protected: 36 | }; 37 | } // namespace dynamo 38 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/periodmsd.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class OPMSD; 25 | class Topology; 26 | 27 | class OPPeriodicMSD : public OPTicker { 28 | public: 29 | OPPeriodicMSD(const dynamo::Simulation *, const magnet::xml::Node &); 30 | 31 | virtual void initialise(); 32 | 33 | void output(magnet::xml::XmlStream &); 34 | 35 | protected: 36 | virtual void stream(double) {} 37 | virtual void ticker(); 38 | 39 | typedef std::pair localpair; 40 | 41 | std::list results; 42 | 43 | typedef std::pair> localpair2; 44 | 45 | std::vector structResults; 46 | std::vector> speciesData; 47 | 48 | shared_ptr ptrOPMSD; 49 | }; 50 | } // namespace dynamo 51 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/structureImage.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class OPStructureImaging : public OPTicker { 25 | public: 26 | OPStructureImaging(const dynamo::Simulation *, const magnet::xml::Node &); 27 | 28 | virtual void initialise(); 29 | 30 | virtual void stream(double) {} 31 | 32 | virtual void ticker(); 33 | 34 | // virtual void replicaExchange(OutputPlugin&); 35 | 36 | virtual void operator<<(const magnet::xml::Node &); 37 | 38 | virtual void output(magnet::xml::XmlStream &); 39 | 40 | protected: 41 | void printImage(); 42 | size_t id; 43 | size_t imageCount; 44 | std::vector> imagelist; 45 | std::string structureName; 46 | }; 47 | } // namespace dynamo 48 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/ticker.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* dynamo:- Event driven molecular dynamics simulator 3 | http://www.dynamomd.org 4 | Copyright (C) 2011 Marcus N Campbell Bannerman 5 | 6 | This program is free software: you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | version 3 as published by the Free Software Foundation. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | OPTicker::OPTicker(const dynamo::Simulation *t1, const char *t2) 25 | : OutputPlugin(t1, t2) {} 26 | 27 | double OPTicker::getTickerTime() const { 28 | try { 29 | return std::dynamic_pointer_cast(Sim->systems["SystemTicker"]) 30 | ->getPeriod(); 31 | } catch (const std::bad_cast &) { 32 | M_throw() << "Could not upcast the SystemTicker system event to SysTicker, " 33 | "have you named a system as SystemTicker?"; 34 | } 35 | } 36 | } // namespace dynamo 37 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/ticker.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | /*! \brief An output plugin marker class for periodically 'ticked' 23 | * plugins, ticked by the SysTicker class. 24 | * 25 | * This class doesn't require any Dynamics::updateParticle or 26 | * Dynamics::updateAllParticles as this is done in the SysTicker 27 | * class. This is optimal as most ticker plugins need it anyway 28 | */ 29 | class OPTicker : public OutputPlugin { 30 | public: 31 | OPTicker(const dynamo::Simulation *, const char *); 32 | 33 | // Non virtual to warn if you use them, 34 | void eventUpdate(const Event &, const NEventData &) {} 35 | 36 | virtual void output(magnet::xml::XmlStream &) {} 37 | 38 | virtual void ticker() = 0; 39 | 40 | virtual void periodicOutput() {} 41 | 42 | virtual void replicaExchange(OutputPlugin &) { 43 | M_throw() << "This System type hasn't been prepared for changes of system"; 44 | } 45 | 46 | protected: 47 | double getTickerTime() const; 48 | }; 49 | } // namespace dynamo 50 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/vacf.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class OPVACF : public OPTicker { 26 | public: 27 | OPVACF(const dynamo::Simulation *, const magnet::xml::Node &); 28 | 29 | virtual void initialise(); 30 | 31 | void output(magnet::xml::XmlStream &); 32 | 33 | virtual void operator<<(const magnet::xml::Node &); 34 | 35 | protected: 36 | virtual void stream(double) {} 37 | virtual void ticker(); 38 | 39 | void accPass(); 40 | 41 | std::vector> velHistory; 42 | std::vector> speciesData; 43 | std::vector> structData; 44 | size_t length; 45 | size_t currCorrLength; 46 | size_t ticksTaken; 47 | }; 48 | } // namespace dynamo 49 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/vel_dist.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace dynamo { 26 | class OPVelDist : public OPTicker { 27 | public: 28 | OPVelDist(const dynamo::Simulation *, const magnet::xml::Node &); 29 | 30 | virtual void initialise(); 31 | 32 | virtual void stream(double) {} 33 | 34 | virtual void ticker(); 35 | 36 | virtual void output(magnet::xml::XmlStream &); 37 | 38 | void operator<<(const magnet::xml::Node &); 39 | 40 | protected: 41 | double binWidth; 42 | std::vector> data[NDIM]; 43 | }; 44 | } // namespace dynamo 45 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/velprof.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | class OPVelProfile : public OPTicker { 24 | public: 25 | OPVelProfile(const dynamo::Simulation *, const magnet::xml::Node &); 26 | 27 | virtual void initialise(); 28 | 29 | virtual void stream(double) {} 30 | 31 | virtual void ticker(); 32 | 33 | virtual void output(magnet::xml::XmlStream &); 34 | 35 | protected: 36 | std::vector>> vx; 37 | 38 | size_t samplesTaken; 39 | double binWidth; 40 | }; 41 | } // namespace dynamo 42 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/tickerproperty/vtk.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class OPVTK : public OPTicker { 25 | public: 26 | OPVTK(const dynamo::Simulation *, const magnet::xml::Node &); 27 | 28 | virtual void initialise(); 29 | 30 | virtual void stream(double) {} 31 | 32 | virtual void ticker(); 33 | 34 | virtual void operator<<(const magnet::xml::Node &); 35 | 36 | virtual void output(magnet::xml::XmlStream &); 37 | 38 | protected: 39 | Vector _binWidths; 40 | std::array _binCounts; 41 | std::vector _numberField; 42 | std::vector _massField; 43 | std::vector _momentumField; 44 | std::vector _kineticEnergyField; 45 | 46 | size_t imageCount; 47 | bool _fields; 48 | }; 49 | } // namespace dynamo 50 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/outputplugins/trajectory.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | class OPTrajectory : public OutputPlugin { 24 | public: 25 | OPTrajectory(const dynamo::Simulation *, const magnet::xml::Node &); 26 | 27 | OPTrajectory(const OPTrajectory &); 28 | 29 | ~OPTrajectory() {} 30 | 31 | void eventUpdate(const Event &, const NEventData &); 32 | 33 | virtual void replicaExchange(OutputPlugin &) { 34 | M_throw() 35 | << "This output plugin hasn't been prepared for changes of system"; 36 | } 37 | 38 | virtual void initialise(); 39 | 40 | virtual void output(magnet::xml::XmlStream &); 41 | 42 | private: 43 | mutable std::ofstream logfile; 44 | }; 45 | } // namespace dynamo 46 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/particle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace dynamo { 4 | //! \brief Operator to write out an XML representation of a Particle. 5 | magnet::xml::XmlStream &operator<<(magnet::xml::XmlStream &XML, 6 | const Particle &particle) { 7 | XML << magnet::xml::attr("ID") << particle._ID; 8 | 9 | if (!particle.testState(Particle::DYNAMIC)) 10 | XML << magnet::xml::attr("Static") << "Static"; 11 | 12 | XML << magnet::xml::tag("P") << (particle._pos) << magnet::xml::endtag("P") 13 | << magnet::xml::tag("V") << (particle._vel) << magnet::xml::endtag("V"); 14 | 15 | return XML; 16 | } 17 | 18 | Particle::Particle(const Vector &position, const Vector &velocity, 19 | const unsigned long &nID) 20 | : _pos(position), _peculiarTime(0.0), _vel(velocity), _ID(nID), 21 | _state(DEFAULT) {} 22 | 23 | Particle::Particle(const magnet::xml::Node &XML, unsigned long nID) 24 | : _peculiarTime(0.0), _ID(nID), _state(DEFAULT) { 25 | if (XML.hasAttribute("Static")) 26 | clearState(DYNAMIC); 27 | 28 | _pos << XML.getNode("P"); 29 | _vel << XML.getNode("V"); 30 | } 31 | } // namespace dynamo -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/IDPairRange.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace xml { 23 | class Node; 24 | class XmlStream; 25 | } // namespace xml 26 | } // namespace magnet 27 | namespace dynamo { 28 | using std::shared_ptr; 29 | class Simulation; 30 | class Particle; 31 | 32 | class IDPairRange { 33 | public: 34 | virtual ~IDPairRange() {} 35 | 36 | /*! \brief Test if the pair of particles are represented in this 37 | Range. */ 38 | virtual bool isInRange(const Particle &, const Particle &) const = 0; 39 | 40 | /*! \brief Test if this one particle is within the Range, with any 41 | other particle. */ 42 | virtual bool isInRange(const Particle &) const = 0; 43 | 44 | static IDPairRange *getClass(const magnet::xml::Node &, 45 | const dynamo::Simulation *); 46 | 47 | friend magnet::xml::XmlStream &operator<<(magnet::xml::XmlStream &XML, 48 | const IDPairRange &range); 49 | 50 | protected: 51 | virtual void outputXML(magnet::xml::XmlStream &XML) const = 0; 52 | }; 53 | } // namespace dynamo 54 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/IDPairRangeAll.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class IDPairRangeAll : public IDPairRange { 26 | public: 27 | IDPairRangeAll() {} 28 | 29 | IDPairRangeAll(const magnet::xml::Node &XML, const dynamo::Simulation *) {} 30 | 31 | virtual bool isInRange(const Particle &, const Particle &) const { 32 | return true; 33 | } 34 | virtual bool isInRange(const Particle &) const { return true; } 35 | 36 | protected: 37 | virtual void outputXML(magnet::xml::XmlStream &XML) const { 38 | XML << magnet::xml::attr("Type") << "All"; 39 | } 40 | }; 41 | } // namespace dynamo 42 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/IDPairRangeNone.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class IDPairRangeNone : public IDPairRange { 23 | public: 24 | IDPairRangeNone() {} 25 | 26 | IDPairRangeNone(const magnet::xml::Node &XML, const dynamo::Simulation *) {} 27 | 28 | virtual bool isInRange(const Particle &, const Particle &) const { 29 | return false; 30 | } 31 | virtual bool isInRange(const Particle &) const { return false; } 32 | 33 | protected: 34 | virtual void outputXML(magnet::xml::XmlStream &XML) const { 35 | XML << magnet::xml::attr("Type") << "None"; 36 | } 37 | }; 38 | } // namespace dynamo 39 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/IDPairRangeRangePair.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | class IDPairRangePair : public IDPairRange { 24 | public: 25 | IDPairRangePair(IDRange *r1, IDRange *r2) : range1(r1), range2(r2) {} 26 | 27 | IDPairRangePair(const magnet::xml::Node &XML, const dynamo::Simulation *Sim) { 28 | magnet::xml::Node subRangeXML = XML.getNode("IDRange"); 29 | range1 = shared_ptr(IDRange::getClass(subRangeXML, Sim)); 30 | ++subRangeXML; 31 | range2 = shared_ptr(IDRange::getClass(subRangeXML, Sim)); 32 | } 33 | 34 | virtual bool isInRange(const Particle &p1, const Particle &p2) const { 35 | return (range1->isInRange(p1) && range2->isInRange(p2)) || 36 | (range1->isInRange(p2) && range2->isInRange(p1)); 37 | } 38 | 39 | virtual bool isInRange(const Particle &p1) const { 40 | return range1->isInRange(p1) || range2->isInRange(p1); 41 | } 42 | 43 | protected: 44 | virtual void outputXML(magnet::xml::XmlStream &XML) const { 45 | XML << magnet::xml::attr("Type") << "Pair" << range1 << range2; 46 | } 47 | 48 | shared_ptr range1; 49 | shared_ptr range2; 50 | }; 51 | } // namespace dynamo 52 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/IDPairRangeSelf.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class IDPairRangeSelf : public IDPairRange { 26 | public: 27 | IDPairRangeSelf(IDRange *r1) : range(r1) {} 28 | 29 | IDPairRangeSelf(const magnet::xml::Node &XML, const dynamo::Simulation *Sim) { 30 | range = shared_ptr(IDRange::getClass(XML.getNode("IDRange"), Sim)); 31 | } 32 | 33 | virtual bool isInRange(const Particle &p1, const Particle &p2) const { 34 | return (p1.getID() == p2.getID()) && range->isInRange(p1); 35 | } 36 | 37 | virtual bool isInRange(const Particle &p1) const { 38 | return range->isInRange(p1); 39 | } 40 | 41 | const shared_ptr &getRange() const { return range; } 42 | 43 | protected: 44 | virtual void outputXML(magnet::xml::XmlStream &XML) const { 45 | XML << magnet::xml::attr("Type") << "Self" << range; 46 | } 47 | 48 | shared_ptr range; 49 | }; 50 | } // namespace dynamo 51 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/IDPairRangeSingle.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class IDPairRangeSingle : public IDPairRange { 26 | public: 27 | IDPairRangeSingle(IDRange *r1) : range(r1) {} 28 | 29 | IDPairRangeSingle(const magnet::xml::Node &XML, 30 | const dynamo::Simulation *Sim) { 31 | range = shared_ptr(IDRange::getClass(XML.getNode("IDRange"), Sim)); 32 | } 33 | 34 | virtual bool isInRange(const Particle &p1, const Particle &p2) const { 35 | return range->isInRange(p1) && range->isInRange(p2); 36 | } 37 | 38 | virtual bool isInRange(const Particle &p1) const { 39 | return range->isInRange(p1); 40 | } 41 | 42 | const shared_ptr &getRange() const { return range; } 43 | 44 | protected: 45 | virtual void outputXML(magnet::xml::XmlStream &XML) const { 46 | XML << magnet::xml::attr("Type") << "Single" << range; 47 | } 48 | 49 | shared_ptr range; 50 | }; 51 | } // namespace dynamo 52 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/IDRangeAll.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace dynamo { 26 | class IDRangeAll : public IDRange, public dynamo::SimBase_const { 27 | public: 28 | IDRangeAll(const dynamo::Simulation *SimDat) 29 | : SimBase_const(SimDat, "IDRangeAll") {} 30 | 31 | IDRangeAll(const magnet::xml::Node &XML, const dynamo::Simulation *SimDat) 32 | : SimBase_const(SimDat, "IDRangeAll") { 33 | operator<<(XML); 34 | } 35 | 36 | virtual bool isInRange(const Particle &) const { return true; } 37 | 38 | void operator<<(const magnet::xml::Node &XML) {} 39 | 40 | virtual unsigned long size() const { return Sim->particles.size(); } 41 | 42 | virtual unsigned long operator[](unsigned long i) const { return i; } 43 | 44 | virtual unsigned long at(unsigned long i) const { 45 | if (i >= Sim->particles.size()) 46 | M_throw() << "Bad array access value in range.at()"; 47 | 48 | return i; 49 | } 50 | 51 | protected: 52 | void outputXML(magnet::xml::XmlStream &XML) const { 53 | XML << magnet::xml::attr("Type") << "All"; 54 | } 55 | }; 56 | } // namespace dynamo 57 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/IDRangeNone.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | class IDRangeNone : public IDRange { 26 | public: 27 | IDRangeNone() {} 28 | 29 | IDRangeNone(const magnet::xml::Node &XML) {} 30 | 31 | virtual bool isInRange(const Particle &) const { return false; } 32 | 33 | virtual unsigned long size() const { return 0; } 34 | 35 | virtual unsigned long operator[](unsigned long i) const { 36 | M_throw() << "Nothing to access"; 37 | } 38 | 39 | virtual unsigned long at(unsigned long i) const { 40 | M_throw() << "Nothing to access"; 41 | } 42 | 43 | protected: 44 | virtual void outputXML(magnet::xml::XmlStream &XML) const { 45 | XML << magnet::xml::attr("Type") << "None"; 46 | } 47 | }; 48 | } // namespace dynamo 49 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/ranges/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/schedulers/dumbsched.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class SDumb : public Scheduler { 23 | public: 24 | SDumb(const magnet::xml::Node &, dynamo::Simulation *const); 25 | 26 | SDumb(dynamo::Simulation *const, FEL *); 27 | 28 | virtual void initialiseNBlist() {} 29 | 30 | virtual double getNeighbourhoodDistance() const { 31 | return std::numeric_limits::infinity(); 32 | } 33 | virtual std::unique_ptr 34 | getParticleNeighbours(const Particle &) const; 35 | virtual std::unique_ptr getParticleNeighbours(const Vector &) const; 36 | virtual std::unique_ptr getParticleLocals(const Particle &) const; 37 | 38 | protected: 39 | virtual void outputXML(magnet::xml::XmlStream &) const; 40 | }; 41 | } // namespace dynamo 42 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/schedulers/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/schedulers/neighbourlist.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class SNeighbourList : public Scheduler, public magnet::Tracked { 23 | public: 24 | SNeighbourList(const magnet::xml::Node &, dynamo::Simulation *const); 25 | 26 | SNeighbourList(dynamo::Simulation *const, FEL *); 27 | 28 | virtual void initialise(); 29 | virtual void initialiseNBlist(); 30 | 31 | virtual double getNeighbourhoodDistance() const; 32 | virtual std::unique_ptr 33 | getParticleNeighbours(const Particle &) const; 34 | virtual std::unique_ptr getParticleNeighbours(const Vector &) const; 35 | virtual std::unique_ptr getParticleLocals(const Particle &) const; 36 | 37 | protected: 38 | virtual void outputXML(magnet::xml::XmlStream &) const; 39 | 40 | size_t NBListID; 41 | }; 42 | } // namespace dynamo 43 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/schedulers/systemonly.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class SSystemOnly : public Scheduler { 23 | public: 24 | SSystemOnly(const magnet::xml::Node &, dynamo::Simulation *const); 25 | 26 | SSystemOnly(dynamo::Simulation *const, FEL *); 27 | 28 | virtual void rebuildList(); 29 | 30 | virtual void initialise(); 31 | virtual void initialiseNBlist() {} 32 | 33 | virtual double getNeighbourhoodDistance() const { return 0; } 34 | virtual std::unique_ptr 35 | getParticleNeighbours(const Particle &) const; 36 | virtual std::unique_ptr getParticleNeighbours(const Vector &) const; 37 | virtual std::unique_ptr getParticleLocals(const Particle &) const; 38 | 39 | protected: 40 | virtual void outputXML(magnet::xml::XmlStream &) const; 41 | }; 42 | } // namespace dynamo 43 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/species/fixedCollider.cpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | void SpFixedCollider::initialise() { 24 | SpPoint::initialise(); 25 | 26 | for (size_t ID : *range) 27 | Sim->particles[ID].clearState(Particle::DYNAMIC); 28 | } 29 | 30 | void SpFixedCollider::operator<<(const magnet::xml::Node &XML) { 31 | range = shared_ptr(IDRange::getClass(XML.getNode("IDRange"), Sim)); 32 | spName = XML.getAttribute("Name"); 33 | } 34 | 35 | void SpFixedCollider::outputXML(magnet::xml::XmlStream &XML) const { 36 | XML << magnet::xml::attr("Name") << spName << magnet::xml::attr("Type") 37 | << "FixedCollider"; 38 | XML << *range; 39 | } 40 | } // namespace dynamo 41 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/species/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/species/inertia.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace dynamo { 23 | /*! \brief A thin class to just dynamically check that a species has inertia*/ 24 | class SpInertia : public SpPoint { 25 | public: 26 | SpInertia(dynamo::Simulation *sim, IDRange *r, double nMass, 27 | std::string nName, unsigned int ID) 28 | : SpPoint(sim, r, nMass, nName, ID) {} 29 | 30 | SpInertia(const magnet::xml::Node &XML, dynamo::Simulation *Sim, 31 | unsigned int ID) 32 | : SpPoint(XML, Sim, ID) {} 33 | }; 34 | } // namespace dynamo 35 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/species/point.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace Gtk { 26 | class VBox; 27 | class RadioButton; 28 | } // namespace Gtk 29 | 30 | namespace dynamo { 31 | class SpPoint : public Species { 32 | public: 33 | template 34 | SpPoint(dynamo::Simulation *sim, IDRange *r, T1 nmass, std::string nName, 35 | unsigned int ID) 36 | : Species(sim, "SpPoint", r, nmass, nName, ID) {} 37 | 38 | SpPoint(const magnet::xml::Node &XML, dynamo::Simulation *nSim, 39 | unsigned int nID) 40 | : Species(nSim, "", NULL, 0, "", nID) { 41 | SpPoint::operator<<(XML); 42 | } 43 | 44 | virtual void initialise() {} 45 | 46 | virtual void operator<<(const magnet::xml::Node &XML); 47 | 48 | virtual double getScalarMomentOfInertia(size_t ID) const { 49 | M_throw() << "Species has no intertia"; 50 | } 51 | 52 | virtual double getParticleKineticEnergy(size_t ID) const; 53 | 54 | virtual double getDOF() const { return NDIM; } 55 | 56 | protected: 57 | virtual void outputXML(magnet::xml::XmlStream &XML) const; 58 | }; 59 | } // namespace dynamo 60 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/species/species.cpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | namespace dynamo { 23 | Species::~Species() {} 24 | 25 | shared_ptr Species::getClass(const magnet::xml::Node &XML, 26 | dynamo::Simulation *tmp, size_t nID) { 27 | if (!XML.getAttribute("Type").getValue().compare("Point")) 28 | return shared_ptr(new SpPoint(XML, tmp, nID)); 29 | else if (!XML.getAttribute("Type").getValue().compare("SphericalTop") || 30 | !XML.getAttribute("Type").getValue().compare("Lines")) 31 | return shared_ptr(new SpSphericalTop(XML, tmp, nID)); 32 | else if (!XML.getAttribute("Type").getValue().compare("FixedCollider")) 33 | return shared_ptr(new SpFixedCollider(XML, tmp, nID)); 34 | else 35 | M_throw() << XML.getAttribute("Type").getValue() 36 | << ", Unknown type of species encountered"; 37 | } 38 | 39 | double Species::getParticleKineticEnergy(const Particle &p) const { 40 | return getParticleKineticEnergy(p.getID()); 41 | } 42 | } // namespace dynamo 43 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/species/sphericalTop.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace dynamo { 23 | class SpSphericalTop : public SpInertia { 24 | public: 25 | SpSphericalTop(dynamo::Simulation *, IDRange *, double nMass, 26 | std::string nName, unsigned int ID, double iC); 27 | 28 | SpSphericalTop(const magnet::xml::Node &, dynamo::Simulation *, 29 | unsigned int ID); 30 | 31 | virtual double getScalarMomentOfInertia(size_t ID) const { 32 | return inertiaConstant * getMass(ID); 33 | } 34 | 35 | virtual void operator<<(const magnet::xml::Node &); 36 | 37 | virtual double getParticleKineticEnergy(size_t ID) const; 38 | 39 | virtual double getDOF() const { return NDIM + 2; } 40 | 41 | protected: 42 | virtual void outputXML(magnet::xml::XmlStream &XML) const { 43 | outputXML(XML, "SphericalTop"); 44 | } 45 | 46 | void outputXML(magnet::xml::XmlStream &XML, std::string type) const; 47 | 48 | double inertiaConstant; 49 | }; 50 | } // namespace dynamo 51 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/DSMCspheres.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class SysDSMCSpheres : public System { 25 | public: 26 | SysDSMCSpheres(const magnet::xml::Node &XML, dynamo::Simulation *); 27 | 28 | SysDSMCSpheres(dynamo::Simulation *, double, double, double, double, 29 | std::string, IDRange *, IDRange *); 30 | 31 | virtual NEventData runEvent(); 32 | 33 | virtual void initialise(size_t); 34 | 35 | virtual void operator<<(const magnet::xml::Node &); 36 | 37 | protected: 38 | virtual void outputXML(magnet::xml::XmlStream &) const; 39 | 40 | double tstep; 41 | double chi; 42 | double d2; 43 | double diameter; 44 | mutable double maxprob; 45 | double e; 46 | double factor; 47 | 48 | shared_ptr range1; 49 | shared_ptr range2; 50 | }; 51 | } // namespace dynamo 52 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/francesco.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | class SysFrancesco : public System { 25 | public: 26 | SysFrancesco(const magnet::xml::Node &XML, dynamo::Simulation *); 27 | 28 | SysFrancesco(dynamo::Simulation *, double, double, std::string); 29 | 30 | virtual NEventData runEvent(); 31 | 32 | virtual void initialise(size_t); 33 | 34 | virtual void operator<<(const magnet::xml::Node &); 35 | 36 | double getTemperature() const { return Temp; } 37 | double getReducedTemperature() const; 38 | void setTemperature(double nT) { 39 | Temp = nT; 40 | sqrtTemp = std::sqrt(Temp); 41 | } 42 | void setReducedTemperature(double nT); 43 | 44 | protected: 45 | virtual void outputXML(magnet::xml::XmlStream &) const; 46 | double meanFreeTime; 47 | double Temp, sqrtTemp; 48 | double _R; 49 | size_t dimensions; 50 | size_t eventCount; 51 | size_t lastlNColl; 52 | 53 | double getGhostt() const; 54 | 55 | shared_ptr range; 56 | }; 57 | } // namespace dynamo 58 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/nblistCompressionFix.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class SysNBListCompressionFix : public System { 23 | public: 24 | SysNBListCompressionFix(dynamo::Simulation *, double, size_t); 25 | 26 | virtual NEventData runEvent(); 27 | 28 | virtual void initialise(size_t); 29 | 30 | virtual void operator<<(const magnet::xml::Node &) {} 31 | 32 | void fixNBlistForOutput(); 33 | 34 | protected: 35 | virtual void outputXML(magnet::xml::XmlStream &) const {} 36 | 37 | double growthRate; 38 | double initialSupportedRange; 39 | size_t cellID; 40 | }; 41 | } // namespace dynamo 42 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/rotateGravity.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace dynamo { 24 | /*! \brief An event which periodically rotates the gravity vector 25 | some amount, to approximate the system being rotated. 26 | */ 27 | class SysRotateGravity : public System { 28 | public: 29 | SysRotateGravity(const magnet::xml::Node &XML, dynamo::Simulation *); 30 | SysRotateGravity(dynamo::Simulation *, std::string name, double timestep, 31 | double angularvel, Vector axis); 32 | 33 | virtual NEventData runEvent(); 34 | 35 | virtual void initialise(size_t); 36 | 37 | virtual void operator<<(const magnet::xml::Node &); 38 | 39 | Vector getAxis() const { return _rotationaxis; } 40 | 41 | protected: 42 | virtual void outputXML(magnet::xml::XmlStream &) const; 43 | 44 | double _timestep; 45 | double _angularvel; 46 | Vector _rotationaxis; 47 | }; 48 | } // namespace dynamo 49 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/sleep.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | Copyright (C) 2011 Sebastian Gonzalez 5 | 6 | This program is free software: you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | version 3 as published by the Free Software Foundation. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace dynamo { 27 | class SSleep : public System { 28 | public: 29 | SSleep(const magnet::xml::Node &XML, dynamo::Simulation *); 30 | 31 | SSleep(dynamo::Simulation *, std::string, IDRange *, double); 32 | 33 | virtual NEventData runEvent(); 34 | 35 | virtual void initialise(size_t); 36 | 37 | virtual void operator<<(const magnet::xml::Node &); 38 | 39 | protected: 40 | virtual void outputXML(magnet::xml::XmlStream &) const; 41 | 42 | void particlesUpdated(const NEventData &); 43 | 44 | void recalculateTime(); 45 | 46 | bool sleepCondition(const Particle &part, const Vector &g, 47 | const Vector &vel = Vector{0, 0, 0}); 48 | 49 | shared_ptr _range; 50 | double _sleepDistance; 51 | double _sleepTime; 52 | double _sleepVelocity; 53 | 54 | mutable std::map stateChange; 55 | 56 | std::vector> _lastData; 57 | }; 58 | } // namespace dynamo 59 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/sysTicker.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class SysTicker : public System { 23 | public: 24 | SysTicker(dynamo::Simulation *, double, std::string); 25 | 26 | virtual NEventData runEvent(); 27 | 28 | virtual void initialise(size_t); 29 | 30 | virtual void operator<<(const magnet::xml::Node &) {} 31 | 32 | void setdt(double); 33 | 34 | void increasedt(double); 35 | 36 | void setTickerPeriod(const double &); 37 | 38 | const double &getPeriod() const { return period; } 39 | 40 | virtual void replicaExchange(System &os) { 41 | SysTicker &s = static_cast(os); 42 | std::swap(dt, s.dt); 43 | std::swap(period, s.period); 44 | } 45 | 46 | protected: 47 | virtual void outputXML(magnet::xml::XmlStream &) const {} 48 | 49 | double period; 50 | }; 51 | } // namespace dynamo 52 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/tHalt.cpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace dynamo { 25 | SystHalt::SystHalt(dynamo::Simulation *nSim, double ndt, std::string nName) 26 | : System(nSim) { 27 | dt = ndt * Sim->units.unitTime(); 28 | 29 | sysName = nName; 30 | 31 | dout << "System halt set for " << ndt << std::endl; 32 | 33 | type = VIRTUAL; 34 | } 35 | 36 | NEventData SystHalt::runEvent() { 37 | Sim->nextPrintEvent = Sim->endEventCount = Sim->eventCount; 38 | return NEventData(); 39 | } 40 | 41 | void SystHalt::initialise(size_t nID) { ID = nID; } 42 | 43 | void SystHalt::setdt(double ndt) { dt = ndt * Sim->units.unitTime(); } 44 | 45 | void SystHalt::increasedt(double ndt) { dt += ndt * Sim->units.unitTime(); } 46 | } // namespace dynamo 47 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/tHalt.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class SystHalt : public System { 23 | public: 24 | SystHalt(dynamo::Simulation *, double, std::string); 25 | 26 | virtual NEventData runEvent(); 27 | 28 | virtual void initialise(size_t); 29 | 30 | virtual void operator<<(const magnet::xml::Node &) {} 31 | 32 | void setdt(double); 33 | 34 | void increasedt(double); 35 | 36 | virtual void replicaExchange(System &os) { 37 | auto s = static_cast(os); 38 | std::swap(dt, s.dt); 39 | } 40 | 41 | protected: 42 | virtual void outputXML(magnet::xml::XmlStream &) const {} 43 | }; 44 | } // namespace dynamo 45 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/umbrella.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace dynamo { 26 | class SysUmbrella : public System { 27 | public: 28 | SysUmbrella(const magnet::xml::Node &XML, dynamo::Simulation *); 29 | 30 | virtual NEventData runEvent(); 31 | 32 | virtual void initialise(size_t); 33 | 34 | virtual void operator<<(const magnet::xml::Node &); 35 | 36 | virtual void outputData(magnet::xml::XmlStream &) const; 37 | 38 | protected: 39 | virtual void outputXML(magnet::xml::XmlStream &) const; 40 | 41 | void particlesUpdated(const NEventData &); 42 | 43 | void recalculateTime(); 44 | 45 | std::size_t _stepID; 46 | shared_ptr _potential; 47 | shared_ptr range1; 48 | shared_ptr range2; 49 | double _energyScale; 50 | double _lengthScale; 51 | mutable std::map _histogram; 52 | mutable long double _lastSystemTime; 53 | }; 54 | } // namespace dynamo 55 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/systems/visualizer.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #ifdef DYNAMO_visualizer 21 | #include 22 | #include 23 | #include 24 | 25 | namespace coil { 26 | class DataSet; 27 | } 28 | namespace dynamo { 29 | class SVisualizer : public System { 30 | public: 31 | SVisualizer(dynamo::Simulation *, std::string, double); 32 | 33 | virtual NEventData runEvent(); 34 | 35 | virtual void initialise(size_t); 36 | 37 | virtual void operator<<(const magnet::xml::Node &) {} 38 | 39 | void particlesUpdated(const NEventData &); 40 | 41 | protected: 42 | SVisualizer( 43 | const SVisualizer &); // Cannot copy due to the coil update connection 44 | 45 | virtual void outputXML(magnet::xml::XmlStream &) const {} 46 | 47 | shared_ptr _window; 48 | coil::CoilRegister _coil; 49 | 50 | void initDataSet(); 51 | void updateRenderData(); 52 | 53 | shared_ptr _particleData; 54 | boost::posix_time::ptime _lastUpdate; 55 | std::vector> _interactionIDs; 56 | }; 57 | } // namespace dynamo 58 | #endif 59 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/topology/chain.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace dynamo { 22 | class TChain : public Topology { 23 | public: 24 | TChain(const magnet::xml::Node &, dynamo::Simulation *, unsigned int ID); 25 | 26 | TChain(dynamo::Simulation *, unsigned int ID, std::string); 27 | 28 | virtual ~TChain() {} 29 | 30 | virtual void operator<<(const magnet::xml::Node &); 31 | 32 | protected: 33 | virtual void outputXML(magnet::xml::XmlStream &) const; 34 | }; 35 | } // namespace dynamo 36 | -------------------------------------------------------------------------------- /src/dynamo/dynamo/topology/include.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | -------------------------------------------------------------------------------- /src/magnet/magnet/CL/detail/common.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | * http://www.dynamomd.org 3 | * Copyright (C) 2009 Marcus N Campbell Bannerman 4 | * 5 | * This program is free software: you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * version 3 as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #pragma once 18 | 19 | #define __CL_ENABLE_EXCEPTIONS 20 | #include 21 | #include 22 | #include 23 | #include 24 | -------------------------------------------------------------------------------- /src/magnet/magnet/CL/detail/extension_wrangler.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | * http://www.dynamomd.org 3 | * Copyright (C) 2009 Marcus N Campbell Bannerman 4 | * 5 | * This program is free software: you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * version 3 as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #pragma once 18 | 19 | #define __CL_ENABLE_EXCEPTIONS 20 | #include 21 | #include 22 | 23 | namespace magnet { 24 | namespace CL { 25 | namespace detail { 26 | // Check if a device supports an OpenCL extension 27 | inline bool detectExtension(cl::Device device, const std::string extension) { 28 | std::string extensions = device.getInfo(); 29 | return extensions.find(extension) != std::string::npos; 30 | } 31 | 32 | // Check if all devices in a context support an OpenCL extension 33 | inline bool detectExtension(cl::Context context, const std::string extension) { 34 | std::vector devices = context.getInfo(); 35 | 36 | for (std::vector::const_iterator devPtr = devices.begin(); 37 | devPtr != devices.end(); ++devPtr) 38 | if (!detectExtension(*devPtr, extension)) 39 | return false; 40 | 41 | return true; 42 | } 43 | } // namespace detail 44 | } // namespace CL 45 | } // namespace magnet 46 | -------------------------------------------------------------------------------- /src/magnet/magnet/GL/detail/error_check.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | * http://www.dynamomd.org 3 | * Copyright (C) 2009 Marcus N Campbell Bannerman 4 | * 5 | * This program is free software: you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * version 3 as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace magnet { 23 | namespace GL { 24 | namespace detail { 25 | inline void errorCheck() { 26 | #ifdef MAGNET_DEBUG 27 | GLenum errcode = glGetError(); 28 | switch (errcode) { 29 | case GL_NO_ERROR: 30 | return; 31 | case GL_INVALID_ENUM: 32 | M_throw() << "glGetError() returned GL_INVALID_ENUM"; 33 | case GL_INVALID_VALUE: 34 | M_throw() << "glGetError() returned GL_INVALID_VALUE"; 35 | case GL_INVALID_OPERATION: 36 | M_throw() << "glGetError() returned GL_INVALID_OPERATION"; 37 | case GL_OUT_OF_MEMORY: 38 | M_throw() << "glGetError() returned GL_OUT_OF_MEMORY"; 39 | case GL_INVALID_FRAMEBUFFER_OPERATION: 40 | M_throw() << "glGetError() returned GL_INVALID_FRAMEBUFFER_OPERATION"; 41 | default: 42 | M_throw() << "glGetError() returned " << errcode; 43 | } 44 | #endif 45 | } 46 | 47 | } // namespace detail 48 | } // namespace GL 49 | } // namespace magnet 50 | -------------------------------------------------------------------------------- /src/magnet/magnet/GL/shader/copy.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | * http://www.dynamomd.org 3 | * Copyright (C) 2009 Marcus N Campbell Bannerman 4 | * 5 | * This program is free software: you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * version 3 as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #pragma once 18 | #include 19 | 20 | namespace magnet { 21 | namespace GL { 22 | namespace shader { 23 | class CopyShader : public detail::SSKernelShader { 24 | public: 25 | void build() { SSKernelShader::build(1); } 26 | 27 | virtual const GLfloat *weights() { 28 | static const GLfloat weights[1][1] = {{1}}; 29 | return (const GLfloat *)weights; 30 | } 31 | }; 32 | } // namespace shader 33 | } // namespace GL 34 | } // namespace magnet 35 | -------------------------------------------------------------------------------- /src/magnet/magnet/GL/shader/multiplyTexture.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | * http://www.dynamomd.org 3 | * Copyright (C) 2009 Marcus N Campbell Bannerman 4 | * 5 | * This program is free software: you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * version 3 as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #pragma once 18 | #include 19 | #define STRINGIFY(A) #A 20 | 21 | namespace magnet { 22 | namespace GL { 23 | namespace shader { 24 | /*! \brief Simple \ref Shader to multiply two textures.*/ 25 | class MultiplyTexture : public detail::SSShader { 26 | public: 27 | virtual std::string initFragmentShaderSource() { 28 | return STRINGIFY(uniform sampler2D u_Texture0; // input 29 | uniform sampler2D u_Texture1; // Depth buffer 30 | 31 | smooth in vec2 screenCoord; 32 | layout(location = 0) out vec4 color_out; 33 | 34 | void main(void) { 35 | color_out = texture(u_Texture0, screenCoord) * 36 | texture(u_Texture1, screenCoord); 37 | }); 38 | } 39 | }; 40 | } // namespace shader 41 | } // namespace GL 42 | } // namespace magnet 43 | 44 | #undef STRINGIFY 45 | -------------------------------------------------------------------------------- /src/magnet/magnet/arg_share.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace magnet { 23 | struct ArgShare { 24 | ArgShare() : _argc(NULL), _argv(NULL) {} 25 | 26 | inline static ArgShare &getInstance() { 27 | static ArgShare instance; 28 | return instance; 29 | } 30 | 31 | void setArgs(int &argc, char **&argv) { 32 | _argc = &argc; 33 | _argv = &argv; 34 | } 35 | 36 | int &getArgc() { 37 | if (_argc == NULL) 38 | M_throw() << "Command line args not passed to ArgShare"; 39 | return *_argc; 40 | } 41 | 42 | char **&getArgv() { 43 | if (_argv == NULL) 44 | M_throw() << "Command line args not passed to ArgShare"; 45 | 46 | return *_argv; 47 | } 48 | 49 | private: 50 | int *_argc; 51 | char ***_argv; 52 | }; 53 | } // namespace magnet 54 | -------------------------------------------------------------------------------- /src/magnet/magnet/clamp.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | /*! \brief A C++ equivalent of the OpenCL and OpenGL clamp function. 23 | * 24 | * \param Val The value to clamp. 25 | * \param Min The lower bound to return if Val < Min. 26 | * \param Max The upper bound to return if Val > Max. 27 | */ 28 | template inline T clamp(T Val, T Min, T Max) { 29 | return std::max(std::min(Val, Max), Min); 30 | } 31 | } // namespace magnet 32 | -------------------------------------------------------------------------------- /src/magnet/magnet/color/marcus.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace magnet { 25 | namespace color { 26 | inline void MarcustoRGB(GLfloat color[4], float h) { 27 | h = clamp(h, 0.0f, 1.0f); 28 | 29 | float R = clamp(2.0f * h - 0.84f, 0.0f, 1.0f); 30 | float B = clamp(std::fabs(2.0f * h - 0.5f), 0.0f, 1.0f); 31 | 32 | float G; 33 | if (h < 0.3) 34 | G = 4.0 * h; 35 | else if (h < 0.92) 36 | G = 1.84 - (2.0 * h); 37 | else 38 | G = (h / 0.08) - 11.5; 39 | 40 | G = clamp(G, 0.0f, 1.0f); 41 | 42 | color[0] = R; 43 | color[1] = G; 44 | color[2] = B; 45 | color[3] = 1; 46 | } 47 | } // namespace color 48 | } // namespace magnet 49 | -------------------------------------------------------------------------------- /src/magnet/magnet/color/sebastian.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace magnet { 25 | namespace color { 26 | inline void SebastiantoRGB(GLfloat color[4], float h) { 27 | h = clamp(h, 0.0f, 1.0f); 28 | 29 | color[0] = h; 30 | color[1] = 4 * h * (1 - h); 31 | color[2] = (1 - h); 32 | color[3] = 1; 33 | } 34 | } // namespace color 35 | } // namespace magnet 36 | -------------------------------------------------------------------------------- /src/magnet/magnet/containers/iterator_pair.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | Copyright (C) 2008 Todd Wease <-> 5 | 6 | This program is free software: you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License 8 | version 3 as published by the Free Software Foundation. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | Based on a an original implementation kindly released by Todd 19 | Wease. 20 | */ 21 | #pragma once 22 | 23 | namespace magnet { 24 | namespace containers { 25 | /*! \brief This container allows a pair of iterators to be used in 26 | a range-based for loop. 27 | 28 | An example usage, using the helper function, is this: 29 | 30 | \code 31 | std::vector vector; 32 | for (auto& value : IteratorPairRange<>) 33 | \endcode 34 | */ 35 | template class IteratorPairRange { 36 | public: 37 | IteratorPairRange(Iterator begin, Iterator end) : _begin(begin), _end(end) {} 38 | const Iterator &begin() const { return _begin; } 39 | const Iterator &end() const { return _end; } 40 | 41 | private: 42 | const Iterator _begin; 43 | const Iterator _end; 44 | }; 45 | 46 | /*! \brief Helper function for IteratorPairRange. */ 47 | template 48 | IteratorPairRange makeIteratorRange(Iterator begin, Iterator end) { 49 | return IteratorPairRange(begin, end); 50 | } 51 | 52 | } // namespace containers 53 | } // namespace magnet 54 | -------------------------------------------------------------------------------- /src/magnet/magnet/errno.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace magnet { 25 | /*! \brief A reentrant, and C++ form of the strerror C function. 26 | 27 | \param errnum The error number to generate a string for. 28 | */ 29 | inline std::string strerror(const int errnum) { 30 | #if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) || \ 31 | defined(__APPLE__) 32 | std::vector buf(128); 33 | 34 | int val = strerror_r(errnum, &buf[0], buf.size()); 35 | 36 | while (val == ERANGE) { 37 | buf.resize(buf.size() * 2); 38 | val = strerror_r(errnum, &buf[0], buf.size()); 39 | } 40 | 41 | if (val == EINVAL) { 42 | std::ostringstream os; 43 | os << "Unknown error number passed to strerror: " << errnum; 44 | return os.str(); 45 | } 46 | 47 | if (val == -1) 48 | return std::string("Call to strerror_r failed"); 49 | 50 | return std::string(buf.begin(), buf.end()); 51 | #else 52 | char buf[512]; 53 | char *realbuf = strerror_r(errnum, buf, 512); 54 | return std::string(realbuf); 55 | #endif 56 | } 57 | } // namespace magnet 58 | -------------------------------------------------------------------------------- /src/magnet/magnet/intersection/intersection.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace intersection { 23 | namespace detail { 24 | /*! \brief Implementation of unions of overlap functions. */ 25 | template class IntersectionOverlapFunction { 26 | public: 27 | IntersectionOverlapFunction(const TA &fA, const TB &fB) : _fA(fA), _fB(fB) {} 28 | 29 | inline double operator()(double dt = 0) const { 30 | return std::min(_fA(dt), _fB(dt)); 31 | } 32 | 33 | void flipSign() { 34 | _fA.flipSign(); 35 | _fB.flipSign(); 36 | } 37 | 38 | double nextEvent() const { 39 | return std::min(_fA.nextEvent(), _fB.nextEvent()); 40 | } 41 | 42 | private: 43 | TA _fA; 44 | TB _fB; 45 | }; 46 | 47 | /*! \brief Helper function for creating unions of overlap 48 | functions. */ 49 | template 50 | IntersectionOverlapFunction make_intersection(const TA &fA, 51 | const TB &fB) { 52 | return IntersectionOverlapFunction(fA, fB); 53 | } 54 | } // namespace detail 55 | } // namespace intersection 56 | } // namespace magnet 57 | -------------------------------------------------------------------------------- /src/magnet/magnet/intersection/parabola_cylinder.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace intersection { 23 | /*! \brief A parabola-cylinder intersection test. 24 | 25 | This test ignores the back face of the cylinder, it is used to 26 | detect when a ray will enter a cylinder. 27 | 28 | \param T The origin of the ray relative to a point on the cylinder axis. 29 | \param D The direction/velocity of the ray. 30 | \param Aray The acceleration acting on the ray 31 | \param A A normalized vector parallel to the axis of the cylinder. 32 | \param r Radius of the cylinder. 33 | \return The time until the intersection, or HUGE_VAL if no intersection. 34 | */ 35 | inline double parabola_cylinder(math::Vector T, math::Vector D, 36 | math::Vector Aray, const math::Vector &A, 37 | const double r) { 38 | // Project off the axial component of the position, velocity and acceleration 39 | T -= math::Vector((T | A) * A); 40 | D -= math::Vector((D | A) * A); 41 | Aray -= math::Vector((Aray | A) * A); 42 | return parabola_sphere(T, D, Aray, r); 43 | } 44 | } // namespace intersection 45 | } // namespace magnet 46 | -------------------------------------------------------------------------------- /src/magnet/magnet/intersection/parabola_plane.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace magnet { 23 | namespace intersection { 24 | /*! \brief A parabola-plane intersection test which ignores 25 | negative time intersections. 26 | 27 | \param T The origin of the ray relative to a point on the plane. 28 | \param D The direction/velocity of the ray. 29 | \param A The acceleration of the ray. 30 | \param N The normal of the plane. 31 | \param d The thickness of the plane. 32 | \return The time until the intersection, or HUGE_VAL if no intersection. 33 | */ 34 | inline double parabola_plane(const math::Vector &R, const math::Vector &V, 35 | const math::Vector &A, math::Vector N, 36 | const double d) { 37 | double rdotn = N | R; 38 | if (rdotn < 0) { 39 | N = -N; 40 | rdotn = -rdotn; 41 | } 42 | detail::PolynomialFunction<2> f(rdotn - d, V | N, A | N); 43 | return detail::nextEvent(f); 44 | } 45 | } // namespace intersection 46 | } // namespace magnet 47 | -------------------------------------------------------------------------------- /src/magnet/magnet/intersection/parabola_sphere.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace magnet { 23 | namespace intersection { 24 | /*! \brief A parabolic(ray)-sphere intersection test with backface culling. 25 | 26 | \param T The origin of the ray relative to the sphere center. 27 | \param D The direction/velocity of the ray. 28 | \param A The acceleration of the ray. 29 | \param r The radius of the sphere. 30 | \return The time until the intersection, or HUGE_VAL if no intersection. 31 | */ 32 | template 33 | inline double parabola_sphere(const math::Vector &R, const math::Vector &V, 34 | const math::Vector &A, const double &r) { 35 | detail::PolynomialFunction<4> f{R.nrm2() - r * r, 2 * (V | R), 36 | 2 * (V.nrm2() + (A | R)), 6 * (A | V), 37 | 6 * A.nrm2()}; 38 | if (inverse) 39 | f.flipSign(); 40 | return detail::nextEvent(f, r * r); 41 | } 42 | } // namespace intersection 43 | } // namespace magnet 44 | -------------------------------------------------------------------------------- /src/magnet/magnet/intersection/ray_cylinder.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace intersection { 23 | /*! \brief A ray_cylinder intersection test. 24 | 25 | \tparam inverse If true, the time the ray escapes the cylinder is returned. 26 | \param R The origin of the ray relative to a point on the cylinder axis. 27 | \param V The direction/velocity of the ray. 28 | \param n A normalized vector parallel to the axis of the cylinder. 29 | \param sig Radius of the cylinder. 30 | 31 | \return The time until the intersection, or HUGE_VAL if no intersection. 32 | */ 33 | template 34 | inline double ray_cylinder(math::Vector R, math::Vector V, 35 | const math::Vector &n, const double sig) { 36 | // Project off the axial component of the position and velocity 37 | R -= math::Vector((R | n) * n); 38 | V -= math::Vector((V | n) * n); 39 | return ray_sphere(R, V, sig); 40 | } 41 | } // namespace intersection 42 | } // namespace magnet 43 | -------------------------------------------------------------------------------- /src/magnet/magnet/intersection/ray_plane.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | 22 | namespace magnet { 23 | namespace intersection { 24 | /*! \brief A stable particle and thick plane intersection test. 25 | 26 | \param R The origin of the particle relative to a location on the plane. 27 | \param V The direction/velocity of the particle. 28 | \param N The normal of the plane. 29 | \param d The interaction distance to the plane (the plane's thickness). 30 | \return The time until the intersection, or HUGE_VAL if no intersection. 31 | */ 32 | inline double ray_plane(const math::Vector &R, const math::Vector &V, 33 | math::Vector N, const double d) { 34 | double r = R | N; 35 | if (r < 0) { 36 | r = -r; 37 | N = -N; 38 | } 39 | detail::PolynomialFunction<1> f(r - d, V | N); 40 | return detail::nextEvent(f); 41 | } 42 | } // namespace intersection 43 | } // namespace magnet 44 | -------------------------------------------------------------------------------- /src/magnet/magnet/intersection/union.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace intersection { 23 | namespace detail { 24 | /*! \brief Implementation of unions of overlap functions. */ 25 | template class UnionOverlapFunction { 26 | public: 27 | UnionOverlapFunction(const TA &fA, const TB &fB) : _fA(fA), _fB(fB) {} 28 | 29 | inline double operator()(double dt = 0) const { 30 | return std::min(_fA(dt), _fB(dt)); 31 | } 32 | 33 | void flipSign() { 34 | _fA.flipSign(); 35 | _fB.flipSign(); 36 | } 37 | 38 | double nextEvent() const { 39 | return std::min(_fA.nextEvent(), _fB.nextEvent()); 40 | } 41 | 42 | private: 43 | TA _fA; 44 | TB _fB; 45 | }; 46 | 47 | /*! \brief Helper function for creating unions of overlap 48 | functions. */ 49 | template 50 | UnionOverlapFunction make_union(const TA &fA, const TB &fB) { 51 | return UnionOverlapFunction(fA, fB); 52 | } 53 | } // namespace detail 54 | } // namespace intersection 55 | } // namespace magnet 56 | -------------------------------------------------------------------------------- /src/magnet/magnet/math/bisect.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | #ifdef MAGNET_DEBUG 21 | #include 22 | #endif 23 | 24 | namespace magnet { 25 | namespace math { 26 | #ifdef MAGNET_DEBUG 27 | namespace { 28 | inline bool comparesign(double a, double b) { return (a < 0) == (b < 0); } 29 | } // namespace 30 | #endif 31 | 32 | template 33 | inline double bisect(const Functor &func, double t1, double t2, 34 | double rootthreshold, const size_t nIt = 5000) { 35 | #ifdef MAGNET_DEBUG 36 | if (comparesign(func(t1), func(t2))) 37 | M_throw() << "No sign change in the interval!"; 38 | #endif 39 | bool negative_min = func(t1) < 0; 40 | 41 | for (size_t i(0); i < nIt; ++i) { 42 | double tm = 0.5 * (t1 + t2); 43 | double f = func(tm); 44 | 45 | if (std::abs(f) < rootthreshold) 46 | return tm; 47 | 48 | if ((f < 0.0) == negative_min) 49 | t1 = tm; 50 | else 51 | t2 = tm; 52 | } 53 | 54 | return t1; 55 | } 56 | } // namespace math 57 | } // namespace magnet 58 | -------------------------------------------------------------------------------- /src/magnet/magnet/math/ctime_pow.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | 20 | namespace magnet { 21 | namespace math { 22 | //!\brief A template metafunction for calculating the power of an integer. 23 | template struct ctime_pow { 24 | static const int result = X * ctime_pow::result; 25 | }; 26 | 27 | #ifndef DOXYGEN_SHOULD_IGNORE_THIS 28 | template struct ctime_pow { 29 | static const int result = X; 30 | }; 31 | 32 | template struct ctime_pow { 33 | static const int result = 1; 34 | }; 35 | #endif 36 | } // namespace math 37 | } // namespace magnet 38 | -------------------------------------------------------------------------------- /src/magnet/magnet/overlap/point_cube.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace overlap { 23 | /*! \brief Discovers if a cube and a point intersect. 24 | 25 | \param CubeOrigin The location of the cube relative to the point. 26 | \param CubeDimensions The size of the cube sides. 27 | \return If the point is inside/on the cube. 28 | */ 29 | inline bool point_cube(const magnet::math::Vector &CubeOrigin, 30 | const magnet::math::Vector &CubeDimensions, 31 | const double tol = 0) { 32 | for (size_t iDim(0); iDim < NDIM; ++iDim) 33 | if (fabs(CubeOrigin[iDim]) > (CubeDimensions[iDim] / 2)) 34 | return false; 35 | 36 | return true; 37 | } 38 | } // namespace overlap 39 | } // namespace magnet 40 | -------------------------------------------------------------------------------- /src/magnet/magnet/overlap/point_prism.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace overlap { 23 | //! \brief A point-prism (extruded triangle) overlap test. 24 | //! 25 | //! \param P The point's position, relative to V0. 26 | //! \param E1 The first edge vector of the prism face triangle (V1-V0). 27 | //! \param E2 The second edge vector of the prism face triangle (V2-V0). 28 | //! \param N Normal of the triangle. 29 | //! \param d The depth of the prism. 30 | //! \return Whether the point is inside the triangle. 31 | inline bool point_prism(const math::Vector &P, const math::Vector &E1, 32 | const math::Vector &E2, const math::Vector &N, 33 | const double d) { 34 | 35 | // Check the point is in the allowed depth range of the prism 36 | double dr = N | P; 37 | if ((dr > 0) || (dr < -d)) 38 | return false; 39 | 40 | return point_triangle(P, E1, E2); 41 | } 42 | } // namespace overlap 43 | } // namespace magnet 44 | -------------------------------------------------------------------------------- /src/magnet/magnet/overlap/sphere_sphere.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace overlap { 23 | //! \brief A point-sphere overlap test. 24 | //! 25 | //! This function assumes the point location passed is relative to 26 | //! the sphere's center. 27 | //! 28 | //! \param S The point's relative position. 29 | //! \param d The diameter of the sphere. 30 | //! \return Whether the point is inside the sphere. 31 | inline bool point_sphere(const math::Vector &P, const double d) { 32 | return P.nrm2() <= d * d; 33 | } 34 | 35 | //! \brief A sphere-sphere overlap test. 36 | //! 37 | //! This function assumes the sphere location passed is relative to 38 | //! the other sphere's center. 39 | //! 40 | //! \param S The other sphere's relative position. 41 | //! \param d The average diameter of the spheres. 42 | //! \return Whether the spheres are overlapping. 43 | inline bool sphere_sphere(const math::Vector &P, const double d) { 44 | return point_sphere(P, d); 45 | } 46 | } // namespace overlap 47 | } // namespace magnet 48 | -------------------------------------------------------------------------------- /src/magnet/magnet/string/searchreplace.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | 21 | namespace magnet { 22 | namespace string { 23 | /*! \brief Search and replace elements in a std::string. 24 | * \param in The string to search within. 25 | * \param from A string giving the text sequence to replace 26 | * \param to A string with the replacement text sequence. 27 | * \returns The string "in" with all occurences of "from" replaced with "to". 28 | */ 29 | inline std::string search_replace(std::string in, const std::string &from, 30 | const std::string &to) { 31 | if (!in.empty()) { 32 | std::string::size_type toLen = to.length(); 33 | std::string::size_type frLen = from.length(); 34 | std::string::size_type loc = 0; 35 | 36 | while (std::string::npos != (loc = in.find(from, loc))) { 37 | in.replace(loc, frLen, to); 38 | loc += toLen; 39 | 40 | if (loc >= in.length()) 41 | break; 42 | } 43 | } 44 | return in; 45 | } 46 | } // namespace string 47 | } // namespace magnet 48 | -------------------------------------------------------------------------------- /src/magnet/magnet/thread/threadgroup.hpp: -------------------------------------------------------------------------------- 1 | /* dynamo:- Event driven molecular dynamics simulator 2 | http://www.dynamomd.org 3 | Copyright (C) 2011 Marcus N Campbell Bannerman 4 | 5 | This program is free software: you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | version 3 as published by the Free Software Foundation. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace magnet { 24 | namespace thread { 25 | class ThreadGroup { 26 | public: 27 | inline ThreadGroup() {} 28 | 29 | inline ~ThreadGroup() { join_all(); } 30 | 31 | template 32 | inline void create_thread(Function &&f, Args &&...args) { 33 | _threads.push_back(std::thread(f, args...)); 34 | } 35 | 36 | inline size_t size() const { return _threads.size(); } 37 | 38 | inline void join_all() { 39 | for (auto &thread : _threads) 40 | if (thread.joinable()) 41 | thread.join(); 42 | _threads.clear(); 43 | } 44 | 45 | protected: 46 | std::vector _threads; 47 | 48 | ThreadGroup(const ThreadGroup &); 49 | ThreadGroup &operator=(const ThreadGroup &); 50 | }; 51 | } // namespace thread 52 | } // namespace magnet 53 | -------------------------------------------------------------------------------- /src/magnet/tests/ffmpeg_test.cpp: -------------------------------------------------------------------------------- 1 | /* Compile this with the following code 2 | g++ ffmpeg-example.c $(pkg-config --cflags libavcodec) $(pkg-config --libs 3 | libavcodec) -I ~/dynamo/src/magnet/ -O3 4 | */ 5 | 6 | #include 7 | 8 | int main(int argc, char **argv) { 9 | const char *filename = "/tmp/test.mpg"; 10 | size_t width = 1023; 11 | size_t height = 1023; 12 | size_t size = width * height; 13 | 14 | magnet::image::VideoEncoderFFMPEG encoder; 15 | encoder.open(filename, width, height); 16 | 17 | /* Allocate the RGB image in advance */ 18 | std::vector rgb_buf(size * 3); 19 | 20 | /* encode 3 seconds of video */ 21 | for (int i = 0; i < 75; ++i) { 22 | for (size_t y = 0; y < height; y++) 23 | for (size_t x = 0; x < width; x++) { 24 | rgb_buf[3 * (x + width * y) + 0] = 10 * i; // R 25 | rgb_buf[3 * (x + width * y) + 1] = 51 * i; // G 26 | rgb_buf[3 * (x + width * y) + 2] = std::min(x, y); // B 27 | } 28 | encoder.addFrame(rgb_buf); 29 | } 30 | 31 | encoder.close(); 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /src/magnet/tests/stack_vector_test.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE StackVector_test 2 | #include 3 | #include 4 | 5 | using namespace magnet::containers; 6 | 7 | BOOST_AUTO_TEST_CASE(StackVector_size) { 8 | StackVector vec; 9 | BOOST_CHECK(vec.size() == 0); 10 | BOOST_CHECK(vec.empty()); 11 | 12 | vec.push_back(1); 13 | BOOST_CHECK(vec.size() == 1); 14 | BOOST_CHECK(!vec.empty()); 15 | 16 | vec.push_back(2); 17 | BOOST_CHECK(vec.size() == 2); 18 | BOOST_CHECK(!vec.empty()); 19 | } 20 | 21 | BOOST_AUTO_TEST_CASE(StackVector_initializer_list) { 22 | StackVector vec1{}; 23 | BOOST_CHECK(vec1.size() == 0); 24 | BOOST_CHECK(vec1.empty()); 25 | 26 | StackVector vec2{0.5, 0.25}; 27 | BOOST_CHECK(vec2.size() == 2); 28 | BOOST_CHECK(!vec2.empty()); 29 | BOOST_CHECK_EQUAL(vec2[0], 0.5); 30 | BOOST_CHECK_EQUAL(vec2[1], 0.25); 31 | 32 | StackVector vec3{0.5, 0.25, 0.125}; 33 | BOOST_CHECK(vec3.size() == 3); 34 | BOOST_CHECK(!vec3.empty()); 35 | BOOST_CHECK_EQUAL(vec3[0], 0.5); 36 | BOOST_CHECK_EQUAL(vec3[1], 0.25); 37 | BOOST_CHECK_EQUAL(vec3[2], 0.125); 38 | 39 | StackVector vec4{0.5, 0.25, 0.125, 0.1}; 40 | BOOST_CHECK(vec4.size() == 3); 41 | BOOST_CHECK(!vec4.empty()); 42 | BOOST_CHECK_EQUAL(vec4[0], 0.5); 43 | BOOST_CHECK_EQUAL(vec4[1], 0.25); 44 | BOOST_CHECK_EQUAL(vec4[2], 0.125); 45 | } 46 | 47 | BOOST_AUTO_TEST_CASE(StackVector_foreach) { 48 | StackVector vec4{0.5, 0.25, 0.125}; 49 | 50 | double sum = 0.0; 51 | for (const auto &val : vec4) 52 | sum += val; 53 | BOOST_CHECK_CLOSE(sum, 0.875, 0.001); 54 | 55 | for (auto &val : vec4) 56 | val *= 2; 57 | BOOST_CHECK_CLOSE(vec4[0], 1.0, 0.001); 58 | } 59 | -------------------------------------------------------------------------------- /src/pydynamo/test_math.py: -------------------------------------------------------------------------------- 1 | from pydynamo.math import * 2 | 3 | 4 | def test_math(): 5 | from statistics import mean, stdev 6 | 7 | from scipy.optimize import curve_fit 8 | x = [2,4,8] 9 | yavg = [2.2, 2.4, 2.8] 10 | ysig = [1, 2, 3] 11 | 12 | results = [] 13 | for i in range(200): 14 | y = [yavg[j] + numpy.random.normal(0, ysig[j]) for j in range(len(yavg))] 15 | popt, pcov = curve_fit(lambda x,a,b: a + b * x, x, y) 16 | results.append(popt[0]) 17 | 18 | result, coeffs = linear_interp(x, [uncertainties.ufloat(y,dy) for y,dy in zip(yavg, ysig)]) 19 | # Currently I don't check anything here. I'm not even sure what this code was meant to do? 20 | # TODO - Write meaningful tests for the math functions? -------------------------------------------------------------------------------- /src/pydynamo/test_output_properties.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | import pytest 4 | 5 | import pydynamo 6 | 7 | 8 | def test_pressure(): 9 | """Here we test basic functionality of the SingleAttribute class and the Pressure property.""" 10 | from subprocess import PIPE, run 11 | 12 | # Create a hard sphere config 13 | createlog = run(["dynamod", "-m", "0"], check=True, stdout=PIPE, stderr=PIPE) 14 | runlog = run(["dynarun", "config.out.xml.bz2", "-c", "10000"], check=True, stdout=PIPE, stderr=PIPE) 15 | 16 | outputfile = pydynamo.OutputFile("output.xml.bz2") 17 | outputplugin = pydynamo.OutputFile.output_props["p"] 18 | prop = outputplugin.init() 19 | result = outputplugin.result(state=[], outputfile=outputfile, configfilename="config.out.xml.bz2", counter=1, manager=None, output_dir=None) 20 | 21 | assert result.avg() == pytest.approx(outputfile.p()) 22 | #assert math.isnan(result.std_error()) 23 | 24 | runlog = run(["dynarun", "config.out.xml.bz2", "-c", "10000"], check=True, stdout=PIPE, stderr=PIPE) 25 | outputfile2 = pydynamo.OutputFile("output.xml.bz2") 26 | result += outputplugin.result(state=[], outputfile=outputfile2, configfilename="config.out.xml.bz2", counter=2, manager=None, output_dir=None) 27 | 28 | time_weighted_avg = outputfile.p() * outputfile.t() + outputfile2.p() * outputfile2.t() 29 | time_weighted_avg /= outputfile.t() + outputfile2.t() 30 | 31 | assert result.avg() == pytest.approx(time_weighted_avg) 32 | #print("\n",repr(result)) -------------------------------------------------------------------------------- /test/PRIME_helper_files/15-GNNQQNY.xml.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamomd/DynamO/274a1349f418ace0dd5325dee8f9b7e09bbf2ba6/test/PRIME_helper_files/15-GNNQQNY.xml.bz2 -------------------------------------------------------------------------------- /test/PRIME_helper_files/48-KLVFFAE.xml.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamomd/DynamO/274a1349f418ace0dd5325dee8f9b7e09bbf2ba6/test/PRIME_helper_files/48-KLVFFAE.xml.bz2 -------------------------------------------------------------------------------- /test/PRIME_helper_files/A20.xml.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamomd/DynamO/274a1349f418ace0dd5325dee8f9b7e09bbf2ba6/test/PRIME_helper_files/A20.xml.bz2 -------------------------------------------------------------------------------- /test/PRIME_helper_files/G20.xml.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamomd/DynamO/274a1349f418ace0dd5325dee8f9b7e09bbf2ba6/test/PRIME_helper_files/G20.xml.bz2 -------------------------------------------------------------------------------- /test/PRIME_helper_files/alphabet.xml.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dynamomd/DynamO/274a1349f418ace0dd5325dee8f9b7e09bbf2ba6/test/PRIME_helper_files/alphabet.xml.bz2 -------------------------------------------------------------------------------- /vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "main", 3 | "version-string": "latest", 4 | "dependencies": [ 5 | "boost-bimap", 6 | "boost-chrono", 7 | "boost-circular-buffer", 8 | "boost-filesystem", 9 | "boost-lexical-cast", 10 | "boost-math", 11 | "boost-mpl", 12 | "boost-program-options", 13 | "boost-rational", 14 | "boost-serialization", 15 | "boost-test", 16 | "boost-tokenizer", 17 | "boost-ublas", 18 | "eigen3", 19 | "bzip2" 20 | ] 21 | } 22 | --------------------------------------------------------------------------------