Dear All,
I am providing an explanation of the problem, along with my program’s structure and sharing my input file for reference. I would greatly appreciate your assistance in incorporating the read_restart
command and defining a loop that initiates from the equilibrium data file loaded by read_restart
Here is problem explanation:
I conducted a simulation of a nanotube using DPDe methodology. The interaction potential between bead-bead pairs within the nanotube’s wall can be adjusted by varying the bond coefficient. This coefficient serves as a pivotal parameter for manipulating the Young’s Modulus of the nanotube. To determine the Young’s Modulus, I subjected both ends of the CNT to opposing forces, initiating elongation.
However, to systematically explore the impact of varying bond coefficients on the nanotube’s mechanical properties, I need to loop over these coefficients. This loop, designated by the variable “loopa,” should encompass different bond coefficient values. Additionally, I must commence the elongation process from an equilibrium state, necessitating the utilization of the read_restart
command.
My challenge lies in sequencing these steps effectively. I must ensure that the loop begins after all regions and computes are defined to prevent the “compute/region ID is reused” error. However, I also need the read_restart
command at the outset to establish the initial state of the simulation. This predicament has left me uncertain about how to integrate the loop and read_restart
command seamlessly to fulfill my objectives.
My program proceeds in the following steps:
- Initialization and Equilibration: Initially, the program reads the data, including bond coefficients, and conducts an equilibration phase for the carbon nanotube (CNT) at room temperature. This step ensures that the system reaches a stable equilibrium state before further manipulation.
- Elongation of the CNT: Subsequently, the CNT is subjected to elongation. This involves applying opposing forces to both ends of the nanotube to induce deformation. The response of the CNT to this elongation is monitored to understand its mechanical behavior under external loading conditions.
- Looping over Bond Coefficients: The program then enters a loop where it iterates over different bond coefficients. For each iteration, the CNT is elongated from its equilibrium position using the specific bond coefficient value corresponding to that iteration. This allows for a systematic exploration of how variations in bond coefficients influence the mechanical properties of the nanotube.
Inputfile:
variable T equal 1
units lj
dimension 3
boundary p p p
neighbor 0.2 bin
neigh_modify every 1 delay 0 check yes
neigh_modify one 1500
atom_style hybrid edpd full
bond_style harmonic
angle_style harmonic
pair_style edpd 1.58 9872598
# Reset box and simulation parameters
clear
region mybox block -15 15 -15 15 -15 15 units box
read_restart restart.equi
Include parmcnt.lammps
#GROUPING
group CNT type 1
comm_modify vel yes cutoff 5
#RECENTER THE CNT
variable CNT_xcm equal -1*xcm(CNT,x)
variable CNT_ycm equal -1*xcm(CNT,y)
variable CNT_zcm equal -1*xcm(CNT,z)
displace_atoms CNT move ${CNT_xcm} ${CNT_ycm} ${CNT_zcm}
#CHANGE BOX BOUNDARIES
change_box all x final -15 15 y final -15 15 z final -15 15
variable zmax equal bound(CNT,zmax)-1.5
variable zmin equal bound(CNT,zmin)+1.5
variable zmidmin equal ((${zmax}+${zmin})/2)-0.6
variable zmidmax equal ((${zmax}+${zmin})/2)+0.6
region rtop block INF INF INF INF ${zmax} INF
region rbot block INF INF INF INF INF ${zmin}
region rmid block INF INF INF INF ${zmin} ${zmax}
region zmid block INF INF INF INF ${zmidmin} ${zmidmax}
group CNT_top region rtop
group CNT_bot region rbot
group CNT_mid region rmid
group CNT_zmid region zmid
set region rtop type 2
set region rbot type 3
set region zmid type 1
#THE MOLECULAR DYNAMICS
velocity CNT_mid create ${T} 48455 mom yes rot yes
fix mynve all nve
compute Tmid CNT_mid temp
fix myber CNT_mid temp/berendsen ${T} ${T} 100
fix_modify myber temp Tmid
label loopa
variable a loop 15
variable c equal ${a}
variable b equal 100*${a}
bond_coeff 1 ${b} 0.77
#RESTRAIN THE MOTION OF ATOMS AT THE EDGES
#(FOR TWIST WE WANT TO FIX ONE EDGE ONLY AND TWIST THE OTHER EDGE)
fix mysf2 CNT_top setforce 0 0 0
fix mysf3 CNT_bot setforce 0 0 0
velocity CNT_top set 0 0 0
velocity CNT_bot set 0 0 0
variable L equal xcm(CNT_top,z)-xcm(CNT_bot,z)
fix at2 all ave/time 10 100 1000 v_c v_j v_b v_f v_L file len${a}.txt
fix at3 all ave/time 10 100 1000 v_c v_j v_b v_f f_mysf2[3] f_mysf3[3] file force${a}.txt
variable mc equal 5*1.99*(10)^(-26)
variable rcutoff equal 6.4633*10^(-10)
variable kB equal 1.38*10^(-23)
variable tem equal 300
variable epsilon equal (v_kB*v_tem)
variable tau0 equal sqrt(v_mc*(v_rcutoff)^2/(v_epsilon))
variable funit equal (v_mc*v_rcutoff)/(v_tau0)^2
variable cntA equal 1.23654*(10)^(-18)
variable lini equal 22.1782*(v_rcutoff)
variable stress equal ((abs(f_mysf2[3])+abs(f_mysf3[3]))*v_funit)/(v_cntA)
variable strain equal (v_L*v_rcutoff-v_lini)/(v_lini)
fix at4 all ave/time 1 1 1 v_b v_f v_stress file stress${a}.txt
fix at5 all ave/time 1 1 1 v_b v_f v_strain file strain${a}.txt
#CHECK THE TEMP OF NON-FROZZEN GROUP OVER TIME
fix at1 all ave/time 10 100 1000 c_Tmid file output_temperature_middle_group.dat
# RUN A SIMPLE EQULIBRATION TO BRING THE SYS TO THE REQUIRED TEMP BEFORE APPLYING ANY DEFORMATION
thermo 100
thermo_modify temp Tmid
timestep 0.01
run 1000
#Elongation
velocity CNT_top set 0 0 0.005
velocity CNT_bot set 0 0 -0.005
run 100
next a
clear
jump SELF loopa
I could not find any example in GitHub that people used loops and read_restart with same aim. If you know of any example that can help could please provide me with the link.