The Python code for executing global optimization of bare and adsorbed molecular cluster configurations using particle swarm optimization.
- Python 3.x
- Required Python libraries:
numpy
,scipy
,math
,multiprocessing
Install the required libraries using:
pip install numpy scipy
- GY.txt: This file should contain the atomic coordinates of the GY sheet in a comma-separated format. Each line should represent an atom with its corresponding x, y, z coordinates. The script reads the atomic coordinates from
GY.txt
usingnumpy.loadtxt()
to process the atomic species and coordinates. Ensure that yourGY.txt
file is correctly formatted and available in the script's directory.
Example format:
C, 0.0000, 0.0000, 0.0000
C, 1.2300, 0.0000, 0.0000
C, 2.4600, 0.0000, 0.0000
- GY-COORDS/: This folder contains the coordinates of γ-GY model sytems used in the study.
Before running the script, specify the following variables in the script:
-
Number of Molecules:
m
: Number of CO2 moleculesn
: Number of N2 molecules- Example values:
m = 2 # Number of CO2 molecules n = 2 # Number of N2 molecules
-
PSO Algorithm Parameters:
pop
: Population sizemaxtrial
: Number of trialsmaxit
: Maximum number of iterations- Example values:
pop = 2000 # Population size maxtrial = 25 # Number of trials maxit = 1000 # Maximum number of iterations
Update the script with the appropriate values for the number of molecules and PSO parameters as outlined above.
To execute the script, simply run from the terminal:
python N2_CO2_bare_PSO.py
python GY_N2_CO2_PSO.py