File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// it under the terms of the GNU General Public License as published by
33// the Free Software Foundation, either version 3 of the License, or
44// (at your option) any later version.
5-
65// This program is distributed in the hope that it will be useful,
76// but WITHOUT ANY WARRANTY; without even the implied warranty of
87// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98// GNU General Public License for more details.
10-
119// You should have received a copy of the GNU General Public License
1210// along with this program. If not, see <http://www.gnu.org/licenses/>.
1311
@@ -40,4 +38,21 @@ inline real nextSoftening(real nodeSize,
4038 eps = eps_min;
4139
4240 return eps;
41+ }
42+
43+ inline real pairSoftening (real ma, real mb)
44+ {
45+ // Mass-based softening (cubic root gives physical size scale)
46+ real ea = std::cbrt (ma) * real (0.002 );
47+ real eb = std::cbrt (mb) * real (0.002 );
48+
49+ // Symmetric combination
50+ real eps2 = ea*ea + eb*eb;
51+
52+ // Minimum floor
53+ const real eps_min = real (1e-6 );
54+ if (eps2 < eps_min)
55+ eps2 = eps_min;
56+
57+ return eps2;
4358}
You can’t perform that action at this time.
0 commit comments