parmed.amber.AmberFormat¶
-
class
parmed.amber.
AmberFormat
(fname=None)[source]¶ A class that can parse and print files stored in the Amber topology or MDL format. In particular, these files have the general form:
` %VERSION VERSION_STAMP = V00001.000 DATE = XX/XX/XX XX:XX:XX %FLAG <FLAG_NAME> %COMMENT <comments> %FORMAT(<Fortran_Format>) ... data corresponding to that Fortran Format %FLAG <FLAG_NAME2> %COMMENT <comments> %FORMAT(<Fortran_Format>) ... data corresponding to that Fortran Format `
where the %COMMENT sections are entirely optional
- Parameters
- fnamestr=None
If provided, this file is parsed and the data structures will be loaded from the data in this file
- Attributes
- parm_datadict {str
A dictionary that maps FLAG names to all of the data contained in that section of the Amber file.
- formatsdict {str
A dictionary that maps FLAG names to the FortranFormat instance in which the data is stored in that section
- parm_commentsdict {str
A dictionary that maps FLAG names to the list of COMMENT lines that were stored in the original file
- flag_listlist
An ordered list of all FLAG names. This must be kept synchronized with parm_data, formats, and parm_comments such that every item in flag_list is a key to those 3 dicts and no other keys exist
- charge_flagstr=’CHARGE’
The name of the name of the FLAG that describes partial atomic charge data. If this flag is found, then its data are multiplied by the ELECTROSTATIC_CONSTANT to convert back to fractions of electrons
- versionstr
The VERSION string from the Amber file
- namestr
The file name of the originally parsed file (set to the fname parameter)
Methods
add_flag
(flag_name, flag_format[, data, …])Adds a new flag with the given flag name and Fortran format string and initializes the array with the values given, or as an array of 0s of length num_items
delete_flag
(flag_name)Removes a flag from the topology file
id_format
(filename)Identifies the file type as either Amber-format file (like prmtop) or an old-style topology file.
parse
(filename, *args, **kwargs)Meant for use with the automatic file loader, this will automatically return a subclass of AmberFormat corresponding to what the information in the prmtop file contains (i.e., either an AmberParm, ChamberParm, AmoebaParm, or AmberFormat)
rdparm
(fname[, slow])Parses the Amber format file
rdparm_old
(prmtop_lines[, check])This reads an old-style topology file and stores the results in the same data structures as a new-style topology file
rdparm_slow
(fname)Parses the Amber format file.
Sets the version string
view_as
(cls)Returns a view of the current object as another object.
write_parm
(name)Writes the current data in parm_data into a new topology file with the given name
Methods
__init__
([fname])Constructor.
add_flag
(flag_name, flag_format[, data, …])Adds a new flag with the given flag name and Fortran format string and initializes the array with the values given, or as an array of 0s of length num_items
delete_flag
(flag_name)Removes a flag from the topology file
id_format
(filename)Identifies the file type as either Amber-format file (like prmtop) or an old-style topology file.
parse
(filename, *args, **kwargs)Meant for use with the automatic file loader, this will automatically return a subclass of AmberFormat corresponding to what the information in the prmtop file contains (i.e., either an AmberParm, ChamberParm, AmoebaParm, or AmberFormat)
rdparm
(fname[, slow])Parses the Amber format file
rdparm_old
(prmtop_lines[, check])This reads an old-style topology file and stores the results in the same data structures as a new-style topology file
rdparm_slow
(fname)Parses the Amber format file.
Sets the version string
view_as
(cls)Returns a view of the current object as another object.
write_parm
(name)Writes the current data in parm_data into a new topology file with the given name