Skip to content

Commit 8c464e0

Browse files
committed
added benchmark
1 parent ad9948d commit 8c464e0

File tree

5 files changed

+76
-14
lines changed

5 files changed

+76
-14
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Configuration A
2+
3+
Particle in the NVT ensemble.
4+
5+
nmb_1= 50 # Define atom number
6+
sig_1 = 3 * ureg.angstrom # Define LJ parameters (sigma)
7+
eps_1 = 0.1 * ureg.kcal/ureg.mol # Define LJ parameters (epsilon)
8+
mss_1 = 10 * ureg.gram/ureg.mol # Define atom mass
9+
L = 20 * ureg.angstrom # Define box size
10+
rc = 2.5 * sig_1 # Define cut_off
11+
T = 300 * ureg.kelvin # Pick the desired temperature
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
variable dump equal 5000
2+
variable thermo equal 5000
3+
variable steps equal 100000
4+
5+
variable nmb_1 equal 50 # Define atom number
6+
variable sig_1 equal 3 # Define LJ parameters (sigma)
7+
variable eps_1 equal 0.1 # Define LJ parameters (epsilon)
8+
variable mss_1 equal 10 # Define atom mass
9+
variable L equal 20 # Define box size
10+
variable rc equal 2.5*${sig_1} # Define cut_off (angstrom)
11+
variable T equal 300 # Pick the desired temperature (kelvin)
12+
13+
units real
14+
dimension 3
15+
atom_style atomic
16+
pair_style lj/cut ${rc}
17+
boundary p p p
18+
19+
#read_data twoparticle.data
20+
21+
variable L2 equal ${L}/2
22+
region myreg block -${L2} ${L2} -${L2} ${L2} -${L2} ${L2}
23+
create_box 1 myreg
24+
create_atoms 1 random ${nmb_1} 32141 myreg
25+
26+
mass 1 ${mss_1}
27+
pair_coeff 1 1 ${eps_1} ${sig_1}
28+
29+
velocity all create ${T} 4928459
30+
fix mynve all nve
31+
fix myber all temp/berendsen 300 300 100
32+
timestep 0.25
33+
34+
thermo ${thermo}
35+
dump mydmp all custom ${dump} dump.lammpstrj id type x y z vx vy vz
36+
37+
run ${steps} # equilibration
38+
39+
variable Epot equal pe
40+
variable Ekin equal ke
41+
variable Etot equal v_Epot+v_Ekin
42+
variable pressure equal press
43+
variable temperature equal temp
44+
fix myat1 all ave/time ${dump} 1 ${dump} v_Epot file Epot.dat
45+
fix myat2 all ave/time ${dump} 1 ${dump} v_Ekin file Ekin.dat
46+
fix myat3 all ave/time ${dump} 1 ${dump} v_Etot file Etot.dat
47+
fix myat4 all ave/time ${dump} 1 ${dump} v_pressure file pressure.dat
48+
fix myat5 all ave/time ${dump} 1 ${dump} v_temperature file temperature.dat
49+
run ${steps}

integration_tests/test_monte_carlo_move.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,31 @@ def setUp(self):
1717

1818
ureg = UnitRegistry()
1919

20+
# Configuration A
2021
nmb_1= 50 # Define atom number
2122
sig_1 = 3 * ureg.angstrom # Define LJ parameters (sigma)
2223
eps_1 = 0.1 * ureg.kcal/ureg.mol # Define LJ parameters (epsilon)
2324
mss_1 = 10 * ureg.gram/ureg.mol # Define atom mass
2425
L = 20 * ureg.angstrom # Define box size
2526
rc = 2.5 * sig_1 # Define cut_off
2627
T = 300 * ureg.kelvin # Pick the desired temperature
27-
displace_mc = sig_1/4 # choose the displace_mc
28+
displace_mc = sig_1/2 # choose the displace_mc
2829

2930
# Initialize the MonteCarlo object
3031
self.mc = MonteCarlo(
3132
ureg = ureg,
32-
maximum_steps=100,
33-
thermo_period=10,
34-
dumping_period=10,
35-
number_atoms=[nmb_1],
36-
epsilon=[eps_1], # kcal/mol
37-
sigma=[sig_1], # A
38-
atom_mass=[mss_1], # g/mol
39-
box_dimensions=[L, L, L], # A
40-
cut_off=rc,
41-
thermo_outputs="Epot-press",
42-
desired_temperature=T, # K
43-
neighbor=20,
33+
maximum_steps = 10000,
34+
thermo_period = 1000,
35+
dumping_period = 1000,
36+
number_atoms = [nmb_1],
37+
epsilon = [eps_1],
38+
sigma = [sig_1],
39+
atom_mass = [mss_1],
40+
box_dimensions = [L, L, L],
41+
cut_off = rc,
42+
thermo_outputs = "Epot-press",
43+
desired_temperature = T,
44+
neighbor = 20,
4445
displace_mc = displace_mc,
4546
)
4647

molecular_simulation_code/forces_utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ def compute_force_matrix(neighbor_lists: List[np.ndarray], atoms_positions: np.n
6161

6262
# Update force matrix
6363
force_matrix[atom_i, atom_j] += fij_xyz * rij_xyz / rij
64-
force_matrix[atom_j, atom_i] += fij_xyz * rij_xyz / rij
64+
force_matrix[atom_j, atom_i] -= fij_xyz * rij_xyz / rij
6565
return force_matrix
6666

molecular_simulation_code/simulation_logger.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def log_simulation_data(code):
6060
pressure = compute_pressure(code.atoms_positions, code.box_mda,
6161
code.neighbor_lists, code.cross_coefficients,
6262
code.potential_type, code.desired_temperature)
63+
6364
press = pressure * code.ref_pressure # Atm
6465
logger.info(f"{code.step} {Epot.magnitude:.2f} {press.magnitude:.2f}")
6566

0 commit comments

Comments
 (0)