fix bond/swap

Hi Steve,

I am trying to extend the ‘fix bond/swap’ command to the polymers with dihedral terms and no special bonds (special_bond 0 0 0). Here I attached my revised version on the ‘fix bond/swap’ (I call it ‘fix bond/swapall’ instead). It works well if I only use 1 CPU. However, when I run the simulation with 8 CPUs (1 node), there are always errors like below:

PBS: End PBS Prologue Tue Aug 30 18:17:42 CDT 2011 1314746262
[qnode0624:18099] *** Process received signal ***
[qnode0624:18099] Signal: Segmentation fault (11)
[qnode0624:18099] Signal code: Address not mapped (1)
[qnode0624:18099] Failing at address: 0x15f5e2d0
[qnode0624:18099] [ 0] /lib64/libpthread.so.0 [0x2ac2e0a2c4c0]
[qnode0624:18099] [ 1] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZN9LAMMPS_NS13DihedralTable6singleEiiiii+0x2c6) [0x4e1d66]
[qnode0624:18099] [ 2] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZN9LAMMPS_NS14FixBondSwapall12dihedral_engEiiiii+0x29) [0x535ef9]
[qnode0624:18099] [ 3] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZN9LAMMPS_NS14FixBondSwapall12pre_neighborEv+0x2724) [0x533e14]
[qnode0624:18099] [ 4] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZN9LAMMPS_NS6Modify12pre_neighborEv+0x3f) [0x5f30af]
[qnode0624:18099] [ 5] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZN9LAMMPS_NS6Verlet3runEi+0x1f3) [0x712323]
[qnode0624:18099] [ 6] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZN9LAMMPS_NS3Run7commandEiPPc+0xb93) [0x6e8ed3]
[qnode0624:18099] [ 7] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZN9LAMMPS_NS5Input15execute_commandEv+0x27a3) [0x5cccd3]
[qnode0624:18099] [ 8] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZN9LAMMPS_NS5Input4fileEv+0x2e8) [0x5c9e38]
[qnode0624:18099] [ 9] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(main+0xad) [0x5dbfbd]
[qnode0624:18099] [10] /lib64/libc.so.6(__libc_start_main+0xf4) [0x2ac2e0c56974]
[qnode0624:18099] [11] /hpc/home/yli791/lammps-5Apr11revised/src/lmp_quest(_ZNSt8ios_base4InitD1Ev+0x41) [0x45f5f9]
[qnode0624:18099] *** End of error message ***

fix_bond_swapall.cpp (42 KB)

fix_bond_swapall.h (1.53 KB)

I have no idea why this error occurs. Can you give me some suggestions? My

segmentation faults happen, for example when you try to write
to memory locations that are not allocated.

LAMMPS version is 5Apr 2011. By the way, I have also include the 'single()'
function for energy calculation of dihedral term, which is not included in
the original LAMMPS package.

i am not certain what you are asking for. you cannot expect _anybody_
to do _your_ job and write/debug your code for you. writing parallel code
and correct code as well as debugging code takes practice, experience
and time. so at the very least, you have to offer some incentive for somebody
to help you. basically nobody will be able to solve your problems by staring
at your code for a few minutes (and those that are would charge you a
_lot_ of money for their time).

it looks to me that you are trying to do the equivalent of competing
in a formula one race without even having a driver's license. you will
first have to teach yourself and practice debugging segfaults, e.g.
by creating core dumps and doing post mortem analysis with a
debugger, and then sort out how to do debugging in parallel (no need
to spring for a costly totalview license, there are some cool hacks that
allow you to use gdb in parallel on a multi-core/multiprocessor machine.
i've used them, and they work great for lammps debugging).

unless you run into a problem that is a real issue in the LAMMPS
distribution, you are effectively on your own.

axel.