 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
26 "Usage: bwater [options] in.pdb out.pdb",
27 "--------------------------------------",
28 "Generates and does molecular dynamics on blocks of water.",
31 "-create rect Generate water, 1=random, 2=rectangular, 3=tetrahedral (use with -size option).",
32 "-rdf 0.05 Calculate the radial distribution function with the given sampling (angstrom).",
33 "-dynamics 4000 Number of iterations for molecular dynamics.",
36 "-verbose 7 Verbose output.",
38 "-size 10,10,10 Size for generating water (angstrom).",
39 "-wrap Wrap around (periodic boundaries).",
40 "-timestep 0.01 Integration time step (default 0.001).",
41 "-velocitylimit 0.01 Limit on the velocity (default 0.1 per time step).",
42 "-friction 0.2 Friction constant (default 1 = no friction).",
43 "-Kbond 150 Bond strength (default 1).",
44 "-Kangle 4 Angle strength (default 1).",
45 "-Kvdw 0.1 Van der Waals strength (default 0).",
46 "-Kelectrostatic 0.4 Electrostatic strength (default 0).",
47 "-cutoff 7.8 Distance cutoff for non-bonded forces (default 5 A).",
50 "-parameters md.star Molecular dynamics parameter file (default md_param.star).",
53 "-output param.star Output parameter file.",
58 int main(
int argc,
char **argv)
68 double timestep(0.001);
69 double velocitylimit(0.1);
77 Bstring paramfile(
"water_param.star");
83 for ( curropt = option; curropt; curropt = curropt->
next ) {
84 if ( curropt->
tag ==
"create" ) {
90 if ( curropt->
tag ==
"rdf" )
91 if ( ( rdf = curropt->
value.
real() ) < 0.01 )
92 cerr <<
"-rdf: A sampling interval must be specified!" << endl;
93 if ( curropt->
tag ==
"size" ) {
96 cerr <<
"-size: All three dimensions must be specified" << endl;
102 if ( curropt->
tag ==
"wrap" )
104 if ( curropt->
tag ==
"dynamics" )
106 cerr <<
"-dynamics: The number of iterations must be specified!" << endl;
107 if ( curropt->
tag ==
"timestep" )
108 if ( ( timestep = curropt->
value.
real() ) < 1e-30 )
109 cerr <<
"-timestep: The time step must be specified!" << endl;
110 if ( curropt->
tag ==
"velocitylimit" )
111 if ( ( velocitylimit = curropt->
value.
real() ) < 1e-30 )
112 cerr <<
"-velocitylimit: The velocity limit must be specified!" << endl;
113 if ( curropt->
tag ==
"friction" )
114 if ( ( Kfriction = curropt->
value.
real() ) < 1e-30 )
115 cerr <<
"-friction: The friction constant must be specified!" << endl;
116 if ( curropt->
tag ==
"Kbond" )
117 if ( ( Kbond = curropt->
value.
real() ) < 1e-30 )
118 cerr <<
"-Kbond: The bond strength must be specified!" << endl;
119 if ( curropt->
tag ==
"Kangle" )
120 if ( ( Kangle = curropt->
value.
real() ) < 1e-30 )
121 cerr <<
"-Kangle: The angle strength must be specified!" << endl;
122 if ( curropt->
tag ==
"Kelectrostatic" )
123 if ( ( Kelec = curropt->
value.
real() ) < 1e-30 )
124 cerr <<
"-Kelectrostatic: The electrostatic strength must be specified!" << endl;
125 if ( curropt->
tag ==
"Kvdw" )
126 if ( ( Kvdw = curropt->
value.
real() ) < 1e-30 )
127 cerr <<
"-Kvdw: The Van der Waals strength must be specified!" << endl;
128 if ( curropt->
tag ==
"cutoff" )
129 if ( ( cutoff = curropt->
value.
real() ) < 1e-30 )
130 cerr <<
"-cutoff: The cutoff distance must be specified!" << endl;
131 if ( curropt->
tag ==
"output" )
133 if ( curropt->
tag ==
"output" )
141 Bstring filename(argv[optind++]);
145 else if ( genwater > 1 )
149 if ( size[0] > 0 && size[1] > 0 && size[2] > 0 )
150 molgroup->
box = size;
152 molgroup->
box = molgroup->
max - molgroup->
min;
156 cerr <<
"Error: No molecule to work with!" << endl;
162 cerr <<
"Error: File " << paramfile <<
" not read!" << endl;
185 if ( molgroup->
mol && max_iter ) {
186 md_leapfrog(molgroup, md, max_iter, velocitylimit);
198 if ( optind < argc ) {
A class for a command line input option.
Bangle * water_angle_list(Bmolgroup *molgroup)
Generates a bond angle list for a block of waters.
Bbond * water_bond_list(Bmolgroup *molgroup)
Generates a bond list for a block of waters.
int molgroup_kill(Bmolgroup *molgroup)
Destroys a molecule group.
int molecule_update_comment(Bmolgroup *molgroup, int n, char **strings)
Puts a set of strings and time in the main comment of a molecule group.
int md_kill(Bmd *md)
Deallocates a molecular dynamics structure.
int bexit(int value)
Exit function for cleanup and debugging.
Header to read and write molecular dynamics parameters in STAR format.
Generating and managing water.
Boption * get_option_list(const char *use[], int argc, char *argv[], int &optind)
Parses command line arguments based on a template.
Bmolgroup * read_molecule(const char *filename, const char *select, const char *paramfile)
The generalized function for reading molecular files.
Header file for option handlers.
int molgroup_calc_water_rdf(Bmolgroup *molgroup, double interval, double cutoff)
Calculates a radial distribution function for water molecules.
Header for molecular dynamics.
Header file for reading reflection files.
Utilities for timing functions.
Bmolgroup * molgroup_generate_regular_water(Vector3< double > size, int type)
Generates a block of water based on a regular lattice.
double timer_start()
Starts timer and prints the time.
Header file for general utilities.
double molgroup_density(Bmolgroup *molgroup)
Calculates the number and mass density of a molecular system.
int main(int argc, char **argv)
Vector3< double > vector3()
double timer_report(double lasttime)
Reports the time elapsed since a given time.
int write_molecule(char *filename, Bmolgroup *molgroup)
Writes a molecule group.
Header file for generalized linked list functions.
Bmolgroup * molgroup_generate_random_water(Vector3< double > size)
Generates a block of water with random placement.
int option_kill(Boption *option)
Deallocates a linked list of option structures.
double md_leapfrog(Bmolgroup *molgroup, Bmd *md, int max_iter, double velocitylimit)
Molecular dynamics using the leapfrog integrator.
bool contains(const Bstring &s)
Bmd * read_md_parameters(Bstring &filename)
Reading molecular dynamics parameters from STAR files.
Header for molecular dynamics.
int write_md_parameters(Bstring &filename, Bmd *md)
Writing molecular dynamics parameters to a STAR file.
double md_calculate_deviations(Bmolgroup *molgroup, int wrap)
Calculates deviations from the reference bond lengths and angles.