votca / xtp

GW-BSE for excited state Quantum Chemistry in a Gaussian Orbital basis, electronic spectroscopy with QM/MM, charge and energy dynamics in complex molecular systems
29 stars 15 forks source link

Segmentation fault in xtp_map when two molecules with identical "name" #730

Closed zhc079 closed 3 years ago

zhc079 commented 3 years ago

lmp_votca_test.zip xtp_map gives segmentation fault when two same molecules have different atom sequences in the Lammps data file (topology ). Take the structure C-H-H-H-H-C as an example, I want to use C-H-H as a segment. In Lammps data file, the 1st C-H-H has sequences 1,2,3 the 2nd H-H-C has sequences 4,5,6. The C and H sequences are different. Although C-H-H and H-H-C are the same chemical, if only one C1H2 is defined in system.xml, the xtp_map will give segmentation fault error.

JensWehner commented 3 years ago

Hi, thanks for your report. Can you post your mapping file? Which version of xtp are you using?

JensWehner commented 3 years ago

I do not fully understand yet, you want to turn one molecule into two segments?

baumeier commented 3 years ago

In this case, we have a physical molecule, in total 8 monomers long, to be split in two 4-mers. Doing this makes two with the same mdnames.

More generally, it would be the same issue if we have a mixture of two isomers of the same molecule.

zhc079 commented 3 years ago

This is the example mapping file. The version is: xtp_map, version 2022-dev gitid: 9c20903 (compiled May 2 2021, 18:20:57). The situation is exactly as Bjorn described.

<topology>
    <molecules>
        <molecule>
            <mdname>C24H17O8S4</mdname> <!--must be element followed by number-->
            <segments>
                <segment>
                    <name>edot</name> <!--whatever names you choose-->
                    <qmcoords_n>QC_FILES/edot_4mer_n.xyz</qmcoords_n>
                                <qmcoords_e>QC_FILES/edot_4mer_e.xyz</qmcoords_e>
                            <qmcoords_h>QC_FILES/edot_4mer_h.xyz</qmcoords_h>
                    <multipoles_n>MP_FILES/edot_4mer_n_polar.mps</multipoles_n>
                                <multipoles_e>MP_FILES/edot_4mer_e_polar.mps</multipoles_e>
                                <multipoles_h>MP_FILES/edot_4mer_h_polar.mps</multipoles_h>
                    <map2md>0</map2md>
                    <fragments>
                        <fragment> <!-- 1st edot, with H -->
                            <name>edoth_body</name>
                            <mdatoms> 193:S4:3792 192:C7:3793 193:C7:3795 193:C7:3804 193:C7:3805</mdatoms>
                            <qmatoms>0:S 1:C 3:C 12:C 13:C</qmatoms>
                            <mpoles>0:S 1:C 3:C 12:C 13:C</mpoles>
                            <weights>32 12 12 12 12</weights>
                            <localframe>0 1 3</localframe>
                        </fragment>
                        <fragment> 
                            <name>edoth_O1</name>
                            <mdatoms>193:O2:3796</mdatoms>
                            <qmatoms>4:O</qmatoms>
                            <mpoles>4:O</mpoles>
                            <weights>16</weights>
                            <localframe>4</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth_O2</name>
                            <mdatoms> 193:O2:3803</mdatoms>
                            <qmatoms> 11:O </qmatoms>
                            <mpoles> 11:O </mpoles>
                            <weights>16</weights>
                            <localframe>11</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth_tail1</name>
                            <mdatoms>193:C9:3797 193:H3:3798 193:H3:3799</mdatoms>
                            <qmatoms>5:C 6:H 7:H</qmatoms>
                            <mpoles>5:C 6:H 7:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>5 6 7</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth_tail2</name>
                            <mdatoms>193:C9:3800 193:H3:3801 193:H3:3802</mdatoms>
                            <qmatoms>8:C 9:H 10:H</qmatoms>
                            <mpoles>8:C 9:H 10:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>8 9 10</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth_h1</name>
                            <mdatoms>193:H11:3794</mdatoms>
                            <qmatoms>2:H</qmatoms>
                            <mpoles>2:H</mpoles>
                            <weights>1</weights>
                            <localframe>2</localframe>
                        </fragment>
                        <fragment>  <!-- 2nd edot -->
                            <name>edot1_body</name>
                            <mdatoms> 194:C7:3806 194:S4:3807 194:C7:3808 194:C7:3817 194:C7:3818</mdatoms>  <!-- S4: element + lammps type. 193 is the segment number -->  <!--3806,3807,is the (atom number-1) in the newfile.data-->
                            <qmatoms>14:C 15:S 16:C 25:C 26:C</qmatoms>    <!--11,12 is the number inxyzfiles--> <!-- begin with 0--> 
                            <mpoles>14:C 15:S 16:C 25:C 26:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>14 15 16</localframe>  <!-- the atom that constitude a plane-->
                        </fragment>
                        <fragment>
                            <name>edot1_O1</name>
                            <mdatoms> 194:O2:3809</mdatoms>
                            <qmatoms>17:O </qmatoms>
                            <mpoles>17:O </mpoles>
                            <weights>16</weights>
                            <localframe>17</localframe>
                        </fragment>
                        <fragment>
                            <name>edot1_O2</name>
                            <mdatoms> 194:O2:3816</mdatoms>
                            <qmatoms>24:O </qmatoms>
                            <mpoles>24:O </mpoles>
                            <weights>16</weights>
                            <localframe>24</localframe>
                        </fragment>
                        <fragment>
                            <name>edot1_tail1</name>
                            <mdatoms> 194:C9:3810 194:H3:3811 194:H3:3812</mdatoms>
                            <qmatoms>18:C 19:H 20:H</qmatoms>
                            <mpoles>18:C 19:H 20:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>18 19 20</localframe>
                        </fragment>
                        <fragment>
                            <name>edot1_tail2</name>
                            <mdatoms> 194:C9:3813 194:H3:3814 194:H3:3815</mdatoms>
                            <qmatoms>21:C 22:H 23:H</qmatoms>
                            <mpoles>21:C 22:H 23:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>21 22 23</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_body</name>
                            <mdatoms> 195:C7:3819 195:S4:3820 195:C7:3821 195:C7:3830 195:C7:3831</mdatoms>
                            <qmatoms>27:C 28:S 29:C 38:C 39:C</qmatoms>
                            <mpoles>27:C 28:S 29:C 38:C 39:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>27 28 29</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_O1</name>
                            <mdatoms> 195:O2:3822</mdatoms>
                            <qmatoms>30:O </qmatoms>
                            <mpoles>30:O </mpoles>
                            <weights>16</weights>
                            <localframe>30</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_O2</name>
                            <mdatoms> 195:O2:3829</mdatoms>
                            <qmatoms>37:O </qmatoms>
                            <mpoles>37:O </mpoles>
                            <weights>16</weights>
                            <localframe>37</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_tail1</name>
                            <mdatoms> 195:C9:3823 195:H3:3824 195:H3:3825</mdatoms>
                            <qmatoms>31:C 32:H 33:H</qmatoms>
                            <mpoles>31:C 32:H 33:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>31 32 33</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_tail2</name>
                            <mdatoms> 195:C9:3826 195:H3:3827 195:H3:3828</mdatoms>
                            <qmatoms>34:C 35:H 36:H</qmatoms>
                            <mpoles>34:C 35:H 36:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>34 35 36</localframe>
                        </fragment>
                        <fragment> <!-- 4th edot -->
                            <name>edot3_body</name>
                            <mdatoms> 196:C7:3832 196:S4:3833 196:C7:3834 196:C7:3843 196:C7:3844</mdatoms> 
                            <qmatoms>40:C 41:S 42:C 51:C 52:C</qmatoms>
                            <mpoles>40:C 41:S 42:C 51:C 52:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>40 41 42</localframe> 
                        </fragment>
                        <fragment>
                            <name>edot3_O1</name>
                            <mdatoms> 196:O2:3835</mdatoms>
                            <qmatoms>43:O </qmatoms>
                            <mpoles>43:O </mpoles>
                            <weights>16</weights>
                            <localframe>43</localframe>
                        </fragment>
                        <fragment>
                            <name>edot3_O2</name>
                            <mdatoms> 196:O2:3842</mdatoms>
                            <qmatoms>50:O </qmatoms>
                            <mpoles>50:O </mpoles>
                            <weights>16</weights>
                            <localframe>50</localframe>
                        </fragment>
                        <fragment>
                            <name>edot3_tail1</name>
                            <mdatoms> 196:C9:3836 196:H3:3837 196:H3:3838</mdatoms>
                            <qmatoms>44:C 45:H 46:H</qmatoms>
                            <mpoles>44:C 45:H 46:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>44 45 46</localframe>
                        </fragment>
                        <fragment>
                            <name>edot3_tail2</name>
                            <mdatoms> 196:C9:3839 196:H3:3840 196:H3:3841</mdatoms>
                            <qmatoms>47:C 48:H 49:H</qmatoms>
                            <mpoles>47:C 48:H 49:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>47 48 49</localframe>
                        </fragment>
                    </fragments>
                </segment>
            </segments>
        </molecule>
        <molecule>
            <mdname>C8H7O3S1</mdname>
                <segments>
                <segment>
                    <name>ss_noh</name>
                    <qmcoords_n>QC_FILES/ss_noh_n.xyz</qmcoords_n>
                    <qmcoords_e>QC_FILES/ss_noh_e.xyz</qmcoords_e>
                    <qmcoords_h>QC_FILES/ss_noh_h.xyz</qmcoords_h>
                    <multipoles_n>MP_FILES/ss_noh_n_polar.mps</multipoles_n>
                    <multipoles_e>MP_FILES/ss_noh_e_polar.mps</multipoles_e>
                    <multipoles_h>MP_FILES/ss_noh_h_polar.mps</multipoles_h>
                    <map2md>0</map2md>
                    <fragments>
                        <fragment>
                            <name>ss_head1</name>
                            <mdatoms> 4:C9:60 4:H10:61 4:H10:62</mdatoms>
                            <qmatoms>0:C 1:H 2:H</qmatoms>
                            <mpoles>0:C 1:H 2:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>0 1 2</localframe>
                        </fragment>
                        <fragment>
                            <name>ss_head2</name>
                            <mdatoms>4:C9:63 4:H10:64 </mdatoms>
                            <qmatoms>3:C 4:H</qmatoms>
                            <mpoles>3:C 4:H</mpoles>
                            <weights>12 1</weights>
                            <localframe>3 4</localframe>
                        </fragment>
                        <fragment>
                            <name>ss_middle</name>
                            <mdatoms> 4:C7:65 4:C7:66 4:C7:67 4:H8:68 4:C7:69 4:C7:70 4:H8:71 4:C7:72 4:H8:73 4:H8:78 </mdatoms>
                            <qmatoms>5:C 6:C 7:C 8:H 9:C 10:C 11:H 12:C 13:H 18:H</qmatoms>
                            <mpoles>5:C 6:C 7:C 8:H 9:C 10:C 11:H 12:C 13:H 18:H</mpoles>
                            <weights>12 12 12 1 12 12 1 12 1 1</weights>
                            <localframe>5 6 7</localframe>
                        </fragment>
                        <fragment>
                            <name>ss_tail</name>
                            <mdatoms>4:S4:74 4:O1:75 4:O1:76</mdatoms>
                            <qmatoms>14:S 15:O 16:O</qmatoms>
                            <mpoles>14:S 15:O 16:O</mpoles>
                            <weights>32 16 16</weights>
                            <localframe>15 14 16</localframe>
                        </fragment>
                        <fragment>
                            <name>oh</name>
                            <mdatoms>4:O1:77 </mdatoms>
                            <qmatoms>17:O</qmatoms>
                            <mpoles>17:O</mpoles>
                            <weights>16</weights>
                            <localframe>17</localframe>
                        </fragment>
                    </fragments>
                </segment>
            </segments>
        </molecule>
        <molecule>
            <mdname>C8H8O3S1</mdname>
            <segments>
                <segment>
                    <name>ss</name>
                    <qmcoords_n>QC_FILES/ss_n.xyz</qmcoords_n>
                    <qmcoords_e>QC_FILES/ss_e.xyz</qmcoords_e>
                    <qmcoords_h>QC_FILES/ss_h.xyz</qmcoords_h>
                    <multipoles_n>MP_FILES/ss_n_polar.mps</multipoles_n>
                    <multipoles_e>MP_FILES/ss_e_polar.mps</multipoles_e>
                    <multipoles_h>MP_FILES/ss_h_polar.mps</multipoles_h>
                    <map2md>0</map2md>
                    <fragments>
                        <fragment>
                            <name>ssh_head1</name>
                            <mdatoms>1:C9:0 1:H10:1 1:H10:2</mdatoms>
                            <qmatoms>0:C 1:H 2:H</qmatoms> <!--number (starts from 0) + element-->
                            <mpoles>0:C 1:H 2:H</mpoles> 
                            <weights>12 1 1</weights>
                            <localframe>0 1 2</localframe>
                        </fragment>
                        <fragment>
                            <name>ssh_head2</name>
                            <mdatoms>1:C9:3 1:H10:4</mdatoms>
                            <qmatoms>3:C 4:H</qmatoms>
                            <mpoles>3:C 4:H</mpoles>
                            <weights>12 1</weights>
                            <localframe>3 4</localframe>
                        </fragment>
                        <fragment>
                            <name>ssh_middle</name>
                            <mdatoms>1:C7:5 1:C7:6 1:C7:7 1:H8:8 1:C7:9 1:C7:10 1:H8:11 1:C7:12 1:H8:13 1:H8:19</mdatoms>
                            <qmatoms>5:C 6:C 7:C 8:H 9:C 10:C 11:H 12:C 13:H 19:H</qmatoms>
                            <mpoles>5:C 6:C 7:C 8:H 9:C 10:C 11:H 12:C 13:H 19:H</mpoles>
                            <weights>12 12 12 1 12 12 1 12 1 1</weights>
                            <localframe>5 6 7</localframe>
                        </fragment>
                        <fragment>
                            <name>ssh_tail</name>
                            <mdatoms>1:S4:14 1:O1:15 1:O1:18</mdatoms>
                            <qmatoms>14:S 15:O 18:O</qmatoms>
                            <mpoles>14:S 15:O 18:O</mpoles>
                            <weights>32 16 16</weights>
                            <localframe>14 15 18</localframe>
                        </fragment>
                        <fragment>
                            <name>oh</name>
                            <mdatoms>1:O5:16 1:H6:17</mdatoms>
                            <qmatoms>16:O 17:H</qmatoms>
                            <mpoles>16:O 17:H</mpoles>
                            <weights>16 1</weights>
                            <localframe>16 17</localframe>
                        </fragment>
                    </fragments>
                </segment>
            </segments>
        </molecule>
        <molecule>
            <mdname>Cl1</mdname>
            <segments>
                <segment>
                    <name>Cl</name>
                    <qmcoords_n>QC_FILES/Cl_n.xyz</qmcoords_n>
                    <qmcoords_e>QC_FILES/Cl_e.xyz</qmcoords_e>
                    <qmcoords_h>QC_FILES/Cl_h.xyz</qmcoords_h>
                    <multipoles_n>MP_FILES/Cl_n_polar.mps</multipoles_n>
                    <multipoles_e>MP_FILES/Cl_e_polar.mps</multipoles_e>
                    <multipoles_h>MP_FILES/Cl_h_polar.mps</multipoles_h>
                    <map2md>0</map2md>
                    <fragments>
                        <fragment>
                            <name>Cl</name>
                            <mdatoms> 30439:Cl15:96389</mdatoms>
                            <qmatoms>0:Cl</qmatoms>
                            <mpoles>0:Cl</mpoles>
                            <weights>35.45</weights>
                            <localframe>0</localframe>
                        </fragment>
                    </fragments>
                </segment>
            </segments>
        </molecule>
        <molecule>
            <mdname>H2O1</mdname>
            <segments>
                <segment>
                    <name>water</name>
                    <qmcoords_n>QC_FILES/water_n.xyz</qmcoords_n>
                    <qmcoords_e>QC_FILES/water_e.xyz</qmcoords_e>
                    <qmcoords_h>QC_FILES/water_h.xyz</qmcoords_h>
                    <multipoles_n>MP_FILES/water_n_polar.mps</multipoles_n>
                    <multipoles_e>MP_FILES/water_e_polar.mps</multipoles_e>
                    <multipoles_h>MP_FILES/water_h_polar.mps</multipoles_h>
                    <map2md>0</map2md>
                    <fragments>
                        <fragment>
                            <name>water</name>
                            <mdatoms> 33:H12:528 33:H12:529 33:O13:530</mdatoms>
                            <qmatoms>0:H 1:H 2:O</qmatoms>
                            <mpoles>0:H 1:H 2:O</mpoles>
                            <weights>1 1 16</weights>
                            <localframe>0 1 2</localframe>
                        </fragment>
                    </fragments>
                </segment>
            </segments>
        </molecule>
        <molecule>
            <mdname>Na1</mdname>
            <segments>
                <segment>
                    <name>Na</name>
                    <qmcoords_n>QC_FILES/Na_n.xyz</qmcoords_n>
                    <qmcoords_e>QC_FILES/Na_e.xyz</qmcoords_e>
                    <qmcoords_h>QC_FILES/Na_h.xyz</qmcoords_h>
                    <multipoles_n>MP_FILES/Na_n_polar.mps</multipoles_n>
                    <multipoles_e>MP_FILES/Na_e_polar.mps</multipoles_e>
                    <multipoles_h>MP_FILES/Na_h_polar.mps</multipoles_h>
                    <map2md>0</map2md>
                    <fragments>
                        <fragment>
                            <name>Na</name>
                            <mdatoms> 8034:Na14:24528</mdatoms>
                            <qmatoms>0:Na</qmatoms>
                            <mpoles>0:Na</mpoles>
                            <weights>23</weights>
                            <localframe>0</localframe>
                        </fragment>
                    </fragments>
                </segment>
            </segments>
        </molecule>
    </molecules>
</topology>
JensWehner commented 3 years ago

So you are saying the mdname generated by the LAMMPS reader is not unique enough, if two structurally different segments have the same chemical composition?

JensWehner commented 3 years ago

So removing all the unimportant things we have :

<topology>
    <molecules>
        <molecule>
            <mdname>C24H17O8S4</mdname> <!--must be element followed by number-->
        </molecule>
        <molecule>
            <mdname>C8H7O3S1</mdname>
        </molecule>
        <molecule>
            <mdname>C8H8O3S1</mdname>
        </molecule>
        <molecule>
            <mdname>Cl1</mdname>
        </molecule>
        <molecule>
            <mdname>H2O1</mdname>
        </molecule>
        <molecule>
            <mdname>Na1</mdname>
        </molecule>
    </molecules>
</topology>

All molecule names are different. If you want to split a LAMMPS molecule you have to do it on the segment level. The isomer problem with two different molecules having the same composition but different structures I understand. I am not entirely sure how we can change it. I still do not understand, our error handling is not good in this case certainly. Can you post a small example so I can reproduce the problem.

zhc079 commented 3 years ago

I extract from a system_4mer.xml file the two same molecules C24H17O8S4, but with different atom sequences in the Lammps topology file. Initially, we want to define only one molecule with mdname C24H17O8S4. But xtp_map give segmentation fault error. Then I defined two molecules all have the same mdname C24H17O8S4, and xtp_map gives error: "an error occurred: Multiple molecules have same mdname".

I can send you MD files and trajectory files for testing.


    <molecules>
        <molecule>
            <mdname>C24H17O8S4</mdname> <!--must be element followed by number-->
            <segments>
                <segment>
                    <name>edot1</name> <!--whatever names you choose-->
                    <qmcoords_n>QC_FILES/edot_4mer_n.xyz</qmcoords_n>
                                <qmcoords_e>QC_FILES/edot_4mer_e.xyz</qmcoords_e>
                            <qmcoords_h>QC_FILES/edot_4mer_h.xyz</qmcoords_h>
                    <multipoles_n>MP_FILES/edot_4mer_n_polar.mps</multipoles_n>
                                <multipoles_e>MP_FILES/edot_4mer_e_polar.mps</multipoles_e>
                                <multipoles_h>MP_FILES/edot_4mer_h_polar.mps</multipoles_h>
                    <map2md>0</map2md>
                    <fragments>
                        <fragment> <!-- 1st edot, with H -->
                            <name>edoth_body</name>
                            <mdatoms> 193:S4:3792 192:C7:3793 193:C7:3795 193:C7:3804 193:C7:3805</mdatoms>
                            <qmatoms>0:S 1:C 3:C 12:C 13:C</qmatoms>
                            <mpoles>0:S 1:C 3:C 12:C 13:C</mpoles>
                            <weights>32 12 12 12 12</weights>
                            <localframe>0 1 3</localframe>
                        </fragment>
                        <fragment> 
                            <name>edoth_O1</name>
                            <mdatoms>193:O2:3796</mdatoms>
                            <qmatoms>4:O</qmatoms>
                            <mpoles>4:O</mpoles>
                            <weights>16</weights>
                            <localframe>4</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth_O2</name>
                            <mdatoms> 193:O2:3803</mdatoms>
                            <qmatoms> 11:O </qmatoms>
                            <mpoles> 11:O </mpoles>
                            <weights>16</weights>
                            <localframe>11</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth_tail1</name>
                            <mdatoms>193:C9:3797 193:H3:3798 193:H3:3799</mdatoms>
                            <qmatoms>5:C 6:H 7:H</qmatoms>
                            <mpoles>5:C 6:H 7:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>5 6 7</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth_tail2</name>
                            <mdatoms>193:C9:3800 193:H3:3801 193:H3:3802</mdatoms>
                            <qmatoms>8:C 9:H 10:H</qmatoms>
                            <mpoles>8:C 9:H 10:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>8 9 10</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth_h1</name>
                            <mdatoms>193:H11:3794</mdatoms>
                            <qmatoms>2:H</qmatoms>
                            <mpoles>2:H</mpoles>
                            <weights>1</weights>
                            <localframe>2</localframe>
                        </fragment>
                        <fragment>  <!-- 2nd edot -->
                            <name>edot1_body</name>
                            <mdatoms> 194:C7:3806 194:S4:3807 194:C7:3808 194:C7:3817 194:C7:3818</mdatoms>  <!-- S4: element + lammps type. 193 is the segment number -->  <!--3806,3807,is the (atom number-1) in the newfile.data-->
                            <qmatoms>14:C 15:S 16:C 25:C 26:C</qmatoms>    <!--11,12 is the number inxyzfiles--> <!-- begin with 0--> 
                            <mpoles>14:C 15:S 16:C 25:C 26:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>14 15 16</localframe>  <!-- the atom that constitude a plane-->
                        </fragment>
                        <fragment>
                            <name>edot1_O1</name>
                            <mdatoms> 194:O2:3809</mdatoms>
                            <qmatoms>17:O </qmatoms>
                            <mpoles>17:O </mpoles>
                            <weights>16</weights>
                            <localframe>17</localframe>
                        </fragment>
                        <fragment>
                            <name>edot1_O2</name>
                            <mdatoms> 194:O2:3816</mdatoms>
                            <qmatoms>24:O </qmatoms>
                            <mpoles>24:O </mpoles>
                            <weights>16</weights>
                            <localframe>24</localframe>
                        </fragment>
                        <fragment>
                            <name>edot1_tail1</name>
                            <mdatoms> 194:C9:3810 194:H3:3811 194:H3:3812</mdatoms>
                            <qmatoms>18:C 19:H 20:H</qmatoms>
                            <mpoles>18:C 19:H 20:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>18 19 20</localframe>
                        </fragment>
                        <fragment>
                            <name>edot1_tail2</name>
                            <mdatoms> 194:C9:3813 194:H3:3814 194:H3:3815</mdatoms>
                            <qmatoms>21:C 22:H 23:H</qmatoms>
                            <mpoles>21:C 22:H 23:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>21 22 23</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_body</name>
                            <mdatoms> 195:C7:3819 195:S4:3820 195:C7:3821 195:C7:3830 195:C7:3831</mdatoms>
                            <qmatoms>27:C 28:S 29:C 38:C 39:C</qmatoms>
                            <mpoles>27:C 28:S 29:C 38:C 39:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>27 28 29</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_O1</name>
                            <mdatoms> 195:O2:3822</mdatoms>
                            <qmatoms>30:O </qmatoms>
                            <mpoles>30:O </mpoles>
                            <weights>16</weights>
                            <localframe>30</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_O2</name>
                            <mdatoms> 195:O2:3829</mdatoms>
                            <qmatoms>37:O </qmatoms>
                            <mpoles>37:O </mpoles>
                            <weights>16</weights>
                            <localframe>37</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_tail1</name>
                            <mdatoms> 195:C9:3823 195:H3:3824 195:H3:3825</mdatoms>
                            <qmatoms>31:C 32:H 33:H</qmatoms>
                            <mpoles>31:C 32:H 33:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>31 32 33</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_tail2</name>
                            <mdatoms> 195:C9:3826 195:H3:3827 195:H3:3828</mdatoms>
                            <qmatoms>34:C 35:H 36:H</qmatoms>
                            <mpoles>34:C 35:H 36:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>34 35 36</localframe>
                        </fragment>
                        <fragment> <!-- 4th edot -->
                            <name>edot3_body</name>
                            <mdatoms> 196:C7:3832 196:S4:3833 196:C7:3834 196:C7:3843 196:C7:3844</mdatoms> 
                            <qmatoms>40:C 41:S 42:C 51:C 52:C</qmatoms>
                            <mpoles>40:C 41:S 42:C 51:C 52:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>40 41 42</localframe> 
                        </fragment>
                        <fragment>
                            <name>edot3_O1</name>
                            <mdatoms> 196:O2:3835</mdatoms>
                            <qmatoms>43:O </qmatoms>
                            <mpoles>43:O </mpoles>
                            <weights>16</weights>
                            <localframe>43</localframe>
                        </fragment>
                        <fragment>
                            <name>edot3_O2</name>
                            <mdatoms> 196:O2:3842</mdatoms>
                            <qmatoms>50:O </qmatoms>
                            <mpoles>50:O </mpoles>
                            <weights>16</weights>
                            <localframe>50</localframe>
                        </fragment>
                        <fragment>
                            <name>edot3_tail1</name>
                            <mdatoms> 196:C9:3836 196:H3:3837 196:H3:3838</mdatoms>
                            <qmatoms>44:C 45:H 46:H</qmatoms>
                            <mpoles>44:C 45:H 46:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>44 45 46</localframe>
                        </fragment>
                        <fragment>
                            <name>edot3_tail2</name>
                            <mdatoms> 196:C9:3839 196:H3:3840 196:H3:3841</mdatoms>
                            <qmatoms>47:C 48:H 49:H</qmatoms>
                            <mpoles>47:C 48:H 49:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>47 48 49</localframe>
                        </fragment>
                    </fragments>
                </segment>
            </segments>
        </molecule>
        <molecule>
            <mdname>C24H17O8S4</mdname> <!--must be element followed by number--><!--2nd 4mer, atom sequence is difference from 1st -->
            <segments>
                <segment>
                    <name>edot2</name> <!--whatever names you choose-->
                    <qmcoords_n>QC_FILES/edot_4mer_n.xyz</qmcoords_n>
                                <qmcoords_e>QC_FILES/edot_4mer_e.xyz</qmcoords_e>
                            <qmcoords_h>QC_FILES/edot_4mer_h.xyz</qmcoords_h>
                    <multipoles_n>MP_FILES/edot_4mer_n_polar.mps</multipoles_n>
                                <multipoles_e>MP_FILES/edot_4mer_e_polar.mps</multipoles_e>
                                <multipoles_h>MP_FILES/edot_4mer_h_polar.mps</multipoles_h>
                    <map2md>0</map2md>
                    <fragments>
                        <fragment>  <!-- 1st edot -->
                            <name>edot2_1_body</name>
                            <mdatoms> 197:C7:3845 197:S4:3846 197:C7:3847 197:C7:3856 197:C7:3857</mdatoms>  <!-- S4: element + lammps type. 193 is the segment number -->  <!--3806,3807,is the (atom number-1) in the newfile.data-->
                            <qmatoms>14:C 15:S 16:C 25:C 26:C</qmatoms>    <!--11,12 is the number inxyzfiles--> <!-- begin with 0--> 
                            <mpoles>14:C 15:S 16:C 25:C 26:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>14 15 16</localframe>  <!-- the atom that constitude a plane-->
                        </fragment>
                        <fragment>
                            <name>edot2_1_O1</name>
                            <mdatoms> 197:O2:3848</mdatoms>
                            <qmatoms>17:O </qmatoms>
                            <mpoles>17:O </mpoles>
                            <weights>16</weights>
                            <localframe>17</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_1_O2</name>
                            <mdatoms> 197:O2:3855</mdatoms>
                            <qmatoms>24:O </qmatoms>
                            <mpoles>24:O </mpoles>
                            <weights>16</weights>
                            <localframe>24</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_1_tail1</name>
                            <mdatoms> 197:C9:3849 197:H3:3850 197:H3:3851</mdatoms>
                            <qmatoms>18:C 19:H 20:H</qmatoms>
                            <mpoles>18:C 19:H 20:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>18 19 20</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_1_tail2</name>
                            <mdatoms> 197:C9:3852 197:H3:3853 197:H3:3854</mdatoms>
                            <qmatoms>21:C 22:H 23:H</qmatoms>
                            <mpoles>21:C 22:H 23:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>21 22 23</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_2_body</name>
                            <mdatoms> 198:C7:3858 198:S4:3859 198:C7:3860 198:C7:3869 198:C7:3870</mdatoms>
                            <qmatoms>27:C 28:S 29:C 38:C 39:C</qmatoms>
                            <mpoles>27:C 28:S 29:C 38:C 39:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>27 28 29</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_2_O1</name>
                            <mdatoms> 198:O2:3861</mdatoms>
                            <qmatoms>30:O </qmatoms>
                            <mpoles>30:O </mpoles>
                            <weights>16</weights>
                            <localframe>30</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_2_O2</name>
                            <mdatoms> 198:O2:3868</mdatoms>
                            <qmatoms>37:O </qmatoms>
                            <mpoles>37:O </mpoles>
                            <weights>16</weights>
                            <localframe>37</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_2_tail1</name>
                            <mdatoms> 198:C9:3862 198:H3:3863 198:H3:3864</mdatoms>
                            <qmatoms>31:C 32:H 33:H</qmatoms>
                            <mpoles>31:C 32:H 33:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>31 32 33</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_2_tail2</name>
                            <mdatoms> 198:C9:3865 198:H3:3866 198:H3:3867</mdatoms>
                            <qmatoms>34:C 35:H 36:H</qmatoms>
                            <mpoles>34:C 35:H 36:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>34 35 36</localframe>
                        </fragment>
                        <fragment> <!-- 4th edot -->
                            <name>edot2_3_body</name>
                            <mdatoms> 199:C7:3871 199:S4:3872 199:C7:3873 199:C7:3882 199:C7:3883</mdatoms> 
                            <qmatoms>40:C 41:S 42:C 51:C 52:C</qmatoms>
                            <mpoles>40:C 41:S 42:C 51:C 52:C</mpoles>
                            <weights>12 32 12 12 12</weights>
                            <localframe>40 41 42</localframe> 
                        </fragment>
                        <fragment>
                            <name>edot2_3_O1</name>
                            <mdatoms> 199:O2:3874</mdatoms>
                            <qmatoms>43:O </qmatoms>
                            <mpoles>43:O </mpoles>
                            <weights>16</weights>
                            <localframe>43</localframe>
                            <localframe>43</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_3_O2</name>
                            <mdatoms> 199:O2:3881</mdatoms>
                            <qmatoms>50:O </qmatoms>
                            <mpoles>50:O </mpoles>
                            <weights>16</weights>
                            <localframe>50</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_3_tail1</name>
                            <mdatoms> 199:C9:3875 199:H3:3876 199:H3:3877</mdatoms>
                            <qmatoms>44:C 45:H 46:H</qmatoms>
                            <mpoles>44:C 45:H 46:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>44 45 46</localframe>
                        </fragment>
                        <fragment>
                            <name>edot2_3_tail2</name>
                            <mdatoms> 199:C9:3878 199:H3:3879 199:H3:3880</mdatoms>
                            <qmatoms>47:C 48:H 49:H</qmatoms>
                            <mpoles>47:C 48:H 49:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>47 48 49</localframe>
                        </fragment>
                        <fragment> <!-- 4th edot, with H -->
                            <name>edoth2_body</name>
                            <mdatoms> 200:S4:3884 192:C7:3885 200:C7:3887 200:C7:3896 200:C7:3897</mdatoms> <!--1st edoth + 92 = 7*13+1 -->
                            <qmatoms>0:S 1:C 3:C 12:C 13:C</qmatoms>
                            <mpoles>0:S 1:C 3:C 12:C 13:C</mpoles>
                            <weights>32 12 12 12 12</weights>
                            <localframe>0 1 3</localframe>
                        </fragment>
                        <fragment> 
                            <name>edoth2_O1</name>
                            <mdatoms>200:O2:3888</mdatoms>
                            <qmatoms>4:O</qmatoms>
                            <mpoles>4:O</mpoles>
                            <weights>16</weights>
                            <localframe>4</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth2_O2</name>
                            <mdatoms> 200:O2:3895</mdatoms>
                            <qmatoms> 11:O </qmatoms>
                            <mpoles> 11:O </mpoles>
                            <weights>16</weights>
                            <localframe>11</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth2_tail1</name>
                            <mdatoms>200:C9:3889 200:H3:3890 200:H3:3891</mdatoms>
                            <qmatoms>5:C 6:H 7:H</qmatoms>
                            <mpoles>5:C 6:H 7:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>5 6 7</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth2_tail2</name>
                            <mdatoms>200:C9:3892 200:H3:3893 200:H3:3894</mdatoms>
                            <qmatoms>8:C 9:H 10:H</qmatoms>
                            <mpoles>8:C 9:H 10:H</mpoles>
                            <weights>12 1 1</weights>
                            <localframe>8 9 10</localframe>
                        </fragment>
                        <fragment>
                            <name>edoth2_h1</name>
                            <mdatoms>200:H11:3886</mdatoms>
                            <qmatoms>2:H</qmatoms>
                            <mpoles>2:H</mpoles>
                            <weights>1</weights>
                            <localframe>2</localframe>
                        </fragment>
                    </fragments>
                </segment>
            </segments>
        </molecule>```
JensWehner commented 3 years ago

I mean what we can do is to construct the molecule names differently, so different order of atoms will generate different names.

zhc079 commented 3 years ago

I mean what we can do is to construct the molecule names differently, so different order of atoms will generate different names.

Do you mean, in the mdname, I can use a different order? For example, C24H17O8S4 and S4C24H17O8 ? I have tried it, still got segmentation fault.

"If you want to split a LAMMPS molecule you have to do it on the segment level" Here, if I want to split a Lammps molecule into two segments, within segments tag, can I define multiple segment tag?

In the above case, under the segments level, I define one segment edot1 for C24H17O8S4, then I define a second segment edot2 for C24H17O8S4. (Then molecule has mdname C48H34O16S8, the sum of the two segments.) I have tried this method. the xtp_map gives segmentation fault error.

JensWehner commented 3 years ago

Do you mean, in the mdname, I can use a different order? For example, C24H17O8S4 and S4C24H17O8 ? I have tried it, still got segmentation fault.

It is not implemented yet, but that could be a way to fix the problem.

In the mapping file above you created multiple molecules.

<topology>
    <molecules>
        <molecule>
            <mdname>C24H17O8S4</mdname> <!--must be element followed by number-->
                 <segments>
                        <segment>
                           <name>segA</name>
                        </segment>
                        <segment>
                          <name>segB</name>
                        </segment>
                  </segments>
        </molecule>
</topology>
zhc079 commented 3 years ago

Can I create molecule with mdname C48H34O16S8 in this way like below? SegA and SegB have the same QC_files and MP_files.

    <molecules>
        <molecule>
            <mdname>C48H34O16S8</mdname> <!--must be element followed by number-->
                 <segments>
                        <segment>
                           <name>segA</name> <!--composition is C24H17O8S4 -->
                        </segment>
                        <segment>
                          <name>segB</name> <!--composition is same C24H17O8S4, but different atom orer -->
                        </segment>
                  </segments>
        </molecule>
</topology>

My second issue: When I run xtp_map -m system.xml to get a skeleton mapping file, the only segments I got are C6H4O2S1 and C6H5O2S1. That is, the long 8mer is broken down into monomer edoth and edot_noh. If I group all 8 monomers as a segment, is it possible? It seems that I always got segmentation fault error when I grouped all 8 monomers as a segment.

JensWehner commented 3 years ago

Ahh I see, if Lammps broke your molecule into separate monomers that is difficult, I do not know how to turn them into one molecule again atm.

zhc079 commented 3 years ago

Ahh I see, if Lammps broke your molecule into separate monomers that is difficult, I do not know how to turn them into one molecule again atm.

Do you mean if xtp_map broke the molecule into separate monomers then that is difficult? The 8mer has two types of monomer, now I want the whole 8mer to become a molecule, with mdname C48H37O16S4

JensWehner commented 3 years ago

Can you provide your lammps files? I will have a look.

zhc079 commented 3 years ago

A zip file lmp_votca_test.zip is attached. I also sent it in slack. lmp_votca_test.zip

JensWehner commented 3 years ago

So the reason votca splits the large monomer into multiple parts is because the molecule tag for each atom is set differently for each subunit.

How did you create your lammps input?

JensWehner commented 3 years ago

So when I run xtp_map -m I get the following output:

 Writing template mapfile to bla2.xml
Found 144 with name C6H4O2S1
Found 48 with name C6H5O2S1
Found 48 with name C8H7O3S1
Found 144 with name C8H8O3S1
Found 54 with name Cl1
Found 30000 with name H2O1
Found 54 with name Na1

So it seems that the C6H4O2S1, C6H5O2S1,C8H7O3S1 and C8H8O3S1 are different molecules in your input file.

JensWehner commented 3 years ago

I mean we could go through the bonds and say anything that has a bond is a larger molecule together.

JensWehner commented 3 years ago

but I think the input file is simply not well designed. @JoshuaSBrown what do you think?

zhc079 commented 3 years ago

The system has two polymers: poly(3,4-ethylenedioxythiophene) polystyrene sulfonate (PEDOT:PSS). C6H4O2S1 is edot_noh (PEDOT middle monomer), C6H5O2S1 is edoth (PEDOT monomer at the ends.) The PEDOT 8mer is edoth-(edot_noh)x6-edoth. So the xtp_map broke the system into 4 molecules.

Now I want to group all 8mer to become a molecule C48H34O16S8. I suspect that this grouping gives me segmentation fault error. Or I also want to group 4mer into a molecule C24H17O8S4, then there are two molecules with different atom sequences.

JensWehner commented 3 years ago

a) Votca cannot group molecules together into a segment. b) Your lammps input splits the polymer into the parts and votca cannot recover that at the moment.

JensWehner commented 3 years ago

if you look at https://docs.lammps.org/2001/data_format.html you see that, each atom has a molecule id. This is what votca uses to determine if something belongs to a certain molecule.

zhc079 commented 3 years ago

a) Votca cannot group molecules together into a segment. b) Your lammps input splits the polymer into the parts and votca cannot recover that at the moment.

Can I change the Lammps input file such that every 8mer has the same molecule ID while keep the trajectory file unchanged, and then run xtp_map? For the 4mer, there will be two molecules with the atom mdname.

JensWehner commented 3 years ago

@junghans what do you think? Does csg allow bonds that are not inside molecules? Maybe we should change the way we see a LAMMPS molecule as anything that has bonded interaction is a molecule.

JensWehner commented 3 years ago

Can I change the Lammps input file such that every 8mer has the same molecule ID while keep the trajectory file unchanged, and then run xtp_map? For the 4mer, there will be two molecules with the atom mdname. a) I do not know might be worth a try b) the atom ordering is different in that case is it not? I can try to create a fix for that.

zhc079 commented 3 years ago

Can I change the Lammps input file such that every 8mer has the same molecule ID while keep the trajectory file unchanged, and then run xtp_map? For the 4mer, there will be two molecules with the atom mdname. a) I do not know might be worth a try b) the atom ordering is different in that case is it not? I can try to create a fix for that.

I can try modifying the Lammps input file, but the trajectory file is impossible to change. b) Yes the atom ordering is different, just like in the case of isomer.

JensWehner commented 3 years ago

I mean we can make the name take into account the ordering but then it gets a lot longer

JensWehner commented 3 years ago

the trajectory does not have the molecule ids in them so that is not a problem.

junghans commented 3 years ago

@junghans what do you think? Does csg allow bonds that are not inside molecules? Maybe we should change the way we see a LAMMPS molecule as anything that has bonded interaction is a molecule.

csg doesn't allow bond between molecules either.

JensWehner commented 3 years ago

https://github.com/votca/csg/pull/703 should throw an error when you connect multiple molecules with bonds, so at least the error handling is clear.

it will also fix the naming of isomers.

JensWehner commented 3 years ago

Closed by https://github.com/votca/csg/pull/703