~ubuntu-branches/ubuntu/trusty/travis/trusty

« back to all changes in this revision

Viewing changes to src/timestep.cpp

  • Committer: Package Import Robot
  • Author(s): Daniel Leidert
  • Date: 2013-12-13 23:35:55 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20131213233555-4o11bd1ybycqh0l7
Tags: 131115-1
* New upstream release.
* debian/control (Standards-Version): Bumped to 3.9.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        CVirtualAtom *v;
35
35
        CSingleMolecule *sm;
36
36
 
 
37
        tv = 0;
 
38
 
37
39
//      mprintf("** CalcCenters **");
38
40
 
39
41
        if (m_vaCoords.GetSize() < g_iGesVirtAtomCount)
534
536
        for (z=0;z<g_iGesAtomCount;z++)
535
537
        {
536
538
                ta[z] = 0;
537
 
                g_laAtomSMIndex[z] = 0;
 
539
                g_laAtomSMIndex[z] = -1;
538
540
        }
539
541
        g_iBondBlackListUsed = 0;
540
542
        g_oaSingleMolecules.RemoveAll();
1862
1864
}
1863
1865
 
1864
1866
        
1865
 
void CTimeStep::WriteTimestepNb(FILE *a, CNbSet *nbs)
 
1867
void CTimeStep::WriteTimestepNb(FILE *a, CNbSet *nbs, int singlemol)
1866
1868
{
1867
1869
        BTIN;
1868
 
        int z, z2, z3, z4, z0, n;
 
1870
        int z, z2, z3, z4, z0, n, ti;
1869
1871
        CMolecule *m;
1870
1872
        CSingleMolecule *sm;
 
1873
        CConditionGroup *cg;
 
1874
        CConditionSubGroup *cs;
 
1875
        CNbSearch *nb;
1871
1876
 
1872
1877
        n = 0;
 
1878
 
1873
1879
        for (z=0;z<g_oaMolecules.GetSize();z++)
1874
1880
        {
1875
1881
                if (nbs->m_oaConditionGroups[z] == NULL)
1887
1893
        }
1888
1894
 
1889
1895
        mfprintf(a,"  %d\n",n);
1890
 
        if (m_pComment != NULL)
1891
 
                mfprintf(a,"%s\n",m_pComment);
1892
 
                        else mfprintf(a,"\n");
 
1896
 
 
1897
        mfprintf(a,"# Step %d",((int)g_iSteps));
 
1898
 
 
1899
        if (singlemol >= 0)
 
1900
        {
 
1901
                sm = (CSingleMolecule*)g_oaSingleMolecules[singlemol];
 
1902
                m = (CMolecule*)g_oaMolecules[sm->m_iMolType];
 
1903
                if (!g_bSaveVirtAtoms)
 
1904
                {
 
1905
                        if (g_bWriteAtomwise)
 
1906
                                mfprintf(a,", RM=%s[%d]",m->m_sName,sm->m_iMolSMIndex+1);
 
1907
                                        else mfprintf(a,", RM=%s[%d] (%d atoms)",m->m_sName,sm->m_iMolSMIndex+1,m->m_iAtomGes-m->m_laVirtualAtoms.GetSize());
 
1908
                } else
 
1909
                {
 
1910
                        if (g_bWriteAtomwise)
 
1911
                                mfprintf(a,", RM=%s[%d]",m->m_sName,sm->m_iMolSMIndex+1);
 
1912
                                        else mfprintf(a,", RM=%s[%d] (%d atoms)",m->m_sName,sm->m_iMolSMIndex+1,m->m_iAtomGes);
 
1913
                }
 
1914
        }
 
1915
 
 
1916
        if (g_bEnvWriteDetailedInfo)
 
1917
        {
 
1918
                for (z=0;z<g_oaMolecules.GetSize();z++)
 
1919
                {
 
1920
                        if (nbs->m_oaConditionGroups[z] == NULL)
 
1921
                                continue;
 
1922
                        m = (CMolecule*)g_oaMolecules[z];
 
1923
 
 
1924
                        cg = (CConditionGroup*)nbs->m_oaConditionGroups[z];
 
1925
 
 
1926
                        if (g_bEnvSortNb)
 
1927
                        {
 
1928
                                nb = NULL;
 
1929
                                if (cg->m_oaConditionSubGroups.GetSize() == 1)
 
1930
                                {
 
1931
                                        cs = (CConditionSubGroup*)cg->m_oaConditionSubGroups[0];
 
1932
                                        if (cs->m_oaConditions.GetSize() == 1)
 
1933
                                                nb = (CNbSearch*)cs->m_oaConditions[0];
 
1934
                                }
 
1935
                                if (nb == NULL)
 
1936
                                        goto _nosortinfo;
 
1937
 
 
1938
                                if (nb->m_iNbCountMin <= -1)
 
1939
                                        goto _nosortinfo;
 
1940
 
 
1941
                                for (z2=nb->m_iNbCountMin;z2<=nb->m_iNbCountMax;z2++)
 
1942
                                {
 
1943
                                        ti = nb->m_pNbSort[z2].m_iOM;
 
1944
                                        if (!g_bSaveVirtAtoms)
 
1945
                                        {
 
1946
                                                if (m->m_laSingleMolIndex[ti] != singlemol)
 
1947
                                                {
 
1948
                                                        if (g_bWriteAtomwise)
 
1949
                                                                mfprintf(a,", %s[%d] d=%.3fpm",m->m_sName,z2+1,nb->m_pNbSort[z2].m_fMinDist);
 
1950
                                                                        else mfprintf(a,", %s[%d] d=%.3fpm (%d atoms)",m->m_sName,ti+1,nb->m_pNbSort[z2].m_fMinDist,m->m_iAtomGes-m->m_laVirtualAtoms.GetSize());
 
1951
                                                }
 
1952
                                        } else
 
1953
                                        {
 
1954
                                                if (m->m_laSingleMolIndex[ti] != singlemol)
 
1955
                                                {
 
1956
                                                        if (g_bWriteAtomwise)
 
1957
                                                                mfprintf(a,", %s[%d] d=%.3fpm",m->m_sName,z2+1,nb->m_pNbSort[z2].m_fMinDist);
 
1958
                                                                        else mfprintf(a,", %s[%d] d=%.3fpm (%d atoms)",m->m_sName,ti+1,nb->m_pNbSort[z2].m_fMinDist,m->m_iAtomGes);
 
1959
                                                }
 
1960
                                        }
 
1961
                                }
 
1962
                        } else
 
1963
                        {
 
1964
_nosortinfo:
 
1965
                                for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++)
 
1966
                                {
 
1967
                                        if (cg->Contains(z2))
 
1968
                                        {
 
1969
                                                if (!g_bSaveVirtAtoms)
 
1970
                                                {
 
1971
                                                        if (m->m_laSingleMolIndex[z2] != singlemol)
 
1972
                                                        {
 
1973
                                                                if (g_bWriteAtomwise)
 
1974
                                                                        mfprintf(a,", %s[%d]",m->m_sName,z2+1);
 
1975
                                                                                else mfprintf(a,", %s[%d] (%d atoms)",m->m_sName,z2+1,m->m_iAtomGes-m->m_laVirtualAtoms.GetSize());
 
1976
                                                        }
 
1977
                                                } else
 
1978
                                                {
 
1979
                                                        if (m->m_laSingleMolIndex[z2] != singlemol)
 
1980
                                                        {
 
1981
                                                                if (g_bWriteAtomwise)
 
1982
                                                                        mfprintf(a,", %s[%d]",m->m_sName,z2+1);
 
1983
                                                                                else mfprintf(a,", %s[%d] (%d atoms)",m->m_sName,z2+1,m->m_iAtomGes);
 
1984
                                                        }
 
1985
                                                }
 
1986
                                        }
 
1987
                                }
 
1988
                        }
 
1989
                }
 
1990
        }
 
1991
 
 
1992
        mfprintf(a,"\n");
1893
1993
 
1894
1994
        if (g_bWriteAtomwise)
1895
1995
        {
1920
2020
                }
1921
2021
        } else
1922
2022
        {
 
2023
                if (singlemol >= 0)
 
2024
                {
 
2025
                        sm = (CSingleMolecule*)g_oaSingleMolecules[singlemol];
 
2026
                        m = (CMolecule*)g_oaMolecules[sm->m_iMolType];
 
2027
                        for (z3=0;z3<m->m_baAtomIndex.GetSize();z3++)
 
2028
                        {
 
2029
                                if ((!g_bSaveVirtAtoms) && (m->m_baAtomIndex[z3] == g_iVirtAtomType))
 
2030
                                        continue;
 
2031
                                for (z4=0;z4<((CxIntArray*)sm->m_oaAtomOffset[z3])->GetSize();z4++)
 
2032
                                        mfprintf(a,"  %s  %8.5f  %8.5f  %8.5f\n",((CAtom*)g_oaAtoms[m->m_baAtomIndex[z3]])->m_sName,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][0]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][1]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][2]/100.0f);
 
2033
                        }
 
2034
                }
 
2035
 
1923
2036
                for (z=0;z<g_oaMolecules.GetSize();z++)
1924
2037
                {
1925
2038
                        if (nbs->m_oaConditionGroups[z] == NULL)
1926
2039
                                continue;
1927
2040
                        m = (CMolecule*)g_oaMolecules[z];
1928
 
                        for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++)
 
2041
                        cg = (CConditionGroup*)nbs->m_oaConditionGroups[z];
 
2042
 
 
2043
                        if (g_bEnvSortNb)
1929
2044
                        {
1930
 
                                if (((CConditionGroup*)nbs->m_oaConditionGroups[z])->Contains(z2))
1931
 
                                {
1932
 
                                        sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[z2]];
 
2045
                                nb = NULL;
 
2046
                                if (cg->m_oaConditionSubGroups.GetSize() == 1)
 
2047
                                {
 
2048
                                        cs = (CConditionSubGroup*)cg->m_oaConditionSubGroups[0];
 
2049
                                        if (cs->m_oaConditions.GetSize() == 1)
 
2050
                                                nb = (CNbSearch*)cs->m_oaConditions[0];
 
2051
                                }
 
2052
                                if (nb == NULL)
 
2053
                                        goto _nosort;
 
2054
 
 
2055
                                if (nb->m_iNbCountMin <= -1)
 
2056
                                        goto _nosort;
 
2057
 
 
2058
                                for (z2=nb->m_iNbCountMin;z2<=nb->m_iNbCountMax;z2++)
 
2059
                                {
 
2060
                                        ti = nb->m_pNbSort[z2].m_iOM;
 
2061
 
 
2062
                                        if (m->m_laSingleMolIndex[ti] == singlemol)
 
2063
                                                continue;
 
2064
 
 
2065
                                        sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[ti]];
1933
2066
                                        for (z3=0;z3<m->m_baAtomIndex.GetSize();z3++)
1934
2067
                                        {
1935
2068
                                                if ((!g_bSaveVirtAtoms) && (m->m_baAtomIndex[z3] == g_iVirtAtomType))
1938
2071
                                                        mfprintf(a,"  %s  %8.5f  %8.5f  %8.5f\n",((CAtom*)g_oaAtoms[m->m_baAtomIndex[z3]])->m_sName,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][0]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][1]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][2]/100.0f);
1939
2072
                                        }
1940
2073
                                }
 
2074
                        } else
 
2075
                        {
 
2076
_nosort:
 
2077
                                for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++)
 
2078
                                {
 
2079
                                        if (((CConditionGroup*)nbs->m_oaConditionGroups[z])->Contains(z2))
 
2080
                                        {
 
2081
                                                if (m->m_laSingleMolIndex[z2] == singlemol)
 
2082
                                                        continue;
 
2083
                                                sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[z2]];
 
2084
                                                for (z3=0;z3<m->m_baAtomIndex.GetSize();z3++)
 
2085
                                                {
 
2086
                                                        if ((!g_bSaveVirtAtoms) && (m->m_baAtomIndex[z3] == g_iVirtAtomType))
 
2087
                                                                continue;
 
2088
                                                        for (z4=0;z4<((CxIntArray*)sm->m_oaAtomOffset[z3])->GetSize();z4++)
 
2089
                                                                mfprintf(a,"  %s  %8.5f  %8.5f  %8.5f\n",((CAtom*)g_oaAtoms[m->m_baAtomIndex[z3]])->m_sName,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][0]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][1]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][2]/100.0f);
 
2090
                                                }
 
2091
                                        }
 
2092
                                }
1941
2093
                        }
1942
2094
                }
1943
2095
        }
3407
3559
                        m_faCharge[z] = (float)atof(q);
3408
3560
                } else if (needinfo && (z==0))
3409
3561
                {
 
3562
                        if (*p == 0)
 
3563
                                goto _no4;
3410
3564
                        q = p+1;
 
3565
                        if (*q == 0)
 
3566
                                goto _no4;
3411
3567
                        while (strchr(separators,*q) != NULL)
3412
3568
                                q++;
3413
3569
                        p = q;