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

fixed rcut for unbonded pair #93

Merged
merged 1 commit into from
Mar 14, 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
15 changes: 10 additions & 5 deletions contrib/tostiguerra/src/CGNucleicAcidsInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ void CGNucleicAcidsInteraction::get_settings(input_file &inp) {
void CGNucleicAcidsInteraction::init() {
_sqr_rfene = SQR(_rfene);
_PS_sqr_rep_rcut = pow(2. * _WCA_sigma, 2. / _PS_n);
// _WCA_sigma_unbonded = _WCA_sigma * (6.0 / _bead_size - _3b_sigma) / 2.0; // disabled for now
_WCA_sigma_unbonded = _WCA_sigma;
_WCA_sigma_unbonded = _WCA_sigma * (6.0 / _bead_size - _3b_sigma) / 2.0; // not disabled
_PS_sqr_rep_rcut_unbonded = pow(2. * _WCA_sigma_unbonded, 2. / _PS_n);
// _WCA_sigma_unbonded = _WCA_sigma; // disabled

OX_LOG(Logger::LOG_INFO, "CGNA: WCA sigma = %lf, WCA sigma unbonded = %lf", _WCA_sigma, _WCA_sigma_unbonded);

Expand Down Expand Up @@ -215,18 +216,22 @@ number CGNucleicAcidsInteraction::_fene(BaseParticle *p, BaseParticle *q, bool u

number CGNucleicAcidsInteraction::_WCA(BaseParticle *p, BaseParticle *q, bool update_forces) {
number sqr_r = _computed_r.norm();
if(sqr_r > _PS_sqr_rep_rcut) {

number sigma = p->is_bonded(q) ? _WCA_sigma : _WCA_sigma_unbonded;
number sqr_rcut = p->is_bonded(q) ? _PS_sqr_rep_rcut : _PS_sqr_rep_rcut_unbonded;

if(sqr_r > sqr_rcut) {
return (number) 0.;
}

number energy = 0;
// this number is the module of the force over r, so we don't have to divide the distance vector for its module
number force_mod = 0;

number sigma = p->is_bonded(q) ? _WCA_sigma : _WCA_sigma_unbonded;


// cut-off for all the repulsive interactions
if(sqr_r < _PS_sqr_rep_rcut) {
if(sqr_r < sqr_rcut) {
number part = 1.;
number ir2_scaled = SQR(sigma) / sqr_r;
for(int i = 0; i < _PS_n / 2; i++) {
Expand Down
2 changes: 1 addition & 1 deletion contrib/tostiguerra/src/CGNucleicAcidsInteraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CGNucleicAcidsInteraction: public BaseInteraction {
number _rfene = 1.5;
number _sqr_rfene;
number _WCA_sigma = 1.0, _WCA_sigma_unbonded;
number _PS_sqr_rep_rcut;
number _PS_sqr_rep_rcut, _PS_sqr_rep_rcut_unbonded;
number _tC = 37.0;
number dS_mod = 1.0;
number alpha_mod = 1.0;
Expand Down
Loading