Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
__pycache__/
*.pyc
*.egg-info/
log.lammps
log_*.lammps
*.data
*.dump
amorphous_*/
quartz*/
heatofimmersion*/
Q4*/
seed.txt
8 changes: 6 additions & 2 deletions examples/generate_amorphous_system.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
from interface_builder import Silica
import os

# Generate 10 sample of silica surface!
for indx in range(2):
# prepare the surface
output_folder = f'amorphous_{indx}'
os.makedirs(output_folder, exist_ok=True)

silica_params = {
'lx' : 4,
'ly' : 4,
'lz' : 4,
'vacuum' : 30,
'filename' : 'silica_amorphous.data',
'output_folder' : f'amorphous_{indx}',
'output_folder' : output_folder,
'input_folder' : 'test',
'sio2_potential' : './data/SiO2.vashishta',
'sio2_h2o_potential' : "./data/SiOH2O_199_16_adjusted.vashishta",
Expand All @@ -19,7 +23,7 @@
# initilize the silica system
silica = Silica(**silica_params)

silica_file = silica.build_amorphous(16, "lmp", run=True)
silica_file = silica.build_amorphous(mpirun_n=16, lmp_exec="lmp", run=True)

# silica_surface = silica.resize_z(silica_file, 90, "silica_surface.data")
# silica_annealed = silica.anneal(silica_surface, mpirun_n=16, lmp_exec="lmp", run=True)
Expand Down
2 changes: 1 addition & 1 deletion examples/test_quartz.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
passivated_silica = silica_thermalize
for _ in range(3):
passivated_silica = silica.passivate(passivated_silica , T, 'passivated_quartz.data',
thickness=5, mpirun_n=16, lmp_exec='lmp_usc', run=False)
water_thickness=5, mpirun_n=16, lmp_exec='lmp_usc', run=False)

silica_passivated_thermalize = silica.thermalize_passivated(passivated_silica, time=50, temp=300,
output_filename= "silica_passivated_thermalize.data",
Expand Down
Binary file removed interface_builder/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file not shown.
16 changes: 10 additions & 6 deletions interface_builder/interface_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def __init__(
self.sio2_h2o_potential = sio2_h2o_potential

# create the output directory
os.system(f'mkdir {output_folder}')
if output_folder:
os.makedirs(output_folder, exist_ok=True)
if lx is None and ly is None and lz is None:
# copy the input file into the working directory
shutil.copyfile(
Expand Down Expand Up @@ -459,9 +460,6 @@ def set_silanol(
'potential_filename': self.sio2_h2o_potential,
'output_folder': self.output_folder
}
lmp_exec = os.path.join(
"/home/users/anthonca/silica-water-interface_sandbox/interface_builder/interface_builder/lmp_exec/",
"lmp")
if run:
script_path = os.path.join(script_dir, 'script', 'in.set_silanol')
self.execute_lammps(
Expand Down Expand Up @@ -542,7 +540,8 @@ def execute_lammps(
mpirun_n=4,
lmp_exec='lmp',
script=None,
slurm=False):
slurm=False,
oversubscribe=True):
'''Execute a LAMMPS simulation with the given arguments.
This method executes a LAMMPS simulation using the specified LAMMPS executable and input script, along with additional arguments provided in the lmps_args dictionary.

Expand All @@ -556,6 +555,8 @@ def execute_lammps(
:type script: str or None
:param slurm: (Optional) If True, run the simulation using Slurm on a HPC cluster. Default is False.
:type slurm: bool
:param oversubscribe: (Optional) If True, run mpirun with --oversubscribe. Default is True.
:type oversubscribe: bool

:return: None
'''
Expand All @@ -573,8 +574,11 @@ def execute_lammps(
**lmps_args)
sim.run(computer=computer)
else:
mpi_args = f"-n {mpirun_n}"
if oversubscribe:
mpi_args += " --oversubscribe"
os.system(
f"mpirun -n {mpirun_n} {lmp_exec} -in {script} {lmps_args_list}")
f"mpirun {mpi_args} {lmp_exec} -in {script} {lmps_args_list}")

def add_water(
self,
Expand Down
8 changes: 4 additions & 4 deletions interface_builder/script/in.passivated_thermalized
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ units metal
boundary p p p
atom_style atomic

read_data /Users/anthonca/Documents/PhD/silica-water-sim/contact_angle-amorphous/data/new_set/passivation/data/WCA_system_clean/system2_87SiOH_6436.data
read_data ${input_filename}

pair_style usc
pair_coeff * * ./data/SiOH2O_nm_0_0.vashishta H O Si
pair_coeff * * ${potential_filename} H O Si
pair_modify coord 2 3 2.0 0.3
pair_modify coord 2 1 1.4 0.3
mass 1 1.00794
Expand All @@ -27,7 +27,7 @@ variable thermalising_time equal 5 # ps
variable thermalising_steps equal ${thermalising_time}/${dt}

fix 1 all nvt temp 300 300 $(100*dt)
dump silica all custom 100 ./data/silica-passivated.dump id type x y z
dump silica all custom 100 ${output_folder}/silica-passivated.dump id type x y z

log log_passivated-thermalized.lammps
thermo_style custom step time temp etotal spcpu cpuremain
Expand All @@ -36,4 +36,4 @@ thermo 10
timestep ${dt}
run ${thermalising_steps}

write_data ./data/passivated-system2_thermalized.data
write_data ${output_filename}
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
packages=find_packages(),
install_requires=[
"numpy",
"molecular-builder"
"molecular-builder",
"lammps-logfile",
"pandas"
],
classifiers=[
"Programming Language :: Python :: 3.9",
Expand Down