AmberFD

class AmberFD.AmberFD(*args)

AmberFD is an umbrella function thatcombines FlucDens force and DispersionPauli force settings into one accessable class. This class does not calculate forces itslf, but is instead used create and access the fluctuating density and dispersion-pauli system and set it’s options.

To use this class, first create an AmberFD object with the number of particles to be added to the system. The, add each particle to the system by calling add_particle(), passing in a ParticleInfo object. Once all particles have been added, create the fluctuating density force and dispersion-pauli force by calling create_fluc_dens_force() and create_disp_pauli_force(), respectively. Each of these forces will then be generated, and a pointer to each force can be obtained by calling get_fluc_dens_force() or get_disp_pauli_force().

Once the forces have been generated, adding new particles will have no effect on the system. Calling create_XXX_force() will simply return a pointer to the already created forces. If periodic boundary conditions are desired, then call set_use_PBC() after all particles have been added.

__init__(*args)

Overload 1:

Construct a new AmberFD force


Overload 2:

Construct a new AmberFD force with the number of particles already known. This can help speed up the system creation for very large numbers of particles. More particles can be added than n_sites, but the memory will not be preallocated.

Parameters

n_sites (int) – the estimated number of particles to create a system for

Methods

__init__(*args)

Overload 1:

add_fragment(frag_idx)

Set the indicies that define a fragment within the entire molecular system.

add_particle(index, parameters)

Add a new particle to the system with the properties specified in it's ParticleInfo

calc_energy_forces(positions)

Compute the energy and forces on the AmberFD system at the current positions.

calc_one_pair(positions, i, j)

Calculate the interaction between a single pair of particles. Since

create_disp_pauli_force()

Create a DispersionPauli force object. Adding particles to the system

create_fluc_dens_force()

Create a FlucDens force object. Adding particles to the system

dump_to_file(file_loc)

Serialize force FlucDens and DisperionPauli forces to a file

getDeltaR(positions, i, j)

Get the distance object between two pairs of particles.

get_disp_pauli_force([create_if_null])

Get a pointer to the DispersionPauli force object being used

get_fluc_dens_force([create_if_null])

Get a pointer to the FlucDens force object being used

get_forces()

Return the forces exerted on each particle.

get_index_mapping()

Get the a mapping from the OpenMM particle index to

get_num_particles()

Get the number of particles in the system

get_parallel_time()

Get the cumulative wall time used to compute forces and energies so far.

get_use_PBC()

Determine of the periodic doundary contitions are used or not

load_from_file(file_loc)

Load in serialized data previously created with dump_to_file()

set_threads(n_threads)

Set the number of threads to be used in force computations vis OpenMP.

set_use_PBC(*args)

Overload 1:

Attributes

thisown

The membership flag

property thisown

The membership flag

add_particle(index, parameters)

Add a new particle to the system with the properties specified in it’s ParticleInfo

Parameters
Return type

int

Returns

index of the particle added

add_fragment(frag_idx)

Set the indicies that define a fragment within the entire molecular system.

Parameters

frag_idx (vec_i) –

get_num_particles()

Get the number of particles in the system

Return type

int

Returns

int

get_forces()

Return the forces exerted on each particle. This will only have an effect if calc_energy_forces has been called forst with the updated positions. Else, this will return the forces most recently computed.

Return type

std::vector< vec_d,std::allocator< vec_d > >

Returns

std::vector<vec_d>

calc_energy_forces(positions)

Compute the energy and forces on the AmberFD system at the current positions.

Parameters

positions (vec_d) – 1-D array of positions (in a.u.)

Return type

Energies

Returns

Energies object

get_fluc_dens_force(create_if_null=False)

Get a pointer to the FlucDens force object being used

Parameters

create_if_null (boolean) – create the force if it hasn’t been created yet.

Return type

FlucDens

Returns

std::shared_ptr<FlucDens>

get_disp_pauli_force(create_if_null=False)

Get a pointer to the DispersionPauli force object being used

Parameters

create_if_null (boolean) – create the force if it hasn’t been created yet.

Return type

DispersionPauli

Returns

std::shared_ptr<DispersionPauli>

create_fluc_dens_force()
Create a FlucDens force object. Adding particles to the system

After creating this force will have no effect.

Return type

FlucDens

Returns

std::shared_ptr<FlucDens> a pointer to the created force

create_disp_pauli_force()
Create a DispersionPauli force object. Adding particles to the system

After creating this force will have no effect.

Return type

DispersionPauli

Returns

std::shared_ptr<DispersionPauli> a pointer to the created force

get_index_mapping()
Get the a mapping from the OpenMM particle index to

the AmberFD particle index.

Return type

std::map< int,int,std::less< int >,std::allocator< std::pair< int const,int > > >

Returns

std::map<int, int>

calc_one_pair(positions, i, j)
Calculate the interaction between a single pair of particles. Since

Polarization is a many-body force, it will not be calculated here.

Parameters
  • positions (vec_d) – The full array of positions of the system that would normally be passed to calc_energy_forces()

  • i (int) – The index of the first particle

  • j (int) – The index of the second particle

Return type

Energies

Returns

Energies The energies of the pair

getDeltaR(positions, i, j)

Get the distance object between two pairs of particles.

Parameters
  • positions (vec_d) – The full array of positions of the system that would normally be passed to calc_energy_forces()

  • i (int) – The index of the first particle

  • j (int) – The index of the second particle

Return type

DeltaR

Returns

DeltaR

set_use_PBC(*args)

Overload 1:

Turn on or off the use of periodic boundary conditions.

Parameters

is_periodic (boolean) –


Overload 2:

Turn on or off the use of periodic boundary conditions.

Parameters
  • is_periodic (boolean) –

  • x (float) – The x-direction box length

  • y (float) – The y-direction box length

  • z (float) – The z-direction box length

get_use_PBC()

Determine of the periodic doundary contitions are used or not

Return type

boolean

Returns

true

Return type

boolean

Returns

false

dump_to_file(file_loc)

Serialize force FlucDens and DisperionPauli forces to a file

Parameters

file_loc (string) – String of the file location to write data to.

load_from_file(file_loc)

Load in serialized data previously created with dump_to_file()

Parameters

file_loc (string) – String of the file location to load.

set_threads(n_threads)
Set the number of threads to be used in force computations vis OpenMP.

If set less than or equal to one, then a serial calculation will take place.

Parameters

n_threads (int) – Number of threads to use

get_parallel_time()

Get the cumulative wall time used to compute forces and energies so far.

Return type

float

Returns

Wall time in second