Skip to content

Commit

Permalink
Fix a bug that made VMMC simulate the wrong model when used with the …
Browse files Browse the repository at this point in the history
…DNA2 interaction

This commit also adds a new test to try to better catch future errors
  • Loading branch information
lorenzo-rovigatti committed Nov 16, 2024
1 parent 2ea602d commit 6096fdb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/Backends/VMMC_CPUBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,17 +420,16 @@ inline number VMMC_CPUBackend::_particle_particle_nonbonded_interaction_VMMC(Bas
energy += _interaction->pair_interaction_term(DNAInteraction::NONBONDED_EXCLUDED_VOLUME, p, q, false, false);
energy += _interaction->pair_interaction_term(DNAInteraction::CROSS_STACKING, p, q, false, false);

// all interactions except DNA2Interaction use the DNAInteraction coaxial stacking*
// *the hybrid interaction is a second exception
if( (dynamic_cast<DNA2Interaction *>(_interaction.get()) == NULL) || (dynamic_cast<DRHInteraction *>(_interaction.get()) == NULL) ) {
// the DNA and RNA/RNA2 interactions use the original coaxial stacking term
if(dynamic_cast<DNA2Interaction *>(_interaction.get()) == NULL) {
energy += _interaction->pair_interaction_term(DNAInteraction::COAXIAL_STACKING, p, q, false, false);
}

// the DNA2 and DRH interactions use DNA2's coaxial stacking term
if(dynamic_cast<DRHInteraction *>(_interaction.get()) != NULL) {
energy += _interaction->pair_interaction_term(DRHInteraction::COAXIAL_STACKING, p, q, false, false);
energy += _interaction->pair_interaction_term(DRHInteraction::DEBYE_HUCKEL, p, q, false, false);
}

else if(dynamic_cast<DNA2Interaction *>(_interaction.get()) != NULL) {
energy += _interaction->pair_interaction_term(DNA2Interaction::COAXIAL_STACKING, p, q, false, false);
energy += _interaction->pair_interaction_term(DNA2Interaction::DEBYE_HUCKEL, p, q, false, false);
Expand Down
2 changes: 1 addition & 1 deletion test/DNA/DSDNA8/VMMC/quick_compare
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ColumnAverage::energy.dat::2::-1.37970256144::0.15
ColumnAverage::energy.dat::2::-1.37970256144::0.01
1 change: 1 addition & 0 deletions test/DNA/DSDNA8/VMMC_DNA2/quick_compare
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ColumnAverage::energy.dat::2::-1.379235::0.02
38 changes: 38 additions & 0 deletions test/DNA/DSDNA8/VMMC_DNA2/quick_input
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#### PROGRAM PARAMETERS ####
backend = CPU
#debug = 1
#seed = 4982

#### SIM PARAMETERS ####
sim_type = VMMC
ensemble = NVT

interaction_type = DNA2
salt_concentration = 0.5

delta_translation = 0.22
delta_rotation = 0.22

steps = 5e5
newtonian_steps = 103
diff_coeff = 2.50
#pt = 0.1
thermostat = john

T = 20C
dt = 0.005
verlet_skin = 0.5

#### INPUT / OUTPUT ####
topology = ../dsdna8.top
conf_file = ../init.dat
trajectory_file = trajectory.dat
refresh_vel = 1
log_file = log.dat
no_stdout_energy = 1
restart_step_counter = 1
energy_file = energy.dat
print_conf_interval = 1e5
print_energy_every = 1e3
time_scale = linear
external_forces = 0
2 changes: 1 addition & 1 deletion test/DNA/SSDNA15/VMMC/quick_compare
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ColumnAverage::energy.dat::2::-0.700783241758::0.26
ColumnAverage::energy.dat::2::-0.700783241758::0.15

0 comments on commit 6096fdb

Please sign in to comment.