# MDTTM_Nature Simulation Code This repository contains the source code for a molecular dynamics simulation (MD) with a two-temperature model (TTM) for laser-solid interactions. The code is designed to simulate the behavior of materials under various conditions, including thermal and mechanical effects. ## Folder Structure The project is organized into different subroutines for calculating potential, thermal and mechanical energies, as well atomic positions and velocities and pressure. Some notable subroutines include: ├── input/ # Input files for the simulation ├── md.input # Main input file for simulation parameters ├── md.rc # Resource file for linking input/output files ├── md.ttm # Input file for TTM-specific parameters ├── md.bound-Au # Boundary conditions for the simulation ├── md.random # Random seed for initialization │ ├── cg.f90 # Crystal geometry setup ├── vel.f90 # Velocity initialization ├── Au.* # Predefined input data files ├── common.h # Common variables and constants ├── commonTTM.h # Common variables for TTM ├── Makefile # Build instructions ├── Main.f90 # Main program entry point ├── TTMInit.f90 # Initialization for TTM ├── Swrite.f90 # Output writing routines ├── SwriteTTM.f90 # TTM-specific output writing ├── Forces.f90 # Force calculations ├── ... # Additional source files ## Input Files The input/ folder contains several input files that control the simulation. These files can be modified without recompiling the code: md.input: This file contains the main simulation parameters. Key parameters include: NSTEP: Number of simulation steps. MATER: Material type (e.g., 2 for Au). NEPRT: Step interval for printing output information. NWRITE: Step interval for writing output files. NTYPE: Number of particle types. DELTA: Time step for integration in picoseconds. md.rc: This resource file links input and output files used by the simulation. For example: UNIT 07: Boundary condition file (md.bound-Au). UNIT 11: TTM-specific input file (md.ttm). UNIT 15: Output file for simulation results (Au.out.00000). md.ttm: This file contains parameters specific to the two-temperature model (TTM). Key parameters include: NTST: Step interval for printing temperature/pressure contours. LCOND: Toggle for electron thermal conduction (0 = off, 1 = on). WIDTH: Laser pulse width at half maximum (in nm). DURAT: Laser pulse duration (in picoseconds). ENRIN: Laser energy input (in Joules). md.bound-Au: Defines boundary conditions for the simulation, such as periodic or rigid boundaries. md.random: Provides a random seed for initializing the simulation. ## Prerequisites - **Fortran Compiler**: The code is written in Fortran 90 and requires a compatible compiler, such as `mpif90` for MPI-based parallel execution. - **MPI Library**: The code uses MPI for parallel processing. Ensure that an MPI library (e.g., OpenMPI or MPICH) is installed. ## Compilation To compile the code, use the provided "Makefile". The executable will be created in the "input/" directory as "brag.x". Use the following command to start the compilation of the code: "make" To clean up the compiled files, run: "make clean" ## Running the Simulation After compilation, run the simulation using the generated executable: mpirun -np ./brag.x or use a predefined sbatch script (see provided example brag.pbs) ## Output Files The simulation generates several output files for analysis: e.g. Au.out.00000: These files are written for each MPI process and contain detailed simulation data. The format includes: Number of particles (NN1), simulation time (TIME), and critical Z-coordinate (ZCRIT). System dimensions (XL, YL, ZL) and center coordinates (XCENTR, YCENTR, ZCENTR). Particle types, positions, and velocities. Additional data such as density, energy, and forces. e.g. ttmreal001.d: This file contains the 3D TTM profile data for the simulation. It includes: Spatial coordinates (XEDT, YEDT, ZEDT). Lattice temperature (T_lG) and electron temperature (T_eG). Pressure (TPSXG), density (RONG), and solid fraction (FSOLG). Heat flux (Q1VG) and electron displacement (XEDT, YEDT, ZEDT). These files are written at specific time intervals (chtime) and are useful for analyzing the thermal and mechanical behavior of the system. energy.out: Contains energy data for the system. liquid.out: Tracks liquid phase properties. NRB.out: Outputs data for non-reflective boundaries (if applicable). time.*: Time-dependent data for each MPI process. ## Customization You can modify the following files to customize the simulation: parameters.h: Adjust simulation parameters such as the number of processor, maximum number of atoms in the system and other relevant and other relevant parameters. cg.f90: Change the crystal geometry and lattice constants. vel.f90: Modify initial velocities and initial temperature of the system. You can also modify the input files (md.input, md.ttm, etc.) to customize the simulation parameters. Changes to these files do not require recompilation of the code. ## Troubleshooting Ensure that the number of MPI processes matches the geometry defined in cg.f90 (nxnodes, nynodes, nznodes). Check the Makefile for compiler flags and paths if compilation fails, and that the compilation takes into account the correct architecture of the computing facility. ## References This code is based on the work of Leonid Zhigilei and collaborators. For more details, refer to the associated publications: Zhigilei, Leonid V., Zhibin Lin, and Dmitriy S. Ivanov. "Atomistic modeling of short pulse laser ablation of metals: connections between melting, spallation, and phase explosion." The Journal of Physical Chemistry C 113.27 (2009): 11892-11906. DOI: https://doi.org/10.1103/PhysRevB.68.064114 This `README.md` provides an overview of the project, instructions for compilation and execution, and guidance on customization and troubleshooting. You can adjust the parameters and content of the code as needed to fit your specific requirements.