start moving to another architecture

This commit is contained in:
arcan1s
2014-01-26 03:49:43 +04:00
parent 473d195ea9
commit 7c874ca96d
170 changed files with 3170 additions and 14746 deletions

View File

@ -1,28 +1,31 @@
cmake_minimum_required (VERSION 2.8)
cmake_policy (SET CMP0003 OLD)
cmake_policy (SET CMP0002 OLD)
cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
set ("PROJECT_VERSION_MAJOR" 1)
set ("PROJECT_VERSION_MINOR" 1)
set ("PROJECT_VERSION_PATCH" 1)
set ("PROJECT_VERSION" ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
set (PROJECT_LONG mathmech)
set (PROJECT_VERSION_MAJOR 1)
set (PROJECT_VERSION_MINOR 1)
set (PROJECT_VERSION_PATCH 1)
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
message (STATUS "Version ${PROJECT_VERSION}")
set (COMPS mathmech
mm_agl
mm_envir
mm_radf
mm_statgen
mm_trj
mm_trj2pdb)
mm
agl
envir
radf
statgen
trj
trj2pdb)
# install options
set (MM_PREFIX "mm_" CACHE STRING "Prefix for mathmech tools")
OPTION (WITH_DEBUG_MODE "Build with debug mode" OFF)
OPTION (ADD_DOCS "Add documentation" OFF)
option (WITH_DEBUG_MODE "Build with debug mode" OFF)
option (ADD_DOCS "Add documentation" OFF)
if (CMAKE_SYSTEM_NAME MATCHES Linux)
set (QWT_INCLUDE_PATH "/usr/include" CACHE STRING "Path to qwt include")
set (QWT_LIBRARY_PATH "/usr/lib" CACHE STRING "Path to qwt library")

View File

@ -0,0 +1,17 @@
# set project name
set (PROJECT agl)
# set additional cmake file
include (${PROJECT}.cmake)
# set libraries
set (LIBRARIES "")
foreach (LIBRARY ${LIBRARIES})
add_subdirectory (../${LIBRARY} bin/${LIBRARY})
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../${LIBRARY}/include/)
endforeach ()
# additional targets
set (TARGETS "")
set (HEADERS "")
add_subdirectory (${PROJECT_SOURCE_DIR})

View File

@ -5,8 +5,9 @@ set (PROJECT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set (PROJECT_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
# include_path
include_directories (${PROJECT_INCLUDE_DIR}/${PROJECT}
include_directories (${PROJECT_INCLUDE_DIR}
${PROJECT_SOURCE_DIR})
# library path
link_directories (${PROJECT_LIB_DIR})
# executable path

View File

@ -14,11 +14,8 @@ message (STATUS "${PROJECT} SOURCES: ${SOURCES}")
message (STATUS "${PROJECT} HEADERS: ${HEADERS}")
# link libraries and compile
add_executable (${PROJECT} ${SOURCES} ${HEADERS})
target_link_libraries (${PROJECT} ${ADDITIONAL_LIB})
add_executable (${MM_PREFIX}${PROJECT} ${SOURCES} ${HEADERS})
target_link_libraries (${MM_PREFIX}${PROJECT} ${ADDITIONAL_LIB} ${LIBRARIES})
# install properties
INSTALL (TARGETS ${PROJECT} DESTINATION bin)
if (ADD_DOCS)
INSTALL (FILES ${PROJECT_SOURCE_DIR}/../${_PROJECT}.pdf DESTINATION share/doc/mathmech)
endif ()
install (TARGETS ${MM_PREFIX}${PROJECT} DESTINATION bin)

View File

@ -4,7 +4,7 @@
#include <stdio.h>
#include "messages.h"
#include <mathmech/messages.h>
/**
@ -104,4 +104,4 @@ int set_defaults (char *aglinp, float *cell, char *input, int *log, char *output
*quiet = 0;
return 0;
}
}

View File

@ -1,85 +1,6 @@
/**
* @file
*/
/**
* @mainpage mm_agl
* @image latex ./logo.png
*
* @section intro_sec Introduction
*
* <b>About this program</b>:
* <ul>
* <li>Program that creates PDB file with chosen agglomerate
* </ul>
*
* <b>Developer</b>:
* <ul>
* <li>Evgeniy Alekseev aka arcanis <pre><esalexeev (at) gmail (dot) com></pre>
*</ul>
* <b>License</b>:
* <ul>
* <li>GPL
* </ul>
*
* @section How-To-Use How to use
* Usage:
* <pre>
* mm_agl -a AGL_INP -i INPUT -c X,Y,Z -o OUTPUT [ -l LOGFILE ] [ -q ] [ -h ]
*
* Parametrs:
* -a - input file with agglomerates (in format statgen)
* -i - input file with coordinates
* -c - cell size (float), A
* -o - output file name
* -l - log enable
* -q - quiet enable
* -h - show this help and exit
* </pre>
*
* @page Install
*
* @section Requirements Requirements
* The application mm_agl requires the following external stuff:
* - cmake >= 2.8
* - gcc >= 4.8
*
* @section How-To How to install
*
* @subsection Linux Linux
* @code
* mkdir build && cd build
* cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../
* make
* make install
* @endcode
*
* @subsection Windows Windows
* @code
* create project file using 'cmake'
* compile project
* @endcode
* You may also download compiled executable file for Win_x86.
*
* @page Changelog
* V.1.1.1 (2013-09-03)
* <ul>
* <li>optimization
* </ul>
* V.1.1.0 (2013-09-02)
* <ul>
* <li>added help window
* <li>added help docs
* <li>small bug fixes
* </ul>
* V.1.0.3 (2013-08-30)
* <ul>
* <li>bug fixes
* </ul>
* V.1.0.1 (2013-07-27)
* <ul>
* <li>initial release
* </ul>
*/
#include <math.h>
#include <stdio.h>
@ -87,12 +8,12 @@
#include <string.h>
#include "add_main.h"
#include "coords.h"
#include "messages.h"
#include "print_struct.h"
#include "read_agl.h"
#include "select_mol.h"
#include "set_center.h"
#include <mathmech/coords.h>
#include <mathmech/messages.h>
#include <mathmech/print_struct.h>
#include <mathmech/read_agl.h>
#include <mathmech/select_mol.h>
#include <mathmech/set_center.h>
/**
@ -318,4 +239,4 @@ int main(int argc, char *argv[])
if (log == 1)
fclose (f_log);
return 0;
}
}

View File

@ -1,5 +1,3 @@
set (PROJECT mathmech)
# set directory
set (PROJECT_DOCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs)
install (DIRECTORY ${PROJECT_DOCS_DIR}
DESTINATION share/doc/${PROJECT})
install (DIRECTORY ${PROJECT_DOCS_DIR} DESTINATION share/doc/${PROJECT_LONG})

View File

@ -0,0 +1,17 @@
# set project name
set (PROJECT envir)
# set additional cmake file
include (${PROJECT}.cmake)
# set libraries
set (LIBRARIES "")
foreach (LIBRARY ${LIBRARIES})
add_subdirectory (../${LIBRARY} bin/${LIBRARY})
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../${LIBRARY}/include/)
endforeach ()
# additional targets
set (TARGETS "")
set (HEADERS "")
add_subdirectory (${PROJECT_SOURCE_DIR})

View File

@ -5,8 +5,9 @@ set (PROJECT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set (PROJECT_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
# include_path
include_directories (${PROJECT_INCLUDE_DIR}/${PROJECT}
include_directories (${PROJECT_INCLUDE_DIR}
${PROJECT_SOURCE_DIR})
# library path
link_directories (${PROJECT_LIB_DIR})
# executable path

View File

@ -14,11 +14,8 @@ message (STATUS "${PROJECT} SOURCES: ${SOURCES}")
message (STATUS "${PROJECT} HEADERS: ${HEADERS}")
# link libraries and compile
add_executable (${PROJECT} ${SOURCES} ${HEADERS})
target_link_libraries (${PROJECT} ${ADDITIONAL_LIB})
add_executable (${MM_PREFIX}${PROJECT} ${SOURCES} ${HEADERS})
target_link_libraries (${MM_PREFIX}${PROJECT} ${ADDITIONAL_LIB} ${LIBRARIES})
# install properties
INSTALL (TARGETS ${PROJECT} DESTINATION bin)
if (ADD_DOCS)
INSTALL (FILES ${PROJECT_SOURCE_DIR}/../${_PROJECT}.pdf DESTINATION share/doc/mathmech)
endif ()
install (TARGETS ${MM_PREFIX}${PROJECT} DESTINATION bin)

View File

@ -4,7 +4,7 @@
#include <stdio.h>
#include "messages.h"
#include <mathmech/messages.h>
/**
@ -103,4 +103,4 @@ int set_defaults (float *cell, char *input, int *log, int *num_of_mol, char *out
*rad = 6.0;
return 0;
}
}

View File

@ -1,87 +1,6 @@
/**
* @file
*/
/**
* @mainpage mm_envir
* @image latex ./logo.png
*
* @section intro_sec Introduction
*
* <b>About this program</b>:
* <ul>
* <li>Program that searchs environment for chosen molecule by geometric criterion
* </ul>
*
* <b>Developer</b>:
* <ul>
* <li>Evgeniy Alekseev aka arcanis <pre><esalexeev (at) gmail (dot) com></pre>
*</ul>
* <b>License</b>:
* <ul>
* <li>GPL
* </ul>
*
* @section How-To-Use How to use
* Usage:
* <pre>
* mm_envir -i INPUT -c X,Y,Z -o OUTPUT [ -n NUM_OF_MOLECULE ] [ -r RADIUS ]
* [ -l LOGFILE ] [ -q ] [ -h ]
*
* Parametrs:
* -i - input file name
* -c - cell size (float), A
* -o - output file name
* -n - number of molecule for search (integer). Default is 1
* -r - radius of environment (float). Default is 6.0
* -l - log enable
* -q - quiet enable
* -h - show this help and exit
* </pre>
*
* @page Install
*
* @section Requirements Requirements
* The application mm_envir requires the following external stuff:
* - cmake >= 2.8
* - gcc >= 4.8
*
* @section How-To How to install
*
* @subsection Linux Linux
* @code
* mkdir build && cd build
* cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../
* make
* make install
* @endcode
*
* @subsection Windows Windows
* @code
* create project file using 'cmake'
* compile project
* @endcode
* You may also download compiled executable file for Win_x86.
*
* @page Changelog
* V.1.1.1 (2013-09-03)
* <ul>
* <li>optimization
* </ul>
* V.1.1.0 (2013-09-02)
* <ul>
* <li>added help window
* <li>added help docs
* <li>small bug fixes
* </ul>
* V.1.0.3 (2013-08-30)
* <ul>
* <li>bug fixes
* </ul>
* V.1.0.1 (2013-07-27)
* <ul>
* <li>initial release
* </ul>
*/
#include <math.h>
#include <stdio.h>
@ -89,11 +8,11 @@
#include <string.h>
#include "add_main.h"
#include "coords.h"
#include "envir_search.h"
#include "messages.h"
#include "print_struct.h"
#include "set_center.h"
#include <mathmech/coords.h>
#include <mathmech/envir_search.h>
#include <mathmech/messages.h>
#include <mathmech/print_struct.h>
#include <mathmech/set_center.h>
/**
@ -324,4 +243,4 @@ int main(int argc, char *argv[])
if (log == 1)
fclose (f_log);
return 0;
}
}

View File

@ -1,9 +1,3 @@
cmake_minimum_required (VERSION 2.8)
cmake_policy (SET CMP0003 OLD)
cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
# set project name
set (PROJECT mathmech)
# set additional cmake file
@ -11,18 +5,13 @@ include (${PROJECT}.cmake)
# additional options
OPTION (WITH_DEBUG_MODE "Build with debug mode" OFF)
option (WITH_DEBUG_MODE "Build with debug mode" OFF)
# set libraries
set (LIBRARIES)
foreach (LIBRARY ${LIBRARIES})
find_library ("${LIBRARY}_FOUND" ${LIBRARY})
message (STATUS "Check the ${LIBRARY} is installed: " ${${LIBRARY}_FOUND})
if ("${${LIBRARY}_FOUND}" STREQUAL "${LIBRARY}_FOUND-NOTFOUND")
message (STATUS "Adding library sources")
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
endif ()
endforeach ()
set (LIBRARIES "")
foreach (LIBRARY ${LIBRARIES})
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
endforeach ()
# additional targets
set (TARGETS "")

View File

@ -63,10 +63,7 @@ target_link_libraries (${PROJECT} ${LIBRARIES} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRA
# install properties
install (TARGETS ${PROJECT} DESTINATION bin)
if (CMAKE_SYSTEM_NAME MATCHES Linux)
install (FILES ../mathmech.desktop
DESTINATION share/applications/)
install (FILES ../mathmech-logo.png
DESTINATION share/pixmaps/)
install (FILES ../mathmech.png
DESTINATION share/icons/hicolor/32x32/apps/)
install (FILES ../mathmech.desktop DESTINATION share/applications/)
install (FILES ../mathmech-logo.png DESTINATION share/pixmaps/)
install (FILES ../mathmech.png DESTINATION share/icons/hicolor/32x32/apps/)
endif ()

View File

@ -0,0 +1,13 @@
# set project name
set (PROJECT mm)
# set additional cmake file
include (${PROJECT}.cmake)
if (ADD_DOCS)
include (doxygen.cmake)
endif ()
# additional targets
set (TARGETS "")
set (HEADERS "")
add_subdirectory (${PROJECT_SOURCE_DIR})

13
mathmech/mm/doxygen.cmake Normal file
View File

@ -0,0 +1,13 @@
# build docs
find_package (Doxygen)
if (DOXYGEN_FOUND)
set (PROJECT_DOCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs/html)
set (DOXYGEN_INPUT ${CMAKE_CURRENT_SOURCE_DIR})
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/mm.doxygen ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
add_custom_target (docs COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
else (DOXYGEN_FOUND)
message (STATUS "WARNING: Doxygen not found - Reference manual will not be created")
endif ()
# instal properties
# install (DIRECTORY ${PROJECT_DOCS_DIR} DESTINATION share/doc/${PROJECT_LONG})

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

26
mathmech/mm/mm.cmake Normal file
View File

@ -0,0 +1,26 @@
# set directories
set (PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set (PROJECT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
# include_path
include_directories (${PROJECT_INCLUDE_DIR}
${PROJECT_SOURCE_DIR})
# verbose
set (CMAKE_VERBOSE_MAKEFILE ON)
# flags
if ( WITH_DEBUG_MODE )
add_definitions ( -DDEBUG_MODE=1 )
endif ()
if ( CMAKE_COMPILER_IS_GNUCXX )
set (ADD_CXX_FLAGS "-Wall")
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
elseif ( MSVC )
set (ADD_CXX_FLAGS "/W4")
set (CMAKE_CXX_FLAGS "${ADD_CXX_FLAGS}")
else ()
message ("Unknown compiler")
endif ()

2314
mathmech/mm/mm.doxygen Normal file

File diff suppressed because it is too large Load Diff

View File

@ -14,11 +14,8 @@ message (STATUS "${PROJECT} SOURCES: ${SOURCES}")
message (STATUS "${PROJECT} HEADERS: ${HEADERS}")
# link libraries and compile
add_executable (${PROJECT} ${SOURCES} ${HEADERS})
add_library (${PROJECT} SHARED ${SOURCES} ${HEADERS})
target_link_libraries (${PROJECT} ${ADDITIONAL_LIB})
# install properties
INSTALL (TARGETS ${PROJECT} DESTINATION bin)
if (ADD_DOCS)
INSTALL (FILES ${PROJECT_SOURCE_DIR}/../${_PROJECT}.pdf DESTINATION share/doc/mathmech)
endif ()
install (TARGETS ${PROJECT} DESTINATION lib)

103
mathmech/mm/src/main.c Normal file
View File

@ -0,0 +1,103 @@
/**
* @file
*/
/**
* @mainpage libmm
* @image latex ./logo.png
*
* @section intro_sec Introduction
*
* <b>About this program</b>:
* <ul>
* <li>Library for mathmech
* </ul>
*
* <b>Developer</b>:
* <ul>
* <li>Evgeniy Alekseev aka arcanis <pre><esalexeev (at) gmail (dot) com></pre>
*</ul>
* <b>License</b>:
* <ul>
* <li>GPL
* </ul>
*
* @page Install
*
* @section Requirements Requirements
* The application mmlib requires the following external stuff:
* - cmake >= 2.8
* - gcc >= 4.8
*
* @section How-To How to install
*
* @subsection Linux Linux
* @code
* mkdir build && cd build
* cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../
* make
* make install
* @endcode
*
* @subsection Windows Windows
* @code
* create project file using 'cmake'
* compile project
* @endcode
* You may also download compiled executable file for Win_x86.
*
* @page Changelog
* V.1.1.1 (2013-09-03)
* <ul>
* <li>optimization
* </ul>
* V.1.1.0 (2013-09-02)
* <ul>
* <li>added help window
* <li>added help docs
* <li>small bug fixes
* </ul>
* V.1.0.3 (2013-08-30)
* <ul>
* <li>bug fixes
* </ul>
* V.1.0.1 (2013-07-27)
* <ul>
* <li>initial release
* </ul>
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mathmech/atom_types.h>
#include <mathmech/coords.h>
#include <mathmech/envir_search.h>
#include <mathmech/graph.h>
#include <mathmech/messages.h>
#include <mathmech/print_struct.h>
#include <mathmech/print_trj.h>
#include <mathmech/radf.h>
#include <mathmech/radf_proc.h>
#include <mathmech/read_agl.h>
#include <mathmech/read_gmx.h>
#include <mathmech/read_puma.h>
#include <mathmech/select_mol.h>
#include <mathmech/set_center.h>
#include <mathmech/stat_print.h>
#include <mathmech/stat_select.h>
#include <mathmech/stat_sort.h>
#include <mathmech/summary_stat.h>
/**
* @fn main
*/
int main(int argc, char *argv[])
/**
* @return 0 - exit without errors
*/
{
return 0;
}

View File

@ -5,7 +5,7 @@
#include <math.h>
#include <stdio.h>
#include "print_trj.h"
#include <mathmech/print_trj.h>
/**
@ -151,4 +151,4 @@ int rw_gmx (const char *input, const int step, const char *output, const int num
fclose (f_inp);
return 0;
}
}

View File

@ -4,7 +4,7 @@
#include <stdio.h>
#include "print_trj.h"
#include <mathmech/print_trj.h>
/**
@ -91,4 +91,4 @@ int rw_puma (const char *input, const int step, const char *output, const int nu
fclose (f_inp);
return 0;
}
}

View File

@ -5,7 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "graph.h"
#include <mathmech/graph.h>
/**
@ -138,4 +138,4 @@ int printing_agl (const char *input, const char *output, const int *connect,
free (iso);
return 0;
}
}

View File

@ -1,28 +0,0 @@
cmake_minimum_required (VERSION 2.8)
cmake_policy (SET CMP0003 OLD)
cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
# set project name
set (PROJECT ${MM_PREFIX}agl)
set (_PROJECT mm_agl)
# set additional cmake file
include (${_PROJECT}.cmake)
# set libraries
set (LIBRARIES)
foreach (LIBRARY ${LIBRARIES})
find_library ("${LIBRARY}_FOUND" ${LIBRARY})
message (STATUS "Check the ${LIBRARY} is installed: " ${${LIBRARY}_FOUND})
if ("${${LIBRARY}_FOUND}" STREQUAL "${LIBRARY}_FOUND-NOTFOUND")
message (STATUS "Adding library sources")
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
endif ()
endforeach ()
# additional targets
set (TARGETS "")
set (HEADERS "")
add_subdirectory (${PROJECT_SOURCE_DIR})

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,20 +0,0 @@
PROJECT=AGL
CC=gcc
CFLAGS=-c -Wall -fPIC
LDFLAGS=-lm
SOURCES_DIR=src
SOURCES=main.c add_main.c coords.c messages.c print_struct.c read_agl.c select_mol.c set_center.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=mm_agl
$(PROJECT): $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -f *.o test*

View File

@ -1,28 +0,0 @@
cmake_minimum_required (VERSION 2.8)
cmake_policy (SET CMP0003 OLD)
cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
# set project name
set (PROJECT ${MM_PREFIX}envir)
set (_PROJECT mm_envir)
# set additional cmake file
include (${_PROJECT}.cmake)
# set libraries
set (LIBRARIES)
foreach (LIBRARY ${LIBRARIES})
find_library ("${LIBRARY}_FOUND" ${LIBRARY})
message (STATUS "Check the ${LIBRARY} is installed: " ${${LIBRARY}_FOUND})
if ("${${LIBRARY}_FOUND}" STREQUAL "${LIBRARY}_FOUND-NOTFOUND")
message (STATUS "Adding library sources")
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
endif ()
endforeach ()
# additional targets
set (TARGETS "")
set (HEADERS "")
add_subdirectory (${PROJECT_SOURCE_DIR})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,20 +0,0 @@
PROJECT=ENVIR
CC=gcc
CFLAGS=-c -Wall -fPIC
LDFLAGS=-lm
SOURCES_DIR=src
SOURCES=main.c add_main.c coords.c envir_search.c messages.c print_struct.c set_center.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=mm_envir
$(PROJECT): $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -f *.o test*

View File

@ -1,354 +0,0 @@
/**
* @file
*/
#include <stdio.h>
#include <stdlib.h>
/**
* @fn reading_coords
*/
int reading_coords (const int mode, const char *filename, const int type_inter,
const int *label_atom, const float *cell, int *num_mol,
int *num_atoms, int *true_label_mol, int *label_mol,
int *type_atoms, float *coords, char *ch_type_atoms)
/**
* @brief function that reads coordinates from special file format
* @code
* reading_coords (0, filename, type_inter, label_atom, cell, &num_mol, &num_atoms,
* true_label_mol, label_mol, type_atoms, coords, ch_type_atoms);
* @endcode
*
* @param mode mode of reading; '1' is statgen, '2' is envir or
* frad, '3' is agl
* @param filename input file name
* @param type_inter number of needed atoms
* (number of needed molecules)
* @param label_atom massive of needed atom types
* (massive of needed molecules)
* @param cell massive of cell size
* @param num_mol number of molecules
* @param num_atoms number of atoms
* @param true_label_mol massive of true numbers of molecule for atoms
* @param label_mol massive of numbers of molecule for atoms
* @param type_atoms massive of atom types
* @param coords massive of coordinates
* @param ch_type_atoms massive of char atom types
*
* @return 1 - file $filename does not exist
* @return 2 - unknown mode
* @return 0 - exit without errors
*/
{
char at_symb[32], file_string[256];
int atoms, cur_at_num, cur_at_type, cur_mol, i, j, tr_num_atoms, ref_mol, x, y;
float cur_coords[3], *not_tr_coords, ref[3];
FILE *inp;
/* cur_* temp variables
* at_symb temp variable
* file_string temp string variable
* atoms total number of atoms in system
* tr_num_atoms number of translated atoms (must be 8*num_atoms)
* ref_mol number of molecule for reference in translation
* not_tr_coords massive of not translated coordinates
* ref massive of coordinates of reference molecule
* inp input file
*/
/// <b>Work blocks</b>
*num_atoms = 0;
*num_mol = 0;
/// <pre> reading file </pre>
inp = fopen (filename, "r");
if (inp == NULL)
return 1;
ref_mol = -1;
fscanf (inp, "%i", &atoms);
not_tr_coords = (float *) malloc (3 * atoms * sizeof (float));
fgets (file_string, 256, inp);
for (i=0; i<atoms; i++)
{
fgets (file_string, 256, inp);
sscanf (file_string, "%i%s%f%f%f%i%i", &cur_at_num, at_symb, &cur_coords[0],
&cur_coords[1], &cur_coords[2], &cur_at_type, &cur_mol);
// reading variables according to selected mode
switch (mode)
{
case 0:
// mode == 0 (selected atoms)
for (j=0; j<type_inter; j++)
if (cur_at_type == label_atom[j])
{
not_tr_coords[3**num_atoms+0] = cur_coords[0];
not_tr_coords[3**num_atoms+1] = cur_coords[1];
not_tr_coords[3**num_atoms+2] = cur_coords[2];
if (ref_mol != cur_mol)
{
ref_mol = cur_mol;
true_label_mol[*num_mol] = ref_mol;
*num_mol = *num_mol + 1;
}
label_mol[*num_atoms] = *num_mol - 1;
type_atoms[*num_atoms] = j;
*num_atoms = *num_atoms + 1;
}
break;
case 1:
// mode == 1 (all atoms)
not_tr_coords[3**num_atoms+0] = cur_coords[0];
not_tr_coords[3**num_atoms+1] = cur_coords[1];
not_tr_coords[3**num_atoms+2] = cur_coords[2];
ch_type_atoms[2**num_atoms+0] = at_symb[0];
ch_type_atoms[2**num_atoms+1] = at_symb[1];
if (ref_mol != cur_mol)
{
ref_mol = cur_mol;
true_label_mol[*num_mol] = ref_mol;
*num_mol = *num_mol + 1;
}
label_mol[*num_atoms] = *num_mol - 1;
type_atoms[*num_atoms] = j;
*num_atoms = *num_atoms + 1;
break;
case 2:
// mode == 2 (selected molecules)
for (j=0; j<type_inter; j++)
if (cur_mol == label_atom[j])
{
not_tr_coords[3**num_atoms+0] = cur_coords[0];
not_tr_coords[3**num_atoms+1] = cur_coords[1];
not_tr_coords[3**num_atoms+2] = cur_coords[2];
ch_type_atoms[2**num_atoms+0] = at_symb[0];
ch_type_atoms[2**num_atoms+1] = at_symb[1];
if (ref_mol != cur_mol)
{
ref_mol = cur_mol;
true_label_mol[*num_mol] = ref_mol;
*num_mol = *num_mol + 1;
}
label_mol[*num_atoms] = *num_mol - 1;
type_atoms[*num_atoms] = j;
*num_atoms = *num_atoms + 1;
}
break;
default: return 2;
}
}
fclose (inp);
/// <pre> translation </pre>
tr_num_atoms = *num_atoms;
for (i=0; i<*num_atoms; i++)
for (j=0; j<3; j++)
coords[3*i+j] = not_tr_coords[3*i+j];
// assign initial value to reference coordinates
ref_mol = label_mol[0];
for (i=0; i<3; i++)
ref[i] = coords[3*0+i];
for (i=0; i<*num_atoms; i++)
{
if (label_mol[i] != ref_mol)
{
ref_mol = label_mol[i];
for (j=0; j<3; j++)
ref[j] = not_tr_coords[3*i+j];
}
for (x=0; x<3; x++)
{
if (ref[x] >= 0.0)
// if xyz >= 0.0 A
{
for (j=0; j<3; j++)
if (j == x)
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j];
else
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
else
// if xyz < 0.0 A
{
for (j=0; j<3; j++)
if (j == x)
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j];
else
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
}
for (x=0; x<3; x++)
{
for (y=x+1; y<3; y++)
{
if ((ref[x] >= 0.0) && (ref[y] >= 0.0))
// if xyz and xyz >= 0.0 A
{
for (j=0; j<3; j++)
if ((j == x) || (j == y))
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j];
else
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[x] < 0.0) && (ref[y] < 0.0))
// if xyz and xyz < 0.0 A
{
for (j=0; j<3; j++)
if ((j == x) || (j == y))
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j];
else
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
}
for (y=0; y<3; y++)
if ((ref[x] < 0.0) && (ref[y] >= 0.0))
// if xyz OR xyz >= 0.0
{
for (j=0; j<3; j++)
{
if (j == x)
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j];
if (j == y)
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j];
if ((j != x) && (j != y))
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
}
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
}
if ((ref[0] >= 0.0) && (ref[1] >= 0.0) && (ref[2] >= 0.0))
// if x and y and z >= 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] >= 0.0) && (ref[1] >= 0.0) && (ref[2] < 0.0))
// if x and y >= 0.0 A and z < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] >= 0.0) && (ref[1] < 0.0) && (ref[2] >= 0.0))
// if x and z >= 0.0 A and y < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] < 0.0) && (ref[1] >= 0.0) && (ref[2] >= 0.0))
// if y and z >= 0.0 A and x < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] < 0.0) && (ref[1] < 0.0) && (ref[2] >= 0.0))
// if x and y < 0.0 A and z >= 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] < 0.0) && (ref[1] >= 0.0) && (ref[2] < 0.0))
// if x and z < 0.0 A and y >= 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] >= 0.0) && (ref[1] < 0.0) && (ref[2] < 0.0))
// if x >= 0.0 A and y and z < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] < 0.0) && (ref[1] < 0.0) && (ref[2] < 0.0))
// if x and y and z < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
}
/// <pre> free memory </pre>
free (not_tr_coords);
return 0;
}

View File

@ -1,16 +0,0 @@
/**
* @file
*/
#ifndef COORDS_H
#define COORDS_H
/**
* @fn reading_coords
*/
int reading_coords (const int, const char *, const int, const int *,
const float *, int *, int *, int *, int *, int *, float *,
char *);
#endif /* COORDS_H */

View File

@ -1,119 +0,0 @@
/**
* @file
*/
#include <stdio.h>
#include <time.h>
/**
* @fn message
*/
int message (const int log, const int mode, const char *text, FILE *output)
/**
* @brief function that prints messages to output
* @code
* message (log, mode, text, output);
* @endcode
*
* @param log equal to 1 if print to logfile
* @param mode number of message
* @param text additional text
* @param output output file (may be stdout)
*
* @return 1 - unknown mode
* @return 0 - exit without errors
*/
{
char out[4096];
if (log == 1)
{
char time_str[256];
time_t t = time (NULL);
struct tm* aTm = localtime (&t);
sprintf (time_str, "[%04d-%02d-%02d %02d:%02d:%02d] [%2i]: ", aTm->tm_year+1900,
aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec, mode);
fputs (time_str, output);
}
switch (mode)
{
case 0:
sprintf (out, "Start program: '%s'\n", text);
break;
case 1:
sprintf (out, "Checking errors\n");
break;
case 2:
sprintf (out, "Errors are not detected\n");
break;
case 3:
sprintf (out, "Initialization of variables from file '%s'\n", text);
break;
case 4:
sprintf (out, "%6cAgglomerate was selected successfully\n", ' ');
break;
case 5:
sprintf (out, "Initial parametrs: \n%s", text);
break;
case 6:
sprintf (out, "Processing\n");
break;
case 7:
sprintf (out, "Open file: '%s'\n", text);
break;
case 8:
sprintf (out, "%s", text);
break;
case 9:
sprintf (out, "%6cSize of variables was changed successfully\n", ' ');
break;
case 10:
sprintf (out, "%6cConnectivity matrix was created successfully\n", ' ');
break;
case 11:
sprintf (out, "%6cConnectivity matrix was processed successfully\n", ' ');
break;
case 12:
sprintf (out, "%6cResult was printed to file '%s' successfully\n", ' ', text);
break;
case 13:
sprintf (out, "End of processing\n");
break;
case 14:
sprintf (out, "Print result to file '%s'\n", text);
break;
case 15:
sprintf (out, "Free memory\n");
break;
case 16:
sprintf (out, "Exiting without errors\n");
break;
case 17:
sprintf (out, "Something wrong!\nSee '%s -h' for more details\n", text);
break;
case 18:
sprintf (out, "File '%s' not found\nError\n", text);
break;
case 19:
sprintf (out, "Memory error\n");
break;
case 20:
sprintf (out, "%6cCenter of molecules was set successfully\n", ' ');
break;
case 21:
sprintf (out, "%6cEnvironment was selected successfully\n", ' ');
break;
case 22:
sprintf (out, "%6cRADF was appended successfully\n", ' ');
break;
default:
return 1;
break;
}
fputs (out, output);
return 0;
}

View File

@ -1,14 +0,0 @@
/**
* @file
*/
#ifndef MESSAGES_H
#define MESSAGES_H
/**
* @fn message
*/
int message (const int, const int, const char *, FILE *);
#endif /* MESSAGES_H */

View File

@ -1,69 +0,0 @@
/**
* @file
*/
#include <stdio.h>
/**
* @fn print_structure
*/
int print_structure (const char *output, const int num_needed_mol, const int *needed_mol,
const int num_atoms, const int *label_mol, const char *ch_type_atoms,
const float *coords)
/**
* @brief function that prints structure to pdb file
* @code
* print_structure (output, num_needed_mol, needed_mol, num_atoms, label_mol,
* char_type_atoms, coords);
* @endcode
*
* @param output output file name
* @param num_needed_mol number of needed molecules
* @param needed_mol massive of number of needed molecules
* @param num_atoms number of atoms
* @param label_mol massive of numbers of molecule for atoms
* @param ch_type_atoms massive of char atom types
* @param coords massive of coordinates
*
* @return 0 - exit without errors
*/
{
int cur_atom, cur_atom_num, cur_mol, i, j;
FILE *f_out;
/* cur_atom current atom
* cur_atom_num true atom number
* cur_mol current molecule
* f_out output file
*/
cur_atom = 1;
f_out = fopen (output, "w");
for (i=0; i<num_needed_mol; i++)
for (j=0; j<8*num_atoms; j++)
{
if (j < num_atoms)
{
cur_mol = 0;
cur_atom_num = j;
}
else
{
cur_mol = ((j - num_atoms) % 7) + 1;
cur_atom_num = (j - num_atoms) / 7;
}
if (needed_mol[i] == (8*label_mol[j]+cur_mol))
{
fprintf(f_out, "ATOM %5i %c%c MOL %4i %8.3f%8.3f%8.3f\n", cur_atom,
ch_type_atoms[2*cur_atom_num+0], ch_type_atoms[2*cur_atom_num+1],
i+1, coords[3*j+0], coords[3*j+1], coords[3*j+2]);
cur_atom++;
}
}
fclose (f_out);
return 0;
}

View File

@ -1,15 +0,0 @@
/**
* @file
*/
#ifndef PRINT_STRUCTURE_H
#define PRINT_STRUCTURE_H
/**
* @fn print_structure
*/
int print_structure (const char *, const int, const int *, const int, const int *,
const char *, const float *);
#endif /* PRINT_STRUCTURE_H */

View File

@ -1,61 +0,0 @@
/**
* @file
*/
/**
* @fn set_center
*/
int set_center (const int num_atoms, const int num_mol, const int *label_mol,
const float *coords, float *centr_coords)
/**
* @brief function that searchs center mass of molecules
* @code
* set_center (num_of_atoms, num_of_molecules, label_molecules, coords, centr_coords);
* @endcode
*
* @param num_atoms number of atoms
* @param num_mol number of molecules
* @param label_mol massive of numbers of molecule for atoms
* @param coords massive of coordinates
* @param centr_coords massive of centered coordinates
*
* @return 0 - exit without errors
*/
{
int at_in_mol, cur_mol, i, j, k;
/* at_int_mol number of atoms in molecule
* cur_mol current molecule
*/
for (i=0; i<8*num_mol; i++)
for (j=0; j<3; j++)
centr_coords[i*3+j] = 0.0;
for (i=0; i<8*num_atoms; i++)
{
if (i < num_atoms)
cur_mol = 0;
else
cur_mol = ((i - num_atoms) % 7) + 1;
for (j=0; j<3; j++)
centr_coords[3*(8*label_mol[i]+cur_mol)+j] += coords[3*i+j];
}
at_in_mol = 0;
cur_mol = 0;
for (i=0; i<num_atoms; i++)
if (cur_mol != label_mol[i])
{
for (j=0; j<8; j++)
for (k=0; k<3; k++)
centr_coords[3*(8*cur_mol+j)+k] = centr_coords[3*(8*cur_mol+j)+k] / at_in_mol;
at_in_mol = 0;
cur_mol = label_mol[i];
}
else
at_in_mol++;
return 0;
}

View File

@ -1,14 +0,0 @@
/**
* @file
*/
#ifndef SET_CENTER_H
#define SET_CENTER_H
/**
* @fn set_center
*/
int set_center (const int, const int, const int *, const float *, float *);
#endif /* SET_CENTER_H */

View File

@ -1,28 +0,0 @@
cmake_minimum_required (VERSION 2.8)
cmake_policy (SET CMP0003 OLD)
cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
# set project name
set (PROJECT ${MM_PREFIX}radf)
set (_PROJECT mm_radf)
# set additional cmake file
include (${_PROJECT}.cmake)
# set libraries
set (LIBRARIES)
foreach (LIBRARY ${LIBRARIES})
find_library ("${LIBRARY}_FOUND" ${LIBRARY})
message (STATUS "Check the ${LIBRARY} is installed: " ${${LIBRARY}_FOUND})
if ("${${LIBRARY}_FOUND}" STREQUAL "${LIBRARY}_FOUND-NOTFOUND")
message (STATUS "Adding library sources")
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
endif ()
endforeach ()
# additional targets
set (TARGETS "")
set (HEADERS "")
add_subdirectory (${PROJECT_SOURCE_DIR})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,20 +0,0 @@
PROJECT=RADF
CC=gcc
CFLAGS=-c -Wall -fPIC
LDFLAGS=-lm
SOURCES_DIR=src
SOURCES=main.c add_main.c coords.c messages.c radf.c radf_proc.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=mm_radf
$(PROJECT): $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -f *.o test*

View File

@ -1,354 +0,0 @@
/**
* @file
*/
#include <stdio.h>
#include <stdlib.h>
/**
* @fn reading_coords
*/
int reading_coords (const int mode, const char *filename, const int type_inter,
const int *label_atom, const float *cell, int *num_mol,
int *num_atoms, int *true_label_mol, int *label_mol,
int *type_atoms, float *coords, char *ch_type_atoms)
/**
* @brief function that reads coordinates from special file format
* @code
* reading_coords (0, filename, type_inter, label_atom, cell, &num_mol, &num_atoms,
* true_label_mol, label_mol, type_atoms, coords, ch_type_atoms);
* @endcode
*
* @param mode mode of reading; '1' is statgen, '2' is envir or
* frad, '3' is agl
* @param filename input file name
* @param type_inter number of needed atoms
* (number of needed molecules)
* @param label_atom massive of needed atom types
* (massive of needed molecules)
* @param cell massive of cell size
* @param num_mol number of molecules
* @param num_atoms number of atoms
* @param true_label_mol massive of true numbers of molecule for atoms
* @param label_mol massive of numbers of molecule for atoms
* @param type_atoms massive of atom types
* @param coords massive of coordinates
* @param ch_type_atoms massive of char atom types
*
* @return 1 - file $filename does not exist
* @return 2 - unknown mode
* @return 0 - exit without errors
*/
{
char at_symb[32], file_string[256];
int atoms, cur_at_num, cur_at_type, cur_mol, i, j, tr_num_atoms, ref_mol, x, y;
float cur_coords[3], *not_tr_coords, ref[3];
FILE *inp;
/* cur_* temp variables
* at_symb temp variable
* file_string temp string variable
* atoms total number of atoms in system
* tr_num_atoms number of translated atoms (must be 8*num_atoms)
* ref_mol number of molecule for reference in translation
* not_tr_coords massive of not translated coordinates
* ref massive of coordinates of reference molecule
* inp input file
*/
/// <b>Work blocks</b>
*num_atoms = 0;
*num_mol = 0;
/// <pre> reading file </pre>
inp = fopen (filename, "r");
if (inp == NULL)
return 1;
ref_mol = -1;
fscanf (inp, "%i", &atoms);
not_tr_coords = (float *) malloc (3 * atoms * sizeof (float));
fgets (file_string, 256, inp);
for (i=0; i<atoms; i++)
{
fgets (file_string, 256, inp);
sscanf (file_string, "%i%s%f%f%f%i%i", &cur_at_num, at_symb, &cur_coords[0],
&cur_coords[1], &cur_coords[2], &cur_at_type, &cur_mol);
// reading variables according to selected mode
switch (mode)
{
case 0:
// mode == 0 (selected atoms)
for (j=0; j<type_inter; j++)
if (cur_at_type == label_atom[j])
{
not_tr_coords[3**num_atoms+0] = cur_coords[0];
not_tr_coords[3**num_atoms+1] = cur_coords[1];
not_tr_coords[3**num_atoms+2] = cur_coords[2];
if (ref_mol != cur_mol)
{
ref_mol = cur_mol;
true_label_mol[*num_mol] = ref_mol;
*num_mol = *num_mol + 1;
}
label_mol[*num_atoms] = *num_mol - 1;
type_atoms[*num_atoms] = j;
*num_atoms = *num_atoms + 1;
}
break;
case 1:
// mode == 1 (all atoms)
not_tr_coords[3**num_atoms+0] = cur_coords[0];
not_tr_coords[3**num_atoms+1] = cur_coords[1];
not_tr_coords[3**num_atoms+2] = cur_coords[2];
ch_type_atoms[2**num_atoms+0] = at_symb[0];
ch_type_atoms[2**num_atoms+1] = at_symb[1];
if (ref_mol != cur_mol)
{
ref_mol = cur_mol;
true_label_mol[*num_mol] = ref_mol;
*num_mol = *num_mol + 1;
}
label_mol[*num_atoms] = *num_mol - 1;
type_atoms[*num_atoms] = j;
*num_atoms = *num_atoms + 1;
break;
case 2:
// mode == 2 (selected molecules)
for (j=0; j<type_inter; j++)
if (cur_mol == label_atom[j])
{
not_tr_coords[3**num_atoms+0] = cur_coords[0];
not_tr_coords[3**num_atoms+1] = cur_coords[1];
not_tr_coords[3**num_atoms+2] = cur_coords[2];
ch_type_atoms[2**num_atoms+0] = at_symb[0];
ch_type_atoms[2**num_atoms+1] = at_symb[1];
if (ref_mol != cur_mol)
{
ref_mol = cur_mol;
true_label_mol[*num_mol] = ref_mol;
*num_mol = *num_mol + 1;
}
label_mol[*num_atoms] = *num_mol - 1;
type_atoms[*num_atoms] = j;
*num_atoms = *num_atoms + 1;
}
break;
default: return 2;
}
}
fclose (inp);
/// <pre> translation </pre>
tr_num_atoms = *num_atoms;
for (i=0; i<*num_atoms; i++)
for (j=0; j<3; j++)
coords[3*i+j] = not_tr_coords[3*i+j];
// assign initial value to reference coordinates
ref_mol = label_mol[0];
for (i=0; i<3; i++)
ref[i] = coords[3*0+i];
for (i=0; i<*num_atoms; i++)
{
if (label_mol[i] != ref_mol)
{
ref_mol = label_mol[i];
for (j=0; j<3; j++)
ref[j] = not_tr_coords[3*i+j];
}
for (x=0; x<3; x++)
{
if (ref[x] >= 0.0)
// if xyz >= 0.0 A
{
for (j=0; j<3; j++)
if (j == x)
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j];
else
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
else
// if xyz < 0.0 A
{
for (j=0; j<3; j++)
if (j == x)
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j];
else
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
}
for (x=0; x<3; x++)
{
for (y=x+1; y<3; y++)
{
if ((ref[x] >= 0.0) && (ref[y] >= 0.0))
// if xyz and xyz >= 0.0 A
{
for (j=0; j<3; j++)
if ((j == x) || (j == y))
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j];
else
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[x] < 0.0) && (ref[y] < 0.0))
// if xyz and xyz < 0.0 A
{
for (j=0; j<3; j++)
if ((j == x) || (j == y))
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j];
else
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
}
for (y=0; y<3; y++)
if ((ref[x] < 0.0) && (ref[y] >= 0.0))
// if xyz OR xyz >= 0.0
{
for (j=0; j<3; j++)
{
if (j == x)
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] + cell[j];
if (j == y)
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j] - cell[j];
if ((j != x) && (j != y))
coords[3*tr_num_atoms+j] = not_tr_coords[3*i+j];
}
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
}
if ((ref[0] >= 0.0) && (ref[1] >= 0.0) && (ref[2] >= 0.0))
// if x and y and z >= 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] >= 0.0) && (ref[1] >= 0.0) && (ref[2] < 0.0))
// if x and y >= 0.0 A and z < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] >= 0.0) && (ref[1] < 0.0) && (ref[2] >= 0.0))
// if x and z >= 0.0 A and y < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] < 0.0) && (ref[1] >= 0.0) && (ref[2] >= 0.0))
// if y and z >= 0.0 A and x < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] < 0.0) && (ref[1] < 0.0) && (ref[2] >= 0.0))
// if x and y < 0.0 A and z >= 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] - cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] < 0.0) && (ref[1] >= 0.0) && (ref[2] < 0.0))
// if x and z < 0.0 A and y >= 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] - cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] >= 0.0) && (ref[1] < 0.0) && (ref[2] < 0.0))
// if x >= 0.0 A and y and z < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] - cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
if ((ref[0] < 0.0) && (ref[1] < 0.0) && (ref[2] < 0.0))
// if x and y and z < 0.0 A
{
coords[3*tr_num_atoms+0] = not_tr_coords[3*i+0] + cell[0];
coords[3*tr_num_atoms+1] = not_tr_coords[3*i+1] + cell[1];
coords[3*tr_num_atoms+2] = not_tr_coords[3*i+2] + cell[2];
label_mol[tr_num_atoms] = label_mol[i];
type_atoms[tr_num_atoms] = type_atoms[i];
tr_num_atoms++;
}
}
/// <pre> free memory </pre>
free (not_tr_coords);
return 0;
}

View File

@ -1,16 +0,0 @@
/**
* @file
*/
#ifndef COORDS_H
#define COORDS_H
/**
* @fn reading_coords
*/
int reading_coords (const int, const char *, const int, const int *,
const float *, int *, int *, int *, int *, int *, float *,
char *);
#endif /* COORDS_H */

View File

@ -1,119 +0,0 @@
/**
* @file
*/
#include <stdio.h>
#include <time.h>
/**
* @fn message
*/
int message (const int log, const int mode, const char *text, FILE *output)
/**
* @brief function that prints messages to output
* @code
* message (log, mode, text, output);
* @endcode
*
* @param log equal to 1 if print to logfile
* @param mode number of message
* @param text additional text
* @param output output file (may be stdout)
*
* @return 1 - unknown mode
* @return 0 - exit without errors
*/
{
char out[4096];
if (log == 1)
{
char time_str[256];
time_t t = time (NULL);
struct tm* aTm = localtime (&t);
sprintf (time_str, "[%04d-%02d-%02d %02d:%02d:%02d] [%2i]: ", aTm->tm_year+1900,
aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec, mode);
fputs (time_str, output);
}
switch (mode)
{
case 0:
sprintf (out, "Start program: '%s'\n", text);
break;
case 1:
sprintf (out, "Checking errors\n");
break;
case 2:
sprintf (out, "Errors are not detected\n");
break;
case 3:
sprintf (out, "Initialization of variables from file '%s'\n", text);
break;
case 4:
sprintf (out, "%6cAgglomerate was selected successfully\n", ' ');
break;
case 5:
sprintf (out, "Initial parametrs: \n%s", text);
break;
case 6:
sprintf (out, "Processing\n");
break;
case 7:
sprintf (out, "Open file: '%s'\n", text);
break;
case 8:
sprintf (out, "%s", text);
break;
case 9:
sprintf (out, "%6cSize of variables was changed successfully\n", ' ');
break;
case 10:
sprintf (out, "%6cConnectivity matrix was created successfully\n", ' ');
break;
case 11:
sprintf (out, "%6cConnectivity matrix was processed successfully\n", ' ');
break;
case 12:
sprintf (out, "%6cResult was printed to file '%s' successfully\n", ' ', text);
break;
case 13:
sprintf (out, "End of processing\n");
break;
case 14:
sprintf (out, "Print result to file '%s'\n", text);
break;
case 15:
sprintf (out, "Free memory\n");
break;
case 16:
sprintf (out, "Exiting without errors\n");
break;
case 17:
sprintf (out, "Something wrong!\nSee '%s -h' for more details\n", text);
break;
case 18:
sprintf (out, "File '%s' not found\nError\n", text);
break;
case 19:
sprintf (out, "Memory error\n");
break;
case 20:
sprintf (out, "%6cCenter of molecules was set successfully\n", ' ');
break;
case 21:
sprintf (out, "%6cEnvironment was selected successfully\n", ' ');
break;
case 22:
sprintf (out, "%6cRADF was appended successfully\n", ' ');
break;
default:
return 1;
break;
}
fputs (out, output);
return 0;
}

View File

@ -1,14 +0,0 @@
/**
* @file
*/
#ifndef MESSAGES_H
#define MESSAGES_H
/**
* @fn message
*/
int message (const int, const int, const char *, FILE *);
#endif /* MESSAGES_H */

View File

@ -1,28 +0,0 @@
cmake_minimum_required (VERSION 2.8)
cmake_policy (SET CMP0003 OLD)
cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
# set project name
set (PROJECT ${MM_PREFIX}statgen)
set (_PROJECT mm_statgen)
# set additional cmake file
include (${_PROJECT}.cmake)
# set libraries
set (LIBRARIES)
foreach (LIBRARY ${LIBRARIES})
find_library ("${LIBRARY}_FOUND" ${LIBRARY})
message (STATUS "Check the ${LIBRARY} is installed: " ${${LIBRARY}_FOUND})
if ("${${LIBRARY}_FOUND}" STREQUAL "${LIBRARY}_FOUND-NOTFOUND")
message (STATUS "Adding library sources")
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
endif ()
endforeach ()
# additional targets
set (TARGETS "")
set (HEADERS "")
add_subdirectory (${PROJECT_SOURCE_DIR})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More