Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update MWs in MCCCS-MN log file generation #266

Merged
merged 6 commits into from
Dec 15, 2024
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
2 changes: 1 addition & 1 deletion reproducibility_project/clear_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def main():
):
print("-----------------------------------------------------")

if molecule == "waterSPCE" and engine == "mcccs":
if molecule == "benzeneUA" and engine == "mcccs":
print(
molecule,
ensemble,
Expand Down
14 changes: 12 additions & 2 deletions reproducibility_project/find_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def main():
):
print("-----------------------------------------------------")

if molecule == "ethanolAA" and engine == "mcccs":
jobs = []

if molecule == "benzeneUA" and engine == "mcccs":
print(
molecule,
ensemble,
Expand All @@ -50,7 +52,15 @@ def main():
)

for job in group:
print(job.sp.replica, job)
jobs.append(
[
job.sp.replica,
str(job),
]
)
jobs.sort()
for job in jobs:
print(job)


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@


&mc_simple
pm_atom_tra= 0.05
armtra= 1.000000000000000E-002
rmtra= 0.300000000000000
rmrot= 0.400000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@


&mc_simple
pm_atom_tra= 0.05
armtra= 1.000000000000000E-002
rmtra= 0.300000000000000
rmrot= 0.400000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@


&mc_simple
pm_atom_tra= 0.05
armtra= 1.000000000000000E-002
rmtra= 0.300000000000000
rmrot= 0.400000000000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@


&mc_simple
pm_atom_tra= 0.05
armtra= 1.000000000000000E-002
rmtra= 0.300000000000000
rmrot= 0.400000000000000
Expand Down
25 changes: 23 additions & 2 deletions reproducibility_project/src/engines/mcccs/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def main():
base_dir = os.getcwd()
if ensemble == "NPT":
density_list = []
density_list_logfile = []
for job in group:
os.chdir(job.ws)
# print(job)
Expand All @@ -103,15 +104,25 @@ def main():
)
)
density_list.append(avg_one_seed_density_box1(prod_run_files))

density_list_logfile.append(density_avg_logfile("log-npt.txt"))
# print(density_list)
filtered_density_list = list(filter(None, density_list))
output_string = "The average density is {} g/ml with SEM {} from {} samples".format(
filtered_density_list_logfile = list(
filter(None, density_list_logfile)
)
output_string = "For NpT cases, the first line is runfile avg and second line is logfile avg\nThe average density is {} g/ml with SEM {} from {} samples\n".format(
np.mean(filtered_density_list),
np.std(filtered_density_list)
/ np.sqrt(len(filtered_density_list)),
len(filtered_density_list),
)
output_string += "The average density is {} g/ml with SEM {} from {} samples".format(
np.mean(filtered_density_list_logfile),
np.std(filtered_density_list_logfile)
/ np.sqrt(len(filtered_density_list_logfile)),
len(filtered_density_list_logfile),
)

print(output_string)
os.chdir(base_dir)
with open("density_results.txt", "w") as text_file:
Expand Down Expand Up @@ -171,6 +182,16 @@ def main():
os.chdir("..")


def density_avg_logfile(logfile):
"""Calc average for log files."""
data = np.loadtxt("log-npt.txt", skiprows=1)

# Calculate the average of the third from last column (density)
density_column_index = -3 # Third from last column
average_density = np.mean(data[:, density_column_index])
return average_density


def avg_one_seed_density_box1(prod_run_files):
"""For a one particular seed, read all the prod run files and provide the average density (g/ml) for one seed."""
if len(prod_run_files) == 0:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 0.698325046875 g/ml with SEM 0.00019497573995066978 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 0.6980418125000001 g/ml with SEM 0.00023460065439170633 from 16 samples
The average density is 0.698041913994141 g/ml with SEM 0.0002348979377991116 from 16 samples
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 0.8132740781250001 g/ml with SEM 0.00022710556005862753 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 0.8127313437499999 g/ml with SEM 0.0002470408075268068 from 16 samples
The average density is 0.8127309012571694 g/ml with SEM 0.00024699982340980933 from 16 samples
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 0.7915156250000001 g/ml with SEM 0.00022247973156454715 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 0.7914194531250001 g/ml with SEM 0.00021111305682752364 from 16 samples
The average density is 0.7914208917911247 g/ml with SEM 0.00021123437103423662 from 16 samples
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 0.76872575 g/ml with SEM 0.00020045779758662987 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 0.76839096875 g/ml with SEM 0.00020634974964182785 from 16 samples
The average density is 0.7683913005838312 g/ml with SEM 0.0002062944575966398 from 16 samples
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Box1 The average density is 0.374604859375 g/ml with SEM 3.351215358442761e-05 from 16 samples
Box1 The average density is 0.374604859375 g/ml with SEM 3.3512153584427606e-05 from 16 samples
Box2 The average density is 0.010456921875 g/ml with SEM 1.4941499182717499e-05 from 16 samples
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 0.375760578125 g/ml with SEM 4.58862635118307e-05 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 0.375760578125 g/ml with SEM 4.588626351183069e-05 from 16 samples
The average density is 0.3757593605773165 g/ml with SEM 4.592843462569958e-05 from 16 samples
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Box1 The average density is 0.538999234375 g/ml with SEM 7.901658581811365e-05 from 16 samples
Box2 The average density is 0.02035428125 g/ml with SEM 3.284094656059866e-05 from 16 samples
Box1 The average density is 0.5389992343750001 g/ml with SEM 7.901658581811365e-05 from 16 samples
Box2 The average density is 0.02035428125 g/ml with SEM 3.284094656059865e-05 from 16 samples
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 0.5410875312499999 g/ml with SEM 8.71734668226038e-05 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 0.54108753125 g/ml with SEM 8.71734668226038e-05 from 16 samples
The average density is 0.5410886453415662 g/ml with SEM 8.653017097453927e-05 from 16 samples
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 1.0072252343750001 g/ml with SEM 0.00047373785257594106 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 1.00705103125 g/ml with SEM 0.0003472372551509214 from 16 samples
The average density is 1.0070531403810825 g/ml with SEM 0.00034683889433465964 from 16 samples
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 0.9977669062499999 g/ml with SEM 0.0003959896293592313 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 0.99770809375 g/ml with SEM 0.0003722279679110896 from 16 samples
The average density is 0.9977080406908347 g/ml with SEM 0.00037210745263542696 from 16 samples
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
The average density is 0.9861051249999999 g/ml with SEM 0.00017870171851222096 from 16 samples
For NpT cases, the first line is runfile avg and second line is logfile avg
The average density is 0.986137296875 g/ml with SEM 0.0002256395199824372 from 16 samples
The average density is 0.9861366533115048 g/ml with SEM 0.0002257823152641847 from 16 samples
12 changes: 11 additions & 1 deletion reproducibility_project/src/engines/mcccs/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,17 @@ def sanitize_npt_log(step, job):
"""Sanitize the output logs for NPT simulations."""
import numpy as np

mw = job.sp.mass
masses = {
"methaneUA": 16.043,
"pentaneUA-flexible_bonds": 72.151,
"pentaneUA-constrain_bonds": 72.151,
"benzeneUA": 78.114,
"waterSPCE": 18.015324,
"ethanolAA": 46.068672,
}

mw = masses[job.sp.molecule]
print("sanitizing for", job, "molecule =", job.sp.molecule, "mw=", mw)
temp = job.sp.temperature
files = sorted(glob("fort*12*{}*".format(step)))
arrays = []
Expand Down
Loading