MaterSim / AtomisticSimulation

MEGR7090 course in Atomistic Simulation in Materials Modeling
MIT License
2 stars 0 forks source link

Week 1 discussion #1

Open qzhu2017 opened 2 months ago

qzhu2017 commented 2 months ago

Here is the place to discuss the issues related to week 1.

qzhu2017 commented 2 months ago

Just for fun. Below I used the following prompt in GPT to finish the 1st version of MD code

I want to write a Python code to simulate a system of 864 particles interacting with a I.ennard-Jones potential with epsilon = 120 kB, sigma = 3.4 Angstrom, and a cutoff distance of R=2.25sigma. The 864 particles would be placed to a cubic box with a unit length of 10.229 sigma. We will impose a periodic boundary condition. During the time, we don't allow the cell box to change. The initial velocity is generate by following the maxwell distribution at 94.4 K.

zfahim57 commented 1 month ago

LAMMPS script to setup NVE calculation for the Argon calculation

# Initial setup of the simulation
units           metal              # Use Metal units
dimension       3                  # 3D simulation
boundary        p p p              # Periodic boundary conditions
atom_style      atomic             # Atomic style for particles

# Declaring necessary parameters as variables
variable M              equal 39.95             # Mass gram/mole
variable dt             equal 0.001             # timestep 1fs
variable T              equal 94.4              # Temperature K
variable KB             equal 8.61733e-5        # eV/K
variable epsilon        equal 120*${KB}         # eV
variable sigma          equal 3.4               # Angstrom
variable L              equal 10.229*${sigma}   # Length of the simulation box
variable a              equal $L/6              # Lattice parameter
variable R_cut          equal 2.25*${sigma}     # Cutoff radius

# Generating atoms and crystal structure
lattice         fcc $a
region          box block 0 1 0 1 0 1 units lattice
create_box      1 box
create_atoms    1 box
replicate       6 6 6

# These variables are generated to check the size of the simulation domain
variable lx equal lx            # Length along x axis
variable ly equal ly            # Length along y axis
variable lz equal lz            # Length along z axis
print   "${lx} ${ly} ${lz}"

# Setting up the Lennard-Jones potential
mass            1 $M                    # Mass of each particle
pair_style      lj/cut ${R_cut}         # LJ potential with cutoff radius R = 2.25 * sigma = 7.65 Angstrom
pair_coeff      1 1 ${epsilon} ${sigma} # epsilon/Kb = 120K, sigma = 3.4 Angstrom 
timestep        ${dt}                   # timestep

# Thermodynamic parameters and setup
velocity        all create $T 12345     # Initialize velocities for temperature of 94.4K
fix             1 all nve             

# Neighbor list and communication
neighbor        0.3 bin

# Settings for output
thermo          100               # Output thermodynamic info every 100 timesteps
thermo_style    custom step temp epair etotal ke pe press

dump            1 all atom 1000 traj.lammpstrj  # Write trajectory every 1000 steps
dump            2 all custom 1000 dump.argon type id x y z vx vy vz
log             output.txt
run 10000
zfahim57 commented 1 month ago

LAMMPS script to setup NVT calculation using Langevin thermostat for the Argon calculation

# Initial setup of the simulation
units           metal              # Use Metal units
dimension       3                  # 3D simulation
boundary        p p p              # Periodic boundary conditions
atom_style      atomic             # Atomic style for particles

# Declaring necessary parameters as variables
variable M              equal 39.95             # Mass gram/mole
variable dt             equal 0.001             # timestep 1fs
variable T              equal 94.4              # Temperature K
variable KB             equal 8.61733e-5        # eV/K
variable epsilon        equal 120*${KB}         # eV
variable sigma          equal 3.4               # Angstrom
variable L              equal 10.229*${sigma}   # Length of the simulation box
variable a              equal $L/6              # Lattice parameter
variable R_cut          equal 2.25*${sigma}     # Cutoff radius

# Generating atoms and crystal structure
lattice         fcc $a
region          box block 0 1 0 1 0 1 units lattice
create_box      1 box
create_atoms    1 box
replicate       6 6 6

# These variables are generated to check the size of the simulation domain
variable lx equal lx            # Length along x axis
variable ly equal ly            # Length along y axis
variable lz equal lz            # Length along z axis
print   "${lx} ${ly} ${lz}"

# Setting up the Lennard-Jones potential
mass            1 $M                    # Mass of each particle
pair_style      lj/cut ${R_cut}         # LJ potential with cutoff radius R = 2.25 * sigma = 7.65 Angstrom
pair_coeff      1 1 ${epsilon} ${sigma} # epsilon/Kb = 120K, sigma = 3.4 Angstrom 
timestep        ${dt}                   # timestep

# Thermodynamic parameters and setup
velocity        all create $T 12345     # Initialize velocities for temperature of 94.4K
fix             1 all nve            
fix             2 all langevin $T $T ${tdamp} 12399797

# Neighbor list and communication
neighbor        0.3 bin

# Settings for output
thermo          100               # Output thermodynamic info every 100 timesteps
thermo_style    custom step temp epair etotal ke pe press

dump            1 all atom 1000 traj.lammpstrj  # Write trajectory every 1000 steps
dump            2 all custom 1000 dump.argon type id x y z vx vy vz
log             output.txt
run 10000
zfahim57 commented 1 month ago

LAMMPS script to setup NVT calculation using Nose-Hoover thermostat for the Argon calculation

# Initial setup of the simulation
units           metal              # Use Metal units
dimension       3                  # 3D simulation
boundary        p p p              # Periodic boundary conditions
atom_style      atomic             # Atomic style for particles

# Declaring necessary parameters as variables
variable M              equal 39.95             # Mass gram/mole
variable dt             equal 0.001             # timestep 1fs
variable T              equal 94.4              # Temperature K
variable tdamp          equal 100*${dt}  #damping coefficient(gamma) for temperature
variable KB             equal 8.61733e-5        # eV/K
variable epsilon        equal 120*${KB}         # eV
variable sigma          equal 3.4               # Angstrom
variable L              equal 10.229*${sigma}   # Length of the simulation box
variable a              equal $L/6              # Lattice parameter
variable R_cut          equal 2.25*${sigma}     # Cutoff radius

# Generating atoms and crystal structure
lattice         fcc $a
region          box block 0 1 0 1 0 1 units lattice
create_box      1 box
create_atoms    1 box
replicate       6 6 6

# These variables are generated to check the size of the simulation domain
variable lx equal lx            # Length along x axis
variable ly equal ly            # Length along y axis
variable lz equal lz            # Length along z axis
print   "${lx} ${ly} ${lz}"

# Setting up the Lennard-Jones potential
mass            1 $M                    # Mass of each particle
pair_style      lj/cut ${R_cut}         # LJ potential with cutoff radius R = 2.25 * sigma = 7.65 Angstrom
pair_coeff      1 1 ${epsilon} ${sigma} # epsilon/Kb = 120K, sigma = 3.4 Angstrom 
timestep        ${dt}                   # timestep

# Thermodynamic parameters and setup
velocity        all create $T 12345     # Initialize velocities for temperature of 94.4K
fix             1 all nvt temp $T $T ${tdamp}            

# Neighbor list and communication
neighbor        0.3 bin

# Settings for output
thermo          100               # Output thermodynamic info every 100 timesteps
thermo_style    custom step temp epair etotal ke pe press

dump            1 all atom 1000 traj.lammpstrj  # Write trajectory every 1000 steps
dump            2 all custom 1000 dump.argon type id x y z vx vy vz
log             output.txt
run 10000