from fluid import LJContainer

NUM_PARTICLES = 108
TIME_STEP = 0.001

class LennardJones:

    def __init__(self, density, temperature):
        #Initialize the container
        container = LJContainer()
        #Equilibriate the system
        #Start measuring
        while self.t < run_length:
            #Calculate the forces
            #Integrate equations of motion
            t += TIME_STEP
            #Sample averages
        #Generate a plot of the energies (kinetic, potential, total)

if __name__ == "__main__":
    LennardJones()


from fluid import LJContainer

PARTICLES = 108.0
TEMPERATURE = 2.0
DENSITY = 1.0
TIME_STEP = 0.001
STEPS = 2000

class LennardJones:

    _t = 0

    def __init__(self):
        #Initialize the container
        container = LJContainer(PARTICLES, DENSITY, TEMPERATURE)
        #Equilibriate the system
        #Start measuring
        while self._t < STEPS:
            #Calculate the forces
            #Integrate equations of motion
            self._t += TIME_STEP
            #Sample averages
        #Generate a plot of the energies (kinetic, potential, total)

if __name__ == "__main__":
    LennardJones()

Modify simulation to use global parameters
Modify simulation to use global parameters

+ 
  from fluid import LJContainer
  
- NUM_PARTICLES = 108
+ PARTICLES = 108.0
+ TEMPERATURE = 2.0
+ DENSITY = 1.0
  TIME_STEP = 0.001
+ STEPS = 2000
  
  class LennardJones:
  
-     def __init__(self, density, temperature):
+     _t = 0
+ 
+     def __init__(self):
          #Initialize the container
-         container = LJContainer()
+         container = LJContainer(PARTICLES, DENSITY, TEMPERATURE)
          #Equilibriate the system
          #Start measuring
-         while self.t < run_length:
+         while self._t < STEPS:
              #Calculate the forces
              #Integrate equations of motion
-             t += TIME_STEP
+             self._t += TIME_STEP
              #Sample averages
          #Generate a plot of the energies (kinetic, potential, total)
  
  if __name__ == "__main__":
      LennardJones()
  
Modify simulation to use global parameters
## Code Before:
from fluid import LJContainer

NUM_PARTICLES = 108
TIME_STEP = 0.001

class LennardJones:

    def __init__(self, density, temperature):
        #Initialize the container
        container = LJContainer()
        #Equilibriate the system
        #Start measuring
        while self.t < run_length:
            #Calculate the forces
            #Integrate equations of motion
            t += TIME_STEP
            #Sample averages
        #Generate a plot of the energies (kinetic, potential, total)

if __name__ == "__main__":
    LennardJones()

## Instruction:
Modify simulation to use global parameters
## Code After:

from fluid import LJContainer

PARTICLES = 108.0
TEMPERATURE = 2.0
DENSITY = 1.0
TIME_STEP = 0.001
STEPS = 2000

class LennardJones:

    _t = 0

    def __init__(self):
        #Initialize the container
        container = LJContainer(PARTICLES, DENSITY, TEMPERATURE)
        #Equilibriate the system
        #Start measuring
        while self._t < STEPS:
            #Calculate the forces
            #Integrate equations of motion
            self._t += TIME_STEP
            #Sample averages
        #Generate a plot of the energies (kinetic, potential, total)

if __name__ == "__main__":
    LennardJones()
