1 / 6

Molecular Dynamics: Digital Material

Molecular Dynamics: Digital Material. Sethna/Myers, Physics 682 / CIS 629; Cornell University, Oct 19, 2006. Design Patterns. Design pattern philosopy Many small objects work together ListOfAtoms Potential BoundaryConditions NeighborLocator Observer Mover

paulsmoore
Download Presentation

Molecular Dynamics: Digital Material

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Molecular Dynamics: Digital Material Sethna/Myers, Physics 682 / CIS 629; Cornell University, Oct 19, 2006

  2. Design Patterns • Design pattern philosopy • Many small objects work together • ListOfAtoms • Potential • BoundaryConditions • NeighborLocator • Observer • Mover • Build many types of simulations • from pieces • Factor problem into components • Refactor several times to get right • Traditional programming: • One large seamless code • Single purpose • Reusable subroutines • Object-oriented programming • Define new kind of objects • g=Graph() • Attach data • g.nodes, g.neighbor_dict • Attach methods • g.AddEdge(), g.HasNode() Plan ahead for change

  3. Class Diagram: Digital Material

  4. Gravity Cluster built from pieces gravityPotential = GravityPotential(g=g) LennardJonesPotential = LennardJonesCutPotential() potential = CompositePotential([gravityPotential, LennardJonesPotential]) boundaryConditions = ReflectiveBoundaryConditions(L) neighborLocator = SimpleNeighborLocator(LennardJonesPotential.cutoff, boundaryConditions) atoms = TriangularSphericalClusterListOfAtoms( R=R, center=[L/2., L/2.], temperature=T, radius=LennardJonesPotential.latticeSpacing/2.0) displayObserver = VisualDisplayAtomsObserver(atoms,L) energyObserver = DM.EnergyObserver(potential, neighborLocator, boundaryConditions) observers = [displayObserver, energyObserver] mover = RunVelocityVerlet; sys = MDSystem(L, atoms, observers, neighborLocator, boundaryConditions, potential, mover)

  5. ListOfAtoms NOT a list of atom objects: use fast array operations! positions = numpy.array((nAtoms, dimension)) velocities = numpy.array((nAtoms, dimension)) mass, radius, color KineticEnergy: return 0.5*sum(mass*velocity*velocity) Initializers (RandomListOfAtoms, TriangularSphericalClusterListOfAtoms) Potentials (GravityPotential, LennardJonesPotential) Provides Forces and PotentialEnergy Movers (ThermalizingTransformer, RunVelocityVerlet, QuickMin) Observers (EnergyObserver, VisualDisplayObserver, VelocityTrajectoryObserver) Subject-Observer pattern Have Update; list of observers all called by Mover once per step; Flexible! Removes complex code from inner loop of program! BoundaryConditions (Periodic, Reflective, Free) DigitalMaterial

  6. NeighborLocator (CellNeighborLocator, NeighborList, SimpleNeighborLocator, NoNeighborLocator!) used, e.g., by Potential look only within cutoff Gives Neighbors(), displacements, HalfNeighbors() NeighborLocators and Constraints Constraints (RigidBody, Fixed, …) Called by Mover AdjustForces(), AdjustPositions(), AdjustVelocities()

More Related