Bash scripts mostly for clean, modification, download, extraction
This commit is contained in:
parent
90a04cb08b
commit
2d6fb3f15c
@ -549,13 +549,13 @@ SaveDirectory = './Results/Data_3D/AnisotropicTrap/TiltedDipoles45';
|
||||
JobNumber = 0;
|
||||
Plotter.visualizeGSWavefunction(SaveDirectory, JobNumber)
|
||||
%%
|
||||
SaveDirectory = './Results/Data_3D/GradientDescent/aS_079_theta_000_phi_000_N_50000';
|
||||
SaveDirectory = './Results/Data_3D/GradientDescent/Phi050/aS_089_theta_050_phi_000_N_100000';
|
||||
JobNumber = 0;
|
||||
Plotter.visualizeGSWavefunction(SaveDirectory, JobNumber)
|
||||
%%
|
||||
% Parameters you can set before the loop
|
||||
N = 60000;
|
||||
theta = 0;
|
||||
N = 105000;
|
||||
theta = 50.0;
|
||||
phi = 0;
|
||||
JobNumber = 0;
|
||||
|
||||
@ -570,7 +570,7 @@ for aS = aS_values
|
||||
N_str = sprintf('%d', N);
|
||||
|
||||
% Construct directory path
|
||||
SaveDirectory = ['./Results/Data_3D/GradientDescent/aS_', aS_str, ...
|
||||
SaveDirectory = ['./Results/Data_3D/GradientDescent/Phi',theta_str, '/aS_', aS_str, ...
|
||||
'_theta_', theta_str, '_phi_', phi_str, '_N_', N_str];
|
||||
|
||||
% Call the plotting function
|
||||
@ -586,12 +586,13 @@ for aS = aS_values
|
||||
pause(0.25)
|
||||
end
|
||||
|
||||
|
||||
%%
|
||||
SaveDirectory = './Results/Data_3D/GradientDescent/';
|
||||
JobNumber = 1;
|
||||
Plotter.visualizeGSWavefunction(SaveDirectory, JobNumber)
|
||||
%% Visualize phase diagram
|
||||
load('phase_diagram_matrix_theta_0.mat')
|
||||
load('phase_diagram_matrix_theta_30.mat')
|
||||
PhaseDiagramMatrix = M;
|
||||
ScatteringLengths = SCATTERING_LENGTH_RANGE;
|
||||
NumberOfAtoms = NUM_ATOMS_LIST * 1E-5;
|
||||
@ -604,13 +605,14 @@ set(gca,'FontSize',16,'Box','On','Linewidth',2);
|
||||
hImg = imagesc(M);
|
||||
set(gca, 'YDir', 'normal');
|
||||
colormap(parula);
|
||||
% colorbar;
|
||||
ax = gca; % Get current axes
|
||||
ax.FontSize = 16; % Set tick label font size (adjust as needed)
|
||||
axis equal tight;
|
||||
xticks(1:xlen);
|
||||
yticks(1:ylen);
|
||||
xticklabels(string(NumberOfAtoms));
|
||||
yticklabels(string(ScatteringLengths));
|
||||
xlabel('Number of Atoms (x 10^5)', FontSize=16);
|
||||
xlabel('Number of Atoms (x 10^5)', 'Interpreter', 'tex', FontSize=16);
|
||||
ylabel('Scattering Length (a0)', FontSize=16);
|
||||
title('Zero-temperature Phase Diagram for \theta = 0', 'Interpreter', 'tex', FontSize=16);
|
||||
% title('Zero-temperature Phase Diagram for \theta = 0', 'Interpreter', 'tex', FontSize=16);
|
||||
grid on;
|
@ -0,0 +1,27 @@
|
||||
$root = "C:\Users\Karthik\Documents\GitRepositories\Calculations\Dipolar-Gas-Simulator\Results\Data_3D\GradientDescent\Phi050"
|
||||
|
||||
# Step 1: Delete all files except 'psi_gs.mat'
|
||||
Get-ChildItem -Path $root -Recurse -File -Force |
|
||||
Where-Object { $_.Name -ne "psi_gs.mat" } |
|
||||
ForEach-Object {
|
||||
try {
|
||||
Remove-Item -Path $_.FullName -Force -ErrorAction Stop
|
||||
Write-Output "Deleted: $($_.FullName)"
|
||||
} catch {
|
||||
Write-Warning "Failed to delete: $($_.FullName)"
|
||||
}
|
||||
}
|
||||
|
||||
# Step 2: Delete all empty directories (deepest first)
|
||||
Get-ChildItem -Path $root -Recurse -Directory -Force |
|
||||
Sort-Object FullName -Descending |
|
||||
ForEach-Object {
|
||||
if (-not (Get-ChildItem -Path $_.FullName -Force)) {
|
||||
try {
|
||||
Remove-Item -Path $_.FullName -Force -ErrorAction Stop
|
||||
Write-Output "Deleted empty folder: $($_.FullName)"
|
||||
} catch {
|
||||
Write-Warning "Failed to delete folder: $($_.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
$root = "C:\Users\Karthik\Documents\GitRepositories\Calculations\Dipolar-Gas-Simulator\Results\Data_3D\GradientDescent\Phi030"
|
||||
|
||||
# Define parameter ranges
|
||||
$SCATTERING_LENGTH_RANGE = @(79.0..90.0)
|
||||
$POLAR_ANGLE_RANGE = @(30.0)
|
||||
$AZIMUTHAL_ANGLE_RANGE = @(0.0)
|
||||
$NUM_ATOMS_LIST = @(50000, 55000, 60000, 65000, 70000, 75000, 80000, 85000, 90000, 95000, 100000, 105000)
|
||||
|
||||
# Utility function to format floating point values as zero-padded 3-digit integers
|
||||
function Format-Value($value) {
|
||||
return "{0:D3}" -f [int]($value * 1)
|
||||
}
|
||||
|
||||
# Generate all valid folder names
|
||||
$expectedFolders = @()
|
||||
foreach ($aS in $SCATTERING_LENGTH_RANGE) {
|
||||
$aS_str = Format-Value $aS
|
||||
foreach ($theta in $POLAR_ANGLE_RANGE) {
|
||||
$theta_str = Format-Value $theta
|
||||
foreach ($phi in $AZIMUTHAL_ANGLE_RANGE) {
|
||||
$phi_str = Format-Value $phi
|
||||
foreach ($N in $NUM_ATOMS_LIST) {
|
||||
$folderName = "aS_${aS_str}_theta_${theta_str}_phi_${phi_str}_N_${N}"
|
||||
$expectedFolders += $folderName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Get actual folders in the root directory
|
||||
$actualFolders = Get-ChildItem -Path $root -Directory -Force | Select-Object -ExpandProperty Name
|
||||
|
||||
# Compare and find missing folders
|
||||
$missingFolders = $expectedFolders | Where-Object { $_ -notin $actualFolders }
|
||||
|
||||
# Output missing folders
|
||||
Write-Host "Missing folders:"
|
||||
$missingFolders | ForEach-Object { Write-Host $_ }
|
||||
|
||||
# Optional: Save to a file
|
||||
$missingFolders | Out-File -FilePath "$root\missing_folders.txt" -Encoding UTF8
|
22
Dipolar-Gas-Simulator/create_tar_ball.slurm
Normal file
22
Dipolar-Gas-Simulator/create_tar_ball.slurm
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
########### Begin SLURM header ###########
|
||||
#Partition
|
||||
#SBATCH --partition=cpu-single
|
||||
# Request number of nodes and CPU cores per node for job
|
||||
#SBATCH --nodes=1
|
||||
#SBATCH --ntasks-per-node=1
|
||||
#SBATCH --cpus-per-task=10
|
||||
#SBATCH --mem=2G
|
||||
# Estimated wallclock time for job
|
||||
#SBATCH --time=01:00:00
|
||||
#SBATCH --job-name=tar
|
||||
#SBATCH --output=tar.out
|
||||
#SBATCH --error=tar.err
|
||||
|
||||
SRC_DIR="/home/hd/hd_hd/hd_fz183/Dipolar-Gas-Simulator/Results/Data_3D/GradientDescent"
|
||||
TARBALL_NAME="gd_result_$(date +%Y%m%d_%H%M%S).tar.gz"
|
||||
|
||||
# Create tarball
|
||||
echo "Creating tarball..."
|
||||
tar -czf "$TARBALL_NAME" -C "$SRC_DIR" .
|
||||
echo "Completed creation of tarball."
|
40
Dipolar-Gas-Simulator/generateRerunListsForBash.m
Normal file
40
Dipolar-Gas-Simulator/generateRerunListsForBash.m
Normal file
@ -0,0 +1,40 @@
|
||||
% Read the lines from the text file
|
||||
filename = 'C:\Users\Karthik\Documents\GitRepositories\Calculations\Dipolar-Gas-Simulator\Results\Data_3D\GradientDescent\Phi050\missing_folders.txt'; % replace with your actual file name
|
||||
strs = readlines(filename);
|
||||
strs = strs(strs ~= ""); % remove empty lines if any
|
||||
|
||||
% Initialize arrays
|
||||
aS = zeros(length(strs),1);
|
||||
theta = zeros(length(strs),1);
|
||||
phi = zeros(length(strs),1);
|
||||
N = zeros(length(strs),1);
|
||||
|
||||
% Extract numbers using regular expressions
|
||||
for i = 1:length(strs)
|
||||
tokens = regexp(strs(i), 'aS_(\d+)_theta_(\d+)_phi_(\d+)_N_(\d+)', 'tokens');
|
||||
nums = str2double(tokens{1});
|
||||
aS(i) = nums(1);
|
||||
theta(i) = nums(2);
|
||||
phi(i) = nums(3);
|
||||
N(i) = nums(4);
|
||||
end
|
||||
|
||||
% Convert to bash-style space-separated strings
|
||||
aS_str = sprintf('%d ', unique(aS));
|
||||
theta_str = sprintf('%d ', unique(theta));
|
||||
phi_str = sprintf('%d ', unique(phi));
|
||||
N_str = sprintf('%d ', unique(N));
|
||||
|
||||
% Trim trailing spaces
|
||||
aS_str = strtrim(aS_str);
|
||||
theta_str = strtrim(theta_str);
|
||||
phi_str = strtrim(phi_str);
|
||||
N_str = strtrim(N_str);
|
||||
|
||||
% Display Bash-compatible output
|
||||
fprintf('SCATTERING_LENGTH_RANGE=[%s]\n', aS_str);
|
||||
fprintf('POLAR_ANGLE_RANGE=[%s]\n', theta_str);
|
||||
fprintf('AZIMUTHAL_ANGLE_RANGE=[%s]\n', phi_str);
|
||||
fprintf('NUM_ATOMS_LIST=[%s]\n', N_str);
|
||||
|
||||
%%
|
Loading…
Reference in New Issue
Block a user