summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmarks.csv40
-rw-r--r--lj_matrix.py20
-rw-r--r--main.py56
3 files changed, 68 insertions, 48 deletions
diff --git a/benchmarks.csv b/benchmarks.csv
index 181da4e77..eb0ff0333 100644
--- a/benchmarks.csv
+++ b/benchmarks.csv
@@ -1,17 +1,23 @@
-ml_type,tr_size,te_size,sigma,mae,time
-CM,2500,1500,1000.0,26.97361909951274,282.1443384
-L-JM,2500,1500,1000.0,11.785532138202667,277.3047686
-CM,3000,1500,1000.0,24.641045831013365,368.9830951
-L-JM,3000,1500,1000.0,11.08713556535848,370.8802103
-CM,3500,1500,1000.0,23.152765029544195,467.1278212
-L-JM,3500,1500,1000.0,10.430573100461325,464.2503922
-CM,4000,1500,1000.0,22.15854674774742,562.7823053
-L-JM,4000,1500,1000.0,10.117842321543852,564.9598646000001
-CM,4500,1500,1000.0,21.180935112846054,655.8574701
-L-JM,4500,1500,1000.0,9.677330400431318,652.4534939
-CM,5000,1500,1000.0,20.30113013118839,755.6121498
-L-JM,5000,1500,1000.0,9.143465812164308,759.3658756
-CM,5500,1500,1000.0,19.749349939851125,867.1811531999999
-L-JM,5500,1500,1000.0,8.902193965087893,863.8858544000001
-CM,6000,1101,1000.0,18.989775833821966,934.9760266999999
-L-JM,6000,1101,1000.0,8.595942764490113,932.6673659
+ml_type,tr_size,te_size,kernel_s,mae,time,lj_s,lj_e,date_ran
+CM,1500,1500,1000.0,31.512240475332977,100.3640273,na,na,14/12/2019
+L-JM,1500,1500,1000.0,14.071581760048153,101.6336081,1,1,14/12/2019
+CM,2000,1500,1000.0,28.245321081132253,152.88077109999998,na,na,14/12/2019
+L-JM,2000,1500,1000.0,12.641839980374655,155.5011396,1,1,14/12/2019
+CM,2500,1500,1000.0,26.97361909951274,215.9536518,na,na,14/12/2019
+L-JM,2500,1500,1000.0,11.785532138202667,211.8681615,1,1,14/12/2019
+CM,3000,1500,1000.0,24.641045831013365,278.5150912,na,na,14/12/2019
+L-JM,3000,1500,1000.0,11.08713556535848,278.5971606,1,1,14/12/2019
+CM,3500,1500,1000.0,23.152765029544195,401.9234568,na,na,14/12/2019
+L-JM,3500,1500,1000.0,10.430573100461325,408.3161812,1,1,14/12/2019
+CM,4000,1500,1000.0,22.15854674774742,499.55023489999996,na,na,14/12/2019
+L-JM,4000,1500,1000.0,10.117842321543852,503.7487102,1,1,14/12/2019
+CM,4500,1500,1000.0,21.180935112846054,605.4631191999999,na,na,14/12/2019
+L-JM,4500,1500,1000.0,9.677330400431318,604.4122219,1,1,14/12/2019
+CM,5000,1500,1000.0,20.30113013118839,699.0641616,na,na,14/12/2019
+L-JM,5000,1500,1000.0,9.143465812164308,701.9964291,1,1,14/12/2019
+CM,5500,1500,1000.0,19.749349939851125,816.2225933,na,na,14/12/2019
+L-JM,5500,1500,1000.0,8.902193965087893,800.8945613,1,1,14/12/2019
+CM,6000,1101,1000.0,18.989775833821966,894.5558989,na,na,14/12/2019
+L-JM,6000,1101,1000.0,8.595942764490113,885.4234397,1,1,14/12/2019
+CM,6500,601,1000.0,19.424238707695146,956.2706457,na,na,14/12/2019
+L-JM,6500,601,1000.0,8.636351001125403,950.2348745,1,1,14/12/2019
diff --git a/lj_matrix.py b/lj_matrix.py
index 5cb1b5a8d..2a8e0d956 100644
--- a/lj_matrix.py
+++ b/lj_matrix.py
@@ -29,6 +29,8 @@ from numpy.linalg import eig
def lj_matrix(mol_data,
nc_data,
+ sigma=1.0,
+ epsilon=1.0,
max_len=25,
as_eig=True,
bohr_radius_units=False):
@@ -92,11 +94,11 @@ def lj_matrix(mol_data,
# Conversion factor is included in r^2.
# 1/r^2
- r_2 = 1/(conversion_rate**2*(x + y + z))
+ r_2 = sigma**2/(conversion_rate**2*(x + y + z))
r_6 = math.pow(r_2, 3)
r_12 = math.pow(r_6, 2)
- lj[i, j] = (4*(r_12 - r_6))
+ lj[i, j] = (4*epsilon*(r_12 - r_6))
else:
break
@@ -150,11 +152,11 @@ def lj_matrix(mol_data,
# Conversion factor is included in r^2.
# 1/r^2
- r_2 = 1/(conversion_rate**2*(x + y + z))
+ r_2 = sigma**2/(conversion_rate**2*(x + y + z))
r_6 = math.pow(r_2, 3)
r_12 = math.pow(r_6, 2)
- lj_row.append(4*(r_12 - r_6))
+ lj_row.append(4*epsilon*(r_12 - r_6))
lj_temp.append(np.array(lj_row))
@@ -169,6 +171,8 @@ def lj_matrix(mol_data,
def lj_matrix_multiple(mol_data,
nc_data,
pipe=None,
+ sigma=1,
+ epsilon=1,
max_len=25,
as_eig=True,
bohr_radius_units=False):
@@ -185,7 +189,13 @@ def lj_matrix_multiple(mol_data,
printc('L-J Matrices calculation started.', 'CYAN')
tic = time.perf_counter()
- ljm_data = np.array([lj_matrix(mol, nc, max_len, as_eig, bohr_radius_units)
+ ljm_data = np.array([lj_matrix(mol,
+ nc,
+ sigma,
+ epsilon,
+ max_len,
+ as_eig,
+ bohr_radius_units)
for mol, nc in zip(mol_data, nc_data)])
toc = time.perf_counter()
diff --git a/main.py b/main.py
index 9144099d5..88f0a26f5 100644
--- a/main.py
+++ b/main.py
@@ -43,37 +43,37 @@ def main():
procs = []
pipes = []
- cm_recv, cm_send = Pipe(False)
- p1 = Process(target=c_matrix_multiple,
- args=(molecules, nuclear_charge, cm_send))
- procs.append(p1)
- pipes.append(cm_recv)
- p1.start()
+ # cm_recv, cm_send = Pipe(False)
+ # p1 = Process(target=c_matrix_multiple,
+ # args=(molecules, nuclear_charge, cm_send))
+ # procs.append(p1)
+ # pipes.append(cm_recv)
+ # p1.start()
ljm_recv, ljm_send = Pipe(False)
p2 = Process(target=lj_matrix_multiple,
- args=(molecules, nuclear_charge, ljm_send))
+ args=(molecules, nuclear_charge, ljm_send, 1.5))
procs.append(p2)
pipes.append(ljm_recv)
p2.start()
- cm_data = pipes[0].recv()
- ljm_data = pipes[1].recv()
+ # cm_data = pipes[0].recv()
+ ljm_data = pipes[0].recv()
for proc in procs:
proc.join()
# ML calculation.
procs = []
- cm_pipes = []
+ # cm_pipes = []
ljm_pipes = []
- for i in range(2500, 6000 + 1, 500):
- cm_recv, cm_send = Pipe(False)
- p1 = Process(target=do_ml,
- args=(cm_data, energy_pbe0, i, 'CM', cm_send))
- procs.append(p1)
- cm_pipes.append(cm_recv)
- p1.start()
+ for i in range(1500, 6500 + 1, 500):
+ # cm_recv, cm_send = Pipe(False)
+ # p1 = Process(target=do_ml,
+ # args=(cm_data, energy_pbe0, i, 'CM', cm_send))
+ # procs.append(p1)
+ # cm_pipes.append(cm_recv)
+ # p1.start()
ljm_recv, ljm_send = Pipe(False)
p2 = Process(target=do_ml,
@@ -82,21 +82,25 @@ def main():
ljm_pipes.append(ljm_recv)
p2.start()
- cm_bench_results = []
+ # cm_bench_results = []
ljm_bench_results = []
- for cd_pipe, ljd_pipe in zip(cm_pipes, ljm_pipes):
- cm_bench_results.append(cd_pipe.recv())
+ for ljd_pipe in ljm_pipes: # cd_pipe, ljd_pipe in zip(cm_pipes, ljm_pipes):
+ # cm_bench_results.append(cd_pipe.recv())
ljm_bench_results.append(ljd_pipe.recv())
for proc in procs:
proc.join()
- with open('benchmarks.csv', 'w') as save_file:
- save_file.write('ml_type,tr_size,te_size,sigma,mae,time\n')
- for cm, ljm, in zip(cm_bench_results, ljm_bench_results):
- cm_text = ','.join([str(field) for field in cm]) + '\n'
- ljm_text = ','.join([str(field) for field in ljm]) + '\n'
- save_file.write(cm_text)
+ with open('benchmarks.csv', 'a') as save_file:
+ # save_file.write(''.join(['ml_type,tr_size,te_size,kernel_s,',
+ # 'mae,time,lj_s,lj_e,date_ran\n']))
+ date = '/'.join([str(field) for field in time.localtime()[:3][::-1]])
+ for ljm in ljm_bench_results: # cm, ljm, in zip(cm_bench_results, ljm_bench_results):
+ # cm_text = ','.join([str(field) for field in cm])\
+ # + ',' + date + '\n'
+ ljm_text = ','.join([str(field) for field in ljm])\
+ + ',1.5,1,' + date + '\n'
+ # save_file.write(cm_text)
save_file.write(ljm_text)
# End of program