From 6096fdbbcbb8e30d2b2dd457667de71db791ca54 Mon Sep 17 00:00:00 2001 From: lorenzo-rovigatti Date: Sat, 16 Nov 2024 11:10:11 +0100 Subject: [PATCH] Fix a bug that made VMMC simulate the wrong model when used with the DNA2 interaction This commit also adds a new test to try to better catch future errors --- src/Backends/VMMC_CPUBackend.cpp | 7 ++--- test/DNA/DSDNA8/VMMC/quick_compare | 2 +- test/DNA/DSDNA8/VMMC_DNA2/quick_compare | 1 + test/DNA/DSDNA8/VMMC_DNA2/quick_input | 38 +++++++++++++++++++++++++ test/DNA/SSDNA15/VMMC/quick_compare | 2 +- 5 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 test/DNA/DSDNA8/VMMC_DNA2/quick_compare create mode 100644 test/DNA/DSDNA8/VMMC_DNA2/quick_input diff --git a/src/Backends/VMMC_CPUBackend.cpp b/src/Backends/VMMC_CPUBackend.cpp index 07766d100..67b6b858a 100644 --- a/src/Backends/VMMC_CPUBackend.cpp +++ b/src/Backends/VMMC_CPUBackend.cpp @@ -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(_interaction.get()) == NULL) || (dynamic_cast(_interaction.get()) == NULL) ) { + // the DNA and RNA/RNA2 interactions use the original coaxial stacking term + if(dynamic_cast(_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(_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(_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); diff --git a/test/DNA/DSDNA8/VMMC/quick_compare b/test/DNA/DSDNA8/VMMC/quick_compare index 74a088ec4..f34c38c12 100644 --- a/test/DNA/DSDNA8/VMMC/quick_compare +++ b/test/DNA/DSDNA8/VMMC/quick_compare @@ -1 +1 @@ -ColumnAverage::energy.dat::2::-1.37970256144::0.15 +ColumnAverage::energy.dat::2::-1.37970256144::0.01 diff --git a/test/DNA/DSDNA8/VMMC_DNA2/quick_compare b/test/DNA/DSDNA8/VMMC_DNA2/quick_compare new file mode 100644 index 000000000..7f912b2d8 --- /dev/null +++ b/test/DNA/DSDNA8/VMMC_DNA2/quick_compare @@ -0,0 +1 @@ +ColumnAverage::energy.dat::2::-1.379235::0.02 diff --git a/test/DNA/DSDNA8/VMMC_DNA2/quick_input b/test/DNA/DSDNA8/VMMC_DNA2/quick_input new file mode 100644 index 000000000..5b8f47cbe --- /dev/null +++ b/test/DNA/DSDNA8/VMMC_DNA2/quick_input @@ -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 diff --git a/test/DNA/SSDNA15/VMMC/quick_compare b/test/DNA/SSDNA15/VMMC/quick_compare index 57987ea7e..b9f9cdfe8 100644 --- a/test/DNA/SSDNA15/VMMC/quick_compare +++ b/test/DNA/SSDNA15/VMMC/quick_compare @@ -1 +1 @@ -ColumnAverage::energy.dat::2::-0.700783241758::0.26 +ColumnAverage::energy.dat::2::-0.700783241758::0.15