diff --git a/examples/H2O_64/rom/convert_density.py b/examples/H2O_64/rom/convert_density.py new file mode 100644 index 00000000..37ef5a6d --- /dev/null +++ b/examples/H2O_64/rom/convert_density.py @@ -0,0 +1,188 @@ +import numpy as np +import matplotlib.pyplot as plt +import os +import pickle +import h5py +import matplotlib.animation as animation +import sys + +verbose = 1 +vectorize = 0 +temperature = 300.0 # Parameter +dt = 9.6 +n_procs = 64 +b = 32 +Nt = 100 + +tag = f"H2O_64_{temperature}" +input_data_path = f"/p/lustre2/cheung26/H2O_64_9.6fs_new/data/{tag}" +output_data_path = f"/p/lustre2/cheung26/H2O_64_9.6fs_new/data/{tag}/postprocess" +n_blocks = round(n_procs ** (1/3)) +mesh = b * n_blocks + +if verbose: + print(f"input_data_path = {input_data_path}") + print(f"output_data_path = {output_data_path}") + print(f"n_blocks = {n_blocks}") + print(f"mesh = {mesh}") + +os.makedirs(output_data_path, exist_ok=True) + +for nt in range(0, Nt + 1): + print(f"\nProcessing time step nt = {nt}") + if nt == 0: + filename = f"{tag}/orbital" + else: + filename = f"MD_mdstep{nt}" + + block_snapshots = [] + + for rank in range(n_procs): + snapshot_filename = filename + f"_snapshot.{rank:06}" + snapshot_path = os.path.join(input_data_path, snapshot_filename) + + if not os.path.exists(snapshot_path): + print(f"Warning: Snapshot file not found: {snapshot_path}. Skipping rank {rank}.") + continue + + try: + snapshot_data = h5py.File(snapshot_path, 'r') + except Exception as e: + print(f"Error opening HDF5 file {snapshot_path}: {e}. Skipping rank {rank}.") + if 'snapshot_data' in locals() and snapshot_data is not None: + snapshot_data.close() + continue + + if verbose: + print(f" Processing rank = {rank}") + + if f'snapshot_matrix_num_cols' not in snapshot_data.keys(): + print(f" Error: Key 'snapshot_matrix_num_cols' not found in {snapshot_path}. Skipping rank {rank}.") + snapshot_data.close() + continue + + n_cols_snapshot = snapshot_data[f'snapshot_matrix_num_cols'][0] + + if f'snapshot_matrix' not in snapshot_data.keys(): + print(f" Error: Key 'snapshot_matrix' not found in {snapshot_path}. Skipping rank {rank}.") + snapshot_data.close() + continue + + block_snapshot = np.array(snapshot_data[f'snapshot_matrix']) + snapshot_data.close() + + if verbose: + print(" Block snapshot raw shape: ", block_snapshot.shape) + + expected_elements = b * b * b * n_cols_snapshot + if block_snapshot.size != expected_elements: + print(f" Error: block_snapshot size ({block_snapshot.size}) does not match expected elements ({expected_elements}) for rank {rank}. Skipping.") + continue + + block_snapshot = np.reshape(block_snapshot, (b, b, b, n_cols_snapshot)) + if verbose: + print(" Block snapshot reshaped shape: ", block_snapshot.shape) + + block_snapshots.append(block_snapshot) + + if len(block_snapshots) != n_procs: + print(f"Warning: Only {len(block_snapshots)} out of {n_procs} snapshots were successfully loaded for nt = {nt}. Cannot reconstruct full snapshot. Skipping this time step.") + continue + + try: + full_snapshots = np.concatenate( + [ np.concatenate( + [ np.concatenate(block_snapshots[(i*n_blocks+j)*n_blocks:(i*n_blocks+j+1)*n_blocks], axis=2) + for j in range(n_blocks)], axis=1) + for i in range(n_blocks)], axis=0 + ) + except Exception as e: + print(f"Error concatenating blocks for nt = {nt}: {e}. This might indicate an issue with block_snapshots list or dimensions after loading.") + continue + + if vectorize: + full_snapshots = np.reshape(full_snapshots, (mesh**3, n_cols_snapshot)) + + if verbose: + print(" Full snapshots shape: ", full_snapshots.shape) + + density = np.sum(np.square(full_snapshots), axis=-1) + + if verbose: + print(" Density shape: ", density.shape) + + try: + pickle.dump(full_snapshots.astype('float32'), open(f"{output_data_path}/snapshots_{nt}.p",'wb')) + pickle.dump(density.astype('float32'), open(f"{output_data_path}/density_{nt}.p", 'wb')) + except Exception as e: + print(f"Error saving pickle files for nt = {nt}: {e}") + +print("\n--- All density data processed and saved as pickle files. ---") + +fig, axes = plt.subplots(1, 3, figsize=(18, 6)) +mid_slice = mesh // 2 + +try: + initial_density_path = f"{output_data_path}/density_{0}.p" + initial_density = pickle.load(open(initial_density_path, 'rb')) + im0 = axes[0].imshow(initial_density[:, :, mid_slice], cmap='viridis', origin='lower', animated=True) + im1 = axes[1].imshow(initial_density[:, mid_slice, :], cmap='viridis', origin='lower', animated=True) + im2 = axes[2].imshow(initial_density[mid_slice, :, :], cmap='viridis', origin='lower', animated=True) + + axes[0].set_title(f'Density (Z = {mid_slice})') + axes[0].set_xlabel('X') + axes[0].set_ylabel('Y') + fig.colorbar(im0, ax=axes[0], fraction=0.046, pad=0.04) + + axes[1].set_title(f'Density (Y = {mid_slice})') + axes[1].set_xlabel('X') + axes[1].set_ylabel('Z') + fig.colorbar(im1, ax=axes[1], fraction=0.046, pad=0.04) + + axes[2].set_title(f'Density (X = {mid_slice})') + axes[2].set_xlabel('Y') + axes[2].set_ylabel('Z') + fig.colorbar(im2, ax=axes[2], fraction=0.046, pad=0.04) + + suptitle_obj = plt.suptitle(f'Density at Time 0 fs, Step 0', fontsize=16) + plt.tight_layout(rect=[0, 0.03, 1, 0.95]) + +except Exception as e: + print(f"Error initializing animation with first frame data: {e}") + print("Animation generation aborted.") + plt.close(fig) + sys.exit(1) + +def animate(i): + nt_current = i + 1 + density_path = f"{output_data_path}/density_{nt_current}.p" + + try: + current_density = pickle.load(open(density_path, 'rb')) + except FileNotFoundError: + print(f"Density file not found for nt = {nt_current}. Skipping frame.") + return im0, im1, im2, suptitle_obj + except Exception as e: + print(f"Error loading density for nt = {nt_current}: {e}. Skipping frame.") + return im0, im1, im2, suptitle_obj + + im0.set_array(current_density[:, :, mid_slice]) + im1.set_array(current_density[:, mid_slice, :]) + im2.set_array(current_density[mid_slice, :, :]) + + suptitle_obj.set_text(f'Density at Time {nt_current * dt} fs, Step {nt_current}') + + return im0, im1, im2, suptitle_obj + +anim = animation.FuncAnimation(fig, animate, frames=Nt, interval=200, blit=True) + +video_filename = os.path.join(output_data_path, "density.mp4") + +print(f"Creating video: {video_filename} using matplotlib.animation...") +try: + anim.save(video_filename, writer='ffmpeg', dpi=200) + print(f"Video created successfully at: {video_filename}") +except Exception as e: + print(f"Error saving animation: {e}") + +plt.close(fig) diff --git a/examples/H2O_64/rom/coords.in b/examples/H2O_64/rom/coords.in new file mode 100644 index 00000000..3496b2e5 --- /dev/null +++ b/examples/H2O_64/rom/coords.in @@ -0,0 +1,192 @@ +O1 1 -3.39327689 -4.62341033 7.55503536 1 4.397109e-05 -2.204894e-04 1.661038e-04 +O4 1 2.17655754 7.07419683 9.71655589 1 1.832457e-04 -2.129741e-04 1.946991e-04 +O7 1 7.62020647 -10.44808969 7.35114882 1 3.434425e-06 1.452690e-04 -1.912334e-04 +O10 1 10.07207765 7.92622426 12.89860842 1 -1.920642e-04 8.372464e-05 7.151047e-05 +O13 1 11.92054387 -4.27596304 5.15152308 1 9.686938e-05 2.227376e-04 6.551400e-05 +O16 1 10.57969169 6.30823586 1.72552047 1 -3.600013e-04 2.375009e-04 -5.598914e-05 +O19 1 -3.97743829 -9.96289608 -0.85746077 1 3.009434e-04 -2.302956e-04 -1.002259e-04 +O22 1 1.24264646 6.61473616 2.82128138 1 4.495540e-05 1.459941e-05 5.373707e-05 +O25 1 -8.37765154 -6.61560731 8.68894759 1 2.454511e-04 -4.646778e-05 1.830311e-04 +O28 1 -3.54756989 9.35879785 -9.30789063 1 -8.867533e-05 -3.696997e-04 4.825718e-05 +O31 1 3.82741842 1.73980259 -11.46662978 1 -1.362498e-04 2.680686e-05 -2.829186e-04 +O34 1 -8.16630235 8.82280075 1.06430932 1 1.231696e-04 -2.808625e-04 -1.457808e-04 +O37 1 -4.59894154 -1.45631628 11.14142257 1 2.331169e-04 1.180037e-04 1.692437e-04 +O40 1 -2.90370233 -4.57988394 2.53671109 1 -1.972883e-04 9.529371e-05 3.029176e-04 +O43 1 -12.09243823 -7.24731662 -2.35112831 1 8.343914e-05 3.051731e-04 -1.787144e-04 +O46 1 7.26566010 -3.41177026 8.06941603 1 2.365217e-05 -2.923762e-04 -3.776887e-05 +O49 1 4.68555900 6.48085455 -9.54689304 1 -4.615204e-05 1.695866e-04 8.647878e-05 +O52 1 10.29980024 12.62912805 14.61240150 1 3.201663e-05 1.829978e-04 2.685074e-04 +O55 1 3.96531522 -0.25116042 5.41363877 1 1.108130e-04 6.270519e-04 -6.082183e-05 +O58 1 -9.86058528 -6.54036871 13.50593711 1 3.803691e-05 -1.554369e-05 2.529442e-04 +O61 1 -10.84847406 1.07973285 -5.64390043 1 -1.953645e-06 1.693251e-04 1.142947e-04 +O64 1 -5.83359882 7.82603854 5.51638435 1 -3.831323e-04 2.112777e-04 -1.035486e-04 +O67 1 2.24004199 2.73436945 -4.14043084 1 -2.825640e-04 6.613577e-05 1.651798e-06 +O70 1 0.06469034 -8.16817476 -14.20031950 1 -3.106814e-04 1.127953e-05 7.031054e-05 +O73 1 7.66186065 -5.03001188 -4.93806217 1 1.466638e-05 1.638476e-04 9.932617e-05 +O76 1 -7.98145287 8.94207464 -6.54030645 1 -2.962627e-05 -3.772076e-05 1.914929e-04 +O79 1 13.37757282 0.35385983 3.04500411 1 -5.240931e-05 -1.183173e-04 1.255233e-04 +O82 1 -5.06968184 0.47180752 1.51286183 1 -1.109897e-04 1.021916e-04 3.003974e-05 +O85 1 1.97341938 -12.19200378 6.53702826 1 1.912567e-04 -7.795254e-05 -6.112455e-05 +O88 1 -6.99874048 -0.72602050 -2.98790593 1 2.923701e-04 2.529532e-04 -2.205254e-04 +O91 1 1.15922528 -9.11442555 -1.16814362 1 4.573346e-05 7.064670e-05 -2.462937e-05 +O94 1 8.29142769 -6.57126616 1.92186122 1 -1.922044e-04 -3.353333e-04 -3.779533e-04 +O97 1 4.35866012 -1.74613622 -2.95203158 1 1.007614e-04 -2.095916e-04 -2.724664e-04 +O100 1 10.43892760 1.73857100 -0.92606028 1 -2.332671e-04 1.048044e-04 -2.910349e-04 +O103 1 8.41249253 0.23317733 -12.43609782 1 6.423976e-05 -4.346015e-05 -1.163011e-04 +O106 1 12.09143535 1.93977404 7.97908500 1 5.962629e-05 1.647900e-04 1.386124e-04 +O109 1 4.91399218 13.38439768 1.81444684 1 3.396599e-04 -1.628150e-04 -3.352993e-04 +O112 1 -2.30344127 11.11167544 3.48576322 1 -2.829690e-04 2.341504e-04 2.352738e-04 +O115 1 -4.99194231 -5.30773137 -9.05379923 1 -8.758203e-05 -9.584790e-05 -7.707151e-05 +O118 1 7.76536561 9.37028299 -0.61121397 1 8.348941e-05 9.997348e-05 2.130196e-04 +O121 1 10.21391421 6.48585400 6.82606914 1 -1.401686e-04 3.290745e-04 -3.408622e-04 +O124 1 -7.13075534 -6.00063059 -1.30409970 1 -2.436945e-04 -1.785947e-04 1.041775e-04 +O127 1 3.54059029 6.88744959 -1.89007303 1 4.530864e-05 -2.256668e-04 -1.548300e-05 +O130 1 5.07776864 4.92446305 6.02303470 1 8.630850e-05 -6.378701e-05 -6.363400e-05 +O133 1 -7.52440728 2.52646251 -12.35300346 1 -5.443556e-05 -2.230347e-04 -3.268760e-04 +O136 1 -2.44699692 4.53811059 -1.66493875 1 3.047741e-04 -2.188765e-04 6.278909e-05 +O139 1 -2.82565628 -2.18056645 -5.45504151 1 2.054721e-04 1.148380e-04 -7.308948e-05 +O142 1 -8.11148551 9.13805032 10.09049306 1 -8.944504e-06 1.078273e-05 -3.003342e-04 +O145 1 1.73227257 -9.70863578 -6.27678799 1 2.592262e-04 -7.709399e-05 1.935414e-04 +O148 1 -2.02088710 -9.01982043 -9.78771685 1 -4.229394e-04 2.924553e-05 1.321205e-04 +O151 1 -10.50696109 -11.07467597 6.87112503 1 -7.373275e-05 2.418213e-05 5.727150e-04 +O154 1 -4.82142655 8.79644564 -2.72030867 1 -2.570386e-04 1.015291e-04 8.454333e-05 +O157 1 -0.10292325 1.78393314 -8.43389722 1 -7.585899e-05 -3.875170e-04 -1.660019e-04 +O160 1 11.77500434 11.20266031 -4.22449479 1 -1.901104e-06 3.802240e-05 2.003822e-04 +O163 1 -10.11950073 4.80289066 14.56776401 1 -1.778451e-04 -2.004671e-04 -2.258098e-04 +O166 1 -13.44608540 -2.09286896 -8.77993839 1 -1.695404e-05 3.383385e-04 6.326397e-05 +O169 1 6.00070507 -8.56035829 -8.53814471 1 -2.634087e-04 9.114321e-05 3.218376e-04 +O172 1 0.27102741 -4.26013574 -1.20104809 1 3.172984e-04 7.532331e-05 4.361109e-05 +O175 1 -2.99815889 4.65101365 11.68720220 1 1.004995e-04 6.392446e-05 -3.506668e-05 +O178 1 -2.64435694 3.76193803 4.65786342 1 -6.228416e-05 1.416797e-04 -1.595762e-05 +O181 1 7.09110285 -1.49104865 1.35157098 1 2.277276e-04 -1.004057e-04 2.827869e-04 +O184 1 1.76350650 8.75010728 -6.17280032 1 1.830175e-05 -2.915064e-04 -2.604066e-04 +O187 1 -0.46474904 1.22107089 8.38495850 1 6.668296e-06 1.900383e-04 -9.117977e-05 +O190 1 5.04701205 -7.37112502 10.34830828 1 -7.303292e-05 -2.855294e-04 -2.597417e-05 +H2 2 -3.80040986 -3.25544717 8.90152556 1 3.181650e-04 -1.115846e-03 3.055891e-05 +H3 2 -4.78546942 -5.70083164 7.94674309 1 1.000595e-04 -8.793744e-04 -1.553373e-04 +H5 2 3.04263534 6.70421364 11.40707424 1 -8.344988e-05 1.152918e-03 4.436245e-05 +H6 2 0.47652781 6.30281837 9.78006218 1 -3.507240e-04 -2.585112e-04 -9.903951e-04 +H8 2 6.93311922 -9.44545611 8.71587274 1 3.401433e-07 1.240494e-04 3.923909e-04 +H9 2 6.53332128 -11.97530077 7.43952981 1 5.517727e-04 6.773973e-05 -1.598341e-03 +H11 2 9.81576220 8.15063597 11.03693847 1 -6.540779e-04 4.992504e-04 5.573712e-04 +H12 2 10.10305925 9.69578222 13.54437791 1 6.594767e-06 -3.601304e-04 -1.427162e-03 +H14 2 12.78540504 -2.84547990 4.31382064 1 5.418596e-05 1.036344e-03 -8.230057e-04 +H15 2 13.18304430 -4.82688520 6.41516824 1 -1.036800e-03 1.049730e-03 -1.183827e-03 +H17 2 12.26652273 7.14039060 1.38293538 1 -1.156982e-03 2.794755e-04 3.539633e-04 +H18 2 9.30924793 7.53938669 0.88702708 1 -4.785293e-04 4.415524e-04 -9.193747e-04 +H20 2 -4.82929188 -8.28987348 -1.27772181 1 -2.387974e-04 2.347542e-03 8.146576e-05 +H21 2 -3.93115526 -10.19672459 0.99887178 1 8.103206e-04 -1.103380e-03 4.366641e-04 +H23 2 2.55722357 6.17677693 4.04510520 1 -5.620041e-04 -7.154456e-04 -2.528136e-04 +H24 2 0.45925531 8.19720582 3.26656521 1 4.510263e-04 3.172532e-04 5.501638e-04 +H26 2 -9.08640874 -6.67261664 10.43270390 1 7.767592e-04 -2.767164e-04 8.844669e-04 +H27 2 -8.97735443 -8.36618953 7.95763397 1 9.015412e-04 3.325522e-04 6.392022e-05 +H29 2 -5.39789433 9.02821312 -8.94121777 1 2.993735e-04 -7.657028e-04 4.219678e-04 +H30 2 -2.62348672 9.09187865 -7.68017574 1 -1.996245e-04 -2.651238e-04 -2.017435e-04 +H32 2 3.78961389 3.30298287 -10.37173547 1 8.309451e-04 5.788240e-04 -9.854244e-05 +H33 2 5.71426335 1.35561722 -11.80184401 1 -3.400190e-04 -2.847475e-04 4.358465e-04 +H35 2 -7.24452256 8.40889926 -0.59553795 1 5.848431e-04 8.614678e-04 7.219290e-04 +H36 2 -8.49027198 10.63617358 1.17620069 1 6.225494e-04 -5.871427e-04 -7.219098e-04 +H38 2 -5.94233934 -0.06526811 11.20646095 1 -4.879527e-04 1.703800e-05 2.543338e-04 +H39 2 -4.87851535 -2.73015739 12.53833454 1 -2.895059e-04 4.568677e-04 4.712705e-04 +H41 2 -2.73591205 -4.09168890 4.27098878 1 5.836503e-05 6.376373e-04 1.488212e-03 +H42 2 -4.39163466 -5.54331409 2.29777771 1 6.622157e-04 1.263820e-03 2.167038e-04 +H44 2 -12.22429906 -9.12287462 -2.75004459 1 7.476727e-05 5.147785e-04 1.577519e-03 +H45 2 -12.97050982 -6.95521647 -0.66026299 1 1.297265e-04 -3.342471e-04 1.007201e-04 +H47 2 7.91889437 -2.19252880 9.34700292 1 3.067846e-05 5.634387e-04 -9.883005e-04 +H48 2 8.62218943 -3.81977112 6.92140471 1 2.456564e-04 2.277300e-04 9.155533e-04 +H50 2 4.07727275 7.41001818 -8.04413610 1 5.479307e-04 -4.771960e-04 3.351837e-04 +H51 2 6.44900459 6.93115533 -9.73766141 1 1.767716e-04 -1.412593e-04 -4.760206e-04 +H53 2 11.60474581 13.89535844 14.23656385 1 4.063873e-04 -4.559560e-04 8.616508e-04 +H54 2 8.55390795 13.47322256 14.71748964 1 1.593368e-03 -5.388886e-04 -1.488693e-04 +H56 2 5.10826803 -1.21967893 6.54377937 1 9.818926e-04 -1.234623e-03 -6.946694e-04 +H57 2 2.25558689 -0.41262473 6.05297749 1 9.666906e-04 7.905502e-04 -8.010551e-04 +H59 2 -8.28671196 -6.55331960 14.46857171 1 4.420528e-04 2.354369e-04 -1.643548e-04 +H60 2 -10.87709652 -5.04900831 14.09337950 1 3.893560e-04 7.944366e-04 1.829670e-04 +H62 2 -11.88795314 1.36591503 -4.13110931 1 1.297167e-03 -2.469449e-04 7.120217e-04 +H63 2 -10.67913032 2.54836882 -6.75025177 1 -1.744633e-03 4.282979e-04 -2.073625e-04 +H65 2 -6.87867271 7.90227121 3.99501873 1 8.776430e-04 1.061453e-03 -8.021276e-04 +H66 2 -4.80516128 6.20351371 5.58979961 1 -4.350773e-04 3.566506e-04 -1.298334e-04 +H68 2 2.81131674 0.90686332 -3.83911616 1 -1.096073e-03 -2.697077e-04 7.200056e-04 +H69 2 1.32426632 2.61068356 -5.80944850 1 2.487825e-04 -1.010952e-04 -1.063430e-03 +H71 2 -0.33822413 -8.31404610 -12.35641467 1 -4.634839e-04 -1.129233e-05 -9.890087e-04 +H72 2 -1.14499459 -6.76723216 -14.78914218 1 8.231892e-04 -6.803143e-04 -9.697820e-04 +H74 2 6.35558887 -4.02559642 -4.11168323 1 4.016748e-04 -1.355620e-03 -5.399202e-04 +H75 2 9.09236922 -5.47185680 -3.72549153 1 -2.704869e-04 5.344257e-04 6.671557e-04 +H77 2 -6.64787250 9.03623248 -5.18460601 1 -7.541573e-04 -6.520530e-04 1.950909e-03 +H78 2 -9.40043492 9.81210740 -5.62599094 1 -5.450893e-04 2.597505e-04 5.637598e-04 +H80 2 12.28126226 0.69523553 1.61850631 1 -1.985501e-04 7.345113e-05 -1.630004e-03 +H81 2 15.02113752 0.23548909 2.45036956 1 -4.086489e-04 1.299467e-03 4.073502e-04 +H83 2 -4.54696956 -1.27123482 1.90634095 1 7.180714e-04 1.849120e-04 -1.940446e-03 +H84 2 -3.99693362 1.56658889 2.69926296 1 5.163822e-04 -1.045861e-04 4.167339e-04 +H86 2 2.28124815 -13.51148896 7.80823983 1 -6.455060e-04 -1.073480e-03 1.886321e-03 +H87 2 1.17678976 -10.87418979 7.55628509 1 -1.180951e-03 6.035158e-05 3.294933e-04 +H89 2 -6.55039804 0.26764697 -1.49182833 1 -7.237267e-04 -3.263918e-04 -2.817932e-04 +H90 2 -8.40241129 0.26189772 -4.08187140 1 3.583041e-04 2.823202e-04 -4.875195e-04 +H92 2 -0.56670062 -9.51053848 -0.69765768 1 1.713462e-03 -3.132846e-04 -3.650251e-04 +H93 2 0.85795979 -7.20285858 -0.96944461 1 -9.250903e-05 3.936209e-04 -5.337787e-04 +H95 2 9.50801830 -7.06913846 3.24888558 1 -1.849079e-04 -7.597119e-04 7.323329e-04 +H96 2 6.98464485 -8.01019171 1.96288371 1 -1.719349e-04 4.184675e-04 -4.893892e-04 +H98 2 3.03586769 -2.71352331 -1.93924215 1 3.808794e-04 -4.728256e-05 4.971244e-04 +H99 2 5.57059080 -1.41423992 -1.64200080 1 1.244348e-03 -1.286874e-04 1.121633e-03 +H101 2 10.51870992 3.54664339 -0.28186670 1 1.146038e-04 4.183414e-04 5.287198e-04 +H102 2 9.05391800 0.74050193 -0.10485860 1 7.443100e-04 -1.138501e-03 -1.955459e-04 +H104 2 9.93501879 0.76466498 -13.41555738 1 -3.631466e-04 -8.435484e-05 1.002366e-03 +H105 2 9.03620129 -0.66815419 -10.69197602 1 -7.748382e-04 -2.465770e-04 -7.935342e-04 +H107 2 11.38711205 3.62136828 7.83166390 1 -3.933636e-04 2.878797e-04 1.453427e-04 +H108 2 12.60947485 1.41506313 6.24624422 1 2.203179e-04 1.070577e-03 4.984911e-04 +H110 2 4.41887506 12.97710046 3.58129484 1 3.670030e-04 6.215692e-04 -9.378567e-04 +H111 2 3.34126583 13.77548631 0.69898701 1 2.840574e-04 3.597549e-04 5.466718e-04 +H113 2 -1.00298169 11.38526067 4.77855866 1 -1.314039e-03 6.768290e-04 -1.224936e-04 +H114 2 -3.52973265 10.01023931 4.34821478 1 -1.012494e-03 -2.801366e-04 3.864098e-04 +H116 2 -3.68325305 -4.44272867 -7.83169509 1 9.537086e-04 -8.283714e-05 7.825247e-05 +H117 2 -3.90615764 -6.58492081 -9.97599302 1 4.599181e-04 -5.961227e-04 6.153893e-04 +H119 2 6.87450602 10.93142772 -0.06312860 1 4.076267e-04 -2.177853e-04 3.958027e-04 +H120 2 6.44967362 8.06897312 -1.18996360 1 -3.745677e-04 -2.173467e-04 -9.395095e-05 +H122 2 8.41958117 6.20197877 6.43366466 1 1.605936e-03 1.243449e-03 6.988943e-04 +H123 2 10.77670645 6.58337631 5.07375467 1 -5.299450e-04 -9.530419e-04 1.393814e-03 +H125 2 -8.87439717 -6.60470073 -1.70736776 1 1.188524e-03 -4.498870e-05 4.897300e-04 +H126 2 -7.11126218 -4.26408543 -1.97406036 1 1.652273e-03 -1.420211e-03 -3.169469e-04 +H128 2 3.54249287 5.19022351 -2.82478330 1 -1.975939e-04 -2.660211e-04 -3.461115e-04 +H129 2 2.95779789 6.44578735 -0.18772717 1 -1.871155e-04 -4.916234e-04 -4.095802e-04 +H131 2 4.57259554 3.07585137 5.95798515 1 -6.715358e-05 -1.849133e-04 1.291986e-03 +H132 2 3.97651828 5.60670695 7.41747352 1 3.168155e-04 -5.913619e-04 8.766871e-04 +H134 2 -8.73153231 2.33994052 -13.78162469 1 -7.260546e-05 6.497647e-04 1.110851e-04 +H135 2 -8.41323431 3.29551895 -10.99951925 1 -7.753856e-04 -1.265207e-03 4.632225e-04 +H137 2 -2.93519731 2.91141184 -1.12856644 1 3.975706e-04 -4.646473e-04 -1.065220e-04 +H138 2 -0.67802930 4.33222775 -2.37652379 1 3.466920e-04 -9.841521e-04 -1.190669e-03 +H140 2 -1.96969296 -0.87627451 -6.52724641 1 -1.632898e-04 -1.980188e-04 -9.987404e-04 +H141 2 -4.23740459 -1.42414711 -4.47538692 1 -4.638097e-04 -1.693069e-04 1.343086e-04 +H143 2 -7.02609187 8.53276958 8.70100544 1 1.897932e-04 7.908782e-04 1.437917e-03 +H144 2 -8.89131017 7.53322406 10.38095101 1 -1.568963e-03 -4.144158e-04 -8.370353e-04 +H146 2 3.24112602 -9.49801090 -7.29803632 1 2.557217e-04 7.793330e-04 6.039397e-04 +H147 2 2.04066095 -9.35520838 -4.44903994 1 1.256331e-03 -6.728293e-04 -1.165285e-03 +H149 2 -3.02299644 -10.62965237 -9.81190712 1 1.168245e-03 -4.391721e-04 -3.488333e-04 +H150 2 -0.91170591 -9.20620145 -8.36695264 1 6.333256e-04 -5.345426e-04 -2.462316e-04 +H152 2 -9.70223248 -12.31768098 8.07860832 1 2.738144e-04 -2.543022e-04 -9.267240e-04 +H153 2 -12.31166106 -11.31315089 7.10466783 1 -3.367496e-04 -4.486773e-04 -1.385196e-03 +H155 2 -3.83651595 10.19046898 -1.99517792 1 -3.694873e-04 1.847174e-05 -7.520253e-05 +H156 2 -3.83691900 7.15907638 -2.78621220 1 1.157378e-04 1.381853e-04 -1.247523e-03 +H158 2 1.44135934 1.42272389 -9.44174596 1 8.233360e-04 -4.809177e-04 1.161149e-03 +H159 2 -0.98841753 2.91375051 -9.63438049 1 2.285249e-04 -4.304246e-04 1.118336e-03 +H161 2 10.89369608 11.53336136 -5.78198734 1 2.636134e-04 3.752133e-04 2.250979e-04 +H162 2 10.41817757 10.35180279 -3.26661333 1 -6.348835e-04 1.623110e-04 -1.158066e-03 +H164 2 -9.04914477 6.06106247 15.62839285 1 -5.152753e-04 -3.460623e-04 7.889134e-04 +H165 2 -11.27522771 6.24643684 13.98733640 1 -8.585412e-06 3.736468e-04 1.261324e-04 +H167 2 -12.51169818 -0.93767948 -7.49021135 1 -6.511585e-05 -1.000393e-03 1.812229e-04 +H168 2 -14.75177102 -2.87537176 -7.72343026 1 -2.757944e-04 -8.897222e-04 6.072684e-04 +H170 2 6.79577598 -7.21612024 -7.52266212 1 -1.260349e-03 -3.386159e-04 -1.193251e-03 +H171 2 5.55514024 -7.94623500 -10.29162082 1 -3.232334e-04 -2.300678e-04 -1.758538e-03 +H173 2 -1.02795804 -4.11266127 0.13653354 1 2.440005e-04 8.930809e-04 5.217333e-05 +H174 2 -0.59940903 -3.47236531 -2.59182956 1 -8.563304e-05 2.941476e-04 9.022726e-04 +H176 2 -4.72159641 4.05908934 11.13867939 1 4.671460e-04 5.363801e-04 4.850685e-04 +H177 2 -3.40590470 6.32189986 12.51959486 1 7.639365e-05 -4.776834e-04 3.486760e-04 +H179 2 -1.92789549 3.01576124 6.15258181 1 1.780284e-03 -1.397622e-03 -8.090690e-04 +H180 2 -1.19408214 4.45288539 3.71144227 1 -1.191606e-03 -8.088910e-04 5.756535e-04 +H182 2 5.87291127 -1.19314358 2.76174150 1 2.818976e-06 -1.866662e-04 -7.077353e-04 +H183 2 7.65246291 -3.38339626 1.48124604 1 -1.190071e-03 -2.229384e-04 -5.427690e-04 +H185 2 2.34464626 8.11392869 -4.39357821 1 -5.900141e-04 4.609018e-05 -5.798321e-04 +H186 2 2.12263667 10.63174329 -5.97931486 1 -1.019631e-03 -1.254058e-05 -2.611865e-05 +H188 2 -1.79220828 0.46391427 9.48650424 1 -1.018477e-03 1.181967e-04 -1.340113e-03 +H189 2 0.90361009 1.31807274 9.62438281 1 -7.776422e-04 6.056244e-04 6.899094e-04 +H191 2 5.93752224 -5.86758521 9.62083105 1 7.134376e-04 2.111649e-04 -8.094298e-04 +H192 2 3.48973322 -7.58522767 9.41988952 1 1.405215e-03 8.561769e-04 7.032423e-05 diff --git a/examples/H2O_64/rom/job.snap b/examples/H2O_64/rom/job.snap new file mode 100644 index 00000000..3e592028 --- /dev/null +++ b/examples/H2O_64/rom/job.snap @@ -0,0 +1,25 @@ +#!/bin/tcsh +#SBATCH -N 2 +#SBATCH -t 1:00:00 +#SBATCH -p pdebug + +setenv OMP_NUM_THREADS 1 +#setenv KMP_DETERMINISTIC_REDUCTION 1 + +set maindir = /p/lustre2/cheung26/mgmol + +setenv LD_LIBRARY_PATH ${maindir}/build_quartz/libROM/build/lib:$LD_LIBRARY_PATH + +set exe = ${maindir}/install_quartz/bin/mgmol-opt +set datadir = $maindir/examples/H2O_64 +set cfg_quench = mgmol_quench.cfg +set cfg_md = mgmol_md.cfg + +#set ncpus = 98 +#set ncpus = 49 +set ncpus = 64 + +source $maindir/scripts/modules.quartz + +srun -n $ncpus $exe -c $cfg_quench -i coords.in > quench_H2O_64.out +srun -n $ncpus $exe -c $cfg_md -i coords.in > md_H2O_64.out diff --git a/examples/H2O_64/rom/job.snap_batch b/examples/H2O_64/rom/job.snap_batch new file mode 100644 index 00000000..21e71430 --- /dev/null +++ b/examples/H2O_64/rom/job.snap_batch @@ -0,0 +1,47 @@ +#!/bin/tcsh +#SBATCH -N 2 +#SBATCH -t 1:00:00 +#SBATCH -p pdebug + +date + +set maindir = /p/lustre2/cheung26/mgmol +set exe = ${maindir}/install_quartz/bin/mgmol-opt +set datadir = $maindir/examples/H2O_64 +set cfg_quench = mgmol_quench.cfg +set cfg_md = mgmol_md.cfg + +set temperature_min = 300 +set temperature_max = 400 +set temperature_num_increments = 1 + +mkdir data + +foreach k (`seq 0 $temperature_num_increments`) + set temperature = `echo "scale=1; $temperature_min + $k * ($temperature_max - $temperature_min) / ($temperature_num_increments)" | bc` + set tag = H2O_64_$temperature + echo ${tag} + + if (-e data/${tag}) then + continue + else + mkdir data/${tag} + endif + + cp $cfg_quench data/${tag} + cp $cfg_md data/${tag} + cp coords.in data/${tag} + cp job.snap data/${tag} + + cd data/${tag} + ln -s -f $maindir/potentials/pseudo.O_ONCV_PBE_SG15 . + ln -s -f $maindir/potentials/pseudo.D_ONCV_PBE_SG15 . + sed -i -e "s/CUSTOM_TAG/${tag}/g" ${cfg_quench} + sed -i -e "s/CUSTOM_TEMPERATURE/${temperature}/g" ${cfg_quench} + sed -i -e "s/CUSTOM_TAG/${tag}/g" ${cfg_md} + sed -i -e "s/CUSTOM_TEMPERATURE/${temperature}/g" ${cfg_md} + sbatch job.snap + cd ../.. +end + +date diff --git a/examples/H2O_64/rom/mgmol_md.cfg b/examples/H2O_64/rom/mgmol_md.cfg new file mode 100644 index 00000000..981c4dbb --- /dev/null +++ b/examples/H2O_64/rom/mgmol_md.cfg @@ -0,0 +1,37 @@ +verbosity=1 +xcFunctional=PBE +FDtype=4th +[Mesh] +nx=128 +ny=128 +nz=128 +[Domain] +ox=0. +oy=0. +oz=0. +lx=23.4884 +ly=23.4884 +lz=23.4884 +[Potentials] +pseudopotential=pseudo.O_ONCV_PBE_SG15 +pseudopotential=pseudo.D_ONCV_PBE_SG15 +[Run] +type=MD +[Quench] +max_steps=15 +atol=1.e-7 +[MD] +num_steps=100 +dt=40. +print_interval=5 +[Restart] +input_filename=CUSTOM_TAG +input_level=4 +interval=30 +output_filename=CUSTOM_TAG +output_level=4 +[Thermostat] +temperature=CUSTOM_TEMPERATURE +[ROM.offline] +save_librom_snapshot=ON +librom_snapshot_freq=1 diff --git a/examples/H2O_64/rom/mgmol_quench.cfg b/examples/H2O_64/rom/mgmol_quench.cfg new file mode 100644 index 00000000..06025fa9 --- /dev/null +++ b/examples/H2O_64/rom/mgmol_quench.cfg @@ -0,0 +1,31 @@ +verbosity=1 +xcFunctional=PBE +FDtype=4th +[Mesh] +nx=128 +ny=128 +nz=128 +[Domain] +ox=0. +oy=0. +oz=0. +lx=23.4884 +ly=23.4884 +lz=23.4884 +[Potentials] +pseudopotential=pseudo.O_ONCV_PBE_SG15 +pseudopotential=pseudo.D_ONCV_PBE_SG15 +[Run] +type=QUENCH +[Quench] +max_steps=100 +atol=1.e-8 +[Orbitals] +initial_type=Fourier +[Restart] +output_level=4 +output_filename=CUSTOM_TAG +[Thermostat] +temperature=CUSTOM_TEMPERATURE +[ROM.offline] +save_librom_snapshot=ON