GLYLIB  0.3.0b
write_amber_prmtop.c File Reference
#include <AMBER/amber.h>
Include dependency graph for write_amber_prmtop.c:

Go to the source code of this file.

Functions

void write_amber_prmtop (fileset F, amber_prmtop *P)

Detailed Description

Writes out an amber prmtop file.

There should be an amber_prmtop structure available that contains the proper information. It is up to the calling function to make any needed modifications to that structure. See also the read_amber_prmtop function. The typical flow goes something like this:

  1. Read an amber prmtop file using read_amber_prmtop
    • The entire contents of the original file can be found in the void pointer. See the documentation on use of the void pointer.
  2. Decide which parts to change and which parts of the original file to include in the output file.
    • Note that not all parts of the original file are necessarily parsed into the assembly structure. See parse_amber_prmtop for more info.
  3. Copy the updated prmtop contents to an amber_prmtop struct.
    • It is probably safest to make a new amber-prmtop struct for the changed info.
    • If memory space is an issue, the information can be written back into the void pointer. Alternately, and better, a new prmtop can be generated and the old one (in the void pointer) can be freed.
  4. Call this function to write an amber prmtop file out.

Note, also, that the amber_prmtop struct contains content and formatting information. It is the duty of the calling program to get that right. This function will provide only internal checks -- that it, it will make sure that the string lengths match the data information. **But** it will get formatting information from the interpreted units in the amber_prmtop_section structure and -not- from the original formatting string. **However** it will write the original string in *FORMAT out to the file. So, make sure there is a match.

Definition in file write_amber_prmtop.c.


Function Documentation

void write_amber_prmtop ( fileset  F,
amber_prmtop P 
)

Open the file

Write the version info

Loop through all the sections

  • Check that each string length matches the format length
  • Check that the number of units matches the length of the array **D
  • Write the required number per lie
  • Write the contents

Definition at line 33 of file write_amber_prmtop.c.

References amber_prmtop_section::D, fileset::F, amber_prmtop_section::FORMAT, myfopen(), mywhine(), fileset::N, amber_prmtop_section::N, amber_prmtop_section::npl, amber_prmtop::nS, amber_prmtop_section::nt, amber_prmtop::S, and amber_prmtop::VERSION.

Here is the call graph for this function:

 All Classes Files Functions Variables Typedefs Defines