forked from lijiext/lammps
Merge branch 'master' into doc-adjust3
This commit is contained in:
commit
c42d07d907
|
@ -176,7 +176,6 @@ $(VENV):
|
|||
$(VIRTUALENV) -p $(PYTHON) $(VENV); \
|
||||
. $(VENV)/bin/activate; \
|
||||
pip install Sphinx; \
|
||||
pip install sphinxcontrib-images; \
|
||||
deactivate;\
|
||||
)
|
||||
|
||||
|
|
|
@ -55,11 +55,11 @@ required changes or ask the submitter of the pull request to implement
|
|||
them. Even though, all LAMMPS developers may have write access to pull
|
||||
requests (if enabled by the submitter, which is the default), only the
|
||||
submitter or the assignee of a pull request may do so. During this
|
||||
period the "work_in_progress" label shall be applied to the pull
|
||||
period the `work_in_progress` label shall be applied to the pull
|
||||
request. The assignee gets to decide what happens to the pull request
|
||||
next, e.g. whether it should be assigned to a different developer for
|
||||
additional checks and changes, or is recommended to be merged. Removing
|
||||
the "work_in_progress" label and assigning the pull request to the
|
||||
the `work_in_progress` label and assigning the pull request to the
|
||||
developer tasked with merging signals that a pull request is ready to be
|
||||
merged.
|
||||
|
||||
|
@ -145,6 +145,9 @@ Here are some items to check:
|
|||
compiling LAMMPS with `-DLAMMPS_BIGBIG`.
|
||||
* when including both `lmptype.h` (and using defines or macros from it)
|
||||
and `mpi.h`, `lmptype.h` must be included first.
|
||||
* when pair styles are added, check if settings for flags like
|
||||
`single_enable`, `writedata`, `reinitflag`, `manybody_flag`
|
||||
and others are correctly set and supported.
|
||||
|
||||
## GitHub Issues
|
||||
|
||||
|
|
|
@ -510,10 +510,13 @@ each processor, instead of 4, and "SQUARES" replaced by "CUBES".
|
|||
For 2d simulations, the {z} style cannot be used. Nor can a "z"
|
||||
appear in {dimstr} for the {shift} style.
|
||||
|
||||
Balancing through recursive bisectioning ({rcb} style) requires
|
||||
"comm_style tiled"_comm_style.html
|
||||
|
||||
[Related commands:]
|
||||
|
||||
"group"_group.html, "processors"_processors.html,
|
||||
"fix balance"_fix_balance.html
|
||||
"fix balance"_fix_balance.html, "comm_style"_comm_style.html
|
||||
|
||||
[Default:] none
|
||||
:link(pizza,http://pizza.sandia.gov)
|
||||
|
|
|
@ -51,7 +51,10 @@ decomposition will be the same, as described by
|
|||
commands. The decomposition can be changed via the
|
||||
"balance"_balance.html or "fix balance"_fix_balance.html commands.
|
||||
|
||||
[Restrictions:] none
|
||||
[Restrictions:]
|
||||
|
||||
Communication style {tiled} cannot be used with {triclinic} simulation
|
||||
cells.
|
||||
|
||||
[Related commands:]
|
||||
|
||||
|
|
|
@ -371,9 +371,13 @@ minimization"_minimize.html.
|
|||
For 2d simulations, the {z} style cannot be used. Nor can a "z"
|
||||
appear in {dimstr} for the {shift} style.
|
||||
|
||||
Balancing through recursive bisectioning ({rcb} style) requires
|
||||
"comm_style tiled"_comm_style.html
|
||||
|
||||
[Related commands:]
|
||||
|
||||
"group"_group.html, "processors"_processors.html, "balance"_balance.html
|
||||
"group"_group.html, "processors"_processors.html, "balance"_balance.html,
|
||||
"comm_style"_comm_style.html
|
||||
|
||||
[Default:] none
|
||||
:link(pizza,http://pizza.sandia.gov)
|
||||
|
|
|
@ -196,19 +196,25 @@ the options you need each time. This command cannot be used a 2nd
|
|||
time incrementally. E.g. these two commands:
|
||||
|
||||
special_bonds lj 0.0 1.0 1.0
|
||||
special_bonds coul 0.0 0.0 1.0
|
||||
special_bonds coul 0.0 0.0 1.0 :pre
|
||||
|
||||
are not the same as
|
||||
|
||||
special_bonds lj 0.0 1.0 1.0 coul 0.0 0.0 1.0
|
||||
special_bonds lj 0.0 1.0 1.0 coul 0.0 0.0 1.0 :pre
|
||||
|
||||
In the first case you end up with (after the 2nd command):
|
||||
|
||||
LJ: 0.0 0.0 0.0
|
||||
Coul: coul 0.0 0.0 1.0
|
||||
Coul: 0.0 0.0 1.0 :pre
|
||||
|
||||
because the LJ settings are reset to their default values
|
||||
each time the command is issued.
|
||||
while only in the second case, you get the desired settings of:
|
||||
|
||||
LJ: 0.0 1.0 1.0
|
||||
Coul: 0.0 0.0 1.0 :pre
|
||||
|
||||
This happens because the LJ (and Coul) settings are reset to
|
||||
their default values before modifying them, each time the
|
||||
{special_bonds} command is issued.
|
||||
|
||||
[Restrictions:] none
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ latex_documents = [
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('Manual', 'liggghts', 'LAMMPS Documentation',
|
||||
('Manual', 'lammps', 'LAMMPS Documentation',
|
||||
['Steve Plimpton'], 1)
|
||||
]
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <mpi.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "msg.h"
|
||||
|
||||
|
@ -23,7 +23,7 @@ using namespace CSLIB_NS;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Msg::Msg(int csflag, const void *ptr, MPI_Comm cworld)
|
||||
Msg::Msg(int csflag, const void * /* ptr */, MPI_Comm cworld)
|
||||
{
|
||||
world = cworld;
|
||||
MPI_Comm_rank(world,&me);
|
||||
|
@ -34,7 +34,7 @@ Msg::Msg(int csflag, const void *ptr, MPI_Comm cworld)
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Msg::Msg(int csflag, const void *ptr)
|
||||
Msg::Msg(int csflag, const void * /* ptr */)
|
||||
{
|
||||
world = 0;
|
||||
me = 0;
|
||||
|
@ -57,7 +57,7 @@ void Msg::init(int csflag)
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Msg::allocate(int nheader, int &maxheader, int *&header,
|
||||
int nbuf, int &maxbuf, char *&buf)
|
||||
int nbuf, int &maxbuf, char *&buf)
|
||||
{
|
||||
if (nheader > maxheader) {
|
||||
sfree(header);
|
||||
|
|
|
@ -463,8 +463,8 @@ int MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
|
|||
/* copy values from data1 to data2 */
|
||||
|
||||
int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
|
||||
MPI_Datatype datatype, MPI_Op op,
|
||||
int root, MPI_Comm comm)
|
||||
MPI_Datatype datatype, MPI_Op op,
|
||||
int root, MPI_Comm comm)
|
||||
{
|
||||
int n = count * stubtypesize(datatype);
|
||||
|
||||
|
@ -550,8 +550,8 @@ int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
|||
/* copy values from data1 to data2 */
|
||||
|
||||
int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
void *recvbuf, int *recvcounts, int *displs,
|
||||
MPI_Datatype recvtype, int root, MPI_Comm comm)
|
||||
void *recvbuf, int *recvcounts, int *displs,
|
||||
MPI_Datatype recvtype, int root, MPI_Comm comm)
|
||||
{
|
||||
int n = sendcount * stubtypesize(sendtype);
|
||||
|
||||
|
@ -581,8 +581,8 @@ int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
|||
/* copy values from data1 to data2 */
|
||||
|
||||
int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
|
||||
MPI_Datatype sendtype, void *recvbuf, int recvcount,
|
||||
MPI_Datatype recvtype, int root, MPI_Comm comm)
|
||||
MPI_Datatype sendtype, void *recvbuf, int recvcount,
|
||||
MPI_Datatype recvtype, int root, MPI_Comm comm)
|
||||
{
|
||||
int n = recvcount * stubtypesize(recvtype);
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ using namespace LAMMPS_NS;
|
|||
|
||||
PairILPGrapheneHBN::PairILPGrapheneHBN(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
writedata = 1;
|
||||
restartinfo = 0;
|
||||
|
||||
// initialize element to parameter maps
|
||||
|
|
|
@ -46,8 +46,6 @@ using namespace LAMMPS_NS;
|
|||
|
||||
PairKolmogorovCrespiFull::PairKolmogorovCrespiFull(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
writedata = 1;
|
||||
|
||||
// initialize element to parameter maps
|
||||
nelements = 0;
|
||||
elements = NULL;
|
||||
|
|
|
@ -42,7 +42,7 @@ using namespace LAMMPS_NS;
|
|||
|
||||
PairKolmogorovCrespiZ::PairKolmogorovCrespiZ(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
writedata = 1;
|
||||
single_enable = 0;
|
||||
restartinfo = 0;
|
||||
|
||||
// initialize element to parameter maps
|
||||
|
|
|
@ -68,6 +68,7 @@ static int srp_instance = 0;
|
|||
PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
writedata = 1;
|
||||
single_enable = 0;
|
||||
|
||||
if (lmp->citeme) lmp->citeme->add(cite_srp);
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ int PairReaxCOMP::write_reax_lists()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairReaxCOMP::read_reax_forces(int vflag)
|
||||
void PairReaxCOMP::read_reax_forces(int /* vflag */)
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for schedule(static) default(shared)
|
||||
|
|
|
@ -220,7 +220,8 @@ void Add_dBond_to_ForcesOMP( reax_system *system, int i, int pj,
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, simulation_data *data,
|
||||
void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj,
|
||||
simulation_data * /* data */,
|
||||
storage *workspace, reax_list **lists ) {
|
||||
reax_list *bonds = (*lists) + BONDS;
|
||||
bond_data *nbr_j, *nbr_k;
|
||||
|
@ -343,9 +344,9 @@ void Add_dBond_to_Forces_NPTOMP( reax_system *system, int i, int pj, simulation_
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int BOp_OMP( storage *workspace, reax_list *bonds, double bo_cut,
|
||||
int BOp_OMP( storage * /* workspace */, reax_list *bonds, double bo_cut,
|
||||
int i, int btop_i, far_neighbor_data *nbr_pj,
|
||||
single_body_parameters *sbp_i, single_body_parameters *sbp_j,
|
||||
single_body_parameters * /* sbp_i */, single_body_parameters * /* sbp_j */,
|
||||
two_body_parameters *twbp,
|
||||
int btop_j, double C12, double C34, double C56, double BO, double BO_s, double BO_pi, double BO_pi2) {
|
||||
int j;
|
||||
|
@ -419,8 +420,8 @@ int BOp_OMP( storage *workspace, reax_list *bonds, double bo_cut,
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void BOOMP( reax_system *system, control_params *control, simulation_data *data,
|
||||
storage *workspace, reax_list **lists, output_controls *out_control )
|
||||
void BOOMP( reax_system *system, control_params * /* control */, simulation_data * /* data */,
|
||||
storage *workspace, reax_list **lists, output_controls * /* out_control */)
|
||||
{
|
||||
#ifdef OMP_TIMING
|
||||
double endTimeBase, startTimeBase;
|
||||
|
|
|
@ -42,9 +42,9 @@ using namespace LAMMPS_NS;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void BondsOMP( reax_system *system, control_params *control,
|
||||
void BondsOMP( reax_system *system, control_params * /* control */,
|
||||
simulation_data *data, storage *workspace, reax_list **lists,
|
||||
output_controls *out_control )
|
||||
output_controls * /* out_control */)
|
||||
{
|
||||
#ifdef OMP_TIMING
|
||||
double endTimeBase, startTimeBase;
|
||||
|
|
|
@ -79,7 +79,7 @@ void Init_Force_FunctionsOMP( control_params *control )
|
|||
void Compute_Bonded_ForcesOMP( reax_system *system, control_params *control,
|
||||
simulation_data *data, storage *workspace,
|
||||
reax_list **lists, output_controls *out_control,
|
||||
MPI_Comm comm )
|
||||
MPI_Comm /* comm */)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -105,7 +105,7 @@ void Compute_Bonded_ForcesOMP( reax_system *system, control_params *control,
|
|||
void Compute_NonBonded_ForcesOMP( reax_system *system, control_params *control,
|
||||
simulation_data *data, storage *workspace,
|
||||
reax_list **lists, output_controls *out_control,
|
||||
MPI_Comm comm )
|
||||
MPI_Comm /* comm */)
|
||||
{
|
||||
/* van der Waals and Coulomb interactions */
|
||||
#ifdef OMP_TIMING
|
||||
|
@ -133,7 +133,7 @@ void Compute_NonBonded_ForcesOMP( reax_system *system, control_params *control,
|
|||
Saves enormous time & space! */
|
||||
void Compute_Total_ForceOMP( reax_system *system, control_params *control,
|
||||
simulation_data *data, storage *workspace,
|
||||
reax_list **lists, mpi_datatypes *mpi_data )
|
||||
reax_list **lists, mpi_datatypes * /* mpi_data */)
|
||||
{
|
||||
#ifdef OMP_TIMING
|
||||
double startTimeBase,endTimeBase;
|
||||
|
@ -262,7 +262,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control,
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Validate_ListsOMP( reax_system *system, storage *workspace, reax_list **lists,
|
||||
void Validate_ListsOMP( reax_system *system, storage * /*workspace */, reax_list **lists,
|
||||
int step, int n, int N, int numH, MPI_Comm comm )
|
||||
{
|
||||
int i, comp, Hindex;
|
||||
|
@ -329,7 +329,7 @@ void Validate_ListsOMP( reax_system *system, storage *workspace, reax_list **lis
|
|||
|
||||
void Init_Forces_noQEq_OMP( reax_system *system, control_params *control,
|
||||
simulation_data *data, storage *workspace,
|
||||
reax_list **lists, output_controls *out_control,
|
||||
reax_list **lists, output_controls * /* out_control */,
|
||||
MPI_Comm comm ) {
|
||||
#ifdef OMP_TIMING
|
||||
double startTimeBase, endTimeBase;
|
||||
|
|
|
@ -45,7 +45,7 @@ using namespace LAMMPS_NS;
|
|||
|
||||
void Hydrogen_BondsOMP( reax_system *system, control_params *control,
|
||||
simulation_data *data, storage *workspace,
|
||||
reax_list **lists, output_controls *out_control )
|
||||
reax_list **lists, output_controls * /* out_control */)
|
||||
{
|
||||
#ifdef OMP_TIMING
|
||||
double endTimeBase, startTimeBase;
|
||||
|
|
|
@ -48,8 +48,8 @@ extern int Init_Workspace(reax_system*, control_params*, storage*, MPI_Comm, cha
|
|||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int Init_ListsOMP( reax_system *system, control_params *control,
|
||||
simulation_data *data, storage *workspace, reax_list **lists,
|
||||
mpi_datatypes *mpi_data, char *msg )
|
||||
simulation_data * /* data */, storage * /* workspace */,
|
||||
reax_list **lists, mpi_datatypes *mpi_data, char * /* msg */)
|
||||
{
|
||||
int i, total_hbonds, total_bonds, bond_cap, num_3body, cap_3body, Htop;
|
||||
int *hb_top, *bond_top;
|
||||
|
|
|
@ -42,9 +42,9 @@ using namespace LAMMPS_NS;
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Atom_EnergyOMP( reax_system *system, control_params *control,
|
||||
void Atom_EnergyOMP( reax_system *system, control_params * /* control */,
|
||||
simulation_data *data, storage *workspace, reax_list **lists,
|
||||
output_controls *out_control )
|
||||
output_controls * /* out_control */)
|
||||
{
|
||||
#ifdef OMP_TIMING
|
||||
double endTimeBase, startTimeBase;
|
||||
|
|
|
@ -47,8 +47,8 @@ using namespace LAMMPS_NS;
|
|||
|
||||
void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
|
||||
simulation_data *data, storage *workspace,
|
||||
reax_list **lists, output_controls *out_control ) {
|
||||
|
||||
reax_list **lists, output_controls * /* out_control */ )
|
||||
{
|
||||
int natoms = system->n;
|
||||
reax_list *far_nbrs = (*lists) + FAR_NBRS;
|
||||
double p_vdW1 = system->reax_param.gp.l[28];
|
||||
|
@ -254,7 +254,7 @@ void vdW_Coulomb_Energy_OMP( reax_system *system, control_params *control,
|
|||
void Tabulated_vdW_Coulomb_Energy_OMP(reax_system *system,control_params *control,
|
||||
simulation_data *data, storage *workspace,
|
||||
reax_list **lists,
|
||||
output_controls *out_control ) {
|
||||
output_controls * /* out_control */) {
|
||||
|
||||
double SMALL = 0.0001;
|
||||
int natoms = system->n;
|
||||
|
|
|
@ -100,7 +100,7 @@ void Calculate_dCos_ThetaOMP( rvec dvec_ji, double d_ji, rvec dvec_jk, double d_
|
|||
played by j which sits in the middle of the other two. */
|
||||
void Valence_AnglesOMP( reax_system *system, control_params *control,
|
||||
simulation_data *data, storage *workspace,
|
||||
reax_list **lists, output_controls *out_control )
|
||||
reax_list **lists, output_controls * /* out_control */)
|
||||
{
|
||||
|
||||
#ifdef OMP_TIMING
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <climits>
|
||||
#include <algorithm>
|
||||
#include "ptm_graph_tools.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include "ptm_convex_hull_incremental.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
#include "ptm_graph_tools.h"
|
||||
#include "ptm_constants.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include <cassert>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include <cassert>
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include "ptm_quat.h"
|
||||
#include "ptm_polar.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include <cassert>
|
||||
|
|
|
@ -38,7 +38,7 @@ int Init_Output_Files( reax_system *system, control_params *control,
|
|||
output_controls *out_control, mpi_datatypes *mpi_data,
|
||||
char *msg )
|
||||
{
|
||||
char temp[MAX_STR];
|
||||
char temp[MAX_STR+8];
|
||||
int ret;
|
||||
|
||||
if( out_control->write_steps > 0 ){
|
||||
|
|
|
@ -43,7 +43,7 @@ int Tokenize( char* s, char*** tok )
|
|||
char *word;
|
||||
int count=0;
|
||||
|
||||
strncpy( test, s, MAX_LINE );
|
||||
strncpy( test, s, MAX_LINE-1);
|
||||
|
||||
for( word = strtok(test, sep); word; word = strtok(NULL, sep) ) {
|
||||
strncpy( (*tok)[count], word, MAX_LINE );
|
||||
|
|
|
@ -315,7 +315,7 @@ int Init_Traj( reax_system *system, control_params *control,
|
|||
output_controls *out_control, mpi_datatypes *mpi_data,
|
||||
char *msg )
|
||||
{
|
||||
char fname[MAX_STR];
|
||||
char fname[MAX_STR+8];
|
||||
int atom_line_len[ NR_OPT_ATOM ] = { 0, 0, 0, 0,
|
||||
ATOM_BASIC_LEN, ATOM_wV_LEN,
|
||||
ATOM_wF_LEN, ATOM_FULL_LEN };
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum {REGULAR_MODE, CLASS2_MODE};
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
called as write_coeff command in input script
|
||||
------------------------------------------------------------------------- */
|
||||
|
@ -50,6 +52,7 @@ void WriteCoeff::command(int narg, char **arg)
|
|||
if (comm->me == 0) {
|
||||
char str[256], coeff[256];
|
||||
FILE *one = fopen(file,"wb+");
|
||||
|
||||
if (one == NULL) {
|
||||
snprintf(str,256,"Cannot open coeff file %s",file);
|
||||
error->one(FLERR,str);
|
||||
|
@ -91,17 +94,78 @@ void WriteCoeff::command(int narg, char **arg)
|
|||
}
|
||||
fprintf(two,"# LAMMPS coeff file via write_coeff, version %s\n",
|
||||
universe->version);
|
||||
|
||||
while(1) {
|
||||
int coeff_mode = REGULAR_MODE;
|
||||
if (fgets(str,256,one) == NULL) break;
|
||||
|
||||
// some coeffs need special treatment
|
||||
if (strstr(str,"class2") != NULL) {
|
||||
if (strstr(str,"angle_style") != NULL)
|
||||
coeff_mode = CLASS2_MODE;
|
||||
else if (strstr(str,"dihedral_style") != NULL)
|
||||
coeff_mode = CLASS2_MODE;
|
||||
else if (strstr(str,"improper_style") != NULL)
|
||||
coeff_mode = CLASS2_MODE;
|
||||
}
|
||||
|
||||
const char *section = (const char *)"";
|
||||
fputs(str,two); // style
|
||||
fgets(str,256,one); // coeff
|
||||
n = strlen(str);
|
||||
strcpy(coeff,str);
|
||||
coeff[n-1] = '\0';
|
||||
fgets(str,256,one);
|
||||
|
||||
while (strcmp(str,"end\n") != 0) {
|
||||
fprintf(two,"%s %s",coeff,str);
|
||||
fgets(str,256,one);
|
||||
|
||||
if (coeff_mode == REGULAR_MODE) {
|
||||
|
||||
fprintf(two,"%s %s",coeff,str);
|
||||
fgets(str,256,one);
|
||||
|
||||
} else if (coeff_mode == CLASS2_MODE) {
|
||||
|
||||
// class2 angles, dihedrals, and impropers can have
|
||||
// multiple sections and thus need special treatment
|
||||
|
||||
if (strcmp(str,"\n") == 0) {
|
||||
|
||||
// all but the the last section end with an empty line.
|
||||
// skip it and read and parse the next section title
|
||||
|
||||
fgets(str,256,one);
|
||||
|
||||
if (strcmp(str,"BondBond Coeffs\n") == 0)
|
||||
section = (const char *)"bb";
|
||||
else if (strcmp(str,"BondAngle Coeffs\n") ==0)
|
||||
section = (const char *)"ba";
|
||||
else if (strcmp(str,"MiddleBondTorsion Coeffs\n") == 0)
|
||||
section = (const char *)"mbt";
|
||||
else if (strcmp(str,"EndBondTorsion Coeffs\n") == 0)
|
||||
section = (const char *)"ebt";
|
||||
else if (strcmp(str,"AngleTorsion Coeffs\n") == 0)
|
||||
section = (const char *)"at";
|
||||
else if (strcmp(str,"AngleAngleTorsion Coeffs\n") == 0)
|
||||
section = (const char *)"aat";
|
||||
else if (strcmp(str,"BondBond13 Coeffs\n") == 0)
|
||||
section = (const char *)"bb13";
|
||||
else if (strcmp(str,"AngleAngle Coeffs\n") == 0)
|
||||
section = (const char *)"aa";
|
||||
|
||||
fgets(str,256,one); // gobble up one more empty line
|
||||
fgets(str,256,one);
|
||||
}
|
||||
|
||||
// parse type number and skip over it
|
||||
int type = atoi(str);
|
||||
char *p = str;
|
||||
while ((*p != '\0') && (*p == ' ')) ++p;
|
||||
while ((*p != '\0') && isdigit(*p)) ++p;
|
||||
|
||||
fprintf(two,"%s %d %s %s",coeff,type,section,p);
|
||||
fgets(str,256,one);
|
||||
}
|
||||
}
|
||||
fputc('\n',two);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue